160 likes | 343 Views
Concurrency control in XML databases. Ali Abbasi. Concurrency in XML Bases. XML : standard format of data exchange on the internet XML docs is stored in databases Concurrency control is an important function of a DB Traditional CC protocols are not tailored to XML database systems
E N D
Concurrency control in XML databases Ali Abbasi
Concurrency in XML Bases • XML : standard format of data exchange on the internet • XML docs is stored in databases • Concurrency control is an important function of a DB • Traditional CC protocols are not tailored to XML database systems • New protocols designed based on different access methods : DOM, XPath, ...
XPath • XPath models an XML document as a tree of nodes. • XPath expressions are used to indicate the requested nodes in the XML tree • An Xpath exp : /S1,j /S2,j /S3,j /.../Sm,j • Si,j : Axis::NodeTest[Predicate]
Non-conflicting conditions • A transaction T is a sequence of pairs of operations Oj(x) and location path Lj • Operations are : pass-by, read, write, insert, delete • For any x,y, <Pi(x),Pj(y)>, <Pi(x),Rj(y)> and <Ri(x),Rj(y)>, • For any x,y, <Ri(x),Ij(y)>, <Wi(x),Ij(y)> • For any y, if there exists a location step S in location path L in Ti such that x is not a member of R(S) and RI(S), <Pi(x),Wj(y)>, <Pi(x),Ij(y)>, <Pi(x),Dj(y)>
Conflicting conditions • <Ri(x),Wj(x)>, <Ri(x),Dj(x)> • <Wi(x),Wj(x)>, <Wi(x),Dj(x)> • <Ii(x),Ij(x)>, <Ii(x),Dj(x)>, <Di(x),Dj(x)> • For any x, if there exists a location step S in location path L such that x is a member of R(S) or RI(S), <Pi(x),Wj(x)>, <Pi(x),Ij(x)>, <Pi(x),Dj(x)>
XLP • XLP is a lock-based protocol with five lock modes, denoted by P-, R-, W-, I- and D-locks • XLP is 2PL • Nodes in the M-set of Si,j (M(Si,j) and MI(Si,j)) are all locked by P-locks before performing the Node-Test and Predicate • Granularity Rules : • (1) Lock granularity of P-, R-, I-, or W-locks on a node is only the node itself. • (2) Lock granularity of D-locks on a node includes the whole subtree rooted at the node.
XLP • Compatibility Rule. • A particular type of lock on location step Si can be granted as long as the compatibility matrix is respected. • Release Rules • R-, W-, I- or D-locks on Nd(Lj) can only be released in the shrinking phase of a transaction. • P-locks on nodes in the set are released only in the shrinking phase; • Other P-locks on are released after location step Si,j finishes
Properties • XLP ensures conflict serializability. • XLP outperforms 2PL owing to the earlier release of P-locks and lower lock conflicts according to its lock compatibility matrix. • XLP fully supports most XPath’s axis operations • phantom problem may exist in some schedules under XLP
LWMGL • A lock-based CC protocol • XML documents have a hierarchical structure • Two hierarchical locking protocol: TL, MGL • None of them a is an appropriate solution • LWMGL is a hybrid of MGL and TL • It’s goal is preventing phantoms and providing high concurrency
pseudo-conflict: T1 retrieves all the /description elements T2 inserts price element Pseudo-conflict
phantom T1 retrieves all the elements in /Books/Book T2 inserts Discount
XIET data model • The element table schema E has a set of element records E = {indexing group, elements, rowID} • The data table schema D has a set of data records D = {rowID, TextString} • indexing group I = {G,S,D}
LWMGL Protocol • Find the target element by using GSD indices • Acquire S_locks for reading each element where the target element traverses subelements • Acquire X_locks on the leaf element in order to update the value in the data table • Acquire IX_lock on the parent for inserting a node for prohibiting phantom
LWMGL Protocol • Acquire IX locks from the root element to target element in order to delete an element in the element table so as to prohibit parent element deletion from other transactions during deletion. • Follow the order in locking from the parent element of the subelements to their child. In an unlocking fashion, follow it in the opposite direction, i.e., from the child element to the parent of the subelements.
References • Kuen-Fang Jea, Shih-Ying Chen, A High concurrency XPath-based locking protocol for XML Databases, In: Elsevier Science ,2005. • Yonggoo Choi, Songchum Moon, Lightweight multigranularity locking for transaction management in XML database systems, In: Elsevier Science ,2005. • Grabs, T., Bo¨hm, K., Schek, H.-J., XMLTM: efficient transaction management for XML documents. In: Proceedings of the ACM International Conference on Information and Knowledge Management, CIKM 2002
L :/child::a/descendant::d[position()=2] • M(S1,1)=R(S1,1)= {a} , MI(S1,1) and RI(S1,1) are empty • MI(S2,1)={b2, b3, c1, c2} , M(S2,1)={d1, d2, d3} • RI(S2,1)={b2, c1} , R(S2,1)={d2}.