Data verification method and related equipment

By obtaining the LSN and CRC of the data page in memory to generate key-value pairs and storing them in the verification log, the problem of not being able to identify memory data errors during database restart is solved, and the checksum repair of the data page version information is realized, avoiding the spread of data errors.

CN120508437APending Publication Date: 2025-08-19HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410182556.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-18
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

In the prior art, data errors in data pages in memory cannot be identified by replaying the redo log when the database is restarted, especially when the flashing failed before the redopoint and the log is not modified, resulting in data errors not being recognized and spread.

Method used

By obtaining the version information of the data page in memory, including the log sequence number LSN and the cyclic redundancy verification CRC, key-value pairs are generated and stored in the verification log, and the version information in the memory is verified to ensure that data errors are identified without modification before the database restart after redopoint.

Benefits of technology

It realizes verification of the version information of the data page in the memory, identify and repair data errors, avoids the spread of data errors, and improves the efficiency and accuracy of data verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120508437A_ABST
    Figure CN120508437A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data verification method and related equipment, which are used for verifying version information of a data page in a memory. In the application, first version information is obtained by obtaining version information of a data page in a memory, and the version information of the data page comprises a log serial number LSN. After the data page in the memory is flashed to the memory, the version information of the data page can be obtained from the memory, and the second version information is obtained. According to the embodiment of the invention, the first version information of the data page in the memory is acquired, then the second version information is verified on the basis of the first version information, and verification of the version information of the data page in the memory is realized under the condition that the data page is not modified after redopoint and before the database is restarted, so that the data page with data errors is identified, and data error spreading is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data storage technology, and in particular to a data verification method and related equipment. Background Art

[0002] Database data pages typically reside in memory. When a data page in memory is modified, a new version of the page is created. This new version can then be flushed (i.e., dirty) to memory (hereinafter referred to as memory) based on non-volatile storage media. Each time a data page is modified in memory, a new redo log (stored in append-only format) is generated, recording the changes to the data page. After the database is restarted, the redo log can be replayed to identify data errors in the database.

[0003] Among them, after the data page in the memory is modified from version information 1 to version information 2, if the data page fails to be flushed from the memory to the storage based on the checkpoint mechanism, the version information of the data page in the memory is version information 2, while the version information of the data page in the storage is still version information 1, that is, there is a data error. Subsequently, if the data page in the memory is modified, a new redo log can be obtained. The new redo log records the change of the version information of the data page in the memory from version information 2 to version information 3. After obtaining the new redo log, if a database restart occurs, the new redo log can be replayed, that is, the version information 1 of the data page must be obtained from the storage and the new redo log is replayed. Since the new redo log requires that the version information 2 of the data page be changed to version information 3, while the version information of the data page in the storage is version information 1, the data error problem of the data page in the storage is discovered, and error processing can be performed.

[0004] However, redo log replay starts from the redo log following the redo point (a redo point is a redo log) and continues until the last redo log before the database restart. If the aforementioned data page flush failure occurs before the redo point, and no redo log exists between the redo point and the database restart to modify the data page, the data error on the data page cannot be identified by replaying the redo logs. Summary of the Invention

[0005] Embodiments of the present application provide a data verification method and related devices for verifying version information of data pages in a memory.

[0006] The first aspect of the present application provides a data verification method, which obtains first version information by obtaining version information of a data page in memory, wherein the version information of the data page includes a log sequence number (LSN). After the data page in memory is flushed to the memory, the version information of the data page can be obtained from the memory to obtain second version information. The second version information is then verified based on the first version information. When the data page is not modified after redopoint and before the database is restarted, the version information of the data page in the memory is verified, thereby identifying data pages with data errors and preventing the spread of data errors.

[0007] A data page is the smallest unit for storing data in a memory. The size of the data stored in a data page can be 4 kilobytes or 16KB, which is not limited here. When the memory receives a read or write command, the read or write command can be a read operation, a write operation, or a modification operation on a data page. The memory can return the data page to the memory based on the read or write command so that the read or write command can be executed on the data page in the memory. Compared to the memory, the capacity of the memory is smaller, and the memory generally stores data through a volatile storage medium. Therefore, after modifying the data page in the memory, the data in the modified data page in the memory needs to be stored in the data page of the memory, thereby updating the data of the data page in the memory. There are many ways for the memory to flush data pages to the memory, including the cold data elimination mechanism and the checkpoint mechanism.

[0008] In some possible implementations, the version information of the data page may include a log sequence number (LSN). In some possible implementations, the version information of the data page may include a log sequence number (LSN) and a cyclic redundancy check (CRC).

[0009] The LSN is the redo log number. The LSN is stored in the data page in memory. When the data page is modified, a new redo log is generated with a unique number, namely the new LSN. This new LSN replaces the LSN stored in the data page in memory, and the new LSN is stored in the data page in memory.

[0010] In some possible implementations, after obtaining the version information of the data page in the memory and obtaining the first version information, the method further includes: generating a key-value pair based on the page identifier of the data page and the first version information, wherein the key in the key-value pair is the page identifier of the data page, and the value in the key-value pair is the first version information; storing the key-value pair in a verification log; before verifying the second version information based on the first version information, the method further includes: obtaining the key-value pair from the verify log based on the page identifier of the data page; and determining the first version information based on the key-value pair.

[0011] By storing the verify log, when the database is restarted, the first version information can be determined from the verify log using the page identifier without losing the obtained first version information.

[0012] In some possible implementations, after the key-value pair is generated, it can first be stored in a verify log buffer pool. The data in the verify log buffer pool is then flushed to a persistent file in an append-write manner. In some possible implementations, the data in the verify log buffer pool can be flushed to a persistent file immediately, periodically, or based on a trigger condition (e.g., insufficient available capacity in the buffer pool). This is not limited here.

[0013] In some possible implementations, obtaining the key-value pair from the verify log based on the page identifier of the data page includes: obtaining multiple key-value pairs with the page identifier of the data page as the key from the verify log; determining the first version information based on the key-value pair includes: merging the values of the multiple key-value pairs to determine the latest first version information.

[0014] If the latest first version information passes the verification of the second version information, then the non-latest first version information can also pass the verification of the second version information, thereby reducing the number of verifications and improving verification efficiency.

[0015] In some possible implementations, the verification of the second version information based on the first version information includes: if the LSN in the second version information is greater than or equal to the LSN in the first version information, the verification passes; if the LSN in the second version information is smaller than the LSN in the first version information, the verification fails.

[0016] By comparing the first version information and the second version information, if the second version information is consistent with the first version information, or the second version information is newer than the first version information, it is determined that the version information of the data page is correct and the verification passes; otherwise, the verification fails.

[0017] In some possible implementations, if the verification fails, the version information of the data page in the memory is repaired; the repairing of the version information of the data page in the memory includes: replacing the version information of the data page in the memory based on the version information of the data page in the memory; or, updating the version information of the data page in the memory based on the redo log related to the data page; or, obtaining the version information of the data page from the standby node to replace the version information of the data page in the memory. Then, when a data error is found in the version information of a data page, the version information of the data page can be repaired.

[0018] In some possible implementations, if the verification fails, after verifying the second version information based on the first version information, the method further includes: deleting the key-value pair from the verify log. This saves storage space in the verify log and allows for the subsequent storage of new key-value pairs.

[0019] When the amount of data stored in the verify log's persistent file reaches a certain level, some data needs to be eliminated to free up storage space for other data. To this end, the key-value pairs stored in the verify log's persistent file can be used to verify the data pages in the memory. The used key-value pairs in the verify log's persistent file are then deleted to free up storage space. This mechanism is called asynchronous advancement.

[0020] In some possible implementations, the version information of the data page also includes a cyclic check code (CRC), and the method further includes: if the LSN in the second version information is equal to the LSN in the first version information, and the CRC in the second version information is not equal to the CRC in the first version information, an alarm is issued so that the user can check the data page to determine whether there is a data error.

[0021] It should be noted that CRC is a commonly used checksum with error detection and correction capabilities. The CRC can be a hash value generated based on the LSN and the data stored in the data page. In other words, if the functions and values stored in two data pages, as well as their LSNs, are identical, then the CRCs of the two data pages are identical.

[0022] In some possible implementations, the obtaining of the key-value pair from the verify log based on the page identifier of the data page includes: obtaining the LSN of the redo point redopoint from the checkpoint checkpoint; determining the key-value pair from the verify log based on the LSN of the redopoint, wherein the LSN of the first version information in the key-value pair is less than the LSN of the redopoint. Then, when a database restart occurs, the version information of the data page can be verified using the key-value pair in the verify log before the redopoint. In the case that the data page is not modified after the redopoint and before the database restart, the version information of the data page in the memory is verified, thereby identifying the data page with data errors and preventing the spread of data errors.

[0023] In some possible implementations, after verifying the second version information based on the first version information, the method further includes: replaying the redo log after the redo point. Then, after a database restart occurs, the data page in the memory can be restored.

[0024] A second aspect of the present application provides a service device, which is used to execute any one of the methods described in the first aspect.

[0025] A third aspect of the present application provides a computer-readable storage medium, which stores instructions. When the computer-readable storage medium is run on a computer, it enables the computer to execute the method provided by the first aspect or any possible implementation of the first aspect.

[0026] A fourth aspect of the present application provides a computer program product, which includes computer-executable instructions, which are stored in a computer-readable storage medium; at least one processor of a device can read the computer-executable instructions from the computer-readable storage medium, and at least one processor executes the computer-executable instructions so that the device implements the method provided by the above-mentioned first aspect or any possible implementation of the first aspect.

[0027] In a fifth aspect, the present application provides a communication device, which may include at least one processor, a memory, and a communication interface. The at least one processor is coupled to the memory and the communication interface. The memory is configured to store instructions, the at least one processor is configured to execute the instructions, and the communication interface is configured to communicate with other communication devices under the control of the at least one processor. When executed by the at least one processor, the instructions cause the at least one processor to perform the method of the first aspect or any possible implementation of the first aspect.

[0028] In a sixth aspect, the present application provides a chip system, which includes a processor for supporting the implementation of the functions involved in the above-mentioned first aspect or any possible implementation method of the first aspect.

[0029] In a possible design, the chip system may further include a memory for storing necessary program instructions and data. The chip system may be composed of a chip or may include a chip and other discrete devices.

[0030] Among them, the technical effects brought about by the second to sixth aspects or any possible implementation methods thereof can refer to the technical effects brought about by the first aspect or different possible implementation methods of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1-1 A schematic diagram of the structure of a data storage system provided in an embodiment of the present application;

[0032] Figure 1-2 This is a schematic diagram of the hardware structure of the service device in the embodiment of the present application;

[0033] Figure 1-3 This is a schematic diagram of a redo log in an embodiment of the present application;

[0034] Figure 1-4 This is another schematic diagram of the redo log in the embodiment of the present application;

[0035] Figure 2-1 A flowchart of a data verification method provided in an embodiment of the present application;

[0036] Figure 2-2 A schematic diagram of generating a verify log in an embodiment of the present application;

[0037] Figure 2-3 This is a schematic diagram of generating a verify hash in an embodiment of the present application;

[0038] Figure 2-4 A schematic diagram of repairing a data page in an embodiment of the present application;

[0039] Figure 3-1 A flowchart of a data verification method provided in an embodiment of the present application;

[0040] Figure 3-2 A schematic diagram of repairing a data page in an embodiment of the present application;

[0041] Figure 4 A schematic diagram of the structure of a service device provided in an embodiment of the present application;

[0042] Figure 5A schematic structural diagram of a communication device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] Embodiments of the present application provide a data verification method and related devices for verifying version information of data pages in a memory.

[0044] The following describes the embodiments of the present application in conjunction with the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present application, rather than all the embodiments. Those skilled in the art will appreciate that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0045] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or that are inherent to these processes, methods, products or devices. The naming or numbering of steps in this application does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The process steps that have been named or numbered can be changed in the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved.

[0046] like Figure 1-1 As shown, a data storage system 100 provided in an embodiment of the present application includes: a user device 110 and a service device 120.

[0047] The user equipment 110 may also be referred to as a terminal device, mobile station (MS), mobile terminal (MT), etc., and is a device that provides voice and / or data connectivity to a user, or a chip within the device, such as a handheld device or vehicle-mounted device with wireless connectivity. Currently, some examples of terminal devices include: mobile phones, desktop computers, tablet computers, laptop computers, PDAs, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, and 5G-residential gateways (5G-RGs) that support 5G access.

[0048] The service device 120 may be a server. A server needs to respond to service requests, process them, and provide reliable services. Therefore, a server should generally be capable of providing and guaranteeing services. It should also possess strong processing capabilities, high stability, high reliability, high security, scalability, and manageability. The server may be an x86 server, also known as a complex instruction set computer (CISC) architecture server, commonly referred to as a personal computer (PC) server. This server is based on the PC architecture and uses Intel or other x86 instruction set-compatible processor chips and the Windows operating system.

[0049] Figure 1-2 FIG. 1 is a schematic diagram of the hardware structure of the service device 120 in the embodiment of the present application. Figure 1-2 As shown, the service device 120 includes at least a transceiver 121 , a memory 122 , a storage 123 , a processor 124 and a bus 125 .

[0050] The processor 124 can be a general-purpose processor, such as but not limited to a central processing unit (CPU), or a special-purpose processor, such as but not limited to a digital signal processor (DSP), an application-specific integrated circuit (ASIC), and a field programmable gate array (FPGA). The processor 124 can also be a neural processing unit (NPU). In addition, the processor 124 can also be a combination of multiple processors. In particular, in the technical solutions provided in the embodiments of the present application, the processor 124 can be used to execute the relevant steps in the subsequent method embodiments.

[0051] The transceiver 121 includes an input / output (I / O) interface for interacting with the user device 110, so that the service device 120 can provide services to the user device 110 through the transceiver. The processor 124 can be used to execute instructions stored in the memory 123 to control the transceiver 121 to receive messages and / or send messages, thereby completing the functions of the service device 120 in the embodiment of the method of the present application.

[0052] The memory 123 can be various types of non-volatile storage devices, such as non-volatile random access memory (NVRAM), a solid-state drive, a mechanical hard drive, etc. The memory 123 is specifically used to store instructions and data, and the processor 124 can perform the steps and / or operations described in the method embodiments of the present application by reading and executing the instructions stored in the memory 123.

[0053] The memory 122 may be various types of volatile storage media, such as random access memory (RAM), read only memory (ROM), etc. The memory 122 is used to cache data, and the storage 123 reads, writes, or modifies data in the memory 122 .

[0054] In some possible implementations, the data storage system 100 may further include a backup service device 300, wherein the backup service device 300 is used to back up data for the service device 120. When the service device 120 fails, the backup service device 300 can replace the service device 120 to interact with the user device 110 and provide services for the user device 110. The hardware structures of the service device 120 and the backup service device 300 may be the same or different, and are not limited here.

[0055] Data pages in a database typically run in memory 122. When a data page running in memory 122 is modified, a new version of the data page is obtained, which can be flushed (i.e., a dirty page is flushed) to storage 123. Each time a data page is modified in memory 122, a new redo log is generated (stored in append-only format), which records the modification to the data page. After the database is restarted, the redo log can be replayed to identify data errors in the database.

[0056] Among them, after the data page in the memory is modified from version information 1 to version information 2, if the data page fails to be flushed from the memory to the storage based on the checkpoint mechanism, the version information of the data page in the memory is version information 2, while the version information of the data page in the storage is still version information 1, that is, there is a data error. Subsequently, if the data page in the memory is modified, a new redo log can be obtained. The new redo log records the change of the version information of the data page in the memory from version information 2 to version information 3. After obtaining the new redo log, if a database restart occurs, the new redo log can be replayed, that is, the version information 1 of the data page must be obtained from the storage and the new redo log is replayed. Since the new redo log requires that the version information 2 of the data page be changed to version information 3, while the version information of the data page in the storage is version information 1, the data error problem of the data page in the storage is discovered, and error processing can be performed.

[0057] For example, Figure 1-3As shown in the figure, redo logs L1, L4, and Ln respectively modify data page P4. When the version information of P4 in memory changes from V7 to V8, it is recorded as redo log L1 and successfully flushed to the memory (based on the checkpoint mechanism). The version information of P4 in memory is V8, and the version information of P4 in memory is also V8. Subsequently, when the version information of P4 in memory changes from V8 to V9, it is recorded as redo log L4, but the flushing to the memory fails (based on the checkpoint mechanism, P4 in memory is still saved). The version information of P4 in memory is V9, but the version information of P4 in memory is V8. Subsequently, when the version information of P4 in memory changes from V9 to V10, it is recorded as redo log Ln, but before it is flushed to the memory, the database restarts. In this case, the version information of P4 in memory is V8, and the memory does not store P4 version information.

[0058] Because the redopoint is after L1 and L4, when the redo log is replayed, Ln is replayed instead of L1 or L4. When replaying Ln, the version information of P4 read from the memory is V8, while Ln records the change of P4 version information from V9 to V10. Since V8 is not equal to V9, a mismatch is determined, indicating a data error, and error processing can be performed.

[0059] However, redo log replay starts from the redo log following the redo point (a redo point is a redo log) and continues until the last redo log before the database restart. If the aforementioned data page flush failure occurs before the redo point, and no redo log exists between the redo point and the database restart to modify the data page, the data error on the data page cannot be identified by replaying the redo logs.

[0060] Continuing with the above example, Figure 1-4 As shown, if P4 is not modified after L4 and the database is restarted, the version information of P4 in memory will remain V8. Since there is no redo log recording the modification of P4 after the redopoint, the version information of P4 will not be verified during redo log playback. Therefore, after the database is restarted, the version information of P4 will still be V8, not V9. This means that the data error problem still exists after the database restart.

[0061] To this end, the present application proposes a data page verification method and related equipment.

[0062] In this application, the first version information is obtained by obtaining the version information of the data page in the memory, and the version information of the data page includes the log sequence number LSN. After the data page in the memory is flushed to the memory, the version information of the data page can be obtained from the memory to obtain the second version information. The second version information is then verified based on the first version information. When the data page is not modified after the redopoint and before the database is restarted, the version information of the data page in the memory is verified, thereby identifying the data page with data errors and preventing the spread of data errors.

[0063] See also Figure 2-1 As shown, a data verification method provided in Example 1 of the present application mainly includes the following steps:

[0064] 201. The service device determines a data page in the memory that is ready to be flushed to the storage.

[0065] A data page is the smallest unit of data stored in a memory. The size of the data stored in a data page can be 4 kilobytes or 16KB, which is not limited here. The memory stores multiple data pages, each of which corresponds to a page identifier, represented by P below. For example, page identifiers P1, P2, ..., Pn represent corresponding data pages respectively. The data stored in a data page can include multiple functions and the values of these functions. For example, the functions in P4 include a, b, and c, where a=3, b=4, and c=5.

[0066] When the memory receives a read / write command, the read / write command may be a read operation, a write operation, or a modification operation on a data page. The memory may return the data page to the memory based on the read / write command so that the read / write command can be executed on the data page in the memory. Exemplarily, if the read / write command is a modification operation on P4, the memory may return P4 to the memory so that P4 is modified in the memory based on the read / write command. For example, if the read / write command is to modify a=3 in P4 to a=4, then the memory may modify a=3 in P4 to a=4. Exemplarily, if the read / write command is a read operation on P4, the memory may return P4 to the memory so that P4 is read in the memory based on the read / write command. In this case, the value of a in P4 in the memory is not changed, that is, the data in P4 is not changed. For example, if the read / write command is to modify a=3 in P4, after executing the read / write command, the value of a in P4 in the memory remains equal to 3.

[0067] Compared to storage, memory has a smaller capacity and generally uses volatile storage media to store data. Therefore, after modifying a data page in memory, the data in the modified data page in memory must be stored in the data page in storage, thereby updating the data in the data page in storage. There are various ways to flush data pages from memory to storage, including cold data elimination and checkpoint mechanisms.

[0068] Among them, if a data page in the memory is executed with read and write commands multiple times within a period of time, the data page is hot data, and hot data has a higher retention priority in the memory. However, if a data page is executed with a read and write command once within a period of time, and no read and write commands are executed for a period of time or for a long time, the data page is cold data, and cold data has a lower retention priority in the memory. Due to the small capacity of the memory, when the available capacity of the memory is less than or equal to a certain amount and affects the performance, in order to free up a certain amount of capacity to accommodate new data, based on the cold data elimination mechanism, the data pages with the lowest retention priority can be flushed to the memory, and then these data pages can be deleted from the memory.

[0069] In addition to the cold data elimination mechanism, when the available memory capacity is not less than or equal to a certain amount, in order to avoid database crashes caused by failures and other reasons, which would result in the complete loss of all data pages in memory, a checkpoint mechanism can also be used to flush data pages in memory to storage. However, these data pages are still retained in memory, thus ensuring data consistency between memory and storage.

[0070] In the embodiment of the present application, refreshing a data page under a checkpoint mechanism is taken as an example for explanation.

[0071] 202. The service device obtains the version information of the data page from the memory to obtain first version information.

[0072] In some possible implementations, the version information of the data page may include a log sequence number (LSN). In some possible implementations, the version information of the data page may include a log sequence number (LSN) and a cyclic redundancy check (CRC).

[0073] The LSN is the redo log number. The LSN is stored in the data page of the memory. When the data page is modified, a new redo log is generated. This new redo log has a unique number, namely a new LSN. This new LSN replaces the LSN stored in the data page of the memory, and the new LSN is stored in the data page of the memory. In some possible implementations, the redo log is written in append form, and the LSN of the redo log is generated sequentially. For example, L4 and L5 are both redo logs, and L5 is generated after L4. If L4 = 1004, then L5 = 1005.

[0074] For example, redo logs L1 and L4 each record modifications to a data page in memory, where L1 = 1001 and L4 = 1004. Therefore, before the modification recorded in L4 is performed on the data page in memory, the LSN stored in the data page in memory is L1 = 1001; after the modification recorded in L4 is performed on the data page in memory, the LSN stored in the data page in memory is L4 = 1004.

[0075] It should be noted that CRC is a commonly used checksum with error detection and correction capabilities. The CRC can be a hash value generated based on the LSN and the data stored in the data page. In other words, if the functions and values stored in two data pages, as well as their LSNs, are identical, then the CRCs of the two data pages are identical.

[0076] For example, when a=3 in memory P4, LSN=L1=1001, then CRC1 can be generated based on LSN=1001 and the data stored in P4 (including a=3); when a=3 in memory P4 is changed to a=4, LSN=L4=1004, then CRC2 can be generated based on LSN=1004 and the data stored in P4 (including a=4). Since L1 is not equal to L4, a=3 is different from a=4, so CRC1 is not equal to CRC2.

[0077] 203. The service device generates a key-value pair based on the page identifier and the first version information of the data page, and records the key-value pair in a verify log.

[0078] Exemplarily, continuing the above example, the key-value pair is P4-V9 (P4 is the key, V9 is the value), where P4 is the page identifier of the data page, V9 is the first version information, and V9 is L4+CRC2.

[0079] In some possible implementations, after the key-value pair is generated, it can first be stored in a verify log buffer pool. The data in the verify log buffer pool is then flushed to a persistent file in an append-write manner. In some possible implementations, the data in the verify log buffer pool can be flushed to a persistent file immediately, periodically, or based on a trigger condition (e.g., insufficient available capacity in the buffer pool). This is not limited here.

[0080] In some possible implementations, the verify log cache pool may be stored in a storage space of a certain capacity allocated in the memory, and the persistent file may also be stored in a storage space of a certain capacity allocated in the memory, which is not limited here.

[0081] In some possible implementations, in the persistent file of the verify log, key-value pairs are stored at the file granularity. When a key-value pair is received, the already used file is first used to store the key-value pair. After the file is fully loaded, the next unused file is used to store other key-value pairs. Exemplarily, the persistent file includes 8 files, each of which is 2 megabytes (MB) in size, namely file 1, file 2, ..., file 8, wherein file 1 and file 2 are already used files, and files 3 to 8 are unused files. When the persistent file receives a key-value pair, if file 1 is already fully loaded and file 2 is not fully loaded, file 2 is used to store the key-value pair. Until file 2 is also fully loaded, file 3 can be used to store new key-value pairs.

[0082] For example, Figure 2-2 As shown, P4 in the memory and the corresponding version information V9 are stored as a key-value pair in the verify log.

[0083] 204. The service device flushes the data page from the memory to the storage.

[0084] For example, if data page P4 in the memory has a value of 3, and the memory receives a read / write command for P4, which instructs to modify a=3 in P4 to a=4, then, based on the cold data elimination mechanism or the checkpoint mechanism, P4 in the memory can be flushed to the memory, and a=3 in P4 in the memory can be modified to a=4.

[0085] For example, if data page P4 in memory has value a = 3, and the memory receives a read or write command for P4, the command is a read operation on a = 3 in P4, and does not modify a = 3 in P4. Based on the cold data elimination mechanism or checkpoint mechanism, P4 in memory can be flushed to the memory, and the value of a in P4 in the memory remains equal to 3.

[0086] In some possible implementations, if based on a cold data elimination mechanism, the data page can be deleted from the memory after being flushed from the memory to the storage; if based on a checkpoint mechanism, the data page can be retained in the memory after being flushed from the memory to the storage.

[0087] It should be noted that the step of flushing the data page from the memory to the storage may succeed or fail. If the step of flushing the data page from the memory to the storage succeeds, the data, LSN, and CRC of the data page in the memory will replace the data, LSN, and CRC of the data page in the storage. If the step of flushing the data page from the memory to the storage fails, the data, LSN, and CRC of the data page in the storage remain unchanged.

[0088] For example, the data in memory P4 includes a=3, whose LSN=L1=1001, and CRC=CRC1; the data in memory P4 includes a=4, whose LSN=L4=1004, and CRC=CRC2. If the step of flushing the data page from the memory to the memory is successful, then the data in memory P4 includes a=4, whose LSN=L4=1004, and CRC=CRC2; if the step of flushing the data page from the memory to the memory fails, then the data in memory P4 includes a=3, whose LSN=L1=1001, and CRC=CRC1.

[0089] In the embodiment of the present application, the version information of the data page of the memory is referred to as second version information.

[0090] When the amount of data stored in the verify log's persistent file reaches a certain level, some data needs to be eliminated to free up storage space for other data. To this end, the key-value pairs stored in the verify log's persistent file can be used to verify the data pages in the memory. The used key-value pairs in the verify log's persistent file are then deleted to free up storage space. This mechanism is called asynchronous advancement.

[0091] The following steps 205-209 are based on the use of the verify log to verify the data page, which is triggered by the asynchronous push mechanism. The asynchronous push mechanism can be executed periodically, or it can be triggered by a condition (for example, when the amount of data stored in the persistent file reaches a certain level), or it can be executed by user action, which is not limited here.

[0092] 205. The service device obtains the verify log.

[0093] In some possible implementations, the stored verify log may be obtained from a persistent file, or the stored verify log may be obtained from a persistent file and a cache pool respectively.

[0094] In some possible implementations, the verify log in the cache pool may be flushed to a persistent file first, and then the stored verify log may be obtained from the persistent file. This is not limited here.

[0095] In some possible implementations, the verification log is obtained at the file granularity, that is, the verification log of a file is first obtained, the data page is verified based on the verification log, and then the verification log of the next file is obtained, and the data page is verified using the verification log of the next file.

[0096] For example, if the persistent file system includes eight files, namely file 1, file 2, ..., file 8, you can first obtain the verify log stored in file 1 and verify the data page based on the verify log of file 1. Then, you can obtain the verify log of file 2 and use it to verify the data page.

[0097] The verify log in a file can store key-value pairs related to multiple different data pages. For example, the verify log in file 1 stores key-value pairs related to P4 and P5, where the key-value pairs related to P4 are P4-V8 (where V8 is L1+CRC1) and P4-V9 (where V9 is L4+CRC2).

[0098] In some possible implementations, all key-value pairs in the verify log may be obtained, and then the key-value pairs related to the data page may be determined based on all key values in the verify log, which is not limited here.

[0099] 206. The service device generates a verify hash corresponding to the data page based on the verify log.

[0100] In an embodiment of the present application, after obtaining the key-value pairs related to the data page, these key-value pairs can be merged to obtain the verify hash corresponding to the data page, where the verify hash is the latest version of the merged key-value pairs and the corresponding page identifier.

[0101] Exemplarily, the key-value pairs related to P4 are P4-V8 (where V8 is L1+CRC1) and P4-V9 (where V9 is L4+CRC2). After merging P4-V8 and P4-V9, since V9 is a newer version than V8 (which can be obtained based on a comparison of L4 and L1, where L4=1004, L1=1001, and since 1004>1001, L4>L1, that is, V9 is a newer version than V8), the verify hash generated based on P4-V8 and P4-V9 is P4-V9.

[0102] As another example, among the key-value pairs in the verify log of file 2, the key-value pair related to P4 is P4-V10 (where V10 is Ln+CRC3), then the verify hash is P4-V10.

[0103] For example, Figure 2-3 As shown, based on each key-value pair in the verify log, verify hash can be generated: P1-V3, P2-V4, P3-V5, P3-V9.

[0104] 207. The service device obtains the second version information of the data page in the memory.

[0105] It should be noted that the second version information is the version information of the data page from the memory. Continuing with the example in step 204, if the step of flushing the data page from the memory to the memory is successful and the data page is not subsequently modified, then the data in P4 of the memory includes a=4, its LSN=L4=1004, and CRC=CRC2, and the second version information is L4+CRC2. If the step of flushing the data page from the memory to the memory fails and the data page is not subsequently modified, then the data in P4 of the memory includes a=3, its LSN=L1=1001, and CRC=CRC1, and the second version information is L1+CRC1.

[0106] 208. The service device verifies the data page based on the verify hash and the second version information.

[0107] Based on the description of step 207, it can be seen that if the data page is successfully flushed from the memory to the storage in step 204 and the data page is not modified afterwards, then the second version information is consistent with the version information in the verify hash; if the data page is unsuccessfully flushed from the memory to the storage in step 204 and the data page is not modified afterwards, then the second version information is inconsistent with the version information in the verify hash, and the version information in the verify hash is newer than the second version information. In addition, if the data page is successfully flushed from the memory to the storage in step 204 and the data page is modified afterwards, then the version information in the verify hash is the old version information, and the second version information is inconsistent with the version information in the verify hash, and the second version information is newer than the version information in the verify hash.

[0108] It can be seen from this that whether the data page is successfully flushed from the memory to the storage in step 204 can be determined by verifying the version information and the second version information in the hash.

[0109] Illustratively, if the LSN in the second version information of the data page is greater than or equal to the LSN in the version information in the verify hash, then the second version information of the data page is newer or consistent with the version information in the verify hash, i.e., the data page was successfully flushed from the memory to the storage in step 204, and the verification succeeds. Conversely, if the LSN in the second version information of the data page is less than the LSN in the version information in the verify hash, then the version information in the verify hash is newer than the second version information of the data page, i.e., the flushing of the data page from the memory to the storage in step 204 failed, and the verification fails.

[0110] If the verify hash is generated based on the key-value pairs related to the data page of a file in the verify log, the version information in the verify hash is not necessarily the correct version information of the data page. Therefore, after the data page is verified through the verify hash, it does not mean that the second version information in the data page is correct. However, if the data page fails to be verified through the verify hash, it means that the second version information in the data page is wrong. In an embodiment of the present application, each file in the verify log can be traversed to verify the data page. If the verify hash obtained in all files passes the verification of the data page, it can be determined that the data page is correct. If the verify hash is generated based on the key-value pairs related to the data page of each file in the verify log, the version information in the verify hash is the correct version information of the data page. Therefore, after the data page is verified through the verify hash, it can be determined that the second version information in the data page is correct.

[0111] 209. The service device deletes the verify log.

[0112] In some possible implementations, after a file in the verify log is used to verify a data page, the file is no longer used. Since the storage space of the verify log's persistent files is limited, the file can be deleted to free up more storage space to accommodate new key-value pairs. For example, if the verify log includes file 1, file 2, ..., file 8, file 1 can be deleted after the data page is verified using file 1, and then file 2 can be deleted after the data page is verified using file 2. Similarly, after all files in the verify log are used to verify the data page, all files in the verify log can be deleted.

[0113] 210. The service device repairs the data page that fails verification.

[0114] In some possible implementations, if the data page fails verification, the data page can be repaired. For example, the data page can be repaired in one of the following three ways:

[0115] Method 1: Obtain the data and version information of the data page from the memory, and based on the data and version information of the data page obtained from the memory, flush it to the data page in the memory to replace the data and version information of the data page in the memory;

[0116] Method 2: Obtain all redo logs related to the data page and modify the data and version information of the data page in the memory based on these redo logs to update the data and version information of the data page in the memory;

[0117] Method 3: Request the data and version information of the data page from the standby machine, and replace the data and version information of the data page in the memory based on the data and version information of the data page obtained from the standby machine.

[0118] For example, Figure 2-4 As shown, the above methods 1 to 3 can be executed in sequence, and method 1 is tried first. If method 1 fails, method 2 is tried. If method 2 fails, method 3 is tried.

[0119] In this application, before refreshing a data page, the version information of the data page in memory is first obtained and a verify log is generated. After refreshing the data page, the version information of the data page in memory is verified using the verify log. This allows timely detection of data page refresh failures, allowing necessary repair operations to be performed, thereby preventing the spread of erroneous data pages.

[0120] For example, in Figure 1-4 In the example shown, after L4, but before P4 in memory is flushed to the memory, the version information of P4 in memory, for example, V9, is obtained based on steps 201-204, and a verify log is generated. If the flushing of P4 in memory to the memory fails, the version information of P4 in memory is V8. Then, a verify hash related to P4 can be generated based on the verify log, and the version information of P4 in the verify hash is V9. During the asynchronous push mechanism of the verify log, the version information of P4 in memory can be verified based on the verify log. Since V9 is a newer version than V8, it is discovered that the version information of P4 in memory is incorrect.

[0121] See also Figure 3-1 As shown, a data verification method provided in the second embodiment of the present application mainly includes the following steps:

[0122] 301. The service device determines a data page in the memory that is ready to be flushed to the storage.

[0123] 302. The service device obtains the version information of the data page from the memory to obtain first version information.

[0124] 303. The service device generates a key-value pair based on the page identifier and the first version information of the data page, and records the key-value pair in a verify log.

[0125] 304. The service device flushes the data of the data page from the memory to the storage.

[0126] Steps 301-304 are the same as steps 201-204 and are not described in detail here.

[0127] Steps 305-311 below describe the use of the verify log to verify data pages based on a database restart. After the database restarts, the data pages in memory are cleared. When a read or write command for a data page is received, the data page is retrieved from storage, placed in memory, and the read or write command is executed in memory.

[0128] 305. The service device determines the redopoint from the checkpoint.

[0129] It should be noted that when a checkpoint operation is executed, a redo log recording the checkpoint operation is generated. The redo log has a corresponding LSN, and the redo log recording the checkpoint operation is called a checkpoint.

[0130] When the database is restarted due to a failure, crash, etc., the data in the memory will be lost and cannot be flushed to the memory immediately. Therefore, the redo log needs to be replayed so that the modification of the data page can be reflected in the memory. In an embodiment of the present application, before executing the playback of the redo log, it is necessary to verify the data page based on the verify log generated before the redopoint (that is, all key-value pairs whose version information LSN in the verify log is less than the LSN of the redopoint). To this end, it is necessary to first obtain the LSN of the recorded redopoint from the checkpoint to determine the redopoint.

[0131] For example, the checkpoint records the LSN of the redopoint = 1010.

[0132] 306. The service device obtains the verify log before the redopoint.

[0133] In the embodiment of the present application, in order to verify the data page based on the verify log generated before the redopoint, that is, the verify log before the redopoint.

[0134] Exemplarily, all key-value pairs whose version information LSN is less than the redopoint LSN are obtained from the verify log. For example, if the redopoint LSN is 1010, then all key-value pairs whose version information LSN is less than 1010 can be obtained from the verify log. For example, among all key-value pairs whose version information LSN is less than 1010 obtained from the verify log, key-value pairs related to data pages include P4-V8 (where V8 is L1+CRC1) and P4-V9 (where V9 is L4+CRC2).

[0135] 307. The service device generates a verify hash corresponding to the data page based on the verify log.

[0136] In an embodiment of the present application, after obtaining the key-value pairs related to the data page, these key-value pairs can be merged to obtain the verify hash corresponding to the data page, where the verify hash is the latest version of the merged key-value pairs and the corresponding page identifier.

[0137] Exemplarily, the key-value pairs related to P4 are P4-V8 (where V8 is L1+CRC1) and P4-V9 (where V9 is L4+CRC2). After merging P4-V8 and P4-V9, since V9 is a newer version than V8 (which can be obtained based on a comparison of L4 and L1, where L4=1004, L1=1001, and since 1004>1001, L4>L1, that is, V9 is a newer version than V8), the verify hash generated based on P4-V8 and P4-V9 is P4-V9.

[0138] 308. The service device obtains the second version information of the data page in the memory.

[0139] Please refer to step 207, which will not be described in detail here.

[0140] 309. The service device verifies the data page based on the verify hash and the second version information.

[0141] Please refer to step 208, which will not be described in detail here.

[0142] In addition, it should be noted that if the LSN in the version information of the verify hash is equal to the LSN of the data page, but the CRC of the data page is different from the CRC of the version information in the verify hash, it may be due to the modification of the data header in the data page, resulting in the difference in CRC, rather than the difference in the various functions in the data page or the numerical values in each function. Therefore, an alarm message can be sent, and it should not be judged as a verification failure.

[0143] 310. The service device repairs the data page in the memory.

[0144] In some possible implementations, if the data page fails verification, the data page can be repaired. Exemplarily, the data page can be repaired in one of the following two ways:

[0145] Method 1: Obtain all redo logs related to the data page and modify the data and version information of the data page in the memory based on these redo logs to update the data and version information of the data page in the memory;

[0146] Method 2: Request the data and version information of the data page from the standby machine, and replace the data and version information of the data page in the memory based on the data and version information of the data page obtained from the standby machine.

[0147] For example, Figure 3-2 As shown, the above methods 1 to 3 can be executed in sequence, and method 1 is tried first. If method 1 fails, method 2 is tried. If method 2 fails, method 3 is tried.

[0148] 311. The service device replays the redo log in the data page in the memory.

[0149] In the embodiment of the present application, after verifying the data page using the verify log, the redo log after the redopoint can be replayed in the memory until the last redo log before the restart is replayed.

[0150] In this application, before refreshing a data page, the version information of the data page in memory is first obtained and a verify log is generated. After refreshing the data page, the version information of the data page in memory is verified using the verify log. This allows timely detection of data page refresh failures, allowing necessary repair operations to be performed, thereby preventing the spread of erroneous data pages.

[0151] For example, in Figure 1-4In the example shown, after L4, before P4 in memory is flushed to the memory, based on the above steps 301-304, the version information of P4 in memory, for example, V9, is obtained, and a verify log is generated. If the flushing of P4 in memory to the memory fails, and the database restarts due to a failure, resulting in the loss of the data page of P4 in memory, the version information of P4 in memory is V8. Then, the database restart can trigger the use of the verify log to verify the data page, and a verify hash related to P4 can be generated based on the verify log. The version information of P4 in the verify hash is V9. Before executing the playback of the redo log, the version information of P4 in memory can be verified based on the verify log. Since V9 is a newer version than V8, it is found that the version information of P4 in memory is incorrect.

[0152] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0153] In order to better implement the above-mentioned solutions of the embodiments of the present application, relevant devices for implementing the above-mentioned solutions are also provided below.

[0154] See also Figure 4 As shown, a service device 400 provided in an embodiment of the present application may include:

[0155] An acquisition module 401 is configured to acquire version information of a data page in a memory to obtain first version information, wherein the version information of the data page includes a log sequence number (LSN);

[0156] The acquisition module 401 is further configured to acquire the version information of the data page from the memory after the data page in the memory is written to the memory, thereby obtaining the second version information;

[0157] The processing module 402 is configured to verify the second version information based on the first version information.

[0158] In some possible implementations,

[0159] The processing module 402 is further configured to generate a key-value pair based on the page identifier of the data page and the first version information, wherein the key in the key-value pair is the page identifier of the data page, and the value in the key-value pair is the first version information;

[0160] The processing module 402 is further configured to store the key-value pair in a verification log;

[0161] The acquisition module 401 is further configured to acquire the key-value pair from the verify log based on the page identifier of the data page;

[0162] The processing module 402 is further configured to determine the first version information based on the key-value pair.

[0163] In some possible implementations, the obtaining module 401 is specifically configured to:

[0164] Acquire, from the verify log, a plurality of key-value pairs with the page identifier of the data page as a key;

[0165] The processing module is specifically used to:

[0166] The values of the multiple key-value pairs are merged to determine the first version information with the latest version information.

[0167] In some possible implementations, the processing module 402 is specifically configured to:

[0168] If the LSN in the second version information is greater than or equal to the LSN in the first version information, the verification passes;

[0169] If the LSN in the second version information is smaller than the LSN in the first version information, the verification fails.

[0170] In some possible implementations, the processing module 402 is further configured to:

[0171] If the verification fails, repairing the version information of the data page in the memory;

[0172] The processing module is specifically used to:

[0173] replacing the version information of the data page in the storage based on the version information of the data page in the memory; or,

[0174] Based on the redo log related to the data page, update the version information of the data page in the memory; or,

[0175] The version information of the data page is obtained from the standby node to replace the version information of the data page in the memory.

[0176] In some possible implementations, the processing module 402 is further configured to:

[0177] If the verification fails, after verifying the second version information based on the first version information, the method further includes:

[0178] Delete the key-value pair in the verify log.

[0179] In some possible implementations, the version information of the data page also includes a cyclic check code CRC, and the processing module 402 is further used to: if the LSN in the second version information is equal to the LSN in the first version information, and the CRC in the second version information is not equal to the CRC in the first version information, then issue an alarm.

[0180] In some possible implementations, the obtaining module 401 is specifically configured to:

[0181] Get the LSN of the redo point from the checkpoint;

[0182] The key-value pair is determined from the verify log based on the LSN of the redopoint, where the LSN of the first version information in the key-value pair is smaller than the LSN of the redopoint.

[0183] In some possible implementations, the processing module 402 is further configured to: perform playback based on the redo log after the redopoint.

[0184] It should be noted that the information interaction, execution process, etc. between the modules / units of the above-mentioned device are based on the same concept as the method embodiment of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown above in the present application, and no further details will be given here.

[0185] An embodiment of the present application further provides a computer storage medium, wherein the computer storage medium stores a program, and the program executes some or all of the steps recorded in the above method embodiment.

[0186] Next, another communication device provided by the embodiment of the present application is introduced. Figure 5 As shown, the communication device 500 includes:

[0187] Receiver 501, transmitter 502, processor 503 and memory 504. In some embodiments of the present application, the receiver 501, transmitter 502, processor 503 and memory 504 may be connected via a bus or other means, wherein: Figure 5 The bus connection is taken as an example.

[0188] The memory 504 may include a read-only memory and a random access memory, and provides instructions and data to the processor 503. A portion of the memory 504 may also include non-volatile random access memory (NVRAM). The memory 504 stores an operating system and operating instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof. The operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic services and processing hardware-based tasks.

[0189] Processor 503 controls the operation of communication device 500 and may also be referred to as a central processing unit (CPU). In specific applications, the various components of communication device 500 are coupled together via a bus system. In addition to a data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for clarity, all bus systems are referred to as a bus system in the figure.

[0190] The methods disclosed in the above embodiments of the present application can be applied to or implemented by processor 503. Processor 503 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in processor 503. The above processor 503 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The methods, steps, and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software modules can be located in storage media well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory 504 , and the processor 503 reads the information in the memory 504 and completes the steps of the above method in combination with its hardware.

[0191] The receiver 501 can be used to receive input digital or character information and generate signal input related to relevant settings and function control. The transmitter 502 can include a display device such as a display screen. The transmitter 502 can be used to output digital or character information through an external interface.

[0192] In the embodiment of the present application, the processor 503 is used to execute the aforementioned data verification method.

[0193] In another possible design, when the service device 400 or the communication device 500 is a chip, it includes: a processing unit and a communication unit. The processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin, or a circuit. The processing unit may execute computer-executable instructions stored in the storage unit to enable the chip in the terminal to execute the method for sending wireless report information according to any one of the above-mentioned first aspects. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit may also be a storage unit in the terminal located outside the chip, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.

[0194] The processor mentioned in any of the above may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the program of the above method.

[0195] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.

[0196] Through the description of the above embodiments, it is clear to those skilled in the art that the present application can be implemented by means of software plus necessary general-purpose hardware, and of course it can also be implemented by means of dedicated hardware including application-specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be various, such as analog circuits, digital circuits, or dedicated circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0197] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0198] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a server, or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode to another website, a computer, a server, or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium can be a magnetic medium, (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state drive (SSD)).

Claims

1. A data verification method, characterized in that: include: Obtaining version information of a data page in the memory to obtain first version information, wherein the version information of the data page includes a log sequence number (LSN); After the data page in the memory is written to the memory, the version information of the data page is obtained from the memory to obtain second version information; The second version information is verified based on the first version information.

2. The method according to claim 1, characterized in that After obtaining the version information of the data page in the memory and obtaining the first version information, the method further includes: generating a key-value pair based on the page identifier of the data page and the first version information, wherein the key in the key-value pair is the page identifier of the data page, and the value in the key-value pair is the first version information; Storing the key-value pair in a verification log; Before verifying the second version information based on the first version information, the method further includes: Obtaining the key-value pair from the verify log based on the page identifier of the data page; The first version information is determined based on the key-value pair.

3. The method according to claim 2, characterized in that The obtaining the key-value pair from the verify log based on the page identifier of the data page includes: Acquire, from the verify log, a plurality of key-value pairs with the page identifier of the data page as a key; The determining the first version information based on the key-value pair includes: The values of the multiple key-value pairs are merged to determine the first version information with the latest version information.

4. The method according to any one of claims 1 to 3, characterized in that The verifying the second version information based on the first version information includes: If the LSN in the second version information is greater than or equal to the LSN in the first version information, the verification passes; If the LSN in the second version information is smaller than the LSN in the first version information, the verification fails.

5. The method according to claim 4, characterized in that: If the verification fails, repairing the version information of the data page in the memory; Repairing the version information of the data page in the memory includes: Replacing the version information of the data page in the storage based on the version information of the data page in the memory; or, Based on the redo log related to the data page, update the version information of the data page in the memory; or, The version information of the data page is obtained from the standby node to replace the version information of the data page in the memory.

6. The method according to claim 4 or 5, characterized in that If the verification fails, after verifying the second version information based on the first version information, the method further includes: Delete the key-value pair in the verify log.

7. The method according to any one of claims 4 to 6, characterized in that: The version information of the data page also includes a cyclic check code (CRC), and the method further includes: If the LSN in the second version information is equal to the LSN in the first version information, and the CRC in the second version information is not equal to the CRC in the first version information, an alarm is issued.

8. The method according to claim 2 or 3, characterized in that: The obtaining the key-value pair from the verify log based on the page identifier of the data page includes: Get the LSN of the redo point from the checkpoint; The key-value pair is determined from the verify log based on the LSN of the redopoint, where the LSN of the first version information in the key-value pair is smaller than the LSN of the redopoint.

9. The method according to claim 8, characterized in that After verifying the second version information based on the first version information, the method further includes: Replay is performed based on the redo log after the redopoint.

10. A service device, characterized in that: include: An acquisition module is configured to acquire version information of a data page in a memory to obtain first version information, wherein the version information of the data page includes a log sequence number (LSN); The acquisition module is further configured to acquire the version information of the data page from the memory after the data page in the memory is written to the memory, thereby obtaining the second version information; A processing module is configured to verify the second version information based on the first version information.

11. The service device according to claim 10, characterized in that: The processing module is further configured to generate a key-value pair based on the page identifier of the data page and the first version information, wherein the key in the key-value pair is the page identifier of the data page, and the value in the key-value pair is the first version information; The processing module is further configured to store the key-value pair in a verification log; The acquisition module is further configured to acquire the key-value pair from the verify log based on the page identifier of the data page; The processing module is further configured to determine the first version information based on the key-value pair.

12. The service device according to claim 11, characterized in that: The acquisition module is specifically used to: Acquire, from the verify log, a plurality of key-value pairs with the page identifier of the data page as a key; The processing module is specifically used to: The values of the multiple key-value pairs are merged to determine the first version information with the latest version information.

13. The service device according to any one of claims 10 to 12, characterized in that: The processing module is specifically used to: If the LSN in the second version information is greater than or equal to the LSN in the first version information, the verification passes; If the LSN in the second version information is smaller than the LSN in the first version information, the verification fails.

14. The service device according to claim 13, characterized in that: The processing module is further configured to: If the verification fails, repairing the version information of the data page in the memory; The processing module is specifically used to: replacing the version information of the data page in the storage based on the version information of the data page in the memory; or, Based on the redo log related to the data page, update the version information of the data page in the memory; or, The version information of the data page is obtained from the standby node to replace the version information of the data page in the memory.

15. The service device according to claim 13 or 14, characterized in that: The processing module is further configured to: If the verification fails, after verifying the second version information based on the first version information, the method further includes: Delete the key-value pair in the verify log.

16. The service device according to any one of claims 13 to 15, characterized in that: The version information of the data page also includes a cyclic check code (CRC). The processing module is further configured to: If the LSN in the second version information is equal to the LSN in the first version information, and the CRC in the second version information is not equal to the CRC in the first version information, an alarm is issued.

17. The service device according to claim 11 or 12, characterized in that: The acquisition module is specifically used to: Get the LSN of the redo point from the checkpoint; The key-value pair is determined from the verify log based on the LSN of the redopoint, where the LSN of the first version information in the key-value pair is smaller than the LSN of the redopoint.

18. The service device according to claim 17, characterized in that: The processing module is further configured to: Replay is performed based on the redo log after the redopoint.

19. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a program, and the program causes a computer device to execute the method according to any one of claims 1 to 9.

20. A computer program product, characterized in that The computer program product includes computer-executable instructions, which are stored in a computer-readable storage medium; at least one processor of a device reads the computer-executable instructions from the computer-readable storage medium, and the at least one processor executes the computer-executable instructions so that the device performs the method according to any one of claims 1 to 9.

21. A communication device, characterized in that: The communication device includes at least one processor, a memory and a communication interface; the at least one processor coupled to the memory and the communication interface; The memory is used to store instructions, the processor is used to execute the instructions, and the communication interface is used to communicate with other communication devices under the control of the at least one processor; When the instructions are executed by the at least one processor, the at least one processor is caused to perform the method according to any one of claims 1 to 9.

22. A chip system, characterized in that: The chip system includes a processor and a memory, the memory and the processor are interconnected via a line, instructions are stored in the memory, and the processor is used to execute the method according to any one of claims 1 to 9.