Download presentation
Presentation is loading. Please wait.
1
Distributed Transactions
2
Transaction Manager One at every site
Maintains a log for recovery purposes (undo or redo) Participates in concurrency control scheme (more on this later) to coordinate transactions acting on its site
3
Transaction Monitor (Coordinator)
Only one coordinator per transaction Starts the execution of a transaction Breaks transactions involving multiple sites into sub-transactions and distributes those sub- transactions to the transaction managers. Coordinates the termination of the transaction.
4
Distinguished Copy In systems with replication, designate a particular copy of each data item as distinguished. If you have complete replication, you can designate a site as the distinguished copy, called the primary site. All locking actions take place on the distinguished copy. Because there is only one distinguished copy, deadlocks and commits only need be resolved at that site. Then the changes can be propagated across the network. Once writes have occurred at all the sites, the commit can finish at the distinguished copy.
5
What are downsides of having a distinguished copy?
1. Single point of failure at distinguished copy 2. Write network bottleneck at distinguished copy 3. Impossible for non-redundant data distribution 4. Necessity of a top hat and monocle
6
Primary Site with Backup Site
To reduce the problems associated with having a primary site as a distinguished copy, often a designated backup site is created. All locking actions are performed on both the primary and backup sites. If the primary site fails (in the middle of carrying out transactions), the backup site can immediately become the new primary site until the original primary site is restored. Upside: Greater reliability Downside: Slower transactions
7
Why does keeping a backup site slow transactions?
1. Changes made to the primary site must also be made to the backup site for each commit 2. Backup sites are slower because they need to keep backups/archives 3. Backup sites require network delays to ensure rollbacks always happen 4. Because you said it did on the previous slide
8
Primary Copy A variant of the Primary Site idea is to have there be a Primary Copy of each database item (that aren't necessarily co-located). With a Primary Copy, certain elements (tables, rows, etc) have a distinguished copy, but the distinguished copy of a different element may be at a different site. If you don't have complete replication, you can't have a Primary Site, but you can have a Primary Copy for each part of your database.
9
What do you do if the Primary Site/Copy fails?
1. Make the Backup Site/Copy the primary 2. Scapegoat the chief technical officer 3. Fire your database administrator 4. Cry
10
Choosing a new Primary Site
If your Primary Copy fails, you make the Backup Copy the new primary. Which site becomes the new Primary Site? The most common approach is to have the sites have an election, with the winner becoming the new Primary Site. Election details vary with each implementation, but the point is to ensure only one site is designated as the Primary Site.
11
Voting instead of Distinguished Copy
An alternative to distinguished copy (one site being responsible for some/all of the locking actions of the entire distributed database) is voting. For each lock request, every site votes on if that lock should be granted. If a majority agree, the lock is granted everywhere. Although this is nice and decentralized, the implementation is very complex, and the amount of network traffic to make is happen is sometimes exorbitant.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.