csce824-lecture10

csce824-lecture10 - Replicated Databases Replicated...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Replicated Databases Replicated Databases Reading Reading Farkas Textbook: Ch. 12.5, 12.6 Textbook: Ch.13 CSCE 824 ­ Spring 2011 2 Review Review Locking protocols – 2PL – Chapter 11 – Lock types increases concurrency Reliability – 2PC – Chapter 12 – Site and network failures Farkas CSCE 824 ­ Spring 2011 3 2PC 2PC Coordinator Work Initial phase All Work requests competed Prepare phase Wait for all responses Global abort/commit Decision phase Abort/commit Farkas Participant Work request Work msg. Executes work Prepare msg. Abort/commit Global abort/commit ACK CSCE 824 ­ Spring 2011 Abort/commit vote Window of Uncertainty Abort/commit 4 Replicated Databases Replicated Databases Multiple copies of the same data items (databases) Consistency: – Local consistency – Mutual consistency Farkas CSCE 824 ­ Spring 2011 5 Replica Control Hides replication from transaction Knows location of all replicas Translates transaction’s request to access an item into request to access particular replica(s) Maintains some form of mutual consistency Farkas Farkas CSCE 824 ­ Spring 2011 66 One­Copy Serializability One­Copy Serializability (1SR) Farkas Extension of the serializability theory Effects of transactions on replicated data items should be the same as if they had been performed one at­a­time on a single set of date items CSCE 824 ­ Spring 2011 7 Example Replication x1 x2 Transaction x3 Issues – May reduce performance (complex operations) – Too expensive – Can’t control when replicas are updated Farkas Farkas 7/22/99 CSCE 824 ­ Spring 2011 8 8 Replica Control Replica Control Farkas Pessimistic replica control: at most one group can make an update – mutual consistency at all times Optimistic replica control: system must be available at all times. Correct if there is any violation of mutual consistency CSCE 824 ­ Spring 2011 9 Read One / Write All Replica Control Pessimistic approach Read the nearest replica Write all replicas – Synchronous : before transaction commits – Asynchronous case: eventually Advantage: − Mutual consistency − Performance benefits: reads transactions Disadvantage: availability is not always guaranteed E.g., Single Master/slave approach Farkas Farkas CSCE 824 ­ Spring 2011 10 10 Eager Single Master/Slave Eager Single Master/Slave Read­only transaction Update transaction commit Master Farkas Slave A Slave B CSCE 824 ­ Spring 2011 Slave C 11 Primary Copy Primary Copy Farkas Each data item may have different master More complex to ensure global serializability Transaction manager at the application site acts as a coordinator and sends the work requests to the primary sites of the data items CSCE 824 ­ Spring 2011 12 Primary Site – static Primary Site – static Primary site: most recent copy What happens if the network is partitioned? 1 DB1 DB0 Primary DB3 DB2 DB6 DB5 DB4 Farkas 2 CSCE 824 ­ Spring 2011 13 Majority Approach Majority Approach The group that contains the majority of the sites can process an update 1 DB0 DB3 DB1 DB2 DB5 DB4 Farkas DB6 CSCE 824 ­ Spring 2011 14 Majority Approach The group that contains the majority of the sites can process an update 2 1 DB3 DB1 DB2 DB6 DB5 DB4 Farkas Farkas (N+1)/2 DB0 CSCE 824 ­ Spring 2011 15 Majority Approach Majority Approach Farkas Advantages: more flexible than primary site Disadvantages: zero availability may still happen Who has the most recent copy? – Version number: Each site assigns a version number to the copy (initially VN=0) After an update, the VN is incremented by 1 CSCE 824 ­ Spring 2011 16 Quorum Consensus Quorum Consensus Each sites are not equal Special case of majority approach W=5 Total=22 DB0 W=2 W=3 DB3 DB1 W=1 DB4 W=15 Farkas DB2 CSCE 824 ­ Spring 2011 W=1 DB6 DB5 W=1 Total=6 17 Other Approaches Other Approaches Farkas Dynamic Linear: order sites linearly to calculate majority Token­based primary site (moving token): change the location of the primary site CSCE 824 ­ Spring 2011 18 Pessimistic Replica Control Pessimistic Replica Control Advantages: – Mutual consistency at all times – Know the latest version ( between two consecutive updates, there is a site in common) Disadvantage: – May result in zero availability Farkas CSCE 824 ­ Spring 2011 19 Optimistic Replica Control Optimistic Replica Control Goal: availability at all time Issues: consistency may not be guaranteed – Need an algorithm to detect whether an inconsistency occurred – Take actions to fix any inconsistencies Farkas CSCE 824 ­ Spring 2011 20 Example Optimistic Alg. Example Optimistic Alg. Farkas Two partitions P1, P2 Assumption: separately, P1 and P2 produces serializable histories Need: after P1 and P2 joins again: Detect which transactions violate global serializability CSCE 824 ­ Spring 2011 21 Example cont. Example cont. Farkas Items read by transaction T: read(T) Items written by transaction T: write(T) Assume: write(T) ⊆ read(T) Transactions in P1: T1i , in P2: T2i CSCE 824 ­ Spring 2011 22 Example cont. Example cont. Precedence graph: G – Nodes: {T11, …,T1n, T21, …, T2m} – Edges: Farkas Dependency edge (ripple effect): there is an edge Tij→ Tik if j<k and there is a data item d, s.t., d ∈ write (Tij) ∩ read(Tik) and there is no l s.t., j<l<k and d is in the write set in Til (to consider dirty read within the same partition) CSCE 824 ­ Spring 2011 23 Example cont. Example cont. Farkas Precendence edges: there is an edge Tij→ Tik if j<k and there is a data item d, s.t., d ∈ read(Tij) ∩ write(Tik) and there is no l s.t., j<l<k and d is in the write set in Til (to consider the first transaction to write a data item after a read within the same partition) CSCE 824 ­ Spring 2011 24 Example cont. Example cont. Farkas Interference edges: there is an edge T1i→ T2j if there is a data item d, s.t., d ∈ read(T1i) ∩ write(T2j) or vice verse (to consider when T1i reads something written by T2j) CSCE 824 ­ Spring 2011 25 Example cont. Example cont. Farkas Theorem: The combined histories are correct iff the precedence graph is acyclic Correct inconsistencies: by removeing (undo) transactions that make the graph cyclic CSCE 824 ­ Spring 2011 26 Summary Data Replication Correctness: If the transactions are ACID, local execution in serializable, distributed transactions are reliable, and update replication is synchronous then distributed transactions are globally atomic & serializable Performance: – Correctness: transactions are not always serializable (e.g., WS­transactions) – Availability: update propagation is not always asynchronous Farkas Farkas Compensating transactions CSCE 824 ­ Spring 2011 27 Summary of Distributed Summary of Distributed Databases Lectures Reading: textbook: – Chapter 1: Introduction – Chapter 2: Background on Relational DBMS Also, lecture materials from CSCE 520 – Chapter 3: Distributed Database Design – top­down approach Farkas Main concepts, approaches, advantages, disadvantages CSCE 824 ­ Spring 2011 28 Summary cont. Summary cont. – Chapter 4: Database Integration – bottom­ up approach Understand main concepts, difficulties, and supporting technologies – Chapter 5: security concepts Also, lecture notes from CSCE 522 – Chapter 10: Transaction Management Farkas Main concepts, ACID properties, (no 10.3) CSCE 824 ­ Spring 2011 29 Summary cont. Summary cont. – Chapter 11: Concurrency control 2PL, lock types, deadlock management (no specifics about TO alg.) – Chapter 12: reliability 2PC, site and communication failures, window of uncertainty – Chapter 13: replicated databases Farkas Goals, issues, types of replica control alg. , advantages, disadvantages CSCE 824 ­ Spring 2011 30 Next Class Security Policies Reading Text book Chapter 5 Jajodia et al., Flexible Support for Multiple Access Control Policies, http://www.cacs.louisiana.edu/~jyoon/grad/adb/References/secpap/multi Recommended XACML 2.0 core spec., http://docs.oasis­open.org/xacml/2.0/access_control­xacml­2.0­core­spec Farkas Farkas CSCE 824 ­ Spring 2011 31 ...
View Full Document

This note was uploaded on 12/13/2011 for the course CSCE 824 taught by Professor Staff during the Fall '11 term at South Carolina.

Ask a homework question - tutors are online