Transaction processing method, device, electronic device, and computer program for database system
The method enhances transaction processing efficiency in database systems by accurately identifying data anomalies through read-write set intersections and variable version changes, addressing limitations of existing methods.
Patent Information
- Application Number
- JP2023521163
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-05-19
- Filing Date
- 2022-04-20
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2042-04-20
AI Technical Summary
Existing data anomaly identification methods in database systems, such as locking techniques and dependency graph technology, limit parallelism and reduce transaction processing efficiency due to complex cycle detection and non-unified anomaly recognition.
A transaction processing method that determines parallel transactions through read-write operations on the same variable, identifies intersections between read and write sets, and determines data anomaly types based on variable version changes, ensuring accurate and comprehensive data anomaly detection.
Improves transaction processing efficiency by accurately identifying data anomalies and ensuring data integrity, reducing false rollbacks and enhancing parallel execution capabilities.
Smart Images

Figure 0007595758000009 
Figure 0007595758000010 
Figure 0007595758000011
Abstract
Description
[Technical field]
[0001] The present application relates to the technical field of databases, and to a transaction processing method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product for a database system.
[0002] This application is based on and claims priority to a Chinese patent application having application number 202110546080.0 and filing date May 19, 2021, the entire contents of which are hereby incorporated by reference into this application. [Background technology]
[0003] With the development of database technology, how to identify data anomalies in database systems has become an important issue. Currently, there are two methods for identifying data anomalies. One is to use locking technology to identify data anomalies through the locking mechanism. The other is to use dependency graph technology to check whether a cycle exists in a dependency graph constructed by parallel transactions, and if a cycle exists, it explains the existence of a data anomaly. However, the locking technology limits the parallelism of the database system, causing a decrease in transaction processing efficiency, and the dependency graph technology requires traversing each parallel transaction to identify the existence of a cycle, causing a relatively low transaction processing efficiency. Summary of the Invention [Means for solving the problem]
[0004] The embodiments of the present application provide a transaction processing method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product for a database system, which enable improvement of transaction processing efficiency of the database system.
[0005] An embodiment of the present application provides a transaction processing method for a database system, the method comprising: determining a parallel transaction of a target transaction, the parallel transaction and the target transaction including read and write operations that affect the same variable, the target transaction being a transaction that should be committed; obtaining a first intersection between the read set of the target transaction and the write sets of the parallel transactions, and obtaining a second intersection between the write set of the target transaction and the read sets of the parallel transactions; and when at least one of the first intersection set and the second intersection set is a non-empty data set and the target transaction conflicts with the parallel transaction, determining a data anomaly type based on a number of version change times of the same variable acted upon by the target transaction and the parallel transaction and a target variable list, the target variable list including the same variable acted upon by the target transaction and the parallel transaction.
[0006] An embodiment of the present application provides a transaction processing device, the device comprising: a first determination module arranged to determine a parallel transaction of a target transaction, the parallel transaction and the target transaction including read and write operations acting on the same variable, the target transaction being a transaction that should be committed; a second determination module configured to obtain a first intersection between the read set of the target transaction and the write set of the parallel transaction, and obtain a second intersection between the write set of the target transaction and the read set of the parallel transaction, and when at least one of the first intersection and the second intersection is a non-empty data set, and the target transaction conflicts with the parallel transaction, determine a data anomaly type based on a version change number of the same variable acted upon by the target transaction and the parallel transaction and a target variable list, wherein the target variable list includes the same variable acted upon by the target transaction and the parallel transaction.
[0007] An embodiment of the present application provides an electronic device, the electronic device including a processor and a memory, the memory being used to store at least one computer program, the at least one segment of the computer program realizing a transaction processing method of a database system provided by an embodiment of the present application when loaded and executed by the processor.
[0008] An embodiment of the present application provides a computer-readable storage medium having at least one computer program stored therein, the at least one computer program being capable of implementing a transaction processing method for a database system provided by an embodiment of the present application when loaded and executed by a processor.
[0009] An embodiment of the present application provides a computer program product, which includes computer programs or instructions that, when executed by a processor, implement a database system transaction processing method provided by an embodiment of the present application.
[0010] The beneficial effects of the technical solutions provided by the embodiments of the present application include at least the following: After determining the parallel transactions of the target transaction, if there exists a non-empty data set among the first intersection between the read set of the target transaction and the write set of the parallel transaction, and the second intersection between the write set of the target transaction and the read set of the parallel transaction, determine whether the target transaction conflicts with the parallel transaction, and if the target transaction conflicts with the parallel transaction, determine the data anomaly type according to the same variables acted upon by the two transactions and the number of version changes of the same variables. In this way, it is possible to check whether the target transaction constitutes a genuine conflict with the parallel transaction during the execution process of the target transaction, and also to determine the data anomaly type according to the same variables acted upon by the two transactions, thereby identifying various data anomalies in the database system and ensuring the consistency of the data state, thereby improving the transaction processing efficiency of the database system.
[0011] In order to more clearly describe the technical solutions in the embodiments of the present application, the following briefly introduces the drawings that need to be used in the description of the embodiments of the present application. It is obvious that the drawings in the following description are only some embodiments of the present application, and those skilled in the art can further obtain other drawings according to these drawings under the premise that no creative labor is required. [Brief description of the drawings]
[0012] [Figure 1] FIG. 1 is a schematic diagram of an implementation environment of a transaction processing method provided according to an embodiment of the present application. [Diagram 2] FIG. 2 is a schematic diagram of a conflict cycle graph provided according to an embodiment of the present application. [Diagram 3] FIG. 13 is a schematic diagram of another conflict cycle graph provided in accordance with an embodiment of the present application. [Figure 4] FIG. 13 is a schematic diagram of another conflict cycle graph provided in accordance with an embodiment of the present application. [Diagram 5] 2 is a flow chart of a transaction processing method provided in accordance with an embodiment of the present application. [Figure 6] 4 is a flowchart of another transaction processing method provided in accordance with an embodiment of the present application. [Figure 7] FIG. 2 is a schematic diagram of a single metadata anomaly CCG graph provided according to an embodiment of the present application; [Figure 8] FIG. 2 is a schematic diagram of a double metadata anomaly CCG graph provided according to an embodiment of the present application; [Figure 9] FIG. 2 is a schematic diagram of a multi-metadata anomaly CCG graph provided according to an embodiment of the present application; [Figure 10] FIG. 2 is a schematic diagram of obtaining a target conflict cycle graph provided according to an embodiment of the present application; [Figure 11] FIG. 2 is a structural schematic diagram of a transaction processing device provided according to an embodiment of the present application; [Figure 12] FIG. 2 is a structural schematic diagram of a server provided according to an embodiment of the present application; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0013] In order to make the objectives, technical solutions and advantages of the present application clearer, the following describes the embodiments of the present application in more detail in combination with drawings.
[0014] DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS A detailed description will now be given of exemplary embodiments, examples of which are illustrated in the drawings. When the following description refers to the drawings, the same numerals in different drawings represent the same or similar elements unless otherwise noted. The embodiments described in the following exemplary embodiments are not representative of all embodiments consistent with the present application. On the contrary, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0015] The terms "first", "second", etc., in this application are used to distinguish between the same or similar items that have essentially the same actions and functions. It should be understood that there is no logical or chronological dependency between "first", "second", ..., "seventh", and no limitations on the quantity or order of execution. It should be further understood that in the following description, the terms "first", "second", etc., are used to describe various elements, but these elements should not be limited by the terms.
[0016] These terms are only used to distinguish one element from another. For example, without departing from the scope of the examples, a first transaction could be referred to as a second transaction, and similarly, the second transaction could be referred to as the first transaction. Both the first transaction and the second transaction may be transactions, and in some cases may be separate and distinct transactions.
[0017] Here, "at least one" refers to one or more than one, and for example, "at least one transaction" may be any integer number of transactions equal to or greater than one, such as one transaction, two transactions, three transactions, etc. "multiple" refers to two or more than two, and for example, "multiple transactions" may be any integer number of transactions equal to or greater than two, such as two transactions, three transactions, etc.
[0018] Before introducing the embodiments of the present application, some basic concepts in the cloud technology field need to be introduced.
[0019] Cloud Technology: Refers to a type of hosting technology that unifies a series of resources such as hardware, software, and network in a wide area network or a local area network to realize data calculation, storage, processing, and sharing. That is, it is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the application of a cloud computing business model, and can form a resource pool that can be used as needed, which is flexible and convenient. The transaction processing method of a database system provided in the embodiments of the present application (hereinafter, abbreviated as transaction processing method) may be realized based on cloud technology.
[0020] Cloud Storage: A new concept developed by expanding the concept of cloud computing, a distributed cloud storage system (hereinafter referred to as storage system) refers to a storage system that uses functions such as cluster applications, grid technology, and distributed storage file systems to aggregate and cooperate a large number of different types of storage devices (storage devices are also called storage nodes) in a network through application software or application interfaces to jointly provide data storage and business access functions to the outside. The transaction processing method provided in the embodiments of this application can be applied in cloud storage, thereby identifying abnormalities in cloud storage.
[0021] Database system (Database): A kind of computerized file cabinet, that is, a place for storing electronic files, where users can perform operations such as adding, querying, updating, and deleting data in the files. A so-called "database system" is a set of data that is stored together in a predetermined manner, can be shared by multiple users, has minimal redundancy, and is independent of application programs. The transaction processing method provided in the embodiments of this application can be applied in a database system, so as to identify anomalies in the database system.
[0022] The database system according to the embodiment of the present application may be a standalone database system, a transaction-based standalone database system, an analytical standalone database system that requires transaction processing capability, a general non-relational database (Non-relational SQL, NoSQL) system, or a distributed database system or a distributed big data processing system. As for the distributed database system, when different variables are distributed and stored on different physical nodes, it corresponds to the case where there are two or more variables in the data state consistency model, and the data state consistency model and the corresponding transaction processing process will be described in detail in the following description.
[0023] The database system may include at least one node device, and a plurality of data tables may be stored in the database of each node device, and each data table may be used to store one or a plurality of data items (also referred to as variant versions). Here, the database of the node device may be any type of distributed database, and may include at least one of a relational database and a non-relational database, such as a Structured Query Language (SQL) database, NoSQL, a variety of common new scalable / high performance databases (NewSQL), etc., and the type of database is not limited in the embodiments of the present application.
[0024] In some embodiments, the present invention can be further applied to a database system based on blockchain technology (hereinafter, referred to as a "blockchain system"). The blockchain system essentially belongs to a decentralized distributed database system, employs a consensus algorithm to maintain consistency of ledger data recorded in different node devices on the blockchain, uses an encryption algorithm to encrypt and transmit ledger data between different node devices and ensure that it cannot be tampered with, extends ledger functions through a script system, and interconnects different node devices through network routing.
[0025] A blockchain system may include one or more blockchains. A blockchain is a series of data blocks linked together using cryptographic methods, each of which contains information about a batch of network transactions and is used to authenticate the validity of the information (to prevent forgery) and generate the next block.
[0026] In a blockchain system, a peer-to-peer (P2P) network can be formed between node devices, and the P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP). In a blockchain system, any one of the node devices can have the following functions:
[0027] 1) Routing: A basic function possessed by node devices, used to support communication between node devices. 2) Application: Used to be deployed in the blockchain, it realizes a specific business according to actual business needs, and records data related to the realized function to form ledger data. The ledger data carries a digital signature to represent the data source, and sends the ledger data to other node devices in the blockchain system. After the other node devices successfully authenticate the ledger data source and integrity, the ledger data is added to a temporary block. Here, the business realized by the application can include wallets, shared ledgers, smart contracts, etc. 3) Blockchain: A blockchain is a set of blocks that are interconnected in a chronological order. Once a new block is added to the blockchain, it cannot be removed. Blocks contain the ledger data committed by the nodes in the blockchain system.
[0028] In some embodiments, each block may include a hash value (the hash value of the block) that stores the transaction record of the block, and a hash value of the previous block, and each block is connected by the hash value to form a blockchain, and the block may further include information such as a timestamp when the block was generated.
[0029] The accuracy of transaction parallel control in a database system can be described by consistency and isolation. Therefore, before introducing the embodiments of the present application, consistency and isolation will be first explained below.
[0030] 1. Isolation: Transaction isolation levels are defined by whether certain data anomalies can be avoided, and possible data anomalies include: A. Dirty read: A transaction reads an uncommitted data item from another transaction. B. Non-repeatable read: A transaction reads the same data item twice but obtains different results. C. Phantom read: A transaction performs a predicate query (range query) twice during the operation process, and the second query result contains a data item that does not appear in the first query result, or a data item that appeared in the first query result is missing.
[0031] Based on making it possible to resolve the three types of data anomalies, ABC, above, the Database International Standards Institute (ANSI) SQL proposes four isolation levels to distinguish between the three known types of data anomalies, ABC, above, and improve transaction processing efficiency when allowing some data anomalies to exist.
[0032] It also includes four more isolation levels, each of which includes the following: a. Read Uncommitted: The three types of data anomalies A, B, and C above are allowed to occur. b. Read Committed: Dirty reads are not allowed to occur. c. Repeatable Read: Dirty reads and non-repeatable reads are not allowed to occur. d. Serializable: None of the three types of data anomalies A, B, and C above should occur. As can be easily seen from this, none of these four isolation levels allow the occurrence of dirty write anomalies, which refers to two uncommitted transactions modifying the same data item. When ANSI SQL established the standard, there were not many types of data anomalies known, and new data anomalies are constantly being discovered subsequently. In addition to the above several data anomalies, the data anomalies further include lost update anomaly, read partial order anomaly, write partial order anomaly, read write partial order anomaly, sawtooth write partial order anomaly, serial-parallel phenomenon anomaly, cross phenomenon anomaly, causal missing anomaly, causal inversion anomaly, old read anomaly, and future read anomaly, etc.
[0033] 2. Consistency: In database technology, the word "consistency" can have two meanings: first, it refers to transactional consistency, and second, it refers to distributed consistency.
[0034] Regarding the transactional integrity of a database, under the operation of a transaction, the data state of the database changes from one consistent state to another consistent state. The above "consistent state" refers to a data state that satisfies some rules predefined by the database system, for example, these rules can include constraints, cascades, triggers, and any combination of the three (belonging to the logical semantics of data), and what is violated by the write partial order anomaly is the constraint between specific data, and the constraint here belongs to the data integrity limited by user semantics.
[0035] Concurrent access control technology in database transaction processing technology is used to discover and solve the problem of whether transaction parallel operations may cause data anomalies on data items and how to eliminate the data anomalies. ANSI SQL proposes four types of data anomalies and isolation levels, and also develops various concurrent access control algorithms, such as locking-based concurrent access control technology, timestamp-based concurrent access control technology, multi-version concurrency control (MVCC)-based concurrent access control technology, and optimistic concurrency control (OCC)-based concurrent access control technology.
[0036] Distributed consistency of a database is also called the operational consistency of shared data objects, and is a system-level meaning for the entire database system. To ensure that data maintains consistency in a database system, the database system must further comply with two properties: serializability and recoverability. Serializability is the serializable isolation level in the above isolation, where serializability ensures the correctness of parallel operations, and recoverability means that a committed transaction has not read the data written by a rolled back transaction (meaning that a dirty read anomaly does not occur). Recoverability ensures that data returns to the previous consistent state after a transaction is rolled back, and the rolled back transaction does not affect the consistency of data, and the consistency state of the database system is recoverable.
[0037] Based on the above concepts, it is clear that both consistency and isolation are closely related to data anomalies, and therefore data anomalies need to be identified and avoided in database systems, where the relevant database anomalies include dirty read data anomalies, dirty write data anomalies, non-repeatable read data anomalies, phantom read anomalies, missing update data anomalies, read partial order data anomalies, write partial order data anomalies, serial-parallel phenomenon data anomalies, and cross phenomenon data anomalies, etc.
[0038] Generally, the serializability principle is relied upon when identifying data anomalies, and two types of data anomaly identification strategies can be adopted. The first is to use locking technology to prevent data anomalies from occurring through the locking exclusion mechanism. For example, the serializable isolation levels of database systems such as DB2, Informix, and MySQL all use locking technology. The second is to use dependency graph technology to check whether a cycle exists in the dependency graph constructed by parallel transactions, and if a cycle exists, break the existence of the cycle, thereby eliminating the potential data anomaly.
[0039] However, the locking technique seriously limits the parallelism of the database system and reduces the transaction processing efficiency. In addition, the dependency graph technique needs to identify the existence of a cycle by traversing each transaction during a parallel transaction, which causes a relatively low transaction processing efficiency, and it needs to use the help of various derived algorithms to identify whether a cycle exists, and it needs to represent the association relationship between the parallel transaction and the operated data item (i.e., variable version) in a complex data structure, which increases the complexity of the database system.
[0040] In addition, a simplified implementation method based on dependency graph and conflict serialization technology (based on the serialization principle) can be further adopted to perform transaction processing. For example, the snapshot isolation (SSI) technology of database (PostgreSQL) makes it possible to identify in advance the necessary and insufficient conditions that may cause a cycle to exist in the dependency graph. One transaction has one read / write conflict in-edge and one read / write conflict out-edge, and if any one transaction satisfies the above conditions, it is considered that a data anomaly exists.
[0041] Furthermore, the above method for identifying data anomalies further has the following problems.
[0042] First, the recognition is fragmented and not unified. The locking technology, the dependency graph technology, and the SSI technology all fragment the identification methods of various data anomalies, so that when identifying data anomalies, it is necessary to recognize whether they match each type of data anomaly one by one. In other words, these different types of data anomalies cannot be identified and recognized from a unified perspective, which causes the recognition concept of data anomalies to be complex, unclear, and not unified, resulting in a relatively high level of complexity.
[0043] Second, the recognition is limited and incomplete. Locking, dependency graph, and SSI technologies cannot cover whether there is an unknown new data anomaly. When a data anomaly exists, it will cause damage to the entire database system. For example, when a database system is under the non-serializable isolation level, a new data anomaly will cause data inconsistency errors to appear in the system.
[0044] Third, the identification principle is not accurate. Serializability is a sufficient and unnecessary condition for the existence of anomalies in data, which can avoid the emergence of new data anomalies in the implementation of a database system. However, some cases where no data anomalies exist may be considered as data anomalies, which is equivalent to misjudging data anomalies. For example, transaction 1 writes variable version X1 and reads variable version Y1, and transaction 2 reads variable version X1 and writes variable version Y1. The above series of database operations can be written as "W1(X1)R2(X1)W2(Y1)R1(Y1)C2C1", and this series of operations is not serializable, but there is no data anomaly.
[0045] In view of this, an embodiment of the present application provides a transaction processing method, which provides a method for identifying data anomalies and avoiding data anomalies during transaction processing. A general-purpose conflict cycle graph is provided to define data anomalies, and on the premise of ensuring the accuracy of the definition of data anomalies, the definition of data anomalies is visualized and data anomalies are subdivided and classified, making it possible to improve the transaction processing efficiency of a database system. This will be described in detail below.
[0046] Fig. 1 is a schematic diagram of an implementation environment of a transaction processing method provided by an embodiment of the present application. As shown in Fig. 1, the embodiment of the present application can be applied to a distributed database system in a database system, which can include a gateway server 101 (three gateway servers are illustrated as an example), a global timestamp generation cluster 102, a distributed storage cluster 103, and a distributed cooperative system 104 (e.g., ZooKeeper). The distributed storage cluster 103 can include node devices 1 to m (m is a positive integer of 1 or more), and each node device can be a data node device or can also be a cooperative node device.
[0047] Here, the gateway server 101 is used for receiving external read / write requests, and delivering read / write transactions corresponding to the read / write requests to the distributed storage cluster 103. For example, after a user logs in to an application client terminal on a terminal, the user triggers the application client terminal to generate a read / write request, and calls an application programming interface (API) provided by the distributed database system to send the read / write request to the gateway server 101. Here, the API may be an API provided by any kind of relational database system, for example, the API may be a MySQL API.
[0048] In some embodiments, the gateway server 101 may be the same physical machine as any one of the data node devices or any one of the cooperative node devices in the distributed storage cluster 103, i.e., a data node device or cooperative node device may have the functionality of the gateway server 101.
[0049] The global timestamp generation cluster 102 is used to generate a global commit timestamp (Global Timestamp, Gts) for a global transaction. The global transaction is also called a distributed transaction, and refers to a transaction involving multiple data node devices, for example, a global read transaction can involve reading data stored on multiple data node devices, and for example, a global write transaction can involve writing data on multiple data node devices. The global timestamp generation cluster 102 can be logically regarded as a single point, and can provide a service with higher availability through a 1-master 3-slave (one master device and three slave devices corresponding to the master device) architecture, and adopts a cluster form to realize the generation of the global commit timestamp, and when one device in the 1-master 3-slave architecture fails, the other devices in the 1-master 3-slave architecture can continuously realize the generation of the global commit timestamp, thereby preventing single-point failure and avoiding the single-point bottleneck problem.
[0050] In the embodiment of the present application, the global commit timestamp is a timestamp identifier that is globally unique and monotonically increasing in a distributed database system, and can be used to mark the order of global commits of each transaction, thereby reflecting the true time sequence between transactions (total order relationship of transactions). The global commit timestamp can adopt at least one of a physical clock, a logical clock, a hybrid physical clock, or a hybrid logical clock (HLC), and the embodiment of the present application is not limited to the type of the global commit timestamp.
[0051] Exemplarily, the global commit timestamp can be generated by adopting a hybrid physical clock method, where the global commit timestamp can be composed of 8 bytes, each byte containing 8 bits, totaling 64 bits, where the first 44 bits can be the value taken by the physical timestamp (i.e., Unix timestamp, accurate to milliseconds), thus totaling 2 44 unsigned integers, and therefore, in theory, a physical timestamp of approximately 557.8 years in total can be represented.
[0052]
number
[0053] Here, the last 20 bits can be a monotonically increasing count within a millisecond, thus 2 per millisecond. 20 Based on the above data structure, if the transaction throughput of a standalone (any one data node device) is 10w / s, it can theoretically support a distributed storage cluster 103 including 10,000 node devices. At the same time, the number of global commit timestamps represents the total number of transactions that the system can theoretically support, and based on the above data structure, the system can theoretically support (2 44 -1)*2 20 transactions can be supported. This is an exemplary description of a method for defining a kind of global commit timestamp. According to different business needs, the number of bits of the global commit timestamp can be expanded to meet the support for a larger number of nodes and transaction processing, so that the embodiment of the present application does not limit the method for defining the global commit timestamp.
[0054] In some embodiments, the global timestamp generation cluster 102 may be physically separate or may be merged together with the distributed collaboration system 104 .
[0055] Here, the distributed storage cluster 103 may include data node devices and cooperative node devices. Each cooperative node device may correspond to at least one data node device, and the distinction between data node devices and cooperative node devices is based on the difference in transactions. Taking a global transaction as an example, the initiating node of the global transaction may be called a cooperative node device, and other node devices related to the global transaction may be called data node devices, and the number of data node devices or cooperative node devices may be one or more, and the embodiment of the present application does not limit the number of data node devices or cooperative node devices in the distributed storage cluster 103. Since the distributed database system provided by the embodiment of the present application lacks a global transaction manager, the system may support transactions (global transactions) between nodes by adopting an eXtended Architecture (XA) / Two-Phase Commit (2PC) technology, and may guarantee the atomicity and consistency of data during write operations between nodes. At this time, the cooperative node devices correspond to collaborators in the 2PC algorithm, and each data node device corresponding to the cooperative node devices corresponds to a participant in the 2PC algorithm.
[0056] In the embodiment of the present application, each data node device or cooperative node device may be a standalone device, or may adopt a master-standby structure (i.e., a single-master multi-standby cluster). As shown in FIG. 1, the node device (data node device or cooperative node device) is taken as an example of a one-master two-standby cluster. Each node device includes one master device and two standby devices, and each master device or standby device is correspondingly arranged with an agent device. The agent device may be a physical device different from the master device or standby device, and of course, the agent device can also be an agent module on the master device or standby device. Taking the node device 1 as an example, the node device 1 includes one master database and an agent device (abbreviated as Master Database+Agent, Master DB+Agent), and further includes two standby databases and agent devices (abbreviated as Standby Database+Agent, Standby DB+Agent).
[0057] Illustratively, a set of database instances of each node device and corresponding master device or standby device is referred to as a set (SET). For example, if a node device is a standalone device, the SET of the node device is only the database instance of the standalone device. If a node device is a one-master two-standby device cluster, the SET of the node device is a set of a master device database instance and two standby device database instances. At this time, the consistency between the data of the master device and the replica data of the standby device can be guaranteed based on the strong synchronization technology of the cloud database, where each SET can perform linear expansion, thereby meeting the business processing needs under big data scenarios. In some financial business scenarios, a global transaction usually refers to a transfer between SETs.
[0058] The distributed collaboration system 104 can be used to manage at least one of the gateway server 101, the global timestamp generation cluster 102, or the distributed storage cluster 103. In the embodiment of the present application, the distributed collaboration system 104 is accessed by a scheduler on a terminal, and the back-end distributed collaboration system 104 can be controlled based on the front-end scheduler to realize management of each cluster or server. For example, the scheduler can control ZooKeeper to remove a certain node device from the distributed storage cluster 103, that is, disable a certain node device.
[0059] The above FIG. 1 provides an architecture diagram of a kind of lightweight level global transaction processing, which is a kind of distributed database system. The whole distributed database system can be regarded as jointly maintaining one logical data table, and the data stored in this data table is distributed among each node device in the distributed storage cluster 103 by primary key, and the data stored on each node device is independent of other node devices, thereby realizing horizontal partitioning of the logical data table of the node devices. The above system enables each data table in each database to be horizontally partitioned and then stored in a distributed manner, so such a system can also be called an architecture with "database partitioning table partitioning".
[0060] In the above-mentioned distributed database system, data atomicity and consistency during write operations have already been realized based on XA / 2PC technology. For example, the distributed table partitioning architecture shown in FIG. 1 is a local transaction manager, not a global one, so there is still a data consistency problem during read operations. On the other hand, the transaction processing method provided by the embodiment of the present application makes it possible to realize distributed transaction processing, and by constructing a lightweight, decentralized distributed transaction processing mechanism, it makes it possible to provide the distributed database system with capabilities such as horizontal expansion, improve the application range of the distributed database system, and further makes it possible to solve the problems of data atomicity and consistency during write operations and data consistency during read operations, thereby improving transaction processing efficiency.
[0061] The transaction processing method provided by the embodiment of the present application can be applied to a distributed database system that adopts the above-mentioned database partitioning table partitioning architecture. For example, the distributed database system is a distributed transactional database system, and of course, it can also be a distributed relational database system, and the transaction processing method provided by the embodiment of the present application can also be applied to some standalone database systems. When applied to a distributed database system, the transaction processing method provided by the embodiment of the present application can realize distributed transaction processing, and can improve transaction processing efficiency through flexible isolation levels.
[0062] In some embodiments, the distributed database system composed of the gateway server 101, the global timestamp generation cluster 102, the distributed storage cluster 103, and the distributed collaboration system 104 can be regarded as a kind of server providing data services to user terminals. The server may be an independent physical server, a server cluster composed of multiple physical servers, or a distributed system, and may even be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), big data, and artificial intelligence platforms. Here, the user terminal may be, but is not limited to, a smartphone, a tablet computer, a laptop, a desktop computer, a smart speaker, a smart watch, and the like. The terminal and the server may be directly or indirectly connected by wired or wireless communication, and the present application is not limited thereto.
[0063] Below, some basic terms and code representations related to database systems are introduced.
[0064] Transaction: A logical unit in the process in which a database management system executes operations. It consists of a limited sequence of database operations and is the smallest execution unit of a database system operation.
[0065] Variable: A transaction is a data unit in a database relational system, and a variable is an actor (or a data object) of a database operation, and in some embodiments, a variable is also called a data item. Here, a variable may be a tuple or a record, or a page or a table object, etc. A variable may include multiple variable versions (abbreviated as "versions"). Each time a transaction updates a variable, a new variable version is added, and each variable version of a variable may have a natural number as a version number identifier, and the higher the version number, the newer the variable version.
[0066] Operation: A database operation consists of three parts: operation type, transaction, and variable version. Here, the operation type can include two types: read (Read, R) and write (W). For example, a transaction T i reads variable x and writes a new version of variable x m The above read operation generates R i [x m ], and for example, transaction T j updates a variable y, creating a new version of variable y n The write operation generates W j [y n ], where i and j are natural numbers and are the transaction numbers to which the corresponding operations belong, and m and n are natural numbers and are the version numbers of the corresponding variables. Also, when there is no need to distinguish between R and W, O can represent one operation.
[0067] Serializable: Serializable is a schedule, and can also be understood as an execution method between multiple transactions. There is a pre- and post-order order for execution between multiple transactions, and if there are no variables that are jointly manipulated between transactions, it is acceptable to interchange the pre- and post-order order of execution between transactions. However, if there are variables that are jointly manipulated between transactions, the pre- and post-order orders of execution between transactions must be distinguished. For multiple transactions that are executed in parallel and that have jointly manipulated variables, if the execution result is "equivalent" to a certain "serializable schedule", then this schedule is a "serializable schedule". If a schedule satisfies the "serializable schedule", it has the serializable attribute. Therefore, serializable guarantees that the order of execution of multiple transactions in parallel does not affect data consistency.
[0068] Each transaction in a database system has two transaction data sets, the transaction's write set and the transaction's read set, meaning that the write set DSW(T) is used to store new data versions written by transaction T, and the read set DSR(T) is used to store data versions read by transaction T.
[0069] The transaction processing method provided in the embodiment of the present application is implemented based on a data state consistency model (which can also be abbreviated as "data state model"). The embodiment of the present application unifies data anomalies based on the conflict serializability theory, and provides a general-purpose conflict cycle graph, which is used to represent the association relationship between transactions and the variables affected by the read and write operations corresponding to the transactions. The following introduces the basic concepts related to the present application.
[0070] 1. Schedule: One schedule refers to a sequence consisting of multiple operations of a set of transactions, denoted as s. All transactions in one schedule s are denoted as TS(s), all operations in one schedule s are denoted as O(s), and all sets with version number identifier variables in one schedule s are denoted as VS(s). For example, the schedule s = R1[x0]R2[y0]W3[x1]W4[y1]R2[x1]R1[y1] indicates that the operation sequence of this schedule s is derived from four transactions, namely TS{T1, T2, T3, T4}, for two variables x and y, and the variables x and y each have two versions.
[0071] Exemplarily, if in one schedule s, the operations of any two transactions are adjacent in units of transactions, that is, after all operations of one transaction are executed, the next transaction is further executed, then this schedule s is called a serialized schedule. For example, one serialized schedule s is represented by s = R1[x0]R1[y0]R2[y0]R2[x0]W3[x1]W4[y1].
[0072] 2. Conflict: Conflict is also called conflicting operation. When two operations meet the following three conditions, these two operations are called conflicting operations. Here, the three conditions are: 1) The two operations belong to different transactions; 2) At least one operation is a write operation; and 3) The objects operated on by the two operations are the same object (reading the same object or writing to the same object). In the embodiments of the present application, the object is also called a variable.
[0073] Exemplarily, if O i [x m O j [x n (i ≠ j, m < n) are operations of two transactions in schedule s, belonging to transactions T i and Tj Let O be two operations acting on the same variable x. If O i [x m ]O j [x n ] is R i [x m ]W j [x m+1 ], W i [x m ]R j [x m ], and W i [x m ]W j [x m+1 If the problem belongs to one of the three types of conflicts, i [x m ]O j [x n ] is called a conflict, and the conflict is O i and O j A partial order relationship is formed between , and a set including all conflicts in schedule s is denoted as conf(s). In the embodiment of the present application, the above three types of conflicts can be abbreviated as RW, WR, and WW, respectively.
[0074] 3. Conflict Equivalence: For different schedules s and s′, if the following two conditions are satisfied, s and s′ are called conflict equivalent, where 1) schedules s and s′ contain similar transaction sets, i.e., the order of operations in each transaction is fixed and cannot change under different schedules, and 2) schedules s and s′ contain similar conflict sets.
[0075] Illustratively, for distinct schedules s and s', if O(s)=O(s') and conf(s)=conf(s'), then s and s' are called contention-equivalent and denoted as s≈s'.
[0076] For example, here are two competing equivalent schedules:
[0077] s=R1[x0]R1[y0]W2[x1]W1[y1]R2[z0]W1[x2]W2[y2], s′=R1[y0]R1[x0]W1[y1]W2[x1]W1[x2]R2[z0]W2[y2].
[0078] 4. Conflict Serializability: If there exists a serialized schedule s′ for a schedule s, and the two schedules are conflict-equivalent (i.e., s≒s′), then s is called a conflict-serializable schedule.
[0079] 5. Conflict Cycle Graph (CCG): For example, in one schedule s, there are multiple transactions t∈TS(s), and if the graph composed of multiple transactions t satisfies the following three conditions, the cycle graph is called a conflict cycle graph, where CCG(s)=(V,E). The three conditions are explained below.
[0080] 1) V = VS(s) is represented as a vertex set of a CCG graph, and the elements in the vertex set are called vertices. One vertex corresponds to one transaction, where one vertex T i is T i ∈TS(s).
[0081] 2) E is a subset of V×V, which can also be called an edge set, and the elements in the edge set are called directed edges, <T i ,T j > and can be abbreviated as side, where <T i ,T j >∈E⇔i≠j∧(∃O i ∈T i )(∃O j ∈T j )(O i ,O j )∈conf(s), and so a directed edge can be written in a similar form to the “conflict” above. For example, a directed edge can be written as W i [x m ]Wj [x m+1 ], and the examples of the present application are not limited thereto.
[0082] 3) <T i ,T j >∈E, <T j ,T k >∈E,… <T p ,T i >∈E, i≠j≠k≠…≠p, then the CCG graph is a graph consisting of a directed cycle.
[0083] For example, refer to Fig. 2, which is a schematic diagram of a conflict cycle graph provided by an embodiment of the present application. As shown in Fig. 2, T1 and T2 in the figure are vertices of a conflict cycle graph 2-1, and T1 and T2 are connected by two edges to form a conflict cycle graph. Here, the two edges are represented by R1[x0]W2[x1] and W2[x1]R1[x1], respectively.
[0084] In the embodiment of the present application, the following three types of inferences are obtained based on the conflict cycle graph, and each will be described below.
[0085] 1) A conflict cycle graph has at least two edges.
[0086] For example, if there is only one edge in the conflict cycle graph, there are only two transactions in the conflict cycle graph, and these two transactions are serialized transactions and therefore do not form a directed cycle. If two edges form a directed cycle, e.g., the first edge in the conflict cycle graph is T i T j The second edge in the conflict cycle graph is T j T i If there is no equivalent serializable schedule, then the two transactions T i and T j are competing.
[0087] 2) A competitive cycle graph has at most an infinite number of edges.
[0088] For example, there may be an infinite number of transactions in TS(s) corresponding to one schedule s, and correspondingly, there may be an infinite number of vertices in one conflict cycle graph, i.e., there may be an infinite number of edges.
[0089] 3) If any edge of a conflict cycle graph is removed, it does not form a cycle.
[0090] For example, as can be seen from the third condition of the conflict cycle graph above, in a directed cycle formed from a conflict cycle graph, i ≠ j ≠ k ≠ ... ≠ p exists, that is, any two edges are different. Therefore, removing any one edge from a conflict cycle graph does not form a cycle.
[0091] 6. Conflict Consistency State Graph (CCSG): For example, in one schedule s, there are multiple transactions t∈TS(s), and if the graph composed of multiple transactions t satisfies the following four conditions, the graph is called a conflict consistency state graph, where CCSG(s)=(V,E). The four conditions are explained below.
[0092] 1) The definition of schedule s in a CCSG graph satisfies the definition of schedule s in the above CCG graph, that is, an equivalent conversion can be made between CCG(s) and CCSG(s).
[0093] 2) For CCSG(s), V = VS(s) is called the vertex set of the CCSG graph, and its elements are called vertices. i is v i∈VS(s), the vertex is composed of two types of data: the first is a transaction identifier (ID) and the second is a list (List), which is used to store different versions of a variable.
[0094] 3) E is a subset of V×V and can also be called an edge set. The elements in the edge set are called directed edges. In a CCSG graph, edges are divided into the following two types. For the following two types of edges, <V i ,V j >. Such edges are derived from the equivalent transformation of the edges of the CCG graph, and therefore belong to the transformation of the conflict operation. Below, we will explain the two types of edges.
[0095] The first type of edge is a consistency state edge, <x m ,y n > and transaction edge E T The edge of this type contains operations of the same transaction, and therefore the data state within the transaction satisfies the consistency requirement, where x=y and m≠n, or x≠y. Since the CCSG graph is equivalent to the CCG graph, the consistency state edge is R i [x m ]R i [y n ], E T can be the label of the edge.
[0096] The second type of edge is a state transition edge, <x i ,x i+1 > and state edge E S The edge of this type is constructed by a write transaction writing a variable and causing a data state transition, so the version of the variable changes. Since the CCSG graph is equivalent to the CCG graph, the consistency state edge is W j [x m+1 ] may also be expressed as
[0097] 4) ∃V1∈V,V2∈V…,V k ∈V, and ∃E1∈E,E2∈E…,E k ∈E, so that a CCSG graph is a graph consisting of one directed cycle, i.e., V1→E1→V2→E2…V k →E k →V1 is a graph consisting of a directed cycle.
[0098] 7. Equivalent transformation rules for transforming a CCG graph into a CCSG graph: Here, the equivalent transformation rules for transforming a CCG graph into a CCSG graph include the following four items, which are explained below.
[0099] The first term is edge splitting, where any edge in the CCG graph consists of two operations, i.e., one conflict, and can be split into two separate edges. For example, there are three types of edge splitting methods, in which two sub-edges are split in each case. The three types of splitting methods are described below.
[0100] 1) For example, an edge is represented as R1[x0]W2[x1], and by splitting the edge, we get R1[x0] and W2[x1], and at the same time, we get two versions of variable x, x0 and x1.
[0101] 2) For example, an edge is represented as W2[y1]R3[y1], split the edge to get W2[y1] and R3[y1], and at the same time get one version y1 of variable y.
[0102] 3) For example, an edge is represented as W3[z1]W1[Z2], and we split the edge to get W3[z1] and W1[Z2], and at the same time get two versions of variable z, z1 and z2.
[0103] The second term is vertex transformation, where the version of the variable is taken as the vertex of the CCSG graph, that is, the version of the previous step is transformed into a vertex. Here, the vertices obtained in the example of the first term above are taken as an example, and the vertices of the CCSG graph include x0, x1, y1, z1 and z2. The multiple versions of the same variable are arranged vertically, and the versions of different variables operated by the same transaction are arranged horizontally, where the vertical direction may refer to the horizontal direction corresponding to the information displayed on the screen, and may also refer to the direction perpendicular to the horizontal direction corresponding to the information displayed on the screen, and the embodiment of the present application is not limited thereto, but the arrangement direction of the multiple versions of the same variable is opposite to the arrangement direction of the versions of different variables operated by the same transaction. It is necessary to explain that the arrangement method of the vertices here is not a specific requirement, and in some embodiments, they may be arranged in other arrangement methods, and the embodiment of the present application is not limited thereto.
[0104] The third term is to add edges between vertices corresponding to the same variables in adjacent versions. Here, the transition relations between the new vertices obtained in the second term are treated as new edges in the CCSG graph. For example, the related sub-edges of the above transaction T2 include W2[x1] and W2[y1], in which case x1 and y1 are horizontally aligned, so that there is one W2[x1] edge between x0 and x1.
[0105] The fourth term is to add edges between vertices corresponding to variables acted upon by the same transaction. Here, we construct the consistency state edges of the CCSG graph during the same transaction. For example, take the above vertices as an example, and add an edge between x1 and y1, whose label is transaction T2.
[0106] 8. Equivalent transformation rules for transforming CCSG graphs into CCG graphs: Here, the equivalent transformation rules for transforming CCSG graphs into CCG graphs mainly include the following three items, which will be explained below.
[0107] The first term is vertex merging, where variables operated by the same transaction in a CCSG graph are merged into one vertex, and the vertex is named as the transaction identifier of the transaction. The vertex representation method is equivalent to the vertex representation method of the CCG graph described above, and will not be described again here.
[0108] The second term is to add edges between adjacent vertices, which includes the following two points. The first point is to leave the state transition of the variable. For example, as is clear from the edge R1[x0]W2[x1], the state transition of the variable points from T1 to T2, so the new edge added is T1 → T2. The second point is to build a new edge according to the conflict that occurred in the original CCG graph if no write operation occurs. What needs to be explained is that it is applied when there is a WR conflict, and when there is a WR conflict, the corresponding edge points from the transaction where W is located to the transaction where R is located.
[0109] Third, the obtained CCG graph has a cycle and its directed attribute can be ignored, that is, the CCG graph obtained by transforming the CCSG is an undirected cyclic graph.
[0110] It is necessary to explain that in the embodiment of the present application, the CCSG graph is the basis of the data state consistency model. That is, a graph constructed by using the version of a variable as a vertex, and the read / write operation of a transaction as a state transition edge, or the consistency state edge of a transaction as an edge, is the data state consistency model. In the data state consistency model, if a closed loop exists, a data anomaly exists, and if no closed loop exists, no data anomaly exists.
[0111] 9. Data Anomalies (DA): For a schedule s, if there exists a subschedule s′, i.e., ∃s′⊆s, and s′ has a conflict cycle graph, then it is said that the schedule s has a data anomaly, and s′ is a specific data anomaly.
[0112] Based on the above-described conflict cycle graph and data anomaly, the following three types of inferences can be obtained, which will be explained below.
[0113] 1) There are infinite data anomalies. Based on the second reasoning in the conflict cycle graph, there can be an infinite number of vertices and an infinite number of edges in the conflict cycle graph, and therefore there are an infinite number of data anomalies.
[0114] 2) There are an infinite number of finely classified data anomalies. Different vertices in the conflict cycle graph result in different data anomalies, different edges in the conflict cycle graph result in different data anomalies, and different numbers of at least one of the vertices and edges in the conflict cycle graph result in different data anomalies. Thus, there are an infinite number of finely classified data anomalies.
[0115] 3) A formal expression is employed to represent each subclassified data anomaly and to name the subclassified data anomaly.
[0116] It should be understood that a data anomaly is a subset of schedule s for which a conflict cycle exists, and therefore a fine-grained data anomaly can be expressed as an expression for the subset of schedule s that constitutes the conflict cycle.
[0117] For example, take the lost update anomaly as an example, and the conflict cycle graph corresponding to the lost update anomaly is shown in FIG. 3, which is a schematic diagram of another conflict cycle graph provided by an embodiment of the present application. As shown in FIG. 3, in the conflict cycle graph 3-1, V={T1, T2}, E={<R1[x0]W2[x1]> ,<W2[x1]W1[x2]>}, in which case the formal definition of the lost update anomaly is R i [x m ]…W j [x m+1 ]…W i [x m+2 ].
[0118] Also, for example, taking the read partial order anomaly as an example, the conflict cycle graph corresponding to the read partial order anomaly is referred to in FIG. 4, which is a schematic diagram of another conflict cycle graph provided by an embodiment of the present application. As shown in FIG. 4, in the conflict cycle graph 4-1, V={T1, T2}, E={<R1[x0]W2[x1]> ,<W2[y1]R1[y1]>}, in which case the formal definition of the read partial order anomaly is R i [x m ]…W j [x m+1 ]…W i [y n ]…R i [y n ].
[0119] It is necessary to clarify that here, we take the above two types of data anomalies as examples and combine the corresponding conflict cycle graphs to provide an example of the formalization of data anomalies. Conflict cycle graphs corresponding to other data anomalies and the formal definitions of data anomalies will be introduced later.
[0120] 10. Rollback rate: When using locking technology to suppress parallelism and prevent data anomalies, transactions that can be committed will be rolled back, that is, false rollbacks. The following describes rollback information for the embodiments of the present application.
[0121] 1) Data Anomaly Rollback: For a schedule s, a transaction rollback caused by the occurrence of a data anomaly is called a data anomaly rollback, also called a true rollback (TR).
[0122] 2) Algorithmic Rollback: A transaction rollback caused by a parallel access algorithm determining that a data inconsistency may occur for a schedule s when no data anomaly exists is called an algorithmic rollback, also known as a false rollback (FR).
[0123] 3) True rollback rate: In P schedules, if we assume that each of U schedules has a true rollback, then U / P is called the true rollback rate. The true rollback rate reflects the probability of data anomalies occurring in the application context.
[0124] 4) False rollback ratio: In P schedules, if we assume that there is a false rollback in each of V schedules, then V / P is called the false rollback ratio. The false rollback ratio reflects the parallel execution ability of parallel transactions, and the lower the false rollback ratio, the higher the parallelism, and the higher the utilization of computing resources, the higher the transaction parallel efficiency.
[0125] The above is an introduction of the basic concepts of the embodiments of the present application, and the following describes the transaction processing method of the present application. In the embodiments of the present application, based on the above basic concepts, a conflict cycle graph constructed between transactions is used to identify data anomalies, making it possible to effectively identify data anomalies that occur during the execution of a transaction, thereby improving the efficiency of transaction processing.
[0126] Please refer to Table 1, which describes some symbols and their corresponding meanings related to the embodiments of the present application.
[0127] [Table 1]
[0128] Based on the basic concept described above, and the symbols and corresponding meanings shown in Table 1, a transaction processing method provided by an embodiment of the present application will be described below with reference to Fig. 5. Fig. 5 is a flow chart of the transaction processing method provided by an embodiment of the present application, and as shown in Fig. 5, the transaction processing method provided by an embodiment of the present application is applied to any one of node devices in a database system. When the database system is a standalone database system, the node device may be a standalone device, and when the database system is a distributed database system, the node device may be a cooperative node device or a data node device, and the embodiment of the present application includes steps 501 and 502, and each step will be described below respectively.
[0129] Step 501: A node device determines a parallel transaction of a target transaction, where the parallel transaction and the target transaction include read / write operations acting on the same variable, and the target transaction is a transaction to be committed.
[0130] In the embodiment of the present application, the target transaction is a global transaction or a local transaction. Here, the global transaction refers to a transaction related to operations between nodes, and the global transaction is also called a distributed transaction, and the local transaction refers to a transaction related only to operations of a single node, and the local transaction is also called a local transaction. The embodiment of the present application is not limited by the type of the target transaction. Here, the read / write operation refers to at least one of a read operation and a write operation.
[0131] Here, when the node device executes the target transaction, it screens at least one candidate parallel transaction according to the transaction read set and the write set, and determines a parallel transaction of the target transaction from the at least one candidate parallel transaction thus screened (a specific embodiment for determining a parallel transaction will be introduced later). Here, the target transaction can be initiated by a terminal, and at this time, the terminal and the node device establish a session used to process the target transaction, and the terminal transmits a request to execute the target transaction to the node device, and the node device starts to execute the target transaction in response to the request to execute the target transaction. In some embodiments, if the terminal and the node device have already established a session, there is no need to establish a new session between them, and the already established current session can be multiplexed.
[0132] Step 502: The node device obtains a first intersection between the read set of the target transaction and the write set of the parallel transaction, and obtains a second intersection between the write set of the target transaction and the read set of the parallel transaction. When at least one of the first intersection and the second intersection is a non-empty data set, and the target transaction conflicts with the parallel transaction, determine a data anomaly type according to the version change times of the same variable acted upon by the target transaction and the parallel transaction and a target variable list, where the target variable list includes the same variable acted upon by the target transaction and the parallel transaction.
[0133] In the embodiment of the present application, the target transaction conflicts with the parallel transaction means that there are at least two operations that are conflicting operations in the target transaction and the parallel transaction, and if the target transaction is committed at this time, it will cause a data anomaly to occur in the database system. The node device determines that at least one of the first intersection set and the second intersection set is a non-empty data set, and when the target transaction conflicts with the parallel transaction, determines a data anomaly type based on the version change count and the target variable list, and reports the data anomaly type. Here, the non-empty data set refers to a data set that is not an empty set, that is, a data set that includes set elements.
[0134] In the transaction processing method provided by the embodiment of the present application, after determining a parallel transaction of the target transaction, if there is at least one non-empty item among a first intersection between the read set of the target transaction and the write set of the parallel transaction and a second intersection between the write set of the target transaction and the read set of the parallel transaction, the node device judges whether the target transaction conflicts with the parallel transaction. If the target transaction conflicts with the parallel transaction, the node device determines a data anomaly type according to the same variables operated by the two transactions and the number of version changes of the same variables. This method makes it possible to check whether the target transaction constitutes a genuine conflict with the parallel transaction during the execution of the target transaction, and to determine the data anomaly type according to the same variables operated by the two transactions, thereby making it possible to identify various data anomalies in the database system based on the serializability theory, ensuring the consistency of the data state, and improving the transaction processing efficiency of the database system.
[0135] Fig. 5 above is a brief description of the transaction processing method provided by the present application, and below, in combination with Fig. 6, the transaction processing method provided by the embodiment of the present application will be introduced in detail. Fig. 6 is a flowchart of another transaction processing method provided by the embodiment of the present application, and as shown in Fig. 6, the transaction processing method provided by the embodiment of the present application is applied to any one of node devices in a database system, and when the database system is a standalone database system, the node device may be a standalone device, and when the database system is a distributed database system, the node device may be a cooperative node device or a data node device, and the embodiment of the present application includes steps 601 to 609 below, and each step will be described below.
[0136] Step 601: In response to an execution command of a target transaction, the node device initializes a read set and a write set of the target transaction.
[0137] In an embodiment of the present application, in response to an execution command of a target transaction, a node device initializes the read set and write set of the target transaction to an empty set, and assigns a globally unique transaction ID, i.e., a transaction identifier, to the target transaction, where the transaction IDs of different transactions are integer-incremented according to the time sequence in which the node device receives the corresponding execution commands, for example, when the node device receives an execution command of a target transaction at time t1, the node device names the transaction ID of the target transaction as 1000, and if the node device receives an execution command of another transaction at time t2, the node device names the transaction ID of the other transaction as 1001, but the embodiment of the present application is not limited thereto.
[0138] In the embodiment of the present application, in the initialization process, when the database system of the node device starts up, the operating system of the node device allocates an internal memory space, which is used to maintain the read set and write set of at least one transaction, and when starting to execute the target transaction, the node device requests an internal memory from the internal memory space, which is used to manage the read set and write set of the target transaction, thereby completing the creation of the read set and write set of the target transaction on the node device, and initializing both the newly created read set and write set to an empty set.
[0139] Below, we introduce a strategy for updating the read set and write set of a target transaction.
[0140] After completing the initialization of the read set and the write set, the node device determines whether the target transaction is related to an update operation on a variable according to the execution statement of the target transaction. When determining that the target transaction is related to an update operation on a variable, the node device updates any one of the variables in response to the target transaction, adds the variable to the write set of the target transaction, and assigns a version number to the variable. For example, when a transaction T updates a variable x, it adds the variable x to the write set of transaction T and assigns a version number to the variable x. The version numbers of write operations on the same variable of different transactions are integer-incremented, and at this time, the node device can obtain the version number of the variable when it executes a read operation. That is, the database system maintains one incremental version number for each variable. Also, when the node device reads any one of the variables according to the execution statement of the target transaction, the read variable is the latest variable that satisfies the read-committed rule.
[0141] The above update strategy can also be understood as the target transaction's read set and write set being maintained in real time as transaction operations occur. If a read operation occurs, the read variable goes into the read set, and if a write operation occurs, the read variable goes into the write set. If the same transaction writes the same variable multiple times, it will have multiple different new versions, and the latest variable version will replace the older variable version in the write set.
[0142] It is necessary to explain that step 601 is the process of forming a transaction read set and a write set in the above step 501, and is a step of forming a transaction read / write set in the read / write phase.
[0143] Step 602: The node device obtains at least one candidate parallel transaction of the target transaction in response to an execution command of each operation in the target transaction.
[0144] In an embodiment of the present application, for each operation of the target transaction (which may be a read operation or may be a write operation), when the operation occurs, a preparation phase is entered, in which the node device enters a critical region, traverses the read set and write set of the target transaction, obtains the transaction ID of at least one candidate parallel transaction (e.g., all parallel transactions) of the target transaction, and stores the transaction ID of the at least one candidate parallel transaction in a Typescript (TS).
[0145] In an embodiment of the present application, in the process in which the node device acquires at least one candidate parallel transaction, a transaction ID (abbreviated as an active transaction ID) of a transaction that has read and written the variable but has not been committed is written on each variable in the internal memory. The active transaction ID written on each variable may be one, multiple, or even empty. The node device can obtain the transaction ID of the at least one candidate parallel transaction by acquiring each active transaction ID written on each variable in the read set and the write set.
[0146] Step 602 can also be understood as the node device starting preparation work upon occurrence of each operation of the target transaction and entering the preparation stage of the target transaction, where the preparation stage properly performs the preparation work before performing transaction parallel access control anomaly verification to determine whether the transaction T can be committed, and the node device logs out from the critical domain after finding the transaction ID of at least one candidate parallel transaction in the critical domain.
[0147] It should be noted that step 602 is also a preparatory step for step 501 above, and is used to screen at least one candidate parallel transaction.
[0148] Step 603: The node device determines a parallel transaction of the target transaction from at least one candidate parallel transaction, where the parallel transaction and the target transaction include read and write operations acting on the same variable.
[0149] In an embodiment of the present application, the node device obtains at least one candidate parallel transaction of the target transaction when each operation of the target transaction occurs, and for any one of the at least one candidate parallel transaction, the node device determines whether the candidate parallel transaction is a parallel transaction of the target transaction according to the read set and write set of the candidate parallel transaction and the target transaction. If a read / write operation acting on the same variable is included between the candidate parallel transaction and the target transaction, the node device determines the candidate parallel transaction as a parallel transaction of the target transaction and executes steps 604 to 607; otherwise, the node device re-adds the candidate parallel transaction to the tail of the TypeScript TS.
[0150] Here, the node device performs a consistency check based on serializability theory by determining whether or not a conflict cycle graph is formed between the at least one candidate parallel transaction and the target transaction. The process of performing step 603 will be described in detail below by taking any one candidate parallel transaction in TypeScript TS as an example. Here, the process of performing step 603 includes steps 6031 to 6035, and each step will be described below.
[0151] Step 6031: The node device obtains a first candidate intersection between the read set of the target transaction and the write set of the candidate parallel transaction, a second candidate intersection between the write set of the target transaction and the read set of the candidate parallel transaction, and a third candidate intersection between the write set of the target transaction and the write set of the candidate parallel transaction.
[0152] Here, when the target transaction is T and the candidate parallel transaction is TL, the node device sets the number of directed edges between the target transaction T and the candidate parallel transaction TL to 0, sets the number of version changes of the same variables acted upon by the target transaction and the candidate parallel transaction to 0, and sets the target variable list to an empty set. Here, the number of directed edges is used to represent whether there is a conflict between the target transaction and the candidate parallel transaction, the number of version changes is used to represent the data states of the target transaction and the same variables acted upon by the candidate parallel transaction, and the target variable list is used to store the same variables acted upon by the target transaction and the candidate parallel transaction.
[0153] In an embodiment of the present application, a node device represents the number of directed edges with a dynamic line intersection value (DLI), represents the number of version changes with a variable state value (VS), and represents the target variable list with a variable list (VL), i.e., DLI=0, VS=0, and VL=empty set.
[0154] In the embodiment of the present application, the first candidate intersection set is represented as "S1 = DSR(T) ∩ DSW(TL)", the second candidate intersection set is represented as "S2 = DSR(TL) ∩ DSW(T)", and the third candidate intersection set is represented as "S3 = DSW(T) ∩ DSW(TL)".
[0155] In an embodiment of the present application, when the node device obtains the first candidate intersection set, the second candidate intersection set, and the third candidate intersection set, the node device may use a hash table to store the read / write sets of the target transaction and each of the candidate parallel transactions, thereby enabling the corresponding intersection sets to be obtained within linear time complexity.
[0156] Step 6032: If the union among the first candidate intersection set, the second candidate intersection set, and the third candidate intersection set is an empty set, the node device adds the candidate parallel transaction to the tail of the typescript TS again, and if there is at least one item among the first candidate intersection set, the second candidate intersection set, and the third candidate intersection set that is not an empty set, the node device executes the following steps 6033 to 6035.
[0157] Here, it is explained that if the union among the first candidate intersection set, the second candidate intersection set, and the third candidate intersection set is an empty set (i.e., the first intersection set, the second intersection set, and the third intersection set are all empty sets), the candidate parallel transaction is not a parallel transaction of the target transaction. It is explained that if there is at least one item among the first candidate intersection set, the second candidate intersection set, and the third candidate intersection set that is not an empty set, the candidate parallel transaction is a parallel transaction of the target transaction. The node device determines the candidate parallel transaction as a parallel transaction of the target transaction, i.e., a parallel transaction related to this step 603, and executes the following steps 6033 to 6035. In addition, when the node device determines that the candidate parallel transaction is a parallel transaction of the target transaction, the first candidate intersection set is the first intersection set, the second candidate intersection set is the second intersection set, and the third candidate intersection set is the third intersection set.
[0158] Steps 6033 to 6035 will be described below by taking as an example the candidate parallel transaction as the determined parallel transaction.
[0159] Step 6033: If the first intersection is not an empty set, the node device performs an increment process on the number of directed edges and adds the variables in the first intersection to the target variable list, and if there are variables with different versions in the first intersection, the node device performs an increment process on the number of version changes.
[0160] Here, the increment process refers to incrementing the corresponding value by 1. For example, the quantity of directed edges is DLI and the number of version changes is VS, and the above two types of increment processes are expressed as DLI=DLI++ and VS=VS++, respectively. In addition, the addition of variables in the first common set by a node device to the target variable list refers to orderly adding variables to the target variable list according to a preset order.
[0161] Step 6034: If the second intersection set is not empty, the node device performs increment processing on the number of directed edges and adds the variables in the second intersection set to the target variable list, and if there are variables with different versions in the second intersection set, the node device performs increment processing on the number of version changes.
[0162] Here, step 6034 and the above step 6033 are similar in implementation process, so they are not repeated here again.
[0163] Step 6035: If the third intersection is not an empty set, the node device determines a data anomaly type based on the commit status of the parallel transactions, and if the third intersection is an empty set, the node device executes the subsequent step 604.
[0164] Here, if the third intersection is not an empty set, it indicates that a write conflict occurs between the target transaction and the parallel transaction. A write conflict is one of the causes of data error under the data consistency state model, that is, a dirty write data anomaly is prohibited. Therefore, in this case, the node device determines a data anomaly type based on the commit state of the parallel transaction, reports the occurrence of a write anomaly, terminates the current process, and performs a rollback for the target transaction. When the third intersection is an empty set, it indicates that no write conflict occurs, and the node device performs the following step 604.
[0165] In some embodiments, if the parallel transaction is not committed and the target parameter T.no_committed of the target transaction is 1, the node device determines that the data anomaly type is a dirty write anomaly. Here, the target parameter T.no_committed is used to represent the number of committed transactions corresponding to the read / write set of the target transaction. In the process of a cycle, if there is no data anomaly between the previous parallel transaction and the target transaction, the previous parallel transaction needs to be merged with the target transaction before executing the current cycle, and the new transaction obtained after the merge is determined as the target transaction of the current cycle, and the merge can be realized by merging the read / write sets of the two transactions. Therefore, in any one cycle, the read / write set of the target transaction may be the read / write set after the merge, and when the read / write set of the target transaction includes a component of the read / write set of the transaction that has already been committed, the target parameter T.no_committed is used to describe the number of committed transactions corresponding to the read / write set.
[0166] In some embodiments, if the parallel transactions are committed and the intersection between the first intersection and the third intersection is not an empty set, then determine that the data anomaly type is a lost update anomaly.
[0167] For example, the first intersection set, the second intersection set, and the third intersection set are respectively represented as S1, S2, and S3. If S3!=[Number 2], when any one of the following conditions is met, the node device determines the data anomaly type, reports the occurrence of a write anomaly, and terminates the cycle. Here, the conditions to be met include: 1) the commitment of the parallel transaction is not completed and the target parameter of the target transaction is T.no_committed=1, at which time a write conflict is constituted and the data anomaly type is a dirty write anomaly; and 2) the parallel transaction has already been committed and S1∩S3 is not an empty set, at which time the data anomaly type is a lost update anomaly.
[0168]
number
[0169] It should be noted that the node devices may execute the above steps 6031 to 6035 synchronously, or may execute the above steps 6031 to 6035 in any order, and the embodiment of the present application is not limited thereto.
[0170] In the above step 603, the node device determines a parallel transaction of the target transaction from at least one candidate parallel transaction, and if the third intersection between the target transaction and the parallel transactions is an empty set, the node device executes the following step 604.
[0171] Step 604: If there is at least one non-empty item among the first intersection set and the second intersection set, and the target transaction conflicts with the parallel transaction, the node device determines a data anomaly type based on the version change counts of the same variables acted upon by the target transaction and the parallel transaction, and a target variable list, where the target variable list includes the same variables acted upon by the target transaction and the parallel transaction.
[0172] Here, the existence of at least one term that is not an empty set among the first intersection set and the second intersection set includes the following three cases: 1) the first intersection set is not an empty set, but the second intersection set is an empty set; 2) the first intersection set is an empty set, but the second intersection set is not an empty set; 3) the first intersection set is not an empty set, and the second intersection set is not an empty set. If the first intersection set and the second intersection set satisfy any one of the above three cases and the target transaction conflicts with the parallel transaction, the node device determines a data anomaly type based on the number of version changes and the target variable list. Here, the node device determines whether the target transaction conflicts with the parallel transaction based on the number of directed edges between the target transaction and the parallel transaction, i.e., if the number of directed edges between the target transaction and the parallel transaction is 2 or more, it determines that the target transaction conflicts with the parallel transaction.
[0173] The process of determining the data anomaly type in step 604 will be described below. First, the categories, subcategories and isolation levels of the data anomaly types in the embodiment of the present application are respectively introduced according to the following four points:
[0174] The first point is the category to which the data anomaly type belongs.
[0175] In the embodiment of the present application, the categories to which the data anomaly types belong include a write anomaly category (WAT), a read anomaly category (RAT), and an intersect anomaly category (IAT).
[0176] Here, if there are at least two (referred to as a first specified quantity) write operations acting on the same variable of different versions in a schedule (referred to as satisfying the write anomaly condition), the category to which the data anomaly type belongs is the write anomaly category, if there are not at least two write operations acting on the same variable of different versions in a schedule (referred to as not satisfying the write anomaly condition), and there are read operations and write operations acting on the same variable of the same version in the schedule (referred to as satisfying the read anomaly condition), the category to which the data anomaly type belongs is the read anomaly category. If there are not at least two write operations acting on the same variable of different versions in a schedule (referred to as not satisfying the write anomaly condition), and there are not read operations and write operations acting on the same variable of the same version in the schedule (referred to as not satisfying the read anomaly condition), and there are read operations and write operations acting on the same variable of different versions in the schedule (referred to as satisfying the cross anomaly condition), the category to which the data anomaly type belongs is the cross anomaly category.
[0177] In the following, by combining the symbols and corresponding meanings shown in Table 1 above, we will define ∃T i ,T j If i ∈ TS(s) and i ≠ j, the category to which the data anomaly type belongs can be expressed in the following three forms, which are explained below.
[0178] 1, Write anomaly category.
[0179] If <Ti ,T j >∈E=W i [x m ]W j [x m+1 ], then a data anomaly exists in the schedule s, and the category to which the data anomaly type belongs is the write anomaly category.
[0180] 2, read abnormality category.
[0181] If∀ <T i ,T j >∈E≠W i [x m ]W j [x m+1 ] and ∃ <T i ,T j >∈E=W i [x m ]R j [x m ], then a data anomaly exists in the schedule s, and the category to which the data anomaly type belongs is the read anomaly category.
[0182] 3, cross-abnormal category.
[0183] If <T i ,T j >∈E≠W i [x m ]W j [x m+1 ] and ∀ <T i ,T j >∈E≠W i [x m ]R j [x m ] and ∃ <T i ,T j >∈E=R i [x m ]W j [x m+1 ], then a data anomaly exists in the schedule s, and the category to which the data anomaly type belongs is the cross anomaly category.
[0184] The second point is the subcategory of data anomaly types.
[0185] In the embodiment of the present application, the first point describes the difference according to the conflict, and divides the data anomaly types into three categories: write anomaly category, read anomaly category, and cross anomaly category. Here, in order to improve the accuracy of data anomaly identification, the data anomaly types are continuously classified to obtain subcategories.
[0186] Here, if one data anomaly occurs on the same variable, the subcategory of the data anomaly type's category belongs to Single-Meta Data Anomalies (SDA); if one data anomaly occurs on two variables (referred to as the third specified quantity), the subcategory of the data anomaly type's category belongs to Double-Meta Data Anomalies (DDA); and if one data anomaly does not belong to the above two subcategories, the subcategory of the data anomaly type's category belongs to Multi-Meta Data Anomalies (MDA).
[0187] As an example, assuming that the number of variables in one data anomaly (DA, abbreviated as da) is represented as NV and the number of transactions is represented as NT, the combination of NV and NT is called a data anomaly feature, and Cda = (NV, NT) is written. The subcategories of the above data anomaly types are represented as the following three cases, which are explained below.
[0188] 1. Single metadata abnormality.
[0189] If Cda=(1,2), a data anomaly occurs on one variable in two transactions, in which case the subcategory in the data anomaly type's category belongs to single metadata anomaly.
[0190] 2. Double metadata abnormality.
[0191] If Cda=(2,2), a data anomaly occurs on two variables in two transactions, and in this case, the subcategory in the category of the data anomaly type belongs to double metadata anomaly.
[0192] 3. Multi-metadata abnormality.
[0193] If Cda ≠ (1,2) and Cda ≠ (2,2), the subcategory in the data anomaly type's belonging category belongs to the multi-metadata anomaly.
[0194] The third point is the subclassification of data anomaly types.
[0195] In the embodiment of the present application, according to the classification shown in the above first point (category to which data anomaly type belongs) and second point (subcategory of data anomaly type), the category, name, corresponding formalized expression, corresponding CCG graph, and corresponding subcategory of various finely classified data anomalies are given. Specifically, as shown in Table 2 and Figs. 7 to 9. Here, Fig. 7 is a schematic diagram of a single metadata anomaly CCG graph provided by the embodiment of the present application. Fig. 8 is a schematic diagram of a double metadata anomaly CCG graph provided by the embodiment of the present application. Fig. 9 is a schematic diagram of a multi metadata anomaly CCG graph provided by the embodiment of the present application.
[0196] [Table 2]
[0197] What needs to be explained is that for the relevant descriptions of the schematic diagrams of the CCG graphs shown in Figures 7 to 9, reference can be made to the description paragraphs corresponding to Figures 2 to 4, and the embodiments of the present application will not be described again here.
[0198] It is necessary to note that the occurrence probability of multiple metadata anomalies is relatively low compared to single metadata anomalies and double metadata anomalies. Hereinafter, a schedule expression corresponding to the multiple metadata anomaly CCG graph shown in FIG. 9 will be exemplarily described.
[0199] As shown in graph (a) in Figure 9, in the conflict cycle graph 9-1, there is a staircase write anomaly, and the schedule expression of the staircase write anomaly is s = R1[x0]W2[x1]W2[y1]W3[y2]R3[z0]W1[z1], and the schedule includes a WW conflict.
[0200] As shown in graph (b) in Figure 9, in the conflict loop graph 9-2, there is a staircase read anomaly, and the schedule expression of the staircase read anomaly is s = R1[x0]W2[x1]W2[y1]R3[y1]R3[z0]W1[z1], and the schedule includes a WR conflict but does not include a WW conflict.
[0201] As shown in graph (c) in Figure 9, in the conflict cycle graph 9-3, there is a step-wise crossing anomaly, and the schedule expression of the step-wise crossing anomaly is s = R1[x0]W2[x1]R2[y0]W3[y1]R3[z0]W1[z1]. The schedule includes RW conflicts, but does not include WW conflicts or WR conflicts.
[0202] The fourth point is the isolation level of data anomaly types.
[0203] In the embodiment of the present application, two kinds of isolation levels are provided according to the subclassification of data anomalies shown in the third point above, namely, No Read-Write Anomalies (NRW) and No Anomalies (NA). Here, the basis for grading the isolation levels is the degree to which data anomalies are permitted to appear, and the isolation levels enable the complexity of parallel access control processing to be reduced. Here, NRW refers to not permitting the appearance of data anomalies of WAT and RAT types, but not removing data anomalies of IAT types, and NA refers to not permitting the occurrence of any data anomalies, which is equivalent to the serializable isolation level defined by the ANSI-SQL standard. Therefore, the NRW level is lower than the NA level.
[0204] The levels of isolation provided by the examples of the present application are described below with reference to Table 3.
[0205] [Table 3]
[0206] It should be noted that the node device determines the parallel access control process based on the isolation level related information described in Table 3.
[0207] In the embodiment of the present application, the node device sets rules according to the isolation levels described in Table 3 to avoid occurrence of data anomalies and to reach the NRW level. For example, a rule for prohibiting the occurrence of WW edges is adopted to avoid occurrence of WAT anomalies, and for example, a method such as read committed or snapshot read is adopted to avoid occurrence of RAT anomalies. In this way, the number of layers of isolation levels can be reduced, and the efficiency of parallel access control processing can be improved. For example, the Serializable Snapshot Isolation (SSI) technology can be adopted to identify whether anomalies occur on two consecutive RW edges, thereby reaching the NA level, and thus improving the efficiency of parallel access control processing.
[0208] The above four points describe the categories, subcategories, and isolation levels of the data anomaly types in the embodiment of the present application, and the implementation process of step 604 will be described in detail below based on the information described in the above four points. Here, step 604 includes steps 6041 to 6043, and each step will be described below.
[0209] Step 6041: The node device determines the category to which the target transaction belongs based on the read / write operations that act on the same variable in the target transaction and the parallel transaction.
[0210] Here, the category to which the data anomaly type belongs refers to the category to which the data anomaly type belongs. Step 6041 includes the following three cases, which will be described below.
[0211] Case 1: If there are a first specified number (eg, two) of write operations acting on the same variable in different versions in the target transaction and the parallel transaction, the node device determines that the belonging category is the write anomaly category.
[0212] Exemplarily, the target transaction is T i and the parallel transaction is T j And if ∃ <T i ,T j >∈E=W i [x m ]W j [x m+1 ], the node device determines that the category to which it belongs is the writing abnormality category.
[0213] Case 2: If there are no two write operations that operate on the same variable of different versions in the target transaction and the parallel transaction, and there are a read operation and a write operation that operate on the same variable of the same version in the target transaction and the parallel transaction, the node device determines that the category to which it belongs is the read anomaly category.
[0214] Exemplarily, the target transaction is T i and the parallel transaction is T j Assume that, if ∀ <T i ,T j >∈E≠W i [x m ]W j [x m+1 ] and ∃ <T i ,T j >∈E=W i [x m ]R j [x m ], the node device determines that the category to which it belongs is the reading abnormality category.
[0215] Case 3: If there are no two write operations that operate on the same variable of different versions in the target transaction and the parallel transaction, and there are no read operations and write operations that operate on the same variable of the same version in the target transaction and the parallel transaction, and there are read operations and write operations that operate on the same variable of different versions in the target transaction and the parallel transaction, the node device determines that the category to which it belongs is the intersection anomaly category.
[0216] Exemplarily, the target transaction is T i and the parallel transaction is T j Assume that, if ∀ <T i ,T j >∈E≠W i [x m ]W j [x m+1 ] and ∀ <T i ,T j >∈E≠W i [x m ]R j [x m ] and ∃ <T i ,T j >∈E=R i [x m ]W j [x m+1 ], the node device determines that the category to which it belongs is an intersection abnormal category.
[0217] Step 6042: The node device determines the category to which the data anomaly type belongs and a subcategory in the category based on the target variable list.
[0218] As is clear from step 603, the target transaction and the same variables acted upon by the parallel transaction are stored in the target variable list. That is, the node device obtains the quantity of the target transaction and the same variables acted upon by the parallel transaction based on the target variable list, and combines the descriptions of the three subcategories to determine the subcategories in the belonging category.
[0219] For example, step 6042 includes the following three cases, which will be described below.
[0220] Case 1: If the quantity of variables in the target variable list is a second specified quantity (eg, one), the node device determines that the subcategory in the belonging category belongs to a single metadata anomaly.
[0221] Case 2: If the quantity of variables in the target variable list is a third specified quantity (eg, two), the node device determines that the subcategory in the belonging category belongs to a double metadata anomaly.
[0222] Case 3: If the quantity of a variable in the target variable list is a fourth specified quantity, where the fourth specified quantity is different from both the second specified quantity and the third specified quantity, that is, the subcategory in the belonging category not only does not belong to the single metadata anomaly but also does not belong to the double metadata anomaly, the node device determines that the subcategory in the belonging category belongs to a multi-metadata anomaly.
[0223] Step 6043: The node device determines a data anomaly type based on the subcategory in the category to which it belongs, the number of version changes, and the read / write operations acting on the same variable in the parallel transaction and the target transaction.
[0224] Here, as is clear from the above step 603, the version change count is used to represent the data state of the same variable acted upon by the target transaction and the parallel transaction. Also, as is clear from the above [Table 2], the version change counts corresponding to different data anomalies and the read / write operations of the two transactions acting upon the same variable are different, therefore, in this step 6043, the node device determines the data anomaly type based on the version change count and the read / write operations acting upon the same variable in the parallel transaction and the target transaction.
[0225] For illustrative purposes, eight different scenes are taken as examples to respectively describe the process of performing step 6043.
[0226] Scene 1: If the category is a writing abnormality category and the subcategory is a single metadata abnormality, this step 6043 includes the following three cases, which are described below.
[0227] 1) If the version change count is 1, the node device determines that the data anomaly type is a lost self-update anomaly.
[0228] 2) If the version change count is 2 and there are a fifth specified number (e.g., three) of write operations acting on the same variable in the target transaction and the parallel transaction, the node device determines that the data anomaly type is an all-write anomaly.
[0229] 3) If the version change count is 2, and there are two write operations acting on the same variable in the target transaction and the parallel transaction, and a sixth specified number (e.g., one) of read operations, the node device determines that the data anomaly type is a lost update anomaly.
[0230] Scene 2: If the category of the data anomaly type is a writing anomaly category and the subcategory is a double metadata anomaly, step 6043 includes the following three cases, which are described below.
[0231] 1) If the version change count is 1, and there is a write operation and a read operation acting on a first variable of different versions in the target transaction and the parallel transaction (referred to as satisfying the first condition), and there are two write operations acting on a second variable of different versions (referred to as satisfying the second condition), the node device determines that the data anomaly type is a read / write partial order anomaly, where satisfying the first condition refers to the target read / write operation including a write operation and a read operation acting on a first variable of different versions, and satisfying the second condition refers to the target read / write operation including a first specified number of write operations acting on a second variable of different versions.
[0232] 2) If the version change count is 1, and there is a write operation and a read operation that operate on the same version of the first variable in the target transaction and the parallel transaction (referred to as satisfying the third condition), and there are two write operations that operate on different versions of the second variable (referred to as satisfying the second condition), the node device determines that the data anomaly type is a repeatable write partial order anomaly, where satisfying the third condition means that the target read / write operation includes a write operation and a read operation that operate on the same version of the first variable.
[0233] 3) if the version change count is 1, and there are two write operations operating on different versions of a first variable in the target transaction and the parallel transaction (referred to as satisfying the fourth condition), and there are two write operations operating on different versions of a second variable in the target transaction and the parallel transaction (referred to as satisfying the second condition), the node device determines that the data anomaly type is a full-write partial order anomaly, where satisfying the fourth condition refers to the target read / write operation including a first specified number of write operations operating on different versions of a first variable.
[0234] Scene 3: If the category of the data anomaly type is a read anomaly category and the subcategory is a single metadata anomaly, step 6043 includes the following two cases, which are described below.
[0235] 1) If the version change count is 1, and there are two read operations and one write operation that affect the same variable in the target transaction and the parallel transaction, the node device determines that the data anomaly type is a non-repeatable read anomaly.
[0236] 2) If the version change count is 1, and there are two write operations and one read operation acting on the same variable in the target transaction and the parallel transaction, the node device determines that the data anomaly type is an intermediate read anomaly.
[0237] Scene 4: If the category of the data anomaly type is a read anomaly category and the subcategory is a double metadata anomaly, step 6043 includes the following two cases, which are described below.
[0238] 1) If the version change count is the seventh specified quantity (for example, zero), the node device determines that the data anomaly type is a write / read partial order anomaly.
[0239] 2) If the version change count is 1, the node device determines that the data anomaly type is a read partial order anomaly.
[0240] Scene 5: If the category of the data anomaly type is an intersection anomaly category and the subcategory is a double metadata anomaly, this step 6043 includes: if the version change count is 1, the node device determines that the data anomaly type is a write partial order anomaly.
[0241] Scene 6: If the category of the data anomaly type is a write anomaly category and the subcategory is a multi-metadata anomaly, this step 6043 includes the node device determining that the data anomaly type is a staircase write anomaly.
[0242] Scene 7: If the category of the data anomaly type is a read anomaly category and the subcategory is a multi-metadata anomaly, this step 6043 includes the node device determining that the data anomaly type is a staircase read anomaly.
[0243] Scene 8: If the category of the data anomaly type is an intersection anomaly category and the subcategory is a multi-metadata anomaly, this step 6043 includes: the node device determines that the data anomaly type is a staircase intersection anomaly.
[0244] It is necessary to explain that the node device executes steps 6041 to 6043 in the following order, that is, the node device first determines the category to which the data abnormality type belongs, then determines the subcategory, and finally determines the finely classified data abnormality type. In some embodiments, the above steps 6041 to 6043 are replaced with the following steps 1 to 3.
[0245] Step 1: The node device determines a subcategory based on the target variable list.
[0246] Step 2: The node device determines a category to which the target transaction and the parallel transaction belong based on the read / write operations that affect the same variable.
[0247] Step 3: The node device determines the data anomaly type based on the subcategory in the category to which the data belongs, the number of version changes, and the read / write operations that affect the same variable in the parallel transaction and the target transaction.
[0248] That is, the node device first determines the subcategory of the data abnormality type, then determines the category to which the data abnormality belongs, and finally determines the finely classified data abnormality type.
[0249] In some embodiments, the node device may further synchronously determine the category and subcategory to which the data anomaly type belongs, and the embodiments of the present application are not limited in this regard.
[0250] After the node device determines the data anomaly type through the above step 604, the node device executes the following steps 605 to 607. It should be noted that if there is at least one item that is not an empty set among the first intersection set and the second intersection set, and the target transaction does not conflict with the parallel transaction, the node device executes the following step 608.
[0251] Step 605: The node device determines which transaction should be rolled back from the target transaction and the parallel transactions.
[0252] In the embodiment of the present application, in step 604, the node device determines that a data anomaly has occurred, and that it is necessary to roll back the target transaction or the parallel transaction, and determines which of the two transactions should be rolled back.
[0253] Two alternative embodiments for this step 605 are described below.
[0254] Method 1: The node device determines, according to the transaction priority, the transaction with the lowest transaction priority among the target transaction and the parallel transactions as the transaction to be rolled back.
[0255] In the embodiment of the present application, the transaction priority is a preset priority, and the database system pre-assigns a transaction priority to each type of transaction, for example, the transaction priority of each transaction is determined according to at least one of the transaction processing period, the transaction operation type, and the number of variables acted upon, but the embodiment of the present application does not limit the manner of setting the transaction priority.
[0256] As an example, an embodiment of step 605 will be described below using four types of transaction priority setting methods as examples.
[0257] First, if the processing period of the current transaction among the target transaction and the parallel transaction is less than the processing period of the other transactions, the node device determines the current transaction as the transaction with the lowest transaction priority, so that the transaction to be rolled back is the current transaction.
[0258] Here, the transaction priority is determined according to the transaction processing period. A transaction whose processing period is greater than the reference period is determined as a long transaction, and a transaction whose processing period is equal to or less than the reference period is determined as a short transaction. The transaction priority of a long transaction is higher than the transaction priority of a short transaction. Here, the current transaction is either the target transaction or one of the parallel transactions, and the other transactions are the target transaction and the parallel transactions other than the current transaction.
[0259] Illustratively, for a target transaction, the processing period of the parallel transaction is used as a reference period, and if the processing period of the target transaction is less than the parallel transaction, the node device determines the target transaction as a transaction to be rolled back, and if not, determines the parallel transaction as a transaction to be rolled back.
[0260] Second, if the target transaction and any one of the parallel transactions are read transactions, the node device determines the read transaction as the transaction with the lowest transaction priority, and thus the transaction to be rolled back is the read transaction.
[0261] Here, the transaction priority is determined according to the operation type of the transaction, and the transaction priority of a write transaction is higher than the transaction priority of a read transaction, where the operation type of the transaction includes a write transaction type and a read transaction type, and a transaction of a write transaction type is a write transaction and a transaction of a read type is a read transaction.
[0262] Exemplarily, if the target transaction is a write transaction and the parallel transaction is a read transaction, the node device determines the target transaction as the transaction to be rolled back.
[0263] As a third type, if the target transaction and the current transaction among the parallel transactions are write transactions, and the processing period of the write transaction is less than the reference period, the node device determines the write transaction as the transaction with the lowest transaction priority, so that the transaction to be rolled back is the current transaction.
[0264] Here, the transaction priority is determined by combining the transaction processing period and the operation type. That is, when a write transaction is a short transaction, its transaction priority is lower than a long read transaction. Illustratively, if the target transaction is a write transaction and the processing period of the target transaction is less than the reference period, the node device determines the target transaction as a transaction to be rolled back.
[0265] It is to be noted that in some embodiments, the transaction priority setting scheme can have other forms, such as the transaction priority of a short transaction being higher than the transaction priority of a long transaction, and the transaction priority of a read transaction being higher than the transaction priority of a write transaction, but the embodiments of the present application are not limited thereto.
[0266] As can be seen, such a method of determining which transactions to roll back based on transaction priority allows transactions to be rolled back appropriately and ensures that important transactions are processed preferentially, thereby improving utilization of computing resources and improving efficiency of transaction processing.
[0267] Fourth, if the variable quantity affected by the current transaction among the target transaction and the parallel transaction is greater than the variable quantity affected by the other transaction, the node device determines the current transaction as the transaction with the lowest transaction priority, so that the transaction to be rolled back is the current transaction.
[0268] In an embodiment of the present application, the node device traverses the target conflict cycle graph of the target transaction and the parallel transactions (the introduction of the target conflict cycle graph will be introduced later in step 607 and will not be repeated here), and when the current transaction has affected the largest number of variables, it determines the current transaction as the transaction to be rolled back.
[0269] Such an optional embodiment allows for rolling back transactions involving a relatively large number of variables to reduce the likelihood of conflicts with other transactions in subsequent transaction processing, thereby reducing transaction processing conflict rates and improving transaction processing efficiency.
[0270] Method 2: The node device randomly selects a transaction from the target transaction and parallel transactions and determines that the transaction should be rolled back.
[0271] Step 606: The node device rolls back the transaction that should be rolled back.
[0272] What needs to be explained is that, through steps 601 to 606 above, the node device determines whether or not the target transaction and the parallel transaction constitute a conflict, and determines the transaction to be rolled back only if a data abnormality exists.
[0273] As can be understood, when the node device determines which transaction should be rolled back, it does not directly roll back the target transaction, but determines according to a predetermined strategy, thus enabling to effectively reduce the false rollback rate, thereby improving the utilization rate of computing resources and improving the efficiency of transaction processing.
[0274] Step 607: The node device deletes the variables affected by the transaction to be rolled back in the target conflict cycle graph and the corresponding read / write operations, where the vertices in the target conflict cycle graph are used to represent transaction identifiers corresponding to transactions and variables affected by read / write operations corresponding to transactions, and the edges in the target conflict cycle graph are used to represent association relationships between transactions and version changes between variables.
[0275] In the embodiment of the present application, the target conflict cycle graph is a kind of Detail Conflict Cycle Graph (DCCG), which is a kind of conflict cycle graph equivalent to the CCG graph and the CCSG graph, and is also the implementation basis of the data state consistency model in the embodiment of the present application. In the above step 606, after rolling back the transaction to be rolled back, the node device deletes the variables affected by the transaction to be rolled back in the target conflict cycle graph and the corresponding read and write operations, so as to maintain the structure of the target conflict cycle graph.
[0276] The method for obtaining the target conflict cycle graph will be described in detail below. The following steps include step 1 to step 3, and each step will be described below.
[0277] Step 1: obtain a first conflict cycle graph between the target transaction and the parallel transaction, where the vertices in the first conflict cycle graph are used to represent transaction identifiers corresponding to transactions, and the edges in the first conflict cycle graph are used to represent association relationships between transactions and variables affected by read and write operations corresponding to transactions.
[0278] Here, the first conflict cycle graph is a CCG graph between the target transaction and the parallel transaction. For the meanings of the vertices and edges in the first conflict cycle graph, please refer to the above introduction of the vertices and edges of the CCG graph, and we will not repeat the description here.
[0279] Step 2: Transform the first conflict cycle graph to obtain a second conflict cycle graph, in which vertices represent multiple different versions of variables, and edges represent version changes between variables and variables affected by the same transaction.
[0280] Here, the second conflict cycle graph is a CCSG graph between the target transaction and the parallel transaction. The meanings of the vertices and edges in the second conflict cycle graph can be referred to the above introduction of the vertices and edges of the CCSG graph, and will not be described again here. As is clear from the above introduction of the CCG graph and the CCSG graph, the CCG graph is equivalent to the CCSG graph, and the following briefly describes an embodiment of this step 2 based on the equivalent conversion rule from the CCG graph to the CCSG graph. The following step A and step B are included, and each step will be described below.
[0281] Step A: Split the edges of the first conflict cycle graph to obtain the multiple different versions of the variables.
[0282] Step B: Using the variables of the different versions as vertices, add edges between vertices corresponding to the same variables of adjacent versions, and add edges between vertices corresponding to variables affected by the same transaction to obtain the second conflict cycle graph.
[0283] Step 3: Transform the second conflict cycle graph to obtain the target conflict cycle graph.
[0284] Here, based on the above introduction of CCG graph and CCSG graph, it is clear that CCG graph is equivalent to CCSG graph, CCSG graph can be equivalently transformed into CCG graph, and the target conflict cycle graph is a new CCG graph obtained by transforming CCSG graph. In the above first conflict cycle graph, the vertices in the first conflict cycle graph are used to represent transaction identifiers corresponding to transactions. Meanwhile, in the target conflict cycle graph (i.e., the new CCG graph), the vertex information of the target conflict cycle graph is more finely divided than the vertex information in the first conflict cycle graph, and not only includes transaction identifiers corresponding to transactions, but also includes variables acted on by read / write operations corresponding to transactions. In addition, the variables corresponding to the vertices of the target conflict cycle graph remain necessary variables to construct a conflict cycle, and although the variables operated by one transaction may be very large, all variables and their versions are not sufficient conditions to construct a conflict cycle graph.
[0285] Below, a specific embodiment of this step 3 will be described based on the above equivalent conversion rules from a CCSG graph to a CCG graph. The following steps C to E are included, and each step will be described below.
[0286] Step C: Merge the vertices corresponding to the variables affected by the same transaction in the second conflict cycle graph, and determine the transaction identifier corresponding to the same transaction as the merged vertex, i.e., the node device names the merged vertex as the transaction identifier corresponding to the same transaction.
[0287] Step D: Add edges between adjacent vertices of the second conflict cycle graph after the merger to obtain a third conflict cycle graph.
[0288] Step E: If the same version of the variable exists between any two adjacent vertices in the third conflict cycle graph, merge the two adjacent vertices and delete the same version of the variable corresponding to the merged vertex to obtain the target conflict cycle graph. If different versions of the same variable exist between any two adjacent vertices in the third conflict cycle graph, merge the two adjacent vertices to obtain the target conflict cycle graph.
[0289] Here, the third conflict cycle graph is a CCG graph obtained by performing transformation on the CCSG graph according to the equivalent transformation rule, and in the third conflict cycle graph, if the same version of a variable exists in any two adjacent vertices, the third conflict cycle graph is applied to the contraction rule, so that the node device merges the two vertices and deletes the same version of the variable. If the same variable exists in different versions in any two adjacent vertices, the third conflict cycle graph is applied to the merge rule but not to the contraction rule, so that the node device merges the two vertices. If the same variable does not exist in any two adjacent vertices, the node device directly takes the third conflict cycle graph as the target conflict cycle graph.
[0290] The above contraction rules and merger rules are introduced below.
[0291] First, reduction rules.
[0292] For any two adjacent vertices V in a competitive cycle graph, i and V i+1 For V i ∩V i+1 ={x m ,y n , …} ≠ [Number 3], i.e., if there exists at least one variable with the same version, then V i and V i+1 can be merged into one vertex. In the new merged vertex, x m and y n etc. can be removed, leaving the two vertices that do not intersect with each other, i.e., V i ∪V i+1 -V i ∩V i+1 That is, the new vertex after contraction is V i and V i+1 We are left with the difference of the two sets:
[0293]
number
[0294] Based on the above introduction to the target conflict cycle graph and the contraction rule, the following three inferences can be obtained, and each inference will be explained below.
[0295] Corollary 1: In a schedule s, if ∃dccg∈DCCG and the intersection of any two adjacent vertices in the dccg graph is the empty set, then the dccg is called a minimal DCCG graph, i.e., after completing the contraction of vertices that satisfy the contraction rules in the dccg graph, the obtained DCCG graph is the simplest.
[0296] Corollary 2: One minimal DCCG graph is equivalent to a certain data anomaly in Table 2 above.
[0297] Corollary 3: In a schedule s, if there exists a WR relationship between any two parallel transactions, the two parallel transactions can be applied to the reduction rule.
[0298] Second, merger rules.
[0299] For any two adjacent vertices V in a competitive cycle graph, i and V i+1 For V i ∩V i+1 = [Number 4], then these two vertices cannot be contracted. If V i ∩V i+1 = {x, y, …} ≠ [Equation 4], i.e., there is at least one identical variable, and the contraction rule does not apply to these two adjacent vertices, then these two adjacent vertices are subject to the union rule. In other words, the transactions corresponding to these two adjacent vertices are called mergeable transactions, and V i and V i+1 The read set of transactions corresponding to the new merged vertex is V i and V i+1 The write set of transactions corresponding to the new merged vertex is the union of the read sets corresponding to i and V i+1 is the union of the write sets corresponding to
[0300]
number
[0301] Moreover, based on the above introduction to the target conflict cycle graph and the merge rule, we can obtain the following inference: A data anomaly represented in the dccg graph of one schedule s does not affect the data anomaly equivalent to the original dccg graph after merging mergeable transactions.
[0302] The above is an introduction of the method of obtaining a target conflict cycle graph and the related rules. In the following, the method of obtaining a target conflict cycle graph will be described by way of example with reference to Table 4 and Fig. 10. Fig. 10 is a schematic diagram of obtaining a target conflict cycle graph provided by an embodiment of the present application. A schedule s includes three transactions T1, T2, and T3, and the execution sequence is as shown in Table 4.
[0303] [Table 4]
[0304] As shown in (a) of Figure 10, the edges in the CCG graph (i.e., the first conflict cycle graph) of the schedule s are used to represent the association relationships between transactions and the variables affected by the read and write operations corresponding to the transactions, and include three edges: E1 = (T1 → T2, R1 [x0] W2 [x1]), E2 = (T2 → T3, W2 [y1] R3 [y1]), and E3 = (T3 → T1, W3 [z1] W1 [z2]), which correspond to the three variables x, y, and z.
[0305] As shown in (b) and (c) of FIG. 10, the CCG graph includes three variables x, y, and z, which are on edges E1, E2, and E3, respectively, and the three edges are divided with the variables as vertices. For example, E1 is represented as R1[x0]W2[x1], and the edge is divided to E 11 = R1[x0], and E 12 = W2[x1], E2 is expressed as W2[y1]R3[y1], and the edge is divided to obtain E 21 = W2 [y1], and E 22 =R3[y1] is obtained, and E3 is expressed as W3[z1]W1[z2]. By dividing the edge, E 31 = W3 [z1], and E 32 = W1 [z2]. This removes a vertex from the CCG graph.
[0306] As shown in FIG. 10(d), after the edge splitting process, we obtain two versions of variable x, x0 and x1, one version of variable y, y1, and two versions of variable z, z1 and z2. These versions of variables are the vertices of the CCSG graph, with multiple versions of the same variable arranged vertically and versions of different variables affected by the same transaction arranged horizontally (it should be understood that in FIG. 10(d), we further include the initial version z0 of variable z, and only in this way can the edge E 31 Here, edges are added between vertices corresponding to the same variable in adjacent versions, and edges are added between vertices corresponding to variables acted upon by the same transaction. Also, as is clear based on the above description of the CCSG graph, the CCSG graph is a graph composed of directed cycles. In this case, edges W3[z1], W2[y1] and variable versions z0 and y0 have no effect on the construction of a directed cycle, and therefore these two edges and these two variable versions are deleted to obtain the CCSG graph shown in (e) of FIG. 10.
[0307] As shown in (e) of Figure 10, the vertices in the CCSG graph (i.e., the second conflict cycle graph) are used to represent multiple different versions of variables, and the edges in the second conflict cycle graph are used to represent version changes between variables and variables affected by the same transaction. For example, vertices V = {x0, x1, y1, z1, z2}, and E = {W2[x1], R2[x1] R2[y1], R3[y1] R3[z1], W1[z2], R1[x2] R1[x0]}, where E T ={R2[x1]R2[y1],R3[y1]R3[z1],R1[x2]R1[x0]} and Es={W2[x1],W1[z2]}.
[0308] As shown in Fig. 10(f), Fig. 10(f) is a new CCG graph (i.e., a third conflict cycle graph) obtained by converting the CCSG graph shown in Fig. 10(e). The conversion process includes a node device merging variable versions related to the same transaction in the CCSG graph into the same vertex to obtain Fig. 10(f). As shown in Fig. 10(f), each vertex is re-modified to make the transaction a vertex, showing the association relationship between the transactions. It is necessary to note that in some embodiments, the graph may further be an undirected cycle graph.
[0309] As shown in (g) of Fig. 10, vertices V2 and V3 satisfy the contraction rule, i.e., both vertices contain the same version of variable y1. Therefore, vertices V2 and V3 are merged, and variable y1 in the merged vertex is deleted to obtain the DCCG graph (i.e., target conflict cycle graph) shown in (h) of Fig. 10.
[0310] The above describes a method for obtaining a target conflict cycle graph by using an example, and can also be understood as a process for determining a directed cycle graph between parallel transactions. In step 607, after the node device determines the transaction to be rolled back, the node device maintains the structure of the target conflict cycle graph, which makes it easier to execute the next cycle subsequently, that is, performs a consistency check on other candidate parallel transactions among the at least one candidate parallel transaction.
[0311] The following describes the case where the target transaction does not conflict with a parallel transaction according to step 608.
[0312] Step 608: The node device merges the target transaction and the parallel transaction to obtain a merged target transaction, and executes the above step 603 again, continuing until the typescript TS is empty.
[0313] In the embodiment of the present application, the above step 604 can also be understood as: there is at least one non-empty item among the first intersection set and the second intersection set, the target transaction does not conflict with the parallel transaction, and a target conflict cycle graph is not formed between the target transaction and the parallel transaction. In this case, there is no data anomaly in the target transaction and the parallel transaction, and the node device merges the two transactions to obtain a merged target transaction, and continuously selects candidate parallel transactions from TypeScript TS until TypeScript TS is empty.
[0314] Hereinafter, an embodiment of this step 608 will be described taking as an example a case where the target transaction is T and the parallel transaction is TL.
[0315] The node device merges the read set of the parallel transaction TL into the read set of the target transaction T, and merges the write set of the parallel transaction TL into the write set of the target transaction T, thereby achieving transaction merging and obtaining a new transaction T-new after the merge. If the parallel transaction TL is not committed, the node device performs an increment operation on the target parameter (no_committed) of T-new, i.e., T-new.no_committed++ (increase by 1), to indicate that the new transaction obtained by the merger has a component of the read / write set of a transaction that has already been committed. Based on this, the node device determines T-new as a new target transaction T' (i.e., T'=T-new), extracts a second candidate parallel transaction from the typescript TS and determines it as TL', and executes step 603 (determines whether there is a conflict between the new T-new and TL').
[0316] Step 609: If there is no data anomaly between the last one candidate parallel transaction in the typescript TS and the target transaction, the node device commits the target transaction.
[0317] In the embodiment of the present application, if there is no data anomaly between the last one candidate parallel transaction in TypeScript TS and the target transaction, it is asserted that the target transaction can be committed. Here, if the isolation level parameter=S, that is, the isolation level is serializable, then the serializable level can be satisfied; otherwise, the isolation level set by the above [Table 3] is satisfied.
[0318] All the above optional technical solutions can be adopted in any combination to form the embodiments of the present application, and will not be described one by one again here.
[0319] 11 is a structural schematic diagram of a transaction processing device provided according to an embodiment of the present application, which is used to execute the steps when the above transaction processing method is executed. As shown in FIG. 11, the transaction processing device 1100 includes a first determination module 1101 and a second determination module 1102.
[0320] The first determination module 1101 is configured to determine a parallel transaction of a target transaction, the parallel transaction and the target transaction having read and write operations acting on the same variable between them, the target transaction being a transaction to be committed; The second determination module 1102 is configured to obtain a first intersection between the read set of the target transaction and the write set of the parallel transaction, and obtain a second intersection between the write set of the target transaction and the read set of the parallel transaction, and when at least one of the first intersection and the second intersection is a non-empty data set and the target transaction conflicts with the parallel transaction, determine a data anomaly type based on the version change times of the same variable acted upon by the target transaction and the parallel transaction and a target variable list, where the target variable list includes the same variable acted upon by the target transaction and the parallel transaction.
[0321] In an embodiment of the present application, the transaction processing device 1100 further includes a third determination module and a rollback module, where the third determination module is configured to determine a transaction to be rolled back from the target transaction and the parallel transaction, and the rollback module is configured to roll back the transaction to be rolled back.
[0322] In an embodiment of the present application, the third determination module is configured to determine, based on transaction priority, a transaction having the lowest transaction priority among the target transaction and the parallel transactions as the transaction to be rolled back.
[0323] In an embodiment of the present application, the third determination module is configured to: determine the current transaction as the transaction with the lowest transaction priority when, in the target transaction and the parallel transaction, a processing period of the current transaction is less than a processing period of the other transactions, the current transaction is any one of the target transaction and the parallel transaction, and the other transactions are transactions of the target transaction and the parallel transaction other than the current transaction; determine the current transaction as the transaction with the lowest transaction priority when, in the target transaction and the parallel transaction, the current transaction is a read transaction; determine the current transaction as the transaction with the lowest transaction priority when, in the target transaction and the parallel transaction, the current transaction is a write transaction and the processing period of the current transaction is less than a reference period; and determine the current transaction as the transaction with the lowest transaction priority when, in the target transaction and the parallel transaction, a variable quantity acted upon by the current transaction is greater than a variable quantity acted upon by the other transactions.
[0324] In an embodiment of the present application, the transaction processing device 1100 further includes a deletion module, which is configured to delete variables affected by the transaction to be rolled back and corresponding read / write operations in the target conflict cycle graph, where vertices in the target conflict cycle graph are used to represent transaction identifiers corresponding to transactions and variables affected by read / write operations corresponding to transactions, and edges in the target conflict cycle graph are used to represent association relationships between transactions and version changes between variables.
[0325] In an embodiment of the present application, the transaction processing device 1100 further includes an acquisition module, configured to acquire the target conflict cycle graph between the target transaction and the parallel transaction.
[0326] In an embodiment of the present application, the acquisition module includes a sub-acquisition module, a first transformation module, and a second transformation module, the acquisition module is configured to acquire a first conflict cycle graph between the target transaction and the parallel transaction, vertices in the first conflict cycle graph are used to represent transaction identifiers corresponding to transactions, and edges in the first conflict cycle graph are used to represent association relationships between transactions and variables affected by read and write operations corresponding to transactions, the first transformation module is configured to transform the first conflict cycle graph to obtain a second conflict cycle graph, vertices in the second conflict cycle graph are used to represent multiple different versions of variables, and edges in the second conflict cycle graph are used to represent version changes between variables and variables affected by the same transaction, and the second transformation module is configured to transform the second conflict cycle graph to obtain the target conflict cycle graph.
[0327] In an embodiment of the present application, the first transformation module is configured to split edges of the first conflict cycle graph to obtain the multiple different versions of variables, and to obtain the second conflict cycle graph by using the multiple different versions of variables as vertices, and adding edges between vertices corresponding to the same variable of adjacent versions, and adding edges between vertices corresponding to variables acted upon by the same transaction.
[0328] In an embodiment of the present application, the second transformation module is configured to merge vertices corresponding to variables affected by the same transaction in the second conflict cycle graph, and determine a transaction identifier corresponding to the same transaction as a merged vertex, add an edge between adjacent vertices of the second conflict cycle graph after merger to obtain a third conflict cycle graph, when two adjacent vertices of the third conflict cycle graph contain variables of the same version, merge the two adjacent vertices and delete the variables of the same version at the merged vertex to obtain the target conflict cycle graph, and when two adjacent vertices of the third conflict cycle graph contain variables of different versions, merge the two adjacent vertices to obtain the target conflict cycle graph.
[0329] In an embodiment of the present application, the transaction processing device 1100 further includes a first processing module, a second processing module, and a third processing module, and the first processing module is configured to perform an increment process on the number of directed edges between the target transaction and the parallel transaction when the first intersection is the non-empty data set, and to add variables in the first intersection to the target variable list, and to perform an increment process on the number of version changes when the first intersection includes variables with different versions. The number of directed edges is used to indicate whether there is a conflict between the target transaction and the parallel transaction. The second processing module is configured to perform an increment process on the number of directed edges when the second intersection is the non-empty data set, and to add variables in the second intersection to the target variable list, and to perform an increment process on the number of version changes when the second intersection includes variables with different versions. The third processing module is configured to determine the data anomaly type based on a commit status of the parallel transaction when the third intersection is the non-empty data set. The third intersection is the intersection between the write set of the target transaction and the write set of the parallel transaction.
[0330] In an embodiment of the present application, the second determination module 1102 includes a first sub-determination module, a second sub-determination module, and a third sub-determination module, where the first sub-determination module is configured to determine a belonging category according to target read / write operations acting on the same variable in the target transaction and the parallel transaction. The second sub-determination module is configured to determine a subcategory in the belonging category according to target read / write operations acting on the same variable in the target transaction and the parallel transaction. The third sub-determination module is configured to determine the data anomaly type according to at least one of the subcategory in the belonging category, the version change count, and the target read / write operation.
[0331] In an embodiment of the present application, the first sub-determination module is further configured to determine that the belonging category is a write abnormality category when the target transaction and the target read / write operations in the parallel transaction satisfy a write abnormality condition. The write abnormality condition is satisfied when the target read / write operation includes a first specified number of write operations acting on the same variable in different versions, and the belonging category is determined to be a read abnormality category when the target read / write operation does not satisfy the write abnormality condition and satisfies a read abnormality condition. The read abnormality condition is satisfied when the target read / write operation includes a read operation and a write operation acting on the same variable in the same version, and the belonging category is determined to be a cross abnormality category when the target read / write operation does not satisfy the write abnormality condition and the read abnormality condition and satisfies an intersection abnormality condition. The cross abnormality condition is satisfied when the target read / write operation includes a read operation and a write operation acting on the same variable in different versions.
[0332] In an embodiment of the present application, the second sub-determination module is further configured to determine that the subcategory in the belonging category is a single metadata anomaly when the variable quantity in the target variable list is a second designated quantity, determine that the subcategory in the belonging category is a double metadata anomaly when the variable quantity in the target variable list is a third designated quantity, and determine that the subcategory in the belonging category is a multi-metadata anomaly when the variable quantity in the target variable list is a fourth designated quantity, where the fourth designated quantity is different from both the second designated quantity and the third designated quantity.
[0333] In an embodiment of the present application, when the belonging category is a write anomaly category and the subcategory is a single metadata anomaly, the third sub-determination module is further configured to determine, when the number of version changes is a second specified number, based on the write anomaly category and the single metadata anomaly, that the data anomaly type is a lost self-update anomaly; when the number of version changes is a third specified number and the target read and write operations are a fifth specified number of write operations, based on the write anomaly category and the single metadata anomaly, that the data anomaly type is a full write anomaly; and when the number of version changes is the third specified number and the target read and write operations are a first specified number of write operations and a sixth specified number of read operations, based on the write anomaly category and the single metadata anomaly, that the data anomaly type is a lost update anomaly.
[0334] In an embodiment of the present application, when the belonging category is a write anomaly category, the subcategory is a double metadata anomaly, and the version change count is a second specified quantity, the third sub-determination module further determines that the data anomaly type is a read-write partial order anomaly based on the write anomaly category, the double metadata anomaly, and the second specified quantity when the target read / write operation satisfies a first condition and a second condition. Satisfying the first condition refers to the target read and write operation including a write operation and a read operation acting on a first variable of a different version; satisfying the second condition refers to the target read and write operation including a first specified number of write operations acting on a second variable of a different version; when the target read and write operation satisfies the third condition and the second condition, determining based on the write anomaly category, the double metadata anomaly, and the second specified number that the data anomaly type is a repeatable write partial order anomaly; satisfying the third condition refers to the target read and write operation including a write operation and a read operation acting on the first variable of a same version; when the target read and write operation satisfies the fourth condition and the second condition, determining based on the write anomaly category, the double metadata anomaly, and the second specified number that the data anomaly type is a full write partial order anomaly; and satisfying the fourth condition refers to the target read and write operation including the first specified number of write operations acting on the first variable of a different version.
[0335] In an embodiment of the present application, when the belonging category is a read anomaly category, the subcategory is a single metadata anomaly, and the number of version changes is a second specified quantity, the third sub-determination module is further configured to determine that the data anomaly type is a non-repeatable read anomaly based on the read anomaly category, the single metadata anomaly, and the second specified quantity when the target read / write operations include a first specified quantity of read operations and a sixth specified quantity of write operations acting on the same variable; and to determine that the data anomaly type is an intermediate read anomaly based on the read anomaly category, the single metadata anomaly, and the second specified quantity when the target read / write operations include the first specified quantity of write operations and the sixth specified quantity of read operations acting on the same variable.
[0336] In an embodiment of the present application, when the belonging category is a read anomaly category and the subcategory is a double metadata anomaly, the third sub-determination module is further configured to determine that the data anomaly type is a write-read partial order anomaly based on the read anomaly category and the double metadata anomaly when the number of version change counts is a seventh specified quantity, and to determine that the data anomaly type is a read partial order anomaly based on the read anomaly category and the double metadata anomaly when the number of version change counts is a second specified quantity.
[0337] In an embodiment of the present application, the third sub-determination module is further configured to determine that the data anomaly type is a write partial order anomaly when the belonging category is an intersection anomaly category, the subcategory is a double metadata anomaly, and the version change count is a second specified quantity.
[0338] In an embodiment of the present application, the third sub-determination module is further configured to determine that the data anomaly type is a staircase write anomaly when the belonging category is a write anomaly category and the subcategory is a multi-metadata anomaly, determine that the data anomaly type is a staircase read anomaly when the belonging category is a read anomaly category and the subcategory is the multi-metadata anomaly, and determine that the data anomaly type is a staircase intersection anomaly when the belonging category is an intersection anomaly category and the subcategory is the multi-metadata anomaly.
[0339] It is necessary to explain that, although the transaction processing device provided in the above embodiment has been described by taking an example of the division of each functional module when processing a transaction, in actual application, the above functions can be assigned to different functional modules to be completed as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the transaction processing device provided in the embodiment of the present application belongs to the same concept as the transaction processing method, but the implementation process can be detailed by referring to the embodiment of the method, and will not be described again here.
[0340] An embodiment of the present application further provides an electronic device (e.g., a computer device), the electronic device including a processor and a memory, the memory being used to store at least one computer program, and the at least one segment of the computer program being loaded and executed by the processor to realize a transaction processing method in an embodiment of the present application.
[0341] In some embodiments, a computer program relating to an embodiment of the present application may be deployed and executed on one computer device, or may be executed on multiple computer devices located at one location, or may be executed on multiple computer devices distributed at multiple locations and connected to each other by a wired network or a wireless network, and multiple computer devices distributed at multiple locations and connected to each other by a wired network or a wireless network may constitute a blockchain system.
[0342] Taking the computer device as an example, Fig. 12 is a structural schematic diagram of a server provided according to an embodiment of the present application. The server 1200 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 1201 and one or more memories 1202. Here, at least one computer program is stored in the memory 1202, and the at least one computer program is loaded and executed by the processor 1201 to realize the transaction processing method provided by each of the above method embodiments. Of course, the server may further include components such as a wired or wireless network interface, a keyboard, and an input / output interface, which can facilitate input and output, and the server may further include other components used to realize the functions of the device, which will not be described again here.
[0343] An embodiment of the present application further provides a computer-readable storage medium, which is applied to a computer device, and at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by a processor to realize the transaction processing method of the embodiment of the present application.
[0344] An embodiment of the present application further provides a computer program product, comprising a computer program or instructions, the computer program or instructions being stored in a computer readable storage medium, a processor of a computing device reading the computer program or instructions from the computer readable storage medium, and the processor executing the computer program or instructions to cause the computing device to perform a transaction processing method provided by an embodiment of the present application.
[0345] As can be understood by those skilled in the art, the realization of all or part of the steps in the above embodiments can be completed by hardware, or can be completed by issuing instructions to related hardware by a program, and the above program can be stored in a type of computer-readable storage medium, and the above-mentioned storage medium can be a read-only memory, a magnetic disk, an optical disk, etc.
[0346] As can be understood, in the embodiments of the present application, with regard to relevant data such as user information, when the embodiments of the present application are applied to a specific product or technology, user permission or consent must be obtained, and the collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of relevant countries and regions.
[0347] The above are merely selectable embodiments of the present application, and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included within the scope of protection of the present application. [Explanation of symbols]
[0348] 101 Gateway Server 103 Distributed Memory Cluster 104 Distributed Collaborative Systems 1100 Transaction Processing Device 1101 First Decision Module 1102 Second Decision Module 1200 Server 1201 Processor 1202 Memory
Claims
1. A transaction processing method for a database system, executed by an electronic device, the method comprising: determining a parallel transaction of a target transaction, the parallel transaction and the target transaction including read and write operations that affect the same variable, the target transaction being a transaction that should be committed; obtaining a first intersection between the read set of the target transaction and the write sets of the parallel transactions, and obtaining a second intersection between the write set of the target transaction and the read sets of the parallel transactions; and when at least one of the first intersection set and the second intersection set is a non-empty data set and the target transaction conflicts with the parallel transaction, determining a data anomaly type based on the number of version changes of the same variable acted upon by the target transaction and the parallel transaction and a target variable list, the target variable list including the same variable acted upon by the target transaction and the parallel transaction.
2. The method comprises: determining a transaction to be rolled back from the target transaction and the parallel transaction; 2. The method of claim 1, further comprising the step of: performing a rollback on the transaction that is to be rolled back.
3. The step of determining which transaction to roll back from the target transaction and the parallel transaction comprises:
3. The method of claim 2, further comprising determining, based on transaction priority, a transaction having the lowest transaction priority among the target transaction and the parallel transactions as the transaction to be rolled back.
4. Prior to the step of determining, based on transaction priority, a transaction having the lowest transaction priority among the target transaction and the parallel transactions as the transaction to be rolled back, the method further comprises: determining the current transaction as the transaction with the lowest transaction priority when a processing period of the current transaction is less than a processing period of another transaction among the target transaction and the parallel transaction, the current transaction being any one of the target transaction and the parallel transaction, and the other transaction being a transaction among the target transaction and the parallel transaction other than the current transaction; determining, when the current transaction is a read transaction, the current transaction as the transaction with the lowest transaction priority among the target transaction and the parallel transaction; determining, when the current transaction is a write transaction and the processing period of the current transaction is less than a reference period, the current transaction as the transaction with the lowest transaction priority among the target transaction and the parallel transaction; determining the current transaction as the transaction with the lowest transaction priority when a variable quantity affected by the current transaction is greater than a variable quantity affected by the other transactions in the target transaction and the parallel transaction;
5. After the step of performing a rollback on the transaction to be rolled back, the method further comprises: The method according to any one of claims 2 to 4, further comprising a step of deleting variables affected by the transaction to be rolled back and corresponding read / write operations in a target conflict cycle graph, wherein vertices in the target conflict cycle graph are used to represent transaction identifiers corresponding to transactions and variables affected by read / write operations corresponding to transactions, and edges in the target conflict cycle graph are used to represent association relationships between transactions and version changes between variables.
6. The method comprises: obtaining a first conflict cycle graph between the target transaction and the parallel transaction, in which vertices in the first conflict cycle graph are used to represent transaction identifiers corresponding to the transactions, and edges in the first conflict cycle graph are used to represent association relationships between the transactions and variables acted upon by read and write operations corresponding to the transactions; performing a transformation on the first conflict cycle graph to obtain a second conflict cycle graph, in which vertices in the second conflict cycle graph are used to represent a plurality of different versions of variables, and edges in the second conflict cycle graph are used to represent version changes between variables and variables affected by the same transaction; 6. The method of claim 5, further comprising: performing a transformation on the second conflict cycle graph to obtain the target conflict cycle graph.
7. The step of performing a transformation on the first conflict cycle graph to obtain a second conflict cycle graph includes: performing a partition on the edges of the first conflict cycle graph to obtain the plurality of different versions of the variables; and obtaining the second conflict cycle graph by adding edges between vertices corresponding to the same variable of adjacent versions and between vertices corresponding to variables acted upon by the same transaction, using the variables of the different versions as vertices.
8. The step of performing a transformation on the second conflict cycle graph to obtain the target conflict cycle graph includes: merging vertices corresponding to variables acted upon by the same transaction in the second conflict cycle graph, and determining a transaction identifier corresponding to the same transaction as a vertex after the merge; adding edges between adjacent vertices of the second conflict cycle graph after the merger to obtain a third conflict cycle graph; When two adjacent vertices of the third conflict cycle graph contain variables of the same version, merging the two adjacent vertices and eliminating the variables of the same version at the vertices after the merger to obtain the target conflict cycle graph; and when two adjacent vertices of the third conflict cycle graph contain different versions of the same variable, merging the two adjacent vertices to obtain the target conflict cycle graph.
9. The method comprises: a step of incrementing a number of directed edges between the target transaction and the parallel transaction in a conflict consistency state graph composed of a plurality of transactions when the first intersection is the non-empty data set, and adding variables in the first intersection to the target variable list, and incrementing the number of version changes when the first intersection includes variables with different versions, the number of directed edges being used to indicate whether there is a conflict between the target transaction and the parallel transaction; when the second intersection is the non-empty data set, performing an increment process on the number of directed edges, and adding variables in the second intersection to the target variable list, and performing an increment process on the number of version changes if the second intersection includes variables with different versions; 5. The method of claim 1, further comprising: determining the data anomaly type based on a commit state of the parallel transactions when a third intersection is the non-empty data set, the third intersection being an intersection between a write set of the target transaction and a write set of the parallel transaction.
10. When at least one of the first intersection set and the second intersection set is a non-empty data set and the target transaction conflicts with the parallel transaction, the step of determining a data anomaly type based on the number of version changes of the same variable acted upon by the target transaction and the parallel transaction and a target variable list, determining a category to which the data anomaly type belongs based on target read / write operations that affect the same variable in the target transaction and the parallel transaction; determining a subcategory of the category based on the category and the target variable list; The method according to any one of claims 1 to 4, further comprising: determining the data anomaly type based on at least one of the subcategory in the category, the number of version changes, and the target read / write operation.
11. determining a category of the target transaction based on target read / write operations that affect the same variable in the target transaction and the parallel transaction, determining that the belonging category is a write anomaly category when the target transaction and the target read / write operations in the parallel transaction satisfy a write anomaly condition, where the target read / write operations include a first specified number of write operations that operate on the same variable in different versions; determining that the category is a read abnormality category when the target read / write operation does not satisfy the write abnormality condition but satisfies a read abnormality condition, where the target read / write operation includes a read operation and a write operation that operate on the same variable of the same version; 11. The method of claim 10, further comprising: determining that the category to which the target read / write operation belongs is an intersection anomaly category when the target read / write operation does not satisfy the write anomaly condition and the read anomaly condition and satisfies an intersection anomaly condition, wherein satisfying the intersection anomaly condition means that the target read / write operation includes a read operation and a write operation that operate on the same variable in different versions.
12. The step of determining a subcategory in the category based on the category and the target variable list includes: determining that the subcategory in the category is a single metadata anomaly when a variable quantity in the target variable list is a second specified quantity; determining that the subcategory in the category is a double metadata anomaly when a variable quantity in the target variable list is a third specified quantity; and determining that the subcategory in the belonging category is a multi-metadata anomaly when a variable quantity in the target variable list is a fourth specified quantity, the fourth specified quantity being different from both the second specified quantity and the third specified quantity.
13. When the belonging category is the writing anomaly category and the subcategory is the single metadata anomaly, The step of determining the data anomaly type based on at least one of the subcategory in the belonging category, the number of version changes, and the target read / write operation, determining, when the number of version changes is a second specified quantity, that the data anomaly type is a lost self-update anomaly based on the write anomaly category and the single metadata anomaly; determining, when the number of version changes is a third specified number and the target read / write operations are a fifth specified number of write operations, that the data anomaly type is an all-write anomaly based on the write anomaly category and the single metadata anomaly; and determining, when the number of version changes is the third specified number and the target read / write operations are a first specified number of write operations and a sixth specified number of read operations, that the data anomaly type is a lost update anomaly based on the write anomaly category and the single metadata anomaly.
14. When the category is the write abnormality category, the subcategory is the double metadata abnormality, and the number of version changes is a second specified number, The step of determining the data anomaly type based on at least one of the subcategory in the belonging category, the number of version changes, and the target read / write operation, determining, based on the write anomaly category, the double metadata anomaly, and the second specified quantity, that the data anomaly type is a read-write partial order anomaly when the target read / write operation satisfies a first condition and a second condition, where satisfying the first condition refers to the target read / write operation including a write operation and a read operation acting on a first variable of different versions, and satisfying the second condition refers to the target read / write operation including a first specified quantity of write operations acting on a second variable of different versions; determining that the data anomaly type is a repeatable write partial order anomaly based on the write anomaly category, the double metadata anomaly, and the second specified quantity when the target read write operation satisfies a third condition and the second condition, where satisfying the third condition means that the target read write operation includes a write operation and a read operation that operate on the same version of the first variable; and determining that the data anomaly type is a full write partial order anomaly based on the write anomaly category, the double metadata anomaly, and the second specified quantity when the target read write operation satisfies a fourth condition and the second condition, where satisfying the fourth condition refers to the target read write operation including the first specified quantity of write operations that operate on different versions of the first variable.
15. When the category is the read error category, the subcategory is the single metadata error, and the number of version changes is a second specified number, The step of determining the data anomaly type based on at least one of the subcategory in the belonging category, the number of version changes, and the target read / write operation, if the target read and write operations include a first specified number of read operations and a sixth specified number of write operations operating on a same variable, determining that the data anomaly type is a non-repeatable read anomaly based on the read anomaly category, the single metadata anomaly, and the second specified number; and if the target read / write operations include the first specified number of write operations and the sixth specified number of read operations operating on a same variable, determining that the data anomaly type is an intermediate read anomaly based on the read anomaly category, the single metadata anomaly, and the second specified number.
16. When the category is the read anomaly category and the subcategory is the double metadata anomaly, The step of determining the data anomaly type based on at least one of the subcategory in the belonging category, the number of version changes, and the target read / write operation, determining, when the number of version changes is a seventh designated quantity, that the data anomaly type is a write-read partial order anomaly based on the read anomaly category and the double metadata anomaly; and determining, when the number of version changes is a second specified quantity, that the data anomaly type is a read partial order anomaly based on the read anomaly category and the double metadata anomaly.
17. The step of determining the data anomaly type based on at least one of the subcategory in the belonging category, the number of version changes, and the target read / write operation, 13. The method of claim 12, further comprising: determining that the data anomaly type is a write partial order anomaly when the belonging category is the intersection anomaly category, the subcategory is the double metadata anomaly, and the number of version changes is a second specified quantity.
18. The step of determining the data anomaly type based on at least one of the subcategory in the belonging category, the number of version changes, and the target read / write operation, determining that the data anomaly type is a staircase write anomaly when the belonging category is the write anomaly category and the subcategory is the multi-metadata anomaly; determining that the data anomaly type is a staircase read anomaly when the belonging category is the read anomaly category and the subcategory is the multi-metadata anomaly; and determining that the data anomaly type is a staircase intersection anomaly when the belonging category is the intersection anomaly category and the subcategory is the multi-metadata anomaly.
19. 1. A transaction processing device, comprising: a first determination module arranged to determine a parallel transaction of a target transaction, the parallel transaction and the target transaction including read and write operations acting on the same variable, the target transaction being a transaction that should be committed; and a second determination module configured to obtain a first intersection between the read set of the target transaction and the write set of the parallel transaction, and obtain a second intersection between the write set of the target transaction and the read set of the parallel transaction, wherein at least one of the first intersection and the second intersection is a non-empty data set, and when the target transaction conflicts with the parallel transaction, determine a data anomaly type based on a version change number of an identical variable acted upon by the target transaction and the parallel transaction and a target variable list, wherein the target variable list includes an identical variable acted upon by the target transaction and the parallel transaction.
20. An electronic device comprising a processor and a memory, the memory being used to store at least one computer program, the at least one computer program being loaded and executed by the processor to realize a transaction processing method for a database system according to any one of claims 1 to 4.
21. A computer program which, when executed by a processor, realizes the transaction processing method for a database system according to any one of claims 1 to 4.
Citation Information
Patent Citations
Transaction processing method and device, computer equipment and storage medium
CN111708615A
Transaction processing system
JP2015118431A
Control processing device, control processing method, and control processing program
JP2020204975A
Data storage method, system and non-transitory computer readable medium
JP2021051743A
