Database Log Recovery Deadlock Prevention
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In distributed database systems, a deadlock situation can occur during log recovery processes when multiple services share a sequential storage device, causing the recovery process to halt due to exclusive access blocking other services from accessing the shared device.
Innovation Solution
The solution involves synchronizing log executors and log readers by informing the log reader of the target recovery positions, allowing it to read only up to the point that the log executor can guarantee consumption, thereby preventing deadlocks and ensuring efficient log recovery.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If multiple database services share a sequential storage device for log recovery, then resource utilization is improved, but deadlock occurs when one service blocks exclusive access preventing other services from accessing the device
Solution Approach 1:
The system determines target log positions for all services before the log recovery process begins. By pre-calculating and communicating these target positions to log readers, the system ensures that readers know exactly where to stop reading, preventing them from blocking other services' access to the sequential storage device. This preliminary action eliminates the deadlock condition while maintaining shared device access.
2Productivity
If log readers read ahead during log recovery, then recovery speed is improved, but deadlocks occur when readers block executors from accessing the storage device
Solution Approach 1:
The system implements a feedback mechanism where log executors communicate their target log positions to log readers. Readers use this feedback information to adjust their reading behavior, stopping exactly at the target position where the executor will consume the logs. This feedback loop enables readers to read ahead efficiently without blocking executors, as readers are informed of the exact consumption point and do not read beyond it.
3Reliability
If exclusive access is granted to one service on a shared storage device, then access safety is improved, but other services are blocked from accessing the device during recovery
Solution Approach 1:
Before the log recovery process begins, the system performs preliminary determination of target log positions for all services that will share the sequential storage device. These target positions are communicated to log readers in advance, allowing readers to know their exact reading boundaries. This preliminary coordination enables multiple services to safely share the storage device during recovery without exclusive access blocking, as each service knows its designated position and will not interfere with others' access.
Data Source
AI summary
A method, medium, and system to receive a request to perform a log recovery to restore multiple database services; determine log backup entries corresponding to a target log position for a first database service of the multiple database services; read from a sequential stream device, by the first database service, the log backup entries corresponding to the target log position for the first database service; inform a second database service of the multiple database services that the first database service has concluded executing the log backup entries corresponding to the target log position for the first database service from the sequential stream device; assuring that no resources of the streaming device are blocked by the first database service; and read log backup entries of the second database service corresponding to a target log position for the second database service from the sequential stream device.


