Information Technology Reference
In-Depth Information
of all modified pages with
P
AGE
-LSN
s less than the
LSN
n of the commit log record
of T (together with all log record with
LSN
s up to and including n) are shipped
to the server. With this policy, the current version of the database is the same as
the server version of the database at times when there are no active transactions in
progress at any client.
In the
lazy
or
demand-driven update propagation
, a modified page is shipped
from a client to the server only when:
1. The page is needed at some other client for a read or an update action.
2. The page is needed at the server for taking a checkpoint.
3. The client runs out of cache space.
In these cases the client must also give up its write privilege on the cached page.
In what follows we assume that the lazy update-propagation policy, which is the
most liberal among the three, is followed.
14.5
Cache Consistency
Caching data at clients poses the problem of ensuring
cache consistency
:whena
page is latched at a client for reading or updating some tuple in the page, the version
of the tuple in the client's cache should be its current version. With the caching
protocol considered in this chapter, we even impose the stronger requirement that a
page latched at a client for reading or updating must always be the current version
of the page.
We need a mechanism by which the server can take away the write privilege held
by client c on an unlatched page p cached at c when that page is requested to be
cached at another client c
0
for updating. Also, it should be possible to downgrade
the write privilege held by c on p to a read privilege when the page is requested to
be cached at c
0
for reading. Taking away or downgrading a caching privilege held
by client c on page p is called a
callback
of p from c.
When a server-process thread holds the server version of a page p write-latched,
it can call the page back from client c by issuing the call
callback-page
.p;m;c/
(Algorithm
14.3
), where m is the privilege (read or write) under which some other
client wants to cache p. The request
callback-page
.p; m/ is sent to client c.At
client c, the request is responded by performing the call
respond-to-callback
.p; m/
(Algorithm
14.4
), which begins with fixing and write-latching the cached page p.If
p is cached at c for writing, client c ships to the server a copy of p,the
R
EC
-LSN
.p/
value and all the log records with
LSN
s up to and including
P
AGE
-LSN
.p/ that have
not been sent earlier. If p is cached for reading or is requested for writing elsewhere
(i.e., m
D
“write”), p is purged from the cache of p;otherwise,p remains cached at
c for reading: the write privilege on p held by c is downgraded to a read privilege.
Upon receiving the response from c, the server-process thread installs p into its
buffer, appends the log records to the log buffer, and updates the caching privilege
on p at c.