Data processing method and database system
By obtaining and verifying the version identification of the data page in the database storage system, the problem of data page version loss is solved, ensuring data consistency and reliability, and preventing the spread of wrong data.
Patent Information
- Application Number
- PCT/CN2024/117015
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-31
- Filing Date
- 2024-09-05
- Publication Date
- 2025-08-07
AI Technical Summary
In relational databases, the data page version may be lost during persistent writing to memory, causing erroneous data to spread and destroying database reliability.
By obtaining the first version identifier and the second version identifier of the page in the controller of the storage system, the mapping relationship is used to perform version verification to ensure the correctness of the data page version, and switching and alarming of the main and standby machine when the version verification fails.
Accurate verification of data pages in memory is achieved, error data is prevented from spreading, and database reliability and data consistency are improved.
Smart Images

Figure CN2024117015_07082025_PF_FP_ABST
Abstract
Description
A data processing method and database system
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on January 31, 2024, with application number 202410144719.6 and application name “A Data Processing Method and Database System”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] The present application relates to the field of database technology, and in particular to a data processing method, a database system, and a device. Background Art
[0003] Relational database data is typically stored in underlying memory (non-volatile storage media). The process of persisting data to memory can fail occasionally, leading to data page version loss. This means the latest version of a data page isn't stored in the underlying memory, and reading the page from memory again will return an older version. During database operation, if a data page version is lost, continued updates based on the incorrect data page can cause the erroneous data to spread, leading to partial data loss and compromising database reliability.
[0004] Therefore, there is an urgent need for a method for verifying the version of a data page to ensure that the version of the data page is correct.
[0005] Summary of the Invention
[0006] In a first aspect, the present 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 obtains a first version identifier and a second version identifier of the first page based on the first read request. 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.
[0007] In one possible implementation, the controller can obtain the version of the first page that has been persistently stored in the memory (that is, the version indicated by the first version identifier). However, a write failure may occur when writing the first page to the memory. 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. 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 a version before version A (for example, version B). If a version check is not performed and the data of version B is directly read, an error will result. In an embodiment of the present application, the storage system also maintains the latest version of the page before the page is persistently stored in the memory. The 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 (that is, the first version identifier), and obtain the latest version of the first page before the first page is persistently stored in the memory (that is, 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 page version actually stored in the current memory and the ideal correct version. Therefore, based on this relationship, the first page can be version-verified. When the page version actually stored in the memory is the ideal correct version, it can be considered to have passed the verification. When the page version actually stored in the memory is not the ideal correct version, it can be considered to have failed the verification. In the above manner, the pages in the memory can be accurately verified.
[0008] In one 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 a mapping relationship, where the mapping relationship includes multiple pages and the corresponding relationship between the latest version of each page before the page is persistently stored in the memory.
[0009] In one possible implementation, the controller of the storage system determines that the version verification of the first page has failed when the relationship between the first version identifier and the second version identifier does not meet a preset condition; and determines that the version verification of the first page has succeeded when the relationship between the first version identifier and the second version identifier meets the preset condition.
[0010] In one possible implementation, the controller and the memory correspond to a host, and the storage system also includes a backup machine. The controller of the storage system should also switch the host to the backup machine and trigger the backup machine to switch to the host when determining that the version check of the first page fails.
[0011] In order to promptly discover the loss of data page versions during database operation, the present application maintains page version verification information in memory (that is, the mapping relationship in the embodiment of the present application), records version information when the page is refreshed, and verifies information when the page is read. The response speed is fast, and each refreshed page may have an old version problem. By recording and verifying pages that may have errors, version errors can be discovered in a timely manner. In addition, for page version loss that is discovered, certain measures need to be taken to solve this problem, prevent the spread of erroneous data, formulate version verification rules, and for operations that fail verification, the process exits and performs a master-slave switch. When a version error is discovered, the master-slave switch is triggered immediately, and the node with the wrong version is no longer used as the master node, which can prevent the spread of erroneous data.
[0012] In one 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 a preset condition, determining that the version verification of the first page has failed includes: when the first log sequence number and the second log sequence number are different, determining that the version verification of the first page has failed.
[0013] In a possible implementation, the method further includes: triggering an alarm message when it is determined that the version verification of the first page fails, and reading the first page in the memory.
[0014] 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 a preset condition, determining that the version check of the first page has failed 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 has failed.
[0015] The LSN indicates the version of the data body of the page number. When the LSNs are the same, the data body of the page number may be the same. In this case, the data can be read (because the read data is correct). When the LSNs are different, it can be assumed that the version of the data body of the page number in the memory is incorrect. In this case, the data read is not performed. In addition, when the LSNs are the same, other data such as the data header on the page number may be different. Therefore, the CRC can also be compared to determine whether the data of the page number is exactly the same. If they are different, an alarm can be issued, but it does not affect the reading of the data.
[0016] 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.
[0017] 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.
[0018] In a possible implementation, before obtaining the first read request, the method further includes:
[0019] Before executing the operation of writing the first page of the version corresponding to the second version identifier into the memory, the corresponding relationship between the first page and the second version identifier is written into the mapping relationship.
[0020] 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 between the latest version of each of the pages before the page is persistently stored in the memory.
[0021] In a possible implementation, obtaining the second version identifier corresponding to the first page from the mapping relationship includes:
[0022] The second version identifier corresponding to the first page is obtained from the mapping relationship stored in the memory.
[0023] In a possible implementation, the method further includes: obtaining a second read request, the second read request instructing to read data of the second page; and determining that the version verification of the second page is successful when the mapping relationship does not include a version identifier corresponding to the second page.
[0024] When the mapping relationship does not include relevant information of the page to be read, it is equivalent to that a verification has been completed before and the verification is successful, and no new version data is written afterwards, then the version verification of the page can be considered successful. For example, a second read request can be obtained, which indicates reading 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.
[0025] In a second aspect, the present application provides a data processing device, the device comprising:
[0026] An acquisition module, configured to acquire a first read request, where the first read request indicates reading data of a first page;
[0027] A processing module is used to obtain 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 the first page is verified according to the relationship between the first version identifier and the second version identifier.
[0028] In a possible implementation, the processing module is specifically configured to:
[0029] A first version identifier of the first page is obtained, and a second version identifier corresponding to the first page is obtained from a mapping relationship, wherein the mapping relationship includes a correspondence between multiple pages and the latest version of each of the pages before the page is persistently stored in the memory.
[0030] In a possible implementation, the processing module is specifically configured to:
[0031] When the relationship between the first version identifier and the second version identifier does not satisfy a preset condition, determining that the version verification of the first page fails;
[0032] When the relationship between the first version identifier and the second version identifier satisfies the preset condition, it is determined that the version verification of the first page is successful.
[0033] In a possible implementation, the controller and the memory correspond to a host, the storage system further includes a standby machine, and the processing module is further configured to:
[0034] When it is determined that the version verification of the first page fails, the host is switched to a standby machine, and the standby machine is triggered to switch to the host machine.
[0035] 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 check of the first page fails.
[0036] In a possible implementation, the processing module is further configured to:
[0037] When it is determined that the version check of the first page fails, an alarm message is triggered, and the first page in the memory is read.
[0038] 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:
[0039] 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, it is determined that the version check of the first page fails.
[0040] In a possible implementation, the processing module is further configured to:
[0041] When it is determined that the version verification of the first page succeeds, the first page in the memory is read.
[0042] In a possible implementation, the processing module is further configured to:
[0043] 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.
[0044] In a possible implementation, the processing module is further configured to:
[0045] Before executing the operation of writing the first page of the version corresponding to the second version identifier into the memory, the corresponding relationship between the first page and the second version identifier is written into the mapping relationship.
[0046] 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 between the latest version of each of the pages before the page is persistently stored in the memory.
[0047] In a possible implementation, the processing module is specifically configured to:
[0048] The second version identifier corresponding to the first page is obtained from the mapping relationship stored in the memory.
[0049] In a possible implementation, the acquisition module is further configured to acquire a second read request, where the second read request indicates reading data of the second page;
[0050] The processing module is also used to:
[0051] 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.
[0052] 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 configured to store instructions, the processor is configured to execute the instructions, and the communication interface is configured to communicate with other network elements under the control of the processor. When executed by the processor, the instructions cause the processor to perform the method of any possible implementation of the first aspect.
[0053] In a fourth aspect of the present application, a computer-readable storage medium is provided, which stores a program, and the program enables a processor to execute the data processing method of the first aspect and any one of its various implementation methods.
[0054] In a fifth aspect of the present application, a computer program product is provided, which includes computer-executable instructions 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.
[0055] A sixth aspect of the present application provides a chip system, which includes a processor for supporting a data processing device to implement the functions involved in the first aspect or any possible implementation of the first aspect. In one possible design, the chip system may also include a memory for storing program instructions and data necessary for the device to manage transactions. The chip system may be composed of a chip or may include a chip and other discrete devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figures 1A to 1D are schematic diagrams of the application framework of this application;
[0057] Figures 2A and 2B are schematic diagrams of the application framework of this application;
[0058] FIG3 is a flowchart of a data processing method according to an embodiment of the present application;
[0059] FIG4 , FIG5 and FIG7 are flowcharts of a data processing method according to an embodiment of the present application;
[0060] FIG6 is a schematic diagram of an application example of the embodiment of the present application;
[0061] 8 to 10 are schematic diagrams of the structures of the data processing devices according to the embodiments of the present application. DETAILED DESCRIPTION
[0062] 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.
[0063] The terms "first," "second," and the like in the specification and claims of this application and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.
[0064] To facilitate understanding, the following first introduces the relevant terms involved in the embodiments of the present application.
[0065] Redo log: The physical log of the database, also called XLog in this database product, records the physical modifications of data pages. It is used to restore the physical pages after submission.
[0066] Primary node: The primary node of the database, which accepts write requests and generates logs.
[0067] Standby node: The standby node of the database (also known as the backup node), a copy of the primary node, ensures data consistency with the primary node by receiving logs and replaying them.
[0068] Buffer Pool: A memory cache area in the database used to store recently accessed data blocks to speed up data access.
[0069] Checkpoint: A checkpoint mechanism that periodically refreshes the cache to disk and records the log location in the database that has been written to disk. When the database system crashes or fails to recover, the database is restored from this location.
[0070] Flush dirty pages: Write dirty pages in memory (pages that have been modified but not yet written back to disk) back to disk to ensure data consistency and persistence.
[0071] Log sequence number: Each record in the transaction log can be identified by a unique log sequence number (LSN). LSNs are ordered such that if LSN2 is greater than LSN1, the change described by the log record identified by LSN2 occurred after the change described by log record LSN1.
[0072] Cyclic Redundancy Check (CRC): A cyclic redundancy check (CRC) is a hash function used to detect or verify errors in data transmission or storage. A generated number is calculated and appended to the data before transmission or storage. The receiver then verifies whether the data has changed. Typically, the CRC value is a 32-bit integer.
[0073] The method provided in the embodiment of the present application can be applied to a database system. FIG1A shows a typical logical architecture of a database system. According to FIG1A , a database system 100 includes a database 110 and a database management system (DBMS) 130 .
[0074] Among them, the database 110 is an organized data set stored in the data storage 120, that is, a related data set organized, stored and used according to a specific data model. According to the different data models used to organize data, data can be divided into multiple types, such as relational data, graph data, time series data, etc. Relational data is data modeled using a 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, referred to as "graph", is used to represent the relationship between objects or entities, such as social relationships. Time series data, 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.
[0075] The database management system 130 is the core of the database system and is the system software used to organize, store, and maintain data. Clients 200 can access the database 110 through the database management system 130, and database administrators also use the database management system to perform database maintenance. The database management system 130 provides various functions for clients 200, which can be applications or user devices, to create, modify, and query databases. 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. DDL is used to describe 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 that the data is correct and valid; (4) Database establishment and maintenance function, including loading the initial data of the database, dumping, restoring, and reorganizing the database, system performance monitoring, analysis and other functions; (5) Database transmission. The database management system provides transmission of processed data to realize communication between the client and the database management system, which is usually coordinated with the operating system.
[0076] 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 will appreciate that a database system may include fewer or more components than those shown in FIG1A , or may include components different from those shown in FIG1A . FIG1A merely illustrates components that are more relevant to the implementation disclosed in the embodiments of the present invention.
[0077] The database system provided in the embodiments of the present application can be a distributed database system (DDBS). During transaction processing, a DDBS typically employs a global transaction manager (GTM) to manage transactions in order to achieve concurrency control between transactions. The following describes a DDBS with reference to Figures 1B and 1C.
[0078] Figure 1B is a schematic diagram of a distributed database system using a shared-storage architecture, including one or more coordinator nodes (CN), multiple data nodes (DN), and one or more GTMs (such as the first and second GTMs in Figure 1B). The first GTM serves as the master 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, thus ensuring the high reliability of the DDBS. The CN and 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, DN, and GTM jointly implement the functions of the database management system, providing clients with database retrieval, insertion, modification, and deletion services. In one embodiment, a database management system is deployed on each CN, DN, and GTM. The shared data storage stores data that can be shared by multiple DNs, and the DNs 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, DN, first GTM or second GTM in the distributed database system can be a physical machine, such as a database server, or a virtual machine (VM) or container running on abstract hardware resources. In one embodiment, the CN, DN, first GTM or second GTM is a virtual machine or container, and the network channel is a virtual switching network, which includes a virtual switch. The database management system deployed in the CN, DN, first GTM or second GTM is a DBMS instance, which can be a process or a thread. These DBMSs work together to complete the functions of the database relational system. In another embodiment, the CN, DN, first GTM or second GTM is a physical machine, and the network channel includes one or more switches, which are storage area network (SAN) switches, Ethernet switches, fiber switches or other physical switching devices.
[0079] Figure 1C is a schematic diagram of a distributed database system using a shared-nothing architecture. Each DN has its own dedicated hardware resources (such as data storage), operating system, and database. The CN, DN, and first or second GTM communicate via a network channel, which can be understood by referring to the corresponding description of Figure 1B above. In this system, data is distributed to each DN based on the database model and application characteristics. Query tasks are divided into several parts by the CN and executed in parallel on all DNs, collaborating with each other to provide database services as a whole. All communication functions are implemented on a high-bandwidth network interconnection system. Similar to the distributed database system with a shared-storage architecture described in Figure 1B, the CN, DN, first or second GTM can be either physical machines or virtual machines.
[0080] 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-transient computer-readable media. Although the database is not shown in Figures 1B-1C, it should be understood that the database is stored in the data storage. Those skilled in the art will understand that a database system may include fewer or more components than those shown in Figures 1A-1C, or include components different from those shown in Figures 1A-1C, and Figures 1A-1C only show components that are more relevant to the implementation methods disclosed in the embodiments of the present application. However, those skilled in the art will understand that a distributed database system may include any number of CNs and DNs. The database management system functions of each CN and DN may be implemented by an appropriate combination of software, hardware, and / or firmware running on each CN and DN, respectively.
[0081] The distributed database system described in FIG. 1B and FIG. 1C includes multiple DNs and multiple CNs, wherein the function of each DN is substantially the same, and the function of each CN is also substantially the same.
[0082] FIG1D shows an application data management system provided by an embodiment of the present application. Specifically, as shown, a data node cluster may include multiple data node DNs. Application developers may deploy the relevant data of the developed application in the corresponding data node DNs. The application may send a service request to the application server, and the application server may convert the service request into a data operation request; the application server may send the data operation request to the distributed database system. Then, one or more data node DNs in the distributed database system may perform the operation corresponding to the operation request on the data in the database memory. Specifically, the application server may send the data operation request to the coordination node in the coordination node cluster, and the coordination node may forward the operation request to the relevant DN, and the relevant DN may perform the data operation corresponding to the operation request.
[0083] Referring to Figure 2A, Figure 2A is a system architecture diagram of an embodiment of the present application: it includes 1 to multiple coordination nodes (CN) and multiple data nodes (DN), wherein CN receives SQL statements with subqueries sent by users, and generates an execution plan for predicate pushdown based on the distribution information of the parent query and subquery in the query statement. And the plan is sent to the data node DN. On DN, for subqueries, when scanning the base table data, the predicate condition filtering operation will be performed synchronously, and only data that meets the predicate condition will be passed to the upper-level operator. The same applies to the parent query. Finally, DN returns the data to the Gather operator of CN, and CN returns the result to the user after receiving the data.
[0084] Referring to Figure 2B, which is a system architecture diagram of an embodiment of the present application, the present application may be program code contained within a distributed database and deployed on a server. Taking the application scenario shown in Figure 2B as an example, the program code of this application resides within the database parser, optimizer, and executor of the coordinating node CN and data nodes DN of the distributed database. Base table data is stored on different DNs using a distribution algorithm based on the base table's distribution key. As shown in Figure 2B, a user sends an SQL statement with a subquery to the CN. The CN is responsible for parsing and checking the user's input statement, generating an execution plan, and connecting to the DN via the network, sending data and instructions to the DN, and finally aggregating statistical information from the DN. The DN is responsible for the specific execution of the execution plan. Aside from the data they store, the architectures of the DNs are similar and support various data distribution methods. The CN can be selected through an election algorithm or adopt a different architecture from the DN. Depending on the specific deployment of the distributed database, there can be multiple CNs. The various database modules are deployed equally on the CN and each DN, and the roles of the nodes in the distributed database are configured using configuration files.
[0085] Relational database data is typically stored in underlying memory (non-volatile storage media). The process of persisting data to memory can fail occasionally, leading to data page version loss. This means the latest version of a data page isn't stored in the underlying memory, and reading the page from memory again will return an older version. During database operation, if a data page version is lost, continued updates based on the incorrect data page can cause the erroneous data to spread, leading to partial data loss and compromising database reliability.
[0086] Therefore, a method for verifying the version of a data page is provided to ensure that the version of the data page is correct.
[0087] To address the issue of page version loss during database operation, existing techniques add page LSN records to the redo log. When replaying the log on the standby node, the LSN of the log and the page that generated the log are verified to ensure they match. While this method can detect data page version errors during log replay, it still has drawbacks: during normal database operation, replay operations are only performed on the standby node, so it can only verify page versions on the standby node and is not applicable to the primary node. Furthermore, the logs on the standby machine are generated by the primary and synchronized to the standby. Therefore, when an error is detected on the standby machine, it means that the logs generated on the primary have already exceeded the fault log, meaning that the primary may have already generated erroneous data for users.
[0088] Referring to Figure 2A , which illustrates an example application scenario of the present application, during normal database operation, generated data pages are first cached in the Buffer Pool. They are only written to the memory for persistence when a checkpoint is advanced or when the buffer pool is full and swapped in and out. Each data page has a fixed number. When reading data, the server first attempts to retrieve the page from the Buffer Pool. If the page does not exist, the server retrieves it from the storage system.
[0089] It includes software modules: data page refresh and reading modules, wherein the newly added modules in this application (or modules that optimize existing models) can implement: version information collection mechanism when refreshing the page, version verification mechanism when reading the page;
[0090] It includes hardware modules: memory and underlying storage, wherein the newly added modules in this application (or modules that optimize existing models) can realize: maintenance of memory structure page version information mapping table;
[0091] Among them, their functions are as follows: the page refresh module implements the collection of data page version information, the page reading module implements the verification mechanism of data page version information, and the page version information mapping table caches the collected page version information;
[0092] The logical relationship between software and hardware is as follows: Before a database node writes a data page from the buffer pool to the storage device, it must first record the correspondence between the page identifier and its version information in the page version information mapping table. When obtaining a data page from the storage system, the page version will be verified based on the page version information mapping table. Only after the verification passes can the operation continue.
[0093] Referring to Figure 2B, Figure 2B is an example diagram of an application scenario of the present application. As shown in Figure 2B, the form of the embodiment of the present application can be a program code contained in the database kernel, which can be called and executed by the controller. Taking the application scenario shown in Figure 2A as an example, the code corresponding to the embodiment of the present application can exist inside the module for flushing and reading data pages. 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, wherein the part shown in the dotted box is a module newly added to 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.
[0094] The present application provides a data processing method. Referring to FIG. 3 , FIG. 3 is a flow chart of a data processing method provided in the present application, including:
[0095] 301. Obtain a first read request, where the first read request indicates reading data of a first page.
[0096] The embodiment corresponding to FIG3 can be applied to a host.
[0097] In one possible implementation, the data of a table corresponding to a page database instance is divided into multiple pages, each page storing multiple rows or columns of data, and user operations on the table are converted into operations on the pages. Specifically, a user can access data in the database (e.g., read, write, or both), and the controller can generate a read request based on the user's access request. The read request can indicate reading data from a first page, and the read request can include a page identifier for the first page.
[0098] 302. Obtain 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 a version of the first page that has been persistently stored in the memory, and the second version identifier indicates a latest version of the first page before the first page is persistently stored in the memory;
[0099] When reading data, you can first try to obtain the page 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 be verified for version correctness.
[0100] In one possible implementation, the controller can obtain the version of the first page that has been persistently stored in the memory (that is, the version indicated by the first version identifier). However, a write failure may occur when writing the first page to the memory. 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. 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 a version before version A (for example, version B). If a version check is not performed and the data of version B is directly read, an error will result. In an embodiment of the present application, the storage system also maintains the latest version of the page before the page is persistently stored in the memory. The 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 (that is, the first version identifier), and obtain the latest version of the first page before the first page is persistently stored in the memory (that is, the second version identifier), and perform version verification on the first page based on the relationship between the first version identifier and the second version identifier, and use the result of the version verification to determine whether to execute the read for the first page, or perform other operations such as alarms. The relationship between the first version identifier and the second version identifier can represent the relationship between the page version actually stored in the current memory and the ideal correct version. Therefore, based on this relationship, the first page can be version verified. When the page version actually stored in the memory is the ideal correct version, it can be considered to have passed the verification. When the page version actually stored in the memory is not the ideal correct version, it can be considered to have failed the verification. In the above manner, the pages in the memory can be accurately verified.
[0101] The second version identifier may be stored in a mapping relationship, graph information, or other information.
[0102] In a possible implementation, the second version identifier corresponding to the first page may be obtained from a mapping relationship, where the mapping relationship includes a correspondence between multiple pages and the latest version of each of the pages before the pages are persistently stored in the memory.
[0103] The mapping relationship may be stored in a memory, and further, the second version identifier corresponding to the target page may be obtained from the mapping relationship stored in the memory.
[0104] In a possible implementation, the mapping relationship includes a correspondence between page identifiers and version identifiers of multiple pages, and the version identifier of the mapping relationship is the latest version of each of the pages before the pages are persistently stored in the memory.
[0105] Taking the first page as an example, before executing the operation of writing the first page of the version corresponding to the second version identifier into the memory, the correspondence between the first page (for example, the page identifier of the first page) and the second version identifier can be written into the mapping relationship.
[0106] Exemplarily, referring to Figure 4, dirty page flushing operations will be performed during the operation of the database system. For example, there are two main scenarios that will trigger page flushing: a) The scenario is that the data page is swapped in and out because the bufferpool is full, and the cold data page is written to the disk; b) The checkpoint is pushed regularly in the scenario, the data page is written to the disk, but the page still exists in the bufferpool. The version information of all flushed pages needs to be collected. For example, if the first page of the version corresponding to the second version identifier is the page currently to be flushed, the version information (that is, the second version identifier) can be collected, and the key-value pair consisting of the page identifier of the first page and the version information of the first page is recorded as a tuple in the data page version information mapping table maintained in the memory (that is, the mapping relationship in the embodiment 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.
[0107] After the correspondence between the first page (eg, the page identifier of the first page) and the second version identifier is written into the mapping relationship, an operation of writing the first page into the memory may be performed (the writing operation may succeed or fail).
[0108] 303. Verify the first page according to the relationship between the first version identifier and the second version identifier.
[0109] In one possible implementation, when the relationship between the first version identifier and the second version identifier does not meet a preset condition, it can be determined that the version verification of the first page has failed; 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 has succeeded.
[0110] For example, whether the version verification of the first page succeeds or fails may be determined by judging whether the first version identifier and the second version identifier are identical.
[0111] Next, we will first introduce how to verify the first page based on the relationship between the first version identifier and the second version identifier:
[0112] 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, it can be determined that the version check of the first page has failed.
[0113] In one 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 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, it can be determined that the version check of the first page has failed.
[0114] The LSN indicates the version of the data body of the page number. When the LSNs are the same, the data body of the page number may be the same. In this case, the data can be read (because the read data is correct). When the LSNs are different, it can be assumed that the version of the data body of the page number in the memory is incorrect. In this case, the data read is not performed. In addition, when the LSNs are the same, other data such as the data header on the page number may be different. Therefore, the CRC can also be compared to determine whether the data of the page number is exactly the same. If they are different, an alarm can be issued, but it does not affect the reading of the data.
[0115] In one possible implementation, when the first version identifier and the second version identifier are the same, it can be determined that the version verification of the first page is successful. 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.
[0116] 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 storage overhead.
[0117] It should be understood that when the mapping relationship does not include relevant information of the page to be read, it is equivalent to that a verification has been completed before and the verification is successful, and no new version data is written thereafter, then the version verification of the page can be considered successful. For example, a second read request can be obtained, and the second read request indicates to read the data of the second page; when the version identifier corresponding to the second page is not included in the mapping relationship, it is determined that the version verification of the second page is successful.
[0118] For example, reference may be made to FIG5 , which is a schematic diagram of the verification process.
[0119] In one possible implementation, the controller and the memory correspond to a host, and the storage system also includes a backup machine. When it is determined that the version check of the first page fails (for example, it is determined that the LSN is different), the host can be switched to the backup machine, and the backup machine can be triggered to switch to the host.
[0120] In a possible implementation, when it is determined that the version check of the first page fails, an alarm message may be triggered, and the first page in the memory may be read (for example, when it is determined that the LSN is the same but the CRC is different).
[0121] Referring to Figure 7, taking the version identifier including LSN and CRC as an example, the verification rules are as follows:
[0122] 1) The page version LSN read is equal to the LSN recorded in the mapping table. Verification fails, the process exits, and the primary and backup switches.
[0123] 2) The page version LSN read == the LSN recorded in the mapping table, and the page CRC! = the CRC in the verification information. Verification fails, an alarm is issued, and the data is read;
[0124] 3) The read page version LSN == LSN recorded in the mapping table, the page CRC == CRC in the verification information, the verification passes, the mapping table is locked and the record is deleted.
[0125] Among them, “!=” means not equal to, and “==” means equal to.
[0126] Specifically, in order to promptly discover the loss of data page versions during database operation, the present application maintains page version verification information in memory (that is, the mapping relationship in the embodiment of the present application), records version information when the page is refreshed, and verifies information when the page is read. The response speed is fast, and each refreshed page may have an old version problem. By recording and verifying pages that may have errors, version errors can be discovered in a timely manner. In addition, for page version loss that is discovered, certain measures need to be taken to solve this problem, prevent the spread of erroneous data, formulate version verification rules, and for operations that fail verification, the process exits and performs a master-slave switch. After a version error is discovered, the master-slave switch is triggered immediately, and the node with the erroneous version is no longer used as the master node, which can prevent the spread of erroneous data.
[0127] Referring to Figure 6, for page P4, when a page is flushed, page P4 with version V9 in the buffer pool needs to be flushed to the data file. The correspondence between P4 and V9 (for example, 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 page P4 with version V9 to the data file is performed. However, there is an error in the flushing process, resulting in the failure of the flushing. 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 page P4 needs to be verified. The version of page P4 in the data file (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 and the LSN of page P4 in the mapping table are different, it can be considered that the verification has failed.
[0128] 8 , which is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. As shown in FIG8 , a data processing device 800 provided in an embodiment of the present application includes:
[0129] An acquisition module 801 is configured to acquire a first read request, where the first read request indicates reading data of a first page;
[0130] The specific description of the acquisition module 801 can refer to the introduction of step 301 in the above embodiment, which will not be repeated here.
[0131] Processing module 802 is used to obtain 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 verify the first page according to the relationship between the first version identifier and the second version identifier.
[0132] The specific description of the processing module 802 can refer to the introduction of steps 302 and 303 in the above embodiment, which will not be repeated here.
[0133] In a possible implementation, the processing module 802 is specifically configured to:
[0134] Obtain a first version identifier of the first page, and obtain a second version identifier corresponding to the first page from a mapping relationship, wherein the mapping relationship includes a correspondence between multiple pages and the latest version of each of the pages before the pages are persistently stored in the memory.
[0135] In a possible implementation, the processing module 802 is specifically configured to:
[0136] When the relationship between the first version identifier and the second version identifier does not satisfy a preset condition, determining that the version verification of the first page has failed;
[0137] When the relationship between the first version identifier and the second version identifier satisfies the preset condition, it is determined that the version verification of the first page is successful.
[0138] In a possible implementation, the controller and the memory correspond to a host, the storage system further includes a standby machine, and the processing module 802 is further configured to:
[0139] When it is determined that the version verification of the first page fails, the host machine is switched to a standby machine, and the standby machine is triggered to switch to the host machine.
[0140] 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 check of the first page fails.
[0141] In a possible implementation, the processing module 802 is further configured to:
[0142] When it is determined that the version check of the first page fails, an alarm message is triggered, and the first page in the memory is read.
[0143] 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:
[0144] 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, it is determined that the version check of the first page fails.
[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 succeeds, the first page in the memory is read.
[0147] In a possible implementation, the processing module 802 is further configured to:
[0148] 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.
[0149] In a possible implementation, the processing module 802 is further configured to:
[0150] Before executing the operation of writing the first page of the version corresponding to the second version identifier into the memory, the correspondence between the first page and the second version identifier is written into the mapping relationship.
[0151] In a possible implementation, the first read request includes a page identifier of the first page; the mapping relationship includes a correspondence between page identifiers of multiple pages and a latest version of each of the pages before the pages are persistently stored in the memory.
[0152] In a possible implementation, the processing module 802 is specifically configured to:
[0153] The second version identifier corresponding to the first page is obtained from the mapping relationship stored in the memory.
[0154] In a possible implementation, the acquisition module 801 is further configured to acquire a second read request, where the second read request indicates reading data of a second page;
[0155] The processing module 802 is further configured to:
[0156] 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.
[0157] Next, a data processing device provided in an embodiment of the present application is introduced. Please refer to Figure 9, which is a 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 (wherein the number of processors 903 in the data processing device 900 can be one or more, and Figure 9 takes one processor as an example), wherein 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 via a bus or other means.
[0158] The memory 904 may include a read-only memory and a random access memory, and provides instructions and data to the processor 903. A portion of the memory 904 may also include non-volatile random access memory (NVRAM). The memory 904 stores processor and operation instructions, executable modules, or data structures, or subsets or extended sets thereof. The operation instructions may include various operation instructions for implementing various operations.
[0159] Processor 903 controls the operation of the data processing device. In specific applications, the various components of the data processing device 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 types are collectively referred to as a bus system in the figure.
[0160] The methods disclosed in the above embodiments of the present application can be applied to or implemented by the processor 903. The processor 903 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 in the processor 903 or by software instructions. The above processor 903 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and can 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, or discrete hardware components. The processor 903 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. 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 as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium 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 memory 904, and processor 903 reads information from memory 904 and, in conjunction with its hardware, completes the actions performed by the controller in the above method.
[0161] Receiver 901 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the data processing device. Transmitter 902 can be used to output digital or character information through the first interface; transmitter 902 can also be used to send instructions to the disk pack through the first interface to modify the data in the disk pack.
[0162] The present application also provides a data processing device. Please refer to Figure 10, which is a schematic diagram of the structure of the data processing device provided in the present application. The data processing device 1000 may vary significantly due to different configurations or performance, 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) storing application programs 1042 or data 1044. Among them, the memory 1032 and the storage medium 1030 can be temporary storage or permanent storage. The program stored in the storage medium 1030 may include one or more modules (not shown in the figure), each module may include a series of instruction operations in the data processing device. Furthermore, the CPU 1010 can be configured to communicate with the storage medium 1030 to execute a series of instruction operations in the storage medium 1030 on the data processing device 1000.
[0163] The data processing device 1000 may also include one or more power supplies 1026, one or more wired or wireless network interfaces 1050, one or more input and output interfaces 1058; or one or more operating systems 1041, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0164] In the embodiment of the present application, the central processing unit 1010 is used to execute the actions performed by the controller in the above embodiment.
[0165] An embodiment of the present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the steps executed by the aforementioned data processing device.
[0166] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a program for performing signal processing. When the program is run on a computer, the computer executes the steps executed by the aforementioned data processing device.
[0167] The data processing device, data processing device or terminal device provided in the embodiments of the present application can specifically be a chip, and the chip includes: a processing unit and a communication unit. The processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, a pin or a circuit. The processing unit can execute the computer-executable instructions stored in the storage unit to enable the chip in the data processing device to perform the data processing method described in the above embodiment, or to enable the chip in the data processing device to perform the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit can also be a storage unit located outside the chip in the wireless 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.
[0168] The processor mentioned in any of the above places can 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.
[0169] 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.
[0170] 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, a data processing device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0171] 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.
[0172] 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 data processing device 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, computer, data processing device or 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 data processing device, a data center, etc. 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 processing method, characterized in that: A controller applied to a storage system, wherein the storage system further includes a memory, and the method includes: Obtaining a first read request, where the first read request indicates reading data of a first page; Obtaining, according to the first read request, a first version identifier and a second version identifier of the first page; wherein the first version identifier indicates a version of the first page that has been persistently stored in the memory, and the second version identifier indicates a latest version of the first page before the first page is persistently stored in the memory; The first page is verified according to the relationship between the first version identifier and the second version identifier.
2. The method according to claim 1, characterized in that The acquiring, according to the first read request, the first version identifier and the second version identifier of the first page includes: Obtain a first version identifier of the first page, and obtain a second version identifier corresponding to the first page from a mapping relationship, wherein the mapping relationship includes a correspondence between multiple pages and the latest version of each of the pages before the pages are persistently stored in the memory.
3. The method according to claim 1 or 2, characterized in that The verifying 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 satisfy a preset condition, determining that the version verification of the first page has failed; When the relationship between the first version identifier and the second version identifier satisfies the preset condition, it is determined that the version verification of the first page is successful.
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 includes a standby machine, and the method further includes: When it is determined that the version verification of the first page fails, the host machine is switched to a standby machine, and the standby machine is triggered to switch to the host machine.
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; and when the relationship between the first version identifier and the second version identifier does not satisfy a preset condition, determining that the version verification of the first page fails includes: When the first log sequence number and the second log sequence number are different, it is determined that the version verification 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, an alarm message is triggered, and the first page in the memory is read.
7. The method according to claim 6, characterized in that 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 satisfy a preset condition, determining that the version verification of the first page fails 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, it is determined 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 verification of the first page succeeds, the first page in the memory is read.
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, the corresponding relationship between the first page and the second version identifier in the mapping relationship is deleted.
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 executing the operation of writing the first page of the version corresponding to the second version identifier into the memory, the correspondence between the first page and the second version identifier is written into the mapping relationship.
11. The method according to 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 between the latest version of each of the pages before the pages are persistently stored in the memory.
12. The method according to any one of claims 2 to 11, characterized in that: The acquiring the second version identifier corresponding to the first page from the mapping relationship includes: The second version identifier corresponding to the first page is obtained 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 comprises: Obtaining a second read request, where the second read request indicates reading data of a 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.
14. A data processing device, characterized in that: The device comprises: An acquisition module, configured to acquire a first read request, where the first read request indicates reading data of a first page; A processing module is used to obtain 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 the first page is verified 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 is specifically used to: Obtain a first version identifier of the first page, and obtain a second version identifier corresponding to the first page from a mapping relationship, wherein the mapping relationship includes a correspondence between multiple pages and the latest version of each of the pages before the pages are persistently stored in the memory.
16. The device according to claim 14 or 15, characterized in that The processing module is specifically used to: When the relationship between the first version identifier and the second version identifier does not satisfy a preset condition, determining that the version verification of the first page has failed; When the relationship between the first version identifier and the second version identifier satisfies the preset condition, it is determined 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 a host, the storage system further includes a standby machine, and the processing module is further configured to: When it is determined that the version verification of the first page fails, the host machine is switched to a standby machine, and the standby machine is triggered to switch to the host machine.
18. The device according to claim 17, 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; when the first log sequence number and the second log sequence number are different, the version check 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 check of the first page fails, an alarm message is triggered, and the first page in the memory is read.
20. The device according to claim 19, characterized in that 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 and the second log sequence number are the same, and the first cyclic redundancy check and the second cyclic redundancy check are different, it is determined 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 verification of the first page succeeds, the first page in the memory is read.
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 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.
23. The device according to any one of claims 15 to 22, characterized in that The processing module is further configured to: Before executing the operation of writing the first page of the version corresponding to the second version identifier into the memory, the correspondence between the first page and the second version identifier is written 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 between the latest version of each of the pages before the pages are 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 used to: The second version identifier corresponding to the first page is obtained from the mapping relationship stored in the memory.
26. The device according to any one of claims 15 to 25, characterized in that The acquisition module is further configured to acquire a second read request, where the second read request indicates reading data of a second page; The processing module is further configured to: 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.
27. A computer storage medium, characterized in that The computer storage medium stores one or more instructions that, when executed by one or more computers, cause the one or more computers to perform the operations of the method of any one of claims 1 to 13.
28. A computer program product, characterized in that The method comprises computer-readable instructions, which, when executed on a computer device, cause the computer device to execute the method according to any one of claims 1 to 13.
29. A system comprising at least one processor and at least one memory; the processor and the memory are connected via a communication bus and communicate with each other; The at least one memory is used to store code; The at least one processor is configured to execute the code to perform the method according to any one of claims 1 to 13.
30. A chip, characterized in that: The system comprises at least one processing unit and an interface circuit, wherein the interface circuit is used to provide program instructions or data to 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
Patent Citations
Data processing method and database system
CN120407273A
Data synchronization method in distributed system and related equipment
CN112138372A
Page loading method and device, storage medium and electronic equipment
CN115484246A
Data protection method and device, equipment and medium
CN117193643A
Page configuration control method and device, electronic equipment and storage medium
CN117411781A