Distributed Transaction Exclusive Locking for Atomicity and Throughput
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The two-phase commit protocol in distributed transactions requires multiple network round trips and has a long lock-holding time, leading to poor throughput in transaction processing.
Innovation Solution
Implement a single-phase commit method by adding exclusive locks to data records in the read phase of distributed transactions, releasing them immediately after write operations are completed to ensure atomicity and reduce lock-holding time.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the two-phase commit protocol is used to ensure atomicity of distributed transactions, then the atomicity is guaranteed, but the lock-holding time becomes too long and throughput deteriorates
Solution Approach 1:
The patent applies preliminary action by acquiring exclusive locks on all data records in the read phase before any write operations occur. This allows the system to determine the complete write set in advance and release locks immediately after write operations, rather than holding them throughout the entire two-phase commit process. The exclusive locks are acquired preliminarily to ensure atomicity while being released as soon as possible to improve throughput.
2Reliability
If multiple network round trips are introduced in the two-phase commit protocol, then the atomicity is ensured, but the transaction processing time increases
Solution Approach 1:
The patent extracts the lock management functionality from the two-phase commit protocol framework. Instead of relying on the coordinator to manage locks across multiple network round trips, the system acquires exclusive locks locally in the read phase and releases them immediately after write operations. This extraction eliminates the need for lock-related network communication in the commit phase, reducing transaction processing time while maintaining atomicity through the exclusive lock mechanism.
3Reliability
If the lock-holding time is extended to ensure atomicity in distributed transactions, then the reliability is improved, but the transaction throughput decreases
Solution Approach 1:
The patent implements preliminary action by acquiring exclusive locks on all necessary data records during the read phase, before any write operations begin. This preliminary lock acquisition allows the system to calculate the complete write set in advance and release locks immediately after each write operation completes, minimizing the duration locks are held. The atomicity is ensured by the exclusive lock mechanism, while the lock-holding time is reduced to only the necessary write operation duration.
Data Source
AI summary
Embodiments of the present application provide a transaction processing method, a device, and a storage medium. For a distributed transaction, it is proposed innovatively that exclusive locks are added to data records involved in a read set of the distributed transaction in a read phase; in a write phase, write operations for a write set can be directly executed based on these exclusive locks, and an exclusive lock on a related data record can be released immediately after a write operation is completed. In the write phase, the exclusive locks added to the data records can maintain the exclusivity of the distributed transaction over these data records, which can avoid the write operation abort problem in the write phase. That is, all write operations of the distributed transaction are bound to succeed, thereby ensuring the atomicity of distributed transaction processing. In addition, since the exclusive lock is released immediately after the write operation is completed, the lock-holding time of the distributed transaction is only the time inherently required to execute transaction logic of the distributed transaction, thereby greatly reducing the lock-holding time of the distributed transaction, effectively increasing the throughput for distributed transactions and improving the transaction processing efficiency.


