Data processing method and device based on nonvolatile storage space and related equipment
By using pre-store index identifiers in nonvolatile storage space for indexing and adopting a circular dual-version storage method, the problems of low search efficiency, high energy consumption and data loss in DRAM in data storage are solved, and efficient, low energy consumption and reliable data processing are achieved.
Patent Information
- Application Number
- CN202411767203.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-11-30
AI Technical Summary
When using DRAM for data storage, the presence of a large number of tuple versions leads to an increase in positioning and search time, and due to the volatile nature of DRAM, frequent refreshes are required to save data, resulting in high energy consumption and data loss problems.
The data processing method based on non-volatile storage space is adopted, and the index is indexed by pre-stored index identifiers, and the search efficiency is reduced. The dual-version storage method is used to avoid frequent refreshes and data loss.
Improves tuple search efficiency and operational execution efficiency, reduces energy consumption, and ensures data durability and reliability.
Smart Images

Figure CN119718191A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a data processing method, apparatus and related equipment based on non-volatile storage space. Background Art
[0002] The storage engine is the core component responsible for data storage, retrieval and management in the database management system (DBMS). In the DBMS, when the storage engine is used to store the read-write data sets required to execute a transaction, dynamic random access memory (DRAM) is mostly used to store these read-write data sets.
[0003] However, the inventors have found in practice that in the process of storing the read-write data set for executing certain transactions through DRAM, multiple tuple versions of the tuple corresponding to a certain read-write data set are often stored. Therefore, when there are other transactions that update the tuple, a new tuple version will continue to be created based on the existing multiple tuple versions, which means that when a large number of tuples are stored in the DRAM, there will be a large number of tuple versions of a large number of tuples. Therefore, when it is necessary to find and locate a certain tuple in a large number of tuple versions of a large number of tuples, a long positioning search time will be consumed, so that the tuple search efficiency will be reduced. In addition, since 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, that is, the DRAM needs to use capacitors to save each bit of data in the read-write data set, therefore, it is necessary to regularly and frequently consume a large amount of energy consumption (for example, 24% to 40% of the total energy consumption of the entire DRAM) to perform refresh operations to check and replenish the power of the capacitor. In addition, when DRAM is used to store read and write data sets for executing certain transactions, there is a phenomenon of storage data loss due to power outages. Therefore, when a tuple needs to be updated for a certain transaction, it will be difficult to quickly read the corresponding data set due to the loss of storage data, which will in turn affect the execution efficiency of the request operation related to the transaction to a certain extent. Summary of the invention
[0004] The embodiments of the present application provide a data processing method, apparatus and related equipment based on non-volatile storage space, which can improve tuple search efficiency and operation execution efficiency.
[0005] On one hand, an embodiment of the present application provides a data processing method based on a non-volatile storage space, wherein the non-volatile storage space includes a plurality of tuples, and the plurality of tuples are configured to be indexed by index identifiers pre-stored in the non-volatile storage space, respectively. The method includes:
[0006] Obtaining a data processing request, the data processing request carrying an index identifier to be matched and one or more data processing instructions;
[0007] Searching for a target index identifier that matches the to-be-matched index identifier in the non-volatile storage space;
[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 the target tuple corresponding to the target index identifier;
[0009] 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, wherein the storage state set includes at least one storage state;
[0010] If the storage state set includes multiple storage states, obtaining storage timestamps corresponding to the multiple storage states and an instruction timestamp corresponding to the data processing instruction;
[0011] Based on the storage timestamps corresponding to the multiple storage states and the instruction timestamps corresponding to the data processing instructions, a target storage state corresponding to the target tuple is determined in the multiple storage states, and in the target storage state, the instruction operation indicated by the data processing instruction is executed on the target tuple.
[0012] On one hand, an embodiment of the present application provides a data processing device based on a non-volatile storage space, wherein the non-volatile storage space includes a plurality of tuples, and the plurality of tuples are configured to be indexed by index identifiers pre-stored in the non-volatile storage space, respectively, and the device includes:
[0013] A request acquisition module, used to acquire a data processing request, the data processing request carries an index identifier to be matched and one or more data processing instructions;
[0014] An index identifier search module, used to search for a target index identifier that matches the index identifier to be matched in the non-volatile storage space;
[0015] The index identifier search module is further used to determine, in response to finding the target index identifier, an index storage address and a storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space, wherein the storage address offset is an offset between the index storage address and a tuple storage address of the target tuple corresponding to the target index identifier;
[0016] A storage state set determination module, used to determine the tuple storage address through 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;
[0017] A timestamp acquisition module, used for acquiring storage timestamps corresponding to the multiple storage states and an instruction timestamp corresponding to the data processing instruction if the storage state set includes multiple storage states;
[0018] An operation execution module is used to determine a target storage state corresponding to a target tuple among multiple storage states based on storage timestamps corresponding to multiple storage states and instruction timestamps corresponding to data processing instructions, and to execute the instruction operation indicated by the data processing instruction on the target tuple in the target storage state.
[0019] On one hand, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method provided in the above aspect of the embodiment of the present application.
[0020] On one hand, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program is suitable for being loaded and executed by a processor, so that a computer device with a processor executes the method provided in the above aspect of the embodiment of the present application.
[0021] On the one hand, an embodiment of the present application provides a computer program product, which includes a computer program / instructions. The computer program / instructions are stored in a computer-readable storage medium. When a processor of a computer device reads the computer program / instructions from the computer-readable storage medium, the computer program / instructions are executed by the processor to cause the computer device to perform the method provided in the above aspect.
[0022] The computer device involved in the embodiment of the present application is deployed with a non-volatile storage space for persistent data storage. For example, the data persistently stored in the non-volatile storage space may specifically include multiple tuples, and each of the multiple tuples can be indexed by an index identifier pre-stored in the non-volatile storage space. In this way, when the computer device obtains a certain data processing request, it can obtain the index identifier to be matched and one or more data processing instructions carried in the data processing request; further, the computer device can search for a target index identifier that matches the index identifier to be matched in the non-volatile storage space, and then when the target index identifier matching the index identifier to be matched is found, in response to the found target index identifier, quickly determine the index storage address corresponding to the target index identifier pre-stored in the non-volatile storage space and the storage address offset corresponding to the target index identifier. Among them, it can be understood that the index storage address corresponding to the target index identifier can be used to identify the storage address of the target index identifier that can be indexed in the non-volatile storage space, and the storage address offset is the offset between the index storage address and the tuple storage address of the 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 the storage address of a specific storage state (e.g., an initial storage state or an initial version) of the target tuple in multiple tuples. This means that when the embodiment of the present application performs indexing by using the index identifier pre-stored in the non-volatile storage space, it is not necessary to perform a full scan of multiple tuples storing a large amount of complete tuple data, but directly utilizes the byte addressing capability of the non-volatile storage space (e.g., the characteristic that the reading of the non-volatile storage space is faster than the writing) to quickly locate and find the target index identifier that matches the currently searched tuple identifier (i.e., the index identifier to be matched) by identifying the index. Further, the embodiment of the present application can quickly determine (i.e., address) the tuple storage address of the target tuple corresponding to the target index identifier through the storage address offset corresponding to the pre-stored target index identifier and the index storage address corresponding to the target index identifier, and then the tuple storage address of the target tuple that can be addressed can be quickly addressed to the specific storage state of the target tuple (the specific storage state here can be the initial storage state of the target tuple), and then the initial storage address offset in the initial storage state can be used to determine whether the target tuple has other storage states. For example, 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 (for example, two or more than two), and then the state set in which multiple storage states are located can be collectively referred to as a storage state set. Based on this, the embodiment of the present application can ensure the efficiency of tuple search through the storage address offset corresponding to the stored target index identifier and the index storage address corresponding to the target index identifier.Furthermore, the computer device can obtain storage timestamps corresponding to multiple storage states, and obtain instruction timestamps corresponding to data processing instructions, and then determine the target storage state of the target tuple among multiple storage states through the obtained storage timestamps and instruction timestamps (that is, to ensure that when the transaction corresponding to one or more data storage instructions is executed normally, the computer device can read the storage state of the tuple data that most recently stores the target tuple), so that the instruction operation indicated by the corresponding data processing instruction can be executed on the target tuple under the target storage state. In this way, not only the efficiency of operation execution can be improved, but also the accuracy of operation execution can be ensured. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0024] Figure 1 It is a structural diagram of a network architecture provided by this application;
[0025] Figure 2 This is a schematic diagram of data interaction based on NVM architecture provided in an embodiment of the present application;
[0026] Figure 3 It is a flowchart of a data processing method based on non-volatile storage space provided by the present application;
[0027] Figure 4 This is a schematic diagram of a process of displaying transaction execution through a timeline provided by an embodiment of the present application;
[0028] Figure 5 This is a schematic diagram of a structure of forming a cyclic dual version through two storage states provided by an embodiment of the present application;
[0029] Figure 6 It is a schematic diagram of a scenario for determining a target index set in an index file provided by an embodiment of the present application;
[0030] Figure 7 It is a flowchart of performing a read operation on a target tuple based on a read request provided in an embodiment of the present application;
[0031] Figure 8 It is a schematic diagram of a process of updating a target tuple based on a write request provided in an embodiment of the present application;
[0032] Fig. 9It is a flowchart of another data processing method based on non-volatile storage space provided by the present application;
[0033] Fig.10 This is a flowchart of another data processing method based on non-volatile storage space provided by the present application;
[0034] Fig.11 is a flowchart of various stages involved in executing a first transaction provided by an embodiment of the present application;
[0035] Fig.12 This is a schematic diagram of a process for creating a cyclic dual version provided in an embodiment of the present application;
[0036] Fig.13 It is a schematic diagram of a scenario for conflict detection in a multi-transaction concurrent execution scenario provided by an embodiment of the present application;
[0037] Fig.14 The embodiment of the present application changes the request ratio and distribution in the YCSB benchmark test to evaluate the throughput of different data access systems;
[0038] Fig.15 It is a transaction abort statistics chart under different read-write ratios provided by an embodiment of the present application;
[0039] Fig.16 It is a transaction abort delay statistics graph provided by an embodiment of the present application;
[0040] Fig.17 This is a statistical chart showing the scalability of YCSB provided in an embodiment of the present application;
[0041] Fig.18 The embodiment of the present application provides the test results of transaction throughput for NVCaracal system, Falcon system and AKV system under TPC-C workload;
[0042] Fig.19 A statistical diagram of the number of transaction aborts under different contention situations is given;
[0043] Fig. 20 This is a statistical diagram for demonstrating TPC-C scalability provided by an embodiment of the present application;
[0044] Fig.21 The impact of different version numbers and different space allocation schemes provided in the embodiments of the present application on YCSB throughput;
[0045] Fig. 22 is a structural schematic diagram of a data processing device based on a non-volatile storage space provided in an embodiment of the present application;
[0046] Fig.23 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The concepts of the relevant technical terms involved in the embodiments of the present application are explained below:
[0048] 1. Non-volatile memory (NVM) refers to a memory in a computer device in which the stored data does not disappear when 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) with data persistence storage characteristics. The persistent storage here refers to a storage method in which the data is not lost after the computer device loses power or is accidentally shut down.
[0049] Among them, the non-volatile storage space (i.e., NVM space) may specifically include an index file for identification indexing and a tuple heap for data storage, where the index file may specifically include multiple index sets, and one index set is equivalent to a bucket in the field of data statistics. In addition, it can be understood that the reason why the embodiment of the present application needs to create an index file containing multiple index sets in the non-volatile storage space (i.e., NVM space) is to enable the index and data access of one or more tuples related to the transaction to be quickly realized directly through the index file when a transaction is executed through a thread in a computer device, thereby avoiding direct full-quantity table search of the entire table file where the tuple heap is located. This means that when the embodiment of the present application is indexed through each index set in the index file, the efficiency of tuple search and access can be improved from the root.
[0050] 2. The 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 embodiment of the present application is a key-value storage engine, and the key-value storage engine here can be specifically an AKV storage engine (i.e., Agile Key-Value Storage Engine) deployed in a computer device to adapt to the non-volatile storage space (i.e., NVM) configured. That is, in the embodiment of the present application, the data storage device used by a certain thread in the computer device when calling the AKV storage engine for data access is the non-volatile memory, the data access space corresponding to the non-volatile memory is the non-volatile storage space (i.e., NVM space), and the data access architecture corresponding to the non-volatile storage space (i.e., NVM space) is the NVM architecture. The embodiment of the present application can achieve high 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 here can specifically include but are not limited to: enterprise-level database systems, real-time data analysis platforms, cloud computing and big data platforms, high-end trading systems, and Internet of Things data management platforms.
[0052] Among them, for enterprise-level database systems, this technology (i.e., storage and access technology of storage engines based on NVM architecture) can be applied to enterprise-level database systems, especially those database solutions that require high performance and high reliability. It should be understood that this technology aims to significantly improve the storage efficiency and read and write performance of the database through a cyclic dual-version storage method and a cyclic dual-version concurrency control method. Among them, the storage space corresponding to the NVM architecture is the above-mentioned non-volatile storage space.
[0053] Among them, for the real-time data analysis platform, fast reading and processing of data is a key requirement. Therefore, in the real-time data analysis platform, the high performance requirements of real-time data analysis can be achieved through the cyclic dual-version storage method and cyclic dual-version concurrency control method involved in this technology (i.e., the storage and access technology of the storage engine based on the NVM architecture). For example, this 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] Among them, for cloud computing and big data platforms, a large number of data storage and access requests need to be processed. Therefore, when the technology (i.e., the storage and access technology of the storage engine based on the NVM architecture) is applied to the cloud storage and big data processing platform, a cyclic dual-version storage method and a cyclic dual-version concurrency control method can be used to provide an efficient data storage and access solution to improve the performance and reliability of the overall system.
[0055] Among them, for high-frequency trading systems, since this high-end trading system has extremely high requirements for the consistency of read and write performance, the cyclic dual-version concurrency control method involved in this technology can ensure data consistency while improving the performance of read operations. Therefore, this technology can be applied to high-frequency trading systems in the financial field to improve the efficiency of transaction processing.
[0056] Among them, for the IoT data management platform, considering that the IoT devices deployed in the IoT management platform will generate a large amount of data and the generated large amount of data needs to be processed in real time. Therefore, when this technology is applied to the IoT data management platform, it can provide efficient data storage and processing capabilities to meet the high performance requirements of IoT applications.
[0057] It should be understood that in the embodiment of the present application, for any tuple stored in the NVM space, there may be multiple versions of the same tuple, where one version may be equivalent to a storage state. In the multiple storage states, the storage state data corresponding to each storage state may be used to describe (i.e., characterize) the different tuple data stored for the same tuple at different storage timestamps for the corresponding transaction.
[0058] 3. A transaction refers to an operation sequence consisting of instruction operations indicated by one or more different data processing instructions. These instruction operations in the operation sequence are either all executed or not executed. In the embodiment of the present application, the transaction information obtained by the computer device from the data processing request may refer to the transaction content description information of the operation sequence corresponding to the transaction information to be executed by the computer device. At this time, one or more data processing instructions may 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) is to transfer a certain amount of virtual resources from one account (e.g., U1 account) to another account (e.g., U2 account), and the instruction operations indicated by each data processing instruction in the transaction information can be equivalently regarded as an operation sequence consisting of a series of instruction operations.
[0059] For example, in an embodiment of the present application, these instruction operations specifically include operations on a certain tuple (for example, tuple Y1, where tuple Y1 can be the account balance of the account U1) (for example, a read operation of reading the account balance of 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), and operations on another tuple (for example, tuple Y2, where tuple Y2 can be the account balance of the account U2) (for example, a read operation of reading the account balance of 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).
[0060] 4. Circular dual-version storage means that there can be two versions (i.e., two storage states) for the same tuple, and the tuple data of the tuple is updated and stored alternately on these two versions (i.e., two storage states). This means that when there are two versions (i.e., two storage states) of a tuple, the tuple data of the tuple can be updated alternately on these two versions (i.e., two storage states).
[0061] For example, for these 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 limit (i.e., initial tuple data, for example, 100 yuan) of tuple Y1 (i.e., the account balance of account U1) before the transfer to account U2; and the version data structure corresponding to another version (i.e., the storage state data of another storage state) can be used to store the target account limit (i.e., target tuple data, for example, 50 yuan) after the tuple Y1 (i.e., the account balance of account U1) is updated after the transfer to account U2. It should be understood that for any tuple in the tuple heap, the embodiment of the present application can refer to the version (i.e., storage state) used to store the initial tuple data (e.g., initial account limit) of the tuple as the initial storage state, and refer to the other version (i.e., another storage state) used to store the target tuple data (e.g., target account limit) of the tuple as the updated storage state.
[0062] It is understandable that the embodiment of the present application uses a cyclic dual version to store data for the metadata of the tuple, and there is no need to store additional update records for the tuple in the storage log, and for a certain tuple, once two tuple storage spaces for storing the two versions are allocated in the NVM for the tuple, the version addresses of the two versions can be quickly obtained. It should be understood that the embodiment of the present application 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] Among them, one version (i.e., one storage state) corresponds to one tuple storage space, and one tuple storage space is used to store one version of the version data structure (i.e., the storage state data of one storage state). Here, one version of the version data structure (i.e., the storage state data of one storage state) can be used to record the tuple data (i.e., Tuple Data) of a tuple (i.e., Tuple), and another version of the version data structure can be used to record another tuple data of the same tuple.
[0064] It can be understood that, for the two versions in the cyclic dual version, the tuple data stored in the version data structure of one version is determined based on data update of 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 of the present application are the version addresses of the two versions. Since there can be at least one version for a tuple, for ease of understanding, the embodiment of the present application takes two versions as an example to illustrate the alternating tuple update between the two versions. At this time, the storage positions of the corresponding tuple storage spaces of the version addresses of the two versions in the NVM space are fixed. Therefore, when the tuple is updated alternately between the two versions, it is not necessary to modify the index items in the index file deployed in the NVM. Instead, each time, it is necessary to quickly index and access a certain version through the index items in the index file, and then quickly access another version through the version link relationship of the two versions in the cyclic dual version (i.e., the state link relationship for linking a storage state to another storage state) to achieve efficient reading of the two versions. This design is very consistent with the nature of NVM reading faster than writing.
[0066] The version link relationship (i.e., state link relationship) here is used to represent the pointing relationship from an address offset (e.g., address offset V1) in a version data structure of one version (i.e., one storage state, e.g., storage state Y11) to another address offset (e.g., address offset V2) in a version data structure of another version (i.e., another storage state, e.g., storage state Y12). The embodiment of the present application can realize fast indexing from one version to another version through the pointing relationship indicated by the version link relationship.
[0067] For example, for the above tuple Y1, there may be a cyclic dual version consisting of two storage states (e.g., storage state Y11 and storage state Y12) at the same time. It is understandable that the embodiment of the present application can alternately store the account balance of the account U1 through these two storage states (e.g., storage state Y11 and storage state Y12). For ease of understanding, the embodiment of the present application may collectively refer to the storage state Y11 here as the first storage state, and the storage state Y12 as the second storage state. At this time, the embodiment of the present application takes the account balance of the account U1 at three different times (e.g., time T1, time T2, and time T3) (e.g., M1=100, M2=50, M3=150) as an example to explain the method of using these two versions (i.e., two storage states) to alternately store the account balance of the account U1.
[0068] For example, at time T1, the account balance of the account U1 at time T1 before the resource transfer (for example, M1=100) can be stored through the storage state Y11 (that is, the initial storage state, for example, the first storage state), and the account balance of the account U1 after the resource transfer (that is, the latest account balance of the above account U1, for example, M2=50) can be stored through the storage state Y12 (that is, the updated storage state, for example, the second storage state) at time T2 (for example, the next moment after time T1), and then at time T3 (for example, the next moment after time T2), the storage state Y11 (that is, the first storage state) can continue to be reused to store the account balance of the account U1 after executing operations performed by other transactions (that is, the current latest account balance of the account U1, for example, M3=150).
[0069] Optionally, by analogy, for the three versions (i.e., three storage states, for example, the first storage state, the second storage state, and the third storage state) in the three versions of the loop, the tuple data of the same tuple at different times can be alternately stored through these three versions (i.e., the three storage states). For example, the initial tuple data (e.g., the initial account limit, for example, M1=100) of the tuple Y1 (i.e., the account balance of the account U1) can be preferentially stored through the first storage state at time T1, and the first target tuple data (e.g., the first target account limit, for example, M2=50) after the first tuple update of the tuple Y1 (i.e., the account balance of the account U1) can be stored through the next storage state (i.e., the second storage state) of the first storage state at time T2, and the second target tuple data (e.g., the second target account limit, for example, M3=150) after the second tuple update of the tuple Y1 (i.e., the account balance of the account U1) can be stored through the next storage state (i.e., the third storage state) of the second storage state at time T3. Then, at time T4 (for example, the next time after time T3), the first storage state can continue to be reused to store the account balance of the account U1 after executing operations performed by other transactions (that is, the current latest account balance of the account U1, for example, M4=200).
[0070] In other words, when creating these three versions (i.e., three storage states) for the tuple Y1, the state link relationship between the first storage state and the second storage state (i.e., the first state link relationship) can be created first, and then the state link relationship between the second storage state and the third storage state (i.e., the second state link relationship) can be created, and finally the state link relationship between the third storage state and the first storage state (i.e., another new second state link relationship) can be further created. In the cyclic three-version storage, for any two storage states with a state link relationship among the three storage states, one storage state with a state link relationship (e.g., a storage state with a smaller storage timestamp) can be collectively referred to as the above-mentioned initial storage state, and the other storage state with a state link relationship (e.g., a storage state with a larger storage timestamp) can be collectively referred to as an updated storage state relative to the initial storage state. This means that when the loop three version includes the first storage state and the second storage state, if the first storage state is the initial storage state, the second storage state is the updated storage state; and when the loop three version includes the first storage state, the second storage state and the third storage state, if the second storage state is the initial storage state, the third storage state is the updated storage state, otherwise, if the third storage state is the latest initial storage state, the first storage state will be regarded as the latest updated storage state.
[0071] It can be seen that, for 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 link relationship between any two storage states in these storage states can be determined by the storage timestamps corresponding to each storage state, and then the two versions participating in the alternate update of the tuple in each round can be determined in any two storage states through the determined state link relationship. For example, the version with the smallest storage timestamp (i.e., the old version) can be used as the above-mentioned initial storage state, and the version with the largest storage timestamp (i.e., the new version) can be used as the above-mentioned updated storage state. For ease of understanding, the embodiments of the present application will take the two versions in the cyclic dual version as an example to explain the specific process of alternately accessing and updating the same tuple through the cyclic dual version.
[0072] 5. Circular dual-version concurrency control (referred to as dual-version concurrency control), in the embodiment of the present application, by using the cyclic dual-version concurrency control method, when a large number of transactions need to concurrently access and read the same tuple, the consistency and efficiency of data access can be ensured through the cyclic dual version (for example, the storage time field and the modification transaction information field in the cyclic dual 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 will be two situations, one of which is that one version (for example, the old version) is a version that is being modified by a transaction (that is, the current transaction), and the other version (for example, the new version) is a read-only version; the other situation is that there is no active transaction (that is, there is no other high-frequency transaction before the current transaction) to modify this tuple, then there are two readable versions, and then when the tuple data of this tuple needs to be accessed, the version with the largest read storage timestamp can be finally accessed.
[0073] This means that when the embodiment of the present application subsequently executes the current transaction, the corresponding version in the cyclic dual version can be read according to the transaction start timestamp of the current transaction (i.e., read the version with the largest storage timestamp). It should be understood that when the embodiment of the present application can access two versions of a tuple (i.e., target tuple) currently addressed in the tuple stack, the corresponding version (e.g., new version) that can be ultimately read for the current transaction in the cyclic dual version can be collectively referred to as a valid version, and the request operation corresponding to the transaction can be executed on the current tuple (i.e., target tuple) through the read valid version.
[0074] Among them, it should be noted that all data accessed by this application (i.e., tuple data of target tuples, such as enterprise-level data in enterprise-level database systems, real-time data in real-time data analysis platforms, cloud data in cloud computing and big data platforms, transaction data in high-frequency trading systems, and IoT data in IoT data management and other related data) are collected with the consent and authorization of the object to which the data belongs (such as users, enterprises or institutions), and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0075] For further information, see Figure 1 , Figure 1 This is a schematic diagram of a network architecture provided by this application. Figure 1 As shown, the network architecture may include a server 100a and a terminal device cluster, and the terminal device cluster may include one or more terminal devices, and the number of terminal devices is not limited here. Figure 1 As shown, the multiple terminal devices may specifically include terminal device 200a, terminal device 200b, ..., terminal device 200n; Figure 1 As shown, the terminal device 200a, the terminal device 200b, ..., the terminal device 200n can all be connected to the server 100a through a network, so that each terminal device can exchange data with the server 100a through the network connection.
[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. Among them, the cloud service scenario here can include but is not limited to medical cloud service scenario, cloud game service scenario, cloud education service scenario, cloud conference service scenario and cloud social service scenario.
[0077] For example, in a medical cloud service scenario, medical personnel between medical institutions can use NVM to persistently store medical resources for resource sharing. For example, when the access and storage technology of the storage engine based on the NVM architecture is applied to the medical cloud service scenario, medical personnel between medical institutions can quickly access and read the tuple data of a tuple associated with the medical business from the NVM on the cloud server through the index. For example, the tuple data here can specifically be the electronic diagnosis information and / or electronic prescription information of a patient.
[0078] For another example, in a cloud gaming service scenario, game players can share game resources (e.g., game scene rendering resources or character texture rendering resources, etc.) stored on a cloud server. For example, when the access and storage technology of the storage engine based on the NVM architecture is applied to the cloud gaming service scenario, each game player can quickly access and read the tuple data of another tuple associated with the gaming service from the NVM on the cloud server through an index. For example, the tuple data here can specifically be a scene texture resource in a cloud game, and then the scene texture resource can be rendered and displayed on the game interface of each game player.
[0079] For another example, in the transaction transfer scenario corresponding to the high-frequency trading system, each trader can perform transaction transfer business through the transaction account balance of each trader stored on the server. For example, when the access and storage technology of the storage engine based on the NVM architecture is applied to the transaction transfer scenario in the embodiment of the present application, each trader can quickly access and read the tuple data of two tuples associated with the transaction transfer business from the NVM on the server through an index (for example, the tuple data of the tuple corresponding to the transaction transferor and the tuple data of the tuple corresponding to the transaction transferee). For example, the tuple data here can specifically be the transaction account balance of a certain trader.
[0080] Among them, it is understandable that Figure 1 The server 100a shown may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers.
[0081] For further information, see Figure 2 , Figure 2 The NVM architecture here refers to the embodiment of the present application that all key components of the database associated with the corresponding data service (for example, directory files, tuple heaps, index files, transaction commit log lists, and tuple space managers, etc.) are deployed in the data access space corresponding to the non-volatile memory (for example, Figure 2 In other words, the embodiment of the present application proposes that the non-volatile storage space 20a) can be Figure 2The server 22a shown is deployed with a non-volatile memory (NVM) for data storage, without the need to deploy other data access devices in the server 22a (i.e., no other storage media for data storage need to be introduced). For example, there is no need to deploy dynamic random access memory (i.e., Dynamic Random Access Memory, DRAM). This can fundamentally avoid the migration management overhead and migration data consistency detection overhead when migrating data between different storage media.
[0082] Among them, the data access space corresponding to the non-volatile memory (i.e., NVM) is a non-volatile storage space, and the storage medium in the non-volatile storage space is a non-volatile storage medium, while the data storage space corresponding to the dynamic random access memory (i.e., 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 the embodiment of the present application can avoid the consistency problem of considering data migration between storage media of different memories by deploying non-volatile memory (NVM) in the server 22a without deploying dynamic random access memory (i.e., DRAM).
[0083] The NVM architecture may be an architecture for storing and accessing data through an AKV storage engine. For example, the NVM architecture deployed in the server 22a may specifically refer to 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 may include but are not limited to Figure 2 The directory file 2a for organizing and managing file storage locations, the transaction commit log list 2b for recording transaction identifiers of committed transactions, the index file 2c for identifier indexing, and the tuple heap for tuple storage in the business table 2d are shown. It can be understood that Figure 2 The server 22a shown may be the above Figure 1 Server 100a is shown.
[0084] For ease of understanding, the present application embodiment takes the data service as the transaction transfer service in the above-mentioned high-frequency trading system as an example, and the business scenario corresponding to the transaction transfer service can be the above-mentioned transaction transfer scenario. Figure 2 The user 1a shown in the figure requests the server 22a to perform a data service through the terminal device 21a. Figure 2 The transaction transfer business shown. Figure 2 As shown, the transaction transfer business here may specifically be the business corresponding to the transfer office.
[0085] For ease of understanding, the present application embodiment may collectively refer to the transfer transaction here as the first transaction indicated by the data service. For example, the first transaction information corresponding to the first transaction may specifically be: Figure 2 The transaction information shown in FIG. 1 is a virtual resource transaction information for transferring a virtual resource quantity N from account U1 (i.e., the first account) to user U2 (i.e., the second account). The first account can be Figure 2 The account of user 1a (e.g., the first business object) in the high-frequency trading system is shown, and the second account can be an account of another user (e.g., the second business object) in the high-frequency trading system, and / or another account of the user 1a (e.g., the first business object) in the high-frequency trading system. It should be understood that the specific business objects to which the first account and the second account belong are not limited in the embodiments of the present application.
[0086] Specifically, Figure 2 As shown, user 1a can request server 22a associated with the data service to execute the transaction transfer service (ie, data service) through terminal device 21a. For example, terminal device 21a can respond to the confirmation operation for the transaction transfer service (ie, data service) by sending Figure 2 The data processing request 1 for the first transaction information is sent to the server 22a, so that when the server 22a obtains the data processing request 1, it can obtain the to-be-matched index identifier carried in the data processing request 1 and the first transaction information indicated by the transaction transfer service (i.e. Figure 2 The transaction information of transferring N virtual resources from account U1 to user U2 is shown in the figure), and when parsing the transaction information, one or more data processing instructions in the first transaction information for the to-be-matched index identifier can be obtained. The to-be-matched index identifier here can be a tuple identifier of a tuple required to be queried or indexed for the transfer transaction obtained from the data processing request 1.
[0087] It should be understood that in different business scenarios, the number of tuples to be processed that are required to be queried for executing the corresponding data business can be one or more, and the specific number of tuple identifiers that need to be indexed specified in the data processing request will not be limited here. For ease of understanding, the embodiments of the present application collectively refer to tuples corresponding to tuple identifiers that need to be indexed as tuples to be processed.
[0088] Based on this, Figure 2 For the transaction transfer business shown in FIG. 1 , it is assumed 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 2The tuple identifier of tuple Y1 and the tuple identifier of tuple Y2 are shown. At this time, the server 22a can quickly address the tuple Y1 and tuple Y2 in the tuple heap through the index file 2c, which means that the tuple to be processed corresponding to 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) are shown. Among them, the tuple Y1 (i.e., the first tuple) can be the account balance of the account U1 that needs to be read to execute the transfer transaction (i.e., the first transaction, for example, the transaction of transferring N virtual resources from account U1 to 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 to execute the transfer transaction (i.e., the first transaction, for example, the transaction of transferring N virtual resources from account U1 to user U2).
[0089] It should be understood that in the embodiment of the present application, when the server 22a executes the first transaction, the first transaction may be decomposed into two sub-transactions (for example, one sub-transaction is the first sub-transaction and the other sub-transaction is the second sub-transaction). For example, the data processing instruction corresponding to one sub-transaction (i.e., the first sub-transaction) may be an instruction for reading and updating data for the tuple data of tuple Y1, and the data processing instruction corresponding to the other sub-transaction (i.e., the second sub-transaction) may be an instruction for reading and updating data for the tuple data of tuple Y1.
[0090] Among them, for deployment in Figure 2 The tuple stack in the non-volatile storage space 20a shown in the figure may contain multiple tuples. The multiple tuples here may specifically include Figure 2 The storage state set of tuple Y1, ..., and tuple Y2 shown in FIG. 1 may include multiple storage states, where the multiple storage states may include Figure 2 The storage state Y11 and storage state Y12 are shown. Similarly, the storage state set of tuple Y2 may also include multiple storage states, where the multiple storage states may specifically include Figure 2 The storage state Y21 and the storage state Y22 are shown.
[0091] Among them, Figure 2 As shown, for tuple Y1, the storage state data corresponding to the storage state Y11 can be used to store multiple storage parameters of the tuple Y1 in the storage state Y11. The multiple 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 shown), ..., the field value of the storage time field (for example, Figure 2 The storage timestamp w1 shown), the field value of the tuple data field (for example, Figure 2The tuple data D1 shown here is used to represent the tuple data of the tuple Y1 read in the transaction transfer business at the storage timestamp w1, for example, the amount of the account balance of the above-mentioned 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 multiple storage parameters of the tuple Y1 in the storage state Y12. Among them, the multiple storage parameters in 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 business at the storage timestamp w2, for example, the account balance amount of the above-mentioned 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 (eg, the first thread) in the thread pool, the server 22a may respond to the first transaction (eg, Figure 2 The entire transfer transaction shown in FIG. 1 is executed to call a storage engine for data access (for example, the AKV storage engine described above) to read the index storage address (for example, the index storage address of the index file 2c stored in the directory file 2a) in the non-volatile storage space 20a through the AKV storage engine. Figure 2 addr1 as shown), so as to read the index file 2c through the read index storage address, and then identify the index through the index file 2c, so as to find the target index identifier that matches the index identifier to be matched in the index file 2c. It can be understood that at this time, when the server finds the target index identifier, it can further determine the index storage address and storage address offset (for example, Figure 2 The address offset V1 is shown).
[0093] In one achievable manner, the index storage address corresponding to the target index identifier pre-stored in the non-volatile storage space 20a may be the index file address of the index file 2a recorded in the directory file 2a deployed in the non-volatile storage space 20a (for example, Figure 2The tuple storage address corresponding to the target index identifier pre-stored in the non-volatile storage space 20a may be the field 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 in the non-volatile storage space 20a (e.g., Figure 2 The address offset V1 is shown).
[0094] At this time, the server 22a can store the address offset (for example, Figure 2 The address offset V1 shown) and the index storage address (eg, Figure 2 The addr1 shown, i.e., the index file address, is used to determine the tuple storage address of the target tuple corresponding to the target index identifier, so as to determine one or more storage states of the target tuple through the tuple storage address of the target tuple, and then the states where one or more storage states are located can be collectively referred to as a storage state set.
[0095] Among them, in one implementable method, when there are multiple storage states of the target tuple, the tuple storage address of the target tuple in the tuple heap can be the storage address of the storage state corresponding to the 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 the tuple Y1, if the storage timestamp w1 is earlier than (i.e., smaller than) the storage timestamp w2, it means that the storage state Y11 of the tuple Y1 is the old version of the tuple Y1 (i.e., the above-mentioned initial storage state), and the storage state Y12 of the tuple Y1 is the new version of the tuple Y1 (i.e., the above-mentioned updated storage state). Conversely, if the storage timestamp w1 is later than (i.e., larger than) the storage timestamp w2, it means that the storage state Y11 of the tuple Y1 is the new version, and the storage state Y12 of the tuple Y1 is the old version.
[0097] Understandably, Figure 2 The address offset V1 shown is calculated by Figure 2 The storage address of the 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) stored in the directory file 2a is determined by the following equation. Figure 2 The address offset V2 shown is calculated by Figure 2 The storage address of the storage state Y12 shown is Figure 2 The index file address of the index file 2c shown (for example, Figure 2It should be understood that for example Figure 2 For the two versions (i.e., two storage states) of the tuple Y1 shown, the two address offsets (e.g., Figure 2 The bidirectional index relationship between the address offset V1 and the address offset V2 shown (i.e. Figure 2 A pointing relationship from address offset V1 to address offset V2 and another pointing relationship from address offset V2 to address offset V1 are shown), a cyclic dual version consisting of the storage state Y11 and the storage state Y12 is established, and the data update of the tuple data of the tuple Y1 in the NVM is realized alternately through the cyclic dual version.
[0098] Similarly, if Figure 2 As shown, for tuple Y2, the storage state data corresponding to storage state Y21 may specifically include a field value of an address offset field (for example, Figure 2 The address offset V3 shown), ..., the field value of the storage time field (for example, Figure 2 The storage timestamp w3 shown), the field value of the tuple data field (for example, Figure 2 The tuple data D3 shown here is used to represent the tuple data of the tuple Y2 read in the transaction transfer business at the storage timestamp w3, for example, the amount of the account balance of the user U2 at the storage timestamp w3). Similarly, the storage state data corresponding to the storage state Y22 may specifically include the field value of the address offset field (for example, Figure 2 The address offset V4 shown), ..., the field value of the storage time field (for example, Figure 2 The storage timestamp w4 shown), the field value of the tuple data field (for example, Figure 2 The tuple data D4 shown here is used to represent the tuple data of the tuple Y2 read in the transaction transfer business at the storage timestamp w4, for example, the account balance amount of the above user U2 at the storage timestamp w4.
[0099] Understandably, Figure 2 The address offset V3 shown is calculated by Figure 2 The storage address of the 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) stored in the directory file 2a is determined by the following equation. Figure 2 The address offset V4 shown is also calculated by Figure 2 The storage address of the storage state Y22 shown is Figure 2The index file address of the index file 2c shown (for example, Figure 2 It should be understood that for example Figure 2 For the two versions (i.e., two storage states) of the tuple Y2 shown, the two address offsets (e.g., Figure 2 The bidirectional index relationship between the address offset V3 and the address offset V4 shown in FIG. Figure 2 A pointing relationship from address offset V3 to address offset V4 and another pointing relationship from address offset V4 to address offset V3 are shown), a cyclic dual version consisting of the storage state Y21 and the storage state Y22 is established, and the data update of the tuple data of the tuple Y2 in the NVM is realized alternately through the cyclic dual version.
[0100] It should be understood that when the server 22a finds a target index identifier that matches the to-be-matched index identifier of the tuple to be processed (for example, tuple Y1 and tuple Y2) in the index file 2c, it can determine Figure 2 In the tuple pile shown, there are target tuples matching the tuples to be processed (eg, tuple Y1 and tuple Y2) that are currently required to be queried.
[0101] It can be noted that, in the process of searching the index file 2c for a target index identifier that matches the to-be-matched index identifier of the tuple to be processed (for example, tuple Y1 and tuple Y2), the embodiment of the present application can specifically be performed through multiple index sets (for example, Figure 2 In the index set C1, index set C2, index set C3 and index set C4 shown in FIG, the target index set is determined by means of identification mapping, and then the target index set determined is Figure 2 When the index set C1 is shown, the target index identifier that matches the index identifier to be matched is further searched in the index set C1, which can avoid directly searching the index identifiers in the entire index file 2c as a whole, thereby further improving the efficiency of tuple positioning search.
[0102] Further, such as Figure 2 As shown, since the target tuple (for example, Figure 2 The tuple versions of tuples Y1 and Y2 shown in FIG. 1 and FIG. 2 are both cyclic double versions. Therefore, for tuple Y1, during the execution of the first transaction, the storage timestamp (for example, Figure 2The storage timestamp w1 shown in the figure is obtained, and the storage timestamp in the storage state data corresponding to the storage state Y12 is obtained (for example, Figure 2 The storage timestamp w2 shown in the figure can then be used to compare the transaction start timestamp configured for the first transaction by the first thread (i.e., the instruction timestamp corresponding to the one or more data processing instructions) with the storage timestamp w1 and the storage timestamp w2 to determine which of the two versions (i.e., storage state Y11 and storage state Y12) in the cyclic dual version of the tuple Y1 is the valid version (i.e., the target storage state), and then, in the target storage state, the instruction operation indicated by the corresponding data processing instruction can be executed on the tuple Y1.
[0103] For example, the instruction operation here can be a write operation. In this case, 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 valid tuple data in the storage state data corresponding to the valid version (i.e., the target storage state), and based on the read valid tuple data and the transaction detail data of the first transaction (for example, transaction modification detail data, such as virtual resources with a transfer-out quantity of N resources), determine the latest tuple data in the storage state data of another storage state for writing into the cyclic dual version.
[0104] For example, in the embodiment of the present application, when the storage timestamp w1 is less than the storage timestamp w2, the storage state Y11 is determined to be the old version and the storage state Y12 is the new version, and the storage state Y12 (i.e., the new version) can be determined as the valid version to be read for executing the first transaction, and the storage state Y11 (i.e., the old version) can be determined as the old version to be modified and locked for executing the first transaction, so that Figure 2 The valid tuple data (for example, Figure 2 The tuple data D2 shown in the figure, i.e., the amount of the account balance of the account U1 at the storage timestamp w2, for example, 100 yuan) and the transaction details data of the first transaction (e.g., 50 yuan transferred out), determines the latest tuple data (e.g., 100-50=50 yuan) in the version data structure for storing in the storage state Y11 (i.e., the old version), and can further change the field value of the tuple data field of the storage state Y11 from 0 to 1 in the NVM space (i.e., the non-volatile storage space) corresponding to the NVM. Figure 2 The tuple data D1 (eg, 150 yuan) shown is updated and configured to be the latest tuple data (eg, 50 yuan).
[0105] Similarly, by analogy, in the embodiment of the present application, during the execution of the first transaction, for tuple Y2, a storage timestamp (for example, Figure 2The storage timestamp w3 shown in the figure and the storage timestamp in the storage state data corresponding to the storage state Y22 (for example, Figure 2 The storage timestamp w4 shown in the figure is compared with the storage timestamp w3 and the storage timestamp w4 through the transaction start timestamp (i.e. the instruction timestamp corresponding to the one or more data processing instructions mentioned above) to determine which of the two versions in the cyclic dual version of the tuple Y2 (i.e. the storage state Y21 and the storage state Y22) is the valid version (i.e. the target storage state), and then the instruction operation indicated by the corresponding data processing instruction can be executed on the tuple Y2 in the target storage state.
[0106] For example, in the embodiment of the present application, 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 the new version, and then the storage state Y22 (i.e., the new version) can be determined as the valid version required to be read for executing the first transaction, and the storage state Y21 (i.e., the old version) can be determined as the old version required to be modified and locked for executing the first transaction, so that Figure 2 The valid tuple data (for example, Figure 2 The tuple data D4 shown in the figure, i.e., the amount of 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 (e.g., 50 yuan transferred in), determines the latest tuple data (e.g., 200+50=250 yuan) in the version data structure for storing in the storage state Y21 (i.e., the old version), and can further change the field value of the tuple data field of the storage state Y21 from 0 to 1 in the NVM space (i.e., the non-volatile storage space) corresponding to the NVM. Figure 2 The tuple data D3 (eg, 100 yuan) shown is updated and configured to be the latest tuple data (eg, 250 yuan).
[0107] It should be understood that, after executing all request operations (i.e., all read operations and write operations) indicated by the first transaction, the embodiment of the present application can call the AKV storage engine through the first thread to configure a transaction end timestamp for the first transaction, thereby generating a transaction identifier for the first transaction and adding the transaction identifier of the first transaction to Figure 2 In the transaction commit log list 2b shown in Figure 2 As shown, at this time, the transaction commit log list 2b contains the transaction identifiers Tx3 and Tx4 of the committed transactions. In the transaction commit transaction list 2b, one transaction identifier corresponds to one committed transaction.
[0108] In addition, if Figure 2 As shown, the directory file 2a also includes the list address of the transaction commit log list 2b (for example, Figure 2 addr2 shown). In the embodiment of the present application, the list address in the target file 2a (for example, Figure 2 addr2) shown in the figure quickly indexes the transaction commit log list 2b, and can pass the checkpoint set in the transaction commit log list 2b (for example, Figure 2 For example, when the current transaction (i.e., the first transaction) is committed, the server 22a can decide whether the current transaction (i.e., the first transaction) should be committed or aborted according to whether the read and write data sets of the first transaction conflict with other concurrent transactions (e.g., other committed transactions).
[0109] For example, if the read-write data set of the current transaction conflicts with other concurrent transactions, the server 22a can terminate the current transaction (i.e., the first transaction) with the transaction conflict in the fastest way through the above-mentioned AKV storage engine, and mark the storage state of the tuple currently being 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 reused subsequently. In this way, the invalid version (i.e., the invalid storage state) can be prevented from occupying the system resources of the server 22a, thereby causing a waste of system resources.
[0110] It can be understood that, before the index file 2c is used to identify the index, the embodiment of the present application can also use the table address in the directory file 2a (for example, Figure 2 addr3), quickly index to Figure 2 The table file 2d shown in the figure can then map the tuple identifiers of each tuple stored in the tuple heap in the table file 2d to the index file 2c that has a mapping relationship with the business table 2d by means of identifier mapping, so that the tuple identifiers of each tuple can be pre-stored in each index set of the index file 2c, and then the tuple identifiers of each tuple pre-stored in the index file 2c can be collectively referred to as the index identifiers of each tuple, so that the index file address of the index file 2c where the index identifiers of each tuple are mapped and stored (for example, Figure 2 When addr2) shown in the figure is added to the target file 2a, the index file address of the index file 2c that maps and stores the index identifiers of each tuple is collectively referred to as the index storage address corresponding to these index identifiers pre-stored in the index file 2c. In this way, when the server 22a needs to execute a transaction (for example, the first transaction mentioned above) later, it can quickly locate the index file 2c addressed by the directory file 2a, so as to quickly improve the efficiency of tuple query for the target tuple matching the above-mentioned tuple to be processed through the addressed index file.
[0111] Among them, the server 22a searches for the target index identifier that matches the to-be-matched index identifier in the non-volatile storage space, determines the index storage address and storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space, and determines the target storage state in multiple storage states. For specific implementation methods, please refer to the following Figure 3-Figure 21 Description of the corresponding embodiment.
[0112] For further information, see Figure 3 , Figure 3 This is a flowchart of a data processing method based on non-volatile storage space provided by the present application. The method is executed by a computer device, where the computer device can be a terminal device integrated with a non-volatile memory (i.e., NVM) or a server integrated with a non-volatile memory (i.e., NVM). The data access space corresponding to the non-volatile memory (i.e., NVM) is a non-volatile storage space. The non-volatile storage space includes multiple tuples, where the multiple tuples are set to be indexed by index identifiers pre-stored in the non-volatile storage space. Figure 3 As shown, the method may at least include steps S101 to S106:
[0113] Step S101, obtaining a data processing request, the data processing request carrying a to-be-matched index identifier and one or more data processing instructions;
[0114] The data processing request here may be a request sent for a certain transaction information (i.e., the first transaction information), and the first transaction information here may be transaction information corresponding to a specific transaction indicated by a certain data service. It should be understood that the first transaction information here 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 may specifically include one or more data processing instructions.
[0115] The data services may include but are not limited to the enterprise services corresponding to the enterprise-level data in the above-mentioned enterprise-level database system, the real-time analysis services corresponding to the real-time data in the real-time data analysis platform, the cloud services corresponding to the cloud data in the cloud computing and big data platform, the transaction services corresponding to the transaction data in the high-frequency trading system, and the Internet of Things services corresponding to the Internet of Things data in the Internet of Things data management. For ease of understanding, the present application embodiment still takes the data services here as the above-mentioned Figure 2The transaction transfer service is taken as an example to illustrate the specific process of indexing the to-be-matched index identifier carried in the data processing request in the non-volatile storage space during the execution of the specific transaction (eg, transfer transaction) indicated by the transaction transfer service.
[0116] Specifically, it can be understood that when a computer device obtains a data processing request, it can parse 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 that currently needs to be indexed in the non-volatile storage space.
[0117] It should be understood that the embodiment of the present application also requires that different request operations indicated by the first transaction be executed 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), it can indirectly locate and find one or more tuples required for executing the current transaction (i.e., the first transaction) in the tuple heap through the index file, and then determine the target storage state of these tuples from at least one storage state of the located and found tuples, so as to quickly and accurately perform the read operation indicated by the data processing request for the corresponding tuples under the target storage state of these tuples (i.e., the valid version of these tuples), for example, specifically, it can read the valid tuple data of the corresponding tuple from the storage state data corresponding to the target storage state of these tuples, and then the valid tuple data of these tuples can be used as the request response data that needs to be backfilled to the data processing request. In this way, the computer device can return the request response data to the terminal device that currently sends 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), it can indirectly locate and find one or more tuples required for executing the current transaction (i.e., the first transaction) in the tuple heap through the index file, and then determine the target storage state of these tuples (i.e., the valid version of these tuples) from at least one storage state of these located and found tuples, so that through the determined target storage state of these tuples (i.e., the valid version of these tuples), the read operation indicated by the data processing request can be quickly executed for the corresponding tuples, and then the tuple data in the storage state data corresponding to the target storage state of these tuples currently read can be updated based on the valid tuple data in the storage state data corresponding to another storage state of the same tuple in these tuples.
[0120] For example, when the data service is a transaction transfer service, the first transaction indicated by the data service may 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 may be reading 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 may be reading valid tuple data in the storage state data corresponding to the target storage state of all tuples required for executing the transfer transaction, and updating the tuple data in the storage state data corresponding to another storage state of the corresponding tuple by using the valid tuple data of the tuples read.
[0121] Step S102, searching the non-volatile storage space for a target index identifier that matches the index identifier to be matched;
[0122] Among them, in one possible implementation, the non-volatile storage space can be deployed with an index file for indexing pre-stored index identifiers, where 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 the first thread in the 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 through the first thread, it can configure a transaction start timestamp for the first transaction, and when executing the first transaction based on the transaction start timestamp, configure the transaction state of the first transaction to a transaction execution state; further, the computer device can search for a target index identifier that matches the index identifier to be matched through the index file in the transaction execution state.
[0123] Among them, in another possible implementation method, the non-volatile storage space here can be deployed with a tuple stack for storing multiple tuples, and the index file deployed in the non-volatile storage space can specifically include multiple index sets, where the multiple index sets here are sets of index identifiers for pre-storing each tuple determined after identifier mapping of the index identifiers of each tuple in the tuple stack. At this time, the specific process of the computer device searching for a target index identifier that matches the index identifier to be matched through the index file can be described as: the computer device can perform identifier mapping on the index identifier to be matched in a transaction execution state, and can determine the index set used to map the index identifier to be matched as the target index set in multiple index sets; further, the computer device can search for a target index identifier that matches the index identifier to be matched in the target index set.
[0124] In other words, in the embodiment of the present application, when the first transaction is started through the first thread, a transaction start timestamp may 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 may be configured as a transaction execution state; further, the computer device may perform identifier mapping on the to-be-matched index identifier in the transaction execution state, and determine, from among multiple index sets, an index set used to map the to-be-matched index identifier as a target index set; further, the computer device may search for a target index identifier that matches the to-be-matched index identifier in the target index set;
[0125] It should be understood that, in one implementation, if a 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 stack, and then can continue to execute the following step S103. Conversely, in another possible implementation, if a 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 stack, and at this time, the computer device can roll back 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 means that the computer device can, when the first transaction corresponding to the first transaction information is in a transaction execution state, undo all executed operations in the operation sequence and terminate all operations being executed and / or all operations not yet executed in the operation sequence according to the operation sequence indicated by the first transaction.
[0127] For further understanding, please refer to Figure 4 , Figure 4 1 is a flow chart showing the execution of a transaction through a timeline provided by an embodiment of the present application. The transaction here may include: Figure 4 The transaction A1 and the transaction A2 shown here may be collectively referred to as the first transaction corresponding to the first transaction information extracted from the above data processing request.
[0128] For ease of understanding, the present embodiment takes transaction A1 as an example of the first transaction, and explains how to locate the tuple to be processed by searching the index file during the execution of transaction A1 (for example, Figure 4 The specific process of tuple Y1 and tuple Y2) is shown.
[0129] Among them, Figure 4The timeline shown shows multiple different stages of the first transaction (for example, transaction A1), where the multiple different stages may specifically include Figure 4 The transaction A1 start phase, transaction A1 execution phase, metadata modification phase, and transaction A1 commit phase are shown.
[0130] It can be understood that when transaction A1 starts, the computer device needs to start the first transaction (for example, transaction A1) through a thread (ie, the first thread) in the thread pool to enter Figure 4 The transaction A1 is shown as starting stage. At this time, the computer device can execute step S11 through the first thread to configure the transaction A1 with the transaction start timestamp T11, and then when executing the first transaction (for example, transaction A1) based on the transaction start timestamp, the transaction state of the first transaction (for example, transaction A1) can be configured as the transaction execution state. The transaction execution state here is used to indicate that the first transaction (for example, transaction A1) is entering at this moment. Figure 4 Transaction A1 execution phase shown.
[0131] It is understandable that, in the embodiment of the present application, when executing the first transaction, the transaction start timestamp can be used as the instruction timestamp corresponding to one or more data processing instructions in the first transaction information, so as to facilitate the subsequent Figure 4 When the index file shown locates the storage state set of the target tuple, the storage timestamps 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 storage timestamps corresponding to each storage state obtained and the instruction timestamp can be used to determine whether the target storage state of the target tuple exists in each storage state. If so, the instruction operation indicated by the corresponding data processing instruction can be executed on the target tuple in the target storage state of the target tuple. In this way, the computer device can Figure 4 In the metadata modification phase shown, it is determined whether all target tuples in the read set tuples required to execute the first transaction have been accessed during the execution of the first transaction. If all target tuples in the read set have been accessed, it can be determined that the execution of the first transaction has been completed (for example, Figure 4 All operations of transaction A1) shown in the figure can be executed Figure 4 Step S16 is shown.
[0132] Among them, Figure 4 As shown, the computer device may execute step S12 during the execution phase of transaction A1. When transaction A1 is executed, the tuple address of tuple Y1 and / or the tuple address of tuple Y2 may be located through the index file.
[0133] It should be understood that the tuple Y1 and the tuple Y2 here are the tuples to be processed corresponding to the to-be-matched index identifiers for which tuple positioning is required and extracted from the above data processing request.
[0134] Among them, it can be understood that when the first thread in the computer device (i.e., the thread used to execute the first transaction) executes step S12, it can specifically map 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 to be indexed and the to-be-matched index identifier of the tuple Y2) respectively in the transaction execution state currently used to represent that the transaction A1 is being executed, and then, in the multiple index sets contained in the index file, the index sets used to map the two to-be-matched index identifiers can be collectively referred to as target index sets, and then, the index identifiers matching the two to-be-matched index identifiers can be searched for in the target index set, and the index identifiers matching the two to-be-matched index identifiers can be collectively referred to as target index identifiers.
[0135] It can be understood that, in one implementation, the target index set here may include but is not limited to the index set of the to-be-matched index identifiers for mapping tuple Y1 (for example, the above Figure 2 The index set C1 shown in FIG. 1 ) and another index set (for example, the index set C2 shown in FIG. 1 ) for mapping the to-be-matched index identifiers of the tuple Y2. Figure 2 The index set C2 shown).
[0136] Optionally, in another possible implementation, the target index set here may also include the same index set for jointly mapping the to-be-matched index identifier of tuple Y1 and the to-be-matched index identifier of tuple Y2 (for example, the above Figure 2 The index set C3 shown).
[0137] It can be understood that if a target index identifier matching the to-be-matched index identifier is found in the index file (for example, specifically, the target index set in the index file), then the target index identifier can be quickly determined. Figure 4 The target tuple corresponding to the target index identifier exists in the tuple heap shown, which also indirectly reflects Figure 4 In the tuple stack shown, there exists a target tuple that matches the tuple to be processed corresponding to the to-be-matched index identifier.
[0138] For example, Figure 4 As shown, after the computer device executes step S12, if the index storage address corresponding to the target index identifier pre-stored in the non-volatile storage space (for example, Figure 4The tuple address for locating tuple Y1 is determined by using 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 (for example, the tuple address here may include the storage address of one or more storage states configured for the tuple Y1 by the tuple space manager, for example, it may specifically include the storage address of the initial storage state and the storage address of the updated storage state among the multiple storage states), and then the one or more storage states of the tuple Y1 can be read through the located tuple address of the tuple Y1. This means that at this time, the computer device can further perform in one or more storage states of the tuple Y1. Figure 4 Step S13 shown in the figure reads or updates the tuple data of the tuple Y1 in the tuple heap by using the tuple address of the tuple Y1 located (i.e. reads or updates the tuple data of the tuple Y1). Figure 4 The field value of the tuple data field in the storage state data of the corresponding storage state of the tuple Y1 shown, for example, Figure 4 “data” shown).
[0139] Alternatively, if Figure 4 As shown, after the computer device executes step S12, if another tuple is not located in the index file (for example, Figure 4 The tuple address of tuple Y2) shown in the figure can be jumped to execute Figure 4 In step S14, if the tuple address of tuple Y2 is not located in the index file, a tuple storage space 41a is allocated to tuple Y2 through the tuple space manager, and then Figure 4 In step S15 shown, tuple Y2 is inserted into the tuple heap.
[0140] It should be understood that the present application embodiment can insert a tuple into the tuple heap for the first time (for example, the first insertion Figure 4 When a tuple Y2 is shown, a tuple storage space is allocated for the tuple Y2 through the tuple space manager (for example, Figure 4The tuple storage space 41a shown in the figure can be used to store the storage address of the first version (i.e., the initial storage state) of the tuple Y2 inserted into the tuple stack, so that the storage address of the first version (i.e., the initial storage state) can be used as the tuple storage address corresponding to the target index identifier of the tuple Y2 in the tuple stack in the future. In this way, the computer device can calculate the offset between the tuple storage address and the index storage address in real time through the tuple storage address corresponding to the target index identifier of the tuple Y2 and the index storage address corresponding to the target index identifier of the tuple Y2 (for example, the index file address of the index file), and use the offset calculated in real time as the storage address offset corresponding to the target index identifier of the tuple Y2, and add it to the index file, so that when the tuple Y2 needs to be accessed in the subsequent execution of other transactions, the tuple address of the tuple Y2 can be located and addressed through the storage address offset corresponding to the target index identifier of the tuple Y2 pre-stored in the index file.
[0141] The tuple version of tuple Y2 here (for example, the first version of tuple Y2, that is, the initial storage state of tuple Y2) is the first transaction currently being executed (for example, Figure 4 Therefore, during the execution of transaction A1, before inserting tuple Y2 into the tuple heap, it is necessary to create the first version (i.e., the initial storage state) of tuple Y2 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) created for tuple Y2 can be inserted into Figure 4 The tuple heap shown.
[0142] In addition, in one possible implementation, for example, it should be understood that Figure 4 In the tuple heap shown, the tuple version of tuple Y1 may be a circular double version consisting of two versions, wherein the two versions (eg, initial storage state and updated storage state) in the circular double version may be in the first transaction (eg, Figure 4 The version created by another transaction (eg, the second transaction) before the transaction A1) is committed.
[0143] For ease of understanding, please refer to Figure 5 , Figure 5 1 is a schematic diagram of a structure of a cyclic dual version formed by two storage states provided in an embodiment of the present application. The cyclic dual version here refers to two versions (i.e., two storage states) stored for the same tuple. The two versions (i.e., two storage states) here can be specifically Figure 5 The initial storage state and updated storage state are shown in FIG. Figure 5As shown, the initial storage state data corresponding to the initial storage state and the updated storage state data corresponding to the updated storage state both include multiple fields.
[0144] Among them, the multiple fields here can specifically include Figure 5 Field 5a shown (i.e., address offset field, for example, Figure 5 "Version Offset" shown), field 5b (i.e., transaction modification information field, for example, Figure 5 "Txn Inf" as shown), field 5c (i.e., the atomic lock field, for example, Figure 5 "Atomic" as shown), field 5d (i.e., the modification type field, for example, Figure 5 "Inf Type" shown), field 5e (i.e., storage time field, for example, Figure 5 "Wts" shown), field 5f (i.e., a deletion mark field, for example, Figure 5 "Delete" shown), field 5g (i.e., tuple identification field, for example, Figure 5 "TupeID" as shown), and field 5h (i.e., the tuple data field, for example, Figure 5 The “Tupe Data” shown in the figure, where “Tupe Data” can be abbreviated as “Data”).
[0145] It can be understood that for the same tuple (for example, Figure 4 For any two versions of the tuple Y1 shown in FIG. 1 , the version data structures of the two versions (i.e., the storage state data corresponding to the two storage states respectively) can be divided into two parts: the tuple head and the tuple tail. For example, in the storage state data corresponding to the corresponding storage state, the embodiment of the present application can divide the storage state data corresponding to the corresponding storage state into two parts: the tuple head and the tuple tail. Figure 5 The seven fields from field 5a to field 5g shown are collectively referred to as the tuple (for example, the above Figure 4 The tuple Y1) shown in the figure is the tuple head, and Figure 5 The fields 5h shown are collectively referred to as the tuple (for example, the above Figure 4 The tuple tail of the tuple Y1) shown in FIG. 1 , where the tuple tail is specifically used to store the tuple data of the tuple.
[0146] It can be understood that the tuple header here can specifically 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 mark field, i.e. a field value used to identify the current version as an invalid version that can be recycled), the field value of field 5e (i.e. the field value of the storage time field, such as a storage timestamp), the field value of field 5b (i.e. the field value of the transaction modification information field, such as information about modifying the transaction), the field value of field 5a (i.e. the field value of the address offset field, i.e. a field value used to index an offset of 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 used to lock the version being modified by the current transaction.
[0147] It is understandable that for a 64-bit tuple ID, the tuple ID can be split into the above-mentioned Figure 5 The field value of the deletion mark field and the field value of the tuple identification field used for tuple identification are shown. The mask processing here means that the mask processing result can be obtained by performing a bit-by-bit multiplication operation on the bit in the field value of the deletion mark field (i.e. 1 bit) and each bit in the field value of the tuple identification field (i.e. each bit in 63 bits).
[0148] For example, the highest bit (for example, the first bit) in the tuple ID can be used as a deletion mark. For example, when the highest bit is "0", the mask processing result can be obtained by masking the field value of the deletion mark field obtained by splitting and the field value of the tuple identification field (that is, bitwise multiplication operation).
[0149] In one implementation, if the mask processing result indicates that the field value of the tuple identification field (i.e., the value on bit 63) is all "0", it may indicate that the version where the tuple ID is located is an empty version after the current version is deleted. Optionally, if the mask processing result indicates that the field value of the tuple identification field (i.e., the value on bit 63) is not "0", it may indicate that the version where the tuple ID is located is the tuple version that can be currently read and updated.
[0150] In addition, it can be understood that the field value of the storage time field (e.g., storage timestamp) and the field value of the transaction modification information field (e.g., information on modifying a transaction (e.g., transaction identifier or transaction pointer)) involved in the embodiments of the present application can be used for concurrency control and fault recovery. For example, the size of the storage timestamp can be used to reasonably and accurately distinguish between the two versions of the same tuple (i.e., the initial storage state and the updated storage state) in the cyclic dual version, which version is the old version (i.e., the initial storage state) and which version is the new version (i.e., the updated storage state). For example, the version (i.e., storage state) with a smaller storage timestamp (i.e., Wts) can be regarded as the old version in the cyclic dual version, and the version (i.e., storage state) with a larger storage timestamp (i.e., Wts) can be regarded as the new version in the cyclic dual version.
[0151] Among them, the transaction pointer in the transaction modification information involved in the embodiment of the present application helps to determine whether the current transaction (for example, the above-mentioned transaction A1) is in the submission stage. For example, if the field value of the modification transaction information field in the new version of the version data structure is the transaction pointer of the current transaction, it means that the current transaction is still in the execution stage. On the contrary, if the field value of the modification transaction information field in the new version of the version data structure is the transaction identifier of the current transaction (that is, the transaction number, such as the transaction ID), it means that all operations of the current transaction (for example, the above-mentioned transaction A1) have been executed and completed, and then the above-mentioned Figure 4 In step S17 shown, the transaction identifier of transaction A1 (ie, Txn1) is submitted to the transaction submission log list 4a. In other words, before executing step S17, the embodiment of the present application can store the field value of the modified transaction information field in the tuple version modified by the current transaction as the transaction ID (for example, the above Figure 4 Then, when executing step S17, the transaction ID (for example, the transaction ID Figure 4 Txn1 shown) submitted to the above Figure 4 Transaction commit log listing 4a is shown.
[0152] It can be understood that the transaction identifier (ie, transaction number, for example, Figure 4The transaction commit log list 4a can be read through the list address of the transaction commit log list 4a stored in the directory file, and then the tuple version (for example, the storage state Y12 of the tuple Y1) carrying the transaction identifier of the transaction A1 recorded in the transaction commit log list 4a can be indexed in the NVM space, and then the address offset corresponding to the indexed tuple version (for example, the storage state Y12 of the tuple Y1) can be quickly indexed to another tuple version (for example, the tuple storage state Y11) of the tuple Y1, so that it can be ensured that the tuple versions (that is, the storage state sets of the tuples) of all tuples associated with the transaction A1 (for example, the tuple Y1) can be quickly accessed during the failure recovery.
[0153] It should be understood that after executing step S15, the computer device can detect whether all operations of the transaction A1 have been completed, and then can further execute step S16 when detecting that all operations of the transaction A1 have been completed. When all operations of the transaction A1 are completed, the transaction end timestamp T12 is configured for the transaction A1, and the storage timestamp (Wts) of the tuple Y2 created by the transaction A1 is configured as the transaction end timestamp T12, so that the transaction identifier of the transaction A1 currently generated can be stored in the storage state data corresponding to the storage state of the tuple Y2 created by the transaction A1, and the above-mentioned steps can be further executed. Figure 4 Step S17 is shown.
[0154] The specific implementation methods of transaction A2 when executed at different stages can be found in the description of the specific process of executing transaction A1 through steps S11 to S17 above, and will not be further described here.
[0155] Among them, the non-volatile storage space includes a directory file, and the index storage address of the index file is stored in the directory file here; at this time, the specific implementation method of the computer device determining the target index set for mapping the index identifier to be matched in multiple index sets can be described as follows: the computer device can obtain the index file through the index storage address in the directory file when determining that the first transaction is being executed based on the transaction execution status; further, the computer device can obtain multiple 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 index identifier to be matched to obtain the index hash value of the index identifier to be matched, and can perform remainder calculation on the set quantity of multiple index sets through the index hash value to obtain the remainder of the index hash value; further, the computer device can search for a set identifier that matches the remainder of the index hash value among the multiple set identifiers corresponding to the multiple index sets, and determine the index set corresponding to the found set identifier as the target index set for mapping the index identifier to be matched.
[0156] For further understanding, please refer to Figure 6 , Figure 6 Schematic diagram of a scenario for determining a target index set in an index file provided by an embodiment of the present application. Figure 6 As shown, when the computer device obtains the directory file 2a stored in the NVM space, it can execute Figure 6 In step S21, the index file 2c is obtained through the index file address. The index file address here may be an index address for obtaining the index file 2c pre-stored in the target file 2a in the non-volatile storage space, for example, Figure 6 As shown in addr1. Figure 6 As shown, the multiple index sets in the index file 2c may specifically include an index set C1, an index set C2, an index set C3 and an index set C4.
[0157] It should be understood that each index set here is configured as a set of index identifiers for pre-storing each tuple. This means that the index set involved in the embodiment of the present application is a set of index identifiers for pre-storing corresponding tuples, which is determined after the index identifiers of the corresponding tuples in the tuple heap are respectively mapped. It should be understood that the index set here, while pre-storing the index identifier of the corresponding tuple, will also pre-store the address offset in the storage state data corresponding to the specific storage state (for example, the above-mentioned initial storage state) of the tuple, and the address offset in the storage state data corresponding to the pre-stored specific storage state (for example, the above-mentioned initial storage state) can be collectively referred to as the address offset corresponding to the index identifier of the currently pre-stored corresponding tuple.
[0158] For example, Figure 6 As shown, for each index set (for example, index set C3) in the index file, the index set C3 can be used to pre-store the index identifier of one or more tuples. Specifically, Figure 6 As shown, the index identifiers of the multiple tuples here may specifically include the index identifier of tuple Y1 (for example, Figure 6 The tuple ID1 shown in FIG. 1 ) and the address offset corresponding to the index identifier of the tuple Y1 (for example, Figure 6 The address offset 1 shown), the index identifier of tuple Y2 (for example, Figure 6 The tuple ID2 shown in FIG. 10 ) and the address offset corresponding to the index identifier of the tuple Y2 (for example, Figure 6 The address offset 2 shown), ..., and the index identifier of tuple Y3 (for example, Figure 6 The tuple ID3 shown in FIG. 10 ) and the address offset corresponding to the index identifier of the tuple Y3 (for example, Figure 6 The address offset shown is 3).
[0159] Therefore, when the computer device obtains the to-be-matched index identifier of the to-be-processed tuple to be queried (for example, Figure 6 When the tuple identifier shown is the index identifier of tuple ID3, the to-be-matched index identifier can be executed Figure 6 In step S22, a hash calculation is performed to obtain an index hash value of the index identifier to be matched (for example, Figure 6 H3 shown, assuming H3 = 7), further, the computer device can be Figure 6 The number of sets of multiple index sets shown (for example, 4) is determined, and step S23 is performed on the index hash value to perform a remainder calculation to calculate the remainder of the index hash value (for example, Figure 6 As shown in FIG. 1 , F3 here refers to the remainder obtained by performing a remainder processing on H3, for example, F3=3). At this time, the computer device may execute step S24 to search for a 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 here may be as follows: Figure 6 The set identifier shown is the index set C3 corresponding to C3 (eg, C3=3).
[0160] Optionally, in one possible implementation, as Figure 6 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 6 Then, before the computer device reads the index file 2c through the index file address, it also includes pre-building the index file 2c for indexing in the non-volatile storage space, wherein the specific steps of building the index file 2c are as follows:
[0161] The computer device may create an index file whose initial index address is the index file address in the NVM space, and configure multiple 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 the tuple identifier mapping of each tuple in the business table is stored in the index file. In this way, the computer device can use the table address in the directory file (for example, Figure 6 When the business table is obtained by the addr3 shown in the figure, the tuple stack in the business table can be obtained, and the tuple to be mapped (for example, the above tuple Y1) for identifier mapping can be obtained from the multiple tuples contained in the tuple stack, and the tuple identifier (for example, Figure 6 The tuple ID1 shown in the figure is determined as the tuple identifier to be mapped; further, when the computer device obtains the index file address corresponding to the table address through the address mapping relationship, it can obtain the index file through the index file address and obtain multiple 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 tuple identifier to be mapped, and store the tuple identifier mapping to be mapped to a target initial set in multiple initial sets according to the identifier mapping result (for example, Figure 6 The target initial set here refers to a set to which at least one tuple identifier has been mapped. Further, after the tuple identifier of each tuple in the tuple stack is selected as the tuple identifier to be mapped for identifier mapping, the computer device can confirm that the mapping and storage of each tuple identifier in the tuple stack to multiple initial sets is completed, and the multiple initial sets that have been mapped and stored are used as multiple index sets (for example, Figure 6 The index set C1, index set C2, index set C3 and index set C4 shown in the figure can be further indexed into the index files (for example, Figure 6 The index storage address of the index file 2c shown (for example, Figure 6 addr1) is updated and stored in the directory file (for example, Figure 6 Directory file 2a) shown.
[0162] Among them, the specific process of mapping and storing the tuple identifier to be mapped to the target initial set through the identifier mapping method can be described as follows: the computer device can perform a hash calculation on the tuple identifier to be mapped (for example, tuple ID1) to obtain the to-be-mapped index hash value of the tuple identifier to be mapped; further, the computer device can perform a remainder calculation on the number of sets of multiple initial sets through the to-be-mapped index hash value to obtain the remainder of the to-be-mapped index hash value (for example, 3); further, the computer device can search for the initial set corresponding to the set identifier that is consistent with the remainder of the to-be-mapped index hash value (for example, 3) in the multiple initial sets, and use the found initial set as the target initial set (for example, index set C3 with a set identifier of 3), and determine the target initial set as the identifier mapping result obtained after the to-be-mapped tuple identifier is identifier-mapped; further, the computer device can add and store the index item corresponding to the tuple identifier to be mapped to the target initial set according to the identifier mapping result; the index item corresponding to the tuple identifier to be mapped is used to store the initial storage address offset corresponding to the initial storage state of the tuple to be mapped (for example, Figure 6 The address offset 1 shown is a key-value pair of value; the initial storage state of the tuple to be mapped here refers to the storage state for storing the tuple to be mapped that is first constructed when the tuple to be mapped is inserted into the tuple heap, that is, the initial storage state of the tuple to be mapped here is essentially the first version of the tuple data that stores the tuple to be mapped.
[0163] It can be understood that the computer device can separate the tuple data and the tuple identifier in the tuple heap by deploying the index file and the tuple heap in the non-volatile storage space. For example, the computer device can store the tuple data of each tuple in the NVM space through the tuple heap, and can separate and store the tuple identifier of each tuple through the index file. The specific implementation method of the computer device performing hash calculation, remainder calculation and remainder matching on the tuple identifier to be mapped can be referred to in the above Figure 6 The description of the specific process of executing steps S22 to S24 for the matching index identifier will not be repeated here.
[0164] Step S103, in response to finding the target index identifier, determining the index storage address and 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] Among them, the tuple storage address of the target tuple is the storage address of the initial storage state of the target tuple, the initial storage state is a storage state among multiple storage states, the index file deployed in the non-volatile storage space includes a target index set for mapping and storing the target index identifier, and in the target index item corresponding to the target index identifier pre-stored in the target index set, a target key-value pair is stored with the target index identifier as the key and the initial storage address offset in the initial storage state data corresponding to the initial storage state as the value; the initial storage address offset refers to the offset between the 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 the storage state 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 the index storage address corresponding to the target index identifier; at this time, the computer device can obtain the target index identifier (for example, the above-mentioned) in the target index set of the index file in response to finding the target index identifier. Figure 6 The tuple identifier shown is the index identifier of tuple ID3) and the target index item corresponding to the target index item is obtained from the target index item (for example, the above Figure 6 tuple ID3: address offset 3 shown); further, the computer device may determine the initial storage address offset obtained from the target key-value pair (for example, address offset 3 corresponding to tuple ID3) as the storage address offset corresponding to the target index identifier; ... Figure 6 When the index identifier in the index file 2c) is in the non-volatile storage space, the directory file (for example, the above Figure 6 The index file address of the index file pre-stored in the directory file 2a) shown in FIG. Figure 6 addr1) shown in the figure, determine the index storage address corresponding to the target index identifier.
[0166] In other words, the embodiment of the present application may collectively refer to the index addresses of each index identifier pre-stored in the index file as index storage addresses corresponding to each index identifier, and the index storage addresses corresponding to each index identifier are all index file addresses of the same index file where these index identifiers are located.
[0167] Step S104, determining the tuple storage address by 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;
[0168] Specifically, the computer device may determine the storage address of the initial storage state of the target tuple through the storage 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 corresponds to the storage state Y11 shown in FIG. 1 ; the initial storage state data at least includes an address offset field (for example, the above Figure 5 Further, if the field value of the address offset field is not a preset address offset value (for example, the preset address offset value is "0"), and the field value of the address offset field is an initial storage address offset that is consistent with the storage address offset, the computer device can search for the initial storage address offset (for example, the above Figure 2 The address offset V1 shown in the figure) has a first index relationship (for example, a pointing relationship from address offset V1 to address offset V2) and updates the storage address offset (for example, the above Figure 2 The address offset V2 shown in FIG. 1 is the address offset V2 shown in FIG. 1 , where the updated storage address offset (for example, the above Figure 2 The address offset V2 shown in FIG. 1 is the offset between the index file address of the index file and the storage address of the updated storage state of the target tuple; the updated storage state is the next storage state of the initial storage state; further, the computer device may respond to finding the updated storage address offset (for example, the above Figure 2 The address offset V2 shown in the figure is determined by updating the storage address offset and the index file address to determine the storage address of the updated storage state of the target tuple, and the updated storage state having a first state link relationship with the initial storage state is obtained through the storage address of the updated storage state of the target tuple (for example, Figure 2 Further, the computer device can search and update the storage address offset (for example, the above Figure 2 The address offset V2 shown in the figure has a target storage address offset with a second index relationship (the second index relationship here is a pointing relationship different from the first index relationship). It should be understood that in one achievable manner, if the target storage address offset found is the initial storage address offset, the computer device can determine that the storage state with the second state link relationship with the updated storage state is the initial storage state, and then 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 updated storage state can be determined as the storage state set of the target tuple, so that the following step S105 can be further performed later;
[0169] The initial storage state and the updated storage state in the first state set here can be used to form the above-mentioned cyclic dual version. In the cyclic dual version, once the address offset corresponding to one version (i.e., one storage state) is obtained, the address offset corresponding to the currently obtained version can be used to quickly index to another address offset corresponding to another version. For example, the embodiment of the present application can be used through the initial storage state (for example, the above-mentioned Figure 2 The address offset in the initial storage state data corresponding to the storage state Y11 shown in FIG. Figure 2 The address offset V1 shown in FIG. 1 is the address offset in the updated storage state data corresponding to the updated storage state (for example, the address offset V2 shown in FIG. 1 is the address offset in the updated storage state data corresponding to the updated storage state). Figure 2 The address offset V2 shown in FIG. 1 is an index relationship (for example, the first index relationship) between the address offset V2 and the address offset V3 shown in FIG. 1 , and the address offset V2 in the updated storage state data corresponding to the updated storage state is quickly obtained (for example, the first index relationship). Figure 2 The specific data structures 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 be found in the above Figure 5 A schematic diagram of initial storage state data corresponding to an initial storage state and updated storage state data corresponding to an updated storage state in a cyclic dual version is shown.
[0170] Optionally, in another implementable manner, if the tuple version of the target tuple includes the above three versions (i.e., three storage states), the computer device may determine that the storage state having a second state link relationship with the updated storage state is another storage state different from the initial storage state (i.e., the above third storage state, for example, the new updated storage state) when the target storage address offset found is not the initial storage address offset, and then continue to index with another 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 having a third index relationship with the third address offset is indexed as the above initial storage address offset, the storage state having a third state link relationship with the third storage state may be determined to be the initial storage state, and then the state set for cyclically storing the target tuple consisting of the initial storage state, the updated storage state, and the new updated storage state (i.e., the above third storage state) may be determined as the storage state set of the target tuple through the first state link relationship, the second state link relationship, and the third state link relationship. At this time, the storage state set of the target tuple may include three versions of the target tuple.
[0171] It should be understood that, when the storage state set of the target tuple contains three or more versions (i.e., at least three storage states), the computer device's indexing method for any two versions (i.e., two storage states) of the at least three storage states that have a state link relationship can refer to the above description of the indexing method for the two versions in the cyclic dual version, and will not be further elaborated here.
[0172] Optionally, it can be understood that in an embodiment of the present application, if the field value of the address offset field (i.e., the above-mentioned address offset field, for example, Version Offset) in the initial storage state data corresponding to the initial storage state currently indexed 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 yet exist; at this time, the computer device can determine the second state set for storing the target tuple formed by 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 a storage state, and this storage state can be the above-mentioned initial storage state.
[0173] Step S105: If the storage state set includes multiple storage states, storage timestamps corresponding to the multiple storage states and an instruction timestamp corresponding to the data processing instruction are obtained.
[0174] It is understandable that when the storage state set of the target tuple includes multiple storage states (for example, two storage states), the storage timestamps corresponding to the two storage states 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, when the computer device executes the first transaction corresponding to the first transaction information, the transaction start timestamp can be configured for the first transaction, and then the transaction start timestamp configured for the first transaction can be used as the instruction timestamp corresponding to one or more data processing instructions here. This means that for each data processing instruction, the instruction timestamp corresponding to each data processing instruction is the transaction start timestamp here.
[0175] For further understanding, please refer to Figure 7 , Figure 7 FIG. 1 is a flow chart of performing a read operation on a target tuple based on a read request provided in an embodiment of the present application. Figure 7As shown, the computer device can execute step S31 to obtain a read request, where the read request refers to a data processing request of a read type obtained by the computer device, and the read request carries one or more tuple identifiers that need to be indexed, and the tuples corresponding to the one or more index identifiers that need to be indexed are the tuples to be processed that need to be located and read by the read request. At this time, the tuple identifiers of these tuples to be processed can be collectively referred to as index identifiers to be matched in the embodiment of the present application. Further, the computer device can execute step S32 to read the index file, and locate the tuple corresponding to the index identifier to be matched according to the index file. Among them, the specific implementation method of the computer locating the tuple through the index file can refer to the description of the specific process of identifier mapping, identifier search and tuple positioning through the index file, which will not be further described here.
[0176] Furthermore, after locating the tuple, the computer device may further execute step S33 to determine whether the tuple exists. If the determination is no, step S34 may be executed to roll back the transaction. That is, the embodiment of the present application may immediately roll back the first transaction requested by the read request.
[0177] Optionally, if the judgment is yes, step S35 can be further executed to determine whether there are two versions. If the judgment is no, it means that there is only a single version of the tuple in the tuple heap at this time (that is, the above-mentioned initial storage state), so 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 (that is, the above-mentioned storage time field) from the initial storage state data corresponding to the single version (that is, the initial storage state) of the target tuple according to the read request. Figure 7 The field value of Wts shown in the figure can then be used to obtain the storage time field (i.e. the above Figure 7 The field value of the Wts shown in the figure 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 of the tuple data first used to store the target tuple before forming multiple storage states, and the field value of the storage time field of the initial storage state of the target tuple is the initial storage timestamp corresponding to the initial storage state. Then, the computer device can further compare the initial storage timestamp corresponding to the initial storage state with the transaction start timestamp (i.e., the instruction timestamp corresponding to the read instruction corresponding to the read type, for example, it can be the instruction start timestamp) to obtain a first comparison result.
[0178] Further, such as Figure 7As 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, during the execution of the first transaction, the initial storage state of the target tuple cannot be read, so it is necessary to execute step S37 to roll back the transaction. Otherwise, optionally, Figure 7 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 means that the initial storage state of the target tuple has been 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, so step S38 can be further executed to read the version of the tuple whose Wts is not greater than the transaction start timestamp, which 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 an embodiment of the present application, if the first comparison result indicates that the initial storage state storage timestamp is less than or equal to the transaction start timestamp (i.e., the instruction timestamp, which can be 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 the embodiment of the present application can also configure a transaction end timestamp for the first transaction when the first transaction is executed, and determine the transaction end timestamp 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 to determine whether the transaction start timestamp is between the Wts of the two versions if it determines that there are two versions (for example, a cyclic dual version consisting of an initial storage state and an updated storage state). If it is determined to be yes, step S40 may be further executed to read the version of the tuple whose Wts is less than the transaction start timestamp (for example, the above-mentioned initial storage state). Figure 7As shown, if the judgment is no, it is necessary to further execute step S41 to determine whether the Wts of the version with a larger Wts is less than the transaction start timestamp. If the judgment is yes, step S42 can be further executed to read the version of the tuple with the largest Wts. It should be understood that at this time, the version of the tuple with the largest Wts can be the above-mentioned updated storage state. On the contrary, if the judgment is no, that is, when the Wts of the version with a larger Wts is not less than (that is, greater than or equal to) the transaction start timestamp, step S43 can be further executed to roll back the version. This means that at this time, the two versions used to constitute the circular dual version are created after the first transaction, so the computer device cannot read the tuple data in these two versions when executing the first transaction.
[0181] Among them, the specific implementation method of the computer device executing steps S39 to S43 can be found in the following step S106.
[0182] Step S106, based on the storage timestamps corresponding to the multiple storage states and the instruction timestamps corresponding to the data processing instructions, determine the target storage state corresponding to the target tuple in the multiple storage states, and execute the instruction operation indicated by the data processing instruction on the target tuple in the target storage state.
[0183] If the multiple storage states of the target tuple include an initial storage state and an updated storage state for constituting a cyclic dual version, the embodiment of the present application can determine which of the two versions in the cyclic dual version is the old version and which is the new version by comparing the size of the Wts of the two versions (i.e., the storage timestamps corresponding to the two storage states respectively). 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 updated storage state as Wts2 (the second storage timestamp). Among them, 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 updated storage state data corresponding to the updated storage state is the target tuple data;
[0184] Specifically, if the first storage timestamp is a preset first time threshold (for example, "0"), then when the initial storage state is determined to be an invalid storage state (that is, the initial storage state is an 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 updated storage state as a valid version (that is, the target storage state corresponding to the target tuple); further, if the request type of the data processing request is a read type, the computer device can, in the target storage state, when performing a read operation indicated by the read type on the target tuple, update the storage state from the valid version. The computer device may read the tuple data of the target tuple (i.e., the target tuple data mentioned above) from the updated storage state corresponding to the valid version (i.e., the target storage state corresponding to the target tuple); or, optionally, if the request type of the data processing request is a write type, the computer device may read the target tuple data of the target tuple from the updated storage state data corresponding to the valid version (i.e., the target storage state corresponding to the target tuple) when performing a 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 invalid initial storage state through the read target tuple data and the transaction detail data indicated by the first transaction.
[0185] For further understanding, please refer to Figure 8 , Figure 8 Schematic diagram of the process of updating the target tuple based on a write request provided by an embodiment of the present application. Figure 8 As shown, the computer device can execute step S51 to obtain a write request, where the write request refers to a data processing request of a write type obtained by the computer device, and the write request carries one or more tuple identifiers that need to be read, and the tuples corresponding to the one or more tuple identifiers that need to be read are the above-mentioned tuples to be processed. At this time, the embodiment of the present application can collectively refer to the tuple identifiers of these tuples to be processed as index identifiers to be indexed and matched. Further, the computer device can execute step S52 to read the index file, and locate the tuple corresponding to the index identifier to be matched through the index file. Among them, the specific implementation method of the computer locating the tuple through the index file can refer to the description of the specific process of performing identifier mapping, identifier search and tuple positioning through the index file involved in the above-mentioned steps S102-step S104, which will not be further described here.
[0186] Furthermore, after locating the tuple, the computer device may further execute step S53 to determine whether the tuple exists. If the judgment is no, that is, after locating the tuple through the index file, the computer device determines that the tuple corresponding to the currently queried index identifier to be matched does not exist in the tuple heap, then step S60 may be executed to allocate tuple storage space on the NVM, and modify the modification transaction information, tuple identifier, deletion mark bit, and Wts (i.e., storage timestamp) of the tuple.
[0187] It should be understood that when the computer device determines that there is no tuple corresponding to the currently queried to-be-matched index identifier in the tuple heap, it can further detect an insertion operation for tuple insertion in the instruction operation indicated by one or more data processing instructions in response to not finding the target index identifier; then, the computer device can configure a first tuple storage space for the to-be-processed tuple corresponding to the to-be-matched index identifier in the non-volatile storage space in response to the detected insertion operation, and create an initial storage state of the to-be-processed tuple in the first tuple storage space, and then write the 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 Wts will be set to a preset second time threshold (for example: INF, i.e., infinity), where INF is used to indicate that the transaction currently modifying the tuple is currently in a transaction execution state, i.e., it has not been committed. Therefore, the official value of Wts will only be obtained after the transaction that currently modifies the tuple is committed. That is, at this time, the value of Wts will be updated from INF to the transaction end timestamp of the transaction, which indicates that the transaction that currently modifies the tuple has completed the modification of the initial storage state of the tuple.
[0188] Optionally, the computer device may also terminate the execution of the first transaction when the target index identifier is not found and the insertion operation is not checked. In an implementable manner, the multiple data processing instructions include a first data processing instruction and a second data processing instruction, the first transaction includes a first subtransaction corresponding to the first data processing instruction and a second subtransaction corresponding to the second data processing instruction; the tuple corresponding to the first subtransaction is a tuple to be processed; the tuple corresponding to the second subtransaction is an associated processing tuple; the associated processing tuple is a tuple in a tuple heap, at this time, the computer device performs a transaction rollback on the first transaction, which can be specifically described as: when the transaction state of the first transaction corresponding to the first transaction information is a transaction execution state, if the second subtransaction is an executed transaction when executing the first subtransaction, then in the process of rolling back the transaction of the first transaction, the execution of the first subtransaction is terminated, and the transaction modification operation performed on the second subtransaction is revoked; the transaction modification operation here includes a write operation and / or a delete operation on the tuple version of the associated processing tuple read by the second subtransaction.
[0189] Furthermore, the computer device may also configure the storage state of the associated processing tuple corresponding to the transaction modification operation to an invalid storage state; the invalid storage state here 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 reclaimed space; the associated tuple storage address added in the reclaimed space is used to perform spatial reuse on the tuple storage space corresponding to the associated tuple storage address when performing space configuration through the tuple manager.
[0190] It should be understood that the embodiment of the present application can further check whether the transaction operation indicated by the first transaction is an insert operation when it is determined that there is no target tuple matching the tuple to be processed in the tuple stack. If the transaction operation is an insert operation, a tuple storage space (i.e., a first tuple storage space) can be configured in the NVM space for the tuple to be processed, and the first tuple storage space can be configured according to the above Figure 5 The storage state data shown in the figure is modified by modifying each field (for example, the address offset field, the transaction modification information field, the atomic lock field, the modification type field, the storage time field, the deletion mark field, the tuple identification field, and the tuple data field) in the storage state data to create the initial storage state data corresponding to the initial storage state of the tuple to be processed, and inserting the created initial storage state data corresponding to the initial storage state of the tuple to be processed into the tuple heap, modifying the metadata of the tuple to be processed, where the metadata may include but is not limited to the modification transaction information (that is, the field value of the above-mentioned transaction modification information field), the tuple identification (that is, the field value of the above-mentioned tuple identification field), the deletion The mark bit (i.e., the field value of the delete mark field), and Wts (i.e., the field value of the above-mentioned storage time field), and then jump to execute step S56, and complete the writing at the selected tuple version (for example, the initial tuple data of the tuple can be written at the field value of the above-mentioned tuple data field), that is, the embodiment of the present application can determine the initial storage state created when the tuple to be processed is first inserted as a valid version (i.e., the above-mentioned target storage state) based on the request operation indicated by the write request (i.e., the write operation), and then the valid version (i.e., the above-mentioned target storage state) can be used as the currently selected tuple version to complete the writing at the currently selected tuple version.
[0191] Optionally, if the judgment is yes, that is, the computer device determines that the tuple exists in the tuple heap (that is, the target tuple matching the tuple to be processed is found in the tuple heap), then step S54 can be further executed to determine whether there are two versions. The specific implementation method of the computer device determining whether there are two versions can be found in the description of step S104 above, which will not be repeated here.
[0192] In one achievable manner, if the judgment is yes, step S57 can be executed to determine whether the Wts of the version with a larger Wts is smaller 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 the above step S105. 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 executing step S57, the field value of the storage time field in the updated storage state data corresponding to the updated storage state (i.e., Wts2) can be compared with the transaction start timestamp of the currently executing transaction (i.e., the first transaction) to determine whether the Wts of the version with a larger Wts (e.g., the updated storage state) is smaller than the transaction start timestamp. If it is judged to be yes, it means that the updated storage state is a valid version (i.e., the above-mentioned target storage state) at this time, so the version of the tuple with a small wts (i.e., the initial storage state) can be determined as a modifiable version, and then step S58 can be executed, and the version of the tuple with a small Wts can be locked with the help of an atomic lock on the version of the tuple with a small Wts, and the information of the modification transaction of the tuple, Wts, can be modified, and then step S56 can be jumped to complete the writing at the selected tuple version. In other words, when the embodiment of the present application performs the write operation indicated by the write request on the target tuple, the target tuple data of the target tuple can be read from the updated storage state data corresponding to the valid version (i.e., the version of the tuple with a large Wts, for example, the updated storage state), and the initial tuple data of the target tuple in the corresponding initial storage state data of the modifiable version (i.e., the version of the tuple with a small Wts, for example, the initial storage state) in the locked state is modified by the target tuple data read from the target tuple. At this time, the modifiable version here refers to the version that the computer device can lock with the help of an atomic lock.
[0193] Optionally, in another possible implementation, after the computer device executes step S57, if it is judged as no, that is, it is judged that the Wts of the version of the tuple with a larger Wts (for example, updating the storage status) is not less than (that is, greater than or equal to) the transaction start timestamp, then it means that the two versions used to constitute the cyclic dual version at this time are both unreadable versions when executing the first transaction, so it is necessary to execute step S59 on the first transaction to roll back the transaction.
[0194] Similarly, it can be understood that after the computer device executes step S54, if it is determined that the tuple exists in the tuple stack, but the tuple version of the tuple is not a cyclic double version, it can be determined that at this time, the storage state set of the tuple (i.e., the target tuple) in the tuple stack 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 yet exist. At this time, the computer device needs to execute step S55 when performing the first tuple update on the target tuple based on the write request, allocate tuple storage space on the NVM, and modify the modification transaction information, tuple identifier, deletion mark bit, and Wts of the tuple. Among them, the specific implementation method of the computer device implementing the first tuple update through step S55 can refer to the description of the specific implementation method when the tuple is first inserted into the tuple stack through step S60 above, which will not be repeated here.
[0195] In other words, optionally, the embodiment of the present application may further specifically perform the following steps when executing step S106: the computer device may compare the first storage timestamp with the transaction start timestamp when the first storage timestamp is not the preset first time threshold, 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 may compare the second storage timestamp with the first storage timestamp when the request type of the data processing request is a write type, to obtain a fourth comparison result. 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 a storage state in a locked state, and determine that the updated storage state is the target storage state; further, the computer device can be in the target storage state, when performing a write operation indicated by the write type on the target tuple, read the target tuple data from the updated storage state data corresponding to the updated storage state, and update the initial tuple data in the initial storage state data corresponding to the initial storage state in the locked state through the read target tuple data and the transaction detail data indicated by the first transaction.
[0196] It can be seen that when the embodiment of the present application obtains a data processing request, the to-be-matched index identifier and one or more data processing instructions can be obtained from the data processing request; in this way, when the computer device executes the first transaction, it can perform an identifier mapping for the to-be-matched index identifier related to the first transaction, and then determine the index set used to map the to-be-matched index identifier as the target index set in multiple index sets; further, if a target index identifier matching the to-be-matched index identifier is found in the target index set, it can be determined that there is a target tuple matching the to-be-processed tuple in the tuple heap; it should be understood that the index file here is an index table in a non-volatile storage space, and the index file includes multiple index sets, and the multiple index sets here are determined after the tuple identifiers in the tuple heap in the non-volatile storage space are identifier-mapped. This means that when an index file for indexing and a tuple heap for data storage are deployed in a non-volatile storage space, the entire index file can be avoided from being fully indexed through each index set in the index file (for example, an index set can be a bucket), thereby avoiding the full search of the entire table of the business table where the tuple heap is located from the root. In other words, the embodiment of the present application can quickly locate and find the target index set in the non-volatile storage space by indexing the index file, so that the target index identifier that matches the tuple identifier of the current index (i.e., the index identifier to be matched) can be quickly found in the target index set. Further, the embodiment of the present application can determine the index storage address (for example, the above-mentioned index file address) and 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 the tuple storage address of the target tuple can be reversely calculated and determined through 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 through the determined tuple storage address. For example, if the computer device determines that the storage state set of the target tuple includes multiple storage states, it can further obtain the storage timestamps corresponding to the multiple storage states and the instruction timestamps corresponding to the data processing instructions (for example, the above-mentioned transaction start timestamp), and then the target storage state corresponding to the target tuple (that is, the above-mentioned valid version) can be determined in the multiple storage states through the storage timestamps corresponding to the multiple storage states and the instruction timestamps corresponding to the data processing instructions, and then the instruction operation indicated by the data processing instruction can be executed on the target tuple in the target storage state, thereby improving the efficiency of operation execution.
[0197] For further information, see Fig. 9 , Fig. 91 is a flow chart of another data processing method based on non-volatile storage space provided by the present application. The non-volatile storage space includes multiple tuples, and the multiple tuples are set to be indexed by index identifiers pre-stored in the non-volatile storage space. Fig. 9 As shown, the method may at least include steps S201 to 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 the non-volatile storage space for a target index identifier that matches the index identifier to be matched;
[0200] Step S203, in response to finding the target index identifier, determining the index storage address and 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;
[0201] Step S204, determining the tuple storage address by 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;
[0202] Step S205, if the storage state set includes multiple storage states, then obtaining storage timestamps corresponding to the multiple storage states and an instruction timestamp corresponding to the data processing instruction;
[0203] Step S206, based on the storage timestamps corresponding to the multiple storage states and the instruction timestamps corresponding to the data processing instructions, determine the target storage state corresponding to the target tuple in the multiple storage states, and execute the instruction operation indicated by the data processing instruction on the target tuple in the target storage state.
[0204] The specific implementation of steps S201 to S206 can be found in the above Figure 3 The description of the specific implementation method of step S101 to step S106 in the corresponding embodiment will not be repeated here.
[0205] Among them, the one or more data processing instructions are instructions in the first transaction information carried in the data processing request. Optionally, after the computer device executes step S204, if the request type of the data processing request includes a read type, the computer device can further execute the following 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 the next storage state of the initial storage state of the target tuple does not exist yet, then according to the read type, 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; wherein the initial storage state of the target tuple refers to the storage state of the tuple data first used to store the target tuple before forming a plurality of storage states, 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, obtaining a transaction start timestamp of the first transaction corresponding to the first transaction information, and determining the transaction start timestamp as an instruction start timestamp corresponding to the read instruction;
[0208] Step S209, comparing the initial storage timestamp with the instruction start timestamp to obtain a first comparison result;
[0209] It should be understood that after executing step S209, the computer device may also execute the following step S210, or may 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, then according to the read type, 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.
[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] The specific implementation method of the computer device jumping to execute step S207-step S211 after executing step S204 can be found in the above Figure 7 In the corresponding embodiment, after executing step S35, the specific implementation method of jumping to execute step S35-step S38 will not be described in detail here.
[0213] Optionally, it can be understood that when the computer device executes step S205, it can also be used to further execute the following steps when there are two versions and there is no invalid version in the two versions: the computer device can compare the first storage timestamp with the transaction start timestamp when the first storage timestamp is not a preset first time threshold, 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 when the request type of the data processing request is a write type. The storage timestamps are compared 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 a storage state in a locked state, and determine that the updated storage state is the target storage state; further, the computer device can read the target tuple data from the updated storage state data corresponding to the updated storage state when performing a 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 through the read target tuple data and the transaction detail data indicated by the first transaction. Among them, the specific implementation method of the computer device determining the valid version through the fourth comparison result when it is determined that there are two versions and there is no invalid version in the two versions can be found in the above Figure 7 The description of the specific implementation method of steps S39 to S42 in the corresponding embodiment 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 can determine the version with the smaller storage timestamp (i.e. the initial storage state) as the valid version (i.e. the above-mentioned target storage state) based on the read type. At this time, the specific implementation method of the computer device determining the valid version through the third comparison result can be referred to the above Figure 7 The description of step S40 in the corresponding embodiment will not be repeated here.
[0215] Optionally, if the third comparison result indicates that both the first storage timestamp and the second storage timestamp are not 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 of the target tuple (i.e., the initial storage state and the updated storage state) are unreadable versions, and therefore it is necessary to roll back the first transaction, for example, it is necessary to immediately terminate the execution of the first transaction.
[0216] For ease of understanding, the embodiment of the present application provides the relevant program code for concurrent access control through cyclic dual versions when the data processing request is a read request. The cyclic dual versions here are tup1 and tup2 in the relevant program code, which can be specifically referred to as follows:
[0217] Function txnRead(key,txn): / / Get the index identifier to be matched with the request parameter key and the transaction information with the request parameter txn (i.e. the first transaction information mentioned above) from the read request;
[0218] tup1 = offsetToPtr(readIndex(key)); / / Get the index storage address corresponding to the target index identifier from the index file through 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 storage address to locate the storage status of the current tuple, for example, tup1;
[0219] if tup1 == NULL then
[0220] return Abort; / / If tup1 is an empty version (i.e. tup1 is not located), the transaction needs to be rolled back;
[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 accessed quickly. Otherwise, if this tuple is another transaction that modifies this tuple, and the other transaction is in the transaction commit phase, it is necessary to wait for the other transaction to be committed before reading;
[0222] tup2 = offsetToPtr(tup1.next); / / Locate another tuple version of the current tuple, for example, tup2, through the version link relationship between tup1 and tup2 (for example, the index relationship between two different address offsets, that is, 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 an empty version (i.e., tup2 is not located), it is determined that there is only one version tup1. At this time, it is necessary to determine whether the storage timestamp of tup1 (i.e., tup1.wts) is greater than the start timestamp of the current transaction (i.e., txn.ts). Then, when tup1.wts is not greater than (i.e., less than or equal to) the transaction start timestamp, tup1 of this tuple can be accessed. Otherwise, when tup1.wts is greater than the transaction start timestamp, the current transaction will be rolled back or aborted.
[0225] fastReadOrWait();
[0226] Sort();
[0227] if tup1.wts == 0 then
[0228] return(tup2.wts>txn.ts)? Abort:tup2; / / When tup1.wts==0, it is determined that tup1 in the loop dual version is an invalid version. At this time, it is necessary to determine whether the storage timestamp of tup2 (i.e., tup2.wts) is greater than the transaction start timestamp of the current transaction (i.e., txn.ts) to determine whether tup2 is visible (i.e., valid) when executing the current transaction. If visible, access tup2 of this tuple; otherwise, rollback the current 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 timestamp is smaller than tup1.wts (i.e., the version with a smaller tuple wts), the transaction is rolled back; otherwise, if the transaction timestamp is between the two versions of Wts, the version with a smaller Wts (e.g., tup1) is read; or, if the transaction start timestamp is larger than the version with a larger Wts, the version with a larger Wts (e.g., tup2) is read.
[0235] It can be seen that, when the embodiment of the present application obtains a data processing request, it can obtain from the data processing request the first transaction information for defining the instruction operation corresponding to a series of data processing instructions, and the to-be-matched index identifier of the tuple to be processed (i.e., the tuple currently required to be accessed for the first transaction); in this way, when executing the first transaction, the target index identifier that matches the to-be-matched index identifier can be searched in the index file, and then when the target index identifier is found, it can be determined that there is a target tuple matching the to-be-processed tuple in the tuple stack; it should be understood that, by deploying an index file for indexing and a tuple stack for data storage in a non-volatile storage space, the embodiment of the present application can utilize the byte addressing capability of the non-volatile storage space to quickly find the target index identifier that matches the tuple identifier of the current index (i.e., the to-be-matched index identifier) found in the index file, and then it can be quickly determined that there is a target tuple corresponding to the target index identifier in the tuple stack. Furthermore, the embodiments of the present application can quickly index to the two versions or a single version in the circular dual version (i.e., the above-mentioned initial storage state) based on the storage address offset corresponding to the target index identifier in the index file, and then determine whether there is a valid version through the relationship between the storage timestamps in the two versions or a single version in the circular dual version (i.e., the above-mentioned initial storage state) and the transaction start timestamp of the first transaction, and then read the valid version when it exists to improve the timeliness and accuracy of reading the valid version.
[0236] For further information, see Fig.10 , Fig.10 FIG. 1 is a flow chart of another data processing method based on non-volatile storage space provided by the present application. Fig.10 As shown, the method may at least include steps S301 to S310:
[0237] Step S301, obtaining 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, searching the non-volatile storage space for a target index identifier that matches the index identifier to be matched;
[0239] Step S303, in response to finding the target index identifier, determining the index storage address and 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;
[0240] Step S304, determining the tuple storage address by 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;
[0241] Step S305, if the storage state set includes multiple storage states, then obtaining storage timestamps corresponding to the multiple storage states and an instruction timestamp corresponding to the data processing instruction;
[0242] Step S306, based on the storage timestamps corresponding to the multiple storage states and the instruction timestamps corresponding to the data processing instructions, determine the target storage state corresponding to the target tuple in the multiple storage states, and execute 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 to S306 can be found in the above Figure 3 The description of the specific implementation method of step S101 to step S106 in the corresponding embodiment will not be repeated here.
[0244] The one or more data processing instructions are instructions in the first transaction information carried in the data processing request. In the embodiment of the present application, the data processing request is a write request as an example, and the request type of the data processing request is a write type. At this time, optionally, after the computer device executes step S304, the computer device can further execute the following steps S307-S310.
[0245] Step S307, 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, then a second tuple storage space is configured for the target tuple in the non-volatile storage space based on the write type, and the next storage state of the initial storage state of the target tuple is created in the second tuple storage space, and 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 updated storage state of the target tuple, the storage state data corresponding to the updated storage state of the target tuple is determined as the updated storage state data; the second tuple storage space is used to store the second storage address of the updated 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;
[0246] Step S308, when the initial storage state data corresponding to the initial storage state is read through the first storage address in the first tuple storage space, the initial tuple data of the target tuple is read from the initial storage state data corresponding to the initial storage state, and 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, the target tuple data for writing into the updated storage state data corresponding to the updated storage state is determined;
[0247] Step S309, when adding the updated storage state of the target tuple to the tuple heap where the multiple tuples are located, in the updated storage state data corresponding to the updated storage state, the field value of the tuple data field of the target tuple is configured as the target tuple data of the target tuple;
[0248] Among them, the fields in the updated storage state data corresponding to the updated storage state include a tuple data field and an atomic lock field; wherein, the field value of the atomic lock field is used to describe that the updated 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 in the updated storage state data corresponding to the updated storage state as a lock value used to characterize the lock of the updated storage state, and based on the write operation indicated by the lock value authorization write instruction, configure the field value of the tuple data field as the target tuple data of the target tuple.
[0249] Optionally, after configuring the field value of the tuple data field as the target tuple data of the target tuple, the computer device may further perform the following steps: in the updated storage state data corresponding to the updated storage state, updating the field value of the atomic lock field from the lock value configuration to an unlock value for unlocking the updated storage state; the unlock value here is used to indicate that when executing the read operation and / or write operation indicated by the second transaction, the target tuple data can be accessed and read for the second transaction in the updated storage state data corresponding to the updated storage state; the second transaction is a transaction other than the first transaction.
[0250] Step S310, establishing a first state link relationship between the initial storage state and the updated storage state; the first state link relationship refers to a relationship used to describe the field value of the address offset field in the updated storage state data corresponding to the updated storage state, pointing to the field value of the address offset field in the initial storage state data corresponding to the initial storage state, wherein, 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, the field value of the address offset field in the updated storage state data corresponding to the updated storage state is an updated storage address offset, the updated storage address offset is an offset having a first index relationship with the storage address offset, the updated storage address offset is determined by the offset between the second storage address of the updated storage state and the index storage address of the index file in the non-volatile storage space, and the storage address offset is determined by the initial storage address offset between the first storage address of the initial storage state and the index storage address of the index file.
[0251] Optionally, the fields in the updated storage state data corresponding to the updated storage state here include a storage time field. When executing the first transaction, the field value of the storage time field is a preset time threshold (for example, the above-mentioned INF) used to characterize that the first transaction is in a transaction execution state, and the non-volatile storage space includes a transaction submission log list for recording submitted transactions. At this time, the computer device can also obtain a transaction end timestamp used to characterize the completion of the execution of the first transaction when it is checked that the instruction operation indicated by each data processing instruction in one or more data processing instructions has been executed; further, the computer device can update the field value of the storage time field from the preset time threshold (for example, the above-mentioned INF) to the transaction end timestamp in the updated storage state data corresponding to the updated storage state, and submit the first transaction identifier of the first transaction to the transaction submission log list, and determine that the first transaction is a submitted transaction by submitting the first transaction identifier to the transaction submission log list; the storage timestamp corresponding to the updated storage state is the transaction end timestamp.
[0252] In addition, 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 commit phase; 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 have a first state link relationship between the initial storage state and the updated storage state, and the updated storage state is the next version of the initial storage state. At this time, a second state link relationship between the initial storage state and the updated storage state is established, and the second state link relationship refers to a relationship used to describe the field value of the address offset field in the initial storage state data corresponding to the initial storage state, pointing to the field value of the address offset field in the updated storage state data corresponding to the updated storage state; then, the computer device can construct a first state set of tuple data for cyclic storage of the target tuple through the first state link relationship, the second state link relationship, the initial storage state and the updated storage state; the first state set is one of the storage state sets of the target tuple, and at this time, the initial storage state and the updated storage state in the first state set are the cyclic dual versions currently constructed for the target tuple.
[0253] For ease of understanding, please refer to Fig.11 , Fig.11 is a flowchart of various stages involved in executing the first transaction provided by the embodiment of the present application. Fig.11 As shown, the computer device can allocate a transaction start timestamp (i.e. Fig.11 In step S61 shown in FIG. 1 , further, the computer device may execute the current transaction (i.e., the first transaction) based on the assigned transaction start timestamp (e.g., the txn.ts), and then, during the transaction execution phase, may: access the index file, locate the tuple (i.e., Fig.11 In the step S62 shown in FIG. 1 , the computer device can perform read and write operations on the located tuples during the transaction execution phase (i.e., Fig.11 It should be understood that when the data processing request currently obtained by the computer device is a write request, the computer device can, during the metadata modification phase: assign a transaction end timestamp, set the storage timestamp corresponding to the storage state of the tuple modified by the current transaction to the transaction end timestamp (i.e. Fig.11In this way, the computer device can enter the transaction commit phase based on the transaction end timestamp, and then save the transaction identifier in the storage state of the modified tuple in the transaction commit phase, and submit the transaction identifier to the transaction commit log list (i.e. Fig.11 Step S65 shown).
[0254] The specific process of the computer device submitting the transaction identifier (i.e., the first transaction identifier) of the current transaction (i.e., the first transaction) to the transaction submission log list through steps S61 to S65 can be seen in the above Figure 4 The description of the specific process of writing the Txn1 submission to the transaction submission log list 4a in the corresponding embodiment will not be further repeated here.
[0255] For further understanding, please refer to the following Fig.12 , Fig.12 Schematic diagram of the process of creating a cyclic dual version provided by the embodiment of the present application. Fig.12 As shown, when a computer device stores a tuple (i.e., stores a tuple in a certain tuple), it can alternately store the content to be written (i.e., the latest tuple data of the tuple) by cycling through the dual versions. Fig.12 As shown, when the computer device determines that the tuple does not exist in the current tuple stack, it is necessary to further determine whether the transaction operation indicated by the currently executed first transaction is an insert operation (i.e. Fig.12 If the judgment is yes, then step S72 may be executed to allocate a first tuple storage space and insert the tuple into the tuple heap through the allocated first tuple storage space. Fig.12 If the judgment is no, it is necessary to determine whether the transaction operation indicated by the first transaction is the first update (i.e. Fig.12If the judgment is yes, then step S74 will be executed to allocate a second tuple storage space, update the tuple through the allocated second tuple storage space, and link the second tuple storage space with the first tuple storage space (i.e., establish a first state linking relationship between the initial storage state and the updated storage state, and then after the first transaction is committed, further establish a second state linking relationship between the initial storage state and the updated storage state, that is, the embodiment of the present application can achieve the link between the initial storage state and the updated storage state through the established first state linking relationship and the second state linking relationship). Optionally, it can be understood that after the computer device executes step S73, if the judgment is no, it is necessary to further execute step S75, that is, it is necessary to determine the modifiable version by the size of the two versions of Wts in the two versions corresponding to the two tuple storage spaces of the current tuple (i.e., the smaller version of Wts is the old version, and the larger version of Wts is the new version), and then step S75 can be executed to write the content through the tuple storage space corresponding to the selected old version.
[0256] The storage address of the old version (e.g., the initial storage state) is stored in the tuple storage space of the old version. The old version (i.e., the initial storage state) can be located in the tuple heap through the storage address, and then the initial tuple data of the tuple (i.e., the amount of the account balance of account U1 stored in the new version is 100) and the transaction details data of the first transaction (e.g., 50 is transferred from the account U1) read from the updated storage state data corresponding to the new version (e.g., the updated storage state) can be used to determine the content for writing the old version (i.e., the target tuple data of the tuple, for example, the target tuple data that can be written to the old version can specifically be the amount of the latest account balance after the amount of the account balance of account U1 is updated, for example, 100-50=50). The old version here can be the initial storage state in the above-mentioned circular dual version, and the new version can be the updated storage state in the above-mentioned circular dual version.
[0257] For ease of understanding, the embodiment of the present application provides the relevant program code for concurrent access control through cyclic dual versions when the data processing request is a write request. The cyclic dual versions here are tup1 and tup2 in the relevant program code, where the key of the tuple currently to be modified is the tuple identifier of the tuple (i.e. the above-mentioned index identifier to be matched), and txn is the transaction information of the transaction currently 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 a data processing request that is a write request, the request parameters carried in the write request include the key to be indexed (i.e., the index identifier to be matched) and the first transaction information of the first transaction to be executed. The first transaction information (i.e., txn) here 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 tup1 of the tuple in the tuple heap through the storage address of tup1;
[0260] if tup1==NULL&txn.type==insert
[0261] then
[0262] tup1 = allocator(); / / If it is determined through the index file that there is no such tuple in the tuple heap (i.e., tup1 is an empty version), and the transaction operation (i.e., txn.type) of the first transaction is an insert operation, the space allocation component can be called through the allocator() method in the tuple space manager to allocate space for the tup1 of the tuple (i.e., allocate the above-mentioned first tuple storage space), and write tup1 in the allocated space (i.e., allocate the above-mentioned first tuple storage space). 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); / / In the transaction execution phase of the first transaction corresponding to the first transaction information (i.e., txn), the tuple data of the tuple for storage obtained from the first transaction information (i.e., txn) is written into the initial storage state data corresponding to tup1, and tup1 storing the tuple data of the tuple is inserted into the tuple heap;
[0264] return tup1;
[0265] else if(tup1==NULL)∧(txn.type!=insert)then
[0266] return Abort; / / If it is determined through the index file that there is no such tuple in the tuple heap (that is, tup1 is an empty version), and the transaction operation of the first transaction (that is, txn.type) is not an insert operation, then the first transaction is rolled back;
[0267] tup2 = offsetToPtr(tup1.next); / / Locate another tuple version of the current tuple, for example, tup2, through the state link relationship between tup1 and tup2 (i.e., tup1.next, for example, the 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 an empty version), then when there is only one tuple version (i.e., only tup1 exists), the space allocation component can be called by the allocator() method in the tuple space manager deployed in the NVM space to allocate space for the tup2 of the tuple (i.e., allocate the above-mentioned second tuple storage space), and write tup2 in the allocated space (i.e., allocate the above-mentioned second tuple storage space). For example, the storage address of tup2 can be recorded through the allocated space, so that tup2 can be accessed in the tuple heap through the storage address of tup2 later;
[0270] if CAS(tup1.lock,false,ture)fails then
[0271] return Abort: / / By comparing the Wts of tup1 (for example, the above Wts1) and the Wts of tup2 (for example, the above Wts2), 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 before modifying tup1, it is necessary to call the atomic lock through the CAS operation to lock the tup1 that needs to be modified; for example, when tup1 locking fails, it means that during the execution of the first transaction, other transactions are locking and modifying tup1. Therefore, tup1 cannot be repeatedly locked and modified during the execution of the current transaction. In other words, the embodiment of the present application can lock a transaction once during the execution of multiple transactions by using the CAS operation, which can avoid transaction conflicts during the execution of multiple transactions, which means that the current transaction cannot directly repeatedly modify tup1 locked by other transactions.
[0272] bind(tup1, tup2); / / Link the two versions of the tuple, that is, establish a state link relationship between tup1 and tup2. The state link relationship here is that when there are two versions, after sorting the pointers by comparing the Wts of the two versions, the pointer pointing to the old version is always the version with the smaller Wts of the two versions. For example, the state link relationship represented by the pointer pointing can be the first state link relationship or the second state link relationship mentioned above;
[0273] memcpy_content(tup2,txn) writes the tuple data of the tuple for storage obtained from the first transaction information (i.e., txn) into the version data structure corresponding to tup2 during the transaction execution phase of the first transaction corresponding to the first transaction information (i.e., txn), and stores tup2 storing the tuple data of the tuple into 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 sort the pointers by comparing the Wts of the two versions. The pointer between tup1 and tup2 can be determined as a pointer for pointing to the old version, and the pointer for pointing to the old version (for example, tup1) always points to the version with the smaller Wts of the two versions.
[0278] then
[0279] return Abort; / / If the Wts of both versions are greater than the transaction start timestamp, the current transaction needs to be aborted and rolled back;
[0280] else
[0281] if CAS(tup1.lock,false,ture)fails then
[0282] return Abort; by comparing the Wts of tup1 (for example, the above Wts1) and the Wts of tup2 (for example, the above Wts2), 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 before modifying tup1, it is necessary to call the atomic lock through the CAS operation to lock the tup1 that needs to be modified; for example, when tup1 lock fails, it means that during the execution of the first transaction, other transactions are locking and modifying tup1, so tup1 cannot be repeatedly locked and modified when the current transaction is executed;
[0283] memcpy_content(tup1,txn); when tup1 is locked successfully, the tuple of the currently locked tup1 can be updated and stored;
[0284] change(tup1.lock); after the tuple of the currently locked tup1 is updated and stored, 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 corresponding to tup1 (for example, the initial storage state data) can be updated from the lock value (for example, the Boolean value is true) to the unlock value (for example, the Boolean value is false);
[0285] return tup1;
[0286] Wherein, the CAS operation includes three operands: tup1.lock, false, true. Wherein, tup1.lock represents the old version (for example, tup1) of the tuple locked by the current transaction when the current transaction is executed. Wherein, false represents the original value preset before locking, that is, before the old version (for example, tup1) is locked, the field value of the atomic lock field read at the preset position in the version data structure of the old version, and true represents the new value preset after locking, that is, after the old version (for example, tup1) is locked, the field value of the atomic lock field at the preset position in the version data structure of the old version needs to be updated from the original value to the new value. In an embodiment of the present application, when and 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 (for example, 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 achieve locking of the tuple version, otherwise no operation is performed. This mechanism can ensure the atomicity of operations, thereby avoiding data competition and transaction conflicts when different transactions are executed concurrently by different threads in a multi-threaded environment.
[0287] It should be understood that when reading the tuple version of a tuple (assuming there are two versions, and one of the versions is an invalid version with wts of 0), the embodiment of the present application will directly ignore the reading of the invalid version of the tuple, so as to avoid the waste of data reading resources. In addition, when updating a tuple, the embodiment of the present application will give priority to locking the invalid version as a modifiable version, so that when the tuple is updated and written, the content 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 the tuple update, thereby avoiding excessive space fragmentation in the NVM space through space reuse.
[0288] It can be seen from this that the embodiment of the present application can, when the data processing request is a write request, based on the to-be-matched index identifier of the indexed tuple to be processed carried in the write request, make full use of the byte addressing capability of the non-volatile storage space during the execution of the first transaction, and quickly search the index file for a target index identifier that matches the tuple identifier of the current index (i.e., the to-be-matched index identifier). Further, when a target index identifier that matches the tuple identifier of the current index (i.e., the to-be-matched index identifier) is found, it can be quickly determined that a target tuple corresponding to the target index identifier exists in the tuple heap deployed in the NVM space. Further, the embodiment of the present application can quickly index the two versions or a single version (i.e., the above-mentioned initial storage state) in the cyclic dual version based on the storage address offset corresponding to the target index identifier in the index file (for example, the version offset of the above-mentioned tup1), and then determine whether there is a valid version (i.e., the above-mentioned target storage state) through the relationship between the storage timestamps in the two versions or a single version (i.e., the above-mentioned initial storage state) in the cyclic dual version and the transaction start timestamp of the first transaction. Then, when there is a valid version (i.e., the above-mentioned target storage state), read the initial tuple data of the target tuple in the storage state data corresponding to the valid version (i.e., the above-mentioned target storage state) and the transaction details data of the first transaction to determine the target tuple data for writing the modifiable version (another version in the cyclic dual version except the valid version), and then implement the tuple update of the target tuple in the modifiable version through the determined target tuple data. This means that the embodiment of the present application can ensure the accuracy of version reading and the reliability of version modification by locking the modifiable version when multiple transactions are executed in parallel by determining the valid version and the modifiable version in the cyclic dual version.
[0289] Among them, in the NVM space, the concurrent control of storage and access is realized by cyclic dual versions, which requires the computer device 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 is used to determine the storage timestamp corresponding to the storage state of the tuple modified when executing the other transaction.
[0291] Proof: The read-write algorithm implemented by the above related program code can reach the snapshot isolation level. Here, the embodiment of the present application needs to additionally consider the read set of the currently executing transaction (i.e., the first transaction mentioned above), whether there is a read-write conflict with the committed transaction.
[0292] For further understanding, please refer to Fig.13 , Fig.13 1 is a schematic diagram of a scenario for conflict detection in a multi-transaction concurrent execution scenario provided by an embodiment of the present application. The multi-transactions here include the current transaction and other transactions that have been submitted before the current transaction. Fig.13 As shown, in the embodiment of the present application, after all transaction operations of the current transaction are executed, an end timestamp (i.e., transaction end timestamp, for example, T12) can be configured for the current transaction, and step S81 is further executed to determine whether all tuples in the read set of the current transaction have been accessed. If the judgment is yes, a normal transaction commit (i.e., Fig.13 Step S82 shown). On the contrary, if there are unaccessed tuples in the read set of the current transaction, it is necessary to execute step S83 to access the tuples in the read set, and further execute step S84 to determine whether the currently accessed tuple has been modified by other transactions. If it is determined to be yes, it is necessary to obtain the end timestamp of the other transaction that modified the tuple (that is, the above-mentioned transaction end timestamp, for example, T21), and then execute step S85 to determine whether the end timestamp of the other transaction is valid and between the start and end timestamps of the current transaction. That is, at this time, the computer device needs to determine whether the end timestamp of the other transaction is a transaction submitted when all tuples in the read set of the other transaction are accessed. If so, it is determined that the end timestamp configured for the other transaction (for example, T21) is valid. Therefore, when the end timestamp of the other transaction is between the start timestamp and end timestamp of the current transaction (that is, the start and end timestamps of the current transaction), the current transaction can be further aborted and the transaction can be rolled back (that is, Fig.13 On the contrary, if the end timestamp of other transactions is not between the start timestamp and the end timestamp of the current transaction, it can be confirmed that the tuple has been successfully accessed, so that the process can further jump to step S81 to repeatedly execute the business logic of determining whether all tuples in the read set of the current transaction have been accessed, until all tuples in the read set of the current transaction have been accessed, and then the current transaction can be committed normally.
[0293] It can be seen that the embodiment of the present application can further determine whether the tuples involved in the read set of the committed transaction have been modified by other transactions and whether the versions modified by other transactions have been committed after obtaining the transaction end timestamp of the current transaction. If the transaction end timestamp of a committed transaction is larger than the transaction start timestamp of the current transaction but smaller than the end timestamp of the current transaction, and this tuple is modified, the current transaction will be aborted to ensure that the transactions are serialized and executed in the order of the end timestamps of each transaction. This is because there is a committed transaction that modifies the data item after the read operation of the current transaction and has been committed before the current transaction is committed, which violates the serializability requirement.
[0294] In addition, the embodiment of the present application also verifies the feasibility and accuracy of the alternate updating of tuples through multiple storage states of the same tuple (for example, cyclic dual versions) provided by the embodiment of the present application through experimental settings.
[0295] For example, the computer device used for the experiment in the embodiment of the present application 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, 128GB (4x32GB) DRAM and 1TB (4x256GB) NVM are deployed in the data access system of the computer device. For example, the NVM here can be specifically Intel Optane DC Persistent Memory nvdimm (PMem, which is essentially a persistent data storage device) based on 3DXPoint.
[0297] During the experiment, the embodiment of the present application proposed that PMem can be configured 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 at the virtual address to access data.
[0298] Among them, the experimental equipment involved in the embodiment of the present application (i.e., the above-mentioned computer equipment) can specifically be Ubuntu 20.04.6 LTS and 5.4.0-169-generic Linux kernel. We install the file system to NVM in fs-dax mode, and then use libPMem (a database function interface) in PMDK to map the NVM file (the NVM file here includes but is not limited to the above-mentioned business table) to the virtual memory of the process, and use clwb and sfense to persist the data to NVM. All codes are written in C / C++ and compiled using gcc version 9.4.0. For ease of testing, the embodiment of the present application runs experiments on a single CPU socket and its associated NVM and DRAM. Among them, a single CPU socket can use 1TB of NVM and 128GB of DRAM.
[0299] In the implementation process, the embodiment of the present application uses YCSB and TPCC to evaluate the performance of the AKV storage engine deployed for the NVM space. Among them, YCSB is a widely used key-value workload, representing the transactions processed by the network company. In the experiment, the YCSB database consists of a table (i.e., the above-mentioned business table). For each tuple in the business table, an 8B primary key and ten 100-byte random string data columns may be included. Among them, the size of each tuple is approximately 1KB. Among them, each YCSB transaction can be composed of 16 random requests by default. Therefore, the embodiment of the present application can give a primary key (i.e., the to-be-matched index identifier of the above-mentioned tuple to be processed) for a certain YCSB transaction (i.e., the above-mentioned first transaction) in these random requests, and then the retrieved tuple can be read when the request (i.e., the above-mentioned data processing request) is a read request, and the retrieved tuple can be modified when the request (i.e., the above-mentioned 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 the Zipfian distribution (i.e., a long-tail distribution): uniform (θ=0) and Zipfian (θ=0.9). Uniform has no request locality, while Zipfian is used to simulate the situation of high transaction conflicts.
[0300] Among them, the 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 and designs 9 tables and 5 transaction types for comprehensive performance evaluation. Among them, these five transactions can specifically include the two most common header transaction types, NewOrder (order transaction type) and Payment (i.e., payment transaction type), and these two header transaction types account for 45% and 43% of all transaction types respectively, considering that these two short read and write transactions together constitute 88% of the TPC-C workload. Therefore, these two transaction types will be mainly considered in the experiment. At the same time, TPC-C allows users to adjust the number of warehouses according to their needs. By configuring different numbers of warehouses, different levels of competition can be simulated, thereby evaluating the performance of the system under different loads and pressures. In this experiment, the embodiment of the present application uses 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 can be configured for medium contention scenarios, and a single warehouse can be configured for high contention scenarios.
[0301] For further understanding, please refer to Fig.14 , Fig.14 The embodiment of the present application changes the request ratio and distribution in the YCSB benchmark test to evaluate the throughput of different data access systems. Among them, YCSB (Yahoo! Cloud Serving Benchmark) is a widely used database performance benchmark tool that can be used to evaluate the performance of different data access systems under corresponding loads. Fig.14 As shown, these data access systems may include from left to right Fig.14 The Zen_OCC system, Zen_MVCC system, NVCaracal system, Falcon system, Falcon (DRAM) system, AKV system, and AKV (DRAM) system are shown. For all target storage engines in these systems, there are two observations: (1) As the write ratio increases, the transaction throughput tends to decrease, 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 impact 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 conflicts lead to increased transaction throughput. This is because more intensive transaction accesses cause the CPU cache to store the data to be accessed, thereby improving throughput. However, in the case of write-intensive, high transaction conflicts lead to a decrease in transaction throughput. This is because the increase in write conflicts leads to more transaction rollbacks, thereby reducing throughput.
[0302] For Zen systems (e.g. Fig.14 The Zen_OCC system and Zen_MVCC system shown in the figure show that when the write ratio is high, especially for the Zipfian distribution, the throughput of Zen_MVCC is significantly reduced compared to Zen_OCC. Among them, by performing performance analysis on the Zen_MVCC system deployed on a computer device, it is found that there are two main reasons for the low throughput: (1) In order to ensure the correctness of the transaction, subsequent read and write operations must wait for the write operations of the conflicting transactions to complete. (2) As the number of write versions increases, not only does the garbage collection overhead increase, but read operations also require more time to identify the appropriate tuple version because there are too many versions. For uniform distribution, the impact of Zen_MVCC is not significant because there are fewer conflicting operations between transactions. However, for the Zipfian distribution, the increase in conflicting operations makes the above two situations more obvious.
[0303] As the NVCaracal system does not support read-only transactions, we conducted an approximate test after making minor modifications to its code. During this experiment, we measured the time overhead of the NVCaracal system and found that the time of the initialization phase was comparable to the time 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 used a single request as the transaction mode in the YCSB test. However, in order to fully evaluate its performance, each transaction was configured to contain 16 requests in the experiment. This experiment not only tested the Falcon version that fully used NVM, but also tested the version that used DRAM indexing. The results show that in most cases, the Falcon version using DRAM indexing significantly outperforms Zen and NVCaracal. The reason is that it uses 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 AKV 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, AKV of NVM-Only architecture has higher throughput than other storage engines. One reason is that under the NVM-Only architecture, the AKV storage engine uses multi-version concurrency control (e.g., dual-version concurrency control), which can ensure a serializable snapshot isolation level while maximizing the system's read performance. Therefore, the AKV system using the AKV storage engine performs best in read-intensive situations.
[0306] For further information, see Fig.15 , Fig.15 1 is a transaction abort statistics chart under different read-write ratios provided by the embodiment of the present application. Fig.15 As shown, for multiple data access systems (Zen_OCC system, Zen_MVCC system, Falcon system and AKV system) from left to right, in the case of intensive writes, the AKV system will generate a large number of transaction rollbacks. In this case, the embodiment of the present application proposes that a circular dual-version storage method can be used to reduce the cost of transaction rollback by fixing the storage location of tuples (for example, alternately updating the tuple data of the tuple to the old version of the circular dual version).
[0307] For further information, see Fig.16 , Fig.16 1 is a transaction abort delay statistics diagram provided by the embodiment of the present application. Fig.16 As shown, for multiple data access systems (Zen_OCC system, Zen_MVCC system and AKV system) from left to right, the rollback delay of the AKV system is less than one-third of that of the Zen OCC system. Similar to the Falcon system, by fixing the location of tuples and directly accessing data on NVM, the AKV system reduces the overhead of index updates and data replication between different storage media. Without considering the DRAM index, the AKV system achieved a performance improvement of 12.5% and 14.5% in read-only and read-intensive cases, respectively, while ensuring that data is not lost in the event of a power outage. In addition, although the performance of the above-mentioned AKV using DRAM indexing is improved over that of the AKV with NVM-Only architecture, the DRAM index needs to be rebuilt during recovery, which conflicts with the design goal of maintaining an agile architecture. Therefore, an embodiment of the present application proposes an AKV system using an NVM-Only architecture.
[0308] For further information, see Fig.17 , Fig.17 This is a statistical chart showing the scalability of YCSB provided in the embodiment of the present application. Fig.17 As shown in Figure 1, this experiment studies the scalability of the Zen system, the Falcon system, and the AKV system. For example, balanced and unified requests are used in the experiment. Fig.17 As shown in the figure, when the number of threads is less than 16, all three storage engines show good scalability. However, as the number of threads continues to increase, their throughput has not increased, but has decreased. The main reason is that due to the limitation of the number of CPU cores, a maximum of 16 threads can be executed in parallel, and further increasing the number of threads will only lead to resource conflicts. Therefore, the embodiment of the present application proposes that 16 threads can be optimally configured in a computer device deployed with AKV.
[0309] For further information, see Fig.18 , Fig.18 The test results of the transaction throughput of the NVCaracal system, Falcon system and AKV system under the TPC-C workload are given in the embodiments of the present application. Among them, the TPC-C workload refers to the load under the corresponding contention scenario of the TPC-C benchmark test (i.e., another benchmark test tool). For example, 16 threads were used in this test. Among them, Falcon (i.e., the Falcon system) uses OCC as the concurrency control strategy, and only uses NVM, and does not enable DRAM to store data. Overall, AKV (i.e., the AKV system) performs the best. For example, Fig.18 As shown in the figure, under low contention, AKV's throughput is 13% higher than Falcon and 126% higher than NVCaracal. Under medium contention, Falcon's throughput begins to decline, while the throughput of AKV and NVCaracal (i.e., NVCaracal system) remains basically stable.
[0310] For further information, see Fig.19 , Fig.19 A statistical diagram of the number of transaction aborts under different contention conditions is given. Fig.19 It can be seen that the performance degradation of Falcon is mainly due to a large number of transaction aborts. Although the number of aborts of AKV under medium contention increases compared to low contention, the impact on throughput is not significant due to its lower abort latency and much fewer aborts than Falcon.
[0311] like Fig.19 As shown in the figure, under high contention, AKV outperforms Falcon by 380% and is roughly on par with NVCaracal. Fig.19 As can be seen, the number of aborts for Falcon and AKV has increased significantly. Fig.18There is a continued decline in the throughput of both. It is worth noting that NVCaracal's performance is almost the same under the two contention conditions. This is mainly because it has determined the execution order of transactions in the initialization phase, so the performance will not fluctuate due to changes in contention. This is consistent with the analysis results of YCSB. In addition, Falcon performs well under low contention conditions, but its performance drops significantly under high contention conditions. This is mainly because it has a large number of aborts and a large abort overhead.
[0312] For further information, see Fig. 20 , Fig. 20 This is a statistical diagram for demonstrating TPC-C scalability provided by the embodiment of the present application. Fig. 20 As shown in Figure 2, this experiment tested the TPC-C scalability of AKV and used Falcon as a comparison reference. Fig.19 As shown in the figure, the experimental results show that AKV exhibits good scalability before 16 threads, but the throughput begins to decline after more than 16 threads. This trend is similar to the results in the YCSB benchmark. This is due to the limitation of the number of CPU cores: the CPU only supports 16 threads in parallel. Threads exceeding this number cannot be executed in parallel, but will increase resource contention and cause more transaction aborts.
[0313] For further information, see Fig.21 , Fig.21 This is the impact of different version numbers and different space allocation schemes provided in the embodiments of the present application on the YCSB throughput. Fig.21 As shown, in the process of using the AKV storage engine for storage and solution, the embodiment of the present application discusses the space allocation solution of the AKV system and the number of versions used for concurrency control. The experimental results are as follows Fig.21 shown.
[0314] Among them, Fig.21 As shown in the figure, the space allocation method used by the DVCC(naive) scheme and the DVCC scheme is different when using cyclic dual versions 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 do not need to reallocate space when updating the tuple; while the DVCC scheme clearly states that only one version space can be allocated when a tuple is first inserted, and another new version space can be allocated when the tuple is updated later. Fig.21 The TVCC scheme shown configures the versions used for tuple version number control to be three versions, while the QVCC scheme configures the versions used for tuple version control to be four versions.
[0315] like Fig.21 As shown in the figure, through experimental data, it can be observed that the DVCC (naive) scheme has the highest throughput when the write ratio is high. The following two points are mainly considered: since it pre-allocates tuple space, it does not need to reallocate space when the tuple is updated; at the same time, because the two tuple versions are version-linked, there is a certain degree of spatial locality. Compared with the DVCC (naive) scheme, the DVCC scheme that optimizes space allocation occupies less NVM space. When the read ratio is higher, the DVCC scheme performs better. This is because in most cases, only one tuple version needs to be accessed, and there is no need to access both versions at once like the DVCC (naive) scheme to determine the tuple version to be accessed.
[0316] like Fig.21 As shown in Figure 2, the number of versions does not have a significant impact on throughput. However, Fig.21 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 some cases where there are many read requests and intensive access, the increase in the number of versions will reduce the number of interruptions due to read version failure. However, in the case of a lot of writes, the additional versions do not bring any gains, but instead lead to a decrease in throughput. Based on this, the present application proposes that when using a cyclic 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] For further information, see Fig. 22 , Fig. 22 1 is a schematic diagram of a data processing device based on a non-volatile storage space provided in an embodiment of the present application. The data processing device based on a non-volatile storage space 1 can be run on a computer device, and the computer device here can be the above-mentioned Figure 2 The storage space of the computer device includes a non-volatile storage space, wherein the non-volatile storage space includes a plurality of tuples, and the plurality of tuples are configured to be indexed by index identifiers pre-stored in the non-volatile storage space. Fig. 22 As shown, the data processing device 1 based on non-volatile storage space may include: a request acquisition module 11, an index identification search module 12, a storage state set determination module 13, a timestamp acquisition module 14 and an operation execution module 15.
[0318] A request acquisition module 11 is used to acquire a data processing request, where the data processing request carries an index identifier to be matched and one or more data processing instructions;
[0319] An index identifier search module 12 is used to search for a target index identifier that matches the index identifier to be matched in the non-volatile storage space;
[0320] The index identifier search module 12 is further used to determine, in response to finding the target index identifier, an index storage address and a storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space, wherein the storage address offset is an offset between the index storage address and a tuple storage address of the target tuple corresponding to the target index identifier;
[0321] A storage state set determining module 13, configured to determine a tuple storage address by using a storage address offset and an index storage address, so as to determine a storage state set of a target tuple, wherein the storage state set includes at least one storage state;
[0322] A timestamp acquisition module 14, configured to acquire storage timestamps corresponding to the multiple storage states and an instruction timestamp corresponding to the data processing instruction if the storage state set includes multiple storage states;
[0323] The operation execution module 15 is used to determine the target storage state corresponding to the target tuple in multiple storage states based on the storage timestamps corresponding to the multiple storage states and the instruction timestamps corresponding to the data processing instructions, and execute the instruction operation indicated by the data processing instruction on the target tuple in the target storage state.
[0324] The specific implementation of the request acquisition module 11, the index identification search module 12, the storage state set determination module 13, the timestamp acquisition module 14 and the operation execution module 15 can be found in the above Figure 3 The description of step S101 to step S106 in the corresponding embodiment will not be repeated here.
[0325] The non-volatile storage space is deployed with an index file for indexing 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 the first thread in the thread pool corresponding to the non-volatile storage space;
[0326] The index identification search module 12 is specifically used for:
[0327] When starting a first transaction corresponding to the first transaction information through the first thread, configuring a transaction start timestamp for the first transaction, and when executing the first transaction based on the transaction start timestamp, configuring a transaction state of the first transaction as a transaction execution state;
[0328] In the transaction execution state, the target index identifier that matches the to-be-matched index identifier is searched through the index file.
[0329] The non-volatile storage space is deployed with a tuple stack for storing multiple tuples, and the index file includes multiple index sets, which are sets of index identifiers for pre-storing each tuple determined after identifier mapping of the index identifiers of each tuple in the tuple stack;
[0330] The index identification search module 12 is specifically used for:
[0331] In the transaction execution state, the to-be-matched index identifier is mapped, and among the multiple index sets, the index set used for mapping the to-be-matched index identifier is determined as the target index set;
[0332] Search the target index set for a target index identifier that matches the index identifier to be matched.
[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 identification search module 12 is specifically used for:
[0335] When it is determined based on the transaction execution state that the first transaction is being executed, obtaining the index file through the index file address in the directory file;
[0336] Obtain multiple index sets for hash indexing from the index file; one index set corresponds to one set identifier;
[0337] Perform hash calculation on the to-be-matched index identifier to obtain the index hash value of the to-be-matched index identifier, perform remainder calculation on the number of sets of multiple index sets through the index hash value to obtain the remainder of the index hash value;
[0338] Among the multiple set identifiers corresponding to the multiple index sets, a set identifier that matches the remainder of the index hash value is searched, and the index set corresponding to the found set identifier is determined as the target index set for mapping the index identifier to be matched.
[0339] The table where the tuple heap is located is a business table, and the directory file also stores the table address of the business table where the tuple heap is located;
[0340] The device 1 is also used for:
[0341] Create an index file whose initial index address is the index file address, configure multiple initial sets in the index file, and establish an address mapping relationship between the table address and the index file address, when obtaining the business table through the table address in the directory file, obtain the tuple stack in the business table, and obtain the tuple to be mapped for identity mapping from the multiple tuples contained in the tuple stack, and determine the tuple identifier of the tuple to be mapped as the tuple identifier to be mapped;
[0342] 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 multiple initial sets in the index file are obtained;
[0343] Performing identity mapping on the tuple identity to be mapped, and storing the tuple identity mapping to be mapped to a target initial set in a plurality of initial sets according to the identity mapping result;
[0344] After the tuple identifier of each tuple in the tuple heap is selected as the tuple identifier to be mapped for identifier mapping, it is confirmed that the mapping and storage of each tuple identifier in the tuple heap to multiple initial sets are completed, and the multiple initial sets that have completed the mapping and storage are used as multiple index sets, and the target index address is the index file address of the index file where the multiple index sets are located and is updated and stored in the directory file; the tuple identifiers mapped and stored in the multiple index sets are index identifiers used for indexing.
[0345] Wherein, the device 1 is specifically used for:
[0346] Perform hash calculation on the tuple identifier to be mapped to obtain a hash value of the index to be mapped of the tuple identifier to be mapped;
[0347] The remainder of the hash value of the index to be mapped is obtained by performing a remainder calculation on the number of sets of multiple initial sets through the hash value of the index to be mapped;
[0348] Among multiple initial sets, find the initial set corresponding to the set identifier that is consistent with the remainder of the hash value of the index to be mapped, use the found initial set as the target initial set, and determine the target initial set as the identifier mapping result obtained after the identifier of the tuple to be mapped is mapped;
[0349] According to the identifier mapping result, the index item corresponding to the tuple identifier to be mapped is added and stored in the target initial set; the index item corresponding to the tuple identifier to be mapped is used to store a key-value pair with the tuple identifier to be mapped as the key and the initial storage address offset corresponding to the initial storage state of the tuple to be mapped as the value; the initial storage state of the tuple to be mapped refers to the storage state for storing the tuple to be mapped that is first constructed when the tuple to be mapped is inserted into the tuple heap.
[0350] Optionally, the 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 not finding the target index identifier, determining that there is no target tuple in the multiple tuples that matches the tuple to be processed corresponding to the index identifier to be matched, and when the transaction state of the first transaction corresponding to the first transaction information is the transaction execution state, rolling back the first transaction.
[0353] Optionally, the device 1 is further used for:
[0354] In response to not finding the target index identifier, detecting an insert operation for inserting a tuple among the instruction operations indicated by the one or more data processing instructions;
[0355] In response to the detected insert operation, a first tuple storage space is configured in the non-volatile storage space for the tuple to be processed corresponding to the to-be-matched index identifier, an initial storage state of the tuple to be processed is created in the first tuple storage space, and tuple data of the tuple to be processed is written into the initial storage state data corresponding to the initial storage state; or,
[0356] In response to the undetected insert operation, execution of the first transaction is aborted.
[0357] The multiple data processing instructions include a first data processing instruction and a second data processing instruction; the first transaction includes a first subtransaction corresponding to the first data processing instruction and a second subtransaction corresponding to the second data processing instruction; the tuple corresponding to the first subtransaction is a tuple to be processed; the tuple corresponding to the second subtransaction is an associated processing tuple; and the associated processing tuple is a tuple in a tuple pile;
[0358] When the device 1 is used to execute the step of rolling back the first transaction when the transaction state of the first transaction corresponding to the first transaction information is the transaction execution state, it is specifically used to:
[0359] When the transaction status of the first transaction corresponding to the first transaction information is the transaction execution status, if the second subtransaction is an executed transaction when the first subtransaction is executed, then in the process of rolling back the transaction of the first transaction, the execution of the first subtransaction is terminated, and the transaction modification operation performed on the second subtransaction is undone; the transaction modification operation includes a write operation and / or a delete operation on the tuple version of the associated processing tuple read by the second subtransaction.
[0360] After the device 1 cancels the transaction modification operation performed on the second sub-transaction, the device 1 is further used 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 the reclaimed space; the associated tuple storage address added in the reclaimed space is used to perform space reuse on the tuple storage space corresponding to the associated tuple storage address when space configuration is performed through the tuple manager.
[0362] Among them, the tuple storage address of the target tuple is the storage address of the initial storage state of the target tuple, the initial storage state is a storage state among multiple storage states, the index file deployed in the non-volatile storage space includes a target index set for mapping the storage target index identifier, and in the target index item corresponding to the target index identifier pre-stored in the target index set, a target key-value pair is stored with the target index identifier as the key and the initial storage address offset in the initial storage state data corresponding to the initial storage state as the value; the initial storage address offset refers to the offset between the 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 the storage state 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 the index storage address corresponding to the target index identifier;
[0363] When the index identifier search module 12 performs the step of determining the index storage address and 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, it is specifically used to:
[0364] In response to finding the target index identifier, obtaining a target index item corresponding to the target index identifier in the target index set of the index file, and obtaining a target key-value pair from the target index item;
[0365] Determine the initial storage address offset obtained from the target key-value pair as the storage address offset corresponding to the target index identifier;
[0366] When the target index identifier is an index identifier in an index file, the index storage address corresponding to the target index identifier is determined by using 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 determination module 13 is specifically used for:
[0368] Determine the storage address of the initial storage state of the target tuple through the storage address offset and the index storage address, and access the initial storage state data corresponding to the initial storage state of the target tuple through the storage address of the initial storage state of the target tuple; the initial storage state data includes at least 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 the initial storage address offset that is consistent with the storage address offset, then find an updated storage address offset that has a first index relationship with the initial storage address offset; the updated storage address offset refers to the offset between the index file address of the index file and the storage address of the updated storage state of the target tuple; the updated storage state is the next storage state of the initial storage state;
[0370] In response to finding the update storage address offset, determining the storage address of the update storage state of the target tuple by updating the storage address offset and the index file address, and acquiring the update storage state having a first state link relationship with the initial storage state by the storage address of the update storage state of the target tuple;
[0371] Find the target storage address offset that has a second index relationship with the updated storage address offset. If the target storage address offset is the initial storage address offset, determine that the storage state that has a second state link relationship with the updated storage state is the initial storage state. Through the first state link relationship and the second state link relationship, determine the first state set for cyclically storing the target tuple composed of the initial storage state and the updated storage state as the storage state set of the target tuple.
[0372] Optionally, the storage state set determining module 13 is further used for:
[0373] 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 multiple tuples are located, and the next storage state of the initial storage state of the target tuple does not exist;
[0374] 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.
[0375] Optionally, the one or more data processing instructions are instructions in the first transaction information carried in the data processing request, and when the request type of the data processing request includes a read type, the one or more data processing instructions include a read instruction corresponding to the read type;
[0376] The device 1 is also used for:
[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, then according to the read type, 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; wherein the initial storage state of the target tuple refers to the storage state of the tuple data first used to store the target tuple before forming a plurality of storage states, and the field value of the storage time field of the initial storage state of the target tuple is the initial storage timestamp;
[0378] Obtaining a transaction start timestamp of a first transaction corresponding to the first transaction information, and determining the transaction start timestamp as an instruction start timestamp corresponding to the read instruction;
[0379] Compare the initial storage timestamp 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, then according to the read type, 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; 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 when the request type of the data processing request includes a write type, the one or more data processing instructions include a write instruction corresponding to the write type;
[0383] The device 1 is also used for:
[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, then a second tuple storage space is configured for the target tuple in the non-volatile storage space based on the write type, and the next storage state of the initial storage state of the target tuple is created in the second tuple storage space, and 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 updated storage state of the target tuple, the storage state data corresponding to the updated storage state of the target tuple is determined as the updated storage state data; the second tuple storage space is used to store the second storage address of the updated 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] When the initial storage state data corresponding to the initial storage state is read through the first storage address in the first tuple storage space, the initial tuple data of the target tuple is read from the initial storage state data corresponding to the initial storage state, and 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, the target tuple data for writing into the updated storage state data corresponding to the updated storage state is determined;
[0386] When adding the updated storage state of the target tuple to the tuple heap where the plurality of tuples are located, in the updated storage state data corresponding to the updated storage state, configuring the field value of the tuple data field of the target tuple as the target tuple data of the target tuple;
[0387] A first state link relationship between an initial storage state and an updated storage state is established; the first state link relationship refers to a relationship used to describe a field value of an address offset field in the updated storage state data corresponding to the updated storage state, pointing 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 updated storage state data corresponding to the updated storage state is an updated storage address offset, the updated storage address offset is an offset having a first index relationship with the storage address offset, the updated storage address offset is determined by the offset between the second storage address of the updated storage state and the index storage address of the index file in the non-volatile storage space, and the storage address offset is determined by the initial storage address offset between the first storage address of the initial storage state and the index storage address of the index file.
[0388] The fields in the update storage state data corresponding to the update storage state include a tuple data field and an atomic lock field; wherein 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;
[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 updated storage state data corresponding to the updated storage state, the field value of the atomic lock field is configured as a lock value used to characterize the locked updated storage state, and based on the write operation indicated by the lock value authorization write instruction, 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 performs the write operation indicated by the lock value-based authorization write instruction and configures the field value of the tuple data field as the target tuple data of the target tuple, the device 1 is further configured to:
[0392] In the updated storage state data corresponding to the updated storage state, the field value of the atomic lock field is updated from the lock value configuration to the unlock value used to unlock the updated storage state; the unlock value is used to indicate that when the read operation and / or write operation indicated by the second transaction is executed, the target tuple data can be accessed and read for the second transaction in the updated storage state data corresponding to the updated storage state; the second transaction is a transaction other than the first transaction.
[0393] The fields in the updated storage state data corresponding to the updated storage state include a storage time field. When executing the first transaction, the field value of the storage time field is a preset time threshold for characterizing that the first transaction is in a transaction execution state. The non-volatile storage space includes a transaction commit log list for recording committed transactions.
[0394] The device 1 is also used for:
[0395] When it is detected that the instruction operation indicated by each of the one or more data processing instructions has been executed, obtaining a transaction end timestamp for indicating that the first transaction has been executed;
[0396] In the updated storage status data corresponding to the updated storage status, the field value of the storage time field is updated from a preset time threshold to a transaction end timestamp, and the first transaction identifier of the first transaction is submitted to the transaction submission log list, and by submitting the first transaction identifier to the transaction submission log list, it is determined that the first transaction is a committed transaction; the storage timestamp corresponding to the updated storage status is the transaction end timestamp.
[0397] Wherein, 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;
[0398] After the device 1 executes and submits the first transaction identifier of the first transaction to the transaction submission log list, the device 1 is further used to:
[0399] The field value of the address offset field in the initial storage state data corresponding to the initial storage state is updated and configured 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 there is a first state link relationship between the initial storage state and the updated storage state, and the updated storage state is the next version of the initial storage state, a second state link relationship between the initial storage state and the updated storage state is established, and the second state link relationship refers to a relationship for describing the field value of the address offset field in the initial storage state data corresponding to the initial storage state, pointing to the field value of the address offset field in the updated storage state data corresponding to the updated storage state;
[0401] Through the first state link relationship, the second state link relationship, the initial storage state and the updated storage state, a first state set for cyclically storing tuple data of the target tuple is constructed; the first state set is one of the storage state sets of the target tuple.
[0402] Among them, the storage timestamps corresponding to the multiple storage states respectively include 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 refers to the 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 the initial tuple data, and the tuple data of the target tuple in the updated storage state data corresponding to the updated storage state is the target tuple data;
[0403] The operation execution module 15 is specifically used for:
[0404] If the first storage timestamp is a preset first time threshold, when the initial storage state is determined to be an invalid storage state, the second storage timestamp is compared with the transaction start timestamp to obtain a second comparison result;
[0405] If the second comparison result indicates that the second storage timestamp is less than or equal to the transaction start timestamp, determining the updated storage state as the target storage state;
[0406] If the request type of the data processing request is a read type, then in the target storage state, when a read operation indicated by the read 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; or,
[0407] If the request type of the data processing request is a write type, then 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 updated storage state data corresponding to the updated storage state, and the initial tuple data in the initial storage state data corresponding to the invalid initial storage state is updated through the read target tuple data and the transaction detail data indicated by the first transaction.
[0408] Optionally, the storage timestamps corresponding to the multiple storage states respectively include 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 refers to the 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 the initial tuple data, and the tuple data of the target tuple in the updated storage state data corresponding to the updated storage state is the target tuple data;
[0409] The operation execution module 15 is specifically used for:
[0410] When the first storage timestamp is not the preset first time threshold, comparing the first storage timestamp with the transaction start timestamp, and comparing the second storage timestamp with the transaction start timestamp 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, 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;
[0412] If the fourth comparison result indicates that the second storage timestamp is greater than the first storage timestamp, determining the initial storage state to be a storage state in a locked state, and determining the updated storage state to be 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 using the read target tuple data and the transaction detail data indicated by the first transaction.
[0414] It can be seen that the embodiment of the present application can realize the separate storage of tuple data and index identifiers of tuples by deploying an index file for identification indexing and a tuple heap for tuple storage in a non-volatile storage space. In this way, when identification indexing is performed through an index file storing a large number of index identifiers, there is no need to fully scan the entire business table where the tuple heap storing a large amount of tuple data is located. This can avoid directly searching the entire table of the business table where the tuple heap is located from the source. This means that the embodiment of the present application can quickly read the index storage address of the index file stored in the directory file (in the index file) and quickly locate and find the target index identifier that matches the tuple identifier of the current index (i.e., the index identifier to be matched) by means of the identification index. In addition, the embodiment of the present application can determine the valid version from the two versions in the cyclic dual version through the relationship between the storage timestamps of the two versions in the cyclic dual version (for example, the initial storage state storage timestamp corresponding to the initial storage state and the updated storage state storage timestamp corresponding to the updated storage state) and the transaction start timestamp of the currently executed transaction (i.e., the first transaction), and then the reliability of subsequent operation execution and the consistency of data reading can be ensured through the valid version (i.e., the above-mentioned target storage state). Therefore, when the instruction operation indicated by the data processing instruction is executed on the target tuple in the target storage state, not only the efficiency of operation execution can be improved, but also the accuracy of operation execution can be ensured.
[0415] For further information, see Fig.23 , Fig.23 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.23 As shown, the computer device 1000 may be a user terminal, for example, Figure 1 The user terminal 200a in the corresponding embodiment may also be a server, for example, Figure 1The server 100a in the corresponding embodiment will not be limited here. For ease of understanding, this application takes the computer device as an example of a server. The computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a non-volatile memory (non-volatile memory), for example, it may be a phase change memory (PCM), a variable resistance memory (ReRAM) and a spin torque memory (STT-RAM). The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Fig.23 As shown, the memory 1005 as a computer-readable storage medium may 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 a network communication function. Fig.10 In the computer device 1000 shown in the figure, the network interface 1004 can provide a network communication function; 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 stored in the memory 1005 to execute the above Figure 3 , Fig. 9 or Fig.10 The description of the data processing method based on the non-volatile storage space in the corresponding embodiment can also be performed as described above. Fig. 22 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 the same method will not be repeated here either.
[0417] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the data processing device 1 based on the non-volatile storage space mentioned above, and the computer program includes computer instructions. When the processor executes the computer instructions, it can execute the above-mentioned Figure 3 , Fig. 9 or Fig.10The description of the data processing method based on non-volatile storage space in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, computer instructions can be deployed on a computer device for execution, or on multiple computer devices located at one location, or on multiple computer devices distributed at multiple locations and interconnected by a communication network. Multiple computer devices distributed at multiple locations and interconnected by a communication network can constitute a blockchain system.
[0418] In addition, it should be noted that: the embodiment of the present application also provides a computer program product or a computer program, which may include computer instructions, and the computer instructions may 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 may execute the computer instructions, so that the computer device executes the above Figure 3 , Fig. 9 or Fig.10 The description of the data processing method 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 the same method will not be repeated. For technical details not disclosed in the computer program product or computer program embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0419] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method based on non-volatile storage space, characterized in that: The non-volatile storage space includes a plurality of tuples, and the plurality of tuples are respectively configured to be indexable by index identifiers pre-stored in the non-volatile storage space, and the method includes: Obtaining a data processing request, wherein the data processing request carries an index identifier to be matched and one or more data processing instructions; Searching the non-volatile storage space for a target index identifier that matches the to-be-matched index identifier; 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, wherein the storage address offset is an offset between the index storage address and a tuple storage address of the target tuple corresponding to the target index identifier; 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, wherein the storage state set includes at least one storage state; If the storage state set includes multiple storage states, obtaining storage timestamps corresponding to the multiple storage states respectively and an instruction timestamp corresponding to the data processing instruction; Based on the storage timestamps corresponding to the multiple storage states and the instruction timestamps corresponding to the data processing instructions, a target storage state corresponding to the target tuple is determined among the multiple storage states, and under the target storage state, the instruction operation indicated by the data processing instruction is executed on the target tuple.
2. The method according to claim 1, characterized in that 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 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; The step of searching the non-volatile storage space for a target index identifier that matches the to-be-matched index identifier includes: When starting a first transaction corresponding to the first transaction information through the first thread, configuring a transaction start timestamp for the first transaction, and when executing the first transaction based on the transaction start timestamp, configuring a transaction state of the first transaction as a transaction execution state; In the transaction execution state, the target index identifier that matches the to-be-matched index identifier is searched through the index file.
3. The method according to claim 2, characterized in that The non-volatile storage space is deployed with a tuple stack for storing the plurality of tuples, the index file includes a plurality of index sets, the plurality of index sets are sets of index identifiers for pre-storing the respective tuples, which are determined after identifier mapping is performed on the index identifiers of the respective tuples in the tuple stack; The step of searching the index file for a target index identifier that matches the index identifier to be matched in the transaction execution state includes: In the transaction execution state, the to-be-matched index identifier is mapped, and among the multiple index sets, an index set used for mapping the to-be-matched index identifier is determined as a target index set; Search the target index set for a target index identifier that matches the to-be-matched index identifier.
4. The method according to claim 3, wherein the non-volatile storage space includes a directory file, and the directory file stores an index file address of the index file; The step of performing identifier mapping on the to-be-matched index identifier in the transaction execution state, and determining, among the multiple index sets, an index set used for mapping the to-be-matched index identifier as a target index set, includes: When it is determined based on the transaction execution state that the first transaction is being executed, obtaining the index file through the index file address in the directory file; Acquire multiple index sets for hash indexing from the index file; one index set corresponds to one set identifier; Performing a hash calculation on the to-be-matched index identifier to obtain an index hash value of the to-be-matched index identifier, and performing a remainder calculation on the number of sets of the multiple index sets using the index hash value to obtain a remainder of the index hash value; Among the multiple set identifiers corresponding to the multiple index sets, a set identifier that matches the remainder of the index hash value is searched, and the index set corresponding to the found set identifier is determined as the target index set for mapping the index identifier to be matched.
5. The method according to claim 3, characterized in that: The table where the tuple stack is located is a business table, and the directory file also stores the table address of the business table where the tuple stack is located; The method further comprises: Create an index file whose initial index address is the index file address, configure the multiple initial sets in the index file, and establish an address mapping relationship between the table address and the index file address, when the business table is obtained through the table address in the directory file, obtain the tuple stack in the business table, and obtain a tuple to be mapped for identifier mapping from the multiple tuples included in the tuple stack, and determine the tuple identifier of the tuple to be mapped as the tuple identifier to be mapped; 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 multiple initial sets in the index file are obtained; Performing identity mapping on the tuple identity to be mapped, and storing the tuple identity to be mapped in a target initial set among the multiple initial sets according to the identity mapping result; After the tuple identifier of each tuple in the tuple stack is selected as the tuple identifier to be mapped for identifier mapping, it is confirmed that the mapping and storage of each tuple identifier in the tuple stack to the multiple initial sets are completed, and the multiple initial sets that have completed the mapping and storage are used as the multiple index sets, and the target index address is the index file address of the index file where the multiple index sets are located and is updated and stored in the directory file; the tuple identifiers mapped and stored in the multiple index sets are index identifiers used for indexing.
6. The method according to claim 5, characterized in that The step of performing identity mapping on the tuple identity to be mapped, and storing the tuple identity to be mapped in a target initial set among the multiple initial sets according to the identity mapping result, includes: Performing hash calculation on the tuple identifier to be mapped to obtain a hash value of the index to be mapped of the tuple identifier to be mapped; Performing a remainder calculation on the number of sets of the multiple initial sets by using the hash value of the index to be mapped to obtain a remainder of the hash value of the index to be mapped; Among the multiple initial sets, search for the initial set corresponding to the set identifier that is consistent with the remainder of the hash value of the index to be mapped, use the found initial set as the target initial set, and determine the target initial set as the identifier mapping result obtained after identifier mapping is performed on the tuple identifier to be mapped; According to the identifier mapping result, the index item corresponding to the tuple identifier to be mapped is added and stored in the target initial set; the index item corresponding to the tuple identifier to be mapped is used to store a key-value pair with the tuple identifier to be mapped as the key and the initial storage address offset corresponding to the initial storage state of the tuple to be mapped as the value; the initial storage state of the tuple to be mapped refers to the storage state for storing the tuple to be mapped that is first constructed when the tuple to be mapped is inserted into the tuple heap.
7. The method according to claim 1, characterized in that One or more of the data processing instructions are instructions in the first transaction information carried in the data processing request; The method further comprises: In response to not finding the target index identifier, determining that there is no target tuple among the multiple tuples that matches the tuple to be processed corresponding to the index identifier to be matched, and when the transaction status of the first transaction corresponding to the first transaction information is a transaction execution status, rolling back the first transaction.
8. The method according to claim 7, characterized in that The method further comprises: In response to not finding the target index identifier, detecting an insert operation for inserting a tuple in the instruction operations 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 tuple to be processed corresponding to the to-be-matched index identifier, an initial storage state of the tuple to be processed is created in the first tuple storage space, and tuple data of the tuple to be processed is written into the initial storage state data corresponding to the initial storage state; or, In response to the insert operation not being detected, executing the first transaction is aborted.
9. The method according to claim 7, characterized in that: The multiple data processing instructions include a first data processing instruction and a second data processing instruction, the first transaction includes a first subtransaction corresponding to the first data processing instruction and a second subtransaction corresponding to the second data processing instruction; the tuple corresponding to the first subtransaction is the to-be-processed tuple; the tuple corresponding to the second subtransaction is an associated processing tuple; the associated processing tuple is a tuple in the tuple pile; When the transaction state of the first transaction corresponding to the first transaction information is a transaction execution state, rolling back the first transaction includes: When the transaction status of the first transaction corresponding to the first transaction information is the transaction execution status, if the second subtransaction is an executed transaction when the first subtransaction is executed, then in the process of rolling back the first transaction, the execution of the first subtransaction is terminated, and the transaction modification operation performed on the second subtransaction is undone; the transaction modification operation includes a write operation and / or a delete operation on the tuple version of the associated processing tuple read by the second subtransaction.
10. The method according to claim 9, characterized in that After undoing the transaction modification operation performed on the second subtransaction, the method further includes: 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 the reclaimed space; the associated tuple storage address added in the reclaimed space is used to perform space reuse on the tuple storage space corresponding to the associated tuple storage address when space configuration is performed through the tuple manager.
11. The method according to claim 1, characterized in that: The tuple storage address of the target tuple is the storage address of the initial storage state of the target tuple, the initial storage state is a storage state among the multiple storage states, the index file deployed in the non-volatile storage space includes a target index set for mapping and storing the target index identifier, and in the target index item corresponding to the target index identifier pre-stored in the target index set, a target key-value pair is stored with the target index identifier as the key and the initial storage address offset in the initial storage state data corresponding to the initial storage state as the value; the initial storage address offset refers to the offset between the 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 the storage state 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 the index storage address corresponding to the target index identifier; In response to finding the target index identifier, determining the index storage address and 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, obtaining the target index item corresponding to the target index identifier in the target index set of the index file, and obtaining the target key-value pair from the target index item; Determine the initial storage address offset obtained from the target key-value pair 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 storage address corresponding to the target index identifier is determined by the index file address of the index file pre-stored in the directory file of the non-volatile storage space.
12. The method according to claim 11, characterized in that The step of determining the tuple storage address by using the storage address offset and the index storage address to determine the storage state set of the target tuple includes: Determine the storage address of the initial storage state of the target tuple through the storage address offset and the index storage address, and access the initial storage state data corresponding to the initial storage state of the target tuple 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; 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 that is consistent with the storage address offset, then searching for an updated storage address offset having a first index relationship with the initial storage address offset; the updated storage address offset refers to an offset between an index file address of the index file and a storage address of an updated storage state of the target tuple; the updated storage state is a storage state next to the initial storage state; In response to finding the updated storage address offset, determining the storage address of the updated storage state of the target tuple through the updated storage address offset and the index file address, and acquiring the updated storage state having a first state link relationship with the initial storage state through the storage address of the updated storage state of the target tuple; Search for a target storage address offset having a second index relationship with the updated storage address offset; if the target storage address offset is the initial storage address offset, determine that the storage state having a second state link relationship with the updated storage state is the initial storage state; and through the first state link relationship and the second state link relationship, determine that a first state set for cyclically storing the target tuple, which is composed of the initial storage state and the updated storage state, is the storage state set of the target tuple.
13. The method according to claim 11, characterized in that The method further comprises: 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 multiple 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 according to claim 1 or 13, characterized in that: The one or more data processing instructions are instructions in the first transaction information carried in the data processing request, and when the request type of the data processing request includes a read type, the one or more data processing instructions include a read instruction corresponding to the read type; The method further comprises: 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, then according to the read type, 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; wherein the initial storage state of the target tuple refers to the storage state of the tuple data first used to store the target tuple before the multiple storage states are formed, and the field value of the storage time field of the initial storage state of the target tuple is the initial storage timestamp; Acquire a transaction start timestamp of a first transaction corresponding to the first transaction information, and determine the transaction start timestamp as an instruction start timestamp corresponding to the read instruction; Compare the initial storage timestamp 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, then according to the read type, read the tuple data of the target tuple from the initial storage state data corresponding to the initial storage state of the target tuple; or, If the first comparison result indicates that the initial storage timestamp is greater than the instruction start timestamp, the first transaction is rolled back.
15. The method according to claim 1 or 13, characterized in that: The one or more data processing instructions are instructions in the first transaction information carried in the data processing request, and when the request type of the data processing request includes a write type, the one or more data processing instructions include a write instruction corresponding to the write type; The method further comprises: 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, then based on the write type, a second tuple storage space is configured for the target tuple in the non-volatile storage space, and the next storage state of the initial storage state of the target tuple is created in the second tuple storage space, and 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 updated storage state of the target tuple, the storage state data corresponding to the updated storage state of the target tuple is determined as the updated storage state data; the second tuple storage space is used to store the second storage address of the updated 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; When the initial storage state data corresponding to the initial storage state is read through the first storage address in the first tuple storage space, the initial tuple data of the target tuple is read from the initial storage state data corresponding to the initial storage state, and 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, the target tuple data of the target tuple to be written into the updated storage state data corresponding to the updated storage state is determined; When adding the updated storage state of the target tuple to the tuple heap where the multiple tuples are located, in the updated storage state data corresponding to the updated storage state, the field value of the tuple data field of the target tuple is configured as the target tuple data of the target tuple; A first state link relationship between the initial storage state and the updated storage state is established; the first state link relationship refers to a relationship used to describe the field value of the address offset field in the updated storage state data corresponding to the updated storage state, pointing to the field value of the 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 updated storage state data corresponding to the updated storage state is an updated storage address offset, the updated storage address offset is an offset having a first index relationship with the storage address offset, the updated storage address offset is determined by the offset between the second storage address of the updated storage state and the index storage address of the index file in the non-volatile storage space, and the storage address offset is determined by the 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 according to claim 1, characterized in that The storage timestamps corresponding to the multiple storage states respectively include a first storage timestamp corresponding to the initial storage state and a second storage timestamp corresponding to the updated storage state; one or more of the data processing instructions are instructions in the first transaction information carried in the data processing request; The instruction timestamp refers to the transaction start timestamp configured 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 updated storage state data corresponding to the updated storage state is the target tuple data; The method of determining a target storage state corresponding to the target tuple from the multiple storage states based on the storage timestamps respectively corresponding to the multiple storage states and the instruction timestamp corresponding to the data processing instruction, and executing the instruction operation indicated by the data processing instruction on the target tuple under the target storage state, comprises: When the first storage timestamp is not a preset first time threshold, comparing the first storage timestamp with the transaction start timestamp, and comparing the second storage timestamp with the transaction start timestamp 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, determining the initial storage state to be a storage state in a locked state, and determining the updated storage state to be 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 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 through the read target tuple data and the transaction detail data indicated by the first transaction.
17. A data processing device based on a non-volatile storage space, characterized in that: The non-volatile storage space includes a plurality of tuples, and the plurality of tuples are respectively configured to be indexable by index identifiers pre-stored in the non-volatile storage space, and the device includes: A request acquisition module, used to acquire a data processing request, wherein the data processing request carries an index identifier to be matched and one or more data processing instructions; An index identifier search module, used to search the non-volatile storage space for a target index identifier that matches the index identifier to be matched; The index identifier search module is further used to determine, in response to finding the target index identifier, an index storage address and a storage address offset corresponding to the target index identifier pre-stored in the non-volatile storage space, wherein the storage address offset is an offset between the index storage address and a tuple storage address of the target tuple corresponding to the target index identifier; a storage state set determining module, configured to determine the tuple storage address by using the storage address offset and the index storage address, so as to determine a storage state set of the target tuple, wherein the storage state set includes at least one storage state; A timestamp acquisition module, configured to acquire storage timestamps corresponding to the multiple storage states respectively and an instruction timestamp corresponding to the data processing instruction if the storage state set includes multiple storage states; An operation execution module is used to determine a target storage state corresponding to the target tuple among the multiple storage states based on the storage timestamps corresponding to the multiple storage states and the instruction timestamps corresponding to the data processing instructions, and to execute the instruction operation indicated by the data processing instruction on the target tuple under the target storage state.
18. A computer device, characterized in that: including memory and processor; The memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1 to 16.
19. A computer-readable storage medium, characterized in that: 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 having the processor executes the method according to any one of claims 1 to 16.
20. A computer program product, characterized in that The method comprises a computer program / instruction, wherein 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 implements the method described in any one of claims 1 to 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
Efficient management of point in time copies of data in object storage
US20170083405A1
Transactional key-value store
US20170371912A1
Method, device, and computer program product for storage management
US20210117087A1
Cited By
File management method and electronic equipment
CN120540580A
File management method and electronic device
CN120540580B
Index tuple processing method and device of database system and computer equipment
CN121542270A