Relative Serializability: an Approach for Relaxing the Atomicityoftransactions
Total Page:16
File Type:pdf, Size:1020Kb
Relative Serializability: An Approach for Relaxing the AtomicityofTransactions D. Agrawal J. L. Bruno A. El Abbadi V. Krishnaswamy Department of Computer 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 database 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]. Databases 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 concurrency control 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.