<<

Relative Serializability: An Approach for Relaxing the AtomicityofTransactions

D. Agrawal J. L. Bruno A. El Abbadi V. Krishnaswamy

Department of Science

University of California

Santa Barbara, CA 93106

Abstract

In the presence of semantic information, serializabil i ty is to o strong a correctness criterion and un-

necessarily restricts concurrency.We use the semantic information of a transaction to provide di erent

atomicity views of the transaction to other transactions. The prop osed approachimproves concurrency

and allows interleaving s among transactions which are non-serializabl e, but which nonetheless preserve

the consistency of the and are acceptable to the users. We develop a graph-based to ol whose

acyclicity is b oth a necessary and sucient condition for the correctness of an execution. Our theory

encompasses earlier prop osals that incorp orate semantic information of transactions. Furthermore it is

the rst approach that provides an ecient graph based to ol for recognizing correct schedules without im-

p osing any restrictions on the application domain. Our approach is widely applicabl e to manyadvanced

database application s such as systems with long-lived transactions and collab orativeenvironments.

1 Intro duction

The traditional approach for transaction managementinmulti-user database systems is to maintain entire

transactions as single atomic units with resp ect to each other. Such atomicity of transactions is enforced in

most commercial database systems by ensuring that the interleaved execution of concurrent transactions re-

mains serializable [EGLT76, RSL78,Pap79, BSW79]. are increasingly used in applications, where

transactions may b e long lived, or where transactions corresp ond to executions of various users co op erating

with each other, e.g., in design databases, CAD/CAM databases, etc. For such applications serializabilityis

found to b e to o restrictive [BK91].

Researchers, in general, havetaken two di erent approaches to address this problem. Instead of mo deling

the database as a collection of ob jects that can only b e read or written by transactions, a number of

researchers have considered placing more structure on data ob jects to exploit typ e sp eci c semantics [Kor83,

SS84, Her86, Wei89,BR92]. This approach increases concurrency in the system while remaining within the

con nes of serializability. The other approach relaxes the absolute atomicity of transactions and uses the

explicit semantics of transactions to allow executions in which a transaction mayprovide di erent atomicity



views to other transactions [Gar83, Lyn83, FO89]. For example, consider a transaction T consisting of

database op erations o o o . The traditional serializability requirement is that T app ears as a single atomic

1 2 3

0 00

o o o to other transactions suchasT and T .However, by using the semantics of transactions, the unit

1 2 3

atomicity sp eci cations of T may b e made di erent with resp ect to other transactions. The user may sp ecify 1

0 00

that T should app ear as o o o to T but as o o o to T . Lynch [Lyn83]intro duced this notion and

1 2 3 1 2 3

refers to it as relative atomicity .

In [Lyn83], several examples are presented to motivate the advantages of relative atomicity for banking

applications and computer-aided design environments. In the banking example, customers are group ed into

families each of which shares a common set of accounts. The bank may wish to take a complete bank audit

of all accounts, while creditors may require a credit audit of sp eci c families. In this case the bank audit

should b e atomic with resp ect to all other transactions and vice versa. The relative atomicity sp eci cations

for credit audits and customer transactions are much less severe. Finally, customer transactions in the same

family can b e arbitrarily interleaved. In the computer-aided design example, users are divided into teams

of sp ecialized exp erts. Relative atomicity sp eci cations can now b e used to sp ecify di erent constraints for

memb ers within a team and with resp ect to other teams.

In databases with typ ed ob jects several ecient proto cols exist for enforcing correct executions of transac-

tions. In contrast, results in the area of relative atomicity are still at a preliminary stage. In particular, there

do es not exist a well-de ned theory for analyzing and arguing the correctness of executions of transactions

with relative atomicity sp eci cations. The traditional serializabilitytheory, for example, de nes the notion

of correct executions which are serial executions and provides a graph-based to ol to recognize executions

that are \equivalent" to serial executions. If relative atomicity sp eci cations are to b e used in practice, we

need to develop a theory similar to the traditional serializability theory.

Garcia-Molina [Gar83] pioneered the e ort to use the notion of relative atomicity to increase concurrency

in database systems. He prop osed grouping transactions into compatibility sets, where transactions in

one such set may b e arbitrarily interleaved, but transactions in di erent sets observeeach other as single

atomic units. Clearly, Garcia-Molina's prop osal is a sp ecial case of transactions with relative atomicity

sp eci cations. Lynch [Lyn83] extended Garcia-Molina's sp eci cations from two-level compatibilitysetsto

hierarchically structured interleaving sets, allowing transactions to havevarying atomic units relativeto

each other. Once again, it can b e argued that Lynch's hierarchical sp eci cations are restrictive and do not

mo del the general notion of relative atomicity.However, Lynch's prop osal is comprehensive in that it not

only sp eci es a notion of correctness but also provides a graph-based to ol to eciently recognize correct

 

executions. Farrag and Ozsu [FO89] used the notion of breakp oints, which provides maximal freedom for

relative atomicity sp eci cations. In addition, they prop ose a graph which aids in the recognition of executions



that are \equivalent" to correct executions. The most serious drawbackofFarrag and Ozsu's prop osal is

that the recognition of executions that are equivalent to correct executions has an exp onential complexity.

Once the notion of relative atomicity has b een de ned, the main challenge is to de ne classes of executions

that are larger than the class of correct executions, but that are \equivalent" to the set of correct execu-



tions. Extending the de nitions from traditional databases to relative atomicity,Farrag and Ozsu de ne an

execution to b e correct if it satis es the user de ned relative atomicity sp eci cations and the class relatively

consistent, which includes all executions that are con ict equivalent to correct executions. Unfortunately,

the complexity of recognizing relatively consistent executions is NP-Complete [KB92].

In this pap er, we retain the notion of con ict equivalence and reduce the complexity of this problem by

mo difying the notion of correct executions. This is in contrast to the traditional approach of strengthening 2

1

the notion of equivalence for reducing the complexity of the problem . Rather than de ning a correct

execution to b e the one that only allows the interleavings sp eci ed by the user, our de nition takes into

account the actual interleavings o ccurring in the sp eci c execution. Our de nition may therefore allow

an op eration to b e interleaved within the relatively atomic unit of another transaction, as long as in the

given execution no \dep endencies" o ccur b etween this op eration and the op erations of the atomic unit.

In the traditional mo del, this would b e analogous to generalizing the class of serial executions by allowing

transactions that do not haveany \dep endencies" to b e arbitrarily interleaved. This new de nition of correct

executions which subsumes all earlier de nitions of correct executions, reduces the complexity of recognizing

the set of executions that are equivalent to correct executions. In particular, wedevelop a graph, whose

acyclicity is b oth a necessary and sucient condition for an execution to b e equivalent to a correct execution.

Furthermore, when the relative atomicity sp eci cations are restricted to the case where each transaction is

an atomic unit, our theory corresp onds to the traditional serializability theory.

2 Mo del

A database is mo deled as a set of objects. The ob jects in the database can b e accessed through atomic

read and write op erations. Users interact with the database byinvoking transactions. A transaction is a

sequence of read and write op erations that are executed on the ob jects. A read (write) op eration executed

by a transaction T on ob ject x is denoted as r [x](w [x]). A schedule S over T = fT ;:::;T g is an

i i i 1 n

2

interleaved sequence of all the op erations of the transactions in T such that the op erations of transaction

T app ear in the same order in S as they do in T ,fori =1;:::;n. In order to relate schedules over the

i i

same set of transactions, the notion of con ict between op erations is used in theory

[Pap79, BSW79]. Two op erations of di erent transactions con ict if they access the same data ob ject and

at least one of them is a write op eration. Twoschedules are con ict equivalent if they b oth order con icting

op erations in the same manner.

Our motivation in this pap er is to generalize the transaction mo del. In particular, if semantics of the

applications b eing mo deled by the database is available to the users writing the transactions, they may

b e able to weaken the requirement of the atomicity of transactions. In the relative atomicity mo del, a

transaction has multiply de ned atomicity sp eci cations with resp ect to every other transaction. Formally,

an atomic unit of T relative to T is a sequence of op erations of T such that no op erations of T are

i j i j

allowed to b e executed within this sequence. Atomicity (T ;T ) denotes the ordered sequence of atomic units

i j

th

of T relativetoT and AtomicU nit(k; T ;T ) denotes the k atomic unit in Atomicity (T ;T ). Figure 1

i j i j i j

illustrates an example of three transactions with their relative atomicity sp eci cations. In particular, the

rectangular b oxes represent the atomic units of each transaction with resp ect to other transactions. In

r [x]w [x] , w [z ];r [y ] i,which indicates that if op erations of T have Figure 1, Atomicity (T ;T )ish

1 1 1 1 2 1 2

to b e executed within T then they may only b e executed after w [x] and b efore w [z ]. Wesay that an

1 1 1

op eration o of a transaction T is interleaved with an AtomicU nit(k; T ;T )inaschedule S , if there exist

j i j

1

Such an approach is explored in [Kri93].

2

In general, transactions and schedules are p ermitted to b e partially ordered sequences. In this pap er, however, we assume

that transactions and schedules are totally ordered sequences for simplicity. 3

0 00 0 00

op erations o and o of AtomicU nit(k; T ;T ) such that o precedes o and o precedes o in S .

i j

Consider a set of transactions T = fT ;T ;T g where

1 2 3

T = r [x]w [x]w [z ]r [y ]

1 1 1 1 1

T = r [y ]w [y ]r [x]

2 2 2 2

T = w [x]w [y ]w [z ]

3 3 3 3

Atomicity (T ;T ): r [x]w [x] w [z ]r [y ]

1 2 1 1 1 1

Atomicity (T ;T ): r [x]w [x] w [z ] r [y ]

1 3 1 1 1 1

Atomicity (T ;T ): r [y ] w [y ]r [x]

2 1 2 2 2

Atomicity (T ;T ): r [y ]w [y ] r [x]

2 3 2 2 2

Atomicity (T ;T ): w [x]w [y ] w [z ]

3 1 3 3 3

Atomicity (T ;T ): w [x]w [y ] w [z ]

3 2 3 3 3

Figure 1: RelativeAtomicity Sp eci cations

The relative atomicity sp eci cations over T is the set fAtomicity (T ;T )jT ;T 2Tg.Theabovespec-

i j i j

i cations could also b e sp eci ed in terms of transactions typ es instead of transactions instances as in



[Gar83,FO89]. However, for simplicity of exp osition we will restrict ourselves to relative atomicityin

terms of transaction instances [Lyn83]. The relative atomicity sp eci cations can also b e sp eci ed by using



the notion of atomic steps [Gar83] or breakp oints [FO89].

A correct execution in the traditional transaction mo del requires that all op erations of a transaction

app ear as a single atomic unit. We refer to this as absolute atomicity. For example, T app ears as

1

r [x]w [x]w [z ]r [y ] to all other transactions under absolute atomicity.From the relative atomicity sp ec-

1 1 1 1

i cations of transactions in Figure 1, in any correct execution it is required that op erations of T not b e

2

interleaved with AtomicU nit(k; T ;T ) for k =1; 2. However, op erations of T may b e executed b etween the

1 2 2

two atomic units of T relativetoT . Consider, for example, the following schedule:

1 2

S = r [y ]r [x]w [x]w [y ]r [x]w [z ]w [x]w [y ]r [y ]w [z ]

ra 2 1 1 2 2 1 3 3 1 3

Note that even though S is not a serial schedule, it is correct with resp ect to the relative atomicity

ra

sp eci cations of the three transactions in Figure 1. For example, op erations of T are executed b etween r [y ]

1 2

and w [y ]r [x]. In spite of suchinterleavings, the atomicityof T relativetoT is preserved. It can b e easily

2 2 2 1

shown that the same holds for the remaining interleavings. Based on the relative atomicity sp eci cations,

the correctness of a schedule S over T can b e de ned as follows:

De nition1 S is a relatively atomic schedule over T if for all transactions T and T no op eration of T is

i l i

interleaved with an AtomicU nit(k; T ;T ) for any k .

l i 4

 

Farrag and Ozsu [FO89] refer to relatively atomic schedules as correct schedules. Further, they de ne

relatively consistent schedules as the schedules that are con ict equivalent to a relatively atomic schedule.

Unfortunately, recognizing the class of relatively consistentschedules is NP-complete [KB92].

To reduce the complexity of recognizing relatively consistentschedules, we mo dify the de nition of

correct schedules. We motivate our approachby studying the reason for the NP-Completeness with the

ab ove de nition of correctness. The complexity result arises due to the ambiguity in ordering non-con icting

op erations. Consider for example three op erations o , o ,ando in a schedule S , where o and o are

1 2 3 1 2

0 0

op erations of a transaction T in which o precedes o ,ando is an op eration of a transaction T (T 6= T ),

1 2 3

0

such that o o is an atomic unit of T relativeto T .Ifo con icts with o and/or o , then the order of

1 2 3 1 2

o o is determined by the con ict. On the other hand, if o do es not con ict with o and o relativeto

1 2 3 1 3

o , there is a choice of ordering o either b efore o or after o in an equivalent relatively atomic schedule.

2 3 1 2

Dep ending on the rest of the schedule, one (or b oth) of these choices may not b e p ossible in any equivalent

relatively atomic schedule. In order to verify whether a schedule is relatively consistent, b oth choices must b e

considered to determine if there exists an equivalent relatively atomic schedule. Since several such triples may

exist for any given schedule, there are p otentially an exp onential number of choices that must b e considered.

It might then b e necessary to check each of these orderings for memb ership in the class of relatively atomic

schedules, thus making the test for relatively consistentschedules exp onential.

In fact, the complexity of the problem o ccurs only when the given schedule do es not imp ose a particular

order b etween o and o or o , but the user's relative atomicity sp eci cations require the exclusion of o

3 1 2 3

from the atomic unit o o .Ifaschedule do es not imp ose any order b etween two op erations then the

1 2

execution of one op eration cannot dep end on or a ect the execution of the other. Otherwise, a sequence

of con icting op erations must have b een executed, thus enforcing an order. Our approach is therefore to

extend the user's relative atomicity sp eci cations and allow o to b e executed b etween o and o when o 's

3 1 2 3

execution cannot a ect or dep end on either o or o . This unseemly exclusion arises due to the fact that

1 2

the relative atomicity sp eci cations for the application are given a priori and havetotakeinto accountall

p otential con icts that might o ccur in any execution. In a particular execution not all of these p otential

con icts o ccur, and the relative atomicity sp eci cations tend to b e conservative. For example, transaction

executions that corresp ond to conditionals, the con icts that o ccur can b e determined only at execution

time. We are therefore motivated to expand the class of relatively atomic schedules to include interleavings

of op erations whichdonothaveany dep endencies b etween them.

In order to characterize correct schedules in our mo del, we need to de ne an additional notion called

depends on whichisderived from con icts and the internal structure of transactions. Wesaythato directly

2

depends on o if o precedes o in S and either o and o are op erations of the same transaction or o

1 1 2 1 2 1

con icts with o .Thedepends on relation is the transitive closure of the directly dep ends on relation. In

2

the schedule S shown in Figure 2, w [y ] do es not con ict with either w [x]or r [z ], but r [z ] is a ected by

1 2 1 1 1

w [y ]. Since the user's relative atomicity sp eci cations do es not allow T in the atomic unit w [x]r [z ] , S

2 2 1 1 1

is not a correct schedule. If the dep ends on relation is based only on direct con icts then the schedule S will

1

b e considered as a correct schedule. Hence the e ects from w [y ]tor [z ] should b e captured in the dep ends

2 1

on relation, so as to rule out S as a correct schedule. Another reason for using the notion of dep ends on

1 5

Consider a set of transactions T = fT ;T ;T g where

1 2 3

T = w [x]r [z ]

1 1 1

T = w [y ]

2 2

T = r [y ]w [z ]

3 3 3

Atomicity (T ;T ): w [x]r [z ] Atomicity (T ;T ): r [y ] w [z ]

1 2 1 1 3 1 3 3

Atomicity (T ;T ): w [x] r [z ] Atomicity (T ;T ): r [y ] w [z ]

1 3 1 1 3 2 3 3

Atomicity (T ;T ): w [y ]

2 1 2

Atomicity (T ;T ): w [y ]

2 3 2

S = w [x]w [y ]r [y ]w [z ]r [z ]

1 1 2 3 3 1

Figure 2: An example to show that direct con icts are not sucient for correctness

relation, which generalizes the notion of con icts, is to maintain the corresp ondence b etween our correctness

criterion with the traditional correctness criterion based on serializability. This is discussed b elow after the

formal de nition of correct schedules in our mo del.

For notational convenience, in the rest of the pap er, we index transactions and the op erations within

th

a transaction. For example, op eration o is the j op eration of transaction T .Wenow de ne correct

ij i

schedules in our mo del that are referred to as relatively serial schedules.

De nition2 S is a relatively serial schedule over T if for all transactions T and T , if an op eration o

i l ij

of T is interleaved with an AtomicU nit(k; T ;T ) for some k , then o do es not dep end on any op eration

i l i ij

o 2 AtomicU nit(k; T ;T ) and vice-versa.

lm l i

Consider the following schedule S over T given in Figure 1:

rs

S = r [x]r [y ]w [x]w [y ]w [x]w [z ]w [y ]r [x]r [y ]w [z ]

rs 1 2 1 2 3 1 3 2 1 3

In S op eration r [y ]isinterleaved with AtomicU nit(1;T ;T ) and r [y ] do es not dep end on r [x]and w [x]

rs 2 1 2 2 1 1

do es not dep end on r [y ]. Similarly for the other interleavings: w [z ]interleaved with AtomicU nit(2;T ;T )

2 1 2 1

and AtomicU nit(1;T ;T ) and r [x]interleaved with AtomicU nit(2;T ;T ). Hence, S is relatively serial.

3 1 2 1 2 rs

The notion of relatively serial schedules is analogous to the notion of serial schedules in the serializability

theory. In particular, there exist schedules that are not relatively serial but mayhave the same b ehavior as

some relatively serial schedules. We de ne a schedule to b e relatively serializable if it is con ict equivalent

to some relatively serial schedule. For example, the following schedule S over T given in Figure 1:

1

S = r [x]r [y ]w [y ]w [x]w [x]r [x]w [z ]w [y ]r [y ]w [z ]

2 1 2 2 1 3 2 1 3 1 3 6

is not relatively serial since w [x]isinterleaved with AtomicU nit(2;T ;T )andr [x] dep ends on w [x].

1 2 1 2 1

However, S is relatively serializable since it is con ict equivalent to the relatively serial schedule S given

2 rs

ab ove.

The relative atomicity mo del is a generalization of the traditional absolute atomicity mo del. That is, if

the sp eci cations are such that each transaction is a single atomic unit with resp ect to all other transactions,

then relative atomicity reduces to absolute atomicity. When restricted to absolute atomicity of transactions,

relatively serial schedules are di erent from serial schedules. Every serial schedule is a relatively serial

schedule since each op eration of a serial schedule is not interleaved within the atomic unit of any transaction.

Relatively serial schedules allow arbitrary interleavings (within atomic units) of op erations that do not have

any dep endencies b etween them. It is imp ortant that the intro duction of a new correctness de nition should

not contradict the correctness criterion in the traditional mo del. In the following lemma, weshow that the

de nition of relatively serial schedules is such that, under absolute atomicity, the same correctness as that

in the traditional mo del is still maintained.

Lemma 1 When relative atomicity is restricted to the traditional absolute atomicity model, any relatively

serial schedule is con ict equivalent to some serial schedule.

Proof: Consider a relatively serial schedule S on T .IfS is serial then the lemma is trivially satis ed. If S

rs rs rs

is not serial, assume for contradiction that there do es not exist any serial schedule that is con ict equivalent

to S . Consider the serialization graph SG(S ) for S [Pap79,BSW79]. SG(S ) has transactions in T

rs rs rs rs

as its no des and T ! T is an edge in SG(S ) if an op eration of T con icts and precedes an op eration

i k rs i

of T in S . Since S is not con ict serializable, SG(S ) has a cycle. Weshowthatforeach edge from

k rs rs rs

T ! T in SG(S ), o precedes o in S . Consider an edge T ! T in SG(S ). This implies that

i k rs i1 k 1 rs i k rs

there exist op erations, say, o and o , suchthato con icts and precedes o in S . Since S is relatively

ij kl ij kl rs rs

serial, o precedes the atomic unit of T .Thus o precedes o in S and consequently o precedes o in

ij k ij k 1 rs i1 k 1

S . This implies that for any cycle in SG(S ), the rst op eration of every transaction in the cycle precedes

rs rs

itself in S ,acontradiction. Hence the lemma. 2

rs

In the absolute atomicitymodel,every serial schedule is a relatively serial schedule. From the de nition

of relatively serializable schedules and Lemma 1, it is clear that under absolute atomicity,any relatively

serializable schedule is equivalent to a serial schedule. Thus, the set of relatively serializable schedules is

exactly the same as the set of con ict serializable schedules [Pap79, BSW79] under absolute atomicity.Hence,

our mo del retains the standard notion of correctness when the relative atomicity sp eci cations are restricted

to sp ecify the traditional transaction mo del.

3 EcientTesting of Relatively Serializable Schedules

In this section wedevelop a graph that can b e used to determine whether a given schedule is relatively

serializable. Our approach is analogous to the traditional serializability theory in which a serialization graph

is used to determine whether a given schedule is con ict serializable. Wede netwo complementary notions

of pushing forward or pulling backward an op eration. Let o b elong to AtomicU nit(m; T ;T ). We de ne

ij i k 7

P ushF or w ar d(o ;T )tobeoperationo where o is the last op eration of AtomicU nit(m; T ;T ). Analo-

ij k ip ip i k

gously,we de ne P ullBackward(o ;T ) to b e op eration o where o is the rst op eration of AtomicU nit(m; T ;T ).

ij k iq iq i k

For example in Figure 1, P ushF or w ar d(r [x];T )isw [x] and P ul l B ack w ar d(r [y ];T )isw [z ]. The moti-

1 2 1 1 2 1

vation for the ab ovetwo notions is as follows. Let an op eration o of transaction T be interleaved b etween

kl k

op erations o and o of another transaction T in some schedule S . Furthermore, assume T is not

ij ij +1 i k

allowed to interleavebetween o and o as p er the relative atomicity sp eci cations. In that case, S

ij ij +1

can b e \corrected" if o canbepulledbackward b efore P ullBackward(o ;T ) or pushed forward after

kl ij +1 k

P ushF or w ar d(o ;T ). However, since our de nition of relatively serial schedules allows certain op erations

ij k

to b e interleaved in an atomic unit (i.e., op erations that do not have the dep ends on relation with op era-

tions in an atomic unit), the pushing and pulling needs to b e p erformed conditionally.We formalize these

arguments in the following de nition of the relative serialization graph.

De nition3 The relative serialization graph of a schedule S over T , denoted RS G(S )=(V; E), is a

directed graph whose vertices V are the set of op erations of the transactions in T and whose arcs E are as

follows:

1. Internal Arcs (I - ar cs). E contains all the internal arcs of the form o ! o where o and o

ij ij +1 ij ij +1

are consecutive op erations in T for all T 2T.

i i

2. Dependency Arcs (D -ar cs). E contains all the dep endency arcs of the form o ! o such that i 6= k

ij kl

and o dep ends on o in S . Note that these arcs also capture con icts.

kl ij

3. Push ForwardArcs (F -ar c). For each D - ar c o ! o weaddP ushF orward(o ;T ) ! o in E .

ij kl ij k kl

4. Pul l BackwardArcs (B - ar c). For each D - ar c o ! o we add o ! P ullBackward(o ;T )inE .

kl ij kl ij k

 

Lynch [Lyn83]aswell as Farrag and Ozsu [FO89] use the notion of pushing forward an op eration out

of an atomic unit. However, neither of them employed the notion of pulling backward an op eration out of

an atomic unit. In Figure 3, we provide an example of the relative serialization graph resulting from the

following schedule S over T:

2

S = w [x]r [x]r [z ]w [y ]r [y ]r [z ]

2 1 2 3 2 3 1

w [x]r [z ] is atomic with resp ect to T and since r [x] dep ends on w [x], RS G(S ) For example, since

1 1 2 2 1 2

contains the F -ar c from r [z ]to r [x]. Since r [z ]r [y ] is atomic relativetoT and r [y ] dep ends on w [y ],

1 2 3 3 2 3 2

RS G(S )contains the B -ar c from w [y ]tor [z ].

2 2 3

Wenowprove that acyclicityofRS G(S ) is b oth a necessary and sucient condition for schedule S to

0

b e relatively serializable. In the following, wesay that an arc o ! o in RS G(S )isconsistent with S if o

0

precedes o in S .We start by establishing that the relative serialization graph of a relatively serial schedule

is acyclic.

Lemma 2 If S isarelatively serial schedule over T then RS G(S ) is acyclic.

Proof:We will showthatevery arc of RS G(S ) is consistent with S . It is easy to see that the I -ar cs and

D -ar cs in RS G(S ) are consistent with S . Consider an F -ar c, o ! o in RS G(S ). This implies that there

ip kl 8

is a D - ar c from o ! o , j  p where o and o are in the same atomic unit, say AtomicU nit(m; T ;T ),

ij kl ij ip i k

and o is the last op eration in AtomicU nit(m; T ;T ). Since o dep ends on o ,andS is relatively serial,

ip i k kl ij

o must app ear after AtomicU nit(m; T ;T )inS .Thus the F -ar c o ! o in RS G(S ) is consistent with

kl i k ip kl

S . Similarly, it can b e shown that any B -ar c in RS G(S ) is consistentwithS . Since all arcs in RS G(S )are

consistent with S and S is a total order, RS G(S ) is acyclic. 2

Consider a set of transactions T = fT ;T ;T g where

1 2 3

I T = w [x]r [z ]

1 1 1

c

w [x] r [z ] c -

1 1

A @

T = r [x]w [y ]

2 2 2

A @

D,B F

A @

T = r [z ]r [y ]

3 3 3

@R

A

D,B F

@

? ?

A

@

A

@

A

@

D,F,B AU

Atomicity (T ;T ): w [x]r [z ]

1 2 1 1

@

A

c

r [x] - @ w [y ] c

A

2 2

w [x] r [z ] Atomicity (T ;T ):

1 1 1 3

@

A

I B

@

A

@

A

@R

A

B D,F Atomicity (T ;T ): r [x] w [y ] D,F

2 1 2 2

? ?

@

A @

Atomicity (T ;T ): r [x] w [y ]

2 3 2 2 A @

A @

A @

-

r [z ] r [y ] A @ c

c

3 3

Atomicity (T ;T ): r [z ] r [y ]

3 1 3 3

I

Atomicity (T ;T ): r [z ]r [y ]

3 2 3 3

Figure 3: An example of a relative serialization graph

Theorem 1 A schedule S over T is relatively serializable if and only if RS G(S ) is acyclic.

Proof: Assume S is relatively serializable. Then there exists a relativelyserialschedule S over T which

rs

is con ict equivalenttoS . The I -ar cs are obviously the same in RS G(S )andRS G(S ). The D -ar cs of

rs

RS G(S ) and RS G(S ) are identical b ecause of the con ict equivalence of S and S . Since the F -ar cs and

rs rs

B -ar cs dep end only on the I - ar cs, D -ar cs, and the relative atomicity sp eci cations for T , RS G(S )and

RS G(S ) are identical. It follows from Lemma 2 that RS G(S ) is acyclic.

rs

Assume that RS G(S ) is acyclic. Let S be a schedule obtained by top ologically sorting RS G(S ).

rs

Clearly, S and S are con ict equivalent and therefore RS G(S ) is the same as RS G(S ). It remains to

rs rs

showthatS is relatively serial. Assume for contradiction that there exists an op eration o interleaved with

rs ij

AtomicU nit(m; T ;T )whichcontains o suchthato dep ends on o or o dep ends on o in S .Leto

k i kl ij kl kl ij rs kp

b e the last op eration of AtomicU nit(m; T ;T ) and let o b e the rst op eration of AtomicU nit(m; T ;T ).

k i kq k i

If o dep ends on o in S then there is an F -ar c o ! o in RS G(S ), hence in any top ological sort of

ij kl rs kp ij 9

RS G(S ), o precedes o .However, o precedes o in S since o is interleaved in AtomicU nit(m; T ;T ),

kp ij ij kp rs ij k i

a contradiction. If o dep ends on o in S then there is a B - ar c o ! o in RS G(S ), hence in any

kl ij rs ij kq

top ological sort of RS G(S ), o precedes o . Again weobtainacontradiction since o precedes o in S

ij kq kq ij rs

by our assumption. Therefore S is relatively serial. 2

rs

The relative serialization graph provides an ecient (p olynomial) metho d for recognizing relatively se-

rializable schedules. This graph can b e used as the basis for a concurrency control proto col similar to

serialization graph testing [Bad79, Cas81]. We are currently investigating lo cking proto cols for ensuring

relative serializability of transactions with relative atomicity.

4 Related Work

The relative atomicity mo del is a generalization of the traditional absolute atomicity mo del. In particular,

our mo del retains the standard notion of correctness based on on con ict serializability[Pap79, BSW79] when

the relative atomicity sp eci cations are restricted to sp ecify the traditional transaction mo del. Although the

prop osed mo del is useful in environments where transaction semantics is available, it mayaswell b e used in

the standard database systems without jeopardizing correctness.

One of the earliest prop osals to depart from absolute atomicity of transactions was prop osed by Garcia-

Molina [Gar83]. However, his approach for relaxing atomicity of transactions is a sp ecial case of relative

atomicity. Although Lynch [Lyn83] prop osed relative atomicity, her mo del is restricted to hierarchical

relative atomicity sp eci cations called multilevel atomicity. Lynch has prop osed a graph-based to ol for

eciently recognizing schedules that are equivalenttomultilevel atomic schedules. From the users p ointof

view, however, multilevel atomicity imp oses several constraints in sp ecifying interleavings thus reducing its

applicability. Relative atomicity, on the other hand, imp oses no constraints on the user sp eci cations. It

is easy to construct examples that can b e sp eci ed using relative atomicity but cannot b e sp eci ed using

multilevel atomicity.



Wenow compare the set of relatively consistentschedules [FO89] and the set of relatively serializable

schedules under relative atomicity. Since relatively consistentschedules are con ict equivalent to relatively



atomic [FO89] schedules and the set of relatively atomic schedules is a subset of the set of relatively serial

schedules, it follows that relatively consistentschedules are also relatively serializable. The prop er contain-

ment of the set of relatively consistentschedules in the set of relatively serializable schedules is demonstrated

by the example in Figure 4. The schedule S given in Figure 4 is a relatively serial schedule. However, S

is not con ict equivalenttoany relatively atomic schedule, since the op erations of T cannot b e moved out

1

of the atomic unit of T as seen by T . In fact op erations w [x] and w [y ] cannot b e rearranged to obtain

3 1 1 1

equivalent relatively atomic schedule since T and T do not p ermit T in their resp ective atomic units. The

4 2 1

relationships among the classes describ ed ab oveisgiven in Figure 5. The inclusions of the sets followfrom

the de nitions. The example given in Figure 4 shows that the set of relatively serializable schedules prop erly

 

contains the set of relatively consistentschedules de ned byFarrag and Ozsu [FO89].

There have b een other prop osals to weaken the atomicity of transactions for improving concurrency.

However, these approaches remain within the con nes of traditional serializability. Their primary goal is to

relax the two phase restriction of strict two phase lo cking. Wolfson [Wol86,Wol87] uses preanalysis of read 10

Consider a set of transactions T = fT ;T ;T ;T g where

1 2 3 4

T = w [x]w [y ]

1 1 1

T = w [z ]w [y ]

2 2 2

T = w [t]w [z ]

3 3 3

T = w [x]w [t]

4 4 4

Atomicity (T ;T ): w [x]w [y ] Atomicity (T ;T ): w [z ]w [y ]

1 2 1 1 2 1 2 2

Atomicity (T ;T ): w [x]w [y ] Atomicity (T ;T ): w [z ]w [y ]

1 3 1 1 2 3 2 2

Atomicity (T ;T ): w [x]w [y ] Atomicity (T ;T ): w [z ] w [y ]

1 4 1 1 2 4 2 2

Atomicity (T ;T ): w [t]w [z ] Atomicity (T ;T ): w [x]w [t]

3 1 3 3 4 1 4 4

Atomicity (T ;T ): w [t] w [z ] Atomicity (T ;T ): w [x] w [t]

3 2 3 3 4 2 4 4

Atomicity (T ;T ): w [t] w [z ] Atomicity (T ;T ): w [x] w [t]

3 4 3 3 4 3 4 4

S = w [x]w [t]w [t]w [x]w [y ]w [z ]w [y ]w [z ]

4 3 4 1 1 2 2 3

Figure 4: A relatively serial schedule that is not relatively consistent

relatively serializable

relatively serial

relatively consistent

relatively atomic

Figure 5: Relationships among the di erent correctness classes 11

and write sets of transactions to eliminate the two phase lo cking rule. Shasha et al. [SSV92] have prop osed

achopping graph to re ne user transactions such that only the smaller units of the transactions instead of

the entire one need to b e executed using strict two phase lo cking.

5 Discussion

In this pap er wehave develop ed a theory for relaxing the atomicity of transactions to increase concurrency

in database systems. Our approach is general in that it imp oses minimal restrictions on the users to sp ecify

relative atomicity of transactions. Wehaveshown that the set of relatively serializable schedules de ned in

this pap er is larger than all previous prop osals. In spite of b eing more p ermissive, this class can b e eciently

recognized by testing for the acyclicity of a directed graph. In fact, acyclicity of the graph is b oth a necessary

and sucient condition for correctness.

We draw an analogy from the historical development of serializability theory to provide some insightinto

the signi cance of our approach. In the traditional transaction mo del, view serializability represented the

intuitive correctness criterion based on the user's view of the database. This resulted in a class of schedules

whichwere found to b e intractable. Therefore a restrictive class containing con ict serializable schedules

was accepted as the set of correct schedules. In the relative atomicity mo del the equivalence to relatively

atomic schedules is the intuitive correctness criterion based on the user's relative atomicity sp eci cations.

However in spite of using con ict equivalence this correctness criterion results in a class of schedules which

is NP-complete. As wehave addressed earlier the relative atomicity sp eci cations tend to b e conservative.

Hence we relaxed the class of correct schedules to allow for interleavings which can b e determined to b e

correct only at execution time. The theory wehavedevelop ed is based on a generalization of the notion of

con icts and it provides us with a class which can b e eciently recognized with a graph based to ol. Unlike

in the traditional mo del, wehavebeenabletomake the problem tractable without having to compromise

on the size of the new class. In fact, the class of relatively serializable schedules is larger than the class of

relatively consistentschedules. The next step, in traditional databases was the development of more ecient

lo cking based proto cols suchasthetwo phase lo cking proto col [EGLT76] which recognize subsets of the

set of con ict serializable schedules. We are currently developing such ecient, lo ck based proto cols for

recognizing relatively serializable executions.

We conclude by emphasizing the wide applicability of relative atomicitytomany advance database

applications. In particular, weenvision relative atomicity to b e esp ecially useful for systems with long

lived transactions as well as several advanced collab orative database environments. In fact, for long live

transactions, Salem, Garcia-Molina and Alonso [SGMA87] prop osed the use of altruistic lo cking where a

transaction is allowed to explicitly release a lo ck early so as to allow other transactions to observe it results.

In [SGMA87] it is argued and exp erimentally shown that suchlocks provide improved p erformance for long-

lived transactions. Relative atomicity can b e viewed as a natural generalization of this approach where

di erent degrees of atomicity are allowed with resp ect to di erent transactions. A long-lived transactions

do es not need to b e atomic for its entire duration with resp ect to all other transactions. Rather, di erent

atomic units may b e allowed, thus providing more exibility and concurrency in the system. Finally, in the

case of collab orativeadvanced database applications, such as CAD/CAM design environments, users are 12

often partitioned naturally into groups with various information ow and dep endency constraints. Relative

atomicity sp eci cations can b e easily used to capture suchinterdep endencies. For example, within each

group anyinterleavings may b e allowed while di erent atomicity units can b e sp eci ed among the di erent

groups dep ending on the degree of collab oration. Most existing prop osals for collab oration are ad-ho c and

lack a clear theoretical foundation. We b elieve that our mo del provides such a foundation. Furthermore, the

main hurdle, in our opinion, for using relative atomicity technique in suchenvironments was due to their

computational complexity.Webelieve that our prop osal represents a signi cant rst step towards alleviating

these problems, and will make suchinteractions easy and eciently manageable.

References

[Bad79] D. Z. Badal. Correctness of Concurrency Control and Implications in Distributed Databases. In

IEEE Proceedings of COMPSAC Conference, pages 588{593, Novemb er 1979.

[BK91] N. S. Barghouti and G. E. Kaiser. Concurrency Control in Advanced Database Applications.

ACM Computing Surveys, 23(3):269{318, September 1991.

[BR92] B. R. Badrinath and K. Ramamritham.Semantics-Based Concurrency Control: Beyond Com-

mutativity. ACM Transactions on Database Systems, 17(1):163{199, March 1992.

[BSW79] P. A. Bernstein, D. W. Shipman, and W. S. Wong. Formal Asp ects of Serializability in Database

Concurrency Control. IEEE Transactions on Software Engineering, 5(5):203{216, May 1979.

[Cas81] M. A. Casanova. The Concurrency Control Problem of Database Systems,volume 116 of Lecture

Notes in Computer Science. Springer-Verlag, Berlin, 1981.

[EGLT76] K. P. Eswaran, J. N. Gray, R. A. Lorie, and I. L. Traiger. The Notions of Consistency and

Predicate Lo cks in a Database System. Communications of the ACM, 19(11):624{633, November

1976.

 

[FO89] A. A. Farrag and M. T. Ozsu. Using Semantic Knowledge of Transactions to Increase Concur-

rency. ACM Transactions on Database Systems, 14(4):503{525, Decemb er 1989.

[Gar83] H. Garcia-Molina. Using Semantic Knowledge for Transaction Pro cessing in a Distributed

Database. ACM Transactions on Database Systems, 8(2):186{213, June 1983.

[Her86] M. Herlihy. A Quorum-Consensus Metho d for Abstract Data Typ es. ACM Trans-

actions on Computer Systems, 4(1):32{53, February 1986.

[KB92] V. Krishnaswamy and J. Bruno. On the Complexity of Concurrency Control using Semantic

Information. Technical Rep ort TRCS 92-21, Department of Computer Science, Universityof

California, Santa Barbara, CA 93106, 1992.

[Kor83] H. F. Korth. Lo cking Primitives in a Database System. Journal of the ACM, 30(1):55{79,

January 1983. 13

[Kri93] V. Krishnaswamy. Semantics based Concurrency Control. PhD thesis, Department of Computer

Science, University of California, Santa Barbara, 1993. In preparation.

[Lyn83] N. A. Lynch. Multilevel Atomicity { A New Correctness Criterion for Database Concurrency

Control. ACM Transactions on Database Systems, 8(4):485{502, Decemb er 1983.

[Pap79] C. H. Papadimitriou. The Serializability of Concurrent Database Up dates. Journal of the ACM,

26(4):631{653, Octob er 1979.

[RSL78] D. J. Rosenkrantz,R.E.Stearns,andP. M. Lewis. System Level Concurrency Control for

Distributed Database Systems. ACM Transactions on Database Systems, 3(2):178{198, June

1978.

[SGMA87] K. M. Salem, H. Garcia-Molina, and R. Alonso. Altruistic Lo cking: A Strategy for Coping

with Long-Lived Transactions. In D. Gawlick, M. Haynie, and A. Reuter, editors, Proceedings

of the Workshop on High PerformanceTransaction Processing,volume 359 of Lecture Notes in

Computer Science, pages 175{199. Springer-Verlag, 1987.

[SS84] P.M.Schwarz and A. Z. Sp ector. Synchronizing Shared Abstract Typ es. ACM Transactions on

Computer Systems, 2(3):223{250, August 1984.

[SSV92] D. Shasha, E. Simon, and P.Valduriez. Simple Rational Guidance for Chopping Up Transactions.

In Proceedings of the 1992 ACM SIGMOD International Conference on Management of Data,

pages 298{307, June 1992.

[Wei89] W. E. Weihl. Lo cal Atomicity Prop erties: Mo dular Concurrency Control for Abstract Data

Typ es. ACM Transactions on Programming Languages and Systems, 11(2):249{283, April 1989.

[Wol86] O. Wolfson. An Algorithm for Early Unlo cking of Entities in Database Transactions. Journal of

Algorithms, 7(1):146{156, 1986.

[Wol87] O. Wolfson. The Virtues of Lo cking bySymb olic Names. Journal of Algorithms, 8:536{556, 1987. 14