Information Technology Reference
In-Depth Information
specific log records are omitted. These include log records containing a copy of the
modified-page table written when taking a checkpoint at the primary server. Such
log records are of no use at the backup server, because the set of pages buffered at
the backup server at any time is different from that at the primary server. For one
thing, the backup server never fetches from disk a page that was only read but not
updated at the primary. Also, as explained below, the updates on different pages
may not be applied in exactly the same order in which they were performed at the
primary server.
The log records are stored in the log of the backup server with new
LSN
s, retain-
ing also the
LSN
s used at the primary server. A mapping from primary-server
LSN
s
to backup-server
LSN
s is maintained in a main-memory
primary-to-backup-
LSN
mapping table at the backup server. Before storing a log record, its
U
NDO
-N
EXT
-LSN
value, if any, is replaced by the corresponding backup-server
LSN
obtained from the
mapping table. The mapping table need only store records with backup-server
LSN
s
greater than or equal to the backup-server
C
OMMIT
-LSN
(see Sect.
9.6
). As the log
records also contain the primary-server
LSN
s, the insertions into the mapping table
need not be logged.
Even though redoing a logged update is faster than performing the update
logically, and even though read actions are not repeated, a single server process
at the backup server cannot alone manage to handle the flow of all the log records
coming from many concurrent transactions running at the primary server. The work
at the backup server must be divided between as many concurrent process threads
as are needed to keep pace with the flow of log records.
The flow of log records is directed to different
work queues
, each maintained
in main memory and processed by a single server process. Since for each database
page the log records for updates on that page must still be processed in the original
LSN
order, the log records for updates on a given page must all go to the same
work queue, in the
LSN
order. If a log record describes a structure modification that
involves pages assigned to different work queues, then the log record must go into
all these work queue.
We assume that the assignment of updates is defined by a hash function h such
that, given page-id p, h.p/ gives the address of the work queue assigned for the
updates on page p. For example, all pages residing on a given disk may be assigned
to the same work queue, thus avoiding contention for the same disk arm between
different server processes.
Algorithms
13.8
and
13.9
outline the process of tracking the updates from the
primary server and of their redoing at the backup server. In the case of redoing a
structure modification involving pages assigned to different work queues, we must
be careful to redo the modification selectively only on those pages that are assigned
to the work queue in question. As we have stated previously in Sect.
4.11
, selective
redoing is possible for all the structure modifications we consider in this topic.
The active-transaction table is maintained only for the purpose of accelerating the
takeover by the backup server of normal transaction processing at a primary-server
failure.