User Guide

SAP AG November 2002
queue to be written to the log area. This behavior is always required for COMMIT [Page
129] and ROLLBACK [Page 147] operations.
If a transaction does wait for the redo log entry to be written, the log writer notifies the
transaction once the relevant page has been written from the log queue to the log area,
and informs the transaction of the log sequence number that was assigned when the log
page was written to the log area.
Log Page
The main storage units required for redo log management [Page 45] are the log pages. The
size of the log pages is 8 KB. A fixed number of log pages defined in the database parameter
LOG_IO_QUEUE [Page
84] forms the log queue [Page 45].
A transaction [Page
152] writes redo log entries [Page 44] to the log pages of the log
queues.
Each log page is assigned a log queue sequence number, which specifies the time at
which the redo log entries are written to the log queue.
If a log page is to be written to the log area [Page
142], the log writer [Page 46] is notified.
The log writer fetches the log pages in question from the log queue, and writes them to
the log area.
When each log page is written from the log queue to the log area, the log writer assigns it
a log sequence number and a time stamp. These log sequence numbers can then be
used to determine the unique sequence of the log pages in the log area. The time stamp
is needed for a point-in-time recovery.
A log page that was written by the log writer, but was not full, remains in the log queue and
can be filled with further redo log entries.
Log Writer
One active component of redo log management [Page 45] is the log writer.
The log writer is a user kernel thread (UKT) [Page
14]. When the database system is started,
it is initialized using permanently stored, internal configuration information. This configuration
information is written to the log area at regular intervals, in particular at a savepoint [Page
149].
A log queue [Page
45] is assigned to the log writer.
The log writer writes the log pages [Page
46] that are full, or have to be written as a result
of a COMMIT [Page 129] or ROLLBACK [Page 147], from the log queue to the log area
[Page 142]. The log pages are numbered (log sequence number), so that it is possible to
check that all log pages were written, and to ensure the correct working sequence in the
case of a restart [Page 146] or recovery. The log writer then notifies the transactions that
were waiting for their redo log entries [Page 44] to be written.
Log pages of the log queue that were not full when a write operation was performed
remain in the log queue and continue to be filled, and are written to the log area in a
subsequent write operation. The log writer is configured so that it always writes one and
the same log page to the same physical place.
The log writer regularly checks the state of the log area.
If the log area is full, the log writer locks the log queue so that all transactions that want to
enter redo log entries [Page
44] into the log queue are stopped.
User Manual: SAP DB 46