ppt slides

789 views
699 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
789
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

ppt slides

  1. 1. Chapter 11 Grid Concurrency Control 11.1 A Grid Database Environment 11.2 An Example 11.3 Grid Concurrency Control (GCC) 11.4 Correctness of GCC 11.5 Features of GCC Protocol 11.6 Summary 11.7 Bibliographical Notes 11.8 Exercises
  2. 2. Grid Concurrency Control <ul><li>Concurrency control protocol helps to maintain the consistency of data in database </li></ul><ul><li>Concurrency control protocol addresses ‘C’ and ‘I’ of ACID properties </li></ul><ul><li>Serializability in the most widely accepted correctness criterion </li></ul><ul><li>Different DB architecture needs different concurrency control protocol, i.e. concurrency control protocol for a centralized DBMS will be different that that of a distributerd DBMS </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  3. 3. 11.1 A Grid Database Environment <ul><li>Data is geographically distributed in Grid environment. A typical working of database in Grid architecture is shown in the figure </li></ul><ul><li>A distributed grid DB with 3 sites are shown, DB1, DB2, and DB3 (connected via grid middleware) </li></ul><ul><li>Transactions can be submitted at any site and may need to access data from all the sites </li></ul><ul><li>Originator / coordinator is a site where transaction is submitted </li></ul><ul><li>Transactions T1 and T2 submitted to DB1 and they needs to access data from DB2 and DB3 as well </li></ul><ul><li>Transaction and site identifiers are suffixed, e.g. T1 will have sub-transactions ST12 & ST13; and T2 will have sub-transactions ST21 and ST22 </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  4. 4. 11.1 A Grid Database Environment (Cont’d) <ul><li>Data access must be synchronized to maintain correctness of data </li></ul><ul><li>Global lock tables, global logs etc cannot be implemented in Grid environment </li></ul><ul><li>Different DB sites may implement different concurrency control procols, e.g. one site may use locking whereas other site may use optimistic concurrency control protocol </li></ul><ul><li>This situation is unavoidable in Grid architecture due to heterogeneous DB sites </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  5. 5. 11.2 An Example <ul><li>Following example shows that using traditional concurrency control protocols in the Grid environment may potentially corrupt the data </li></ul><ul><li>Example </li></ul><ul><li>Consider four data objects are stored in two databases DB2 and DB3: </li></ul><ul><li>DB 2 = O1 and O2 </li></ul><ul><li>DB 3 = O3 and O4 </li></ul><ul><li>Two transactions are submitted to the database DB1, as shown below: </li></ul><ul><li>T1 = r1(O1) r1(O2) w1(O3) w1(O1) C1 </li></ul><ul><li>T2 = r2(O1) r2(O3) w2(O4) w2(O1) C2 </li></ul><ul><li>The transactions are submitted to the Grid middleware and the metadata service forms required sub-transactions as follows: </li></ul><ul><ul><li>Sub-transactions of T1: </li></ul></ul><ul><ul><li>ST12 = r12(O1) r12(O2) w12(O1) C12 (11.1) </li></ul></ul><ul><ul><ul><li>ST13 = w13(O3) C13 (11.2) </li></ul></ul></ul><ul><ul><li>Sub-transactions of T2: </li></ul></ul><ul><ul><li>ST22 = r22(O1) w22(O1) C22 (11.3) </li></ul></ul><ul><ul><li>ST23 = r23(O3) w23(O4) C23 (11.4) </li></ul></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  6. 6. 11.2 An Example (Cont’d) <ul><li>The sub-transactions are submitted to respective sites, i.e. ST12 and ST22 are submitted to DB2 and ST13 and ST23 are submitted to DB3 </li></ul><ul><li>As all DB sites are autonomous and hence schedules/histories are created independently. Say DB2 create following history: </li></ul><ul><li> H2 = r12(O1) r12(O2) w12(O1)C12 r22(O1) w22(O1) C22 (11.5) </li></ul><ul><li>and DB3 creates following history: </li></ul><ul><li> H3 = r23(O3) w23(O4) C23 w13(O3) C13 (11.6) </li></ul><ul><li>From equation 11.5 serializability order: T1 execute before T2 and from equation 11.6 serializability order: T2 executes before T1 </li></ul><ul><li>Though there is no problem in executing histories H2 and H3 in isolation, but when both histories are combined then serilaizability graph produces a cycle T1  T2  T1 </li></ul><ul><li>Traditional distributed DB handles this situation by implementing a global management, which is not possible in Grid Databases. Next, Grid Concurrency Control protocol is discussed </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  7. 7. 11.3 Grid Concurrency Control (GCC) <ul><li>The above example is the motivation for GCC; where, though individual sites generate serializable schedules, in global view of things the transactions may be ordered incorrectly </li></ul><ul><li>Functions required by GCC: </li></ul><ul><ul><li>DB_Accessed(T) : takes the global transaction as argument and returns set of databases where sub-transactions of the global transaction are submitted </li></ul></ul><ul><ul><li>Split_Trans(T) : takes the global transaction as argument and returns a set of sub-transactions </li></ul></ul><ul><ul><li>Active_Trans( DB) : takes the database as an argument and returns the set of global transactions having any sub-transaction running in the database </li></ul></ul><ul><ul><li>Cardinality (Any Set) : takes any set, e.g. set of databases or set of sub-transactions and returns the number of elements in the set </li></ul></ul><ul><ul><li>Append_TS (Subtransaction) : takes the sub-transaction as an argument and attaches a unique timestamp to it. Sub-transactions of same global transaction will have same timestamp value </li></ul></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  8. 8. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Grid Serializability Theorem </li></ul><ul><li>Traditional Conflict Serializability is not sufficient to ensure consistency in Grid database environment </li></ul><ul><li>Grid serializability theorem is needed to ensure correctness of data </li></ul><ul><li>Global transactions can be classified in 2 categories: </li></ul><ul><ul><li>Global transactions with only one sub-transaction and </li></ul></ul><ul><ul><li>Global transaction having more than one sub-transaction </li></ul></ul><ul><li>Total order is defined as below: </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  9. 9. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>In traditional serializability theory, serial history is considered correct. On the same ground Grid-serial history is considered correct in Grid architecture </li></ul><ul><li>Grid serial history is defined as below: </li></ul><ul><li>Condition (1) of definition 11.2 is very strict and does not allow interleaving of operations </li></ul><ul><li>Hence a more practical approach, Grid Serializable history is used </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  10. 10. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Grid serializable history: </li></ul><ul><li>Grid serializability is analysed by the grid serializability graph </li></ul><ul><li>If the graph is acyclic the history is Grid serializable </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008 D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  11. 11. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Grid Serializability graph is defined as below: </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  12. 12. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Condition (1) considers local transactions in Grid Serializability graph </li></ul><ul><li>Condition (2) only considers those global transactions having more than one subtransaction </li></ul><ul><li>Condition (3) shows the arc between conflicting transactions </li></ul><ul><li>Grid serializability graph is stored at local sites as there is no global management layer </li></ul><ul><li>Following types of conflicts are possible: </li></ul><ul><ul><li>Conflict between global transactions (global-global conflict) </li></ul></ul><ul><ul><li>Conflict between global transaction and local transaction (global-local conflict) </li></ul></ul><ul><ul><li>Conflict between local transactions (local-local conflict) </li></ul></ul><ul><li>Acyclic Grid-serializability graph is used to resolve global-local conflict </li></ul><ul><li>Total-order is used to resolve global-global conflict </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  13. 13. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Based on the Grid serializability graph and total order Grid serializability theorem is as follows: </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  14. 14. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Example of Grid serializability graph: </li></ul><ul><li>In addition to the global transaction (in earlier example), consider additional local transactions as follows: </li></ul><ul><li>Local Transactions. ( LT12 is read as local transaction 1 at database site DB2): </li></ul><ul><li>LT12 = lr12(O1) lw12(O2) lC12 </li></ul><ul><li>LT13 = lw13(O3) lC13 </li></ul><ul><li>Now consider following modified histories: </li></ul><ul><li>H2 = lr12(O1) r12(O1) r12(O2) w12(O1)C12 r22(O1) w22(O1) lw12(O2) C22 lC12 </li></ul><ul><li>H3 = r23(O3) w23(O4) lw13(O3) C23 w13(O3) C13 lC13 </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  15. 15. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Following figure shows the Grid serializability graph at sites DB2 and DB3 </li></ul><ul><li>Three possible types of conflicts are discussed below: </li></ul><ul><ul><li>Global-global conflict : At site DB2, ST12 precedes ST22 (i.e. T1 precedes T2) and at site DB3, ST23 precedes ST13 (i.e. T2 precedes T1). Thus a cycle is formed at different sites. And it may be impossible to identify the cycle without a global management layer. Total order used in Grid serializability avoids formation of cycles are distributed sites </li></ul></ul><ul><ul><li>Global-local conflict : Can be identified and resolved by local DBMS, e.g. in DB2 ST12 and LT12 </li></ul></ul><ul><ul><li>Local-local conflict : Can be identified and resolved by local DBMS, similar to traditional DBMS </li></ul></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  16. 16. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Grid Concurrency Control Protocol </li></ul><ul><li>Has 2 phases: submission & termination </li></ul><ul><li>Site where transaction is submitted is called originator </li></ul><ul><li>Split_trans(T) function is used to generate multiple sub-transactions of global transaction </li></ul><ul><li>Sub-transactions are then submitted to participating sites </li></ul><ul><li>Unique timestamp is attached to each sub-transactions before submitting </li></ul><ul><li>Sub-transactions at local databases are executed in total-order </li></ul><ul><li>A local schedular does not distinguishes between a local transaction and a sub-transaction of global transaction </li></ul><ul><li>Global transaction with only one sub-transaction does not need to be in total-order as they cannot conflict with other global transaction at more than one site </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  17. 17. GCC (Cont’d) <ul><li>Submission phase of GCC </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  18. 18. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Step-1) Checks if data from multiple sites need to be accessed </li></ul><ul><ul><li>if data from only originator is required then treat as local transaction </li></ul></ul><ul><ul><li>If more multiple DB needs to be accessed then the transaction is submitted to metadata services. Split_trans(T) function is used to create sub-transactions </li></ul></ul><ul><li>Step-2) Global transactions are added to a set which stores all the currently executing global transactions. The set name is Active_Trans </li></ul><ul><li>Step-3) The middleware appends a timestamp to all sub-transactions before submitting it to respective databases </li></ul><ul><li>Step-4) If more than one active global transaction exists simultaneously that accesses more than one database, then sub-transactions are executed in total order (according to the timestamp) </li></ul><ul><li>Step-5) When all sub-transactions of a global transaction finish execution then the global transaction is removed from the Active_Trans set (details in termination phase of GCC) </li></ul><ul><li>Note : Active_Trans is a set of currently active global transactions and Active_trans(DB) is a function that take DB site as argument and returns active transactions executing in that database </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  19. 19. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Termination phase of GCC </li></ul><ul><li>A global transaction is active till even one of the sub-transaction is executing </li></ul><ul><li>Steps of termination are as follows: </li></ul><ul><ul><li>When a sub-transaction finishes execution, the originator is informed </li></ul></ul><ul><ul><li>Active Transactions, Conflicting Active Transactions and databases access by global transaction set are updated accordingly </li></ul></ul><ul><ul><li>Check whether the completed sub-transaction is the last sub-transaction of the global transaction </li></ul></ul><ul><ul><li>if not the last, then sub-transactions waiting in the queue cannot be scheduled </li></ul></ul><ul><ul><li>if the sub-transaction is the last sub-transaction of the global transaction, then other conflicting sub-transactions can be scheduled. Sub-transactions from the queue then follows the normal submission steps </li></ul></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  20. 20. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Termination phase of GCC </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  21. 21. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Revisiting the example of section 11.2 </li></ul><ul><li>Say, transaction T1’s timestamp is 1 and T2’s timestamp is 2 </li></ul><ul><li>History, H2, produced by site DB2 is a serial history (equation 11.5) with T1 preceding T2 </li></ul><ul><li>GCC will not schedule transactions as in H3 (equation 11.6) due to step-4) of the submission phase of GCC. It will always follow the total-order based on timestamp. Hence, sub-transactions of T1 will always be scheduled before sub-transactions of T2. GCC will generate histories H2 (equation 11.5) and H3 (equation 11.6) as follows: </li></ul><ul><li>H2 = r12(O1) r12(O2) w12(O1)C12 r22(O1) w22(O1) C22 (same as (11.5)) </li></ul><ul><li>H3 = w13(O3) C13 r23(O3) w23(O4) C23 (corrected execution order by the GCC protocol) </li></ul><ul><li>Thus both schedules have ordered the transactions in total-order with T1 preceding T2 </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  22. 22. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Comparison with traditional concurrency control protocols </li></ul>Operations of a general centralised locking protocol (e.g. centralised two phase locking) in homogeneous distributed DBMS D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  23. 23. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Operations of a general distributed locking protocol (e.g. decentralised two phase locking) in homogeneous distributed DBMS </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  24. 24. 11.3 Grid Concurrency Control (GCC) (Cont’d) <ul><li>Operations of a general Multi-DBMS protocol </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  25. 25. <ul><li>Operations of GCC protocol </li></ul>11.3 Grid Concurrency Control (GCC) (Cont’d) D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  26. 26. 11.4 Correctness of GCC Protocol <ul><li>Grid-serializable schedule is considered correct in Grid environment </li></ul><ul><li>A concurrency control protocol conforming to Theorem 11.1 is Grid serializable and thus is correct </li></ul><ul><li>Proposition 11.1: All local transactions and global subtransactions submitted to any local scheduler are scheduled in serializable order. </li></ul><ul><li>Proposition 11.2: Any two global transactions having more than one subtransaction actively executing simultaneously must follow total-order. </li></ul><ul><li>Based on the proposition 11.1 and 11.2 following theorem can be proved: </li></ul><ul><li>Theorem 11.2: Every schedule produced by GCC protocol is Grid-serializable. </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  27. 27. 11.5 Features of GCC Protocol <ul><li>Concurrency control in heterogeneous environment - Does not use global lock table etc. and hence can work in Autonomous, Heterogeneous environment </li></ul><ul><li>Reducing the load from originator site - As GCC does not use a centralized scheduling schemes, originator sites have reduced load </li></ul><ul><li>Reducing number of messages in the inter-network - Communication between the originator and other participating sites is reduced </li></ul><ul><li>But due to absence of global management layer, some of the valid interleaving may not be possible and hence may result in strict schedule </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  28. 28. 11.6 Summary <ul><li>Global management layer cannot be used in Grid environment </li></ul><ul><li>GCC protocol maintains the correctness of data in Grid environment </li></ul><ul><li>GCC protocol can work in heterogeneous environment </li></ul><ul><li>Optimizing the scheduling process may be hard </li></ul><ul><li>The focus was to maintain the consistency of data in Grid databases </li></ul>D. Taniar, C.H.C. Leung, W. Rahayu, S. Goel: High-Performance Parallel Database Processing and Grid Databases , John Wiley & Sons, 2008
  29. 29. Continue to Chapter 12…

×