Database Cache Recovery via Pre-saved Disk Mapping
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In databases, the process of restarting after an abnormal closure results in significant time loss due to the need to re-establish description information and re-cache data from disk to level-2 cache, as existing methods require re-reading data and re-establishing correspondence, which is inefficient.
Innovation Solution
The method involves saving disk location information in the header of data blocks in the level-2 cache, allowing direct establishment of description information without re-reading or re-transferring data, thereby reducing the time required for recovery.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If data is re-read from disk and description information is re-established after database restart, then the database can recover its caching functionality, but the recovery time becomes excessively long
Solution Approach 1:
The patent applies preliminary action by saving the correspondence relationship between disk locations and level-2 cache locations into the database's checkpoint information before database closure. When the database restarts, this pre-saved mapping information is directly loaded, eliminating the need to re-read data and re-establish descriptions, thus dramatically reducing recovery time while ensuring reliability
Solution Approach 2:
The patent uses copying by creating and storing a copy of the description information (mapping relationship) in the checkpoint data on disk. This copy contains the essential mapping information between disk blocks and cache locations, which can be quickly replicated into memory during restart without needing to re-process the actual data blocks, thereby reducing recovery time
2Productivity
If the level-2 cache is used to store warm data, then query efficiency is improved, but the complexity of managing description information increases
Solution Approach 1:
The patent merges the description information management with the existing checkpoint mechanism. By integrating the mapping relationship into the checkpoint data structure that already exists in the database system, the patent avoids creating a separate complex management system, thus maintaining query efficiency while minimizing additional complexity
Solution Approach 2:
The patent makes the checkpoint information serve multiple functions: it not only records the database state for recovery but also stores the mapping relationship between disk and cache locations. This multi-functionality eliminates the need for separate description information structures, reducing overall system complexity while maintaining caching efficiency
Data Source
AI summary
A method for recovering description information, or a method for caching data in a database, includes: judging whether a database is closed normally after the last operation; if the database is not closed normally, traversing each data block in a level-2 cache, where corresponding disk location information is saved in a header of each data block; obtaining a data block in a disk according to the disk location information; and when the obtained data block in the disk is the same as a corresponding data block in the level-2 cache, establishing description information according to location information of the data block in the disk and location information of the data block in the level-2 cache, where the description information is used to describe correspondence between the location information of data in the disk and the location information of data in the level-2 cache.


