Advanced Database Management System - Tutorials and Notes: Primary Copy Protocol - Distributed Lock Manager Approach

Search Engine

Please visit, subscribe and share 10 Minutes Lectures in Computer Science

Wednesday, 2 April 2014

Primary Copy Protocol - Distributed Lock Manager Approach


Primary Copy Distributed Lock Manager Approach / Primary Copy based Distributed Concurrency Control Approach

Primary Copy Protocol:

Assume that we have the data item Q which is replicated in several sites and we choose one of the replicas of data item Q as the Primary Copy (only one replica). The site which stores the Primary Copy is designated as the Primary Site. Any lock requests generated for data item Q at any sites must be routed to the Primary site. Primary site’s lock-manager is responsible for handling lock requests, though there are other sites with same data item and local lock-managers.
We can choose different sites as lock-manager sites for different data items.

How does Primary Copy protocol work?

Figure 1 shows the Primary Copy protocol implementation.
In the figure,

  • Q, R, and S are different data items that are replicated.
  • Q is replicated in sites S1, S2, S3 and S5 (represented in blue colored text). Site S3 is designated as Primary site for Q (represented in purple colored text).
  • R is replicated in sites S1, S2, S3, and S4. Site S6 is designated as Primary site for R.
  • S is replicated at sites S1, S2, S4, S5, and S6. Site S1 is designated as Primary site for S.

Then, the concurrency control mechanism works this way;


Step 1: Transaction T1 initiated at site S5 and requests lock on data item Q. Even though the data item available locally at site S5, the lock-manager of S5 cannot grant the lock. The reason is, in our example, Site S3 is designated as primary site for Q. Hence, the request must be routed to the site S3 by the Transaction manager of S5.
Step 2: S5 requests S3 for lock on Q. S5 sends lock request message to S3.
Step 3: If the lock on Q can be granted, S3 grants lock and send a message to S5.
On receiving lock grant, S5 executes the Transaction T1 (Executed on the data item Q available locally. If no local copy, S3 has to execute the transaction in other sites where Q is available).
Step 4: On successful completion of Transaction, S5 sends unlock message to the Primary Site S3.

Note: If the transaction T1 writes the data item Q, then the changes must be forward to all the sites where Q is replicated. If the transaction read the data item Q, then no problem.

Advantages:

  • Handling of concurrency control on replicated data is like unreplicated data. Simple implementation.
  • Only 3 messages to handle lock and unlock requests (1 Lock request, 1 Granted, and 1 Unlock message) for both read and write.

Disadvantages:

  • Possible single point-of-failure. If the Primary Site of a data item, say Q fails, even though the other sites with the same copy of Q available, the data item Q is inaccessible.



Be Considerate to Others
 

***********







Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents