Information Technology Reference
In-Depth Information
example, a B-tree structure for a file defines precisely what kind of a graph structure
the pages must form, what information there must be in each page of the structure,
which balance conditions need to be fulfilled, and which algorithm is used to find
records stored in the leaf pages of the B-tree.
The definition of integrity only pertains to the current version of the database.
The disk version, on the contrary, does not need to be consistent. If each individual
flushing of a page from the buffer onto disk and each individual fetching of a page
from disk to the buffer are always performed correctly, the internal structure of every
single page in the physical database is consistent when no logical database action is
being performed. In this case we say that the pages are page-action consistent .
However, the collection of disk versions of the pages does not necessarily form
a consistent structure. For example, when the structure of a B-tree changes due
to the need to split a full page p to accommodate an insert action, some of the
pages involved in the structure modification (e.g., p itself) may have been taken
onto disk, while others (e.g., p's parent and new sibling) may still reside only in the
buffer. In the same way, the disk version of the logical database can continually be
inconsistent.
When no logical database action by any active transaction is in progress, the
current version of the physical database is consistent. In that case we say that (the
current versions of) the physical and logical databases are action-consistent .When
no transactions are active, so that every transaction is either committed or rolled
back (the current versions of), the physical and logical databases are said to be
transaction consistent .
Clearly, a transaction-consistent physical database is always action-consistent,
and an action consistent physical database is always page-action consistent and
consistent. If a complete checkpoint is taken when no transactions are active and no
new transactions are allowed to the system in the interim, then even the disk versions
of the physical and logical databases will be transaction consistent. A transaction-
consistent logical database is consistent if all the transactions are logically consistent
and have been run in full isolation.
2.7
Latching of Database Pages
The database must stay consistent under operations by several concurrent server-
process threads. To keep the physical database consistent, a process thread that
processes a database page must always latch the fixed page for the duration of the
processing.
A read latch gives the process thread permission to read the page and prevents
other processes and threads from concurrently writing the page. Multiple process
threads can hold a read latch on the same page at the same time. A write latch gives
permission to both read and write the page and prevents other process threads from
reading or writing the page at the same time. The owner of a latch must unlatch the
page (release the latch) after it has used the page.
Search WWH ::




Custom Search