A method for maintaining data consistency in heterogeneous storage systems

By using the write scheduling module and data recovery module in the heterogeneous storage system, and using the global auto-increment number and log item management, the data consistency problems caused by the writing order, granularity and method in the heterogeneous storage system are solved, and the data consistency problem is solved. Efficient and secure storage of data.

CN118503015BActive Publication Date: 2024-10-18JILIN UNIVERSITY
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410947299.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-10-18
Estimated Expiration
2044-07-16

AI Technical Summary

Technical Problem

Different types of storage devices in heterogeneous storage systems have different writing sequences, writing granularities, and writing methods, which makes data consistency difficult to maintain and affects the efficient storage and security of data.

Method used

The write scheduling module and data recovery module are used to ensure the consistency of data in the writing and recovery process of heterogeneous storage systems through global self-increasing number variables and log item management, and use the heterogeneous characteristics of DRAM, NVM and disks to perform data processing. Scheduling and recovery.

Benefits of technology

It effectively solves the problem of data consistency in heterogeneous storage systems, ensures that data maintains integrity and security during storage and recovery, and improves the efficiency and reliability of data storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118503015B_ABST
    Figure CN118503015B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of data storage security and consistency technology, and in particular to a method for maintaining data consistency in a heterogeneous storage system, comprising: when a heterogeneous storage system performs a write operation, calling a preset write scheduling module to determine a write position and a write content, completing the write operation and storing the write data; when the heterogeneous storage system crashes, calling a preset data recovery module to restore the write data to a storage device; wherein the heterogeneous storage system includes DRAM, NVM, and a disk, the write scheduling module is connected to the DRAM, NVM, and the disk, and the data recovery module is connected to the NVM and the disk. The present invention can solve the data consistency problem caused by different write orders, write granularities, and write methods of heterogeneous storage systems, so that the integrity and security of data can be guaranteed when it is efficiently stored in a heterogeneous storage system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data storage security and consistency technology, and in particular to a method for maintaining data consistency in a heterogeneous storage system. Background Art

[0002] In the design process of storage software systems, data consistency is an issue that must be considered because it is crucial for the safe and secure storage of data. Previous consistency work mainly focused on maintaining the data consistency of software systems on a single storage device. For example, all database and file system work considers data consistency issues. In addition, some consistency work specifically explores the consistency model of the file system.

[0003] Previous consistency work has mainly focused on a single type of storage device. With the emergence of new non-volatile memory (NVM), work based on multiple types of memory and storage devices with different access modes has emerged, such as DRAM, NVM, disks, etc. To efficiently use various heterogeneous storage devices at the same time, it will bring challenges to maintaining data consistency on each device. Specifically, different types of storage devices have different write orders, write granularity, and write methods. These heterogeneities make it difficult to maintain data consistency.

[0004] Therefore, there is an urgent need for a method to maintain data consistency in heterogeneous storage systems. Summary of the invention

[0005] The purpose of the present invention is to provide a method for maintaining data consistency in a heterogeneous storage system, which can solve the data consistency problem caused by different write orders, write granularities and write methods in the heterogeneous storage system, so that the integrity and security of data can be guaranteed when it is efficiently stored in the heterogeneous storage system.

[0006] To achieve the above object, the present invention provides the following solutions:

[0007] A method for maintaining data consistency in a heterogeneous storage system, comprising:

[0008] When a heterogeneous storage system performs a write operation, a preset write scheduling module is called to determine the write location and write content, complete the write operation and store the write data;

[0009] When the heterogeneous storage system crashes, calling a preset data recovery module to restore the written data to the storage device;

[0010] The heterogeneous storage system includes DRAM, NVM, and a disk, the write scheduling module is connected to the DRAM, NVM, and the disk, and the data recovery module is connected to the NVM and the disk.

[0011] Optionally, the write scheduling module adopts a write scheduling strategy, and the write scheduling strategy includes:

[0012] Maintain a global auto-increment number variable and a global NVM record variable to be written for each data page block;

[0013] When the data page block is written into NVM or written back to disk, the global auto-increment number variable is increased by 1;

[0014] When the write-back-to-disk event starts, the global NVM record variable to be written is recorded, and when the write-back-to-disk event ends, the global NVM record variable to be written is written to the NVM.

[0015] Optionally, the writing process of writing the scheduling strategy includes:

[0016] Writing data into the DRAM according to the rules of the heterogeneous storage system, marking the data page block as dirty and waiting to be written back to the disk;

[0017] Determine whether it is synchronous writing, if not, the writing ends; if so, the synchronous writing is executed.

[0018] Optionally, the synchronous writing process includes:

[0019] Set the first log item of type to be written, fill the written information into the first log item, and append a version number to the first log item, wherein the version number is the current value of the global auto-increment number variable;

[0020] The first log entry after filling is written to the NVM in an atomic manner.

[0021] Optionally, the write-back disk event includes a write-back start event and a write-back end event.

[0022] Optionally, the process of writing back the start event includes:

[0023] Set a second log item of type writeback, fill the writeback information into the second log item, and append a pre-expired version number to the second log item, wherein the pre-expired version number is a global auto-incremented number variable before the writeback starts;

[0024] The second log entry that has been filled in the temporary storage is waiting for the write-back to be completed.

[0025] Optionally, the process of writing back the end event includes:

[0026] After the write-back is completed, a version number is added to the second log item, and the second log item is written into the NVM, wherein the version number is the current value of the global auto-increment number variable.

[0027] Optionally, the data recovery module adopts a recovery strategy, and the recovery strategy includes:

[0028] Traversing the log entries of each data page block on the NVM from back to front, and storing the log entries in a to-be-recovered stack;

[0029] If it is detected that the log entry is earlier than the pre-expired version number marked by the accessed write-back entry, the traversal ends; if it is not detected, all log entries in the data page block are traversed and the traversal ends;

[0030] Page block recovery is completed according to the log entries in the to-be-recovered stack.

[0031] The beneficial effects of the present invention are:

[0032] The present invention can solve the data consistency problem caused by different writing orders, writing granularities and writing methods in heterogeneous storage systems, so that the integrity and security of data can be guaranteed when data is efficiently stored in the heterogeneous storage system. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1 A flow chart of a method for maintaining data consistency in a heterogeneous storage system according to an embodiment of the present invention;

[0035] Figure 2 is a writing flow chart of an embodiment of the present invention;

[0036] Figure 3 A synchronous writing flow chart of an embodiment of the present invention;

[0037] Figure 4 A flowchart of a write-back start event according to an embodiment of the present invention;

[0038] Figure 5 This is a flow chart of write-back end events according to an embodiment of the present invention;

[0039] Figure 6 The following is a flow chart of page block recovery according to an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0041] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0042] This embodiment provides a method for maintaining data consistency in a heterogeneous storage system, including:

[0043] When a heterogeneous storage system performs a write operation, a preset write scheduling module is called to determine the write location and write content, complete the write operation and store the write data;

[0044] When a heterogeneous storage system crashes, the preset data recovery module is called to restore the written data to the storage device;

[0045] The heterogeneous storage system includes DRAM, NVM, and disk, the write scheduling module is connected with DRAM, NVM, and disk, and the data recovery module is connected with NVM and disk.

[0046] Specifically, Figure 1 As shown, the write scheduling module and the data recovery module are placed in the heterogeneous storage system to ensure data consistency. When the heterogeneous storage system performs a write operation, the write location and content are determined by the write scheduling module, and the data recovery module is guaranteed to recover the data intact after the crash; when the system crashes, the data recovery module is called, and the module restores the correct and appropriate data to the final storage device based on the data previously stored on each heterogeneous storage device. The final storage device of this embodiment is a disk. The write scheduling module is connected to DRAM, NVM and disk at the same time to make full use of each heterogeneous storage device; the data recovery module is only connected to NVM and disk, because only NVM and disk can store data after the crash.

[0047] Furthermore, the write scheduling module adopts a write scheduling strategy, and the write scheduling strategy includes:

[0048] Maintain a global auto-incrementing number variable and a global NVM record variable to be written for each data page block;

[0049] When a data page block is written to NVM or written back to disk, the global auto-increment number variable increases by 1;

[0050] When the write-back-to-disk event starts, the global NVM record variable to be written is recorded, and when the write-back-to-disk event ends, the global NVM record variable to be written is written to the NVM.

[0051] The writing process of the writing scheduling policy includes:

[0052] Write data to DRAM according to the rules of heterogeneous storage systems, mark the data page block as dirty and wait to be written back to disk;

[0053] Determine whether it is synchronous writing. If not, the writing ends; if so, synchronous writing is performed.

[0054] The synchronous writing process includes:

[0055] Set the first log item of type to write, fill the written information into the first log item, and append a version number to the first log item, where the version number is the current value of the global auto-increment number variable;

[0056] The first log entry after filling is written to NVM atomically.

[0057] Furthermore, the write-back disk event includes a write-back start event and a write-back end event. The process of the write-back start event includes:

[0058] Set the second log item type to writeback, fill the writeback information into the second log item, and append a pre-expired version number to the second log item, where the pre-expired version number is a global auto-incremented number variable before the writeback starts; temporarily store the filled second log item and wait for the writeback to end.

[0059] The process of writing back the end event includes:

[0060] After the write-back is completed, a version number is added to the second log entry, and the second log entry is written to the NVM, where the version number is the current value of the global auto-increment number variable.

[0061] Specifically, for the write scheduling module, its write strategy needs to take into account the potential consistency issues caused by the different write orders, write granularities, and write methods of heterogeneous storage devices, and persist data and important recovery-related information to appropriate devices through reasonable write content decisions and scheduling. For the write order and write granularity issues, the write scheduling strategy maintains a global write clock on the NVM. For the write method issue, the write scheduling strategy solves it by reasonably designing the write content and write timing of the NVM global write clock. Specifically, the write scheduling module maintains a global auto-incrementing number variable, namely page_ver_id, for each data page block, that is, the access granularity unit of the disk. Whenever the page block is written to NVM or written back to disk, the corresponding page_ver_id will increase by 1. In addition, the module maintains a global NVM record variable to be written, namely prep_rec, for each data page block. This record is used to record the write back event and the ver_id at the moment when the disk write back starts, and write this prep_rec record to the NVM at the end of the disk write back.

[0062] The writing and synchronous writing process based on the writing scheduling module is shown in Figure 2 and Figure 3 , the write-back start event and write-back end event of the write-back disk process based on the write scheduling module are shown in Figure 4 and Figure 5 Specifically, for any write, its content will first be written to the DRAM cache according to the rules of an existing storage system, such as a file system, and the cache page block being written is marked as dirty. If the write does not need to be synchronized, the write process ends and the data waits to be asynchronously written back to the disk by the system. If synchronization is required, the synchronous write process is executed. Similarly, independent synchronization operations, such as the system fsync operation, will result in a synchronous write process for each dirty page block.

[0063] For the synchronous writing process, the heterogeneous storage system on which this embodiment relies does not wait for the data to be written to the disk, but writes the data to a faster NVM storage device. This embodiment requires that the writing be performed in a log manner, specifically: a new log item (record) is created for this synchronous writing, its type is set to write (WRITE), and the key information such as the page block index (page_index), data (data), offset (off), length (len) written are filled into the log item. Next, this embodiment emphasizes that the current value of the global numbering variable page_ver_id is appended to the log item as the version number (vid) of the log item, and the variable is incremented by 1. When the log item is filled, the entire log item is written to the NVM in an atomic manner. Among them, this embodiment does not limit the specific recording form of the log on the NVM and the method of ensuring atomicity, that is, each storage system can adopt different implementations according to needs.

[0064] For writing data back to the disk, this embodiment does not change the write-back method of the existing storage system, but requires the execution of corresponding logic before and after the start of the write-back: before the start of the write-back, a log item prep_rec is constructed for this write-back event, its type is set to write-back (WRITEBACK), the page block subscript of the write-back item is filled, and the current value of the global numbering variable page_ver_id is assigned to the pre-expired version number (exp_id) in the log item, and then the write-back process is started; after the write-back is successfully completed, the version number (vid) of the log item prep_rec of this write-back event prepared above is set to the current value of the global numbering variable (page_ver_id), and the variable is incremented by 1, and then prep_rec is written to the NVM as a new log item.

[0065] Based on these designs, the write scheduling module will retain enough information on the NVM and disk for the data recovery module to recover data after a crash.

[0066] Furthermore, the data recovery module adopts a recovery strategy, which includes:

[0067] Traverse the log entries of each data page block on the NVM from back to front, and store the log entries in the to-be-recovered stack;

[0068] If it is detected that the log entry is earlier than the pre-expired version number marked by the accessed write-back entry, the traversal ends; if not detected, all log entries in the data page block are traversed and the traversal ends;

[0069] Complete page block recovery based on the log entries in the stack to be recovered.

[0070] Specifically, for the data recovery module, its recovery strategy needs to make full use of the information written to NVM and disk by the write scheduling module before the crash, so as to reasonably restore the user synchronous write after the crash, that is, the data that the user requires to be persistent. For each page block, its data recovery process is as follows: Figure 6As shown, specifically: for each data page block stored in the heterogeneous storage system, the data recovery module traverses the log entries of the page block on the NVM from back to front. Each traversed entry will be temporarily stored in the to-be-recovered stack, namely useful_reocrds. The traversal stops when all entries of the page block have been accessed, or the current entry vid is earlier than the exp_vid of a WRITEBACK entry that has been accessed. For the second stop condition, the reason is that when the WRITEBACK entry is detected, the exp_vid recorded by the entry and all the previous vid writes have been included in the data written back to the disk. Therefore, at this time, it is only necessary to read the data from the disk and replay the NVM log records after exp_vid, and the earlier NVM log records should be discarded. After the traversal stops, the page block version on the disk is taken as the page variable, and then the log items in the to-be-recovered stack useful_records are popped one by one and replayed to the page variable. When all data is replayed, the page variable is overwritten back to the corresponding page block on the disk, and the recovery of the page block is completed. The storage system data can be completely restored by simply applying the above recovery process to all page blocks managed by this embodiment.

[0071] The embodiments described above are only descriptions of the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.

Claims

1. A method for maintaining data consistency in a heterogeneous storage system, characterized in that: include: When a heterogeneous storage system performs a write operation, a preset write scheduling module is called to determine the write location and write content, complete the write operation and store the write data; When the heterogeneous storage system crashes, calling a preset data recovery module to restore the written data to the storage device; Wherein, the heterogeneous storage system includes DRAM, NVM, and disk, the write scheduling module is connected to the DRAM, NVM, and disk, and the data recovery module is connected to the NVM and disk; The write scheduling module adopts a write scheduling strategy, and the write scheduling strategy includes: Maintain a global auto-increment number variable and a global NVM record variable to be written for each data page block; When the data page block is written into NVM or written back to disk, the global auto-increment number variable is increased by 1; When the write-back-to-disk event starts, the global NVM record variable to be written is recorded, and when the write-back-to-disk event ends, the global NVM record variable to be written is written to the NVM; The writing process of the writing scheduling strategy includes: Writing data into the DRAM according to the rules of the heterogeneous storage system, marking the data page block as dirty and waiting to be written back to the disk; Determine whether it is synchronous writing, if not, then end the writing; if yes, then execute the synchronous writing; The synchronous writing process includes: Set the first log item of type to be written, fill the written information into the first log item, and append a version number to the first log item, wherein the version number is the current value of the global auto-increment number variable; Writing the first log entry after filling into the NVM in an atomic manner; The write-back disk event includes a write-back start event and a write-back end event; The process of writing back the start event includes: Set a second log item of type writeback, fill the writeback information into the second log item, and append a pre-expired version number to the second log item, wherein the pre-expired version number is a global auto-incremented number variable before the writeback starts; The second log entry that has been filled is temporarily stored and waits for the write-back to be completed; The process of writing back the end event includes: After the write-back is completed, a version number is added to the second log item, and the second log item is written into the NVM, wherein the version number is the current value of the global auto-increment number variable; The data recovery module adopts a recovery strategy, which includes: Traversing the log entries of each data page block on the NVM from back to front, and storing the log entries in a to-be-recovered stack; If it is detected that the log entry is earlier than the pre-expired version number marked by the accessed write-back entry, the traversal ends; if it is not detected, all log entries in the data page block are traversed and the traversal ends; Page block recovery is completed according to the log entries in the to-be-recovered stack.

Citation Information

Patent Citations

  • Storage-class memory based method for improving performance of log file system

    CN105335098A

  • Database processing method, device and system

    CN110019066A

  • Efficient indexing method for optimizing leaf node merging operation

    CN111475508A

  • Data recovery in virtual storage system

    CN114127693A

  • Data management method and data management device

    CN114816224A