Lock Reordering for Optimistic Data Grid Deadlock Avoidance
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Traditional data storage systems face transaction deadlocks when multiple transactions attempt to write to the same data concurrently, leading to costly CPU and network usage due to the need for dependency graph construction and termination of deadlocked transactions.
Innovation Solution
Implementing a method where an enlisted node in a data grid ranks keys based on identifiers to define a consistent order for acquiring locks, ensuring that all transactions use the same order to avoid deadlocks by using a consistent hash function to determine the lock order for data shared by multiple transactions.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If traditional deadlock detection and resolution methods are used, then transaction consistency is maintained, but CPU and network usage increases significantly
Solution Approach 1:
The patent applies preliminary action by establishing a predetermined lock ordering scheme based on data identifiers before deadlocks occur. Transactions are instructed to acquire locks in a specific order determined by hashing the data identifier, preventing deadlocks proactively rather than detecting and resolving them after they occur, thereby avoiding the high CPU and network overhead of traditional deadlock handling mechanisms
2Reliability
If lock ordering based on data identifiers is implemented, then transaction deadlock is prevented, but system complexity increases
Solution Approach 1:
The patent changes the parameter of lock acquisition order from being transaction-specific to being data-identifier-specific. By transforming the lock ordering criterion into a function of the data identifier itself (through hashing), the system achieves deterministic lock ordering without requiring complex transaction dependency analysis, thus preventing deadlocks while maintaining relatively simple system architecture
Data Source
AI summary
A node a data grid receives a prepare request identifying data to lock for a first transaction. The prepare request indicates a locking order that is different from a locking order indicated by a prior prepare request of a second transaction using the same data. The node identifies keys that correspond to the data. The keys are co-located on the node. The node ranks the keys to define an order for acquiring locks for the data based on key identifiers that correspond to the keys. The defined order matches a locking order used by the second transaction. The node acquires locks for the data using the defined order.


