Hash-Bucket Latching for Database Concurrency Control
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Ensuring atomicity and isolation of database transactions becomes particularly difficult when handling high volumes of potentially concurrent transactions, as existing systems face challenges in efficiently managing concurrency control and preventing deadlocks.
Innovation Solution
A buffer data structure using a hash table with hash-bucket latches is employed to store active database transactions, allowing for efficient storage of key-value pairs and simplifying coherency control, while hash-bucket latches provide concurrency control by locking record chains and preventing interference between transactions.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If traditional concurrency control mechanisms are used to ensure atomicity and isolation of database transactions, then data integrity is maintained, but system complexity increases and deadlock potential rises
Solution Approach 1:
The patent segments the database into multiple independent hash buckets, each with its own latch. This segmentation allows concurrent access to different buckets without requiring global locking mechanisms, thereby maintaining data integrity while reducing the complexity of concurrency control. Each bucket can be independently locked and unlocked, simplifying the overall locking strategy.
Solution Approach 2:
The patent implements local quality by applying latches at the hash-bucket level rather than at the database-wide level. This localized approach means that latches are acquired and released only for specific buckets that contain the relevant records, reducing the scope of locking and minimizing interference between concurrent transactions. This localizes the quality of concurrency control to where it is most needed.
2Productivity
If fine-grained locking is implemented to reduce contention and improve concurrency, then transaction throughput increases, but the risk of deadlocks increases
Solution Approach 1:
By segmenting the database into multiple hash buckets with independent latches, the patent enables fine-grained locking that allows higher transaction throughput. The segmentation ensures that transactions operating on different buckets can proceed concurrently without blocking each other, while the independent latch management for each bucket simplifies deadlock prevention by reducing the scope of potential deadlocks.
Solution Approach 2:
The patent employs preliminary action by hashing the primary key to determine the target bucket before acquiring the latch. This preliminary hashing action ensures that transactions acquire latches in a predictable and consistent order, preventing circular wait conditions that lead to deadlocks. The preliminary determination of the target bucket allows for proactive latch acquisition rather than reactive conflict resolution.
3Productivity
If hash-bucket latches are used to control access to record chains, then concurrency control is simplified and throughput improves, but latch contention may occur on frequently accessed buckets
Solution Approach 1:
The patent segments the database into multiple hash buckets to distribute access patterns across different buckets. This segmentation reduces latch contention on any single bucket by spreading the load across multiple independent latches. When transactions hash their primary keys, they are distributed across different buckets, allowing concurrent access without requiring all transactions to wait for a single latch.
Solution Approach 2:
The patent employs parameter changes by using hash functions to transform primary keys into bucket indices. This transformation changes the access pattern parameters, distributing requests across multiple buckets rather than concentrating them on a single resource. The hash function parameters ensure uniform distribution, reducing the average wait time for latch acquisition while maintaining the simplicity of latch-based concurrency control.
Data Source
AI summary
Techniques are disclosed relating to efficiently processing of concurrent database transactions. In one embodiment, a database system receives a first key-value pair for a database transaction and stores the key-value pair in a data structure for active database transactions. The storing may include indexing into a hash table of the data structure with a key of the key-value pair to identify a hash bucket of the hash table corresponding to the key, acquiring a latch associated with the identified hash bucket, and, based on a state of the acquired latch, appending, to the hash bucket, a record specifying the key-value pair. The database system may cause the key-value pair from the data structure to be committed to persistent storage in response to the database transaction being committed.


