Information Technology Reference
In-Depth Information
The index is assumed to fit in main memory, and modifications on it are not
logged. To accelerate the redo pass of restart recovery, the index is checkpointed
periodically or after the number of updates reaches a preset threshold: the relation is
S-locked, the binary image of the index is flushed to a disk file, the identifier of the
file is logged, and the S lock is released. The redo pass only involves downloading
the index from the file written at the last checkpoint and bringing the index up to
date by scanning and applying the log records written after the checkpoint.
Since the log contains a complete history of all update actions performed by
transactions, a slight modification to the above setting allows a log-structured
database to function as a transaction-time versioned database (Sect. 12.1 ). Index
records for newly created versions initially take the form .x;T;n/,whereT is the
identifier of a transaction that has updated (i.e., created a new version of) the tuple
with key x and n is the LSN of the log record for the most recent update by T on x.
When transaction T has committed, that is, written the commit log record and
flushed the log, the U NDO -N EXT -LSN chain of T is traversed in order to find out
the updated keys, and the commit timestamp of T is substituted for the transaction
identifier T in each index record .x;T;n/. Under snapshot isolation, transaction T
holds its X locks on the keys x during the substitution of the commit timestamps,
after which the locks can be released. To make possible the substitution of the
timestamps during index recreation after a failure, the commit timestamps must be
logged.
When a log-structured database organization is applied to a key-value store
r.X;V/ that partitions the key space logically into many disjoint key groups, the
log can be split into several logs, one for each key group, thus reducing contention
in log writes. Recall that each transaction on such a key-value store can only update
tuples with keys in a single key group. If there are too many key groups, a single log
can serve a subset of key groups, where the partitioning into the subsets is balanced
according to the expected frequency of updates. Each log is indexed by its own
index.
A log-structured database is especially amenable to the remote backup technique
(Sect. 13.8 ) for disaster recovery. Log records written at the primary site are shipped
to the remote site where they are appended to the log buffer, from where they go to
the log disk of the remote site. The index to the log at the remote site is built as the
log records arrive. As indexing is light-weight and the entire index resides in main
memory, we probably do not need to divide the work into many work queues. If
there are several logs, each serving a set of key groups, then the remote site has as
many work queues, one for each log.
15.6
Databases on Flash Memory
New storage technologies such as flash-memory -based solid-state drives ( SSD s)
offer the promise of overcoming the performance limitations of hard-disk drives.
The absence of mechanical parts implies that flash-memory-based SSD s are not
Search WWH ::




Custom Search