Database Flashback Using LSN Jump to Preserve Redo Logs
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current database flashback mechanisms have high application limitations, particularly in the read/write mode where historical data after a recovery moment is discarded, limiting the ability to flashback to multiple time points.
Innovation Solution
A database recovery method that uses an LSN corresponding to the current moment as the start point after rolling back to a historical moment, employing an LSN jump mechanism to avoid conflicts with previous LSNs, allowing redo logs after the recovery moment to be retained, enabling flashback at any time point multiple times.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If database flashback is started in read/write mode, then the database supports both reading and writing data, but backup data generated after the historical time point is discarded
Solution Approach 1:
The patent segments the redo log management into distinct ranges: a first range for redo logs before the recovery moment and a second range for redo logs after the recovery moment. By segmenting the log management, the system can retain both historical redo logs (first range) and future redo logs (second range) independently, preventing information loss while maintaining read/write operations.
Solution Approach 2:
The patent applies preliminary action by pre-defining the start LSN for the recovered database as greater than the current LSN before recovery occurs. This preliminary setting ensures that when the database is recovered to a historical moment, the start LSN is already positioned to exclude discarded redo logs while including necessary future redo logs, preventing data loss before it happens.
2Reliability
If database flashback is started in read-only mode, then the database supports reading data, but does not support writing data
Solution Approach 1:
The patent makes the recovery mode dynamic by allowing the system to adaptively determine whether to operate in read-only or read/write mode based on the recovery instructions and data requirements. The system can switch between modes flexibly, providing read-only mode for safety-critical scenarios and read/write mode for operational flexibility, thus resolving the contradiction between reliability and ease of operation.
3Manufacturing precision
If a new database instance is created for point-in-time recovery, then the database can be recovered to a specified time point, but a large amount of storage space is required
Solution Approach 1:
The patent uses copying by creating a copy of the current database instance and applying incremental changes to this copy rather than creating a completely new instance from scratch. This copying approach allows precise recovery to any time point while significantly reducing storage requirements compared to full instance replication.
Solution Approach 2:
The patent merges the current database instance with the recovered historical instance, combining their respective redo log ranges. By merging the first range (before recovery moment) and second range (after recovery moment), the system achieves comprehensive recovery precision without requiring separate storage for entirely new instances, thus reducing overall storage space requirements.
4Ease of manufacture
If LSN corresponding to historical moment is used as start point after recovery, then recovery can be performed, but LSN conflict occurs with redo logs generated after recovery
Solution Approach 1:
The patent segments the LSN space into distinct ranges: a first range for redo logs before the recovery moment and a second range for redo logs after the recovery moment. By segmenting LSN management, the system can use the historical moment's LSN as the start point for recovery without causing conflicts with future redo logs, as each range is independently managed.
Solution Approach 2:
The patent applies parameter changes by modifying the start LSN parameter to be greater than the current LSN before recovery occurs. This parameter change ensures that the start LSN is positioned in a range that does not conflict with future redo logs, resolving the LSN uniqueness issue while maintaining smooth recovery processing.
Data Source
AI summary
This application discloses a database recovery method and apparatus, and pertains to the field of database technologies. After receiving a recovery instruction for a database, a computer device queries, based on a recovery moment indicated by the recovery instruction, an LSN and time association log for an LSN corresponding to the recovery moment, obtains recovery data of the database based on the LSN corresponding to the recovery moment, and performs data recovery on the database based on the recovery data. Then, a start LSN used by a database corresponding to the recovery moment is greater than an LSN corresponding to a current moment. After the database is rolled back from the current moment to a historical moment, an LSN greater than the LSN corresponding to the current moment is applied to the database starting from the LSN corresponding to the current moment.


