CN107220145A - A kind of method of flash memory database data recovery - Google Patents

A kind of method of flash memory database data recovery Download PDF

Info

Publication number
CN107220145A
CN107220145A CN201710358273.7A CN201710358273A CN107220145A CN 107220145 A CN107220145 A CN 107220145A CN 201710358273 A CN201710358273 A CN 201710358273A CN 107220145 A CN107220145 A CN 107220145A
Authority
CN
China
Prior art keywords
data
log
affairs
log recording
record
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710358273.7A
Other languages
Chinese (zh)
Other versions
CN107220145B (en
Inventor
王仁
韩世杰
张记强
冯帆
陈树峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Institute of Computer Technology and Applications
Original Assignee
Beijing Institute of Computer Technology and Applications
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Institute of Computer Technology and Applications filed Critical Beijing Institute of Computer Technology and Applications
Priority to CN201710358273.7A priority Critical patent/CN107220145B/en
Publication of CN107220145A publication Critical patent/CN107220145A/en
Application granted granted Critical
Publication of CN107220145B publication Critical patent/CN107220145B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1471Saving, restoring, recovering or retrying involving logging of persistent data for recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of method of flash memory database data recovery, wherein, including:Scanning log file, confirms whether have still effective affairs to submit log recording or transaction rollback daily record in journal file;The state current according to journal file is respectively processed:If submitting log recording in the presence of effective affairs, show that all changes for being related to the affairs are not yet completely written in data file, need to complete the rewriting of data file according to log recording;If being recorded in the presence of effective rewind journal, all log recordings are searched according to affairs ID, and carry out rolling back action;If submitting log recording in the absence of effective affairs, also in the absence of effective rewind journal, but there is still effective log recording, show that the affairs are not yet completed, check for partial log record written data file, and part situation about not writing, as existed, then rolling back action is carried out.

Description

A kind of method of flash memory database data recovery
Technical field
The present invention relates to a kind of data storage technology of flash memory, more particularly to a kind of side of flash memory database data recovery Method.
Background technology
Recovery technology based on daily record is widely used in traditional data in magnetic disk base management system.In different agreements Under, design, the management of daily record/data buffer zone, checkpointing mechanism, log and the process of recovery of log recording are not Equally.By taking undo daily records as an example, when affairs T needs database element X (original value is v) value being changed to v1, undo days Will will be formed such as<T,X,v1>Log recording and store on disk.When needing to carry out rolling back action to affairs T, then shape Cheng Ru<T,X,v>Log recording, element X value is reset into v.
Flash memory (Flash Memory) is a kind of long-life nonvolatile memory.Compared with disk, flash memory, which has, to be read Writing rate is fast, antidetonation, power saving, small volume the advantages of.Undo journal recovery processes are reappeared in a flash memory:
(1) tri- elements of A, B, C are included shown in tables of data original state such as table 1 (a), in table, initial value be respectively va, Vb, vc, now flag bit be set to 1, represent that three element values are effective;
(2) when the A values in tables of data are revised as in va ', one new record of insertion, such as table 1 (b) most by affairs T from va A line afterwards, now the flag bit of the first row A values be set to 0, represent that A value is changed, initial value is no longer valid;
(3) if affairs T needs rollback, then a new record is write, A values is reverted into va, shown in such as table 1 (c).
Table 1 (a)
Value Flag bit
A va 1
B vb 1
C vc 1
Table 1 (b)
Value Flag bit
A va 0
B vb 1
C vc 1
A va 1
Table 1 (c)
Value Flag bit
A va 0
B vb 1
C vc 1
A va’ 0
A va 1
As can be seen that the last item record records identical with first from table 1 (c), that is to say, that last column It is redundancy in this case.Therefore generally there is the old version of substantial amounts of data in flash memory, and traditional data recovery Method constantly writes the data record existed again, so not only wasting space but also has lost time.
The content of the invention
It is an object of the invention to provide a kind of method of flash memory database data recovery, for solving above-mentioned prior art The problem of.
A kind of method of flash memory database data recovery of the present invention, wherein, including:Scanning log file, confirms daily record text Whether there are still effective affairs to submit log recording or transaction rollback daily record in part;The state difference current according to journal file It is handled as follows:If submitting log recording in the presence of effective affairs, show that all changes for being related to the affairs are not yet write completely Enter into data file, need to complete the rewriting of data file according to log recording;If being recorded in the presence of effective rewind journal, All log recordings are searched according to affairs ID, and carry out rolling back action;If submitting log recording in the absence of effective affairs, also not In the presence of effective rewind journal, but there is still effective log recording, show that the affairs are not yet completed, check for portion Point log recording written data file, and the situation that part does not write, such as exist, then carry out rolling back action.
According to an embodiment of the method for the flash memory database data recovery of the present invention, wherein, rolling back action includes:First The still effective log recording of the corresponding affairs of all about affairs ID, Ran Houyi are found out from journal file according to affairs ID Secondary judgement logging operations type, according to different operating type, completes following operation:If insertion operation, then delete current The data element of insertion;If deletion action, then deleted data element is reinserted;If updating operation, then by data The value of element returns to original state.
According to an embodiment of the method for the flash memory database data recovery of the present invention, wherein, in addition to:Chain type daily record, Including a chained list and a tables of data, the daily record note for the different pieces of information operation that each affairs of sequential storage are produced in chained list Include and included in the different editions data of each data member in a log recording, the log recording of chained list in record, tables of data Specify the address of tables of data;Log recording in tables of data includes affairs ID, data member, preceding member and data address table four Field, wherein affairs ID are No. ID of affairs belonging to current log is recorded;Data member is that current data operates the data pointed to The title of member;Preceding member is to produce the preceding member of change in Current transaction;Data address table is all version numbers of data member According to address, each edition data is attached with chained list in chronological order, when affairs are submitted or after rollback, the data address word Section is set to sky.
According to an embodiment of the method for the flash memory database data recovery of the present invention, wherein, log recording builds daily record The method of file includes:When a new affairs unlatching, and it is the data member of first renewal when producing first data variation Insert a log recording;When producing the change of other data members in affairs, then a new log recording is inserted, before it Member is set to the data record of a change;For insertion and deletion action, come in data address table using multiple indications Distinguish the data of different editions;If affairs are submitted or rollback, insert one and submit or rewind journal record, preceding member sets It is set to the member updated before;All data members for producing change and its specific data manipulation in database of record, and unite One is stored in journal file.
According to an embodiment of the method for the flash memory database data recovery of the present invention, wherein, in addition to:In journal file Middle write-in checkpoint, it is checkpoint to show current location;Daily record is scanned one by one in units of log blocks, when running into inspection During point, the validity of all log recordings before checkpoint is confirmed, still effective log recording is write into new free block; After the scanning to log blocks is completed, erasing operation is carried out to it, and be transferred to next log blocks not scanned;Work as the free time Block is full, then applies for new free block, and new effective record is write to new free block.
According to an embodiment of the method for the flash memory database data recovery of the present invention, wherein, in addition to:By current log The method that effective record in block dumps to new log blocks includes:Unloading flag bit is set to 1, and creates a new daily record Block;First log recording is obtained, whether judge current unloading flag bit is 1, if not 1, then wipe old log blocks and knot Beam;If 1, then judge whether current log record effective, if still effectively if by current log record copies to new daily record Block, and obtain next log recording and recorded as current log;Directly obtained if invalid next log recording as work as Preceding log recording;If new log blocks are full, next free block is obtained as new log blocks;If the current log obtained Sky is recorded as, then unloading flag bit is set to 0, shows that unloading operation has terminated.
According to an embodiment of the method for the flash memory database data recovery of the present invention, wherein, the time interval of checkpoint Dynamically adjusted according to application characteristic.
According to an embodiment of the method for the flash memory database data recovery of the present invention, wherein, the data of chain type daily record are deposited Method for storing:Log recording is first write into internal memory or caching, log recording is write into journal file, data variation is write into data text Corresponding log recording in part, ineffective treatment journal file.
The present invention proposes that one kind can either save memory space based on flash memory database, and data recovering efficiency can be lifted again Data reconstruction method.Chain type log system carries out journalizing using old version information present in flash memory database, adopts Sequential organization is replaced with list structure to store log recording to improve data recovering efficiency.By periodic test point strategy come Remove the log recording of failure, save flash memory space, while effectively reducing the length of journal file.
Brief description of the drawings
Fig. 1 show chain type log system configuration diagram;
Fig. 2 show log record figure;
Fig. 3 show the step flow chart of unloading;
Embodiment
To make the purpose of the present invention, content and advantage clearer, with reference to the accompanying drawings and examples, to the present invention's Embodiment is described in further detail.
Fig. 1 show chain type log system configuration diagram, as shown in figure 1, the present invention devises a kind of new day aspiration System, is named as chain type daily record.In chain type log system, log manager 1 is responsible for the generation and unified management of log recording;Day Will file 2 is the set of log recording, is made up of a rule log recording;RMAN 3 is responsible for system crash or affairs are returned The recovery management of data during rolling;DBMS4 (Database management system) is data base management system, is responsible for affairs Management, log management, the management of data file 5 etc.;Data file 5 is the physical store place of data record.
Fig. 2 show log record figure, as shown in Fig. 2 chain type daily record stores log recording using list structure, is System safeguards a chained list and a tables of data.The day for the different pieces of information operation that each affairs of sequential storage are produced wherein in chained list The different editions data of each data member in a log recording are included in will, tables of data, specified number is included in chained list daily record According to the address of table.
As shown in Fig. 2 chain type daily record is used to realize to the fast quick-recovery of flash memory database, the characteristics of being mainly based upon flash memory sets A kind of new log record has been counted, can be quick right by operation information of the log recording quick obtaining user to database Flash memory database is recovered.The log recording of chain type daily record includes affairs ID, data member, preceding member and data address table four Individual field, wherein " affairs ID " refers to No. ID of the affiliated affairs of current log;" data member " refers to the number that current data operation is pointed to According to the title of member;" preceding member " refers to the preceding member that change is produced in Current transaction, if the data member of current operation is the thing Be engaged in first member, then preceding member fields are set to " Begin ";" data address table " refers to the ground of all edition datas of data member Location, each edition data is attached with chained list in chronological order, and after affairs submission or rollback, the data address field is set For " NULL ".
As shown in Figure 1 and Figure 2, journal file 2 is made up of a rule log recording, and table 2 is literary for the daily record of chain type daily record Part structural table.Log recording (abbreviation daily record) is to record user to the operation information of database, can be learnt by log recording User is to the operation of database and the change of data, when system crash, and database can be recovered according to log recording;Daily record File refers to the file for depositing log recording, is made up of multiple log blocks;Journal file is stored in storage by block, Each block is referred to as log blocks, i.e. journal file and is divided into multiple log blocks, and each log blocks store multiple log recordings;
Chain type daily record is a kind of new log system that the present invention is designed, for realizing to the fast quick-recovery of flash memory database, The characteristics of being mainly based upon flash memory devises a kind of new log record, can pass through log recording quick obtaining user's logarithm According to the operation information in storehouse, quickly flash memory database is recovered
Table 2
Sequence number Affairs ID Data member Preceding member Data address table
1 T1 X Begin P(X1)->P(X2)->P(X3)
2 T1 Y P(X) P(Y1)->P(Y2)
3 T2 A Begin P(A1)->P(A2)
4 T1 Z P(Y) P(Z1)->P(Z2)->NULL
5 T2 B P(A) NULL->P(B1)
6 T1 Commit P(Z) NULL
7 T2 Rollback P(B) NULL
8
As shown in Figure 1 and Figure 2, log recording is unified is responsible for by log manager 1.Chain type log recording builds day The algorithm and flow of will file 2 are as follows:
First, when a new affairs unlatching, and (insertion, modification or deletion action cause when producing first data variation Database produces change), log manager 1 is that the data member of first renewal inserts a log recording, and by before it into Member is set to " Begin ".As shown in the first row of table 2, affairs T1 is opened, and carries out data manipulation, sequential update to data member X Its numerical value (from X1 to X2, then to X3), so first log recording is entered as:Affairs ID is set to T1, and data member is set to X, Preceding member is set to " Begin ", data address table be set to P (X1)->P(X2)->P (X3) (is herein X1, X2, X3 place tables of data In address).
Second, when producing the change of other data members in affairs, then log manager 1 inserts a new daily record note Record, its preceding member is set to the data record of a upper change.Data member Y value is changed such as in affairs T1, by it from Y1 Y2 is changed to, then log recording is entered as:Affairs ID is still set to T1, and data member is set to Y, and preceding member is set to P (X), data Location table be set to P (Y1)->P (Y2), as shown in the row of table 2 second.
3rd, for insertion and deletion action, different editions are distinguished using multiple indications in data address table Data.Insertion operation is carried out such as in affairs, then first address in its data address table is set to " NULL ", entered in affairs Row deletion action, then be set to " NULL " by last address in data address table, and fourth line represents to delete in T1 in such as table 2 Data member Z, fifth line represents to insert data member B in T2.
4th, if affairs are submitted or rollback, log manager 1 is inserted one and submitted or rewind journal record, preceding Member is set to the member updated before, and address table is set to " NULL ".T1 affairs are submitted (Commit) in such as table 2, T2 affairs (Rollback) is rolled back, so being respectively written into the six, the seven row log recordings.
By above-mentioned daily record algorithm, log manager 1 can be built in log recording complete one by one, database of record All data members for producing change and its specific data manipulation, and be uniformly stored in journal file 2, form journal file 2。
As shown in figure 1, to avoid producing long journal file 2, causing the reduction of system effectiveness, present invention uses inspection Strategy is made an inventory of, to ensure only to transmit still effective log recording.The method to set up of checkpoint is write in journal file 2 Checkpointing, it is checkpoint to show current location.
In chain type daily record using checkpoint strategy after, operating process approximately as:
First, daily record is scanned one by one in units of log blocks.When running into checkpoint, confirm before checkpoint The validity of all log recordings, still effective log recording is write into new free block, and (idle log blocks, i.e., do not write Enter the log blocks of log recording).
Second, after the scanning to log blocks is completed, erasing operation can be carried out to it, and be transferred to and next do not sweep The log blocks retouched.
3rd, when free block is full, then apply for new free block, by new effective record (effective log recording.Daily record Record has a flag bit, shows whether current log record is effective.) the new free block of write-in.
A such as log blocks can deposit 100 log recordings, wherein having 10 still effectively, then dump to 10 new Log blocks in, old piece can wipe.
Fig. 3 show the step flow chart of unloading, as shown in Figure 1 and Figure 3, includes the step of unloading:
(1) " unloading flag bit " is set to 1, and creates a new log blocks;Wherein, unloading flag bit refers to judge to work as The mark whether preceding daily record still effectively records soon, if 1, then show to exist effectively record, if 0, then show to be not present Effectively record, can wipe the log blocks.
(2) first log recording is obtained, judges whether current " unloading flag bit " is 1.If not 1, then wipe old Log blocks simultaneously terminate;If 1, then judge whether current log record effective, if still effectively if by current log record copies To new log blocks, and obtain next log recording and recorded as current log;Next daily record is directly obtained if invalid Record is recorded as current log;
(3) if new log blocks are full, next free block is obtained as new log blocks;
(4) if the current log obtained is recorded as sky, " unloading flag bit " is set to 0, shows that unloading operation has terminated.
Long checkpoint interval can cause to produce big journal file 2, and small checkpoint interval can shorten the life of flash memory Life cycle, therefore, the time interval of checkpoint of the invention can dynamically adjust according to application characteristic, while using periodic test The strategy of point.
In chain type log system, under normal circumstances the process of data storage be related to data base management system (DBMS4) and Log manager 1, wherein DBMS4 are responsible for the generation of the normal transaction operation of database and control data file 5, log manager 1 is responsible for the management of log recording and the generation of journal file 2.The normal data storage of chain type daily record substantially flow is as follows:
First, DBMS4 carry out normal transaction operation, and the database change to generation (is related to data to insert, delete and repair Change operation) issued transaction is done, and log manager 1 is transferred to, wherein, issued transaction is when a series of changes carried out to source data During as an entirety to preserve or cancel, it need to be handled using affairs.Issued transaction include open affairs, submit affairs and Rollback affairs, update all operations when submitting affairs, cancel all operations during rollback affairs.Only insert, delete and change behaviour Affairs are needed to use, because these operations produce renewal to the data in database.Need not if only read operation Use affairs.
Second, log manager 1 requires one rule log recording of generation according to chain type journal format, and constitutes journal file 2, complete the complete documentation of transaction operation.
3rd, affairs are normally submitted, and now data record is write data file 5 (secondary storage media) by DBMS4.
4th, the log recording involved by the affairs having been filed on is done ineffective treatment processing by log manager 1, and whole affairs are carried Friendship process is completed.
From above-mentioned data storage procedure, the substantially flow of data storage is:Log recording is first write into internal memory or slow Deposit->Log recording write-in journal file 2->Data variation write-in data file 5->Corresponding daily record note in ineffective treatment journal file 2 Record.And data recovery must be by means of log recording, i.e. collapse occurs before log recording write-in journal file 2, then need not Recover, because currently without log recording;If collapse occurs after log recording ineffective treatment, without recovery, because Current data written data file 5.In summary, data recovery is only occurred in after the generation of journal file 2, data file 5 Before completion.
With reference to Fig. 1, the data recovery procedure of the method for flash memory database data recovery of the invention includes:
(1) RMAN 3 confirms whether have still effective affairs to carry in journal file 2 by scanning log file 2 Hand over daily record (commit records) or transaction rollback daily record (rollback records).The state current according to journal file 2 is entered respectively The following processing of row.
(2) if submitting log recording (commit records) in the presence of effective affairs, show to be related to all changes of the affairs Not yet it is completely written in data file 5, now needs to complete the rewriting of data file 5 according to log recording.It is i.e. submitted Whether affairs, feed back in data file 5 completely no matter updating, as long as reforming the log recording for once relating to the affairs, Ensure that the state when data record in data file 5 is submitted for normal transaction.As in table 2, affairs T1 has been filed on, but not Know whether be completely written in data file 5.If now collapsing, RMAN 3 is first depending on affairs ID from journal file 2 In find out all about T1 effective record the first, second of table 2 (, fourth line), then will be related to successively in log recording Data variation re-writes data file 5, such as the first row of table 2 be by data member X value be revised as successively P (X1)->P(X2)- >P (X3), the second row be by data member Y value be revised as successively P (Y1)->P (Y2), fourth line is first by data element Z Value be revised as P (Z1)->P (Z2), then deletes data element Z, data recovery procedure only need to be by data element in affairs T1 most X values (can be revised as X3, Y value is revised as Y2, deletes Z) by whole state write-in data file 5, and middle change in process can To omit, the efficiency of journal recovery is so substantially increased.
(3) if recording (rollback daily records) in the presence of effective rewind journal, also need to search all days according to affairs ID Will is recorded, and carries out rolling back action.Rollback flow is to be first depending on affairs ID to find out all about affairs from journal file 2 Still effective log recording, then judges logging operations type successively, according to different operating type, completes following behaviour Make:If insertion operation (i.e. first data address of log recording is " NULL "), then delete the data element being currently inserted into;If It is deletion action (last data address is " NULL "), then reinserts deleted data element;If updating operation (in addition to above-mentioned two situations), then return to original state (value of i.e. first data address) by the value of data element.Such as Affairs T2 has rewind journal in table 2, then finds still effective log recording (the third line of table 2, fifth line) according to affairs ID, so After carry out rollback:Data element A value is set to initial value A1, data element B is deleted.
(4) if submitting daily record in the absence of effective affairs, also in the absence of effective rewind journal, but exist still effective Log recording, shows that the affairs are not yet completed, it is understood that there may be partial log record written data file 5, and part does not write Situation, now need display one transaction rollback of insertion.Then rolling back action is carried out according to above-mentioned 3rd step.It is false in such as table 2 Be located at fifth line data record fill in finish after collapse, now affairs T1 does not write " commit " log recording, now needs rollback Operations all T1, i.e., one rollback record of insertion first in journal file 2, as shown in table 3.
Table 3:
T1 Rollback P(Z) NULL
Then data element X value is reverted into P (X1), data element Y value returns to P (Y1), inserts data element Z, and its value is set to P (Z1).
The method of the flash memory database data recovery of the present invention, devises a kind of new log record, by change The data address of data member and its all different editions is saved as in same log recording, is easy in log rollback or submission When according to affairs ID be quickly found out valid data record, increase data recovery efficiency.
The present invention follows WAL (Write Ahead Logging) rules to determine when refresh daily record simultaneously, i.e., local number When being modified according to storehouse, it is necessary to have corresponding log recording, on the contrary it is not necessarily so.When system conflicts, renewal will only by Journal file 2 is stored, without being delivered in database.Therefore when performing recovery operation, above-mentioned mechanism is able to ensure that data The uniformity and integrality in storehouse.
The method of flash memory database data recovery of the present invention, goes through present in the flash memory database using chain type log system History version information carries out journalizing, uses list structure to replace sequential organization to store log recording to improve data recovery effect Rate.The log recording of failure is removed by periodic test point strategy, flash memory space is saved, while effectively reducing daily record text The length of part.
Described above is only the preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, without departing from the technical principles of the invention, some improvement and deformation can also be made, these improve and deformed Also it should be regarded as protection scope of the present invention.

Claims (8)

1. a kind of method of flash memory database data recovery, it is characterised in that including:
Scanning log file, confirms whether have still effective affairs to submit log recording or transaction rollback day in journal file Will;
The state current according to journal file is handled as follows respectively:
If submitting log recording in the presence of effective affairs, show that all changes for being related to the affairs are not yet completely written to data text In part, need to complete the rewriting of data file according to log recording;
If being recorded in the presence of effective rewind journal, all log recordings are searched according to affairs ID, and carry out rolling back action;
If submitting log recording in the absence of effective affairs, also in the absence of effective rewind journal, but there is still effective day Will is recorded, and shows that the affairs are not yet completed, and checks for partial log record written data file, and part does not write Situation, such as exist, then carry out rolling back action.
2. the method for flash memory database data recovery as claimed in claim 1, it is characterised in that rolling back action includes:First The still effective log recording of the corresponding affairs of all about affairs ID, Ran Houyi are found out from journal file according to affairs ID Secondary judgement logging operations type, according to different operating type, completes following operation:If insertion operation, then delete current The data element of insertion;If deletion action, then deleted data element is reinserted;If updating operation, then by data The value of element returns to original state.
3. the method for flash memory database data recovery as claimed in claim 1, it is characterised in that also include:Chain type daily record, bag The log recording for the different pieces of information operation that each affairs of sequential storage are produced in a chained list and a tables of data, chained list is included, Included in tables of data in the different editions data of each data member in a log recording, the log recording of chained list comprising specified The address of tables of data;Log recording in tables of data includes affairs ID, data member, four words of preceding member and data address table Section, wherein affairs ID is No. ID of affairs belonging to current log is recorded;Data member be current data operate point to data into The title of member;Preceding member is to produce the preceding member of change in Current transaction;Data address table is all edition datas of data member Address, each edition data is attached with chained list in chronological order, when affairs are submitted or after rollback, the data address field It is set to sky.
4. the method for flash memory database data recovery as claimed in claim 3, it is characterised in that log recording builds daily record text The method of part includes:
It is that the data member of first renewal inserts a day when a new affairs unlatching, and when producing first data variation Will is recorded;
When producing the change of other data members in affairs, then a new log recording is inserted, its preceding member is set to upper one The data record of change;
For insertion and deletion action, the data of different editions are distinguished using multiple indications in data address table;
If affairs are submitted or rollback, insert one and submit or rewind journal record, preceding member is set to what is updated before Member;
All data members for producing change and its specific data manipulation in database of record, and uniformly it is stored in journal file In.
5. the method for flash memory database data recovery as claimed in claim 4, it is characterised in that also include:
Checkpoint is write in journal file, it is checkpoint to show current location;
Log recording is scanned one by one in units of log blocks, when running into checkpoint, confirms own before checkpoint The validity of log recording, new free block is write by still effective log recording;
After the scanning to log blocks is completed, erasing operation is carried out to it, and be transferred to next log blocks not scanned;
When free block is full, then apply for new free block, new effective record is write to new free block.
6. the method for flash memory database data recovery as claimed in claim 5, it is characterised in that also include:By current log The method that effective record in block dumps to new log blocks includes:
Unloading flag bit is set to 1, and creates a new log blocks;
First log recording is obtained, whether judge current unloading flag bit is 1, if not 1, then wipe old log blocks and knot Beam;If 1, then judge whether current log record effective, if still effectively if by current log record copies to new daily record Block, and obtain next log recording and recorded as current log;Directly obtained if invalid next log recording as work as Preceding log recording;
If new log blocks are full, next free block is obtained as new log blocks;
If the current log obtained is recorded as sky, unloading flag bit is set to 0, shows that unloading operation has terminated.
7. the method for flash memory database data recovery as claimed in claim 6, it is characterised in that the time interval root of checkpoint Dynamically adjusted according to application characteristic.
8. the method for flash memory database data recovery as claimed in claim 3, it is characterised in that the data storage of chain type daily record Method:
Log recording is first write into internal memory or caching, log recording is write into journal file, data variation is write into data file, Corresponding log recording in ineffective treatment journal file.
CN201710358273.7A 2017-05-19 2017-05-19 Method for recovering data of flash memory database Active CN107220145B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710358273.7A CN107220145B (en) 2017-05-19 2017-05-19 Method for recovering data of flash memory database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710358273.7A CN107220145B (en) 2017-05-19 2017-05-19 Method for recovering data of flash memory database

Publications (2)

Publication Number Publication Date
CN107220145A true CN107220145A (en) 2017-09-29
CN107220145B CN107220145B (en) 2021-06-01

Family

ID=59945356

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710358273.7A Active CN107220145B (en) 2017-05-19 2017-05-19 Method for recovering data of flash memory database

Country Status (1)

Country Link
CN (1) CN107220145B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109101368A (en) * 2018-08-20 2018-12-28 郑州云海信息技术有限公司 A kind of data processing method and device
CN109885422A (en) * 2018-12-29 2019-06-14 贝壳技术有限公司 The data rewind method and apparatus of configuration platform in a kind of house prosperity transaction system
CN109960601A (en) * 2017-12-26 2019-07-02 航天信息股份有限公司 A kind of restoration methods of business datum, device and electronic equipment
CN110096389A (en) * 2019-04-30 2019-08-06 上海达梦数据库有限公司 A kind of starting method, apparatus, equipment and the storage medium of database
CN111026772A (en) * 2019-11-26 2020-04-17 中科驭数(北京)科技有限公司 Method and device for ensuring permanence of database modification
CN111240891A (en) * 2018-11-29 2020-06-05 中国移动通信集团内蒙古有限公司 Data recovery method and device based on data consistency among multiple tables of database
WO2020143240A1 (en) * 2019-01-10 2020-07-16 江苏华存电子科技有限公司 Method for quickly recovering data in flash memory database
CN111654453A (en) * 2020-04-23 2020-09-11 平安国际智慧城市科技股份有限公司 Form data offline caching method and device, terminal and storage medium
CN111694893A (en) * 2020-04-23 2020-09-22 武汉达梦数据库有限公司 Partial rollback analysis method based on log analysis and data synchronization system
CN112612648A (en) * 2020-12-29 2021-04-06 厦门市美亚柏科信息股份有限公司 SQL Server database recovery method, terminal device and storage medium
CN114064664A (en) * 2022-01-17 2022-02-18 北京奥星贝斯科技有限公司 Method and device for inquiring transaction modification content in database

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060047925A1 (en) * 2004-08-24 2006-03-02 Robert Perry Recovering from storage transaction failures using checkpoints
CN101286127A (en) * 2008-05-08 2008-10-15 华中科技大学 Multi-fork diary memory continuous data protecting and restoration method
CN101470629A (en) * 2007-12-30 2009-07-01 英特尔公司 Mechanism for strong atomicity in a transactional memory system
CN102156720A (en) * 2011-03-28 2011-08-17 中国人民解放军国防科学技术大学 Method, device and system for restoring data
US8037112B2 (en) * 2007-04-23 2011-10-11 Microsoft Corporation Efficient access of flash databases
CN102436490A (en) * 2010-10-28 2012-05-02 微软公司 Versatile in-memory database recovery
US20140095765A1 (en) * 2012-09-28 2014-04-03 Apple Inc. Flash translation layer (ftl) database journaling schemes
CN105786955A (en) * 2015-01-08 2016-07-20 国际商业机器公司 Data replication in a database management system
CN105930500A (en) * 2016-05-06 2016-09-07 华为技术有限公司 Transaction recovery method in database system, and database management system
US20160292250A1 (en) * 2013-12-12 2016-10-06 Huawei Technologies Co., Ltd. Data replication method and storage system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060047925A1 (en) * 2004-08-24 2006-03-02 Robert Perry Recovering from storage transaction failures using checkpoints
US8037112B2 (en) * 2007-04-23 2011-10-11 Microsoft Corporation Efficient access of flash databases
CN101470629A (en) * 2007-12-30 2009-07-01 英特尔公司 Mechanism for strong atomicity in a transactional memory system
CN101286127A (en) * 2008-05-08 2008-10-15 华中科技大学 Multi-fork diary memory continuous data protecting and restoration method
CN102436490A (en) * 2010-10-28 2012-05-02 微软公司 Versatile in-memory database recovery
CN102156720A (en) * 2011-03-28 2011-08-17 中国人民解放军国防科学技术大学 Method, device and system for restoring data
US20140095765A1 (en) * 2012-09-28 2014-04-03 Apple Inc. Flash translation layer (ftl) database journaling schemes
US20160292250A1 (en) * 2013-12-12 2016-10-06 Huawei Technologies Co., Ltd. Data replication method and storage system
CN105786955A (en) * 2015-01-08 2016-07-20 国际商业机器公司 Data replication in a database management system
CN105930500A (en) * 2016-05-06 2016-09-07 华为技术有限公司 Transaction recovery method in database system, and database management system

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
SILBERSCHATZ,A.等著,杨冬青等译: "《数据库系统概念(原书第6版)》", 31 March 2012, 机械工业出版社 *
卢泽萍,孟小峰,周大: "HV-Recovery :一种闪存数据库的高效恢复方法", 《计算机学报》 *
林春: "分布式内存数据库的恢复", 《航空计算技术》 *
王曼丽等: "一种高效的闪存数据库故障恢复方法MMR", 《计算机技术与发展》 *

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109960601A (en) * 2017-12-26 2019-07-02 航天信息股份有限公司 A kind of restoration methods of business datum, device and electronic equipment
CN109960601B (en) * 2017-12-26 2023-03-24 航天信息股份有限公司 Service data recovery method and device and electronic equipment
CN109101368B (en) * 2018-08-20 2022-04-22 郑州云海信息技术有限公司 Data processing method and device
CN109101368A (en) * 2018-08-20 2018-12-28 郑州云海信息技术有限公司 A kind of data processing method and device
CN111240891A (en) * 2018-11-29 2020-06-05 中国移动通信集团内蒙古有限公司 Data recovery method and device based on data consistency among multiple tables of database
CN109885422A (en) * 2018-12-29 2019-06-14 贝壳技术有限公司 The data rewind method and apparatus of configuration platform in a kind of house prosperity transaction system
CN109885422B (en) * 2018-12-29 2024-01-12 贝壳技术有限公司 Data rollback method and device for configuration platform in real estate transaction system
WO2020143240A1 (en) * 2019-01-10 2020-07-16 江苏华存电子科技有限公司 Method for quickly recovering data in flash memory database
CN110096389A (en) * 2019-04-30 2019-08-06 上海达梦数据库有限公司 A kind of starting method, apparatus, equipment and the storage medium of database
CN111026772A (en) * 2019-11-26 2020-04-17 中科驭数(北京)科技有限公司 Method and device for ensuring permanence of database modification
CN111026772B (en) * 2019-11-26 2020-11-27 中科驭数(北京)科技有限公司 Method and device for ensuring permanence of database modification
CN111694893A (en) * 2020-04-23 2020-09-22 武汉达梦数据库有限公司 Partial rollback analysis method based on log analysis and data synchronization system
CN111654453B (en) * 2020-04-23 2023-04-18 平安国际智慧城市科技股份有限公司 Form data offline caching method and device, terminal and storage medium
CN111694893B (en) * 2020-04-23 2023-04-25 武汉达梦数据库股份有限公司 Partial rollback analysis method and data synchronization system based on log analysis
CN111654453A (en) * 2020-04-23 2020-09-11 平安国际智慧城市科技股份有限公司 Form data offline caching method and device, terminal and storage medium
CN112612648A (en) * 2020-12-29 2021-04-06 厦门市美亚柏科信息股份有限公司 SQL Server database recovery method, terminal device and storage medium
CN112612648B (en) * 2020-12-29 2022-11-08 厦门市美亚柏科信息股份有限公司 SQL Server database recovery method, terminal equipment and storage medium
CN114064664A (en) * 2022-01-17 2022-02-18 北京奥星贝斯科技有限公司 Method and device for inquiring transaction modification content in database
WO2023134518A1 (en) * 2022-01-17 2023-07-20 北京奥星贝斯科技有限公司 Method and apparatus for querying modified content of transaction in database

Also Published As

Publication number Publication date
CN107220145B (en) 2021-06-01

Similar Documents

Publication Publication Date Title
CN107220145A (en) A kind of method of flash memory database data recovery
CN104537037B (en) A kind of method and device of processing data storehouse daily record
US7552150B2 (en) Reason-based database changes
CN101183322B (en) Method for deferred logging and apparatus thereof
EP3441890A1 (en) Transaction recovery method in database system and database management system
CN100430902C (en) Distributing real-time data bank fault recovering method capable of supporting serving and recovering simultaneously
CN107992269B (en) Transaction writing method based on deduplication SSD
CN103744936A (en) Multi-version concurrency control method in database and database system
US20140236911A1 (en) Low Level Object Version Tracking Using Non-Volatile Memory Write Generations
US9280572B2 (en) Managing product information versions
CN107851037A (en) The consistency protocol that hardware transactional in the shared memory using locking and unlocked nonvolatile storage stores
CN110555770B (en) Block chain world state checking and recovering method based on incremental hash
WO2020143240A1 (en) Method for quickly recovering data in flash memory database
CN104899117B (en) Memory database parallel logging method towards Nonvolatile memory
CN106095613A (en) Use the rollback database of WAL
KR102195839B1 (en) Technique for log records management in database management system
CN110096509A (en) Realize that historical data draws the system and method for storage of linked list modeling processing under big data environment
CN106681848A (en) Data consistency guarantee method and system of erasure code RAID
CN111414320B (en) Method and system for constructing disk cache based on nonvolatile memory of log file system
US9411692B2 (en) Applying write elision
KR20110046118A (en) Adaptive logging apparatus and method
CN103678608B (en) Blog management method and device
CN105556486B (en) Method and system for managing the memory dynamically distributed in computing unit automatically
US20110113017A1 (en) Supporting Internal Consistency Checking with Consistency Coded Journal File Entries
CN112597070B (en) Object recovery method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant