Data processing method and database system
By maintaining the mapping relationship between the page version identification and the latest version in the storage system, combining log sequence number and cyclic redundancy verification, the problem of data page version loss in the database is solved, ensuring data consistency and reliability, and preventing erroneous data from spreading.
Patent Information
- Application Number
- CN202410144719.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-31
- Publication Date
- 2025-08-01
AI Technical Summary
In relational databases, the loss of data page version leads to the spread of erroneous data, destroying the reliability of the database. The existing technology can only verify the page version on the backup node during log playback, and cannot be applied on the primary node.
By maintaining the mapping relationship between the page version identification and the latest version in the storage system, recording version information when brushing the page, and performing version verification when reading, using log sequence number and cyclic redundancy verification to ensure the correctness of the page version, and switching between the main and standby machines if necessary.
It realizes timely discovery and prevents the loss of data page versions during the database operation, prevents the spread of erroneous data, and improves the reliability and data consistency of the database.
Smart Images

Figure CN120407273A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database technologies, and particularly relates to a data processing method, a database system, and a device. Background Art
[0002] Data in a relational database is generally stored in an underlying memory (non-volatile storage medium). Since there will be probabilistic failures during the process of persistently writing data to the memory, this may lead to the loss of the data page version, that is, the latest version of the data page is not stored in the underlying memory. When reading the data page from the memory again, an old version of the data will be returned. During the operation of the database, once the data page version is lost, continuing to update based on the incorrect data page will spread the error, resulting in partial data loss and damaging the reliability of the database.
[0003] Therefore, there is an urgent need for a method to verify the version of the data page to ensure the correctness of the data page version. Summary of the Invention
[0004] In a first aspect, this application provides a data processing method. In this method, a controller of a storage system obtains a first read request, where the first read request indicates reading data of a first page, and based on the first read request, obtains a first version identifier and a second version identifier of the first page. Herein, the first version identifier indicates the version of the first page that has been persistently stored in the memory, and the second version identifier indicates the latest version of the first page before the first page is persistently stored in the memory. The controller verifies the first page based on the relationship between the first version identifier and the second version identifier.
[0005] In a possible implementation, the controller can obtain the version of the first page that has been persistently stored in the memory (i.e., the version indicated by the first version identifier). However, when writing the first page to the memory, a write failure may occur. In this case, the version of the first page that has been persistently stored is not the latest version. That is to say, originally, the first page of version A (the latest version) should be written to the memory. However, an error occurred during the write process. At this time, the version of the first page stored in the memory is not version A, but the version before version A (for example, version B). If the data of version B is directly read without version verification, an error will occur. In the embodiments of the present application, the storage system also maintains the latest version of the page before the page is persistently stored in the memory. This latest version is the version that the page should be persistently stored in the memory when there is no error during the write process. Taking the first page as an example, when reading the first page, the controller can first obtain the version of the first page that has been persistently stored in the memory (i.e., the first version identifier), and obtain the latest version of the first page before the first page is persistently stored in the memory (i.e., the second version identifier), and based on the relationship between the first version identifier and the second version identifier. The relationship between the first version identifier and the second version identifier can represent the relationship between the actual stored page version in the current memory and the ideal correct version. Therefore, based on this relationship, the version verification of the first page can be performed. When the actual stored page version in the memory is the ideal correct version, it can be considered that the verification is passed. When the actual stored page version in the memory is not the ideal correct version, it can be considered that the verification fails. Through the above method, the pages in the memory can be accurately verified.
[0006] In a possible implementation, when obtaining the second version identifier, the controller of the storage system can obtain the first version identifier of the first page and obtain the second version identifier corresponding to the first page from the mapping relationship. The mapping relationship includes the correspondence between multiple pages and the latest version of each page before the page is persistently stored in the memory.
[0007] In a possible implementation, when the relationship between the first version identifier and the second version identifier does not meet the preset condition, the controller of the storage system determines that the version verification of the first page fails; when the relationship between the first version identifier and the second version identifier meets the preset condition, the controller determines that the version verification of the first page succeeds.
[0008] In a possible implementation, the controller and the memory correspond to a host, and the storage system further includes a standby machine. When the controller of the storage system determines that the version verification of the first page fails, it switches the host to the standby machine and triggers the standby machine to be switched to the host.
[0009] In order to timely detect the situation of data page version loss during the operation of the database, the present application maintains page version verification information (i.e., the mapping relationship in the embodiments of the present application) in the memory, records the version information when the page is flushed, and verifies the information when the page is read. The response speed is fast. Each flushed page may have an old version problem. Recording and verifying the pages that may have errors can timely detect version errors. In addition, for the detected page version loss, certain measures need to be taken to solve this problem and prevent the spread of incorrect data. Version verification rules are formulated. For operations with failed verification, the process exits and the primary and standby are switched. When a version error is detected, the primary and standby switch is immediately triggered. The node with the incorrect version is no longer used as the primary node, which can prevent the spread of incorrect data.
[0010] In a possible implementation, the first version identifier includes a first log sequence number (LSN), and the second version identifier includes a second log sequence number; when the relationship between the first version identifier and the second version identifier does not meet the preset condition, determining that the version verification of the first page fails includes: when the first log sequence number is different from the second log sequence number, determining that the version verification of the first page fails.
[0011] In a possible implementation, the method further includes: when determining that the version verification of the first page fails, triggering an alarm message and reading the first page in the memory.
[0012] In a possible implementation, the first version identifier includes a first log sequence number and a first cyclic redundancy check (CRC), and the second version identifier includes a second log sequence number and a second cyclic redundancy check; when the relationship between the first version identifier and the second version identifier does not meet the preset condition, determining that the version verification of the first page fails includes: when the first log sequence number is the same as the second log sequence number and the first cyclic redundancy check is different from the second cyclic redundancy check, determining that the version verification of the first page fails.
[0013] The lsn can represent the version of the data body of the page number. When the lsn is the same, the data body of the page number can be the same. In this case, data reading can be performed (because the read data is correct). When the lsn is different, it can be considered that the version of the data body of the page number in the memory is incorrect. In this case, data reading is not performed. In addition, when the lsn is the same, other data such as the data header on the page number may be different. Therefore, it is also possible to determine whether the data of the page number is exactly the same by comparing the crc. When they are different, an alarm can be given, but it does not affect the data reading.
[0014] In a possible implementation, the method further includes: when it is determined that the version verification of the first page is successful, reading the first page in the memory.
[0015] In a possible implementation, the method further includes: when it is determined that the version verification of the first page is successful, deleting the corresponding relationship between the first page and the second version identifier in the mapping relationship.
[0016] In a possible implementation, before obtaining the first read request, the method further includes:
[0017] Before performing the operation of writing the first page of the version corresponding to the second version identifier into the memory, writing the corresponding relationship between the first page and the second version identifier into the mapping relationship.
[0018] In a possible implementation, the first read request includes the page identifier of the first page; the mapping relationship includes the page identifiers of multiple pages and the corresponding relationship of the latest version of each page before the page is persistently stored in the memory.
[0019] In a possible implementation, obtaining the second version identifier corresponding to the first page from the mapping relationship includes:
[0020] Obtaining the second version identifier corresponding to the first page from the mapping relationship stored in the memory.
[0021] In a possible implementation, the method further includes: obtaining a second read request, where the second read request instructs to read the data of the second page; when the mapping relationship does not include the version identifier corresponding to the second page, determining that the version verification of the second page is successful.
[0022] When the mapping relationship does not include the relevant information of the page to be read, it is equivalent to having completed a verification once and the verification is successful, and there is no new version data written later. Then, it can be considered that the version verification of the page is successful. For example, a second read request can be obtained, where the second read request instructs to read the data of the second page; when the mapping relationship does not include the version identifier corresponding to the second page, determining that the version verification of the second page is successful.
[0023] In a second aspect, the present application provides a data processing device, which includes:
[0024] An acquisition module, configured to acquire a first read request, where the first read request indicates reading data of a first page;
[0025] A processing module, configured to acquire a first version identifier and a second version identifier of the first page according to the first read request; wherein, the first version identifier indicates the version of the first page that has been persistently stored in the memory, and the second version identifier indicates the latest version of the first page before the first page is persistently stored in the memory; and perform verification on the first page according to the relationship between the first version identifier and the second version identifier.
[0026] In a possible implementation, the processing module is specifically configured to:
[0027] Acquire the first version identifier of the first page, and acquire the second version identifier corresponding to the first page from a mapping relationship, where the mapping relationship includes a correspondence between multiple pages and the latest version of each page before the page is persistently stored in the memory.
[0028] In a possible implementation, the processing module is specifically configured to:
[0029] When the relationship between the first version identifier and the second version identifier does not meet a preset condition, determine that the version verification of the first page fails;
[0030] When the relationship between the first version identifier and the second version identifier meets the preset condition, determine that the version verification of the first page is successful.
[0031] In a possible implementation, the controller and the memory correspond to a host, and the storage system further includes a standby machine. The processing module is further configured to:
[0032] When it is determined that the version verification of the first page fails, switch the host to the standby machine and trigger the standby machine to switch to the host.
[0033] In a possible implementation, the first version identifier includes a first log sequence number (LSN), and the second version identifier includes a second log sequence number; when the first log sequence number and the second log sequence number are different, the version verification of the first page fails.
[0034] In a possible implementation, the processing module is further configured to:
[0035] When it is determined that the version verification of the first page fails, trigger an alarm message and read the first page in the memory.
[0036] In a possible implementation, the first version identifier includes a first log sequence number and a first cyclic redundancy check (CRC), and the second version identifier includes a second log sequence number and a second cyclic redundancy check; the processing module is specifically configured to:
[0037] When the first log sequence number is the same as the second log sequence number and the first cyclic redundancy check is different from the second cyclic redundancy check, it is determined that the version check of the first page fails.
[0038] In a possible implementation, the processing module is further configured to:
[0039] When it is determined that the version check of the first page is successful, read the first page in the memory.
[0040] In a possible implementation, the processing module is further configured to:
[0041] When it is determined that the version check of the first page is successful, delete the corresponding relationship between the first page and the second version identifier in the mapping relationship.
[0042] In a possible implementation, the processing module is further configured to:
[0043] Before performing the operation of writing the first page of the version corresponding to the second version identifier to the memory, write the corresponding relationship between the first page and the second version identifier into the mapping relationship.
[0044] In a possible implementation, the first read request includes the page identifier of the first page; the mapping relationship includes the page identifiers of multiple pages and the corresponding relationship of the latest version of each page before the page is persistently stored in the memory.
[0045] In a possible implementation, the processing module is specifically configured to:
[0046] Obtain the second version identifier corresponding to the first page from the mapping relationship stored in the memory.
[0047] In a possible implementation, the obtaining module is further configured to obtain a second read request, and the second read request instructs to read the data of the second page;
[0048] The processing module is further configured to:
[0049] When the mapping relationship does not include the version identifier corresponding to the second page, it is determined that the version check of the second page is successful.
[0050] In a third aspect of the present application, a data processing device is provided. The device may include at least one processor, a memory, and a communication interface. The processor is 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 network elements under the control of the processor. When the instructions are executed by the processor, the processor is caused to execute the method in any possible implementation manner of the first aspect.
[0051] In a fourth aspect of the present application, a computer-readable storage medium is provided. The computer-readable storage medium stores a program, and the program causes the processor to execute any one of the data processing methods in the first aspect and its various implementation manners.
[0052] In a fifth aspect of the present application, a computer program product is provided. The computer program product includes computer-executable instructions, and the computer-executable instructions are stored in a computer-readable storage medium; at least one processor of the device can read the computer-executable instructions from the computer-readable storage medium, and the at least one processor executes the computer-executable instructions to cause the device to implement the method provided in the first aspect or any possible implementation manner of the first aspect.
[0053] In a sixth aspect of the present application, a chip system is provided. The chip system includes a processor for supporting the data processing device to implement the functions involved in the first aspect or any possible implementation manner of the first aspect. In a possible design, the chip system may further include a memory, and the memory is used to store the necessary program instructions and data for managing transactions of the device. The chip system may be composed of chips or may include chips and other discrete devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figures 1A to 1D It is a schematic diagram of the application framework of the present application;
[0055] Figure 2A and Figure 2B It is a schematic diagram of the application framework of the present application;
[0056] Figure 3 It is a schematic diagram of the process of the data processing method according to an embodiment of the present application;
[0057] Figure 4 、 Figure 5 and Figure 7 It is a schematic diagram of the process of the data processing method according to an embodiment of the present application;
[0058] Figure 6 It is a schematic diagram of an application example according to an embodiment of the present application;
[0059] Figures 8 to 10 It is a schematic diagram of the structure of the data processing device according to an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0060] The embodiments of the present application will be described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Those of ordinary skill in the art will understand that with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
[0061] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in an order other than that shown or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0062] For ease of understanding, the relevant terms involved in the embodiments of the present application will be introduced below.
[0063] Redo Log: The physical log of the database, also known as XLog in this database product, records the physical modifications of data pages and is used to restore the physical pages after submission.
[0064] Primary Node: The main node of the database, which accepts write requests and generates logs.
[0065] Standby Node: The standby node of the database (i.e., the backup node), which is a copy of the primary node. By receiving logs and performing log replay, it ensures data consistency with the primary node.
[0066] Buffer Pool: A memory buffer in the database used to store recently accessed data blocks to accelerate data access.
[0067] Checkpoint: The checkpoint mechanism, which periodically flushes the cache to disk and records the log position in the database that has been written to disk. When the database system crashes or fails to recover, the database is recovered from this position.
[0068] Flushing Dirty Pages: Writing the dirty pages (pages that have been modified but not yet written back to disk) in memory back to disk to ensure data consistency and durability.
[0069] Log Sequence Number: Each record in the transaction log can be identified by a unique log sequence number (LSN). The LSNs are sorted such that if LSN2 is greater than LSN1, the change described by the log record identified by LSN2 occurred after the change described by the log record LSN1.
[0070] Cyclic Redundancy Check: Cyclic redundancy check (CRC) is a hash function mainly used to detect or verify errors that may occur after data transmission or storage. The generated number is calculated before the data is transmitted or stored and appended to the data, and then the receiver verifies it to determine if the data has changed. Generally, the values of cyclic redundancy checks are 32-bit integers.
[0071] The method provided by the embodiments of this application can be applied to a database system. Figure 1A shows a typical logical architecture of a database system. According to Figure 1A , the database system 100 includes a database 110 and a database management system (DBMS) 130.
[0072] Among them, the database 110 is an organized collection of data stored in a data storage 120, that is, a collection of related data organized, stored, and used according to a specific data model. According to the different data models used to organize the data, the data can be divided into multiple types, such as relational data, graph data, time series data, etc. Relational data is data modeled using the relational model, usually represented as a table, and the rows in the table represent a set of related values of an object or entity. Graph data, simply referred to as "graph", is used to represent the relationships between objects or entities, such as social relationships. Time series data, simply referred to as time series data, is a data column recorded and indexed in chronological order, used to describe the state change information of an object in the time dimension.
[0073] The database management system 130 is the core of the database system and is system software used to organize, store, and maintain data. The client 200 can access the database 110 through the database management system 130, and the database administrator also performs database maintenance work through the database management system. The database management system 130 provides various functions for the client 200 to create, modify, and query the database. Among them, the client 200 can be an application program or a user device. The functions provided by the database management system 130 may include but are not limited to the following: (1) Data definition function: The database management system 130 provides a data definition language (DDL) to define the structure of the database 110. The DDL is used to depict the database framework and can be saved in the data dictionary; (2) Data access function: The database management system 130 provides a data manipulation language (DML) to implement basic access operations on the database 110, such as retrieval, insertion, modification, and deletion; (3) Database operation management function: The database management system 130 provides a data control function to effectively control and manage the operation of the database 110 to ensure the correctness and effectiveness of the data; (4) Database establishment and maintenance function: including functions such as loading of initial database data, database dump, recovery, reorganization, system performance monitoring, and analysis; (5) Database transmission: The database management system provides data transmission processing to achieve communication between the client and the database management system, usually coordinated with the operating system to complete.
[0074] The data storage 120 includes but is not limited to solid state drives (SSDs), disk arrays, cloud storage, or other types of non-transitory computer-readable storage media. Those skilled in the art can understand that a database system may include fewer or more components than those Figure 1A shown in Figure 1A , or may include components different from those Figure 1A shown,
[0075] The database system provided by the embodiments of the present application can be a distributed database system (DDBS). During the transaction processing of the DDBS, in order to implement concurrent control between transactions, a global transaction manager (GTM) is usually used to manage the transactions. The DDBS will be introduced below in combination with Figure 1B and Figure 1C .
[0076] Figure 1B Schematic diagram of a distributed database system adopting a shared-storage architecture, including one or more coordinator nodes (CN), multiple data nodes (DN), and one or more GTMs (such as Figure 1B the first GTM and the second GTM in). The first GTM serves as the primary GTM, and the second GTM is used to back up the data of the first GTM and take over the work of the first GTM when the first GTM fails, which can ensure the high reliability of the DDBS. The CN and the DN communicate through a network channel. In one embodiment, the network channel can be composed of network devices such as switches, routers, and gateways. The CN, the DN, and the GTM jointly implement the functions of the database management system and provide services such as database retrieval, insertion, modification, and deletion for the client. In one embodiment, a database management system is deployed on each of the CN, the DN, and the GTM. The shared data storage stores data that can be shared by multiple DNs, and the DN can perform read and write operations on the data in the data storage through the network channel. The shared data storage can be a shared disk array. The CN, the DN, the first GTM, or the second GTM in the distributed database system can be a physical machine, such as a database server, or a virtual machine (VM) or a container running on abstract hardware resources. In one embodiment, the CN, the DN, the first GTM, or the second GTM is a virtual machine or a container, and the network channel is a virtual switching network, which includes a virtual switch. The database management system deployed in the CN, the DN, the first GTM, or the second GTM is a DBMS instance, and the DBMS instance can be a process or a thread, and these DBMSs cooperate to complete the functions of the database relational system. In another embodiment, the CN, the DN, the first GTM, or the second GTM is a physical machine, and the network channel includes one or more switches, and the switch is a storage area network (SAN) switch, an Ethernet switch, a fiber switch, or other physical switching devices.
[0077] Figure 1C Schematic diagram of a distributed database system adopting a shared-nothing architecture. Each DN has its own exclusive hardware resources (such as a data storage), an operating system, and a database. The CN, the DN, the first GTM, or the second GTM communicate through a network channel, and the network channel can refer to the above Figure 1BUnderstand the corresponding introductions of the parts. Under this system, data will be allocated to each DN according to the database model and application characteristics. The query tasks will be split into several parts by the CN and executed in parallel on all DNs, collaborating with each other for computing, and providing database services as a whole. All communication functions are implemented on a high-bandwidth network interconnection system. Just like Figure 1B the distributed database system with the shared-storage architecture described, the CN, DN, the first GTM or the second GTM here can be either a physical machine or a virtual machine.
[0078] In all embodiments of the present application, the data storage of the database system includes but is not limited to solid state drives (SSDs), disk arrays, or other types of non-transitory computer-readable media. Figures 1B - 1C Although the database is not shown in Figures 1A - 1C it should be understood that the database is stored in the data storage. Those skilled in the art can understand that a database system may include fewer or more components than Figures 1A - 1C the components shown in Figures 1A - 1C or include components different from those shown in
[0079] Only the components more relevant to the implementation disclosed in the embodiments of the present application are shown. However, those skilled in the art can understand that a distributed database system can include any number of CNs and DNs. The database management system functions of each CN and DN can be respectively implemented by an appropriate combination of software, hardware, and / or firmware running on each CN and DN.
[0079] The above Figure 1B and Figure 1C described distributed database system includes multiple DNs and multiple CNs. Among them, the functions of each DN are basically the same, and the functions of each CN are also basically the same.
[0080] Figure 1D shows an application data management system provided by an embodiment of the present application. Specifically, as shown, the data node cluster may include multiple data nodes DN. Application developers can deploy the relevant data of the developed application in the corresponding data node DN. The application can send a service request to the application server, and the application server can convert the service request into a data operation request; the application server can send the data operation request to the distributed database system. Then, one or more data nodes DN in the distributed database system execute the operation corresponding to the operation request on the data in the database storage. Specifically, the application server can send the data operation request to the coordinator node in the coordinator node cluster, and the coordinator node then forwards the operation request to the relevant DN, and the relevant DN executes the data operation corresponding to the operation request.
[0081] Refer to Figure 2A , Figure 2A , which is a system architecture diagram of an embodiment of the present application: it includes one or more coordination nodes (CNs) and multiple data nodes (DNs), where the CN receives an SQL statement with a subquery sent by a user, generates an execution plan for predicate pushdown according to the distribution information of the parent query and the subquery in the query statement, and sends the plan to the data node DN. On the DN, for the subquery, when scanning the base table data, a predicate condition filtering operation will be synchronously performed, and only the data that meets the predicate conditions will be passed to the upper-layer operator. The same applies to the parent query. Finally, the DN returns the data to the Gather operator of the CN, and the CN returns the result to the user after receiving the data.
[0082] Refer to Figure 2B , Figure 2B , which is a system architecture diagram of an embodiment of the present application: The present application can be program code included in a distributed database and deployed on a server. Taking the application scenario shown in Figure 2B as an example, the program code of the present application exists inside the database parser, optimizer, and executor of the coordination node CN and the data node DN of the distributed database. The base table data is stored on different DNs through a distribution algorithm according to the distribution key of the base table. As shown in Figure 2B , the user sends an SQL statement with a subquery on the CN. The CN is responsible for parsing and checking the user input statement and generating an execution plan, connecting to the DN through a network, sending data and instructions to the DN, and finally summarizing the statistical information of the DN. The DN is responsible for the specific execution process of the execution plan. Except for different stored data, each DN has no difference in architecture and supports various different data distribution methods. The CN can be selected through an election algorithm or can adopt an architecture different from that of the DN. According to the specific deployment situation of the distributed database, there can be multiple CNs. Each module of the database is equally deployed on the CN and each DN, and the role assumed by the node in the distributed database is set through a configuration file.
[0083] Data in a relational database is generally stored in a bottom-layer memory (non-volatile storage medium). Since there will be a probabilistic failure during the process of persistently writing data to the memory, it will cause the loss of the data page version, that is, the latest version of the data page is not stored in the bottom-layer memory, and an old version of the data will be returned when reading the data page from the memory again. During the operation of the database, once the data page version is lost, continuing to update based on the incorrect data page will spread the error data, resulting in partial data loss and destroying the reliability of the database.
[0084] Therefore, a method for verifying the version of the data page is needed to ensure the correct version of the data page.
[0085] To solve the problem of page version loss during the operation of the database, in the prior art, LSN records of pages are added to the redo log, and when log replay is performed on the standby node, it is checked whether the log and the LSN of the page generating the log match; although this method can detect incorrect data page versions during log replay, there are still deficiencies: during the normal operation of the database, only the standby node has replay operations, so it can only check the page versions on the standby node and is not applicable to the primary node. Moreover, the logs on the standby machine are generated by the primary machine and synchronized to the standby machine. Therefore, when an error is found on the standby machine, it means that the logs generated on the primary machine have exceeded the faulty log, that is, incorrect data may have been generated for the user on the primary machine.
[0086] Refer to Figure 2A , Figure 2A is a diagram of an application scenario of this application. As Figure 2A shown, during the normal operation of the database, the data pages generated will first be cached in the Buffer Pool and will only be actually written into the memory for persistence in the scenarios of checkpoint advancement or when the bufferpool is full and pages are swapped in and out. Each data page has its fixed number. When reading data, an attempt will first be made to obtain the page in the Buffer Pool, and if it does not exist, it will be obtained from the storage system.
[0087] It includes software modules: the data page flushing and reading module. Among them, the newly added module (or the module that optimizes the existing model) in this application can implement: the version information collection mechanism during page flushing and the version verification mechanism during page reading;
[0088] It includes hardware modules: memory and underlying storage. Among them, the newly added module (or the module that optimizes the existing model) in this application can implement: the maintenance of the page version information mapping table in the memory structure;
[0089] Among them, their functions are as follows: the version information of the data page is collected in the page flushing module, the version verification mechanism of the data page is implemented in the page reading module, and the collected page version information is cached in the page version information mapping table;
[0090] The logical relationship between software and hardware is as follows: before the database node writes the data page from the buffer pool to the storage device, it is necessary to first record the corresponding relationship between the page identifier of the flushed page and its version information in the page version information mapping table. When obtaining the data page from the storage system, the page version will be verified according to the page version information mapping table, and only after the verification passes can the operation continue.
[0091] Refer to Figure 2B, Figure 2B This is an example diagram of an application scenario of the present application. As Figure 2B shown, the form of the embodiment of the present application can be program code included in the database kernel and can be called and executed by the controller. Taking the Figure 2A application scenario shown as an example, the code corresponding to the embodiment of the present application can exist inside the module for data page flushing and reading. During operation, the code corresponding to the embodiment of the present application runs in the host memory of the server. Figure 2B shows the implementation form of the embodiment of the present application in the server and platform software. The part shown in the dashed box is the newly added module of the embodiment of the present application on the basis of the existing platform software. Inside the data page flushing module, the embodiment of the present application designs a page version information collection module; inside the database page reading module, the embodiment of the present application designs a page version information verification module; in the host memory, the embodiment of the present application allocates a data page version information mapping table buffer.
[0092] The embodiment of the present application provides a data processing method. Referring to Figure 3 , Figure 3 is a flowchart of a data processing method provided by the embodiment of the present application, including:
[0093] 301. Obtain a first read request, where the first read request indicates reading data of a first page.
[0094] Among them, Figure 3 the corresponding embodiment can be applied to a host.
[0095] In a possible implementation, the data of the table corresponding to the database instance of the page is divided into multiple pages, and each page stores data of multiple rows or multiple columns. Operations on the table by the user will be converted into operations on the page. Specifically, the user can access the data in the database (such as read, write, or read and write, etc.), and the controller can generate a read request based on the user's access request. The read request can indicate reading data of the first page, and the read request can include the page identifier of the first page.
[0096] 302. According to the first read request, obtain a first version identifier and a second version identifier of the first page; where the first version identifier indicates the version of the first page that has been persistently stored in the memory, and the second version identifier indicates the latest version of the first page before the first page is persistently stored in the memory;
[0097] When reading data, the page can be first attempted to be obtained in the buffer pool. If it does not exist, it will be obtained from the underlying memory. The data page obtained from the underlying memory needs to verify the correctness of its version.
[0098] In a possible implementation, the controller can obtain the version of the first page that has been persistently stored in the memory (i.e., the version indicated by the first version identifier). However, when writing the first page to the memory, a write failure may occur. In this case, the version of the first page that has been persistently stored is not the latest version. That is to say, the first page of version A (the latest version) should have been written to the memory, but an error occurred during the writing process. At this time, the version of the first page stored in the memory is not version A, but the version before version A (e.g., version B). If the data of version B is directly read without version verification, an error will occur. In the embodiments of the present application, the storage system also maintains the latest version of the page before the page is persistently stored in the memory. This latest version is the version that the page should be persistently stored in the memory when there is no error during the writing process. Taking the first page as an example, when reading the first page, the controller can first obtain the version of the first page that has been persistently stored in the memory (i.e., the first version identifier), and obtain the latest version of the first page before the first page is persistently stored in the memory (i.e., the second version identifier), and perform version verification on the first page according to the relationship between the first version identifier and the second version identifier, and use the result of the version verification to determine whether to perform the read operation on the first page, or perform other operations such as warning. The relationship between the first version identifier and the second version identifier can represent the relationship between the actual page version stored in the current memory and the ideal correct version. Therefore, based on this relationship, the first page can be version-verified. When the actual page version stored in the memory is the ideal correct version, it can be considered that the verification is passed. When the actual page version stored in the memory is not the ideal correct version, it can be considered that the verification fails. Through the above method, the pages in the memory can be accurately verified.
[0099] Among them, the second version identifier can be stored in the mapping relationship, graph information or other information.
[0100] In a possible implementation, the second version identifier corresponding to the first page can be obtained from the mapping relationship. The mapping relationship includes the correspondence between multiple pages and the latest version of each page before the page is persistently stored in the memory.
[0101] Among them, the mapping relationship can be stored in the memory. Furthermore, the second version identifier corresponding to the target page can be obtained from the mapping relationship stored in the memory.
[0102] In a possible implementation, the mapping relationship includes the correspondence between the page identifiers and version identifiers of multiple pages, and the version identifier of the mapping relationship is the latest version of each page before the page is persistently stored in the memory.
[0103] Taking the first page as an example, before performing the operation of writing the first page corresponding to the second version identifier into the memory, the correspondence between the first page (such as the page identifier of the first page) and the second version identifier can be written into the mapping relationship.
[0104] Exemplarily, referring to Figure 4 , during the operation of the database system, a dirty page flushing operation will be performed. For example, there are mainly two scenarios that trigger page flushing: a) The scenario is due to the buffer pool being full and the data pages are swapped in and out, and the cold data pages are written to the disk; b) In the scenario, the checkpoint is advanced regularly, and the data pages are written to the disk, but the pages still exist in the buffer pool. The version information of all flushed pages needs to be collected. For example, if the first page corresponding to the second version identifier is the page to be flushed currently, the version information (that is, the second version identifier) can be collected, and a key-value pair composed of the page identifier of the first page and the version information of the first page is used as a tuple and recorded in the data page version information mapping table maintained in the memory (that is, the mapping relationship in the embodiments of the present application). If the version information of the first page already exists in the table, the tuple will be updated to the latest version record.
[0105] After writing the correspondence between the first page (such as the page identifier of the first page) and the second version identifier into the mapping relationship, the operation of writing the first page into the memory can be performed (the writing operation may succeed or fail).
[0106] 303. Verify the first page according to the relationship between the first version identifier and the second version identifier.
[0107] In a possible implementation, when the relationship between the first version identifier and the second version identifier does not meet the preset condition, it can be determined that the version verification of the first page fails; when the relationship between the first version identifier and the second version identifier meets the preset condition, it can be determined that the version verification of the first page succeeds.
[0108] For example, it can be determined whether the version verification of the first page succeeds or fails by judging whether the first version identifier and the second version identifier are the same.
[0109] Next, first, introduce how to verify the first page according to the relationship between the first version identifier and the second version identifier:
[0110] In a possible implementation, the first version identifier includes a first log sequence number (lsn), and the second version identifier includes a second log sequence number; it can be determined that the version verification of the first page fails when the first log sequence number is different from the second log sequence number.
[0111] In a possible implementation, the first version identifier includes a first log sequence number and a first cyclic redundancy check (crc), and the second version identifier includes a second log sequence number and a second cyclic redundancy check; it can be determined that the version verification of the first page fails when the first log sequence number is the same as the second log sequence number, and the first cyclic redundancy check is different from the second cyclic redundancy check.
[0112] The lsn can represent the version of the data body of the page number. When the lsn is the same, the data body of the page number can be the same. In this case, data reading can be performed (because the read data is correct). When the lsn is different, it can be considered that the version of the data body of the page number in the memory is incorrect. In this case, data reading is not performed. In addition, when the lsn is the same, other data such as data headers on the page number may be different. Therefore, it is also possible to determine whether the data of the page number is exactly the same by comparing the crc. When they are different, an alarm can be given, but it does not affect data reading.
[0113] In a possible implementation, it can be determined that the version verification of the first page is successful when the first version identifier is the same as the second version identifier. When it is determined that the version verification of the first page is successful, the first page in the memory can be read. Optionally, the corresponding relationship between the first page and the second version identifier in the mapping relationship can be deleted.
[0114] Since it has been confirmed that the version verification of the first page is successful, the corresponding relationship between the first page and the second version identifier in the mapping relationship can be deleted, thereby reducing the storage overhead.
[0115] It should be understood that when the mapping relationship does not include information related to the page to be read, it is equivalent to having completed a verification and the verification was successful before, and there is no new version data written afterwards. Then, it can be considered that the version verification of the page is successful. For example, a second read request can be obtained, and the second read request instructs to read the data of the second page; when the mapping relationship does not include the version identifier corresponding to the second page, it is determined that the version verification of the second page is successful.
[0116] Exemplarily, it can be referred toFigure 5 , Figure 5 It is a schematic diagram of the verification process.
[0117] In a possible implementation, the controller and the memory correspond to the host, and the storage system further includes a standby machine. When it is determined that the version verification of the first page fails (for example, it is determined that the lsn is different), the host can be switched to the standby machine, and the standby machine can be triggered to be switched to the host.
[0118] In a possible implementation, when it is determined that the version verification of the first page fails, an alarm message can be triggered, and the first page in the memory can be read (for example, when it is determined that the lsn is the same but the crc is different).
[0119] Referring to Figure 7 , taking the version identifier including lsn and crc as an example, the verification rules are as follows:
[0120] 1) If the lsn of the read page version!= the lsn recorded in the mapping table, the verification fails, the process exits, and the primary and standby are switched;
[0121] 2) If the lsn of the read page version == the lsn recorded in the mapping table, and the page crc!= the crc in the verification information, the verification fails, an alarm is triggered, and the data is read;
[0122] 3) If the lsn of the read page version == the lsn recorded in the mapping table, and the page crc == the crc in the verification information, the verification passes, the mapping table is locked and this record is deleted.
[0123] Among them, "!=" means not equal to, and "==" means equal to.
[0124] Specifically, in order to timely detect the situation of data page version loss during the operation of the database, the present application maintains page version verification information (that is, the mapping relationship in the embodiments of the present application) in the memory, records the version information when the page is flushed, and verifies the information when the page is read. The response speed is fast. Each flushed page may have an old version problem. Recording and verifying the pages that may have errors can timely detect version errors. In addition, for the detected page version loss, certain measures need to be taken to solve this problem and prevent the spread of incorrect data. Version verification rules are formulated. For operations with failed verification, the process exits and the primary and standby are switched. When a version error is found, the primary and standby are immediately switched, and the node with the incorrect version is no longer used as the primary node, which can prevent the spread of incorrect data.
[0125] Referring to Figure 6, for page P4, during a page down flush, the page P4 with version V9 in the buffer pool needs to be flushed to the data file. The correspondence between P4 and V9 (such as the identifier of P4 and the correspondence between the lsn and crc of P4 with version V9) can be recorded in the version mapping table, and the operation of flushing the page P4 with version V9 to the data file is executed. However, an error occurs during the flushing process, resulting in a flushing failure. The version of page P4 in the data file is V8. Before writing page P4 with version V10 to the buffer pool, page P4 in the data file needs to be read, and then page P4 needs to be verified. The version of page P4 in the data file (the lsn and crc of P4 with version V9) and the lsn and crc of page P4 in the mapping table can be obtained. Since the lsn of page P4 in the data file is different from the lsn of page P4 in the mapping table, it can be considered that the verification fails.
[0126] Refer to Figure 8 , Figure 8 is the structural schematic of a data processing device provided by an embodiment of the present application. As Figure 8 shown, a data processing device 800 provided by an embodiment of the present application includes:
[0127] An acquisition module 801, configured to acquire a first read request, where the first read request indicates reading data of a first page;
[0128] Among them, the specific description of the acquisition module 801 can refer to the introduction of step 301 in the above embodiment, which will not be elaborated here.
[0129] A processing module 802, configured to obtain a first version identifier and a second version identifier of the first page according to the first read request; where the first version identifier indicates the version of the first page that has been persistently stored in the memory, and the second version identifier indicates the latest version of the first page before the first page is persistently stored in the memory; verify the first page according to the relationship between the first version identifier and the second version identifier.
[0130] Among them, the specific description of the processing module 802 can refer to the introductions of steps 302 and 303 in the above embodiment, which will not be elaborated here.
[0131] In a possible implementation, the processing module 802 is specifically configured to:
[0132] Obtain the first version identifier of the first page, and obtain the second version identifier corresponding to the first page from the mapping relationship, where the mapping relationship includes the correspondence between multiple pages and the latest version of each page before the page is persistently stored in the memory.
[0133] In a possible implementation, the processing module 802 is specifically configured to:
[0134] When the relationship between the first version identifier and the second version identifier does not meet the preset condition, determine that the version verification of the first page fails;
[0135] When the relationship between the first version identifier and the second version identifier meets the preset condition, determine that the version verification of the first page is successful.
[0136] In a possible implementation, the controller and the memory correspond to a host, and the storage system further includes a standby machine. The processing module 802 is further configured to:
[0137] When it is determined that the version verification of the first page fails, switch the host to the standby machine and trigger the standby machine to switch to the host.
[0138] In a possible implementation, the first version identifier includes a first log sequence number (lsn), and the second version identifier includes a second log sequence number; when the first log sequence number and the second log sequence number are different, the version verification of the first page fails.
[0139] In a possible implementation, the processing module 802 is further configured to:
[0140] When it is determined that the version verification of the first page fails, trigger an alarm message and read the first page in the memory.
[0141] In a possible implementation, the first version identifier includes a first log sequence number and a first cyclic redundancy check (crc), and the second version identifier includes a second log sequence number and a second cyclic redundancy check; the processing module 802 is specifically configured to:
[0142] When the first log sequence number and the second log sequence number are the same and the first cyclic redundancy check and the second cyclic redundancy check are different, determine that the version verification of the first page fails.
[0143] In a possible implementation, the processing module 802 is further configured to:
[0144] When it is determined that the version verification of the first page is successful, read the first page in the memory.
[0145] In a possible implementation, the processing module 802 is further configured to:
[0146] When it is determined that the version verification of the first page is successful, the corresponding relationship between the first page and the second version identifier in the mapping relationship is deleted.
[0147] In a possible implementation, the processing module 802 is further configured to:
[0148] Before performing the operation of writing the first page of the version corresponding to the second version identifier into the memory, write the corresponding relationship between the first page and the second version identifier into the mapping relationship.
[0149] In a possible implementation, the first read request includes the page identifier of the first page; the mapping relationship includes the page identifiers of multiple pages and the corresponding relationship of the latest version of each page before the page is persistently stored in the memory.
[0150] In a possible implementation, the processing module 802 is specifically configured to:
[0151] Obtain the second version identifier corresponding to the first page from the mapping relationship stored in the memory.
[0152] In a possible implementation, the obtaining module 801 is further configured to obtain a second read request, where the second read request instructs to read the data of the second page;
[0153] The processing module 802 is further configured to:
[0154] When the mapping relationship does not include the version identifier corresponding to the second page, determine that the version verification of the second page is successful.
[0155] Next, a data processing device provided in an embodiment of the present application is introduced. Please refer to Figure 9 , Figure 9 which is a schematic structural diagram of a data processing device provided in an embodiment of the present application. Specifically, the data processing device 900 includes: a receiver 901, a transmitter 902, a processor 903, and a memory 904 (where the number of processors 903 in the data processing device 900 can be one or more, Figure 9 taking one processor as an example), where the processor 903 may include an application processor 9031 and a communication processor 9032. In some embodiments of the present application, the receiver 901, the transmitter 902, the processor 903, and the memory 904 may be connected through a bus or other means.
[0156] The memory 904 may include a read-only memory and a random access memory, and provide instructions and data to the processor 903. A part of the memory 904 may also include a non-volatile random access memory (NVRAM). The memory 904 stores processor and operation instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, where the operation instructions may include various operation instructions for implementing various operations.
[0157] The processor 903 controls the operation of the data processing device. In a specific application, the various components of the data processing device are coupled together through a bus system, where the bus system may include a power bus, a control bus, a status signal bus, etc. in addition to the data bus. However, for the sake of clarity, all kinds of buses are referred to as the bus system in the figure.
[0158] The methods disclosed in the embodiments of the present application described above may be applied to the processor 903 or implemented by the processor 903. The processor 903 may be an integrated circuit chip with signal processing capabilities. In the implementation process, the steps of the above methods may be completed by the integrated logic circuit in hardware or instructions in software form in the processor 903. The above-mentioned processor 903 may be a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, and may further include an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The processor 903 may implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the methods disclosed in combination with the embodiments of the present application may be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 904, and the processor 903 reads the information in the memory 904 and combines its hardware to complete the actions executed by the controller in the above methods.
[0159] The receiver 901 can be used to receive input digital or character information and generate signal inputs related to the relevant settings and function controls of the data processing device. The transmitter 902 can be used to output digital or character information through the first interface; the transmitter 902 can also be used to send instructions to the disk array through the first interface to modify the data in the disk array.
[0160] An embodiment of this application also provides a data processing device. Please refer to Figure 10 , Figure 10 FIG. is a schematic structural diagram of a data processing device provided by an embodiment of this application. The data processing device 1000 may vary greatly due to different configurations or performances, and may include one or more central processing units (CPUs) 1010 (for example, one or more processors) and a memory 1032, and one or more storage media 1030 (for example, one or more mass storage devices) for storing application programs 1042 or data 1044. Among them, the memory 1032 and the storage medium 1030 may be transient storage or persistent storage. The program stored in the storage medium 1030 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the data processing device. Further, the central processing unit 1010 may be configured to communicate with the storage medium 1030 and execute a series of instruction operations in the storage medium 1030 on the data processing device 1000.
[0161] The data processing device 1000 may further include one or more power supplies 1026, one or more wired or wireless network interfaces 1050, and one or more input / output interfaces 1058; or, one or more operating systems 1041, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0162] In an embodiment of this application, the central processing unit 1010 is used to perform the actions executed by the controller in the foregoing embodiment.
[0163] An embodiment of this application also provides a computer program product, which when running on a computer, causes the computer to execute the steps performed by the foregoing data processing device.
[0164] An embodiment of this application also provides a computer-readable storage medium, in which a program for signal processing is stored, and when it runs on a computer, it causes the computer to execute the steps performed by the foregoing data processing device.
[0165] The data processing device, data processing device or terminal device provided by the embodiments of the present application may specifically be a chip, and the chip 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, etc. The processing unit may execute the computer-executable instructions stored in the storage unit to cause the chip in the data processing device to execute the data processing method described in the above embodiments, or to cause the chip in the data processing device to execute the data processing method described in the above embodiments. 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 outside the chip in the radio access device, 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.
[0166] Among them, the processor mentioned anywhere 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 above program.
[0167] In addition, it should be noted that the device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the accompanying drawings of the device embodiments provided in the present application, the connection relationship between the modules indicates that they have a communication connection, which may specifically be implemented as one or more communication buses or signal lines.
[0168] Through the description of the above embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general hardware. Of course, it can also be implemented by dedicated hardware including application-specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. Generally, functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structures for implementing the same function can also be various, such as analog circuits, digital circuits, or dedicated circuits. However, for this application, software program implementation is a better embodiment in more cases. Based on such an understanding, the technical solution of this application, in essence, or the part that makes a contribution to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disc of a computer, and includes several instructions to enable a computer device (which can be a personal computer, a data processing device, or a network device, etc.) to execute the methods described in various embodiments of this application.
[0169] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.
[0170] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this application are generated in whole or in part. The computer can be a general computer, a dedicated 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 data processing device, or a data center to another website, computer, data processing device, or data center in a wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that a computer can store, or a data storage device such as a data processing device or a data center that integrates one or more available media. 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 disk (SSD)).
Claims
1. A data processing method, characterized in that, A controller applied to a storage system, the storage system further including a memory, the method comprising: Obtaining a first read request, the first read request indicating to read data of a first page; According to the first read request, obtaining a first version identifier and a second version identifier of the first page; wherein, the first version identifier indicates the version of the first page that has been persistently stored in the memory, and the second version identifier indicates the latest version of the first page before the first page is persistently stored in the memory; Performing a check on the first page according to the relationship between the first version identifier and the second version identifier.
2. The method according to claim 1, wherein The obtaining the first version identifier and the second version identifier of the first page according to the first read request includes: Obtaining the first version identifier of the first page, and obtaining the second version identifier corresponding to the first page from a mapping relationship, the mapping relationship including a plurality of pages and the corresponding relationship between the latest version of each page before the page is persistently stored in the memory.
3. The method according to claim 1 or 2, characterized in that The performing a check on the first page according to the relationship between the first version identifier and the second version identifier includes: When the relationship between the first version identifier and the second version identifier does not meet a preset condition, determining that the version check of the first page fails; When the relationship between the first version identifier and the second version identifier meets the preset condition, determining that the version check of the first page succeeds.
4. The method according to any one of claims 1 to 3, characterized in that, The controller and the memory correspond to a host, the storage system further including a standby machine, the method further comprising: When it is determined that the version check of the first page fails, switching the host to the standby machine, and triggering the standby machine to switch to the host.
5. The method according to claim 4, characterized in that The first version identifier includes a first log sequence number (LSN), and the second version identifier includes a second log sequence number; the determining that the version check of the first page fails when the relationship between the first version identifier and the second version identifier does not meet a preset condition includes: When the first log sequence number and the second log sequence number are different, determining that the version check of the first page fails.
6. The method according to any one of claims 1 to 5, characterized in that, The method further comprises: When it is determined that the version check of the first page fails, triggering an alarm message, and reading the first page in the memory.
7. The method according to claim 6, wherein The first version identifier includes a first log sequence number and a first cyclic redundancy check (CRC), and the second version identifier includes a second log sequence number and a second cyclic redundancy check; The determining that the version check of the first page fails when the relationship between the first version identifier and the second version identifier does not meet a preset condition includes: When the first log sequence number and the second log sequence number are the same, and the first cyclic redundancy check and the second cyclic redundancy check are different, determining that the version check of the first page fails.
8. The method according to any one of claims 1 to 7, characterized in that, The method further comprises: When it is determined that the version check of the first page succeeds, reading the first page in the memory.
9. The method according to any one of claims 2 to 8, characterized in that, The method further comprises: When it is determined that the version verification of the first page is successful, delete the corresponding relationship between the first page and the second version identifier in the mapping relationship.
10. The method according to any one of claims 2 to 9, characterized in that Before obtaining the first read request, the method further includes: Before performing the operation of writing the first page of the version corresponding to the second version identifier into the memory, write the corresponding relationship between the first page and the second version identifier into the mapping relationship.
11. According to the method described in any one of claims 2 to 10, characterized in that, The first read request includes the page identifier of the first page; the mapping relationship includes the page identifiers of multiple pages and the corresponding relationship of the latest version of each page before the page is persistently stored in the memory.
12. The method according to any one of claims 2 to 11, characterized in that Obtaining the second version identifier corresponding to the first page from the mapping relationship includes: Obtaining the second version identifier corresponding to the first page from the mapping relationship stored in the memory.
13. The method according to any one of claims 2 to 12, characterized in that, The method further includes: Obtaining a second read request, where the second read request instructs to read the data of the second page; When the mapping relationship does not include the version identifier corresponding to the second page, determine that the version verification of the second page is successful.
14. A data processing device, characterized in that, The device includes: An obtaining module, configured to obtain a first read request, where the first read request instructs to read the data of the first page; A processing module, configured to obtain a first version identifier and a second version identifier of the first page according to the first read request; where the first version identifier indicates the version of the first page that has been persistently stored in the memory, and the second version identifier indicates the latest version of the first page before the first page is persistently stored in the memory; and verify the first page according to the relationship between the first version identifier and the second version identifier.
15. The device according to claim 14, characterized in that, The processing module, specifically configured to: Obtain the first version identifier of the first page, and obtain the second version identifier corresponding to the first page from the mapping relationship, where the mapping relationship includes multiple pages and the corresponding relationship of the latest version of each page before the page is persistently stored in the memory.
16. The device according to claim 14 or 15, characterized in that The processing module, specifically configured to: When the relationship between the first version identifier and the second version identifier does not meet a preset condition, determine that the version verification of the first page fails; When the relationship between the first version identifier and the second version identifier meets the preset condition, determine that the version verification of the first page is successful.
17. The device according to any one of claims 14 to 16, characterized in that, The controller and the memory correspond to the host, and the storage system further includes a standby machine. The processing module is further configured to: When it is determined that the version verification of the first page fails, switch the host to the standby machine and trigger the standby machine to switch to the host.
18. The device according to claim 17, wherein, The first version identifier includes a first log sequence number (lsn), and the second version identifier includes a second log sequence number; when the first log sequence number and the second log sequence number are different, the version verification of the first page fails.
19. The device according to any one of claims 14 to 18, characterized in that, The processing module is further configured to: When it is determined that the version verification of the first page fails, trigger an alarm message and read the first page in the memory.
20. The device according to claim 19, wherein The first version identifier includes a first log sequence number and a first cyclic redundancy check (CRC), and the second version identifier includes a second log sequence number and a second cyclic redundancy check; the processing module is specifically configured to: When the first log sequence number is the same as the second log sequence number and the first cyclic redundancy check is different from the second cyclic redundancy check, determine that the version check of the first page fails.
21. The device according to any one of claims 14 to 20, characterized in that The processing module is further configured to: When it is determined that the version check of the first page is successful, read the first page in the memory.
22. The device according to any one of claims 15 to 21, characterized in that, The processing module is further configured to: When it is determined that the version check of the first page is successful, delete the corresponding relationship between the first page and the second version identifier in the mapping relationship.
23. The device according to any one of claims 15 to 22, characterized in that, The processing module is further configured to: Before performing the operation of writing the first page of the version corresponding to the second version identifier into the memory, write the corresponding relationship between the first page and the second version identifier into the mapping relationship.
24. The device according to any one of claims 15 to 23, characterized in that The first read request includes the page identifier of the first page; the mapping relationship includes the page identifiers of multiple pages and the corresponding relationship of the latest version of each page before the page is persistently stored in the memory.
25. The device according to any one of claims 15 to 24, characterized in that The processing module is specifically configured to: Obtain the second version identifier corresponding to the first page from the mapping relationship stored in the memory.
26. The device according to any one of claims 15 to 25, characterized in that The obtaining module is further configured to obtain a second read request, and the second read request instructs to read the data of the second page; The processing module is further configured to: When the version identifier corresponding to the second page is not included in the mapping relationship, determine that the version check of the second page is successful.
27. A computer storage medium, characterized in that, The computer storage medium stores one or more instructions, and when the instructions are executed by one or more computers, the one or more computers are caused to perform the operations of the method according to any one of claims 1 to 13.
28. A computer program product, characterized in that, Including computer-readable instructions, when the computer-readable instructions run on a computer device, the computer device is caused to execute the method according to any one of claims 1 to 13.
29. A system includes at least one processor and at least one memory; the processor and the memory are connected through a communication bus and communicate with each other; The at least one memory is used to store code; The at least one processor is used to execute the code to execute the method according to any one of claims 1 to 13.
30. A chip, characterized in that, Including at least one processing unit and an interface circuit, the interface circuit is used to provide program instructions or data for the at least one processing unit, and the at least one processing unit is used to execute the program instructions to implement the method according to any one of claims 1 to 13.
Citation Information
Cited By
Data processing method and database system
WO2025161389A1