Document 11082210

advertisement
"v'^K^S.
IWS7.
OCT 201987
28
414
ms-il
ALFRED
P.
WORKING PAPER
SLOAN SCHOOL OF MANAGEMENT
TIME SLICE IIANIPULATION
IN INFORMATION HIERARCHY
Meichun Hsu
Stuart E. Madnick
#WP 1875-87
MASSACHUSETTS
INSTITUTE OF TECHNOLOGY
50 MEMORIAL DRIVE
CAMBRIDGE, MASSACHUSETTS 02139
TIME SLICE IIANIPULATION
IN INFORMATION HIERARCHY
Meichun Hsu
Stuart E. Madnick
April 1987
#WP 1875-87
Time
Slice
Manipulation in Information Hierarchy
By
Meichun Hsu
Harvard University
Cambridge MA 02138
and
Stuart E. Madnick
Massachusetts Institute of Technology
Cambridge,
02139
MA
Acknowledgement: Work reDoried herem has been supported, in part, by the Naval Electronic
Systems Command through contracts N0O39-83-C-O463 and N0039-8S-C-0571.
ABSTRACT
In this
paper we present theoretical results on a generalized form of partial order, called
hierarchical partial order, for enforcing seriahzabLLity that takes advantage of transaction analysis
in
database systems. Transaction analysis partitions the database into data partitions that may
priorities, such that transactions primarily updatmg less critical data parti-
assume a hierarchy of
tions will not interfere with transactions primarily updating the
do so to a
more
critical
data partitions, or
conventional systems. This results from the ability of
transactions in the system to access different data partitions using different synchronization protocob. The rules governing the different protocols are presented and their correctness with respect
will
to seriaUzabihty
lesser extent
is
proven.
than those
in
M.I.T.
LIBRARIES
OCT 2
1987
RECEIVED
|
!
I
1.
Introduction
Conventional algorithms
for
database concurrency control ensure transaction serializability
by forcing transaction dependencies
to obey certain partial order.
In the case of
two-phase lock-
ing [Eswaran76), the partial order coincides with the order of transaction lock points.
In the case
of basic timestamping algorithm [BernsteinSO, Reed78], the partial order coincides with the order
Therefore, for example,
of transaction timestamps, typically the transaction initiation times.
the basic timestamping algorithm
write a data element d only
greater
than
if
used, a transaction
t
much
assigned to transactions without
of potential interferences
we
with a timestamp TS,
d has not been read by any other transaction
Conventional algorithms rigidly obey
TSi.
In this paper
is
among
this
is
if
allowed to
whose timestamp
is
chosen partial order which
is
consideration for other factors, such as a priori knowledge
classes of transactions.
present theoretical results on a more generalized form of partial order for
enforcing serializability that takes advantage of transaction analysis. Consider a database applica-
ingly
Z?i,
D
system with a database
tion
mto
classes T^
and those
m
and
To,
partitioned
mto Di and Do. Transactions
where transactions
m
are partitioned accord-
m
Ti primarily read and update data elements
To primarily update data elements
m
Dn, but also
make frequent read
accesses
to data elements in Dj. Using conventional concurrency control algorithm, transactions in To, due
to their read accesses to D^.
would
interfere with concurrent transactions in Tj.
considered a class of higher priority than To, this interference
may
allow transactions in To to use a slightly older "time slice" of Pj.
system uses timestamps.
If
a transaction
a pseudo-timestamp TS,- which
Ti at the time of access,
still
it
is
t
in
T2,
be reduced or elinunated
In particular,
T,
if
is
we
assume that the
smaller than the timestamp of the oldest active transaction in
would not
In this example, data elements in
It
if
which has been assigned a timestamp TSt, uses
interfere at
all
with transactions
be using TS, to coordinate accesses to data elements
derived data.
However,
in
in
T,.
In addition.
/
may
Do-
Dj can be considered raw
data, while
data elements
appears that transactions responsible primarily for writing derived data
in
Dn
(e.g.,
-2-
transactions in class T^), or, in general, transactions of lower priorities, can be prevented from
those of higher priorities.
interfering with those processing the
raw data,
example may be generahzed
appUcation composed of more thai
therefore,
more than
2
to an
or, in general,
transaction classes), forming an information
\*a.
ir
-
hierarchy can be represented as a directed acyclic graph (DAG), wher^ ..ode
y.
The above
partitions (and,
An
information
are data partitions
:
and arcs represent the derivation path or priority ordering.
We
examine the following question
in this
marily responsible for writing to data partition
the time slice
it
form of
Dj-,
what
are the rulis
it
must follow
in
res-
DAG.
in
may
enable a more flexible timestamp protocol
ogy) to be used. However the
SDD-1 approach stops
(e.g.,
Protocol
m
1
the research of
among
[BernsteinSOl as a vehicle to discover certain (static) conflict patterns
classes that
pri-
computing
which the information hierarchy b a semi-tree, a
Relevant work: Conflict analysis among transactions has been proposed
SDD-1
in
is
uses for each data partition without compromising overall seriahzability of the
system' Results are presented for the case
tricted
paper: given a transaction class Ty which
transaction
SDD-1 's termmol-
saort of deveiopmg a generahzed theory.
\Iulti-version databasess. conducive to the implemeniai-ion of the notion of database time slices,
has been shown to provide a higher level of concurrency than the conventional smgle-version ones
[BernsteinSS,
Papadimitriou84l.
[ChanSC. Chan8.5
.
The
results
A
relevant
thb paper
in
multi-version
offer
algorithm
been
has
a fundamental proof
method
presented
for
in
verifying
correctness of algorithms designed specifically for information hierarchies (eg. methods proposed
in
[Hsu86]
is
a special case of scenarios supported by results in thb paper).
tree locking protocol [SilberschatzSO,
In
comparbon, the
Kedem83] b a non-two-phase locking protocol which aims
at
reducing the amount of time the locks on the "high-level" nodes of a tree must be held by each
transaction.
The hierarchy used
m
their tree protocol
mation hierarchy the current paper b concerned about.
b
entirely different
from the kind of
infor-
We now
order, followed
present 'he definition of the generalized partial order, called hierarchical partial
by the
ir
terpretation and the proof of the acycHcity theorem, the major result of
the paper.
As
2.
A^'..
The Hierarchical
The
into a
F';.» .V'^l
Order of Transactions
hierarchical partial order
number
of data partitions.
among
We
transactions requires the decomposition of a database
construct a data partition hierarchy which
is
basically a
partial order of the data partitions subject to certain constraints.
2.1.
Data Partition Hierarchy and Transaction
Definition.
Z?,,
and a transaction analysis which
into a set
7",
DPH{P,T,),
[Cl
Given a data decomposition
it
is
is
P
partitions
of update transaction types.
Classification
of a database
all
TPi,
..,
D
into data partitions D^,
D^
potential update transactions in the database
TP„,
a data partition hierarchy, denoted as
any acyclic graph with nodes corresponding to Di,
D2,---,
D^, such that
a semi-iree
(a semi-tree
is
an acyclic digraph where there exists one and only one undirected path
between any pair of nodes), and
[C2!
if
there exists a type of update transactions in the system which write
writes
It is
hierarchy.
in
Dj. then there exists a directed path between D, and D^
noted that only update transactions need participate
There
is
no need for read-only transactions
to
in
There may be multiple data partition hierarchies that
The
In particular,
Z),
and read from or
DPH(P .T^].
in
constraining the data partition
participate in the transaction analysis,
eliminating the difficulties of pinning down, a priori, the nature of
database decomposition.
m
all
ad hoc queries.
satisfy the
any total order of partitions
in
above definition given a
P
satisfies the definition.
actual choice of the data partition hierarchy will reflect the perceived priorities of the write-
processing in each of the data partitions.
Given a data partition hierarchy, each transaction
writes into.
or most of
all
Typically, the data partition chosen
its
writes.
This data partition
transactions with the
[C2] of the definition of
same home data
is
home data
partition of the transaction,
partition are grouped into a transaction class.
data partition hierarchy,
denoted as ttDi, then there
the one in which the transaction performs
is
called the
is
assigned to one of the data partitions
is
home data
a transaction's
if
a directed path between
£>,-
partition
and any other data partition
in
it
all
and
From
is
Z),,
DPH
that the transaction accesses (read or write).
In the remainder of the paper, the notation
DPH
refers to a particular
chy chosen to base our hierarchical partial order of transactions.
higher than data partition D^, denoted as
to
Z),
Intuitively, in our notation, higher level
.
which the lower data partitions derive
Di=Dj
if
D,>Dj,
if
data partitions are most
We
their contents.
m DPH
say that data partition
there exists a directed path in
or D, and Dj are connected by a directed path.
they reside on directed paths
We
data partition hierar-
that intersect.
say that
We
Z?,-
definition,
Z),
from D.
if
either
and Dj are neighbors
D, and D,
if
is
raw data from
and Dj are related
also say that
By
likely
DPH
Z),
are related
then they must be neighbors.
2.2.
The
=>
Relation
A
Definition.
tions
L.
ij,
io
we say
where
that
tr,
relation
t^eD^, tr.eDj.
=>
related to both D, and
where TS
is
"=>", (pronounced
f,
and D, and D, are neighbors
with respect to
Z?y,
A-
=
iff
defined for a pair of transac-
m DPH.
there
e.xists
Given two functions TS and
a
Z)^
m DPH
such that
Dj,
is
a function which maps a transaction to a time value such that no two transactions
of related data partitions
if
TS and L.
is
and
have the same time value; the function
(1)
as 'X-foUows"),
Z),
L,
^
,
which stands for link function,
and Dj and maps one time value
D, then L,^j(m)=m;
is
defined for any pair
to another time value as follows:
,
(2)
if
A >Dj
(3)
if
Di
<Dj
then L,-,y(m
(m );
)=Z).V,.,^
then L,-,y(m)=C/P,,y(m);
where the function UP^j, standing
titions
Z),
for
DowNward
function,
where Di>Dj, and maps a time value
functions UP^
Composible:
[Pi]
function,
and Dj where Di<Dj, and maps a time value
DNij, standing
Di<Dj,
UPward
for
j
and DNj
for
all
i
defined for any pair of data par-
to another time value; the function
defined for any pair of data partitions D,
is
to another time value; for
must
and Dy
any pair of Di and Dj where
satisfy the following three properties:
D^
Z),-,
is
and
where
Dj
Dj>D,,>Di,
for
all
times
m,
UP,j{ UP,,,{m))= UPij{m), and DN,,(DNj,,{m))=DNj,{m)Non-decreasing: for
[P2]
all
£>,
Dj>Dj and
and Dj where
m, m' where
for all times
m >m'
UPi.j(m)>UPij{m') and DNj^,{m)>DNj^,{m').
[P3] \'alue-interlocked: for all D,
and D^ where
Dj>Di and
UP,j(DS,,(m])<m. and DA}, ,( rP,,,(m))>m
Intuitively.
tions
to.
is
els
=>
is
be more specific,
time m,
.
a relation between transactions based on both the timing of the transac-
and the hierarchical
To
for all
levels
"tj
=>
m
DPH
the
t^'
of the transaction classes that the transactions belong
always means that
ij
is
"later"
than
t^-
However,
this "later"
not only based on when the two transactions are physically active, but also on the relative levof the data partitions in which
t^
and
^2
are assigned to.
Clearly,
transactions that belong to neighboring data partitions, and the
UP
=>
and
is
DN
defined only between
functions are defined
only between related data partitions.
Note
also that the functions
DN
TS UP and
,
are not completely specified; only their neces-
sary properties have been specified. This means that, by manipulating the instantiation of these
functions, different instances of the relation
=>
may
timestamp function, which maps a transaction to
function, which
function.
maps
An example
a transaction to
its
its
be defined.
initiation time,
commit time,
of a construction of UP,
j
For example, both the
initiation
and the commit timestamp
are acceptable instantiations of the
and DNji which
satisfies
TS
the non-decreasing and
-6-
value- interlocking properties
stant Cij
Acyclicity
The key
t^
an appropriate con-
Theorem
result of the
paper
=>
<i
the following theorem:
is
A
Tht Acyclicity Theorem.
implies
for
.
The
2.3.
j{m)=m — Cij and DNj i{m)=m + Cij
UP^
is
digraph where nodes are transactions and every arc
'2~*'i
has no cycle.
The theorem
states that
occur only when
a concurrency control algorithm allows a transaction
if
=>
holds, then seriaUzabihty
guaranteed.
dependency
Given the structure
h~*h
•'O
of an
information hierarchy, and the desire to reduce or ehminate interferences from lower-
fo
t^
priority transactions to higher-priority transactions,
TS
(1)
Define a
(2)
Construct a function
one needs
is
to:
function;
hierarchical path
UP
which maps time values to successively smaller values along the
upwards
values downwards, where
m DPH.
UP
and a
and
DN
D!\^ also
whcih maps time values to successively larger
satbfy the composibUity. non-decreasmg and
value-mteriockmg requiremenis;
(3)
Allow lower-level transactions [tiD,] to access an older time shce before UP, j(TSi]
in
a
higher data partition Dj. and
(4)
Allow higher-level transactions (teDj)
(A) with
It
is
the time value
noted that when
assigned identity functions,
tional algorithms.
to access
and timestamp a lower-level data partition
DNji{TS,).
DPH
=>
consists of a single data partition, or
when UP and
degenerates to the partial order typically enforced
in
DN
are
conven-
Proof
2.4.
To prove
theorem, we
this
L_foIlows",) such that
locally transitive,
'3*=^><i-
i.e.,
=>
if
implies
«>
and t2~^'i implies
t3s;>/2 and <2^><i and
tivity result to
all
show
global transitivity.
Given the definition of
Definition.
D, and Do are related then
Lo„,{TS,^>L^„,{TSlJ
between them turns direction
Dm
D„
between D; and
is
tions,
^3
prove that «i>
is
are neighbors of one another then
at
D„
and
(b)
D^, then
the transi-
notational convenience,
we
D,-.)
say that
tn
weakly
on the shortest path
=>
in
f,,
denoted as <2~->'i>
DPH
between D, and Do
D, and Do are not related but the shortest path
if
for all
we extend
Dp on the shortest path
[0.2],
and
for
all
in
DPH
between Do and
D, on the shortest path
in
DPH
mclusive, Lo„,(L„,{TSi^)>Li^^{TS,) [0.3]. (Note that by the fact that
a semi-tree there exists one
and by
as
f,-
=>, we
for all
[0-l]>
Finally
(In the following proofs, for
Lop(TSt^>L,„p{Li„{TStJ)
inclusive,
DPH
and
= ><2)- ^^
data partitions are neighbors of one another.
denote the home data partition of a transaction
inclusive,
^2
<i,
-'(<i
(pronounced as "weakly
Local transitivity completes the proof of the Acyclicity Theorem for a data partition
hierarchy in which
if (a) if
~>,
a weaker relation
will first define
and only one shortest path between any pair of data
definition of neighbors the shortest path
can turn direction at most once.
parti-
between any neighbormg data partitions
the path between any pair of neighbormg data partitions
i.e..
is
either one-phase or two-phase.)
Lemma
Proof.
and
[0.3]
in
We
want
show that
to
the definition of
related to both
(a)
to=>t^ implies f2~^'i-
1.
D^ and Do
Suppose
[O.li
is
^>
(a) [O.l] in the
is
on.)
Since t2=>ti,
true.
let
is
true,
Lo,(TS,^>Lii{TSt^)
and
for
(b) [0.2]
some
£>,-
[l.l].
not true. Then there exists
mclusive such that Loi,{TS,^<Lii{TS,J
now
above definition of :=»>
'2.ll.
Consider the following two cases:
(a.l)
Di,
on the shortest path between Dj and Do
(For brevity, "inclusive"
Di>Do. Let
D^,
is
always implied from
be any data partition on the
DPH
shortest path in
between Dj and D^. Then applying UP/,
use of the properties of
UP
DN
and
functions
D. be any data partition on the shortest path
both sides of
in
in
to both sides of
p
we have UP2^p{TS,}<.DN]p{TSt)-
DPH
between D2 and
we have UP.^,{TSt^<DNi^,{TS,). Therefore
[2.1]
D,-
Then
s.t.
for
all
D^
satisfying
contradictory.
[l.l],
Therefore
we have DN2 ^{TSt^<l'Pi,^(TSi
(b)
such that
We
[2.1]
is
cannot be true.
Combming
true.
[3.1]
[3.2:.
Applying (Tp,m to both sides of
[3.1].
Therefore [0.2] must be true.
Usmg
similar
(b.2)
arguments
we conclude
Lemma
Proof.
2.
[0.2]
and
t^ssXi imphes
From Lemma
<2<7'o,
tn,iDn,,
3.
i.e.,
if
this
(Local
|3.2]
both
[0.2]
show
if
all
true.
this
D,
(a. 2)
[O.l]
is
DN„^
Applying
75J)>L,.,(
D„
£>o>Z)|.
were not true
D^>D^>D^
s.t.
to
l.lj
true.
were not true there cannot
we have tPo.mf
So we have
for all
we obtain contradiction
we conclude
I,„.,(Lo,„(
as presented in (b.l) one can
exist D,
to both sides of
75,,). therefore [0.3]
p{TS,J<L„
p(Li „{TS,
is
))
7'5(^<Z. i^( TS,,), contradictor.- to
and
[0.2]
[0.3]
and
hold,
(b.2)
[0.3] hold.
Di.D2>D„.
Combming
(b.l)
[0.3] true.
~'('i
1, it is
L2ATS,)>L,,,{TS,). Therefore
Lemma
since
(a. 2)
let
were true then there
cannot be
were not true. Then we have some D^ such that Ln
Suppose
[0.2]
and
in (a.l)
Consider two cases: (b.l) D,„>Z)|,Do.
true.
and
)
(a.l)
we have D^„JL2.JTSJ)>UP,JTS,J.
[3.1;
this
if
Similarly for
[2.1].
Using same argument
).
have Lo^( TS, J>Li^f TS,
[l.ll
were true then
Do>Dp>Di, we have DN2_p{TSt^<UPij,(TSt), smce
then we get DN2^i,{TS,^>UP^_i,(TSt^), contradictory to
and therefore
[2.1]
Similarly
By applying .DA*^ on
D/,.
if [2.1]
between D^ and Dn we have UP2,„{TSt^<DNi,„(TSt^). However,
cannot exbt any
and making
[2.1]
= >'2)-
clear that
-^[t,
Transitivity)
if
<2~>ti then
for
all
D^ related
to both
D^ and D;
= >t2).
The
relation
*:>
is
transitive,
i.e..
if
there exists
t^(D^,
such that /;~><i, ly^>t2 and Dj, Do and D^ are neighbors of one another, then
.
-9-
ProoJ. Since
Dn and D3
£>,,
and D^ contains D„, where
Dp between D^ and
also
Z),-
b
also
is
on the path between Dj and D^ and D^ and
on that between
on that between Do and Dj. For
and Dj are
them turns
we
at D^.
and Do, and every P^ between D^ and Z)„
Z-,y(i)
is
if
and Dy are not related but the shortest path between
if D,-
Then by fo«>/,, tz~>ln we have LLz,„(TSi^>LL2,„{TSt^ >LLi^„{TStJ.
LL3 ,(r5,^>LIi
derive
D-^
Then every
D^^.
and Dy neighbors, we denote as LLij{x) either
D,-
related, or Ltj(L,_i(2))
2)3
between
LL,,,{TS,^>LL,JTS,^ =LL„JLL2^„(TS,^) >L„JLL,^„{TS,)) =L,JTS,).
Therefore
larly
Z)„
D„
are neighbors of one another, let the shortest path
Therefore for
,(75,^).
all
D,
in
Simi-
between D^ and D3 we have
IL3.j(rS,j>LLi.,(r5,_). Therefore <3»^><i.
Next we extend
Lemma
Given a DPH.
4.
more general data partition hierarchy.
local transitivity to allow for
if
tt,
=>
=>t,, denoted
and Pj and D, are
as LF{ti,,t,),
neighbors, then f(,~>f,
Proof.
We
prove by induction
then f(,~>fj by local transitivity
than
and
g
D,
and
D^
=
has length
the length
Show
that
neighbors,
length
is
g
/
if
they have a
number
(i.e.,
/,-^>i,- for
then
of arcs) in LF{t^,t^).
'i~>',+i
for
any
common
Therefore fi~>f5+i.
than
<;,
is
less
LF{ti.tj^^)
=
Consider two sub(b.2) If
neighbor D^+j, there exists
<!=>.. = >f^ = >..= >?j and Dj are neighbors of both D, and D^^^.
less
we have <i~>^t. Likewise we have 'i~>'j+i. By
1=2.
(a) If
any LF[t,.tj) whose length
and D^ and D^^i are neighbors.
Di and D^ are neighbors, then fi^X,.
are not neighbors, then since
LF{ti,tg)
(b)
are
ii=>io=>...= >ij = ><j^i whose
cases: (b.l) If
in
t,,
D, and
D^,
such that
Since LF{ti,ti,)
local transitivity,
we
have ti^>tg^i. Q.E.D.
Proof
of
<!—...—<„—<,.
—i(f, = >(i).
Acyclicity
Theorem.
Then from Lemma
4.
Suppose
there
is
we have t^^>t^, and
a
transaction
therefore, from
dependency
Lemma
2.
cycle
we have
This means that there cannot be a transaction dependency i„—<,, contradictory
with the given. Therefore there cannot be a cycle. Q.E.D.
-10-
3.
References
PA., Shipman, D.W., and Rothnie,
[BernsteinSOj Bernstein,
for distributed databases (SDD-1).
[Bernstein83] Bernstein,
algorithms.
ACM
[Chan82] Chan, A.
PA. and Goodman
Trans. Database
Concurrency control
J.B.
Trans. Database Syst.,
5, 1,
March
[Hsu83j Hsu,
M and
theory and
Conference Proceedings, 1982.
a database systems.
IEEE
Trans.
RA. and Traiger, I.L. The notions of consistency
Comm. ACM, 19, 11, November 1976.
Madnick, S.E. Hierarchical database decomposition: a technique
concurrency control. Proceedings of 2nd
of Database Systems, March 1983.
[Hsu86l Hsu,
-
of an integrated concurrency control and recovery
[Eswaran76] Eswaran. K.P., Gray, J.N., Lorie,
in
a system
December 1983.
[Chan85] Chan, A., Gray, R. Implementing distributed read-only transactions.
Softw. Engr., SE-11, 2, February 1985.
and predicate locks
in
1980.
Multi-version concurrency control
N.
Syst., 8, 4,
The implementation
et. al.
ACM SIGMOD
scheme.
ACM
ACM SIGACT-SIGMOD
M. and Chan, A. Partitioned two-phase
To appear
locking.
for database
Symposium on
in
ACM
Principles
Transactions
on Database Systems.
[Kedem83j kedem.
Journal of
Z.
ACM,
and SUberschatz, A.
30, 4. October 1983.
Locking protocols: from exclusive to shared
[Papadimitriou84l Papadimitriou. C.H. and Kanellakis, P.C.
versions.
ACM
Trans. Database Syst.,
9, 1,
March
On
locks.
concurrency control by multiple
1984.
Naming and synchronization in a decentralized computer system. Ph.D.
Dept. of Electrical Engineering and Computer Science, M.I.T., Cambridge,
[Reed78] Reed. D.P.
dissertation.
Mass.
September 1978.
[Silberschatz80;
Journal of
Silberschatz. A. and
ACM.
Kedem.
27. 1. Januarv- 1980.
13U
052
'>"
Z.
Consistency
in
hierarchical database systems.
Date Due
Lib-26-67
3
TOAD ODM
T2fl
120
Download