Information Technology Reference
In-Depth Information
at a client is modified if its contents differ from the server version of the page.
Accordingly, the value
R
EC
-LSN
.p/ indicates that all the updates on page p logged
with
LSN
slessthan
R
EC
-LSN
.p/ are in the server version of p.
When a client c ships an updated page p with log records to the server, it also
ships the value
R
EC
-LSN
.p/ (see Algorithm
14.4
). If the server version of p is still
unmodified, so that either p is not in the server buffer or the modified bit is zero in
the buffer control block of the page in the server buffer (indicating that the buffered
page has the same contents with the disk version of p), the new version of p received
from c is recorded in the server modified-page table with a
R
EC
-A
DDR
value a that
is the address associated with the greatest
LSN
n with n
R
EC
-LSN
.p/ and .n; a/
in the
LSN
-to-address mapping for c.Otherwise,pagep is already recorded in the
server modified-page table, in which case the
R
EC
-A
DDR
.p/ value is left unchanged.
The
client active-transaction table
maintained by each client c contains a
transaction record for each transaction active at c, where a transaction record
contains, as before, the transaction identifier, the transaction state (forward-rolling
or backward-rolling), and the
U
NDO
-N
EXT
-LSN
of the transaction. The transaction
identifiers are created locally at each client and are thus unique only within
that client. A transaction T of client c is identified globally by the pair .c; T /;
accordingly, both the client identifier c and the transaction identifier T are included
in log records written at c for T . The client identifier c is also included in log records
written for structure modifications performed at c.
Example 14.2
At client c
1
, a new transaction is started. A new transaction identifier
T
1
and a new
LSN
value n
1
are generated, the log record
n
1
Wh
c
1
;T
1
;B
i
is appended to the log buffer at c
1
, and the transaction record for a forward-rolling
transaction T
1
with
U
NDO
-N
EXT
-LSN
D
n
1
is inserted into the active-transaction table
at c
1
.
Transaction T
1
then wants to perform action WŒx
1
;
u
1
;
v
1
on data page p,which
has not been accessed since the last restart of the page-server system. In the call
fix-and-write-latch
.p/ performed at c
1
, the request
get-page
.p; “write”/ is sent to
the server so as to get page p cached for writing at c
1
.
In processing the request in the call
service-get-page
.p; “write”;c
1
/ (Algo-
rithm
14.5
), the server fixes and write-latches p, thus bringing p from the server's
disk to the server's buffer, records the page as cached with write privilege at c
1
,
sends a copy of the page to c
1
, and unlatches and unfixes p.
Upon receiving page p with write privilege, client c
1
, continuing with the
fix-
and-write-latch
.p/ call, installs the page in its cache as an unmodified page. The
action WŒx
1
;
u
1
;
v
1
is performed on the cached page, and the action is logged with
n
2
Wh
c
1
;T
1
;W;p;x
1
;
u
1
;
v
1
;n
1
i
,
where n
2
D
1
C
max
f
P
AGE
-LSN
.p/;
L
OCAL
-M
AX
-LSN
.c
1
/
g
,the
LSN
value n
2
is
stamped into the
P
AGE
-LSN
field of p,the
U
NDO
-N
EXT
-LSN
of T
1
in the active-
transaction table at c
1
is advanced to n
2
, and page p is unlatched and unfixed.