Multi-Master Database Locking with Covering Page Locks
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Multi-master database architectures face inefficiencies in managing row locks and page locks, leading to increased network communications, latency, and reduced scalability due to excessive network traffic and lock request roundtrips, particularly in cloud-based systems with mixed access patterns.
Innovation Solution
A hierarchical, hybrid locking protocol that combines physical page locks and logical row locks, using a covering page lock to distribute row lock information and reduce network communications by piggybacking row lock information on existing page lock messages, allowing concurrent and independent row lock granting without immediate synchronization.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If explicit row lock messages are sent over the network for each row lock request, then row lock correctness is ensured, but network traffic and transaction latency increase significantly
Solution Approach 1:
The patent merges row lock information with page lock messages, allowing row lock requests to be piggybacked on existing page lock communication channels. This combining of lock types reduces the number of separate network messages required while maintaining the correctness of row lock management in multi-master database systems.
2Reliability
If row lock information is distributed to all database masters, then lock arbitration correctness is maintained, but network communications overhead increases
Solution Approach 1:
The patent implements preliminary action by having the page lock manager collect and merge row lock information from multiple database masters before distributing it. This advance preparation of lock information reduces the need for continuous real-time communication during lock arbitration, thereby maintaining correctness while reducing overall network overhead.
3Reliability
If fine-grained row locking is implemented, then data consistency is improved, but the amount of network messages and processing overhead increases
Solution Approach 1:
The patent introduces the page lock manager as an intermediary that consolidates row lock information from multiple database masters. This mediator collects, merges, and distributes row lock information centrally, reducing the direct communication burden between masters and maintaining fine-grained data consistency without proportionally increasing network messages and processing overhead.
Data Source
AI summary
A method of managing locks in a database is performed by a row lock manager of a database master. The method includes receiving, from a transaction executing on the database master, a row lock request for a row in the database. The row lock request includes a page in the database where the row is located. The row lock request also includes a row lock mode of sufficient strength to perform the transaction. Then, sending, to a page lock manager, a request for a covering lock of the page. The request specifies a page lock mode of sufficient strength to satisfy the row lock mode. Also, receiving, from the page lock manager, a grant of the page lock. The page lock includes information on row locks of rows located in the page. Then, granting, to the transaction, the row lock.


