Data processing method and apparatus based on non-volatile storage space, and related device
By using index identifiers and timestamps to determine the storage state of the target tuple in non-volatile storage space, the efficiency and energy consumption issues of DRAM storage tuple versions are solved, achieving efficient and low-power data processing.
Patent Information
- Application Number
- CN202411767203.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-11-30
AI Technical Summary
In existing technologies, storing tuple versions in DRAM results in low tuple lookup efficiency, high energy consumption, and the risk of data loss, which affects the efficiency of operation execution.
It employs non-volatile storage space, indexes it using index identifiers, determines the storage status of the target tuple using storage address offset and timestamp, and executes data processing instructions.
It improves tuple lookup efficiency and operation execution efficiency, reduces energy consumption, and ensures data persistence and operation accuracy.
Smart Images

Figure CN119718191B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of Internet, in particular to a data processing method and device based on non-volatile storage space and related equipment. BACKGROUND
[0002] The storage engine is a core component responsible for data storage, retrieval and management in a database management system (DBMS). In the DBMS, when storing the read-write data set required for executing a certain transaction through the storage engine, a dynamic random access memory (DRAM) is usually used to store the read-write data set.
[0003] However, the inventors have found in practice that in the process of storing the read-write data set for executing certain transactions through the DRAM, multiple tuple versions of a tuple corresponding to the read-write data set are often stored. Therefore, when there is a tuple update of the tuple by other transactions, a new tuple version will be created based on the existing multiple tuple versions, which means that when there are a large number of tuples in the DRAM, there will be a large number of tuple versions of the large number of tuples. Therefore, when it is necessary to locate and find a certain tuple in a large number of tuple versions of a large number of tuples, a long locating and finding time will be consumed, which will reduce the tuple finding efficiency. In addition, since the DRAM (dynamic random access memory) is a type of memory that uses capacitors to store each bit of data in the read-write data set, i.e., the DRAM needs to use capacitors to save each bit of data in the read-write data set, it is necessary to periodically and frequently consume a large amount of energy (e.g., 24% to 40% of the total energy of the DRAM) for refresh operation to check and supplement the power of the capacitors. In addition, when storing the read-write data set for executing certain transactions through the DRAM, there is also the phenomenon of data loss due to power failure, so when it is necessary to update a tuple for a certain transaction, it is difficult to quickly read the corresponding data set due to data loss, which will affect the operation execution efficiency of the request operation related to the transaction to some extent. SUMMARY
[0004] The embodiments of the present application provide a data processing method, device and related equipment based on non-volatile storage space, which can improve the tuple finding efficiency and operation execution efficiency.
[0005] The embodiments of the present application provide a data processing method based on non-volatile storage space, wherein the non-volatile storage space includes a plurality of tuples, and the plurality of tuples are set to be respectively indexable by an index identifier pre-stored in the non-volatile storage space, and the method comprises:
[0006] obtaining a data processing request, the data processing request carrying a to-be-matched index identifier and one or more data processing instructions;
[0007] finding, in a non-volatile storage space, a target index identifier matching the to-be-matched index identifier;
[0008] in response to finding the target index identifier, determining an index storage address and a storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space, the storage address offset being an offset between the index storage address and a tuple storage address of a target tuple corresponding to the target index identifier;
[0009] determining the tuple storage address through the storage address offset and the index storage address to determine a storage state set of the target tuple, the storage state set including at least one storage state;
[0010] if the storage state set includes multiple storage states, obtaining a storage timestamp corresponding to each of the multiple storage states and an instruction timestamp corresponding to the data processing instruction;
[0011] based on the storage timestamp corresponding to each of the multiple storage states and the instruction timestamp corresponding to the data processing instruction, determining a target storage state corresponding to the target tuple in the multiple storage states, and executing an instruction operation indicated by the data processing instruction on the target tuple in the target storage state.
[0012] Embodiments of the present application provide a data processing device based on a non-volatile storage space. The non-volatile storage space includes a plurality of tuples, and the plurality of tuples are set to be indexed by index identifiers pre-stored in the non-volatile storage space. The device includes:
[0013] a request obtaining module configured to obtain a data processing request, the data processing request carrying a to-be-matched index identifier and one or more data processing instructions;
[0014] an index identifier finding module configured to find, in a non-volatile storage space, a target index identifier matching the to-be-matched index identifier;
[0015] the index identifier finding module is further configured to, in response to finding the target index identifier, determine an index storage address and a storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space, the storage address offset being an offset between the index storage address and a tuple storage address of a target tuple corresponding to the target index identifier;
[0016] a storage state set determining module configured to determine the tuple storage address through the storage address offset and the index storage address to determine a storage state set of the target tuple, the storage state set including at least one storage state;
[0017] a timestamp obtaining module, configured to, if the set of storage states comprises a plurality of storage states, obtain a storage timestamp corresponding to each of the plurality of storage states, and an instruction timestamp corresponding to the data processing instruction;
[0018] an operation executing module, configured to, based on the storage timestamp corresponding to each of the plurality of storage states and the instruction timestamp corresponding to the data processing instruction, determine a target storage state corresponding to the target tuple from the plurality of storage states, and execute the instruction operation indicated by the data processing instruction on the target tuple in the target storage state.
[0019] In an aspect, the embodiment of the present application provides a computer device, comprising a memory and a processor, the memory is connected with the processor, the memory is used for storing a computer program, and the processor is used for calling the computer program, so that the computer device executes the method provided in the above aspect of the embodiment of the present application.
[0020] In an aspect, the embodiment of the present application provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is suitable for being loaded and executed by a processor, so that a computer device with the processor executes the method provided in the above aspect of the embodiment of the present application.
[0021] In an aspect, the embodiment of the present application provides a computer program product, the computer program product comprises a computer program / instruction, the computer program / instruction is stored in a computer readable storage medium, when a processor of a computer device reads the computer program / instruction from the computer readable storage medium, the computer program / instruction is executed by the processor, so that the computer device executes the method provided in the above aspect.
[0022] The computer device related to the embodiments of the present application is deployed with a non-volatile storage space in which data can be persisted for data storage. Specifically, the data persisted in the non-volatile storage space can include a plurality of tuples, and each tuple can be indexed by an index identifier pre-stored in the non-volatile storage space. In this way, when obtaining a data processing request, the computer device can obtain a to-be-matched index identifier and one or more data processing instructions carried in the data processing request. Further, the computer device can search for a target index identifier matching the to-be-matched index identifier in the non-volatile storage space. When the target index identifier matching the to-be-matched index identifier is found, the computer device can quickly determine an index storage address corresponding to the target index identifier and a storage address offset corresponding to the target index identifier in the non-volatile storage space in response to the found target index identifier. It can be understood that the index storage address corresponding to the target index identifier can be used to identify a storage address of the target index identifier that can be indexed in the non-volatile storage space, and the storage address offset is an offset between the index storage address and a tuple storage address of a target tuple corresponding to the target index identifier. It should be understood that the tuple storage address of the target tuple can be used to identify a storage address of a specific storage state (e.g., an initial storage state or an initial version) of the target tuple in the plurality of tuples. This means that when indexing by the pre-stored index identifier in the non-volatile storage space, the embodiments of the present application do not need to perform full-scan on the plurality of tuples in which a large amount of complete tuple data is stored, but directly utilize the byte addressing capability of the non-volatile storage space (e.g., the read is faster than the write), quickly locate the target index identifier matching the currently searched tuple identifier (i.e., the to-be-matched index identifier) by indexing. Further, the embodiments of the present application can quickly determine (i.e., address) the tuple storage address of the target tuple corresponding to the target index identifier by the pre-stored storage address offset corresponding to the target index identifier and the index storage address corresponding to the target index identifier, and then address the tuple storage address of the target tuple to quickly address the specific storage state (here, the specific storage state can be the initial storage state of the target tuple) of the target tuple, and then determine whether there is another storage state of the target tuple by the initial storage address offset in the initial storage state, e.g., if the initial storage address offset in the initial storage state is consistent with the pre-stored storage address offset, it can be determined that the storage state of the target tuple is not single but multiple (e.g., two or more), and then the state set of the multiple storage states can be collectively referred to as a storage state set. Based on this, the embodiments of the present application can ensure the efficiency of tuple searching by the storage address offset corresponding to the stored target index identifier and the index storage address corresponding to the target index identifier.Further, the computer device can acquire a plurality of storage timestamps respectively corresponding to a plurality of storage states, and acquire an instruction timestamp corresponding to the data processing instruction, and then can determine the target storage state of the target tuple in the plurality of storage states through the acquired storage timestamps and instruction timestamps (i.e., to ensure that the transaction corresponding to one or more data storage instructions is normally executed, the storage state in which the tuple data of the target tuple is stored is the latest), so that the target tuple can be executed in the target storage state. The instruction operation indicated by the corresponding data processing instruction, in this way, not only can improve the operation execution efficiency, but also can ensure the accuracy of the operation execution. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0024] Figure 1 is a structural schematic diagram of a network architecture provided by the present application;
[0025] Figure 2 is a data interaction schematic diagram based on NVM architecture provided by the embodiments of the present application;
[0026] Figure 3 is a flow schematic diagram of a data processing method based on non-volatile storage space provided by the present application;
[0027] Figure 4 is a flow schematic diagram of transaction execution through a time axis provided by the embodiments of the present application;
[0028] Figure 5 is a structural schematic diagram of a cyclic double version constituted by two storage states provided by the embodiments of the present application;
[0029] Figure 6 is a scenario schematic diagram of determining a target index set in an index file provided by the embodiments of the present application;
[0030] Figure 7 is a flow schematic diagram of executing a read operation on a target tuple based on a read request provided by the embodiments of the present application;
[0031] Figure 8 is a flow schematic diagram of updating a target tuple based on a write request provided by the embodiments of the present application;
[0032] Figure 9is a flowchart of another data processing method based on non-volatile storage space provided in the present application;
[0033] Figure 10 is a flowchart of another data processing method based on non-volatile storage space provided in the present application;
[0034] Figure 11 is a flowchart of various stages involved in executing a first transaction provided in an embodiment of the present application;
[0035] Figure 12 is a flowchart of creating a cyclic dual version provided in an embodiment of the present application;
[0036] Figure 13 is a scenario diagram of conflict detection in a multi-transaction concurrent execution scenario provided in an embodiment of the present application;
[0037] Figure 14 is a diagram of transaction abort statistics under different read-write ratios provided in an embodiment of the present application;
[0038] Figure 15 is a diagram of transaction abort delay provided in an embodiment of the present application;
[0039] Figure 16 is a diagram of transaction abort delay provided in an embodiment of the present application;
[0040] Figure 17 is a diagram of YCSB scalability provided in an embodiment of the present application;
[0041] Figure 18 is a diagram of transaction throughput of NVCaracal system, Falcon system and AKV system under TPC-C workload provided in an embodiment of the present application;
[0042] Figure 19 is a diagram of transaction abort statistics under different contention provided in an embodiment of the present application;
[0043] Figure 20 is a diagram of TPC-C scalability provided in an embodiment of the present application;
[0044] Figure 21 is a diagram of the impact of different version numbers and different space allocation schemes on YCSB throughput provided in an embodiment of the present application;
[0045] Figure 22 is a structural diagram of a data processing apparatus based on non-volatile storage space provided in an embodiment of the present application;
[0046] Figure 23 is a structural schematic diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0047] The concept of related technical terms involved in the embodiments of the present application will be described below:
[0048] I. Non-volatile memory (NVM) refers to a memory in a certain computer device whose stored data does not disappear after the current is turned off. For ease of understanding, in the embodiments of the present application, the data access space corresponding to the non-volatile memory (i.e. NVM) can be referred to as a non-volatile storage space (i.e. NVM space) having data persistence storage characteristics. Here, persistence storage refers to a storage method in which data is not lost after the computer device is powered off or unexpectedly turned off.
[0049] Among them, the non-volatile storage space (i.e. NVM space) can specifically include an index file for performing identification indexing and a tuple heap for performing data storage. The index file can specifically include a plurality of index sets, and one index set is equivalent to one bucket in the field of data statistics. In addition, it can be understood that the reason why the embodiments of the present application need to create an index file containing a plurality of index sets in the non-volatile storage space (i.e. NVM space) is to quickly realize the indexing and data access of one or more tuples related to a certain transaction through the index file when a certain thread in the computer device executes a certain transaction, so as to avoid full table searching on the entire table file where the tuple heap is located. This means that the embodiments of the present application can improve the efficiency of tuple searching and accessing from the root when indexing through each index set in the index file.
[0050] II. Database storage engine is the core component of the database management system (DBMS) responsible for performing data storage, retrieval and management operations.
[0051] For example, the storage engine used in the embodiments of the present application is a key-value storage engine, which can be specifically an AKV storage engine (Agile Key-Value Storage Engine) deployed in a computer device to adapt to the non-volatile storage space (NVM). That is, in the embodiments of the present application, the data storage used by a thread in the computer device when calling the AKV storage engine for data access is the non-volatile storage, the data access space corresponding to the non-volatile storage is the non-volatile storage space (NVM space), and the data access architecture corresponding to the non-volatile storage space (NVM space) is the NVM architecture. The embodiments of the present application can achieve the efficiency of data storage, retrieval and management based on the storage and access technology of the storage engine of the NVM architecture (hereinafter referred to as the technology) in different application scenarios. The application scenarios can include but are not limited to enterprise database systems, real-time data analysis platforms, cloud computing and big data platforms, high-frequency trading systems, and Internet of Things data management platforms.
[0052] For enterprise database systems, the technology (storage and access technology of the storage engine of the NVM architecture) can be applied to enterprise database systems, especially those that require high performance and high reliability database solutions. It should be understood that the technology aims to significantly improve the storage efficiency and read-write performance of the database through the cyclic double version storage method and the cyclic double version concurrency control method. The storage space corresponding to the NVM architecture is the non-volatile storage space described above.
[0053] For real-time data analysis platforms, fast data reading and processing is a key requirement. Therefore, in the real-time data analysis platform, the cyclic double version storage method and the cyclic double version concurrency control method involved in the technology (storage and access technology of the storage engine of the NVM architecture) can meet the high performance requirements of real-time data analysis. For example, the technology can be applied to real-time data processing in the fields of finance, Internet of Things, intelligent manufacturing, etc., to improve the timeliness of data processing.
[0054] For cloud computing and big data platforms, a large number of data storage and access requests need to be processed. Therefore, when the technology (storage and access technology of the storage engine of the NVM architecture) is applied in the cloud storage and big data processing platform, the cyclic double version storage method and the cyclic double version concurrency control method can provide efficient data storage and access solutions to improve the performance and reliability of the overall system.
[0055] For the high-frequency trading system, the consistency of read-write performance is extremely high. Therefore, the cyclic double version concurrency control method involved in the technology can ensure data consistency while improving the performance of read operations, so the technology can be applied to the high-frequency trading system in the financial field to improve the efficiency of transaction processing.
[0056] For the Internet of Things data management platform, considering that the Internet of Things devices deployed in the Internet of Things management platform will generate a large amount of data, and a large amount of generated data needs to be processed in real time. Therefore, when the technology is applied to the Internet of Things data management platform, efficient data storage and processing capabilities can be provided to meet the high-performance requirements of Internet of Things applications.
[0057] It should be understood that in the embodiments of the present application, for any one tuple stored in the NVM space, there can be multiple versions of the same tuple. A version here can be equivalent to a storage state. In multiple storage states, each storage state corresponds to storage state data, which can be used to describe (i.e., represent) different tuple data stored by the same tuple at different storage timestamps for the corresponding transaction.
[0058] III. Transaction refers to an operation sequence composed of one or more different data processing instructions. The instruction operations in the operation sequence are either all executed or not executed. In the embodiments of the present application, the transaction information obtained by the computer device from the data processing request can be transaction content description information indicating the operation sequence corresponding to the transaction information that the computer device needs to execute. At this time, one or more data processing instructions can be instructions parsed from the corresponding transaction information (i.e., transaction content description information) carried in the data processing request obtained by the computer device. For example, when the data service is the resource transfer service (e.g., transaction transfer service) in the above-mentioned financial field, the transaction information (transaction content description information) involved in the resource transfer service (e.g., transaction transfer service) can be equivalent to an operation sequence composed of a series of instruction operations when a certain amount of virtual resources is transferred from one account (e.g., U1 account) to another account (e.g., U2 account).
[0059] For example, in the embodiment of the present application, the instruction operations specifically include operations (for example, a read operation of reading the account balance of the account U1, a calculation operation of calculating the latest account balance after deducting a certain amount of virtual resources from the account U1, and a write operation of storing the latest account balance of the account U1) for a certain tuple (for example, tuple Y1, where tuple Y1 can be the account balance of the account U1) and operations (for example, a read operation of reading the account balance of the account U2, a calculation operation of calculating the latest account balance after adding a certain amount of virtual resources to the account U2, and a write operation of storing the latest account balance of the account U2) for another tuple (for example, tuple Y2, where tuple Y2 can be the account balance of the account U2).
[0060] Four, the cyclic double version storage means that two versions (i.e. two storage states) can exist for the same tuple, and the tuple data of the tuple is alternately updated and stored on the two versions (i.e. two storage states). This means that after a certain tuple has two versions (i.e. two storage states), the tuple data of the tuple can be alternately updated on the two versions (i.e. two storage states).
[0061] For example, for the two versions, the version data structure corresponding to one version (i.e. the storage state data of one storage state) can be used to store the initial account balance (i.e. initial tuple data, for example, 100 yuan) of tuple Y1 (i.e. the account balance of the account U1) before transferring to the account U2; and the version data structure corresponding to the other version (i.e. the storage state data of the other storage state) can be used to store the target account balance (i.e. target tuple data, for example, 50 yuan) of the tuple Y1 (i.e. the account balance of the account U1) after updating. It should be understood that for any tuple in the tuple heap, the version (i.e. storage state) used to store the initial tuple data (for example, the initial account balance) of the tuple can be collectively referred to as the initial storage state, and the other version (i.e. the other storage state) used to store the target tuple data (for example, the target account balance) of the tuple can be collectively referred to as the update storage state.
[0062] It can be understood that by using the cyclic double version to store the metadata of the tuple, the present application embodiment does not need to store the update record for the tuple in the storage log, and for a certain tuple, once the two tuple storage spaces for storing the two versions are allocated in the NVM, the version addresses of the two versions can be quickly obtained. It should be understood that the present application embodiment can accurately address the two versions of the tuple stored in the tuple heap through the version addresses of the two versions of the tuple (i.e. the storage addresses of the tuple in the two storage states).
[0063] In the embodiment, one version (i.e., one storage state) corresponds to one tuple storage space, and one tuple storage space is used to store the version data structure of one version (i.e., the storage state data of one storage state), and the version data structure of one version (i.e., the storage state data of one storage state) can be used to record the tuple data of one tuple (i.e., Tuple), and the version data structure of another version can be used to record another tuple data of the same tuple.
[0064] In the embodiment, it can be understood that, for the two versions in the cyclic double version, the tuple data stored in the version data structure of one version is determined based on the data update on the read another tuple data stored in the version data structure of another version.
[0065] The storage space addresses of the two tuple storage spaces involved in the embodiment are the version addresses of the two versions. Since there can be at least one version for one tuple, the embodiment takes two versions as an example to illustrate the alternation of tuple update between the two versions. At this time, the storage positions of the version addresses of the two versions in the corresponding tuple storage spaces in the NVM space are fixed and unchanged. Therefore, when the tuple update is alternated between the two versions, the index items in the index file deployed in the NVM can not be modified, instead, each time a certain version needs to be quickly indexed and accessed through the index items in the index file, and then another version can be quickly accessed through the version link relationship (i.e., the state link relationship for linking one storage state and another storage state) of the two versions in the cyclic double version to realize the efficient reading of the two versions. This design is very suitable for the nature of NVM that reading is faster than writing.
[0066] In the embodiment, the version link relationship (i.e., the state link relationship) is used to represent the pointing relationship from the address offset (e.g., address offset V1) in the version data structure of one version (i.e., one storage state, for example, storage state Y11) to another address offset (e.g., address offset V2) in the version data structure of another version (i.e., another storage state, for example, storage state Y12). The pointing relationship indicated by the version link relationship can be used to quickly index from one version to another version.
[0067] For example, for the tuple Y1, a cyclic dual version composed of two storage states (e.g., storage state Y11 and storage state Y12) can exist simultaneously. It can be understood that the embodiments of the present application can store the account balance of the account U1 alternately through the two storage states (e.g., storage state Y11 and storage state Y12), and for the convenience of understanding, the storage state Y11 can be collectively referred to as a first storage state and the storage state Y12 can be collectively referred to as a second storage state. At this time, the embodiments of the present application take the account balance of the account U1 at three different time points (e.g., T1 time point, T2 time point and T3 time point) (e.g., M1 = 100, M2 = 50, M3 = 150) as an example to describe the way of storing the account balance of the account U1 alternately using the two versions (i.e., two storage states).
[0068] For example, at the T1 time point, the account balance of the account U1 before resource transfer (e.g., M1 = 100) can be stored through the storage state Y11 (i.e., the initial storage state, e.g., the first storage state), and the account balance of the account U1 after resource transfer (i.e., the latest account balance of the account U1, e.g., M2 = 50) can be stored through the storage state Y12 (i.e., the updated storage state, e.g., the second storage state) at the T2 time point (e.g., the next time point of the T1 time point), and then at the T3 time point (e.g., the next time point of the T2 time point), the storage state Y11 (i.e., the first storage state) can be reused to store the account balance of the account U1 after performing the operation of executing other transactions (i.e., the currently latest account balance of the account U1, e.g., M3 = 150).
[0069] Optionally, by analogy, for three versions (i.e., three storage states, for example, a first storage state, a second storage state, and a third storage state) in a cyclic three-version, the same tuple data of the same tuple at different time points can be alternately stored by the three versions (i.e., the three storage states). For example, the initial tuple data (for example, the initial account balance, such as M1 = 100 described above) of the tuple Y1 (i.e., the account balance of the account U1) can be preferentially stored by the first storage state at T1, and the first target tuple data (for example, the first target account balance, such as M2 = 50 described above) after the first tuple update of the tuple Y1 (i.e., the account balance of the account U1) can be stored by the next storage state (i.e., the second storage state) of the first storage state at T2, and the second target tuple data (for example, the second target account balance, such as M3 = 150 described above) after the second tuple update of the tuple Y1 (i.e., the account balance of the account U1) can be stored by the next storage state (i.e., the third storage state) of the second storage state at T3. Then, at T4 (for example, the next time point of T3), the first storage state can be continued to be reused to store the account balance of the account U1 (i.e., the current latest account balance of the account U1, for example, M4 = 200) after the operation performed by other transactions.
[0070] In other words, when creating the three versions (i.e., the three storage states) for the tuple Y1, the state linkage relationship between the first storage state and the second storage state (i.e., the first state linkage relationship) can be created first, then the state linkage relationship between the second storage state and the third storage state (i.e., the second state linkage relationship) can be created, and finally the state linkage relationship between the third storage state and the first storage state (i.e., another new second state linkage relationship) can be further created. In the cyclic three-version storage, for any two storage states with a state linkage relationship in the three storage states, one storage state (for example, the storage state with a smaller storage timestamp) with a state linkage relationship can be collectively referred to as the initial storage state, and the other storage state (for example, the storage state with a larger storage timestamp) with a state linkage relationship can be collectively referred to as the update storage state relative to the initial storage state. This means that when the first storage state and the second storage state are included in the cyclic three-version, if the first storage state is the initial storage state, then the second storage state is the update storage state; and when the first storage state, the second storage state, and the third storage state are included in the cyclic three-version, if the second storage state is the initial storage state, then the third storage state is the update storage state, otherwise, if the third storage state is the latest initial storage state, then the first storage state will be regarded as the latest update storage state.
[0071] It can be seen that, for the multiple storage states of the same tuple stored in the non-volatile storage space, when the tuple data of the same tuple is alternately updated using the multiple storage states, the state linkage relationship between any two of the storage states can be determined through the storage time stamp corresponding to each storage state, and then two versions in any two storage states can be determined through the determined state linkage relationship in each round of participating in the alternately updating the tuple, for example, the version with the smallest storage time stamp (i.e., the old version) can be taken as the initial storage state, and the version with the largest storage time stamp (i.e., the new version) can be taken as the updated storage state. For ease of understanding, the two versions in the cyclic double version will be taken as an example in the subsequent embodiments of the present application to illustrate the specific process of alternately accessing and updating the tuple data of the same tuple through the cyclic double version.
[0072] Five, double version concurrency control (referred to as double version concurrency control), in the embodiments of the present application, by using the cyclic double version concurrency control method, when a large number of transactions need to access and read the same tuple, the consistency and efficiency of data access can be ensured through the cyclic double version (for example, the storage time field and the modification transaction information field in the cyclic double version, for example, the Wts field and the Txn Inf field). It can be understood that when there are two versions of a tuple, there are two cases, one case is that one version (for example, the old version) is a version being modified by a transaction (i.e., the current transaction), and the other version (for example, the new version) is a read-only version; the other case is that there is no active transaction (i.e., no other high-frequency execution transaction before the current transaction) to modify the tuple, so there are two readable versions, and then when the tuple data of the tuple needs to be accessed, the version with the largest read storage time stamp in the two readable versions can be finally accessed.
[0073] This means that in the subsequent embodiments of the present application, when the current transaction is executed, the corresponding version in the cyclic double version (i.e., the version with the largest read storage time stamp) can be read according to the transaction start time stamp of the current transaction. It should be understood that when the two versions of a certain tuple (i.e., a target tuple) addressed in the tuple heap can be accessed, the corresponding version (for example, the new version) in the cyclic double version that can be finally read for the current transaction can be collectively referred to as the effective version, and the request operation corresponding to the current transaction can be executed on the current tuple (i.e., the target tuple) through the read effective version.
[0074] It should be noted that all the data accessed by the present application (i.e. tuple data of target tuples, such as enterprise-level data in an enterprise-level database system, real-time data in a real-time data analysis platform, cloud data in a cloud computing and big data platform, and transaction data in a high-frequency transaction system, and Internet of Things data in Internet of Things data management, and other related data) is collected with the consent and authorization of the object to which the data belongs (such as a user, an enterprise, or an institution), and the collection, use, and processing of related data need to comply with relevant laws, regulations, and standards of the country and region.
[0075] Further, please refer to Figure 1 , Figure 1 is a structural schematic diagram of a network architecture provided by the present application. As Figure 1 indicated, the network architecture can include a server 100a and a cluster of terminal devices, which can include one or more terminal devices, and the number of terminal devices will not be limited here. As Figure 1 indicated, the plurality of terminal devices can specifically include terminal device 200a, terminal device 200b, …, terminal device 200n; as Figure 1 indicated, terminal device 200a, terminal device 200b, …, terminal device 200n can all be network connected with server 100a, so that each terminal device can perform data interaction between the network connection and server 100a.
[0076] It should be understood that in the cloud service scenario corresponding to the cloud computing and big data platform, the server 100a here can be the above-mentioned cloud server. The cloud service scenario here can include but is not limited to a medical cloud service scenario, a cloud game service scenario, a cloud education service scenario, a cloud conference service scenario, and a cloud social service scenario.
[0077] For example, in the medical cloud service scenario, medical personnel between medical institutions can share medical resources through NVM persistent storage. For example, when the present application applies the above-mentioned access and storage technology of the storage engine based on the NVM architecture to the medical cloud service scenario, medical personnel between medical institutions can quickly access and read the tuple data of a certain tuple associated with medical business from the NVM on the cloud server through indexing. For example, the tuple data here can be electronic diagnosis information and / or electronic prescription information of a certain patient, etc.
[0078] For example, in a cloud game service scenario, resource sharing of game resources (e.g., game scene rendering resources or character texture rendering resources, etc.) stored on a cloud server can be implemented among game players. For example, when the above-mentioned access and storage technology of the storage engine based on the NVM architecture is applied in the cloud game service scenario, each game player can quickly access and read the tuple data of another tuple associated with the game service from the NVM on the cloud server through the index. For example, the tuple data here can be scene texture resources in a certain cloud game, which can be rendered and displayed on the game interface of each game player.
[0079] For example, in a transaction transfer scenario corresponding to a high-frequency transaction system, each transaction personnel can perform transaction transfer business through the transaction account balance of each transaction personnel stored on the server. For example, when the above-mentioned access and storage technology of the storage engine based on the NVM architecture is applied in the transaction transfer scenario, each transaction personnel can quickly access and read the tuple data of two tuples associated with the transaction transfer business (e.g., the tuple data of the tuple corresponding to the transaction transfer out party and the tuple data of the tuple corresponding to the transaction transfer in party) from the NVM on the server through the index. For example, the tuple data here can be the transaction account balance of a certain transaction personnel.
[0080] It can be understood that, Figure 1 The server 100a shown can be a standalone physical server, or a server cluster or distributed system composed of multiple physical servers.
[0081] Further, please refer to Figure 2 , Figure 2 is a data interaction schematic diagram based on an NVM architecture provided by an embodiment of the present application. The NVM architecture here refers to an architecture proposed by the embodiment of the present application, in which all key components (e.g., a directory file, a tuple heap, an index file, a transaction commit log list, and a tuple space manager, etc.) of a database associated with a corresponding data service are deployed in a data access space (e.g., a non-volatile storage space 20a) corresponding to a non-volatile memory. Figure 2 In other words, the embodiment of the present application proposes that all key components of a database associated with a corresponding data service can be deployed in a data access space (e.g., a non-volatile storage space 20a) corresponding to a non-volatile memory. Figure 2The server 22a shown in the figure is deployed with a non-volatile memory (NVM) for data storage without additional deployment of other data accessors in the server 22a (i.e. without additional introduction of other storage media for data storage), for example, without additional deployment of a dynamic random access memory (DRAM), so that the migration management overhead and migration data consistency detection overhead can be avoided when data is migrated between different storage media.
[0082] The data access space corresponding to the non-volatile memory (NVM) is a non-volatile storage space, and the storage medium in the non-volatile storage space is a non-volatile storage medium. The data storage space corresponding to the dynamic random access memory (DRAM) is a volatile storage space, and the storage medium in the volatile storage space is a volatile storage medium. It should be understood that by deploying a non-volatile memory (NVM) in the server 22a without deploying a dynamic random access memory (DRAM), the consistency problem when data is migrated between different storage media can be avoided.
[0083] The NVM architecture can be an architecture for data storage and access by the AKV storage engine. For example, the NVM architecture deployed in the server 22a can be an architecture composed of all key components related to the storage engine deployed in the non-volatile storage space 20a. For example, all key components here can include but are not limited to Figure 2 The directory file 2a shown in the figure is used to organize and manage the file storage location, the transaction commit log list 2b is used to record the transaction identifier of the committed transaction, the index file 2c is used to perform index identification, and the tuple heap in the business table 2d is used to store tuples. It can be understood that Figure 2 The server 22a shown in the figure can be the server 22a described above Figure 1 The server 100a shown in the figure.
[0084] For ease of understanding, the embodiments of the present application take the transaction transfer business in the data business as an example, and the business scenario corresponding to the transaction transfer business can be the transaction transfer scenario described above. For example, Figure 2 The user 1a shown in the figure requests the server 22a to perform the data business through the terminal device 21a, which is Figure 2 The transaction transfer business. As Figure 2 The transaction transfer business here can be the business corresponding to the transfer transaction.
[0085] For ease of understanding, in this embodiment of the application, the transfer transactions mentioned here can be collectively referred to as the first transaction indicated by the data service. For example, the first transaction information corresponding to the first transaction can specifically be... Figure 2 The diagram shows transaction information for transferring N virtual resources from account U1 (the first account) to user U2 (the second account). The first account can be... Figure 2 The account shown is that of user 1a (e.g., the first business entity) in the aforementioned high-frequency trading system. The second account can be the account of another user (e.g., the second business entity) in the aforementioned high-frequency trading system, and / or, another account of user 1a (e.g., the first business entity) in the high-frequency trading system. It should be understood that the embodiments of this application do not limit the specific business entities to which the first account and the second account belong.
[0086] Specifically, such as Figure 2 As shown, user 1a can request server 22a associated with the data service to execute the transaction transfer service (i.e., the data service) through terminal device 21a. For example, terminal device 21a can respond to a confirmation operation for the transaction transfer service (i.e., the data service) and... Figure 2 The data processing request 1 for the first transaction information shown is sent to server 22a, so that when server 22a receives the data processing request 1, it can obtain the matching index identifier carried in the data processing request 1 and the first transaction information indicated by the transaction transfer business (i.e., Figure 2 The example shown is a transaction where N virtual resources are transferred from account U1 to user U2. During transaction parsing, one or more data processing instructions can be obtained from this first transaction information targeting the matching index identifier. Here, the matching index identifier can be a tuple identifier obtained from data processing request 1 that is used to query or index a tuple for the transfer transaction.
[0087] It should be understood that, in different business scenarios, the number of tuples to be processed that need to be queried for the corresponding data business can be one or more. Here, the specific number of tuple identifiers to be indexed specified in the data processing request will not be limited. For ease of understanding, in this embodiment, the tuples corresponding to the tuple identifiers to be indexed are collectively referred to as tuples to be processed.
[0088] Based on this, targeting Figure 2 For the transaction transfer business shown, assuming that in the non-volatile storage space 20a (for example, specifically it can be in Figure 2 The target index identifier that matches the index identifier to be matched found in the index file 2c) shown is Figure 2tuple identifier of the tuple Y1 and a tuple identifier of the tuple Y2. At this time, the server 22a can quickly address to the tuple Y1 and the tuple Y2 in the tuple heap through the index file 2c, which means that the to-be-matched index identifier can specifically include Figure 2 the tuple Y1 (i.e., the first tuple) and the tuple Y2 (i.e., the second tuple). Among them, the tuple Y1 (i.e., the first tuple) can be the account balance of the account U1 that needs to be read for executing the transfer transaction (i.e., the first transaction, such as the transaction of transferring the virtual resource with the resource quantity N from the account U1 to the user U2). Similarly, the tuple Y2 (i.e., the second tuple) can be the account balance of the account U2 that needs to be read for executing the transfer transaction (i.e., the first transaction, such as the transaction of transferring the virtual resource with the resource quantity N from the account U1 to the user U2).
[0089] It should be understood that in the embodiments of the present application, the server 22a can decompose the first transaction into two sub-transactions (for example, one sub-transaction is the first sub-transaction and the other sub-transaction is the second sub-transaction) when executing the first transaction. For example, the data processing instruction corresponding to one sub-transaction (i.e., the first sub-transaction) can be an instruction for data reading and data updating of the tuple data of the tuple Y1, and the data processing instruction corresponding to the other sub-transaction (i.e., the second sub-transaction) can be an instruction for data reading and data updating of the tuple data of the tuple Y1.
[0090] Among them, the tuple heap deployed in the non-volatile storage space 20a can contain a plurality of tuples, and the plurality of tuples can specifically include Figure 2 the tuple Y1, …, and the tuple Y2. Among them, the storage state set of the tuple Y1 can contain a plurality of storage states, and the plurality of storage states can specifically include Figure 2 the storage state Y11 and the storage state Y12. Similarly, the storage state set of the tuple Y2 can also contain a plurality of storage states, and the plurality of storage states can specifically include Figure 2 the storage state Y21 and the storage state Y22. Figure 2
[0091] Among them, as shown in the figure, Figure 2 For the tuple Y1, the storage state data corresponding to the storage state Y11 can be used to store a plurality of storage parameters of the tuple Y1 in the storage state Y11. Among them, the plurality of storage parameters in the storage state Y11 can specifically include the field value of the address offset field (for example, Figure 2 the address offset V1), …, the field value of the storage time field (for example, Figure 2 the storage timestamp w1), and the field value of the tuple data field (for example, Figure 2 The tuple data D1 shown here is used to represent the tuple data of the tuple Y1 read in the transaction transfer service at the storage timestamp w1, such as the account balance of the user U1 at the storage timestamp w1, for example, M1=100). Similarly, the storage state data corresponding to the storage state Y12 can also be used to store a plurality of storage parameters of the tuple Y1 at the storage state Y12. Among them, the plurality of storage parameters at the storage state Y12 can specifically include the field value of the address offset field (for example, Figure 2 The address offset V2 shown), the field value of the storage time field (for example, Figure 2 The storage timestamp w2 shown), the field value of the tuple data field (for example, Figure 2 The tuple data D2 shown here is used to represent the tuple data of the tuple Y1 read in the transaction transfer service at the storage timestamp w2, such as the account balance of the user U1 at the storage timestamp w2, for example, M2=50).
[0092] It should be understood that when the server 22a executes the first transaction corresponding to the first transaction information through a thread (for example, the first thread) in the thread pool, the server 22a can invoke the storage engine (for example, the AKV storage engine) for data access in response to the execution operation of the first transaction (that is Figure 2 The entire transfer transaction shown), so as to read the index storage address (for example, Figure 2 The addr1 shown) of the index file 2c stored in the directory file 2a in the AKV storage engine in the non-volatile storage space 20a, so as to read the index file 2c through the read index storage address, and then identify the index through the index file 2c to find the target index identifier matching the to-be-matched index identifier in the index file 2c. It can be understood that at this time, the server can further determine the index storage address and the storage address offset (for example, Figure 2 The address offset V1 shown) corresponding to the target index identifier pre-stored in the non-volatile storage space 20a when the target index identifier is found.
[0093] Among them, in an implementable manner, the index storage address corresponding to the target index identifier pre-stored in the non-volatile storage space 20a can be the index file address of the index file 2a recorded by the directory file 2a deployed in the non-volatile storage space 20a (for example, Figure 2As shown in addr1). The tuple storage address corresponding to the target index identifier pre-stored in the non-volatile storage space 20a can be the value of the address offset field in the storage state data corresponding to the first inserted storage state (e.g., storage state Y11) in the tuple heap of the non-volatile storage space 20a (e.g., ...). Figure 2 The address offset V1 is shown.
[0094] At this time, server 22a can use this storage address offset (for example, Figure 2 The address offset V1 shown) and the index storage address (e.g., Figure 2 The address of the index file (addr1) is used to determine the tuple storage address of the target tuple corresponding to the target index identifier. One or more storage states of the target tuple can be determined through the tuple storage address of the target tuple. The states of one or more storage states can be combined and referred to as the storage state set.
[0095] In one possible implementation, when the target tuple has multiple storage states, the tuple storage address of the target tuple in the tuple heap can be the storage address of the storage state corresponding to an address offset that is consistent with the storage address offset in the index file 2c.
[0096] like Figure 2 As shown, in the two storage states of tuple Y1, if the storage timestamp w1 is earlier than (i.e., less than) the storage timestamp w2, then storage state Y11 of tuple Y1 is the old version of tuple Y1 (i.e., the initial storage state mentioned above), and storage state Y12 of tuple Y1 is the new version of tuple Y1 (i.e., the updated storage state mentioned above). Conversely, if the storage timestamp w1 is later than (i.e., greater than) the storage timestamp w2, then storage state Y11 of tuple Y1 is the new version, and storage state Y12 of tuple Y1 is the old version.
[0097] Understandable, Figure 2 The address offset V1 shown is calculated Figure 2 The storage address of storage state Y11 shown is... Figure 2 The index file address of the index file 2c shown (for example, Figure 2 The offset between addr1 and the value shown is determined after storage in directory file 2a. Similarly, Figure 2 The address offset V2 shown is calculated Figure 2 The storage address of storage state Y12 shown is... Figure 2 The index file address of the index file 2c shown (for example, Figure 2This is determined after another offset between addr1 and the address stored in directory file 2a, as shown. It should be understood that for... Figure 2 Regarding the two versions (i.e., two storage states) of the tuple Y1 shown, they can be represented by these two address offsets (e.g., Figure 2 The bidirectional index relationship between the address offsets V1 and V2 shown (i.e., Figure 2 The pointer relationship from address offset V1 to address offset V2 and another pointer relationship from address offset V2 to address offset V1 are shown. A circular double version consisting of storage state Y11 and storage state Y12 is established, and the data update of tuple data of tuple Y1 in NVM is achieved alternately through the circular double version.
[0098] Similarly, such as Figure 2 As shown, for tuple Y2, the storage state data corresponding to storage state Y21 may specifically include the field value of the address offset field (e.g., Figure 2 The address offset V3 shown), ..., the field value of the storage time field (e.g., Figure 2 The storage timestamp w3 shown), and the field values of the tuple data fields (e.g., Figure 2 The tuple data D3 shown here represents the tuple data of tuple Y2 read in this transaction at storage timestamp w3 (for example, the account balance of user U2 at storage timestamp w3). Similarly, the storage state data corresponding to storage state Y22 may specifically include the field value of the address offset field (e.g., Figure 2 The address offset V4 shown), ..., the field value of the storage time field (e.g., Figure 2 The storage timestamp w4 shown), and the field values of the tuple data fields (e.g., Figure 2 The tuple data D4 shown here is used to represent the tuple data of tuple Y2 read in this transaction at the storage timestamp w4, such as the account balance of user U2 at the storage timestamp w4.
[0099] Understandable, Figure 2 The address offset V3 shown is calculated Figure 2 The storage address of storage state Y21 shown is... Figure 2 The index file address of the index file 2c shown (for example, Figure 2 The offset between addr1 and the value shown is determined after storage in directory file 2a. Similarly, Figure 2 The address offset V4 shown is also calculated. Figure 2 The storage address of storage state Y22 shown is... Figure 2The index file address of the index file 2c shown in the figure (for example, Figure 2 The other offset between the addr1 stored in the directory file 2a shown in the figure and the addr2 determined after the offset is understood. For example, Figure 2 The two versions (i.e. two storage states) of the tuple Y2 shown in the figure can be indexed by the two address offsets (for example, Figure 2 The bidirectional indexing relationship between the address offset V3 and the address offset V4 shown in the figure (i.e. Figure 2 The pointing relationship from the address offset V3 to the address offset V4 and the other pointing relationship from the address offset V4 to the address offset V3 shown in the figure), a cyclic double version composed of the storage state Y21 and the storage state Y22 is established, and the cyclic double version is used to realize the data update of the tuple data of the tuple Y2 in the NVM.
[0100] It should be understood that when the server 22a finds the target index identifier matching the to-be-matched index identifier of the to-be-processed tuple (for example, the tuple Y1 and the tuple Y2) in the index file 2c, it can be determined Figure 2 The target tuple matching the to-be-processed tuple (for example, the tuple Y1 and the tuple Y2) currently required to be queried exists in the tuple heap shown in the figure.
[0101] Among them, the embodiment of the application can be specifically determined by identifying the mapping in the process of finding the target index identifier matching the to-be-matched index identifier of the to-be-processed tuple (for example, the tuple Y1 and the tuple Y2) in the index file 2c, that is, by identifying the mapping in the multiple index sets (for example, Figure 2 The index set C1, the index set C2, the index set C3 and the index set C4 shown in the figure) contained in the index file 2c, the target index set is determined, and then when the determined target index set is Figure 2 The index set C1 shown in the figure, it is further determined whether the target index identifier matching the to-be-matched index identifier exists in the index set C1, which can avoid directly searching the index identifiers in the entire index file 2c, thereby further improving the efficiency of tuple positioning and searching.
[0102] Further, as Figure 2 Since the tuple version of the target tuple (for example, Figure 2 The tuple Y1 and the tuple Y2 shown in the figure) found in the tuple heap of the business table 2d is a cyclic double version, for the tuple Y1, in the process of executing the first transaction, the storage time stamp (for example, Figure 2the storage timestamp w1) and obtain the storage timestamp in the storage state data corresponding to the storage state Y12 (for example, Figure 2 The storage timestamp w2) is shown, and then the transaction start timestamp configured for the first transaction by the first thread (that is, the instruction timestamp corresponding to the one or more data processing instructions) can be compared with the storage timestamp w1 and the storage timestamp w2 to determine which of the two versions (that is, the storage state Y11 and the storage state Y12) in the cyclic double version of the tuple Y1 is the effective version (that is, the target storage state), and then the corresponding instruction operation indicated by the data processing instruction can be executed on the tuple Y1 in the target storage state.
[0103] For example, the instruction operation here can be a write operation, and at this time, the data processing instruction can be a write instruction for the target tuple, which can be used to instruct the server 22a to read the effective tuple data in the storage state data corresponding to the effective version (that is, the target storage state), and determine the latest tuple data for writing into the storage state data of the other storage state in the cyclic double version based on the read effective tuple data and the transaction detail data (for example, transaction modification detail data, such as virtual resources of N number of transfer-out resources) of the first transaction.
[0104] For example, the embodiment of the present application can determine that the storage state Y11 is the old version and the storage state Y12 is the new version when the storage timestamp w1 is less than the storage timestamp w2, and then the storage state Y12 (that is, the new version) can be determined as the effective version to be read for executing the first transaction, and the storage state Y11 (that is, the old version) can be determined as the old version to be modified and locked for executing the first transaction, so that the effective tuple data (for example, Figure 2 The effective tuple data (for example, Figure 2 The tuple data D2 (for example, the account balance of 100 yuan of the account U1 at the storage timestamp w2) and the transaction detail data (for example, 50 yuan) of the first transaction are shown, and the latest tuple data (for example, 100-50=50 yuan) for storing into the version data structure of the storage state Y11 (that is, the old version) can be determined, and the field value of the tuple data field of the storage state Y11 in the NVM space (that is, the non-volatile storage space) corresponding to the NVM can be further updated from Figure 2 The tuple data D1 (for example, 150 yuan) is shown, and the latest tuple data (for example, 50 yuan) is configured.
[0105] Similarly, by analogy, similarly, the embodiment of the present application can also obtain the storage timestamp in the storage state data corresponding to the storage state Y21 (for example, Figure 2The storage timestamp w3) and the storage timestamp in the storage state data corresponding to the storage state Y22 are shown (for example, Figure 2 The storage timestamp w4) is shown, so that the transaction start timestamp (that is, the instruction timestamp corresponding to the one or more data processing instructions described above) is compared with the storage timestamp w3 and the storage timestamp w4, to determine which of the two versions (that is, the storage state Y21 and the storage state Y22) in the cyclic double version of the tuple Y2 is the valid version (that is, the target storage state), and then the corresponding instruction operation indicated by the data processing instruction can be executed on the tuple Y2 in the target storage state.
[0106] For example, when the storage timestamp w3 is less than the storage timestamp w4, the storage state Y21 is determined to be the old version, and the storage state Y22 is determined to be the new version, and then the storage state Y22 (that is, the new version) can be determined as the valid version to be read for executing the first transaction, and the storage state Y21 (that is, the old version) can be determined as the old version to be modified and locked for executing the first transaction, so that the valid tuple data (for example, Figure 2 The valid tuple data (for example, Figure 2 The tuple data D4 shown (that is, the account balance of the account U1 at the storage timestamp w4, for example, 200 yuan) and the transaction details data of the first transaction (for example, 50 yuan transferred in) are used to determine the latest tuple data (for example, 200+50=250 yuan) to be stored in the version data structure of the storage state Y21 (that is, the old version), and the field value of the tuple data field of the storage state Y21 can be further updated from Figure 2 The tuple data D3 shown (for example, 100 yuan) is updated to the latest tuple data (for example, 250 yuan).
[0107] It should be understood that after the first transaction is executed, the AKV storage engine can be called by the first thread to configure a transaction end timestamp for the first transaction, and then the transaction identifier of the first transaction can be generated and added to Figure 2 The transaction identifier Tx3 and the transaction identifier Tx4 of the committed transactions are included in the transaction commit log list 2b, as shown. Figure 2 At this time, the transaction commit log list 2b includes the transaction identifier Tx3 and the transaction identifier Tx4 of the committed transactions. In the transaction commit log list 2b, one transaction identifier corresponds to one committed transaction.
[0108] In addition, as shown in Figure 2 The list address (for example,Figure 2 The server 22a can quickly index to the transaction commit log list 2b through the list address (e.g., addr2) in the target file 2a, and can implement the transaction rollback of the uncommitted transaction through the checkpoint (e.g., TX1) set in the transaction commit log list 2b. Figure 2 The server 22a can quickly index to the transaction commit log list 2b through the list address (e.g., addr2) in the target file 2a, and can implement the transaction rollback of the uncommitted transaction through the checkpoint (e.g., TX1) set in the transaction commit log list 2b. Figure 2 For example, when the current transaction (i.e., the first transaction) is committed, the server 22a can determine whether the current transaction (i.e., the first transaction) should be committed or aborted according to whether the read-write data set of the first transaction has transaction conflict with other concurrent transactions (e.g., other committed transactions).
[0109] For example, if the read-write data set of the current transaction has transaction conflict with other concurrent transactions, the server 22a can terminate the current transaction (i.e., the first transaction) with transaction conflict in the fastest way through the AKV storage engine, and mark the storage state of the tuple currently modified by the first transaction as an invalid version (i.e., an invalid storage state), so that the tuple storage space corresponding to the storage state data of the invalid storage state can be spatially reused in the future, which can avoid the invalid version (i.e., the invalid storage state) occupying the system resources of the server 22a, thereby causing waste of system resources.
[0110] It can be understood that, before the index file 2c is indexed by the server 22a, the server 22a can also quickly index to the table file 2d through the table address (e.g., addr3) in the directory file 2a. Figure 2 The server 22a can quickly index to the table file 2d through the table address (e.g., addr3) in the directory file 2a, and can store the tuple identifiers of each tuple stored in the tuple heap in the table file 2d in a mapping manner into the index file 2c which has a mapping relationship with the business table 2d, so that the tuple identifiers of each tuple can be pre-stored in each index set of the index file 2c, and the tuple identifiers of each tuple pre-stored in the index file 2c are collectively referred to as index identifiers of each tuple. Figure 2 The server 22a can quickly index to the table file 2d through the table address (e.g., addr3) in the directory file 2a, and can store the tuple identifiers of each tuple stored in the tuple heap in the table file 2d in a mapping manner into the index file 2c which has a mapping relationship with the business table 2d, so that the tuple identifiers of each tuple can be pre-stored in each index set of the index file 2c, and the tuple identifiers of each tuple pre-stored in the index file 2c are collectively referred to as index identifiers of each tuple. Figure 2 The server 22a can quickly index to the table file 2d through the table address (e.g., addr3) in the directory file 2a, and can store the tuple identifiers of each tuple stored in the tuple heap in the table file 2d in a mapping manner into the index file 2c which has a mapping relationship with the business table 2d, so that the tuple identifiers of each tuple can be pre-stored in each index set of the index file 2c, and the tuple identifiers of each tuple pre-stored in the index file 2c are collectively referred to as index identifiers of each tuple. The server 22a can quickly index to the table file 2d through the table address (e.g., addr3) in the directory file 2a, and can store the tuple identifiers of each tuple stored in the tuple heap in the table file 2d in a mapping manner into the index file 2c which has a mapping relationship with the business table 2d, so that the tuple identifiers of each tuple can be pre-stored in each index set of the index file 2c, and the tuple identifiers of each tuple pre-stored in the index file 2c are collectively referred to as index identifiers of each tuple.
[0111] The server 22a finds the target index identifier matching the index identifier to be matched in the non-volatile storage space, and determines the index storage address and the storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space, and the specific implementation of determining the target storage state in the plurality of storage states can be referred to in the following Figure 2 The description of the corresponding embodiment.
[0112] Further, please refer to Figure 2 , Figure 2 is a flowchart of a data processing method based on a non-volatile storage space provided by the present application. The method is executed by a computer device, which can be a terminal device integrated with a non-volatile memory (NVM) or a server integrated with a non-volatile memory (NVM), and the data access space corresponding to the non-volatile memory (NVM) is a non-volatile storage space. The non-volatile storage space includes a plurality of tuples, which are indexed by index identifiers pre-stored in the non-volatile storage space. Figure 2 As shown in the figure, the method can include at least steps S101-S106:
[0113] Step S101, obtaining a data processing request, the data processing request carrying an index identifier to be matched and one or more data processing instructions;
[0114] The data processing request can be a request sent for a certain transaction information (first transaction information), and the first transaction information can be transaction information corresponding to a specific transaction indicated by a certain data service. It should be understood that the first transaction information refers to transaction information composed of a series of operation sequences, and each operation in the series of operation sequences corresponds to a data processing instruction, which means that the instructions in the first transaction information carried in the data processing request can include one or more data processing instructions.
[0115] The data service can include, but is not limited to, enterprise-level services corresponding to enterprise-level data in the enterprise-level database system, real-time analysis services corresponding to real-time data in the real-time data analysis platform, cloud services corresponding to cloud data in the cloud computing and big data platform, transaction services corresponding to transaction data in the high-frequency transaction system, and Internet of Things services corresponding to Internet of Things data in the Internet of Things data management. For ease of understanding, the data service in the present application will still be the enterprise-level service corresponding to the enterprise-level data in the enterprise-level database system. Figure 2The transaction transfer service is shown as an example to illustrate the specific process of indexing the to-be-matched index identifier carried in the data processing request in the process of executing a specific transaction (for example, a transfer transaction) indicated by the transaction transfer service.
[0116] Specifically, it can be understood that when the computer device obtains the data processing request, the computer device can perform request analysis on the data processing request to obtain one or more data processing instructions of the first transaction information carried in the data processing request and the to-be-matched index identifier currently required to be indexed in the non-volatile storage space.
[0117] It should be understood that the embodiments of the present application also need to perform different request operations of the first transaction by the computer device based on different request types of the data processing request.
[0118] For example, if the request type is a read type, when the computer device executes the current transaction (i.e., the first transaction) through a certain thread (i.e., the first thread), the computer device can indirectly locate and find one or more tuples required to execute the current transaction (i.e., the first transaction) in the tuple heap through the index file, and then determine the target storage state of the tuples from at least one storage state of the tuples located and found, so as to quickly and accurately execute the read operation indicated by the data processing request for the corresponding tuple under the target storage state of the tuples (i.e., the valid version of the tuples), such as reading the valid tuple data of the corresponding tuple from the storage state data corresponding to the target storage state of the tuples, and then the read valid tuple data of the tuples can be used as the request response data required to be backfilled to the data processing request. In this way, the computer device can return the request response data to the terminal device currently sending the data processing request.
[0119] For another example, if the request type is a write type, when the computer device executes the current transaction (i.e., the first transaction) through a certain thread (i.e., the first thread), the computer device can indirectly locate and find one or more tuples required to execute the current transaction (i.e., the first transaction) in the tuple heap through the index file, and then determine the target storage state of the tuples (i.e., the valid version of the tuples) from at least one storage state of the tuples located and found, so as to quickly execute the read operation indicated by the data processing request for the corresponding tuple through the determined target storage state of the tuples (i.e., the valid version of the tuples), and then update the tuple data in the storage state data corresponding to another storage state of the same tuple in the tuples based on the valid tuple data in the storage state data corresponding to the target storage state of the tuples currently read.
[0120] For example, when the data service is a transaction transfer service, the first transaction indicated by the data service can be a transfer transaction. At this time, if the request type of the data processing request is a read type, the series of operations involved in the transfer transaction can be reading the valid tuple data in the storage state data corresponding to the target storage state of all tuples required for executing the transfer transaction. Alternatively, if the request type of the data processing request is a write type, the series of operations involved in the transfer transaction can be reading the valid tuple data in the storage state data corresponding to the target storage state of all tuples required for executing the transfer transaction, and performing data update on the tuple data in the storage state data corresponding to another storage state of the corresponding tuple by using the read valid tuple data.
[0121] In step S102, a target index identifier matching the to-be-matched index identifier is searched in the non-volatile storage space.
[0122] In one implementation, the non-volatile storage space can be deployed with an index file for indexing the pre-stored index identifiers, and the one or more data processing instructions are instructions in the first transaction information carried in the data processing request, which is a request obtained by a first thread in a thread pool corresponding to the non-volatile storage space. At this time, when the computer device starts the first transaction corresponding to the first transaction information by using the first thread, the computer device can configure a transaction start timestamp for the first transaction, and configure a transaction state of the first transaction as a transaction execution state when executing the first transaction based on the transaction start timestamp. Further, the computer device can search, in the transaction execution state, the target index identifier matching the to-be-matched index identifier by using the index file.
[0123] In another implementation, the non-volatile storage space can be deployed with a tuple heap for storing a plurality of tuples, and the index file deployed in the non-volatile storage space can include a plurality of index sets. The plurality of index sets are sets for pre-storing the index identifiers of the tuples determined after the index identifiers of the tuples in the tuple heap are identified and mapped. At this time, the specific process of searching, by the computer device, the target index identifier matching the to-be-matched index identifier by using the index file can be described as follows: the computer device can identify and map the to-be-matched index identifier in the transaction execution state, and can determine, in the plurality of index sets, an index set for mapping the to-be-matched index identifier as a target index set. Further, the computer device can search, in the target index set, the target index identifier matching the to-be-matched index identifier.
[0124] In other words, when the first transaction is started by the first thread, the transaction start timestamp can be configured for the first transaction, and when the first transaction is executed based on the transaction start timestamp, the transaction state of the first transaction can be configured as a transaction execution state. Further, the computer device can identify map the to-be-matched index identifier in the transaction execution state, and determine an index set used to map the to-be-matched index identifier as a target index set in the plurality of index sets. Further, the computer device can find a target index identifier matching the to-be-matched index identifier in the target index set.
[0125] It should be understood that, in one implementation, if the target index identifier matching the to-be-matched index identifier is found, the computer device can determine that there is a target tuple matching the to-be-processed tuple corresponding to the to-be-matched index identifier in the tuple heap, and then the step S103 can be continued. Conversely, in another implementation, if the target index identifier matching the to-be-matched index identifier is not found, the computer device can determine that there is no target tuple matching the to-be-processed tuple corresponding to the to-be-matched index identifier in the tuple heap, and at this time, the computer device can perform transaction rollback on the first transaction.
[0126] It should be understood that, since the first transaction information refers to transaction information used to describe an operation sequence corresponding to a series of operations, the transaction rollback here essentially refers to that the computer device can, when the first transaction corresponding to the first transaction information is in a transaction execution state, according to the operation sequence indicated by the first transaction, undo all executed operations in the operation sequence, and suspend all executing operations and / or all unexecuted operations in the operation sequence.
[0127] For ease of understanding, further, Figure 2 , Figure 2 is a flow diagram of a transaction execution process displayed by a time axis provided by an embodiment of the present application. Wherein, the transaction here can include transaction A1 and transaction A2 as shown in Figure 2 , which can be collectively referred to as the first transaction corresponding to the first transaction information extracted from the above data processing request.
[0128] Wherein, for ease of understanding, the first transaction is taken as transaction A1 by an embodiment of the present application, and the specific process of locating the to-be-processed tuple (for example, tuple Y1 and tuple Y2 as shown in Figure 2 ) through the index file in the process of executing the transaction A1 is described.
[0129] Wherein, in Figure 2The time axis shows the different stages of the first transaction (e.g., transaction A1), which can include Figure 2 The transaction A1 start stage, the transaction A1 execution stage, the metadata modification stage, and the transaction A1 commit stage are shown.
[0130] It can be understood that at the beginning of transaction A1, the computer device needs to start the first transaction (e.g., transaction A1) through a thread (i.e., the first thread) in the thread pool to enter Figure 2 The transaction A1 start stage is shown. At this time, the computer device can execute step S11 through the first thread to configure a transaction start timestamp T11 for transaction A1, and then can configure the transaction state of the first transaction (e.g., transaction A1) as a transaction execution state when executing the first transaction (e.g., transaction A1) based on the transaction start timestamp, where the transaction execution state represents that the first transaction (e.g., transaction A1) is currently entering Figure 2 The transaction A1 execution stage is shown.
[0131] It can be understood that the embodiments of the present application can configure the transaction start timestamp as the instruction timestamp corresponding to one or more data processing instructions in the first transaction information when executing the first transaction, so that subsequent Figure 2 When the index file is located to the storage state set of the target tuple, the storage timestamp corresponding to each storage state in the storage state set of the target tuple can be obtained, and then the time sequence relationship between the obtained storage timestamp corresponding to each storage state and the instruction timestamp can be used to determine whether there is a target storage state of the target tuple in each storage state, and if so, the target tuple can be executed in the target storage state of the target tuple. The target tuple is executed in the target storage state of the target tuple. Thus, the computer device can determine whether all target tuples in the read set required for executing the first transaction have been accessed during the execution of the first transaction Figure 2 The metadata modification stage is shown. If all target tuples in the read set have been accessed, it can be determined that all operations of the first transaction (e.g., transaction A1) have been completed, and then step S16 can be executed Figure 2 The transaction A1 commit stage is shown. Figure 2
[0132] As shown in Figure 2 The computer device can execute step S12 in the transaction A1 execution stage to locate the tuple address of tuple Y1 and / or the tuple address of tuple Y2 through the index file during the execution of transaction A1.
[0133] It should be understood that the tuple Y1 and the tuple Y2 herein are the to-be-processed tuples corresponding to the to-be-matched index pair extracted from the above data processing request and requiring tuple positioning.
[0134] In the step S12, the computer device can identify the tuple identifier of the tuple Y1 and the tuple identifier of the tuple Y2 (for example, the to-be-matched index identifier of the tuple Y1 and the to-be-matched index identifier of the tuple Y2) respectively, and then find the target index identifier matching the two to-be-matched index identifiers in the index file.
[0135] In an implementation, the target index set herein can include, but is not limited to, an index set for mapping the to-be-matched index identifier of the tuple Y1 (for example, the index set C1 shown in Figure 2 In another implementation, the target index set herein can also include a same index set for mapping the to-be-matched index identifier of the tuple Y1 and the to-be-matched index identifier of the tuple Y2 (for example, the index set C3 shown in Figure 2
[0136] In another implementation, the target index set herein can also include a same index set for mapping the to-be-matched index identifier of the tuple Y1 and the to-be-matched index identifier of the tuple Y2 (for example, the index set C3 shown in Figure 2
[0137] If the target index identifier matching the to-be-matched index identifier is found in the index file (for example, the target index set in the index file), it can be quickly determined that the target tuple corresponding to the target index identifier exists in the tuple heap shown in Figure 2 Figure 2 If the target index identifier matching the to-be-matched index identifier is found in the index file (for example, the target index set in the index file), it can be quickly determined that the target tuple corresponding to the target index identifier exists in the tuple heap shown in
[0138] For example, as shown in Figure 2 Figure 2 The computer device determines the tuple address of the tuple Y1 (for example, the tuple address can include one or more storage addresses of the tuple Y1 configured by the tuple space manager, for example, can specifically include the storage address of the initial storage state and the storage address of the update storage state of the tuple Y1) by locating the tuple address of the tuple Y1 in the index file (for example, the index file address of the index file shown in the figure) and the storage address offset corresponding to the target index identifier pre-stored in the index file of the non-volatile storage space, and then reads one or more storage states of the tuple Y1 through the located tuple address of the tuple Y1. This means that at this time, the computer device can further execute Figure 2 The computer device reads or updates the tuple data of the tuple Y1 in the tuple heap through the located tuple address of the tuple Y1 in step S13 (that is, reads or updates the tuple data of the tuple Y1 in the tuple heap through the tuple address of the tuple Y1). Figure 2 The field value of the tuple data field in the storage state data of the corresponding storage state of the tuple Y1, for example, Figure 2 The tuple data of the tuple Y1 in the tuple heap.
[0139] Optionally, as Figure 2 The computer device can jump to execute step S14 if the tuple address of another tuple (for example, the tuple Y2 shown in the figure) is not located in the index file after step S12 is executed. Figure 2 Figure 2 The computer device allocates the tuple Y2 with the tuple storage space 41a through the tuple space manager if the tuple address of the tuple Y2 is not located in the index file in step S14, and then inserts the tuple Y2 in the tuple heap through step S15. Figure 2
[0140] It should be understood that when the tuple (for example, the tuple Y2 shown in the figure) is first inserted in the tuple heap, the tuple space manager can allocate the tuple Y2 with the tuple storage space (for example, the tuple storage space 41a shown in the figure). Figure 2 Figure 2 The tuple storage space 41a) is shown, and the storage address of the first version (i.e., the initial storage state) of the tuple Y2 inserted into the tuple heap can be stored through the allocated tuple storage space 41a), so that the storage address of the first version (i.e., the initial storage state) can be identified as the corresponding tuple storage address of the target index of the tuple Y2, so that when the computer device calculates the offset between the tuple storage address and the index storage address in real time through the corresponding tuple storage address of the target index of the tuple Y2 and the index file address of the index file of the target index of the tuple Y2, the offset calculated in real time is added to the index file as the storage address offset of the target index of the tuple Y2, so that when the tuple Y2 needs to be accessed when other transactions are executed subsequently, the tuple address of the tuple Y2 can be located and addressed through the pre-stored storage address offset of the target index of the tuple Y2 in the index file.
[0141] Here, the tuple version of the tuple Y2 (for example, the first version of the tuple Y2, that is, the initial storage state of the tuple Y2) is the version created by the first transaction (for example, Figure 2 Transaction A1) currently being executed, so before the tuple Y2 is inserted into the tuple heap during the execution of the transaction A1, the first version (i.e., the initial storage state) of the tuple Y2 needs to be created according to the storage state data corresponding to the storage state of each tuple in the tuple heap, and then the first version (i.e., the initial storage state) of the tuple Y2 created can be inserted into Figure 2 The tuple heap shown.
[0142] In addition, in an implementable manner, for example, it should be understood that in Figure 2 The tuple heap shown, the tuple version of the tuple Y1 can be a cyclic double version composed of two versions (for example, the initial storage state and the updated storage state), and the two versions (for example, the initial storage state and the updated storage state) in the cyclic double version can be versions created by another transaction (for example, a second transaction) before the first transaction (for example, Figure 2 Transaction A1) is committed.
[0143] For ease of understanding, further, Figure 2 , Figure 2 is a structural diagram of a cyclic double version composed of two storage states provided by an embodiment of the present application. The cyclic double version here refers to two versions (i.e., two storage states) stored for the same tuple, and the two versions (i.e., two storage states) here can be Figure 2 The initial storage state and the updated storage state shown. As Figure 2As shown, the initial storage state data corresponding to the initial storage state and the updated storage state data corresponding to the updated storage state each include a plurality of fields.
[0144] Here, the plurality of fields can specifically include Figure 2 As shown, field 5a (i.e., address offset field, for example, Figure 2 As shown, "Version Offset"), field 5b (i.e., transaction modification information field, for example, Figure 2 As shown, "Txn Inf"), field 5c (i.e., atomic lock field, for example, Figure 2 As shown, "Atomic"), field 5d (i.e., modification type field, for example, Figure 2 As shown, "Inf Type"), field 5e (i.e., storage time field, for example, Figure 2 As shown, "Wts"), field 5f (i.e., deletion flag field, for example, Figure 2 As shown, "Delete"), field 5g (i.e., tuple identification field, for example, Figure 2 As shown, "TupeID"), and field 5h (i.e., tuple data field, for example, Figure 2 As shown, "Tupe Data", which can be referred to as "Data" for short.
[0145] It can be understood that, for any two versions of the same tuple (e.g., tuple Y1 shown above), the version data structures (i.e., storage state data corresponding to the two storage states respectively) of the two versions can be divided into a tuple header and a tuple tail. For example, the embodiments of the present application can collectively refer to the seven fields from field 5a to field 5g in the storage state data corresponding to the corresponding storage state as the tuple header of the tuple (e.g., tuple Y1 shown above), and collectively refer to field 5h as the tuple tail of the tuple (e.g., tuple Y1 shown above), where the tuple tail is specifically used to store the tuple data of the tuple. Figure 2 Figure 2 Figure 2 Figure 2 Figure 2
[0146] It can be understood that the tuple header specifically can include the field value of field 5g (i.e., the field value of the tuple identification field, such as tuple ID), the field value of field 5f (i.e., the field value of the deletion marker field, i.e., a kind of invalid version for identifying the current version as a version that can be recycled), the field value of field 5e (i.e., the field value of the storage time field, for example, a storage timestamp), the field value of field 5b (i.e., the field value of the transaction modification information field, for example, information of a modification transaction), the field value of field 5a (i.e., the field value of the address offset field, i.e., a kind of offset for indexing another version) and the field value of field 5c (i.e., the field value of the atomic lock field, i.e., an atomic Boolean value for locking the version being modified by the current transaction).
[0147] It can be understood that for a 64-bit tuple ID, the tuple ID can be split to be represented as the above-mentioned Figure 2 The field value of the deletion marker field and the field value of the tuple identification field for identifying the tuple shown in the figure, the mask processing here refers to that the bit (i.e., 1 bit) in the field value of the deletion marker field can be multiplied by each bit (i.e., each bit in 63 bits) in the field value of the tuple identification field by bit-by-bit multiplication to obtain a mask processing result.
[0148] For example, the highest bit (e.g., the first bit) in the tuple ID can be used as a deletion marker, for example, when the highest bit is "0", the mask processing (i.e., bit-by-bit multiplication) can be performed on the split field value of the deletion marker field and the field value of the tuple identification field to obtain a mask processing result.
[0149] In an implementation manner, if the mask processing result indicates that the field value of the tuple identification field (i.e., the value on 63 bits) is all "0", it can be indicated that the version where the tuple ID is located is a null version after the current version deletion, and optionally, if the mask processing result indicates that the field value of the tuple identification field (i.e., the value on 63 bits) is not all "0", it can be indicated that the version where the tuple ID is located is a current readable and updateable tuple version.
[0150] In addition, it can be understood that the field value of the storage time field (for example, the storage timestamp) and the field value of the transaction modification information field (for example, the information of the modification transaction (for example, the transaction identifier or the transaction pointer)) involved in the embodiments of the present application can be used for concurrent control and fault recovery. For example, the size of the storage timestamp can be used to reasonably and accurately distinguish, in the circular double version, which version of the same tuple (that is, the initial storage state and the updated storage state) is the old version (that is, the initial storage state) and which version is the new version (that is, the updated storage state). For example, the version (that is, the storage state) with a small storage timestamp (that is, Wts) can be regarded as the old version in the circular double version, and the version (that is, the storage state) with a large storage timestamp (that is, Wts) can be regarded as the new version in the circular double version.
[0151] In the embodiments of the present application, the transaction pointer in the information of the modification transaction helps to determine whether the current transaction (for example, the transaction A1) is in the commit phase. For example, if the field value of the modification transaction information field in the version data structure of the new version is the transaction pointer of the current transaction, it means that the current transaction is still in the execution phase. On the contrary, if the field value of the modification transaction information field in the version data structure of the new version is the transaction identifier (that is, the transaction number, for example, the transaction ID) of the current transaction, it means that all operations of the current transaction (for example, the transaction A1) have been executed, and then the commit phase of the current transaction can be determined by the above-mentioned Figure 2 As shown in step S17, the transaction identifier (that is, Txn1) of the transaction A1 is submitted to the transaction commit log list 4a. In other words, before performing step S17, the embodiments of the present application can store the field value of the modification transaction information field in the tuple version modified by the current transaction as the transaction ID (for example, Txn1 as shown in step S16), and then when performing step S17, the transaction ID (for example, Txn1 as shown in step S16) can be submitted to the transaction commit log list 4a as shown in step S17. Figure 2 As shown in step S17, the transaction identifier (that is, Txn1) of the transaction A1 is submitted to the transaction commit log list 4a. In other words, before performing step S17, the embodiments of the present application can store the field value of the modification transaction information field in the tuple version modified by the current transaction as the transaction ID (for example, Txn1 as shown in step S16), and then when performing step S17, the transaction ID (for example, Txn1 as shown in step S16) can be submitted to the transaction commit log list 4a as shown in step S17. Figure 2 As shown in step S17, the transaction identifier (that is, Txn1) of the transaction A1 is submitted to the transaction commit log list 4a. In other words, before performing step S17, the embodiments of the present application can store the field value of the modification transaction information field in the tuple version modified by the current transaction as the transaction ID (for example, Txn1 as shown in step S16), and then when performing step S17, the transaction ID (for example, Txn1 as shown in step S16) can be submitted to the transaction commit log list 4a as shown in step S17. Figure 2 As shown in step S17, the transaction identifier (that is, Txn1) of the transaction A1 is submitted to the transaction commit log list 4a. In other words, before performing step S17, the embodiments of the present application can store the field value of the modification transaction information field in the tuple version modified by the current transaction as the transaction ID (for example, Txn1 as shown in step S16), and then when performing step S17, the transaction ID (for example, Txn1 as shown in step S16) can be submitted to the transaction commit log list 4a as shown in step S17.
[0152] As shown in step S17, the transaction identifier (that is, Txn1) of the transaction A1 is submitted to the transaction commit log list 4a. In other words, before performing step S17, the embodiments of the present application can store the field value of the modification transaction information field in the tuple version modified by the current transaction as the transaction ID (for example, Txn1 as shown in step S16), and then when performing step S17, the transaction ID (for example, Txn1 as shown in step S16) can be submitted to the transaction commit log list 4a as shown in step S17. Figure 2As shown in Txn1), in the case of a failure of the computer device, the transaction identifier can be used to implement failure recovery, for example, the transaction commit log list 4a can be read through the list address of the transaction commit log list 4a stored in the above-mentioned directory file, and then the tuple version (for example, the storage state Y12 of the above-mentioned tuple Y1) carrying the transaction identifier of the transaction A1 can be indexed in the NVM space through the transaction identifier of the transaction A1 recorded in the transaction commit log list 4a, and then another tuple version (for example, the above-mentioned tuple storage state Y11) of the tuple Y1 can be quickly indexed through the address offset corresponding to the indexed tuple version (for example, the above-mentioned tuple Y1 storage state Y12), so as to ensure that all tuple versions (i.e., the storage state set of the tuple) of all tuples (for example, the tuple Y1) associated with the transaction A1 can be quickly accessed during failure recovery.
[0153] It should be understood that after the computer device completes step S15, it can detect whether all operations of the transaction A1 have been completed at present, and then when it is detected that all operations of the transaction A1 have been completed at present, step S16 is further executed, the transaction end timestamp T12 is configured for the transaction A1 when all operations of the transaction A1 are completed, and the storage timestamp (Wts) of the tuple Y2 created by the transaction A1 is configured as the transaction end timestamp T12, so that subsequently in the storage state data corresponding to the storage state of the tuple Y2 created by the transaction A1, the transaction identifier of the transaction A1 generated at present can be further stored after the transaction identifier of the transaction A1 is stored, and the above-mentioned Figure 2 As shown in step S17.
[0154] The specific implementation of the transaction A2 at different stages can be jointly referred to the description of the specific process of executing the transaction A1 through the above-mentioned steps S11-S17, which will not be described here.
[0155] The non-volatile storage space includes a directory file, and the directory file stores an index storage address of an index file. When the computer device determines that the first transaction is being executed based on the transaction execution state, the computer device can obtain the index file through the index storage address in the directory file. Further, the computer device can obtain a plurality of index sets for hash indexing from the index file. One index set corresponds to one set identifier. Further, the computer device can perform hash calculation on the to-be-matched index identifier to obtain an index hash value of the to-be-matched index identifier, and can perform remainder calculation on the number of the plurality of index sets through the index hash value to obtain a remainder of the index hash value. Further, the computer device can find a set identifier that matches the remainder of the index hash value in a plurality of set identifiers corresponding to the plurality of index sets, and determine an index set corresponding to the found set identifier as a target index set for mapping the to-be-matched index identifier.
[0156] For ease of understanding, further, Figure 2 , Figure 2 is a scenario diagram provided by an embodiment of the present application for determining a target index set in an index file. As Figure 2 indicated, when the computer device obtains the directory file 2a stored in the NVM space, the computer device can perform step S21 shown in Figure 2 to obtain the index file 2c through the index file address. The index file address can be an index address pre-stored in the target file 2a in the non-volatile storage space for obtaining the index file 2c, for example, addr1 shown in Figure 2 . As Figure 2 indicated, the plurality of index sets in the index file 2c can include index set C1, index set C2, index set C3, and index set C4.
[0157] It should be understood that each index set herein is configured to pre-store a set of index identifiers of each tuple. This means that the index set involved in the present application is determined after the index identifiers of the corresponding tuples in the tuple heap are respectively identified and mapped, and is used to pre-store the index identifiers of the corresponding tuples. It should be understood that the index set herein, while pre-storing the index identifiers of the corresponding tuples, also pre-stores the address offset in the storage state data corresponding to the specific storage state (for example, the initial storage state) of the tuple, and the pre-stored address offset in the storage state data corresponding to the specific storage state (for example, the initial storage state) of the corresponding tuple can be collectively referred to as the address offset corresponding to the index identifier of the corresponding tuple.
[0158] For example, such as Figure 2 As shown, for each index set in the index file (e.g., index set C3), index set C3 can be used to pre-store the index identifiers of one or more tuples. Specifically, as... Figure 2 As shown, the index identifiers of multiple tuples here can specifically include the index identifier of tuple Y1 (e.g., Figure 2 The tuple ID1 shown and the address offset corresponding to the index identifier of the tuple Y1 (e.g., Figure 2 The address offset shown is 1), and the index identifier of tuple Y2 is (e.g., Figure 2 The tuple ID2 shown and the address offset corresponding to the index identifier of the tuple Y2 (e.g., Figure 2 The address offset 2 shown), ..., and the index identifier of tuple Y3 (e.g., Figure 2 The tuple ID3 shown and the address offset corresponding to the index identifier of the tuple Y3 (e.g., Figure 2 The address offset shown is 3).
[0159] Therefore, when the computer device obtains the index identifier of the tuple to be matched that needs to be queried (e.g., Figure 2 When the tuple identifier shown is the index identifier of tuple ID3, the matching index identifier can be executed. Figure 2 Step S22, as shown, involves performing a hash calculation to obtain the index hash value of the index identifier to be matched (e.g., Figure 2 As shown in the diagram (assuming H3 = 7), furthermore, the computer device can... Figure 2 The number of sets of multiple indexes shown (e.g., 4) is used to perform step S23 on the index hash value, performing a modulo operation to calculate the remainder of the index hash value (e.g., ...). Figure 2 F3, as shown, refers to the remainder obtained by taking the remainder of H3 (e.g., F3 = 3). At this point, the computer device can execute step S24 to find the set identifier that matches the remainder, and determine the index set corresponding to the found set identifier as the target index set. For example, the target index set could be something like... Figure 2 The set shown is index set C3, which corresponds to set C3 (for example, C3 = 3).
[0160] Alternatively, in one possible implementation, such as Figure 2 As shown, considering that the directory file also stores the table address of the business table where the tuple heap is located (for example, Figure 2 As shown in addr3). Therefore, before the computer device reads the index file 2c via the index file address, it also includes pre-building the index file 2c for indexing in non-volatile storage space. The specific steps for building the index file 2c are as follows:
[0161] The computer device can create an index file with an initial index address as an index file address in the NVM space, and configure a plurality of initial sets in the index file. Since the initial index address of the index file has not been added to the directory file at this time, it is necessary to establish an address mapping relationship between the table address and the index file address before mapping and storing the tuple identifier of each tuple in the business table into the index file. In this way, when the computer device obtains the business table through the table address (for example, addr3) in the directory file, it can obtain the tuple heap in the business table, and can obtain the to-be-mapped tuple (for example, tuple Y1) for identifier mapping from a plurality of tuples contained in the tuple heap, and determine the tuple identifier (for example, tuple ID1) of the to-be-mapped tuple (for example, tuple Y1) as the to-be-mapped tuple identifier. Further, the computer device can obtain the index file through the index file address when obtaining the index file address corresponding to the table address through the address mapping relationship, and can obtain a plurality of initial sets in the index file. The initial set here refers to a set that can be used for identifier mapping. Further, the computer device can perform identifier mapping on the to-be-mapped tuple identifier, and store the to-be-mapped tuple identifier into a target initial set (for example, index set C3) in the plurality of initial sets according to the identifier mapping result. The target initial set here refers to a set that has mapped at least one tuple identifier. Further, when the tuple identifier of each tuple in the tuple heap is selected as the to-be-mapped tuple identifier for identifier mapping, the computer device can confirm that the mapping and storage of each tuple identifier in the tuple heap into the plurality of initial sets is completed, and the plurality of initial sets that have completed mapping and storage are used as a plurality of index sets (for example, index set C1, index set C2, index set C3, and index set C4). Further, the computer device can update the index storage address (for example, addr1) of the index file (for example, index file 2c) in which the plurality of index sets are located to the directory file (for example, directory file 2a). Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2
[0162] The specific process of mapping the to-be-mapped tuple identifier to the target initial set by identifier mapping can be described as follows: the computer device can perform hash calculation on the to-be-mapped tuple identifier (for example, tuple ID1) to obtain a to-be-mapped index hash value of the to-be-mapped tuple identifier; further, the computer device can perform remainder calculation on the number of sets of the plurality of initial sets by using the to-be-mapped index hash value to obtain a remainder (for example, 3) of the to-be-mapped index hash value; further, the computer device can find, in the plurality of initial sets, an initial set corresponding to the set identifier consistent with the remainder (for example, 3) of the to-be-mapped index hash value, take the found initial set as the target initial set (for example, the index set C3 with the set identifier 3), and determine the target initial set as the identifier mapping result obtained after identifier mapping is performed on the to-be-mapped tuple identifier; further, the computer device can add and store, according to the identifier mapping result, an index item corresponding to the to-be-mapped tuple identifier to the target initial set; the index item corresponding to the to-be-mapped tuple identifier is used to store a key-value pair with the to-be-mapped tuple identifier (for example, tuple ID1) as the key and an initial storage address offset (for example, address offset 1) corresponding to the initial storage state of the to-be-mapped tuple as the value; the initial storage state of the to-be-mapped tuple here refers to the storage state first constructed for storing the to-be-mapped tuple when the to-be-mapped tuple is inserted into the tuple heap, that is, the initial storage state of the to-be-mapped tuple here is essentially the first version of the tuple data storing the to-be-mapped tuple. Figure 2 The specific process of mapping the to-be-mapped tuple identifier to the target initial set by identifier mapping can be described as follows: the computer device can perform hash calculation on the to-be-mapped tuple identifier (for example, tuple ID1) to obtain a to-be-mapped index hash value of the to-be-mapped tuple identifier; further, the computer device can perform remainder calculation on the number of sets of the plurality of initial sets by using the to-be-mapped index hash value to obtain a remainder (for example, 3) of the to-be-mapped index hash value; further, the computer device can find, in the plurality of initial sets, an initial set corresponding to the set identifier consistent with the remainder (for example, 3) of the to-be-mapped index hash value, take the found initial set as the target initial set (for example, the index set C3 with the set identifier 3), and determine the target initial set as the identifier mapping result obtained after identifier mapping is performed on the to-be-mapped tuple identifier; further, the computer device can add and store, according to the identifier mapping result, an index item corresponding to the to-be-mapped tuple identifier to the target initial set; the index item corresponding to the to-be-mapped tuple identifier is used to store a key-value pair with the to-be-mapped tuple identifier (for example, tuple ID1) as the key and an initial storage address offset (for example, address offset 1) corresponding to the initial storage state of the to-be-mapped tuple as the value; the initial storage state of the to-be-mapped tuple here refers to the storage state first constructed for storing the to-be-mapped tuple when the to-be-mapped tuple is inserted into the tuple heap, that is, the initial storage state of the to-be-mapped tuple here is essentially the first version of the tuple data storing the to-be-mapped tuple.
[0163] It can be understood that the computer device can separate the tuple data in the tuple heap from the tuple identifier by using the index file and the tuple heap deployed in the non-volatile storage space, for example, the computer device can store the tuple data of each tuple in the NVM space by using the tuple heap, and can separate and store the tuple identifier of each tuple by using the index file, wherein the specific implementation of the computer device performing hash calculation, remainder calculation, and remainder matching on the to-be-mapped tuple identifier can be referred to the description of the specific process of performing steps S22-S24 on the to-be-matched index identifier in the above Figure 2 The specific process of mapping the to-be-mapped tuple identifier to the target initial set by identifier mapping can be described as follows: the computer device can perform hash calculation on the to-be-mapped tuple identifier (for example, tuple ID1) to obtain a to-be-mapped index hash value of the to-be-mapped tuple identifier; further, the computer device can perform remainder calculation on the number of sets of the plurality of initial sets by using the to-be-mapped index hash value to obtain a remainder (for example, 3) of the to-be-mapped index hash value; further, the computer device can find, in the plurality of initial sets, an initial set corresponding to the set identifier consistent with the remainder (for example, 3) of the to-be-mapped index hash value, take the found initial set as the target initial set (for example, the index set C3 with the set identifier 3), and determine the target initial set as the identifier mapping result obtained after identifier mapping is performed on the to-be-mapped tuple identifier; further, the computer device can add and store, according to the identifier mapping result, an index item corresponding to the to-be-mapped tuple identifier to the target initial set; the index item corresponding to the to-be-mapped tuple identifier is used to store a key-value pair with the to-be-mapped tuple identifier (for example, tuple ID1) as the key and an initial storage address offset (for example, address offset 1) corresponding to the initial storage state of the to-be-mapped tuple as the value; the initial storage state of the to-be-mapped tuple here refers to the storage state first constructed for storing the to-be-mapped tuple when the to-be-mapped tuple is inserted into the tuple heap, that is, the initial storage state of the to-be-mapped tuple here is essentially the first version of the tuple data storing the to-be-mapped tuple.
[0164] Step S103, in response to finding the target index identifier, determining the index storage address and the storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space, the storage address offset being the offset between the index storage address and the tuple storage address of the target tuple corresponding to the target index identifier;
[0165] The tuple storage address of the target tuple is the storage address of an initial storage state of the target tuple, the initial storage state is a storage state in the plurality of storage states, the index file deployed in the non-volatile storage space includes a target index set used for mapping a target index identifier, in a target index item corresponding to the target index identifier pre-stored in the target index set, a target key-value pair is stored, the target key-value pair takes the target index identifier as a key and takes an initial storage address offset in initial storage state data corresponding to the initial storage state as a value; the initial storage address offset refers to an offset between an index file address of the index file and the storage address of the initial storage state of the target tuple; the initial storage state of the target tuple refers to a storage state used for storing the target tuple that is first constructed when the target tuple is inserted into the tuple heap; the index file address of the index file is an index storage address corresponding to the target index identifier; at this time, the computer device can acquire, in the target index set of the index file, a target index item corresponding to the target index identifier (for example, the index identifier of the tuple identifier tuple ID3 shown in the above Figure 2 ), the target key-value pair (for example, the tuple ID3: address offset 3 shown in the above Figure 2 ) from the target index item; further, the computer device can determine the initial storage address offset (for example, the address offset 3 corresponding to the tuple ID3) acquired from the target key-value pair as a storage address offset corresponding to the target index identifier; further, the computer device can determine, when the target index identifier is an index identifier in the index file (for example, the index file 2c shown in the above Figure 2 ), an index storage address corresponding to the target index identifier by using an index file address (for example, addr1 shown in the above Figure 2 ) of the index file pre-stored in a directory file (for example, the directory file 2a shown in the above Figure 2 ) in the non-volatile storage space.
[0166] In other words, the embodiments of the present application can collectively refer to the index addresses of each index identifier pre-stored in the index file as the index storage addresses corresponding to each index identifier, and the index storage addresses corresponding to each index identifier are all the index file addresses of the same index file in which the index identifiers are located.
[0167] In step S104, the tuple storage address is determined by using the storage address offset and the index storage address, so as to determine a storage state set of the target tuple, and the storage state set includes at least one storage state.
[0168] Specifically, the computer device can determine the storage address of the initial storage state of the target tuple by storing the address offset and the index storage address, and access the initial storage state of the target tuple through the storage address of the initial storage state of the target tuple (for example, Figure 2 The initial storage state data corresponding to the storage state Y11 shown in the figure; the initial storage state data at least includes an address offset field (for example, the above-mentioned Figure 2 Version Offset); further, if the field value of the address offset field is not a preset address offset value (for example, the preset address offset value here is "0"), and the field value of the address offset field is an initial storage address offset consistent with the storage address offset, the computer device can find an update storage address offset (for example, the above-mentioned Figure 2 The address offset V2 shown in the figure) having a first index relationship (for example, a pointing relationship from the address offset V1 to the address offset V2) with the initial storage address offset (for example, the above-mentioned Figure 2 The address offset V1 shown in the figure); the update storage address offset (for example, the above-mentioned Figure 2 The address offset V2 shown in the figure) refers to the offset between the index file address of the index file and the storage address of the update storage state of the target tuple; the update storage state is the next storage state of the initial storage state; further, the computer device can determine the storage address of the update storage state of the target tuple by the update storage address offset and the index file address in response to finding the update storage address offset (for example, the above-mentioned Figure 2 The address offset V2 shown in the figure), and obtain the update storage state (for example, Figure 2 The storage state Y12 shown in the figure) having the first state linkage relationship with the initial storage state through the storage address of the update storage state of the target tuple; further, the computer device can find a target storage address offset having a second index relationship (here, the second index relationship is a pointing relationship different from the first index relationship) with the update storage address offset (for example, the above-mentioned Figure 2 The address offset V2 shown in the figure). It should be understood that in one implementation, if the found target storage address offset is the initial storage address offset, the computer device can determine that the storage state having the second state linkage relationship with the update storage state is the initial storage state, and then can determine the first state set for cyclically storing the target tuple composed of the initial storage state and the update storage state as the storage state set of the target tuple through the first state linkage relationship and the second state linkage relationship, so that the subsequent step S105 can be further executed;
[0169] The initial storage state and the updated storage state in the first state set can be used to form the above-mentioned cyclic double version. In the cyclic double version, once the address offset corresponding to one version (i.e., one storage state) is obtained, the address offset corresponding to another version can be quickly indexed through the address offset corresponding to the version currently obtained. For example, the embodiment of the present application can quickly obtain the address offset (e.g., the address offset V2 shown in FIG. 11) in the updated storage state data corresponding to the updated storage state through the index relationship (e.g., the first index relationship) between the address offset (e.g., the address offset V1 shown in FIG. 11) in the initial storage state data corresponding to the initial storage state (e.g., the storage state Y11 shown in FIG. 11) and the address offset (e.g., the address offset V2 shown in FIG. 11) in the updated storage state data corresponding to the updated storage state. The specific data structure of the initial storage state data corresponding to the initial storage state and the updated storage state data corresponding to the updated storage state can refer to the schematic diagram of the initial storage state data corresponding to the initial storage state and the updated storage state data corresponding to the updated storage state in the cyclic double version shown in FIG. 11. Figure 2 Figure 2 Figure 2 Figure 2 Figure 2
[0170] Optionally, in another implementable manner, if the tuple version of the target tuple includes the above-mentioned three versions (i.e., three storage states), when the target storage address offset found is not the initial storage address offset, the computer device can determine the storage state having the second state linkage relationship with the updated storage state as another storage state (i.e., the third storage state, such as a new updated storage state) different from the initial storage state, and then can continue to index the address offset (i.e., the third address offset) in the storage state data corresponding to the third storage state. At this time, once the new target storage address offset indexed with the third address offset is the above-mentioned initial storage address offset, it can be determined that the storage state having the third state linkage relationship with the third storage state is the initial storage state. Then, the state set for cyclically storing the target tuple formed by the initial storage state, the updated storage state and the new updated storage state (i.e., the third storage state) can be determined as the storage state set of the target tuple through the first state linkage relationship, the second state linkage relationship and the third state linkage relationship. At this time, the storage state set of the target tuple can include three versions of the target tuple.
[0171] It should be understood that, for the case that the storage state set of the target tuple contains three versions or even more versions (i.e., at least three storage states), the computer device indexes two versions (i.e., two storage states) of any two storage states in the at least three storage states that have a state linkage relationship. For details, refer to the description of the indexing manner of the two versions in the cyclic double version above, which will not be repeated here.
[0172] Optionally, it can be understood that, in the embodiment of the present application, if the field value of the address offset field (i.e., the address offset field described above, for example, Version Offset) in the initial storage state data corresponding to the initial storage state indexed currently is a preset address offset value (for example, "0"), the computer device can determine that only the initial storage state of the target tuple exists in the tuple heap, and the next storage state of the initial storage state of the target tuple does not exist yet; at this time, the computer device can determine the second state set for storing the target tuple composed of the initial storage state of the target tuple as the storage state set of the target tuple, which means that at this time, the storage state set of the target tuple contains one storage state, which can be the initial storage state described above.
[0173] In step S105, if the storage state set includes multiple storage states, the storage time stamps corresponding to the multiple storage states and the instruction time stamp corresponding to the data processing instruction are obtained.
[0174] It can be understood that, when the storage state set of the target tuple includes multiple storage states (for example, two storage states), the storage time stamps corresponding to the two storage states respectively can be obtained. In addition, since the one or more data processing instructions involved in the embodiment of the present application are instructions in the first transaction information carried in the data processing request, the computer device can configure a transaction start time stamp for the first transaction corresponding to the first transaction information when executing the first transaction, and then the transaction start time stamp configured for the first transaction can be used as the instruction time stamp corresponding to the one or more data processing instructions. This means that for each data processing instruction, the instruction time stamp corresponding to each data processing instruction is the transaction start time stamp.
[0175] For ease of understanding, further, refer to Figure 2 , Figure 2 is a flowchart of the read request-based read operation performed on the target tuple according to the embodiment of the present application. As Figure 2As shown, the computer device can execute step S31 to obtain a read request. Here, a read request refers to a data processing request of type read obtained by the computer device. This read request carries one or more tuple identifiers that need to be indexed. The tuples corresponding to these one or more index identifiers are the tuples to be processed that need to be located and read through the read request. In this embodiment, these tuple identifiers of the tuples to be processed can be collectively referred to as the index identifiers to be matched. Further, the computer device can execute step S32 to read the index file and locate the tuples corresponding to the index identifiers to be matched based on the index file. The specific implementation method of tuple location by the computer through the index file can be found in the description of the specific process of identifier mapping, identifier lookup, and tuple location through the index file described above, and will not be repeated here.
[0176] Furthermore, after tuple location, the computer device can further execute step S33 to determine whether the tuple exists. If the determination is no, step S34 can be executed to perform transaction rollback. That is, in this embodiment of the application, the first transaction requested by the read request can be rolled back immediately.
[0177] Optionally, if the determination is yes, then step S35 can be further executed to determine whether two versions exist. If the determination is no, it means that only a single version of the tuple (i.e., the initial storage state mentioned above) exists in the tuple heap at this time. Therefore, step S36 can be further executed to determine whether Wts is greater than the transaction start timestamp. That is, at this time, the computer device needs to obtain the storage time field (i.e., the initial storage state) from the initial storage state data corresponding to the single version (i.e., the initial storage state) of the target tuple according to the read request. Figure 2 The field value of Wts shown can then be used to obtain the storage time field (i.e., the one mentioned above). Figure 2 The value of the Wts field shown is used as the storage timestamp corresponding to the initial storage state. It can be understood that the initial storage state of the target tuple refers to the storage state that first stores the tuple data before multiple storage states are constructed, and the value of the storage time field of the initial storage state of the target tuple is the initial storage timestamp corresponding to that initial storage state. Then, the computer device can compare the initial storage timestamp corresponding to this initial storage state with the transaction start timestamp (i.e., the instruction timestamp corresponding to the read instruction of the read type, for example, specifically the instruction start timestamp) to obtain the first comparison result.
[0178] Furthermore, such as Figure 2As shown, if it is determined that Wts (i.e., Wts in the initial storage state data corresponding to the initial storage state of the target tuple) is greater than the transaction start timestamp, it means that the initial storage state of the target tuple was created after the execution of the first transaction. Therefore, the initial storage state of the target tuple cannot be read during the execution of the first transaction, so step S37 needs to be executed to roll back the transaction. Conversely, optionally, as... Figure 2 As shown, if it is determined that Wts (i.e., Wts in the initial storage state data corresponding to the initial storage state of the target tuple) is not greater than (i.e., less than or equal to) the transaction start timestamp, it indicates that the initial storage state of the target tuple was created before the execution of the first transaction. Therefore, during the execution of the first transaction, the initial storage state of the target tuple can be read, and thus step S38 can be further executed to read the version of the tuple whose Wts is not greater than the transaction start timestamp. This means that at this time, the computer device can read the initial storage state of the target tuple during the execution of the first transaction. In other words, in this embodiment, if the first comparison result indicates that the initial storage state timestamp is less than or equal to the transaction start timestamp (i.e., the instruction timestamp, specifically the instruction start timestamp), the computer device can read the tuple data of the target tuple from the initial storage state data corresponding to the initial storage state of the target tuple according to the read type.
[0179] It should be understood that, in the embodiments of this application, when the first transaction is completed, a transaction end timestamp can be configured for the first transaction, and the transaction end timestamp can be determined as the instruction end timestamp corresponding to the read instruction in the currently acquired data processing request.
[0180] Optionally, after executing step S35, the computer device may further execute step S39 if it determines that two versions exist (e.g., a cyclic double version consisting of the initial storage state and the updated storage state). This involves determining whether the transaction start timestamp is between the Wts of the two versions. If so, step S40 can be further executed to read the version of the tuple whose Wts is less than the transaction start timestamp (e.g., the aforementioned initial storage state). Optionally, as... Figure 2As shown, if the judgment is no, further step S41 needs to be performed to judge whether the Wts of the version with larger Wts is smaller than the transaction start timestamp, if the judgment is yes, further step S42 can be performed to read the version of the tuple with largest Wts, it should be understood that at this time, the version of the tuple with largest Wts can be the above-mentioned update storage state. Conversely, if the judgment is no, i.e. in the case that the Wts of the version with larger Wts is not smaller than (i.e. larger than or equal to) the transaction start timestamp, further step S43 can be performed to perform version rollback. This means that at this time, both of the two versions for constituting the cyclic double version are created after the first transaction, so that the computer device cannot read the tuple data in the two versions when performing the first transaction.
[0181] The specific implementation of the computer device performing steps S39-S43 can be referred to step S106 below.
[0182] Step S106, based on the storage timestamps respectively corresponding to the plurality of storage states and the instruction timestamp corresponding to the data processing instruction, determining a target storage state corresponding to a target tuple in the plurality of storage states, and performing the instruction operation indicated by the data processing instruction on the target tuple in the target storage state.
[0183] If the plurality of storage states of the target tuple includes the initial storage state and the update storage state for constituting the cyclic double version, the embodiment of the present application can determine which one is the old version and which one is the new version in the cyclic double version by comparing the sizes of the Wts (i.e. the storage timestamps respectively corresponding to the two storage states) of the two versions. In order to facilitate the distinction, the embodiment of the present application can mark the Wts (i.e. the storage timestamp) corresponding to the initial storage state as Wts1 (i.e. the first storage timestamp), and mark the Wts (i.e. the storage timestamp) corresponding to the update storage state as Wts2 (the second storage timestamp). Wherein, one or more data processing instructions are instructions in the first transaction information carried in the data processing request; the instruction timestamp here refers to the transaction start timestamp configured by the computer device when starting the first transaction corresponding to the first transaction information; the tuple data of the target tuple in the initial storage state data corresponding to the initial storage state is the initial tuple data, and the tuple data of the target tuple in the update storage state data corresponding to the update storage state is the target tuple data;
[0184] Specifically, if the first storage timestamp is a preset first time threshold (for example, "0"), when the initial storage state is determined as the storage state with invalidity (i.e., the initial storage state is the invalid version), the second storage timestamp is compared with the transaction start timestamp to obtain a second comparison result; further, if the second comparison result indicates that the second storage timestamp is less than or equal to the transaction start timestamp, the computer device can determine the update storage state as the valid version (i.e., the target storage state corresponding to the target tuple); further, if the request type of the data processing request is the read type, the computer device can read the tuple data (i.e., the target tuple data) of the target tuple from the update storage state corresponding to the valid version (i.e., the target storage state corresponding to the target tuple) when performing the read operation indicated by the read type on the target tuple in the target storage state; or, alternatively, if the request type of the data processing request is the write type, the computer device can read the target tuple data of the target tuple from the update storage state data corresponding to the valid version (i.e., the target storage state corresponding to the target tuple) when performing the write operation indicated by the write type on the target tuple in the target storage state, and update the initial tuple data in the initial storage state data corresponding to the initial storage state with invalidity by using the read target tuple data of the target tuple and the transaction detail data indicated by the first transaction.
[0185] For ease of understanding, further, Figure 2 , Figure 2 is a flowchart of updating a target tuple based on a write request provided by an embodiment of the present application. As shown in Figure 2 , the computer device can perform step S51 to obtain a write request, where the write request refers to a data processing request of the write type obtained by the computer device, and the write request carries one or more tuple identifiers to be read, where the tuple corresponding to the one or more tuple identifiers to be read is the to-be-processed tuple; at this time, the tuple identifiers of the to-be-processed tuples are collectively referred to as to-be-indexed matching index identifiers. Further, the computer device can perform step S52 to read an index file and locate the tuple corresponding to the matching index identifier through the index file. The specific implementation of locating the tuple through the index file by the computer device can refer to the description of the specific process of identifying mapping and identifying searching and tuple locating involved in steps S102-S104 described above, which will not be repeated here.
[0186] Further, the computer device can further execute step S53 to determine whether the tuple exists after locating the tuple, and if the determination is no, the computer device can execute step S60 to allocate tuple storage space on the NVM and modify information of the modification transaction of the tuple, the tuple identifier, the deletion flag bit, and the Wts (i.e., the storage timestamp) after determining that the tuple corresponding to the to-be-matched index identifier currently queried does not exist in the tuple heap through the index file.
[0187] It should be understood that, when the computer device determines that the tuple corresponding to the to-be-matched index identifier currently queried does not exist in the tuple heap, the computer device can further detect an insertion operation for inserting a tuple in the instruction operation indicated by one or more data processing instructions in response to the target index identifier not being found. Then, the computer device can configure first tuple storage space for the to-be-processed tuple corresponding to the to-be-matched index identifier in the non-volatile storage space and create an initial storage state of the to-be-processed tuple in the first tuple storage space in response to the detected insertion operation, and further write tuple data of the to-be-processed tuple in the initial storage state data corresponding to the initial storage state. At this time, the value of the Wts is set to a preset second time threshold (for example, INF, i.e., infinity), where the INF is used to indicate that the transaction currently modifying the tuple is currently in a transaction execution state, i.e., has not been committed. Therefore, after the transaction currently modifying the tuple is committed, the formal value of the Wts will be updated, i.e., the value of the Wts will be updated from the INF to the transaction end timestamp of the transaction, thereby indicating that the transaction currently modifying the tuple has completed the modification of the initial storage state of the tuple.
[0188] Optionally, the computer device can further abort the execution of the first transaction when the target index identifier is not found and the insertion operation is not detected. In an implementable manner, the plurality of data processing instructions include a first data processing instruction and a second data processing instruction, the first transaction includes a first sub-transaction corresponding to the first data processing instruction and a second sub-transaction corresponding to the second data processing instruction, the tuple corresponding to the first sub-transaction is the to-be-processed tuple, and the tuple corresponding to the second sub-transaction is the associated processing tuple. The associated processing tuple is a tuple in the tuple heap. At this time, the computer device performs transaction rollback on the first transaction, which can be specifically described as follows: when the transaction state of the first transaction corresponding to the first transaction information is a transaction execution state, if the second sub-transaction is an executed transaction during the execution of the first sub-transaction, the execution of the first sub-transaction is aborted and the transaction modification operation performed on the second sub-transaction is revoked in the process of performing transaction rollback on the first transaction. The transaction modification operation here includes a write operation and / or a deletion operation on the tuple version of the associated processing tuple read by the second sub-transaction.
[0189] Further, the computer device can further configure the storage state of the associated processing tuple corresponding to the transaction modification operation as an invalid storage state; the invalid storage state is used to instruct the tuple manager deployed in the non-volatile storage space to add the associated tuple storage address of the associated processing tuple corresponding to the invalid storage state to the recycling space; the associated tuple storage address added in the recycling space is used to perform space reuse on the tuple storage space corresponding to the associated tuple storage address when space configuration is performed by the tuple manager.
[0190] It should be understood that, in the case where it is determined that the target tuple matching the to-be-processed tuple does not exist in the tuple heap, the computer device can further check whether the transaction operation indicated by the first transaction is an insertion operation. If the transaction operation is an insertion operation, the computer device can configure tuple storage space (i.e., the first tuple storage space) for the to-be-processed tuple in the NVM space, and can create initial storage state data corresponding to the initial storage state of the to-be-processed tuple in the first tuple storage space according to the fields (e.g., the address offset field, the transaction modification information field, the atomic lock field, the modification type field, the storage time field, the deletion flag field, the tuple identifier field, and the tuple data field) in the storage state data shown in FIG. 6, and insert the created initial storage state data corresponding to the initial storage state of the to-be-processed tuple into the tuple heap. Figure 2 When the initial storage state data corresponding to the initial storage state of the to-be-processed tuple is inserted into the tuple heap, the computer device modifies the metadata of the to-be-processed tuple, where the metadata can include but is not limited to the information of the modification transaction (i.e., the field value of the transaction modification information field), the tuple identifier (i.e., the field value of the tuple identifier field), the deletion flag bit (i.e., the field value of the deletion flag field), and the Wts (i.e., the field value of the storage time field), and then the computer device can jump to step S56 to complete the writing at the selected tuple version (e.g., the initial tuple data of the tuple can be written at the field value of the tuple data field), that is, the computer device can determine the initial storage state created when the to-be-processed tuple is inserted for the first time as a valid version (i.e., the target storage state) based on the request operation (e.g., the write operation) indicated by the write request, and then the computer device can take the valid version (i.e., the target storage state) as the current selected tuple version to complete the writing at the current selected tuple version.
[0191] Optionally, if the determination result is yes, that is, the computer device determines that the tuple exists in the tuple heap (i.e., the target tuple matching the to-be-processed tuple is found in the tuple heap), the computer device can further perform step S54 to determine whether two versions exist. The specific implementation of the computer device to determine whether two versions exist can be referred to the description of step S104, which will not be described in detail here.
[0192] In an implementation, if the determination is yes, step S57 can be performed to determine whether the Wts of the version with larger Wts is less than the transaction start timestamp. This means that at this time, the computer device can obtain the Wts of the two versions (i.e., the storage timestamps of the two versions, for example, the storage timestamp corresponding to the initial storage state can be Wts1, and the storage timestamp corresponding to the updated storage state can be Wts2) through step S105 described above. If Wts2>Wts1, it can be determined that the updated storage state is the new version, and the initial storage state is the old version. Therefore, when step S57 is performed, the field value of the storage time field (i.e., Wts2) in the updated storage state data corresponding to the updated storage state can be compared with the transaction start timestamp of the transaction (i.e., the first transaction) being executed at present, to determine whether the Wts of the version with larger Wts (e.g., the updated storage state) is less than the transaction start timestamp. If the determination is yes, it means that the updated storage state is the valid version (i.e., the target storage state) at this time, and therefore the version of the tuple with smaller Wts (i.e., the initial storage state) can be determined as the modifiable version. Then, step S58 can be performed to lock the version of the tuple with smaller Wts by means of the atomic lock, modify the information of the modification transaction and the Wts of the tuple, and then jump to step S56 to complete the writing at the selected tuple version. In other words, when performing the write operation indicated by the write request on the target tuple, the embodiment of the present application can read the target tuple data of the target tuple from the updated storage state data corresponding to the valid version (i.e., the version of the tuple with larger Wts, for example, the updated storage state), and modify the initial tuple data of the target tuple in the initial storage state data corresponding to the modifiable version (i.e., the version of the tuple with smaller Wts, for example, the initial storage state) in the locked state by means of the read target tuple data. At this time, the modifiable version herein refers to the version locked by means of the atomic lock.
[0193] Optionally, in another implementation, after performing step S57, if the determination is no, i.e., it is determined that the Wts of the version of the tuple with larger Wts (e.g., the updated storage state) is also not less than (i.e., greater than or equal to) the transaction start timestamp, it means that at this time, the two versions constituting the cyclic double version are both unreadable versions when the first transaction is executed, and therefore step S59 of transaction rollback needs to be performed on the first transaction.
[0194] Similarly, it can be understood that after the computer device performs step S54, if it is determined that the tuple exists in the tuple heap, but the tuple version of the tuple is not the cyclic double version, it can be determined that at this time, the storage state set of the tuple (i.e., the target tuple) existing in the tuple heap only includes the initial storage state of the target tuple, and the next version of the initial storage state of the target tuple does not exist. At this time, when the computer device performs the first tuple update on the target tuple based on the write request, it needs to perform step S55, allocate tuple storage space on the NVM, and modify the information of the modification transaction, the tuple identifier, the deletion flag bit, and Wts of the tuple. The specific implementation manner of the computer device for implementing the first tuple update through step S55 can be referred to the description of the specific implementation manner of the first tuple insertion in the tuple heap through step S60 described above, which will not be described here.
[0195] In other words, optionally, the embodiment of the application can also specifically perform the following steps when step S106 is performed: the computer device can compare the first storage timestamp with the transaction start timestamp and compare the second storage timestamp with the transaction start timestamp when the first storage timestamp is not the preset first time threshold, to obtain a third comparison result; further, if the third comparison result indicates that the first storage timestamp and the second storage timestamp are both less than or equal to the transaction start timestamp, the computer device can compare the second storage timestamp with the first storage timestamp when the request type of the data processing request is the write type, to obtain a fourth comparison result; further, if the fourth comparison result indicates that the second storage timestamp is greater than the first storage timestamp, the computer device can determine that the initial storage state is in the locked state and determine that the update storage state is the target storage state; further, the computer device can perform the write operation indicated by the write type on the target tuple in the target storage state, read the target tuple data from the update storage state data corresponding to the update storage state, and perform data update on the initial tuple data in the initial storage state data corresponding to the initial storage state in the locked state by using the read target tuple data and the transaction detail data indicated by the first transaction.
[0196] It can be seen that, when the data processing request is acquired, the application embodiment can acquire the to-be-matched index identifier and one or more data processing instructions from the data processing request. In this way, when the first transaction is executed, the computer device can perform identity mapping on the to-be-matched index identifier related to the first transaction, and then can determine the index set used to map the to-be-matched index identifier as the target index set in the plurality of index sets. Further, if the target index identifier matching the to-be-matched index identifier is found in the target index set, it can be determined that the target tuple matching the to-be-processed tuple exists in the tuple heap. It should be understood that the index file here is an index table in the non-volatile storage space, and the index file includes a plurality of index sets. The plurality of index sets are determined after identity mapping of the tuple identifier in the tuple heap in the non-volatile storage space. This means that when the index file used for indexing and the tuple heap used for data storage are deployed in the non-volatile storage space, the whole index file can be avoided by using each index set in the index file (for example, one index set can be a bucket), and then the whole table of the business table where the tuple heap is located can be avoided. In other words, the application embodiment can quickly locate and find the target index set in the non-volatile storage space by indexing the index file, so as to quickly find the target index identifier matching the tuple identifier (i.e. the to-be-matched index identifier) in the target index set. Further, the application embodiment can determine the index storage address (for example, the index file address described above) and the storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space in response to finding the target index identifier, and then calculate and determine the tuple storage address of the target tuple by using the storage address offset and the index storage address, so as to quickly determine at least one storage state in the storage state set of the target tuple by using the determined tuple storage address. For example, if the computer device determines that the storage state set of the target tuple includes a plurality of storage states, it can further acquire the storage time stamps corresponding to the plurality of storage states and the instruction time stamp corresponding to the data processing instruction (for example, the transaction start time stamp described above), and then determine the target storage state (i.e. the effective version described above) corresponding to the target tuple in the plurality of storage states by using the storage time stamps corresponding to the plurality of storage states and the instruction time stamp corresponding to the data processing instruction, and then execute the instruction operation indicated by the data processing instruction on the target tuple in the target storage state, thereby improving the operation execution efficiency.
[0197] Further, please refer to Figure 2 , Figure 2is a flowchart of another data processing method based on a nonvolatile storage space provided in the present application. The nonvolatile storage space includes a plurality of tuples, and the plurality of tuples are set to be respectively indexable by index identifiers pre-stored in the nonvolatile storage space. As shown in Figure 2 The method can at least include steps S201-S211:
[0198] Step S201, obtaining a data processing request, the data processing request carrying a to-be-matched index identifier and one or more data processing instructions;
[0199] Step S202, searching for a target index identifier matching the to-be-matched index identifier in the nonvolatile storage space;
[0200] Step S203, in response to finding the target index identifier, determining an index storage address corresponding to the target index identifier pre-stored in the nonvolatile storage space and a storage address offset, the storage address offset being an offset between the index storage address and a tuple storage address of a target tuple corresponding to the target index identifier;
[0201] Step S204, determining the tuple storage address by the storage address offset and the index storage address to determine a storage state set of the target tuple, the storage state set including at least one storage state;
[0202] Step S205, if the storage state set includes a plurality of storage states, obtaining a plurality of storage time stamps respectively corresponding to the plurality of storage states and an instruction time stamp corresponding to the data processing instruction;
[0203] Step S206, determining a target storage state corresponding to the target tuple in the plurality of storage states based on the plurality of storage time stamps respectively corresponding to the plurality of storage states and the instruction time stamp corresponding to the data processing instruction, and executing an instruction operation indicated by the data processing instruction on the target tuple in the target storage state.
[0204] The specific implementation of steps S201-S206 can refer to the description of the specific implementation of steps S101-S106 in the above Figure 2 corresponding embodiments, which will not be described here.
[0205] The one or more data processing instructions are instructions in first transaction information carried in the data processing request. Optionally, after the computer device executes step S204, if a request type of the data processing request includes a read type, the computer device can further execute steps S207-S211.
[0206] Step S207, if the storage state set of the target tuple only includes the initial storage state of the target tuple, and there is no next storage state of the initial storage state of the target tuple, the field value of the storage time field corresponding to the initial storage state of the target tuple is obtained from the initial storage state data corresponding to the initial storage state of the target tuple according to the read type; wherein the initial storage state of the target tuple refers to the storage state used for storing the tuple data of the target tuple for the first time before the multiple storage states are constituted, and the field value of the storage time field of the initial storage state of the target tuple is the initial storage timestamp;
[0207] Step S208, the transaction start timestamp of the first transaction corresponding to the first transaction information is obtained, and the transaction start timestamp is determined as the instruction start timestamp corresponding to the read instruction;
[0208] Step S209, the initial storage timestamp is compared with the instruction start timestamp to obtain a first comparison result;
[0209] It should be understood that after the computer device executes step S209, it can also execute the following step S210, or it can also jump to execute the following step S211.
[0210] Step S210, if the first comparison result indicates that the initial storage timestamp is less than or equal to the instruction start timestamp, the tuple data of the target tuple is read from the initial storage state data corresponding to the initial storage state of the target tuple according to the read type.
[0211] Step S211, if the first comparison result indicates that the initial storage timestamp is greater than the instruction start timestamp, the first transaction is rolled back.
[0212] Wherein, after the computer device executes step S204, it jumps to execute the specific implementation mode of steps S207-S211, which can be referred to the description of the specific implementation mode of steps S35-S38 in the above Figure 2 The specific implementation mode of steps S35-S38 after step S35 is executed in the above
[0213] Optionally, it can be understood that when performing step S205, the computer device can also be configured to further perform the following steps in the case that there are two versions and there is no invalid version in the two versions: when the first storage timestamp is not the preset first time threshold, the computer device can compare the first storage timestamp with the transaction start timestamp and compare the second storage timestamp with the transaction start timestamp to obtain a third comparison result; further, if the third comparison result indicates that the first storage timestamp and the second storage timestamp are both less than or equal to the transaction start timestamp, the computer device can compare the second storage timestamp with the first storage timestamp to obtain a fourth comparison result when the request type of the data processing request is a write type; further, if the fourth comparison result indicates that the second storage timestamp is greater than the first storage timestamp, the computer device can determine that the initial storage state is in the locked state and determine that the update storage state is the target storage state; further, the computer device can read the target tuple data from the update storage state data corresponding to the update storage state when performing the write operation indicated by the write type on the target tuple in the target storage state, and update the initial tuple data in the initial storage state data corresponding to the initial storage state in the locked state by using the read target tuple data and the transaction detail data indicated by the first transaction. Figure 2 The specific implementation of steps S39-S42 is described in the above-mentioned embodiments corresponding to step S40, and will not be repeated here.
[0214] Optionally, if the third comparison result indicates that the first storage timestamp is less than the transaction start timestamp and the second storage timestamp is greater than or equal to (i.e., not less than) the transaction start timestamp, the computer device can determine that the transaction start timestamp is between the first storage timestamp and the second storage timestamp, and then determine the version with the smaller storage timestamp (i.e., the initial storage state) as the valid version (i.e., the target storage state) based on the read type. At this time, the specific implementation of determining the valid version by the computer device through the third comparison result can be referred to the description of the above-mentioned embodiments corresponding to step S40, and will not be repeated here. Figure 2 The specific implementation of step S40 is described in the above-mentioned embodiments corresponding to step S40, and will not be repeated here.
[0215] Optionally, if the third comparison result indicates that neither the first storage timestamp nor the second storage timestamp is less than the transaction start timestamp, and the second storage timestamp is greater than the first storage timestamp, the computer device can determine, when executing the first transaction, that both versions (i.e., the initial storage state and the updated storage state) of the target tuple are unreadable versions, and thus needs to perform transaction rollback on the first transaction, for example, needs to immediately suspend execution of the first transaction.
[0216] For ease of understanding, the present application embodiment gives the related program code for concurrent access control through the double versions in the loop when the data processing request is a read request. Here, the double versions in the loop are tup1 and tup2 in the related program code, which can be specifically seen as follows:
[0217] Funtion txnRead(key, txn): / / get the request parameter as key from the read request The index identifier to be matched and the transaction information (i.e., the first transaction information) of the request parameter as txn;
[0218] tup1 = offsetToPtr(readIndex(key)); / / get the index storage address corresponding to the target index identifier from the index file through the key (i.e., the index identifier to be matched), and determine the tuple storage address of tup1 through the index storage address and the index file address of the index file where the index storage address is located, to locate the storage state of the current tuple, for example, tup1;
[0219] if tup1 == NULL then
[0220] return Abort; / / if tup1 is empty version (i.e., tup1 is not located and found), transaction rollback is needed;
[0221] fastReadOrWait(); / / if this tuple is the tuple being modified by the current transaction (i.e., the first transaction corresponding to the first transaction information), it can be quickly accessed, otherwise, if this tuple is modified by other transactions, and other transactions are in the transaction commit phase, it needs to wait until other transactions are committed before reading;
[0222] tup2 = offsetToPtr(tup1.next); / / locate another tuple version of the current tuple through the version link relationship between tup1 and tup2 (such as the index relationship between two different address offsets, i.e., the pointing relationship from the address offset in the storage state data corresponding to tup1 to another address offset in the storage state data corresponding to tup2);
[0223] if tup2==NULL then
[0224] return(tup1.wts>txn.ts)? Abort : tup1; / / If tup2 is NULL, then there is only one version, tup1. We need to determine if tup1.wts is greater than the transaction start time, txn.ts. If not, then we access tup1. Otherwise, we abort the transaction.
[0225] fastReadOrWait();
[0226] Sort();
[0227] if tup1.wts==0 then
[0228] return(tup2.wts>txn.ts)? Abort : tup2; / / If tup1.wts is 0, then tup1 is invalid. We need to determine if tup2.wts is greater than the transaction start time, txn.ts. If so, then we access tup2. Otherwise, we abort the transaction.
[0229] if tup1.wts>txn.ts then
[0230] return Abort;
[0231] else if tup2.wts>txn.ts then
[0232] return tup1;
[0233] else
[0234] return tup2; / / If the transaction start time is less than tup1.wts, then we abort the transaction. Otherwise, if the transaction start time is between the two versions, then we read the version with the smaller Wts (e.g., tup1). Or, if the transaction start time is greater than the Wts of the larger version, then we read the larger version (e.g., tup2).
[0235] It can be seen that, when the data processing request is acquired, the first transaction information used to define the instruction operation corresponding to a series of data processing instructions and the to-be-matched index identifier of the to-be-processed tuple (i.e., the tuple currently required to be accessed for the first transaction) can be acquired from the data processing request. In this way, when the first transaction is executed, the target index identifier matched with the to-be-matched index identifier can be found in the index file, and then when the target index identifier is found, it can be determined that the target tuple matched with the to-be-processed tuple exists in the tuple heap. It should be understood that, by deploying the index file used for indexing and the tuple heap used for data storage in the non-volatile storage space, the byte addressing capability of the non-volatile storage space can be utilized to quickly find the target index identifier matched with the current index tuple identifier (i.e., the to-be-matched index identifier) in the index file, and then it can be quickly judged that the target tuple corresponding to the target index identifier exists in the tuple heap. Further, the application embodiment can quickly index the two versions or a single version (i.e., the initial storage state described above) in the cyclic double version based on the storage address offset corresponding to the target index identifier in the index file, and then it can be determined whether there is a valid version by the relationship between the storage time stamp in the two versions or a single version (i.e., the initial storage state described above) in the cyclic double version and the transaction start time stamp of the first transaction, and then when there is a valid version, the valid version can be read to improve the timeliness and accuracy of the valid version reading.
[0236] Further, please refer to Figure 2 , Figure 2 is another flow diagram of a data processing method based on a non-volatile storage space provided by the application. As shown in Figure 2 , the method can at least include steps S301-S310:
[0237] Step S301, acquiring a data processing request, the data processing request carrying a to-be-matched index identifier and one or more data processing instructions;
[0238] Step S302, finding a target index identifier matched with the to-be-matched index identifier in a non-volatile storage space;
[0239] Step S303, in response to finding the target index identifier, determining an index storage address and a storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space, the storage address offset being an offset between the index storage address and a tuple storage address of a target tuple corresponding to the target index identifier;
[0240] Step S304, determining a tuple storage address by the storage address offset and the index storage address to determine a storage state set of the target tuple, the storage state set including at least one storage state;
[0241] In step S305, if the storage state set includes multiple storage states, the computer device acquires storage timestamps corresponding to the multiple storage states respectively and an instruction timestamp corresponding to the data processing instruction.
[0242] In step S306, based on the storage timestamps corresponding to the multiple storage states respectively and the instruction timestamp corresponding to the data processing instruction, the computer device determines a target storage state corresponding to the target tuple from the multiple storage states, and executes the instruction operation indicated by the data processing instruction on the target tuple in the target storage state.
[0243] The specific implementation of steps S301-S306 can be referred to the description of the specific implementation of steps S101-S106 in the above Figure 2 The specific implementation of steps S101-S106 in the above
[0244] The one or more data processing instructions are instructions in first transaction information carried in the data processing request. In the embodiments of the present application, the data processing request is taken as an example of a write request, and the request type of the data processing request is a write type. At this time, after step S304 is executed, the computer device can further execute steps S307-S310.
[0245] In step S307, if the storage state set of the target tuple includes only the initial storage state of the target tuple, and the next storage state of the initial storage state of the target tuple does not exist, the computer device configures a second tuple storage space for the target tuple in the non-volatile storage space based on the write type, creates the next storage state of the initial storage state of the target tuple in the second tuple storage space, determines the storage state data corresponding to the initial storage state of the target tuple as initial storage state data, and determines the storage state data corresponding to the update storage state of the target tuple as update storage state data when the next storage state of the initial storage state of the target tuple is determined as the update storage state of the target tuple; the second tuple storage space is used to store a second storage address of the update storage state of the target tuple; the tuple storage space corresponding to the initial storage state is a first tuple storage space of the target tuple, and the first tuple storage space is used to store a first storage address of the initial storage state of the target tuple.
[0246] Step S308, when the initial storage state data corresponding to the initial storage state read through the first storage address in the first tuple storage space, reading the initial tuple data of the target tuple from the initial storage state data corresponding to the initial storage state, and determining the target tuple data of the target tuple for writing in the update storage state data corresponding to the update storage state based on the transaction detail data of the first transaction corresponding to the first transaction information and the initial tuple data of the target tuple read;
[0247] Step S309, when adding the update storage state of the target tuple to the tuple heap where the plurality of tuples are located, configuring the field value of the tuple data field of the target tuple as the target tuple data of the target tuple in the update storage state data corresponding to the update storage state;
[0248] The fields in the update storage state data corresponding to the update storage state include a tuple data field and an atomic lock field; the field value of the atomic lock field is used to describe that the update storage state is locked when the write operation indicated by the first transaction is executed; at this time, the computer device can specifically configure the field value of the atomic lock field as a lock value representing locking the update storage state in the update storage state data corresponding to the update storage state, and configure the field value of the tuple data field as the target tuple data of the target tuple based on the lock value authorizing the write operation indicated by the write instruction.
[0249] Optionally, after the computer device configures the field value of the tuple data field as the target tuple data of the target tuple, the computer device can further perform the following steps: configuring the field value of the atomic lock field from the lock value to an unlock value used to unlock the update storage state in the update storage state data corresponding to the update storage state; the unlock value is used to indicate that when the read operation and / or the write operation indicated by the second transaction is executed, the target tuple data can be accessed and read in the update storage state data corresponding to the update storage state for the second transaction; the second transaction is a transaction other than the first transaction.
[0250] In step S310, a first state linkage relationship between the initial storage state and the update storage state is established. The first state linkage relationship refers to a relationship for describing a field value of an address offset field in initial storage state data corresponding to the initial storage state pointing to a field value of an address offset field in update storage state data corresponding to the update storage state. When the first transaction is in the transaction execution state, the field value of the address offset field in the initial storage state data corresponding to the initial storage state is maintained as a preset address offset value, and the field value of the address offset field in the update storage state data corresponding to the update storage state is an update storage address offset. The update storage address offset is an offset having a first index relationship with the storage address offset. The update storage address offset is determined by an offset between a second storage address of the update storage state and an index storage address of an index file in the non-volatile storage space. The storage address offset is determined by an initial storage address offset between a first storage address of the initial storage state and the index storage address of the index file.
[0251] Optionally, the field in the update storage state data corresponding to the update storage state includes a storage time field. When the first transaction is executed, the field value of the storage time field is a preset time threshold (for example, the INF described above) for representing that the first transaction is in the transaction execution state. The non-volatile storage space includes a transaction commit log list for recording committed transactions. At this time, the computer device can further obtain a transaction end timestamp representing that the first transaction is executed when it is checked that each data processing instruction indicated by the one or more data processing instructions is executed. Further, the computer device can update the field value of the storage time field from the preset time threshold (for example, the INF described above) to the transaction end timestamp in the update storage state data corresponding to the update storage state, and submit the first transaction identifier of the first transaction to the transaction commit log list. The first transaction identifier submitted to the transaction commit log list determines that the first transaction is a committed transaction. The storage time stamp corresponding to the update storage state is the transaction end timestamp.
[0252] Further, it can be understood that, for the first tuple update, at this time, the field value of the address offset field in the initial storage state data corresponding to the initial storage state is a preset address offset value, so the computer device can further update the field value of the address offset field in the initial storage state data corresponding to the initial storage state from the preset address offset value to the initial storage address offset of the initial storage state in the transaction submission stage; the initial storage address offset is determined by the offset between the first storage address of the initial storage state and the index storage address of the index file; further, the computer device can establish a second state linkage relationship between the initial storage state and the update storage state when the initial storage state and the update storage state have a first state linkage relationship and the update storage state is the next version of the initial storage state, the second state linkage relationship refers to a relationship for describing that the field value of the address offset field in the initial storage state data corresponding to the initial storage state points to the field value of the address offset field in the update storage state data corresponding to the update storage state; then, the computer device can construct a first state set for cyclically storing tuple data of the target tuple through the first state linkage relationship, the second state linkage relationship, the initial storage state and the update storage state; the first state set is one of the storage state sets of the target tuple, at this time, the initial storage state and the update storage state in the first state set are the current cyclic double version constructed for the target tuple.
[0253] For ease of understanding, further, Figure 2 , Figure 2 is a flowchart of each stage involved in executing the first transaction provided by the embodiments of the present application. As Figure 2 indicated, the computer device can allocate a transaction start timestamp in the transaction start stage (i.e., step S61 shown in Figure 2 ), further, the computer device can execute the current transaction (i.e., the first transaction) based on the allocated transaction start timestamp (e.g., txn.ts), and then can access the index file to locate the tuple through the index file in the transaction execution stage (i.e., step S62 shown in Figure 2 ), so that the computer device can execute read-write operations on the located tuple in the transaction execution stage (i.e., step S63 shown in Figure 2 ). It should be understood that when the data processing request currently obtained by the computer device is a write request, the computer device can allocate a transaction end timestamp in the metadata modification stage, and set the storage timestamp of the storage state of the tuple modified by the current transaction to the transaction end timestamp (i.e., step S64 shown in Figure 2The step S64) is shown, so that the computer device can enter the transaction commit phase based on the transaction end timestamp, and then can save the transaction identification in the storage state of the modified tuple in the transaction commit phase, and submit the transaction identification to the transaction commit log list (i.e. Figure 2 The step S65) is shown.
[0254] The specific process in which the computer device submits the transaction identification (i.e., the first transaction identification) of the current transaction (i.e., the first transaction) to the transaction commit log list through steps S61-S65 can be referred to the description of the above Figure 2 The specific process of submitting Txn1 to the transaction commit log list 4a in the corresponding embodiment will not be described again.
[0255] For ease of understanding, further, please refer to the following Figure 2 , Figure 2 is a process schematic diagram for creating a cyclic double version provided by the embodiments of the present application. As Figure 2 shown, the computer device can store the content (i.e., the latest tuple data of the tuple) that needs to be written by alternately storing through the cyclic double version when storing the tuple (i.e., storing the tuple for a certain tuple). As Figure 2 shown, when the computer device determines that the current tuple heap does not exist for the tuple, it is necessary to further determine whether the transaction operation indicated by the first transaction currently executed is an insertion operation (i.e. Figure 2 The step S71) is shown, if it is determined to be yes, step S72 can be executed, the first tuple storage space is allocated, and the tuple is inserted into the tuple heap through the allocated first tuple storage space. Conversely, as Figure 2 shown, if it is determined to be no, it is necessary to determine whether the transaction operation indicated by the first transaction is a first update (i.e. Figure 2If the determination is YES, the second tuple storage space is allocated, the tuple is updated through the allocated second tuple storage space, and the second tuple storage space is linked with the first tuple storage space (i.e., the first state linkage relationship between the initial storage state and the updated storage state is established, and then the second state linkage relationship between the initial storage state and the updated storage state can be further established after the first transaction is committed, i.e., the linkage between the initial storage state and the updated storage state can be realized through the established first state linkage relationship and the second state linkage relationship in the embodiment of the application). Alternatively, it can be understood that after the computer device executes step S73, if the determination is NO, step S75 needs to be further executed, i.e., in the two versions corresponding to the two tuple storage spaces of the current tuple, the modifiable version is determined through the size of Wts of the two versions (i.e., the version with smaller Wts is the old version, and the version with larger Wts is the new version), and then step S75 is executed to write the content into the tuple storage space corresponding to the selected old version.
[0256] The tuple storage space of the old version stores the storage address of the old version (e.g., the initial storage state), through which the old version (i.e., the initial storage state) can be located in the tuple heap, and then the initial tuple data (i.e., the account balance of the account U1 stored in the new version is 100) of the tuple read from the updated storage state data corresponding to the new version and the transaction detail data (e.g., 50 is transferred from the account U1) of the first transaction are determined to be the content (i.e., the target tuple data of the tuple, such as the latest account balance after the account balance of the account U1 is updated, for example, 100-50=50) written into the old version. The old version here can be the initial storage state in the above-mentioned cyclic double version, and the new version can be the updated storage state in the above-mentioned cyclic double version.
[0257] For ease of understanding, the related program code for concurrent access control through the cyclic double version when the data processing request is a write request is given in the embodiment of the application. The cyclic double version here is tup1 and tup2 in the related program code, wherein the key of the tuple currently to be modified is the tuple identifier of the tuple (i.e., the above-mentioned to-be-matched index identifier), and txn is the transaction information of the transaction requested to be executed in the data processing request (i.e., the above-mentioned first transaction information), which can be specifically referred to as follows:
[0258] Function txnWrite(key,txn): / / For data processing requests that are write requests, the request parameters carried in the write request include the key to be indexed (i.e., the index identifier to be matched mentioned above) and the first transaction information of the first transaction to be executed. The first transaction information (i.e., txn) can be used to define the instruction operations indicated by a series of data processing instructions.
[0259] tup1 = offsetToPtr(readIndex(key)); / / Get the tuple offset from the index file, calculate the storage address of the initial storage state of the tuple (i.e., tup1) through the tuple offset, and then read the tuple's tup1 from the tuple heap through the storage address of tup1.
[0260] if tup1==NULL&txn.type==insert
[0261] then
[0262] tup1 = allocator(); / / If the index file determines that there is no such tuple in the tuple heap (i.e., tup1 is an empty version), and the transaction operation of the first transaction (i.e., txn.type) is an insertion operation, then the space allocation component can be called through the allocator() method in the tuple space manager to allocate space for tup1 of the tuple (i.e., allocate the storage space of the first tuple mentioned above), and write tup1 into the allocated space (i.e., allocate the storage space of the first tuple mentioned above). For example, the version address of tup1 can be recorded through the allocated space so that tup1 can be accessed in the tuple heap through the version address of tup1 later.
[0263] memcpy_content(tup1,txn); / / During the transaction execution phase of the first transaction corresponding to the first transaction information (i.e., txn), the tuple data obtained from the first transaction information (i.e., txn) for storage is written into the initial storage state data corresponding to tup1, and tup1 containing the tuple data is inserted into the tuple heap.
[0264] return tup1;
[0265] else if(tup1==NULL)∧(txn.type!=insert)then
[0266] return Abort; / / If the index file determines that there is no such tuple in the tuple heap (i.e., tup1 is an empty version), and the transaction operation of the first transaction (i.e., txn.type) is not an insert operation, then roll back the first transaction.
[0267] tup2 = offsetToPtr(tup1.next); / / locate another version of the current tuple, e.g., tup2, through the state linkage between tup1 and tup2 (i.e., tup1.next, such as, the pointing relationship from the version offset in the version data structure corresponding to tup1 to another version offset in the version data structure corresponding to tup2);
[0268] if tup2 == NULL then
[0269] tup2 = allocator(); / / if tup2 does not exist (i.e., tup2 is empty version), then in the case of only one version of the tuple (i.e., only tup1), the allocator() method call in the tuple space manager deployed in the NVM space can be used to allocate space for tup2 of the tuple (i.e., allocate the second tuple storage space mentioned above), and write tup2 in the allocated space (i.e., the second tuple storage space mentioned above), such as, the storage address of the tup2 can be recorded through the allocated space, so that the tup2 can be accessed in the tuple heap through the storage address of the tup2 in the subsequent;
[0270] if CAS(tup1.lock, false, true) fails then
[0271] return Abort: / / by comparing the Wts (e.g., Wts1 mentioned above) of tup1 and the Wts (e.g., Wts2 mentioned above) of tup2, determine which version of the two versions of the same tuple is the old version that needs to be modified, for example, the old version here is tup1, and then the tup1 needs to be locked before modifying the tup1 by using the CAS operation to call the atomic lock; for example, when the tup1 locking fails, it means that there is another transaction that is locking and modifying the tup1 in the process of executing the first transaction, therefore, the current transaction cannot repeatedly lock and modify the tup1 when executing, in other words, the CAS operation used by the present application embodiment can lock a transaction once in the process of multiple transactions, which can avoid transaction conflicts in the process of multiple transactions, which means that the current transaction cannot directly repeatedly modify the tup1 locked by other transactions.
[0272] bind(tup1, tup2); / / link the two versions of the tuple, i.e. the state link between tup1 and tup2 can be established, where the state link is that when there are two versions, after the pointer pointing is sorted by comparing the Wts of the two versions, the pointer pointing to the old version is always the version with smaller Wts. For example, the pointer pointing to the state link can be the first state link or the second state link described above;
[0273] memcpy_content(tup2, txn) writes the tuple data stored in the first transaction information (i.e. txn) to the version data structure corresponding to the tup2 in the transaction execution phase of the first transaction corresponding to the first transaction information (i.e. txn), and stores the tup2 storing the tuple data to the tuple heap;
[0274] change(tup1.lock); / / unlock;
[0275] return tup2;
[0276] sort();
[0277] if (tup1.wts > txn.ts) ∨ (tup2.wts > txn.ts) / / get the Wts of the two versions, and after the pointer pointing is sorted by comparing the Wts of the two versions, the pointer pointing between the tup1 and the tup2 can be determined as the pointer pointing to the old version, and the pointer pointing to the old version (e.g. tup1) is always the version with smaller Wts;
[0278] then
[0279] return Abort; / / if the Wts of the two versions are greater than the transaction start timestamp, the current transaction needs to be aborted, and the transaction rollback of the current transaction is performed;
[0280] else
[0281] if CAS(tup1.lock, false, true) fails then
[0282] return Abort; by comparing the Wts of tup1 (e.g., Wts1 described above) and the Wts of tup2 (e.g., Wts2 described above), determine which of the two versions of the same tuple is the old version that needs to be modified, for example, the old version here is tup1, and then need to call the atomic lock through the CAS operation before modifying tup1 to lock the tup1 that needs to be modified; For example, when the tup1 locking fails, it means that during the execution of the first transaction, there are other transactions that are locking and modifying the tup1, so the current transaction cannot repeatedly lock and modify the tup1 during execution.
[0283] memcpy_content(tup1, txn); When the tup1 locking is successful, the tuple update and storage can be performed on the current locked tup1.
[0284] change(tup1.lock); After the tuple update and storage are performed on the current locked tup1, the atomic lock can be called to unlock the tup1, for example, the field value of the atomic lock field in the storage state data (e.g., the initial storage state data) corresponding to the tup1 can be updated from the lock value (e.g., the Boolean value is true) to the unlock value (e.g., the Boolean value is false).
[0285] return tup1;
[0286] Wherein, the CAS operation contains three operands: tup1.lock, false, true. Wherein, tup1.lock represents the old version of the tuple (e.g., tup1) locked by the current transaction during the execution of the current transaction. Wherein, false represents the original value preset before locking, that is, the field value of the atomic lock field read at the preset position in the version data structure of the old version (e.g., tup1) before the old version is locked, and true represents the new value preset after locking, that is, the field value of the atomic lock field at the preset position in the version data structure of the old version (e.g., tup1) that needs to be updated from the original value to the new value after the old version is locked. In the embodiment of the present application, only when the field value of the tuple lock field at the preset position in the version data structure of the old version matches the preset original value (e.g., false), the computer device will automatically update the field value of the tuple lock field at the preset position in the version data structure of the old version from the original value to the new value (true) to realize the locking of the tuple version, otherwise no operation is performed. This mechanism can ensure the atomicity of the operation, thereby avoiding data competition and transaction conflict when different transactions are concurrently executed by different threads in a multi-threaded environment.
[0287] It should be understood that when reading the tuple version of a certain tuple (assuming that there are two versions, and one of the versions is an invalid version with wts being 0), the embodiment of the present application directly ignores the reading of the invalid version of the tuple, so as to avoid the waste of data reading resources. In addition, when updating a certain tuple, the embodiment of the present application preferentially locks the invalid version as a modifiable version, so that when the tuple is updated and written, the content that needs to be updated and written is written to the invalid version of the tuple, so as to directly reuse the tuple storage space corresponding to the invalid version to implement tuple updating, thereby avoiding the generation of too much space fragmentation in the NVM space through space reuse.
[0288] It can be seen that, when the data processing request is a write request, the embodiment of the present application can carry the to-be-matched index identifier of the to-be-processed tuple with index in the write request, fully utilize the byte addressing capability of the non-volatile storage space in the process of executing the first transaction, quickly find the target index identifier that matches the tuple identifier (i.e., the to-be-matched index identifier) of the current index in the index file, and then quickly determine that the target tuple corresponding to the target index identifier exists in the tuple heap deployed in the NVM space when the target index identifier that matches the tuple identifier (i.e., the to-be-matched index identifier) of the current index is found. Further, the embodiment of the present application can quickly index the two versions or a single version (i.e., the initial storage state) in the cyclic double version based on the storage address offset (for example, the version offset of tup1) corresponding to the target index identifier in the index file, and then determine whether there is a valid version (i.e., the target storage state) through the relationship between the storage timestamp in the two versions or a single version (i.e., the initial storage state) in the cyclic double version and the transaction start timestamp of the first transaction, and then read the initial tuple data of the target tuple in the storage state data corresponding to the valid version (i.e., the target storage state) to determine the target tuple data of the target tuple for writing the modifiable version (another version in the cyclic double version except the valid version) when the valid version (i.e., the target storage state) exists, and then implement tuple updating of the target tuple in the modifiable version through the determined target tuple data, which means that the embodiment of the present application can ensure the accuracy of version reading and the reliability of version modification through the way of determining the valid version and the modifiable version in the cyclic double version, and through locking the modifiable version in the case of multiple transaction parallel execution.
[0289] In the NVM space, the concurrent control of storage and access is implemented through the cyclic double version, and the computer device needs to follow the following theorem:
[0290] Theorem (serializable snapshot isolation): If two transactions update the same tuple, the transaction start timestamp of one transaction should be greater than the transaction end timestamp of the other transaction. The transaction end timestamp of the other transaction here is used to determine the storage timestamp corresponding to the storage state of the modified tuple when the other transaction is executed.
[0291] Proof: The read-write algorithm implemented by the above related program code can achieve the snapshot isolation level. Here, the present embodiment needs to additionally consider whether the read set of the transaction being executed (i.e., the first transaction) conflicts with the read-write of the committed transaction.
[0292] For ease of understanding, further, please refer to Figure 2 , Figure 2 is a scene diagram provided by the present embodiment for conflict detection in a multi-transaction concurrent execution scenario. The multi-transaction here includes the current transaction and the committed other transaction before the current transaction. As shown in Figure 2 , the present embodiment can configure an end timestamp (i.e., the transaction end timestamp, e.g., T12) for the current transaction after executing all transaction operations of the current transaction, and further execute step S81 to determine whether all tuples in the read set of the current transaction are accessed. If the determination is yes, the normal transaction commit (i.e., step S82 shown in Figure 2 ) can be performed for the current transaction. Conversely, if there is a tuple in the read set of the current transaction that is not accessed, step S83 is executed to access the tuple in the read set, and further step S84 is executed to determine whether the accessed tuple is modified by other transactions. If the determination is yes, the end timestamp of the other transaction that modifies the tuple (i.e., the transaction end timestamp, e.g., T21) is obtained, and further step S85 is executed to determine whether the end timestamp of the other transaction is valid and between the start and end timestamps of the current transaction, i.e., at this time, the computer device needs to determine whether the end timestamp of the other transaction is a transaction committed when all tuples in the read set of the other transaction are accessed. If yes, it is determined that the end timestamp (e.g., T21) configured by the other transaction is valid, so that the transaction can be further aborted and rolled back (i.e., execution step S86 shown in Figure 2 ) for the current transaction when the end timestamp of the other transaction is between the start and end timestamps of the current transaction. Conversely, it can be confirmed that the tuple has been successfully accessed when the end timestamp of the other transaction is not between the start and end timestamps of the current transaction, so that step S81 can be further executed to repeat the business logic of determining whether all tuples in the read set of the current transaction are accessed until all tuples in the read set of the current transaction are accessed, and the current transaction can be normally committed.
[0293] As can be seen, the embodiment of the present application can further determine whether the tuple involved in the read set of the committed transaction is modified by other transactions and whether the version modified by other transactions is committed after obtaining the transaction end timestamp of the current transaction. If there is a committed transaction whose transaction end timestamp is greater than the transaction start timestamp of the current transaction but less than the end timestamp of the current transaction, the current transaction is aborted to ensure that the transactions are serialized and executed in the order of the end timestamps of the transactions. This is because there is a committed transaction that modifies the data item after the read operation of the current transaction and is committed before the current transaction is committed, which violates the serializable requirement.
[0294] In addition, the embodiment of the present application also verifies the feasibility and accuracy of the implementation of the alternate update of the tuple by the multiple storage states (for example, cyclic double version) of the same tuple provided by the embodiment of the present application through the experimental setting.
[0295] For example, the computer device used for the experiment is equipped with an Intel Xeon Gold 6326 cpu (16 cores / 32 threads, 512KB L1I, 718KB L1D and 20MB L2 cache, and a shared 24MB L3 cache).
[0296] Among them, the data access system of the computer device is deployed with 128GB (4x32GB) DRAM and 1TB (4x256GB) NVM, for example, the NVM here can be Intel Optane DCPersistent Memory nvdimm (PMem, which is essentially a kind of persistent data storage) based on 3DXPoint.
[0297] During the experiment, the embodiment of the present application proposes to configure the PMem as App-Direct mode, that is, the embodiment of the present application can map the NVM from the data access system to the virtual address of the software, and then directly use the NVM on the virtual address for data access.
[0298] In the implementation process, the experimental equipment (i.e., the computer device) involved in the embodiments of the present application can be Ubuntu 20.04.6 LTS and 5.4.0-169-generic Linux kernel. We install the file system to the NVM in the fs-dax mode, and then map the NVM file (here, the NVM file includes but is not limited to the business table) to the virtual memory of the process using libPMem (a database function interface) in PMDK, and use clwb and sfense to persist data to the NVM. All the codes are written in C / C++, and are compiled using gcc version 9.4.0. For the convenience of testing, the embodiments of the present application run the experiment on a single CPU slot and its related NVM and DRAM. The single CPU slot can use 1 TB of NVM and 128 GB of DRAM.
[0299] In the implementation process, the embodiments of the present application use YCSB and TPCC to evaluate the performance of the AKV storage engine deployed for the NVM space. YCSB is a widely used key-value workload that represents transactions handled by a web company. In the experiment, the YCSB database is composed of a table (i.e., the business table). For each tuple in the business table, it can contain an 8B primary key and ten 100-byte random string data columns. The size of each tuple is about 1 KB. Each YCSB transaction can be composed of 16 random requests by default. Therefore, the embodiments of the present application can give a primary key (i.e., the to-be-matched index identifier of the to-be-processed tuple) for a certain YCSB transaction (i.e., the first transaction) in the random requests, and then read the retrieved tuple when the request (i.e., the data processing request) is a read request, and modify the retrieved tuple when the request (i.e., the data processing request) is a write request. In addition, the embodiments of the present application can consider the following two parameters in the workload: (1) the percentage of read requests, read-only (RO, 100% read), read-heavy (RH, 90% read, 10% write), Balanced (BA, 50% read, 50% write), and write-heavy (WH, 10% read, 90% write); (2) the root mean square parameter of Zipfian distribution (i.e., a long-tailed distribution): uniform (θ = 0) and Zipfian (θ = 0.9). Uniform has no request locality, while Zipfian is used to simulate the case of high transaction conflict.
[0300] TPC-C benchmark is an important tool for evaluating the performance of online transaction processing (OLTP) systems. It simulates the business activities of a wholesale supplier by designing 9 tables and 5 transaction types for comprehensive performance evaluation. Among them, the five transactions can specifically include the two most common NewOrder (order transaction type) and Payment (i.e. payment transaction type) head transaction types, and these two head transaction types account for 45% and 43% of all transaction types, respectively. Considering that these two short read-write transactions together constitute 88% of the TPC-C workload, in the experiment, the two transaction types will be mainly considered. At the same time, TPC-C allows users to adjust the number of warehouses according to their own needs, and by configuring different numbers of warehouses, different competition levels can be simulated to evaluate the performance of the system under different loads and pressures. In this experiment, the embodiments of the present application use TPC-C with different configurations to evaluate the performance of the system in various contention scenarios: for example, 256 warehouses can be configured for low contention scenarios, 8 warehouses for medium contention scenarios, and a single warehouse for high contention scenarios.
[0301] For ease of understanding, further, Figure 2 , Figure 2 is an embodiment of the present application in the YCSB benchmark test to change the request ratio and distribution to evaluate the throughput of different data access systems. Among them, YCSB (Yahoo! Cloud Serving Benchmark) is a widely used database performance benchmarking tool that can be used to evaluate the performance of different data access systems under corresponding loads. As shown in Figure 2 , these data access systems can include, from left to right, Zen_OCC system, Zen_MVCC system, NVCaracal system, Falcon system, Falcon(DRAM) system, AKV system, and AKV(DRAM) system as shown in Figure 2 . For all target storage engines in these systems, there are two observations: (1) As the write ratio increases, the transaction throughput decreases, mainly due to the increase in the number of writes to NVM. It should be noted that the read speed in NVM is usually faster than the write speed. At the same time, due to the influence of concurrency control, the increase in the write ratio usually leads to more transaction aborts. (2) As the transaction conflict increases, the transaction throughput is also affected. In the case of read-intensive, high transaction conflict will lead to an increase in transaction throughput. This is because more intensive transaction access will cause the CPU cache to store the data to be accessed, thereby increasing the throughput. However, in the case of write-intensive, high transaction conflict will lead to a decrease in transaction throughput. This is because the increase in write conflict leads to more transaction rollbacks, thereby reducing the throughput.
[0302] For Zen system (e.g. Figure 2 For the Zen_OCC and Zen_MVCC systems shown, when the write ratio is high, especially for Zipfian distribution, the throughput of Zen_MVCC has a significant decline compared to Zen_OCC. Through performance analysis of deploying Zen_MVCC system on computer equipment, it is found that the main reasons for low throughput are two: (1) In order to ensure the correctness of the transaction, the subsequent read and write operations must wait for the completion of the write operation of the conflict transaction. (2) With the increase of the number of write versions, not only the overhead of garbage collection increases, but also the read operation needs more time to identify the appropriate tuple version because of too many versions. For Uniform distribution, the impact of Zen_MVCC is not significant due to fewer conflict operations between transactions. However, for Zipfian distribution, the increase of conflict operations makes the above two cases more obvious.
[0303] For the NVCaracal system, since it does not support read-only transactions, it is tested after a small modification to its code. During the experiment, the time overhead of the NVCaracal system is measured, and it is found that the time of the initialization phase is comparable to that of the execution phase. This is because NVCaracal is a deterministic database that pre-serializes transactions before execution and then executes them in a predetermined order, with almost no transaction aborts.
[0304] The Falcon system first uses a single request as the transaction pattern in the YCSB test. However, in order to comprehensively evaluate its performance, 16 requests are configured in each transaction in the experiment. This experiment not only tests the Falcon version that uses NVM completely, but also tests the version that uses DRAM index. The results show that in most cases, the Falcon version using DRAM index is significantly better than Zen and NVCaracal. The reason is that it adopts an in-place update mechanism and only persists the final result of the transaction to NVM, while the intermediate results and logs are efficiently processed in the CPU cache. This strategy not only reduces the frequent updates of the index, but also significantly reduces the need for data migration between different storage media.
[0305] For the AKV storage engine involved in the embodiments of the present application, there are two types of AKVs in the experiment: one is AKV for NVM-Only architecture and the other is AKV for NVM+DRAM architecture. The results show that in most cases, the AKV for NVM-Only architecture has higher throughput than other storage engines. One reason is that under the NVM-Only architecture, the AKV storage engine adopts multi-version concurrency control (for example, double-version concurrency control), which can ensure the serializable snapshot isolation level while maximizing the read performance of the system. Therefore, the AKV system using the AKV storage engine performs best in read-intensive cases.
[0306] Further, please refer to Figure 2 , Figure 2 is a transaction abort statistical chart provided by the embodiments of the present application under different read-write ratios. As shown in Figure 2 , for the multiple data access systems from left to right (Zen_OCC system, Zen_MVCC system, Falcon system and AKV system), in the case of write-intensive, the AKV system will generate a large number of transaction rollbacks. In this case, the embodiments of the present application propose to use a cyclic double-version storage method to reduce the cost of transaction rollback by fixing the storage location of the tuple (for example, alternately updating the tuple data of the tuple to the old version of the cyclic double-version).
[0307] Further, please refer to Figure 2 , Figure 2 is a transaction abort delay statistical chart provided by the embodiments of the present application. As shown in Figure 2 , for the multiple data access systems from left to right (Zen_OCC system, Zen_MVCC system and AKV system), the rollback delay of the AKV system is less than one third of the Zen OCC system. Similar to the Falcon system, by fixing the location of the tuple and directly accessing the data on the NVM, the AKV system reduces the overhead of index update and data replication between different storage media. Without considering the DRAM index, the AKV system achieves a performance improvement of 12.5% and 14.5% in read-only and read-intensive cases, respectively, while ensuring that data will not be lost in the case of power failure. In addition, although the AKV performance using the DRAM index is improved compared to the AKV for NVM-Only architecture, the DRAM index needs to be rebuilt during recovery, which conflicts with the design goal of needing to maintain agility architecture. Therefore, the embodiments of the present application propose to use the AKV system for NVM-Only architecture.
[0308] Further, please refer to Figure 2 , Figure 2 is a statistical chart provided by the embodiments of the present application to show the scalability of YCSB. As shown inFigure 2 As shown in FIG. 6, the scalability of Zen, Falcon and AKV is studied in this experiment. For example, balanced and uniform requests are used in the experiment. Figure 2 As shown in FIG. 6, when the number of threads is less than 16, all three storage engines show good scalability. However, as the number of threads increases, their throughput does not increase but decreases. The main reason is that the number of CPU cores is limited, and at most 16 threads can be executed in parallel, and further increasing the number of threads will only cause resource conflicts. Therefore, the embodiment of the present application proposes to optimize the configuration of 16 threads in a computer device deployed with AKV.
[0309] Further, please refer to Figure 2 , Figure 2 The embodiment of the present application gives the test results of transaction throughput of NVCaracal system, Falcon system and AKV system under TPC-C workload. Among them, TPC-C workload refers to the load under the corresponding contention scenario of TPC-C benchmark (i.e. another benchmark tool), for example, 16 threads are used in this test. Among them, Falcon (i.e. Falcon system) uses OCC as the concurrency control strategy, and only uses NVM, without enabling DRAM to store data. Overall, AKV (i.e. AKV system) performs best. For example, as shown in FIG. 7, in the case of low contention, the throughput of AKV is 13% higher than that of Falcon, and 126% higher than that of NVCaracal. In the case of medium contention, the throughput of Falcon starts to decline, while the throughput of AKV and NVCaracal (i.e. NVCaracal system) remains basically stable. Figure 2
[0310] Further, please refer to Figure 2 , Figure 2 The statistical diagram of the number of transaction aborts under different contention is given. As can be seen from Figure 2 , the performance decline of Falcon is mainly due to a large number of transaction aborts. Although the number of aborts of AKV increases compared with the low contention case, the abort delay is low and the number of aborts is much less than that of Falcon, so the impact on throughput is not great.
[0311] As shown in FIG. 8, in the case of high contention, the performance of AKV is 380% higher than that of Falcon, and is basically the same as that of NVCaracal. As can be seen from Figure 2 , the number of aborts of Falcon and AKV increases significantly, so Figure 2 Figure 2 The throughput of both continues to decline. It is worth noting that the performance of NVCaracal in both contention scenarios is similar, which is mainly because it determines the execution order of transactions in the initialization phase, so it will not fluctuate in performance due to changes in contention, which is consistent with the analysis results of YCSB. In addition, Falcon performs well in low contention, but its performance drops significantly in high contention, mainly because there are more aborts and more abort overhead.
[0312] Further, please refer to Figure 2 , Figure 2 is a statistical diagram provided by the embodiment of the present application for showing the TPC-C scalability. As shown in Figure 2 , the TPC-C scalability of AKV is tested in this experiment, and Falcon is used as a comparison reference. As shown in Figure 2 , the experimental results show that AKV shows good scalability before 16 threads, but the throughput starts to decline after more than 16 threads. This trend is similar to the results in the YCSB benchmark test. The reason for this is the limitation of the number of CPU cores: the CPU only supports 16 threads for parallel processing, and more than this number of threads cannot be executed in parallel, but will increase resource contention, resulting in more transaction aborts.
[0313] Further, please refer to Figure 2 , Figure 2 is the influence of different version numbers and different space allocation schemes on YCSB throughput. As shown in Figure 2 , the space allocation scheme of the AKV system and the version number used for concurrency control are discussed in the process of using the AKV storage engine for storage and scheme, and the experimental results are shown in Figure 2 .
[0314] As shown in Figure 2 , the space allocation method used by the DVCC(naive) scheme and the DVCC scheme is different when using cyclic double version for version control, for example, the DVCC(naive) scheme needs to allocate two spaces at a time when a tuple is inserted, and subsequent transactions updating the tuple do not need to allocate space again; while the DVCC scheme clearly indicates that when a tuple is first inserted, only one version space is allocated, and when the tuple is updated, another new version space is allocated. As shown in Figure 2 , the TVCC scheme configures three versions for tuple version control, and the QVCC scheme configures four versions for tuple version control.
[0315] AsFigure 2 As shown in the experimental data, the DVCC (naive) scheme exhibits the highest throughput when the write ratio is high. This is mainly due to two factors: firstly, because it pre-allocates tuple space, it doesn't need to reallocate space when a tuple is updated; secondly, because the two tuple versions are version-linked, there is a certain degree of spatial locality. Compared to the DVCC (naive) scheme, the DVCC scheme, with its optimized space allocation, consumes less NVM space. When the read ratio is high, the DVCC scheme performs better because in most cases only one tuple version needs to be accessed, unlike the DVCC (naive) scheme which requires accessing both versions at once to determine the correct tuple version.
[0316] like Figure 2 As shown, the number of versions does not have a significant impact on throughput, however, from Figure 2 It can be observed that the throughput of two versions of DVCC is better than that of three and four versions in most cases. Therefore, in cases with many read requests and intensive access, increasing the number of versions will reduce the number of aborts due to read version failure. However, in cases with many writes, the additional versions do not bring any benefit, but instead lead to a decrease in throughput. Based on this, this application proposes that when using a circular dual-version concurrency control scheme, not only can space fragmentation be reduced during transaction rollback, but the efficiency of tuple access and storage through the AKV storage engine can also be improved under different contention scenarios.
[0317] Further, please see Figure 2 , Figure 2 This is a schematic diagram of a data processing device based on non-volatile storage space provided in an embodiment of this application. The data processing device 1 based on non-volatile storage space can run on a computer device, which can be the aforementioned... Figure 2 The server 22a is shown. The storage space of this computer device includes non-volatile storage space, which contains multiple tuples, each configured to be indexable by an index identifier pre-stored in the non-volatile storage space. For example, Figure 2 As shown, the data processing device 1 based on non-volatile storage space may include: a request acquisition module 11, an index identifier lookup module 12, a storage state set determination module 13, a timestamp acquisition module 14, and an operation execution module 15.
[0318] Request retrieval module 11 is used to retrieve data processing requests, which carry an index identifier to be matched and one or more data processing instructions.
[0319] The index identifier searching module 12 is configured to search the target index identifier matching the index identifier to be matched in the non-volatile storage space.
[0320] The index identifier searching module 12 is further configured to, in response to searching the target index identifier, determine the index storage address and the storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space, the storage address offset being an offset between the index storage address and the tuple storage address of the target tuple corresponding to the target index identifier.
[0321] The storage state set determining module 13 is configured to determine the tuple storage address by using the storage address offset and the index storage address, so as to determine the storage state set of the target tuple, the storage state set including at least one storage state.
[0322] The timestamp obtaining module 14 is configured to, if the storage state set includes a plurality of storage states, obtain a plurality of storage time stamps respectively corresponding to the plurality of storage states, and an instruction timestamp corresponding to the data processing instruction.
[0323] The operation executing module 15 is configured to, based on the plurality of storage time stamps respectively corresponding to the plurality of storage states and the instruction timestamp corresponding to the data processing instruction, determine a target storage state corresponding to the target tuple in the plurality of storage states, and execute the instruction operation indicated by the data processing instruction on the target tuple in the target storage state.
[0324] The specific implementation manners of the request obtaining module 11, the index identifier searching module 12, the storage state set determining module 13, the timestamp obtaining module 14 and the operation executing module 15 can refer to the descriptions of steps S101-S106 in the above-mentioned Figure 2 The descriptions of steps S101-S106 in the above-mentioned
[0325] The non-volatile storage space is deployed with an index file used for indexing the pre-stored index identifiers, the one or more data processing instructions are instructions in the first transaction information carried in the data processing request, and the data processing request is a request obtained by a first thread in a thread pool corresponding to the non-volatile storage space.
[0326] The index identifier searching module 12 is specifically configured to:
[0327] In the process of starting the first transaction corresponding to the first transaction information by using the first thread, a transaction start timestamp is configured for the first transaction, and in the process of executing the first transaction based on the transaction start timestamp, a transaction state of the first transaction is configured as a transaction execution state.
[0328] In the transaction execution state, the target index identifier matching the index identifier to be matched is searched by using the index file.
[0329] The non-volatile storage space is arranged with a tuple heap for storing a plurality of tuples, the index file includes a plurality of index sets, and the plurality of index sets are sets for pre-storing index identifiers of the respective tuples in the tuple heap after the index identifiers of the respective tuples are identified and mapped;
[0330] The index identifier searching module 12 is specifically configured to:
[0331] In the transaction execution state, the to-be-matched index identifier is identified and mapped, and in the plurality of index sets, an index set used for mapping the to-be-matched index identifier is determined as a target index set;
[0332] The target index identifier matching the to-be-matched index identifier is searched in the target index set.
[0333] The non-volatile storage space includes a directory file, and the directory file stores an index file address of the index file;
[0334] The index identifier searching module 12 is specifically configured to:
[0335] When it is determined that the first transaction is being executed based on the transaction execution state, the index file is acquired through the index file address in the directory file;
[0336] The plurality of index sets used for hash indexing are acquired from the index file; one index set corresponds to one set identifier;
[0337] The to-be-matched index identifier is subjected to hash calculation to obtain an index hash value of the to-be-matched index identifier, and the set number of the plurality of index sets is subjected to remainder calculation through the index hash value to obtain a remainder of the index hash value;
[0338] In the plurality of set identifiers corresponding to the plurality of index sets, a set identifier matching the remainder of the index hash value is searched, and an index set corresponding to the searched set identifier is determined as a target index set used for mapping the to-be-matched index identifier.
[0339] The table in which the tuple heap is located is a business table, and the directory file further stores a table address of the business table in which the tuple heap is located;
[0340] The device 1 is further configured to:
[0341] An index file with an initial index address being the index file address is created, a plurality of initial sets are configured in the index file, and an address mapping relationship between the table address and the index file address is established; when the business table is acquired through the table address in the directory file, the tuple heap in the business table is acquired, a to-be-mapped tuple for identification mapping is acquired from the plurality of tuples contained in the tuple heap, and a tuple identifier of the to-be-mapped tuple is determined as a to-be-mapped tuple identifier.
[0342] When the table address corresponding index file address is obtained through the address mapping relationship, the index file is obtained through the index file address, and a plurality of initial sets in the index file are obtained;
[0343] The to-be-mapped tuple identifier is mapped, and the to-be-mapped tuple identifier is stored in the target initial set in the plurality of initial sets according to the mapping result;
[0344] When the tuple identifier of each tuple in the tuple heap is selected as the to-be-mapped tuple identifier for mapping, it is confirmed that the tuple identifiers of each tuple in the tuple heap are respectively mapped and stored in the plurality of initial sets, and the plurality of initial sets in which the mapping and storage are completed are used as a plurality of index sets, and the index file address of the index file in which the target index address is updated and stored in the directory file; the tuple identifier mapped and stored in the plurality of index sets is an index identifier used for indexing.
[0345] The device 1 is specifically used for:
[0346] The to-be-mapped tuple identifier is hashed to obtain a to-be-mapped index hash value of the to-be-mapped tuple identifier;
[0347] The number of sets of the plurality of initial sets is calculated by taking the remainder of the to-be-mapped index hash value, to obtain the remainder of the to-be-mapped index hash value;
[0348] In the plurality of initial sets, the initial set corresponding to the set identifier consistent with the remainder of the to-be-mapped index hash value is found, the found initial set is used as the target initial set, and the target initial set is determined as the mapping result of the to-be-mapped tuple identifier after the mapping;
[0349] According to the mapping result, the index item corresponding to the to-be-mapped tuple identifier is added and stored in the target initial set; the index item corresponding to the to-be-mapped tuple identifier is used to store a key-value pair with the to-be-mapped tuple identifier as the key and the initial storage address offset corresponding to the initial storage state of the to-be-mapped tuple as the value; the initial storage state of the to-be-mapped tuple refers to the storage state used to store the to-be-mapped tuple when the to-be-mapped tuple is inserted into the tuple heap.
[0350] Optionally, one or more data processing instructions are instructions in the first transaction information carried in the data processing request;
[0351] The device 1 is also used for:
[0352] In response to the target index identifier not being found, it is determined that there is no target tuple in the plurality of tuples that matches the to-be-processed tuple corresponding to the to-be-matched index identifier, and the first transaction corresponding to the first transaction information is rolled back in a transaction execution state.
[0353] Optionally, the apparatus 1 is further configured to:
[0354] In response to the target index identifier not being found, an insertion operation for inserting a tuple is detected in an instruction operation indicated by the one or more data processing instructions.
[0355] In response to the detected insertion operation, a first tuple storage space is configured for the to-be-processed tuple corresponding to the to-be-matched index identifier in the non-volatile storage space, an initial storage state of the to-be-processed tuple is created in the first tuple storage space, and tuple data of the to-be-processed tuple is written in initial storage state data corresponding to the initial storage state; or,
[0356] In response to the undetected insertion operation, the execution of the first transaction is aborted.
[0357] The plurality of data processing instructions include a first data processing instruction and a second data processing instruction, and the first transaction includes a first sub-transaction corresponding to the first data processing instruction and a second sub-transaction corresponding to the second data processing instruction; the tuple corresponding to the first sub-transaction is the to-be-processed tuple; the tuple corresponding to the second sub-transaction is the associated processing tuple; and the associated processing tuple is a tuple in the tuple heap.
[0358] When the apparatus 1 is used to execute the step of rolling back the first transaction in a transaction execution state of the first transaction corresponding to the first transaction information, the apparatus 1 is specifically configured to:
[0359] When the first transaction corresponding to the first transaction information is in a transaction execution state, if the second sub-transaction is an executed transaction during the execution of the first sub-transaction, the execution of the first sub-transaction is aborted and the transaction modification operation performed for the second sub-transaction is reversed during the rolling back of the first transaction; the transaction modification operation includes a write operation and / or a delete operation on a tuple version of the associated processing tuple read by the second sub-transaction.
[0360] After the apparatus 1 executes the step of reversing the transaction modification operation performed for the second sub-transaction, the apparatus 1 is further configured to:
[0361] The storage state of the associated processing tuple corresponding to the transaction modification operation is configured as an invalid storage state; the invalid storage state is used to instruct the tuple manager deployed in the non-volatile storage space to add the associated tuple storage address of the associated processing tuple corresponding to the invalid storage state to a recycling space; the associated tuple storage address added in the recycling space is used to perform space multiplexing on the tuple storage space corresponding to the associated tuple storage address when space configuration is performed by the tuple manager.
[0362] The tuple storage address of the target tuple is the storage address of an initial storage state of the target tuple, the initial storage state is a storage state in the plurality of storage states, the index file deployed in the non-volatile storage space includes a target index set used to map a target index identifier, in a target index item corresponding to the target index identifier pre-stored in the target index set, a target key-value pair is stored, the target key-value pair takes the target index identifier as a key and an initial storage address offset in initial storage state data corresponding to the initial storage state as a value; the initial storage address offset refers to an offset between an index file address of the index file and the storage address of the initial storage state of the target tuple; the initial storage state of the target tuple refers to a storage state used to store the target tuple that is first constructed when the target tuple is inserted into the tuple heap; the index file address of the index file is an index storage address corresponding to the target index identifier;
[0363] The index identifier searching module 12 is specifically used for:
[0364] In response to finding the target index identifier, a target index item corresponding to the target index identifier is acquired in the target index set of the index file, and a target key-value pair is acquired from the target index item;
[0365] The initial storage address offset acquired from the target key-value pair is determined as the storage address offset corresponding to the target index identifier;
[0366] When the target index identifier is an index identifier in the index file, the index storage address corresponding to the target index identifier is determined through the index file address of the index file pre-stored in the directory file of the non-volatile storage space.
[0367] The storage state set determining module 13 is specifically used for:
[0368] The storage address of the initial storage state of the target tuple is determined through the storage address offset and the index storage address, and the initial storage state data corresponding to the initial storage state of the target tuple is accessed through the storage address of the initial storage state of the target tuple; the initial storage state data at least includes an address offset field;
[0369] If the field value of the address offset field is not the preset address offset value, and the field value of the address offset field is an initial storage address offset value consistent with the stored address offset value, the updating storage address offset value having a first index relationship with the initial storage address offset value is found; the updating storage address offset value refers to the offset between the index file address of the index file and the storage address of the updating storage state of the target tuple; the updating storage state is the next storage state of the initial storage state;
[0370] In response to finding the updating storage address offset value, the storage address of the updating storage state of the target tuple is determined through the updating storage address offset value and the index file address, and the updating storage state having the first state link relationship with the initial storage state is obtained through the storage address of the updating storage state of the target tuple;
[0371] The target storage address offset value having a second index relationship with the updating storage address offset value is found, and if the target storage address offset value is the initial storage address offset value, the storage state having the second state link relationship with the updating storage state is determined as the initial storage state; through the first state link relationship and the second state link relationship, the first state set for cyclically storing the target tuple composed of the initial storage state and the updating storage state is determined as the storage state set of the target tuple.
[0372] Optionally, the storage state set determination module 13 is further configured to:
[0373] If the field value of the address offset field is the preset address offset value, it is determined that only the initial storage state of the target tuple exists in the tuple heap where the plurality of tuples are located, and the next storage state of the initial storage state of the target tuple does not exist yet;
[0374] The second state set for storing the target tuple composed of the initial storage state of the target tuple is determined as the storage state set of the target tuple.
[0375] Optionally, the one or more data processing instructions are instructions in the first transaction information carried in the data processing request, and the one or more data processing instructions include a read instruction corresponding to a read type when the request type of the data processing request includes the read type;
[0376] The apparatus 1 is further configured to:
[0377] If the storage state set of the target tuple only includes the initial storage state of the target tuple, and the next storage state of the initial storage state of the target tuple does not exist yet, the field value of the storage time field corresponding to the initial storage state of the target tuple is obtained from the initial storage state data corresponding to the initial storage state of the target tuple according to the read type, wherein the initial storage state of the target tuple refers to the storage state that is used to store the tuple data of the target tuple for the first time before the multiple storage states are constituted, and the field value of the storage time field of the initial storage state of the target tuple is the initial storage timestamp;
[0378] The transaction start timestamp of the first transaction corresponding to the first transaction information is obtained, and the transaction start timestamp is determined as the instruction start timestamp corresponding to the read instruction;
[0379] The initial storage timestamp is compared with the instruction start timestamp to obtain a first comparison result;
[0380] If the first comparison result indicates that the initial storage timestamp is less than or equal to the instruction start timestamp, the tuple data of the target tuple is read from the initial storage state data corresponding to the initial storage state of the target tuple according to the read type; or,
[0381] If the first comparison result indicates that the initial storage timestamp is greater than the instruction start timestamp, the first transaction is rolled back.
[0382] Optionally, the one or more data processing instructions are instructions in the first transaction information carried in the data processing request, and the one or more data processing instructions include a write instruction corresponding to a write type when the request type of the data processing request includes the write type.
[0383] The apparatus 1 is also configured to:
[0384] If the storage state set of the target tuple only includes the initial storage state of the target tuple, and the next storage state of the initial storage state of the target tuple does not exist yet, the second tuple storage space is configured for the target tuple in the non-volatile storage space based on the write type, the next storage state of the initial storage state of the target tuple is created in the second tuple storage space, the storage state data corresponding to the initial storage state of the target tuple is determined as the initial storage state data, and when the next storage state of the initial storage state of the target tuple is determined as the update storage state of the target tuple, the storage state data corresponding to the update storage state of the target tuple is determined as the update storage state data; the second tuple storage space is used to store the second storage address of the update storage state of the target tuple; the tuple storage space corresponding to the initial storage state is the first tuple storage space of the target tuple, and the first tuple storage space is used to store the first storage address of the initial storage state of the target tuple;
[0385] read the initial tuple data of the target tuple from the initial storage state data corresponding to the initial storage state read through the first storage address in the first tuple storage space, and determine the target tuple data of the target tuple for writing into the update storage state data corresponding to the update storage state based on the transaction detail data of the first transaction corresponding to the first transaction information and the initial tuple data of the target tuple read.
[0386] In the step of adding the update storage state of the target tuple to the tuple heap where the plurality of tuples are located, a field value of a tuple data field of the target tuple is configured as the target tuple data of the target tuple in the update storage state data corresponding to the update storage state.
[0387] establishing a first state linkage relationship between the initial storage state and the update storage state; the first state linkage relationship refers to a relationship for describing that a field value of an address offset field in the update storage state data corresponding to the update storage state points to a field value of an address offset field in the initial storage state data corresponding to the initial storage state, wherein when the first transaction is in a transaction execution state, the field value of the address offset field in the initial storage state data corresponding to the initial storage state is maintained as a preset address offset value, the field value of the address offset field in the update storage state data corresponding to the update storage state is an update storage address offset, the update storage address offset is an offset having a first index relationship with a storage address offset, the update storage address offset is determined by an offset between a second storage address of the update storage state and an index storage address of an index file in the non-volatile storage space, and the storage address offset is determined by an initial storage address offset between a first storage address of the initial storage state and the index storage address of the index file.
[0388] The field in the update storage state data corresponding to the update storage state includes a tuple data field and an atomic locking field; the field value of the atomic locking field is used to describe that the update storage state is locked when the write operation indicated by the first transaction is executed.
[0389] When the device 1 executes the step of configuring the field value of the tuple data field of the target tuple as the target tuple data of the target tuple in the update storage state data corresponding to the update storage state, the device 1 is further specifically used for:
[0390] In the update storage state data corresponding to the update storage state, the field value of the atomic locking field is configured as a lock value for representing locking the update storage state, and based on the lock value, the field value of the tuple data field is configured as the target tuple data of the target tuple.
[0391] Optionally, after the device 1 configures the field value of the tuple data field as the target tuple data of the target tuple in executing the write operation indicated by the write instruction based on the lock value, the device 1 is further configured to:
[0392] In the update storage state data corresponding to the update storage state, the field value of the atomic lock field is updated from the lock value to an unlock value used for unlocking the update storage state; the unlock value is used to indicate that, when the read operation and / or the write operation indicated by the second transaction is executed, the target tuple data can be accessed and read by the second transaction in the update storage state data corresponding to the update storage state; the second transaction is a transaction other than the first transaction.
[0393] In the update storage state data corresponding to the update storage state, the field includes a storage time field, and the field value of the storage time field is a preset time threshold value used for representing that the first transaction is in the transaction execution state when the first transaction is executed; the non-volatile storage space includes a transaction commit log list used for recording the committed transactions;
[0394] The device 1 is further configured to:
[0395] When it is checked that the instruction operation indicated by each data processing instruction in the one or more data processing instructions has been executed, the transaction end time stamp used for representing that the first transaction is executed is obtained;
[0396] In the update storage state data corresponding to the update storage state, the field value of the storage time field is updated from the preset time threshold value to the transaction end time stamp, and the first transaction identifier of the first transaction is submitted to the transaction commit log list, and the first transaction identifier submitted to the transaction commit log list is used to determine that the first transaction is a committed transaction; the storage time stamp corresponding to the update storage state is the transaction end time stamp.
[0397] In the initial storage state data corresponding to the initial storage state, the field value of the address offset field is a preset address offset value;
[0398] After the device 1 submits the first transaction identifier of the first transaction to the transaction commit log list, the device 1 is further configured to:
[0399] The field value of the address offset field in the initial storage state data corresponding to the initial storage state is updated from the preset address offset value to the initial storage address offset of the initial storage state; the initial storage address offset is determined by the offset between the first storage address of the initial storage state and the index storage address of the index file;
[0400] when the first state linkage relationship exists between the initial storage state and the updated storage state and the updated storage state is a next version of the initial storage state, establishing a second state linkage relationship between the initial storage state and the updated storage state, the second state linkage relationship being a relationship used to describe a field value of an address offset field in initial storage state data corresponding to the initial storage state pointing to a field value of an address offset field in updated storage state data corresponding to the updated storage state;
[0401] The first state set for cyclically storing the tuple data of the target tuple is constructed through the first state linkage relationship, the second state linkage relationship, the initial storage state, and the updated storage state; and the first state set is one of the storage state sets of the target tuple.
[0402] The storage time stamps corresponding to the plurality of storage states include a first storage time stamp corresponding to the initial storage state and a second storage time stamp corresponding to the updated storage state; the one or more data processing instructions are instructions in first transaction information carried in the data processing request; the instruction time stamp is a transaction start time stamp configured when a first transaction corresponding to the first transaction information is started; the tuple data of the target tuple in the initial storage state data corresponding to the initial storage state is initial tuple data, and the tuple data of the target tuple in the updated storage state data corresponding to the updated storage state is target tuple data.
[0403] The operation execution module 15 is specifically configured to:
[0404] If the first storage time stamp is a preset first time threshold, the second storage time stamp is compared with the transaction start time stamp to obtain a second comparison result when the initial storage state is determined to be the invalid storage state.
[0405] If the second comparison result indicates that the second storage time stamp is less than or equal to the transaction start time stamp, the updated storage state is determined to be the target storage state.
[0406] If the request type of the data processing request is a read type, the target tuple data is read from the updated storage state data corresponding to the updated storage state when a read operation indicated by the read type is performed on the target tuple in the target storage state; or
[0407] If the request type of the data processing request is a write type, the target tuple data is read from the updated storage state data corresponding to the updated storage state when a write operation indicated by the write type is performed on the target tuple in the target storage state, and the initial tuple data in the initial storage state data corresponding to the initial storage state with invalidity is updated through the read target tuple data and transaction detail data indicated by the first transaction.
[0408] Optionally, the plurality of storage states respectively correspond to a first storage timestamp corresponding to the initial storage state and a second storage timestamp corresponding to the updated storage state; the one or more data processing instructions are instructions in the first transaction information carried in the data processing request; the instruction timestamp is a transaction start timestamp configured when the first transaction corresponding to the first transaction information is started; the tuple data of the target tuple in the initial storage state data corresponding to the initial storage state is initial tuple data, and the tuple data of the target tuple in the updated storage state data corresponding to the updated storage state is target tuple data;
[0409] The operation execution module 15 is specifically configured to:
[0410] When the first storage timestamp is not the preset first time threshold, the first storage timestamp and the transaction start timestamp are compared, and the second storage timestamp and the transaction start timestamp are compared to obtain a third comparison result;
[0411] If the third comparison result indicates that the first storage timestamp and the second storage timestamp are both less than or equal to the transaction start timestamp, when the request type of the data processing request is a write type, the second storage timestamp and the first storage timestamp are compared to obtain a fourth comparison result;
[0412] If the fourth comparison result indicates that the second storage timestamp is greater than the first storage timestamp, it is determined that the initial storage state is a storage state in a locked state, and it is determined that the updated storage state is a target storage state;
[0413] In the target storage state, when a write operation indicated by the write type is performed on the target tuple, the target tuple data is read from the updated storage state data corresponding to the updated storage state, and the initial tuple data in the initial storage state data corresponding to the initial storage state in the locked state is updated by using the read target tuple data and the transaction detail data indicated by the first transaction.
[0414] It can be seen that, by deploying the index file for identity indexing and the tuple heap for tuple storage in the non-volatile storage space, the embodiment of the present application can realize the separate storage of tuple data and index identity of the tuple, so that when identity indexing is performed through the index file storing a large number of index identities, it is not necessary to perform full scan on the entire business table where the tuple heap storing a large amount of tuple data is located, so that the table lookup of the entire table of the business table where the tuple heap is located can be avoided from the root, which means that the embodiment of the present application can quickly read the index file through the index storage address of the index file stored in the directory file, and quickly locate and find the target index identity matching the tuple identity of the current index (i.e. the to-be-matched index identity) in the index file through identity indexing. In addition, the embodiment of the present application can determine the valid version from the two versions in the cyclic double version through the relationship between the storage time stamp of the two versions (such as the initial storage state storage time stamp corresponding to the initial storage state and the updated storage state storage time stamp corresponding to the updated storage state) and the transaction start time stamp of the current executed transaction (i.e. the first transaction), and then can ensure the reliability of subsequent operation execution and the consistency of data reading through the valid version (i.e. the above target storage state). Therefore, when performing the instruction operation indicated by the data processing instruction on the target tuple in the target storage state, not only the operation execution efficiency can be improved, but also the accuracy of operation execution can be ensured.
[0415] Further, please refer to Figure 2 , Figure 2 is a structural schematic diagram of a computer device provided by the embodiment of the present application. As shown in Figure 2 , the computer device 1000 can be a user terminal, for example, the user terminal 200a in the above-mentioned Figure 2 corresponding embodiment, and can also be a server, for example, the server 200b in the above-mentioned Figure 2The server 100a in the corresponding embodiment will not be limited here. For ease of understanding, the present application takes a computer device as an example, which is a server. The computer device 1000 can include a processor 1001, a network interface 1004 and a memory 1005. In addition, the computer device 1000 can further include a user interface 1003 and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between the components. The user interface 1003 can further include a standard wired interface and a wireless interface. The network interface 1004 can optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 can be a non-volatile memory, for example, can be a phase change memory (PCM), a variable resistance memory (ReRAM) and a spin torque memory (STT-RAM) and the like. The memory 1005 can also be at least one storage device located away from the aforementioned processor 1001. As shown in the figure, the memory 1005 as a computer readable storage medium can include an operating system, a network communication module, a user interface module and a device control application program. Figure 2 As shown in the figure, the memory 1005 as a computer readable storage medium can include an operating system, a network communication module, a user interface module and a device control application program.
[0416] The network interface 1004 in the computer device 1000 can also provide network communication functions. Figure 2 As shown in the figure, the network interface 1004 in the computer device 1000 can provide network communication functions; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application program stored in the memory 1005 to execute the foregoing Figure 2 、 Figure 2 or Figure 2 The description of the data processing method based on the non-volatile storage space in the corresponding embodiment can also execute the foregoing Figure 2 The description of the data processing device 1 based on the non-volatile storage space in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated here.
[0417] In addition, it should be pointed out here that the present application also provides a computer readable storage medium, and the computer readable storage medium stores the computer program executed by the foregoing data processing device 1 based on the non-volatile storage space, and the computer program includes computer instructions. When the processor executes the computer instructions, the foregoing Figure 2 、 Figure 2 or Figure 2The description of the data processing method based on the non-volatile storage space in the corresponding embodiments will not be repeated here. In addition, the description of the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the computer-readable storage medium embodiments involved in the present application, please refer to the description of the method embodiments of the present application. As an example, computer instructions can be deployed on one computer device for execution, or on multiple computer devices located in one place for execution, or on multiple computer devices distributed in multiple places and interconnected through a communication network for execution. The multiple computer devices distributed in multiple places and interconnected through a communication network can constitute a blockchain system.
[0418] In addition, it should be noted that the computer program product or computer program provided by the embodiments of the present application can include computer instructions, which can be stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor can execute the computer instructions to make the computer device execute the foregoing Figure 2 、 Figure 2 or Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 Figure 2 The description of the data processing method based on the non-volatile storage space in the corresponding embodiments will not be repeated here. In addition, the description of the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the computer program product or computer program embodiments involved in the present application, please refer to the description of the method embodiments of the present application.
[0419] The above disclosure is only the preferred embodiments of the present application, and of course cannot limit the scope of the rights of the present application, so the equivalent changes made according to the claims of the present application still fall within the scope covered by the present application.
Claims
1. A data processing method based on a nonvolatile storage space, characterized by, The non-volatile storage space includes a plurality of tuples, and the plurality of tuples are respectively indexable by index identifiers pre-stored in the non-volatile storage space. The method comprises: obtaining a data processing request, the data processing request carrying a to-be-matched index identifier and one or more data processing instructions; finding a target index identifier matching the to-be-matched index identifier in the non-volatile storage space; in response to finding the target index identifier, determining a target index identifier corresponding index storage address and storage address offset pre-stored in the non-volatile storage space, the storage address offset being an offset between the index storage address and a tuple storage address of a target tuple corresponding to the target index identifier; determining the tuple storage address by the storage address offset and the index storage address to determine a storage state set of the target tuple, the storage state set including at least one storage state; if the storage state set includes a plurality of storage states, obtaining storage time stamps corresponding to the plurality of storage states respectively, and an instruction time stamp corresponding to the data processing instruction; the storage time stamps corresponding to the plurality of storage states respectively include a first storage time stamp corresponding to an initial storage state and a second storage time stamp corresponding to an updated storage state; one or more of the data processing instructions are instructions in first transaction information carried in the data processing request; the instruction time stamp is a transaction start time stamp configured when starting a first transaction corresponding to the first transaction information; based on the storage time stamps corresponding to the plurality of storage states respectively and the instruction time stamp corresponding to the data processing instruction, determining a target storage state corresponding to the target tuple in the plurality of storage states, and executing an instruction operation indicated by the data processing instruction on the target tuple in the target storage state; the target storage state is determined by the updated storage state when the second storage time stamp is greater than the first storage time stamp and the second storage time stamp is less than the transaction start time stamp.
2. The method of claim 1, wherein, The non-volatile storage space is deployed with an index file for indexing pre-stored index identifiers, one or more of the data processing instructions are instructions in first transaction information carried in the data processing request, and the data processing request is a request obtained by a first thread in a thread pool corresponding to the non-volatile storage space; The method comprises: when starting a first transaction corresponding to the first transaction information by the first thread, configuring a transaction start time stamp for the first transaction, and configuring a transaction state of the first transaction as a transaction execution state when executing the first transaction based on the transaction start time stamp; in the transaction execution state, finding a target index identifier matching the to-be-matched index identifier through the index file.
3. The method of claim 2, wherein, The nonvolatile storage space is arranged with a tuple heap for storing the plurality of tuples, and the index file comprises a plurality of index sets determined by mapping the index identifiers of the tuples in the tuple heap, and the index sets are used for pre-storing the index identifiers of the tuples; The index file is used to find a target index identifier matching the to-be-matched index identifier in the transaction execution state, comprising: In the transaction execution state, the to-be-matched index identifier is mapped, and an index set used for mapping the to-be-matched index identifier is determined as a target index set in the plurality of index sets; The target index set is used to find a target index identifier matching the to-be-matched index identifier.
4. The method of claim 3, wherein the nonvolatile storage space comprises a directory file, and the directory file stores an index file address of the index file; In the transaction execution state, the to-be-matched index identifier is mapped, and an index set used for mapping the to-be-matched index identifier is determined as a target index set in the plurality of index sets, comprising: When it is determined that the first transaction is being executed based on the transaction execution state, the index file is obtained through the index file address in the directory file; A plurality of index sets used for hash indexing are obtained from the index file, and one index set corresponds to one set identifier; The to-be-matched index identifier is hash calculated to obtain an index hash value of the to-be-matched index identifier, and the set number of the plurality of index sets is calculated by taking the remainder of the index hash value, to obtain a remainder of the index hash value; In the plurality of set identifiers corresponding to the plurality of index sets, a set identifier matching the remainder of the index hash value is found, and the index set corresponding to the found set identifier is determined as the target index set used for mapping the to-be-matched index identifier.
5. The method of claim 4, wherein, The table where the tuple heap is located is a business table, and the directory file further stores a table address of the business table where the tuple heap is located; The method further comprises: An index file with an initial index address of the index file address is created, a plurality of initial sets are configured in the index file, and an address mapping relationship between the table address and the index file address is established. When the business table is obtained through the table address in the directory file, the tuple heap in the business table is obtained, a to-be-mapped tuple is obtained from the plurality of tuples contained in the tuple heap, and a tuple identifier of the to-be-mapped tuple is determined as a to-be-mapped tuple identifier; When the index file address corresponding to the table address is obtained through the address mapping relationship, the index file is obtained through the index file address, and the plurality of initial sets in the index file are obtained; The to-be-mapped tuple identifier is mapped, and the to-be-mapped tuple identifier is mapped and stored to a target initial set in the plurality of initial sets according to the mapping result. After the tuple identifier of each tuple in the tuple heap is selected as the to-be-mapped tuple identifier for identity mapping, it is confirmed that the tuple identifiers in the tuple heap are respectively mapped and stored in the plurality of initial sets, and the plurality of initial sets in which the mapping storage is completed are taken as the plurality of index sets, and a target index address, which is an index file address of the index file in which the plurality of index sets are located, is updated and stored in the directory file; the tuple identifier mapped and stored in the plurality of index sets is an index identifier used for indexing.
6. The method of claim 5, wherein, The identity mapping of the to-be-mapped tuple identifier and the mapping storage of the to-be-mapped tuple identifier to the target initial set according to the identity mapping result include: Hash calculation is performed on the to-be-mapped tuple identifier to obtain a to-be-mapped index hash value of the to-be-mapped tuple identifier; Residue calculation is performed on the number of sets of the plurality of initial sets through the to-be-mapped index hash value to obtain a residue of the to-be-mapped index hash value; In the plurality of initial sets, a set identifier corresponding initial set that is consistent with the residue of the to-be-mapped index hash value is found, the found initial set is taken as the target initial set, and the target initial set is determined as the identity mapping result of the identity mapping of the to-be-mapped tuple identifier; According to the identity mapping result, an index item corresponding to the to-be-mapped tuple identifier is added and stored in the target initial set; the index item corresponding to the to-be-mapped tuple identifier is used for storing a key-value pair with the to-be-mapped tuple identifier as the key and an initial storage address offset corresponding to an initial storage state of the to-be-mapped tuple as the value; the initial storage state of the to-be-mapped tuple refers to the storage state used for storing the to-be-mapped tuple that is first constructed when the to-be-mapped tuple is inserted in the tuple heap.
7. The method of claim 3, wherein, One or more of the data processing instructions are instructions in first transaction information carried in the data processing request; The method further includes: In response to the target index identifier not being found, it is determined that there is no target tuple in the plurality of tuples that matches the to-be-processed tuple corresponding to the to-be-matched index identifier, and when a transaction state of a first transaction corresponding to the first transaction information is a transaction execution state, the first transaction is transaction-rolled back.
8. The method of claim 7, wherein, The method further includes: In response to the target index identifier not being found, an insertion operation for tuple insertion is detected in an instruction operation indicated by one or more of the data processing instructions; In response to the detected insertion operation, a first tuple storage space is configured in the non-volatile storage space for the to-be-processed tuple corresponding to the to-be-matched index identifier, an initial storage state of the to-be-processed tuple is created in the first tuple storage space, and tuple data of the to-be-processed tuple is written in initial storage state data corresponding to the initial storage state; or, In response to the insertion operation not being detected, the first transaction is aborted.
9. The method of claim 7, wherein, The plurality of data processing instructions include a first data processing instruction and a second data processing instruction, the first transaction includes a first sub-transaction corresponding to the first data processing instruction and a second sub-transaction corresponding to the second data processing instruction; the tuple corresponding to the first sub-transaction is the to-be-processed tuple; the tuple corresponding to the second sub-transaction is the correlation processing tuple; the correlation processing tuple is a tuple in the tuple heap; When the transaction state of the first transaction corresponding to the first transaction information is a transaction execution state, the method further includes: When the transaction state of the first transaction corresponding to the first transaction information is a transaction execution state, if the second sub-transaction is an executed transaction during execution of the first sub-transaction, during transaction rollback of the first transaction, execution of the first sub-transaction is stopped, and transaction modification operations performed for the second sub-transaction are revoked; the transaction modification operations include write operations and / or delete operations on tuple versions of the correlation processing tuple read by the second sub-transaction.
10. The method of claim 9, wherein, After the transaction modification operations performed for the second sub-transaction are revoked, the method further includes: The storage state of the correlation processing tuple corresponding to the transaction modification operations is configured as an invalid storage state; the invalid storage state is used to instruct a tuple manager deployed in the non-volatile storage space to add the correlation tuple storage address of the correlation processing tuple corresponding to the invalid storage state to a recycling space; the added correlation tuple storage address in the recycling space is used to perform space multiplexing on a tuple storage space corresponding to the correlation tuple storage address when space configuration is performed by the tuple manager.
11. The method of claim 3, wherein, The tuple storage address of the target tuple is a storage address of an initial storage state of the target tuple, the initial storage state is a storage state in the plurality of storage states, an index file deployed in the non-volatile storage space includes a target index set used to map storage of the target index identifier, a target key-value pair with the target index identifier as a key and an initial storage address offset in initial storage state data corresponding to the initial storage state as a value is stored in a target index item corresponding to the target index identifier pre-stored in the target index set; the initial storage address offset refers to an offset between an index file address of the index file and the storage address of the initial storage state of the target tuple; the initial storage state of the target tuple refers to a storage state used to store the target tuple that is first constructed when the target tuple is inserted in the tuple heap; the index file address of the index file is an index storage address corresponding to the target index identifier; The method further includes: In response to finding the target index identifier, determining an index storage address and a storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space, includes: In response to finding the target index identifier, the target index item corresponding to the target index identifier is obtained in the target index set of the index file, and the target key-value pair is obtained from the target index item; The initial storage address offset obtained from the target key-value pair is determined as the storage address offset corresponding to the target index identifier; When the target index identifier is an index identifier in the index file, the index file address of the index file pre-stored in the directory file of the non-volatile storage space is used to determine the index storage address corresponding to the target index identifier.
12. The method of claim 11, wherein, The determination of the tuple storage address through the storage address offset and the index storage address includes: The initial storage state address of the target tuple is determined through the storage address offset and the index storage address, and the initial storage state data corresponding to the initial storage state of the target tuple is accessed through the initial storage state address of the target tuple; the initial storage state data at least includes an address offset field; If the field value of the address offset field is not a preset address offset value, and the field value of the address offset field is the initial storage address offset consistent with the storage address offset, an update storage address offset having a first index relationship with the initial storage address offset is found; the update storage address offset refers to the offset between the index file address of the index file and the storage address of the update storage state of the target tuple; the update storage state is the next storage state of the initial storage state; In response to finding the update storage address offset, the storage address of the update storage state of the target tuple is determined through the update storage address offset and the index file address, and the update storage state having a first state link relationship with the initial storage state is obtained through the storage address of the update storage state of the target tuple; If the target storage address offset is the initial storage address offset, the storage state having a second state link relationship with the update storage state is determined as the initial storage state, and a first state set for circularly storing the target tuple, which is composed of the initial storage state and the update storage state, is determined as the storage state set of the target tuple through the first state link relationship and the second state link relationship.
13. The method of claim 12, wherein, The method further includes: If the field value of the address offset field is a preset address offset value, it is determined that only the initial storage state of the target tuple exists in the tuple heap where the plurality of tuples are located, and the next storage state of the initial storage state of the target tuple does not exist; A second state set for storing the target tuple, which is composed of the initial storage state of the target tuple, is determined as the storage state set of the target tuple.
14. The method of claim 1 or 13, wherein, The one or more data processing instructions are instructions in first transaction information carried in the data processing request, and when a request type of the data processing request comprises a read type, the one or more data processing instructions comprise a read instruction corresponding to the read type; The method further comprises: If the storage state set of the target tuple only comprises an initial storage state of the target tuple, and a next storage state of the initial storage state of the target tuple does not exist, a field value of a storage time field corresponding to the initial storage state of the target tuple is obtained from initial storage state data corresponding to the initial storage state of the target tuple according to the read type; the initial storage state of the target tuple refers to a storage state in which tuple data of the target tuple is first stored before the plurality of storage states are constituted; and the field value of the storage time field of the initial storage state of the target tuple is an initial storage timestamp; A transaction start timestamp of a first transaction corresponding to the first transaction information is obtained, and the transaction start timestamp is determined as an instruction start timestamp corresponding to the read instruction; The initial storage timestamp is compared with the instruction start timestamp to obtain a first comparison result; If the first comparison result indicates that the initial storage timestamp is less than or equal to the instruction start timestamp, tuple data of the target tuple is read from the initial storage state data corresponding to the initial storage state of the target tuple according to the read type; or If the first comparison result indicates that the initial storage timestamp is greater than the instruction start timestamp, transaction rollback is performed on the first transaction.
15. The method of claim 1 or 13, wherein, The one or more data processing instructions are instructions in first transaction information carried in the data processing request, and when a request type of the data processing request comprises a write type, the one or more data processing instructions comprise a write instruction corresponding to the write type; The method further comprises: If the storage state set of the target tuple only comprises an initial storage state of the target tuple, and a next storage state of the initial storage state of the target tuple does not exist, a second tuple storage space is configured for the target tuple in the non-volatile storage space based on the write type, the next storage state of the initial storage state of the target tuple is created in the second tuple storage space, storage state data corresponding to the initial storage state of the target tuple is determined as initial storage state data, and when the next storage state of the initial storage state of the target tuple is determined as an update storage state of the target tuple, storage state data corresponding to the update storage state of the target tuple is determined as update storage state data; the second tuple storage space is used to store a second storage address of the update storage state of the target tuple; and a tuple storage space corresponding to the initial storage state is a first tuple storage space of the target tuple, and the first tuple storage space is used to store a first storage address of the initial storage state of the target tuple. read the initial tuple data of the target tuple from the initial storage state data corresponding to the initial storage state, and determine the target tuple data of the target tuple for writing into the update storage state data corresponding to the update storage state based on the transaction detail data of the first transaction corresponding to the first transaction information and the read initial tuple data of the target tuple; when adding the update storage state of the target tuple to the tuple heap where the plurality of tuples are located, configure a field value of a tuple data field of the target tuple as the target tuple data of the target tuple in the update storage state data corresponding to the update storage state; establish a first state linkage relationship between the initial storage state and the update storage state; the first state linkage relationship refers to a relationship for describing that a field value of an address offset field in the update storage state data corresponding to the update storage state points to a field value of an address offset field in the initial storage state data corresponding to the initial storage state, wherein when the first transaction is in a transaction execution state, the field value of the address offset field in the initial storage state data corresponding to the initial storage state is maintained as a preset address offset value, and the field value of the address offset field in the update storage state data corresponding to the update storage state is an update storage address offset, the update storage address offset is an offset having a first index relationship with the storage address offset, and the update storage address offset is determined by an offset between the second storage address of the update storage state and an index storage address of an index file in the non-volatile storage space, and the storage address offset is determined by an initial storage address offset between the first storage address of the initial storage state and the index storage address of the index file.
16. The method of claim 1, wherein, the tuple data of the target tuple in the initial storage state data corresponding to the initial storage state is initial tuple data, and the tuple data of the target tuple in the update storage state data corresponding to the update storage state is target tuple data; the target storage state corresponding to the target tuple is determined from the plurality of storage states based on the plurality of storage time stamps respectively corresponding to the plurality of storage states and the instruction time stamp corresponding to the data processing instruction, and the instruction operation indicated by the data processing instruction is executed on the target tuple in the target storage state, including: when the first storage time stamp is not a preset first time threshold, compare the first storage time stamp with the transaction start time stamp and compare the second storage time stamp with the transaction start time stamp to obtain a third comparison result; if the third comparison result indicates that the first storage timestamp and the second storage timestamp are both less than or equal to the transaction start timestamp, then when the request type of the data processing request is a write type, the second storage timestamp is compared with the first storage timestamp to obtain a fourth comparison result; if the fourth comparison result indicates that the second storage timestamp is greater than the first storage timestamp, then it is determined that the initial storage state is a storage state in a locked state, and the update storage state is determined as the target storage state; in the target storage state, when the write operation indicated by the write type is performed on the target tuple, the target tuple data is read from the update storage state data corresponding to the update storage state, and the initial tuple data in the initial storage state data corresponding to the initial storage state in the locked state is updated by using the read target tuple data and the transaction detail data indicated by the first transaction.
17. A data processing apparatus based on nonvolatile storage space, characterized by, The non-volatile storage space includes a plurality of tuples, and the plurality of tuples are set to be respectively indexable by index identifiers pre-stored in the non-volatile storage space. The apparatus comprises: a request acquisition module configured to acquire a data processing request, the data processing request carrying a to-be-matched index identifier and one or more data processing instructions; an index identifier searching module configured to search for a target index identifier matching the to-be-matched index identifier in the non-volatile storage space; the index identifier searching module is further configured to, in response to finding the target index identifier, determine an index storage address and a storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space, the storage address offset being an offset between the index storage address and a tuple storage address of a target tuple corresponding to the target index identifier; a storage state set determination module configured to determine the tuple storage address by using the storage address offset and the index storage address, to determine a storage state set of the target tuple, the storage state set including at least one storage state; a timestamp acquisition module configured to, if the storage state set includes a plurality of storage states, acquire storage timestamps respectively corresponding to the plurality of storage states and an instruction timestamp corresponding to the data processing instructions; the storage timestamps respectively corresponding to the plurality of storage states include a first storage timestamp corresponding to an initial storage state and a second storage timestamp corresponding to an update storage state; one or more of the data processing instructions are instructions in first transaction information carried in the data processing request; and the instruction timestamp is a transaction start timestamp configured when a first transaction corresponding to the first transaction information is started. The operation execution module is configured to determine a target storage state corresponding to the target tuple from the plurality of storage states based on a storage timestamp corresponding to each of the plurality of storage states and an instruction timestamp corresponding to the data processing instruction, and execute an instruction operation indicated by the data processing instruction on the target tuple in the target storage state; the target storage state is determined by the update storage state when the second storage timestamp is greater than the first storage timestamp and the second storage timestamp is less than the transaction start timestamp.
18. A computer device, comprising: comprising a memory and a processor; The memory is connected with the processor, and the memory is configured to store a computer program, and the processor is configured to call the computer program to enable the computer device to execute the method in any one of claims 1-16.
19. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is adapted to be loaded and executed by the processor to enable a computer device having the processor to execute the method in any one of claims 1-16.
20. A computer program product, characterised in that, comprising a computer program / instruction stored in a computer readable storage medium, when the processor of a computer device reads the computer program / instruction from the computer readable storage medium, the computer program / instruction is executed by the processor to enable the computer device to implement the method in any one of claims 1-16.
Citation Information
Patent Citations
Memory system, memory controller and operating method thereof
CN112634963A
Data storage method, device and equipment and readable storage medium
CN112988042A