Distributed Table Lock Recovery Through Synchronized Lock Logs
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current data lock mechanisms in distributed databases fail to effectively ensure lock operations, leading to read/write failures and inconsistencies during data processing, especially when nodes restart or lose their lock status.
Innovation Solution
Implement a distributed table lock application method that includes generating table-level and partition-level locks, synchronizing lock status information to a log, and restoring locks based on this information after node restarts or failures, ensuring consistent lock operations across master and slave nodes.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If a current data lock mechanism is used in a distributed database, then data processing can be performed in parallel across multiple nodes, but the lock operation cannot be effectively ensured, causing read/write failures and data inconsistencies
Solution Approach 1:
The patent introduces a log as an intermediary component to record and synchronize lock status information across distributed nodes. The log acts as a mediator that ensures lock operations are reliably tracked and restored, resolving the contradiction between parallel processing efficiency and lock reliability by providing a centralized coordination mechanism.
Solution Approach 2:
The patent performs preliminary actions by recording lock status information in a log before node failures or restarts can occur. This advance recording ensures that when nodes restart, the lock status can be restored without re-executing the entire data processing task, thus maintaining both productivity and reliability.
2Reliability
If the master node does not synchronize lock status information to slave nodes, then the system structure remains simple, but the lock status is lost when the master node restarts, causing data processing failures
Solution Approach 1:
The patent creates copies of the lock status information by synchronizing the log from the master node to slave nodes. Each slave node maintains a copy of the critical lock status data, ensuring that even if the master node restarts, the lock information is preserved and can be restored, thus improving reliability without requiring a fundamentally complex system architecture.
3Reliability
If lock status information is synchronized to all slave nodes, then lock recovery after master node failure is ensured, but the synchronization overhead increases system complexity and resource consumption
Solution Approach 1:
The patent extracts only the essential lock status information into a separate log structure, rather than synchronizing entire data states or complex lock management systems. This extraction approach ensures lock recovery capability by maintaining minimal necessary information, while avoiding the complexity and resource consumption of synchronizing complete system states.
4Device complexity
If the master node processes all data processing requests centrally, then lock management is simplified, but the processing efficiency decreases due to the single point of control
Solution Approach 1:
The patent segments the lock management functionality by separating the lock status recording (performed by the master node) from the actual data processing execution (distributed across slave nodes). This segmentation allows simplified centralized lock management while maintaining distributed processing efficiency, as each node can process data independently while referencing the shared log for lock status.
Data Source
AI summary
This specification discloses example distributed table lock application methods and apparatuses, storage media, and electronic devices. In an example method, a master node receives a data processing request and determines a data table that to-be-processed data corresponding to the data processing request are located in. The master node generates a table lock for the data table; performs a lock operation on the data table and generates lock status information corresponding to the data table; writes the lock status information into a local log of the master node and synchronizes the log to a slave node such that the slave node stores the log. After the master node restarts, determines whether the master node stores the log; and in response to that the master node stores the log, restores the lock operation on the data table based on the lock status information recorded in the log.


