Home | Previous Page | Next Page   Logging and Log Administration > Logical Log > Logging Process >

Dbspace Logging

The database server uses the following logging process for operations that involve data stored in dbspaces:

  1. Read the data page from disk to the shared-memory page buffer.
  2. Copy the unchanged page to the physical-log buffer, if needed.
  3. Write the new data to the page buffer, and create a logical-log record of the transaction, if needed.
  4. Flush the physical-log buffer to the physical log on disk.
  5. Flush the logical-log buffer to a logical-log file on disk.
  6. Flush the page buffer, and write it back to disk.

Read Page into Shared-Memory Buffer Pool

In general, an insert or an update begins when a thread requests a row. The database server identifies the page on which the row resides and attempts to locate the page in the shared-memory buffer pool. If the page is not already in shared memory, the database server reads the page from disk. Database Server Thread Access to Buffer Pages explains this process in more detail.

Copy the Page Buffer to the Physical-Log Buffer

Before the database server modifies a dbspace data page for a nonfuzzy operation, it stores a copy of the unchanged page in the physical-log page buffer if it is needed for fast recovery. The database server eventually flushes the physical-log page buffer that contains this before-image to the physical log on disk. Until the database server performs a new checkpoint, subsequent modifications to the same page do not require another before-image to be stored in the physical-log buffer.

The database server knows if a page is already in the physical log. If the time stamp on the page is more recent than the time stamp for the last checkpoint, the page has been changed since the checkpoint and is therefore already in the physical log.

For fuzzy operations, the database server does not store a copy of the before-image of the page into the physical-log page buffer. For fast recovery, the database server finds the oldest update in the logical log. For more information, refer to Details of Fast Recovery After A Fuzzy Checkpoint.

Read Data into Buffer and Create Logical-Log Record

The thread that performs the modifications receives data from the application. After the database server stores a copy of the unchanged data page in the physical-log buffer, the thread writes the new data to the page buffer and writes records necessary to roll back or re-create the operation to the logical-log buffer. For more information, refer to When the Logical-Log Buffer Becomes Full.

Flush Physical-Log Buffer to the Physical Log

The database server must flush the physical-log buffer before it flushes the data buffer. Flushing the physical-log buffer ensures that a copy of the unchanged page is available until the changed page is written to the physical log. For more information, refer to Flushing the Physical-Log Buffer.

Flush Page Buffer

After the database server flushes the physical-log buffer, the database server flushes the data buffer and writes the modified data pages for non-fuzzy operations to disk at the next fuzzy checkpoint. The database server writes all the modified data pages to disk at the next full checkpoint, or when a page cleaner determines that the page should be written to disk. The database server does not flush the data buffer as the transaction is committed. For more information, see Flushing Data to Disk.

Flush Logical-Log Buffer

To flush the logical-log buffer, the database server writes the logical-log records to the current logical-log file on disk. For more information, see Flushing the Logical-Log Buffer.

For information on the criteria that must be satisfied before the database server frees a logical-log file for reuse, see Freeing of Logical-Log Files.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]