Transaction support for non-relational databases
By providing specific transaction support for non-relational databases, the problem of non-relational databases lacking transaction support in distributed deployments is solved, achieving atomicity and isolation, and ensuring the stability and reliability of cloud services.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MICROSOFT TECHNOLOGY LICENSING LLC
- Filing Date
- 2021-02-17
- Publication Date
- 2026-04-28
AI Technical Summary
Non-relational databases lack effective transaction support in distributed deployments, which makes it impossible to guarantee atomicity and isolation, affecting the stability and reliability of cloud services.
Database management systems that provide specific transaction support for non-relational databases can monitor and version control transactions using key-value pair sets and control record sets, ensuring atomicity and isolation.
Atomicity and isolation are achieved in non-relational databases, ensuring reliable execution of transactions, avoiding single points of failure, and improving the stability and reliability of cloud services.
Smart Images

Figure CN115443455B_ABST
Abstract
Description
Background Technology
[0001] In computing, a database comprises an organized, structured collection of information stored electronically within a computing system. For example, a weather database can include a collection of data records, each containing daily high and low temperatures, wind direction and intensity, sunrise and sunset times, daily precipitation, and other weather information. The data records in the database can be queried, managed, modified, updated, controlled, and organized. For instance, a user can query a weather database using a date (e.g., March 21, 2020) as a keyword to retrieve the data records corresponding to that date. Based on the retrieved data records, the user can obtain the desired weather information for that date. Summary of the Invention
[0002] The present invention is provided in a simplified form to introduce selected concepts, which will be further described in the detailed description below. This summary is not intended to identify key or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter.
[0003] Databases can be categorized into relational databases and non-relational databases. Relational databases allow the identification and access of data items related to another data item in multiple tables within the same database. For example, a weather database can include a date table with date records indexed to the number of days from the start date of the year (e.g., January 1st). A weather database can also include a weather table with weather records indexed to dates throughout the year. Thus, when a user queries weather records for 180 days from the start of the year, the search program can use "180" as a keyword to identify a date value in the date table (e.g., June 29th) and then use the identified date value to locate the weather record in the weather table.
[0004] In contrast, non-relational databases typically do not rely on relationships between different data items to identify and access data within the database. Instead, non-relational databases often consist of collections of key-value pairs. For example, a non-relational weather database can use date values as keys and various weather information as corresponding values. Thus, a non-relational weather database can include multiple key-value pairs that store different weather information for each date value.
[0005] Generally, relational databases offer more transaction support than non-relational databases. For example, Structured Query Language (“SQL”) and other relational database programming languages can provide a set of properties that ensure reliable handling of database transactions. These properties can include atomicity, consistency, isolation, and durability (“ACID”). Atomicity guarantees that each transaction with multiple operations is treated as a single “unit” that either succeeds completely or fails completely. Consistency ensures that a transaction can only bring the database from one valid state to another. Isolation ensures that concurrent execution of transactions leaves the database in the same state as it would have been if transactions had been executed sequentially in the database. Durability guarantees that once a transaction has been committed, it remains committed in the database in the event of system failure (e.g., power outage).
[0006] However, storing data in relational databases has several drawbacks. First, deploying and maintaining relational databases is costly. The various facilities used to provide broad transaction support incur high capital and operational costs. Second, a relational database used as a central repository can be a single point of failure affecting the entire computing system. For example, a relational database can be used to store tenant settings records and document indexes for multiple tenants of a cloud service (such as a document management service). Even if other components supporting the cloud service are still functioning normally, a failure of the relational database or access to it will interrupt the cloud service. In contrast, deploying and maintaining non-relational databases is cheaper than relational databases. Non-relational databases can also be deployed in a distributed manner in the computing system, thereby avoiding single points of failure. For example, in the cloud service example above, a non-relational database can be deployed for each tenant to store tenant settings and document indexes. Each of these non-relational databases can operate independently. Thus, even if one non-relational database fails, such a failure will not affect other tenants' operations on other non-relational databases.
[0007] While non-relational databases (NDRs) are generally better suited for distributed deployments than relational databases, the specific transaction support offered by relational databases can be useful for NDRs. For example, cloud service tenants might introduce transactions to modify multiple tenant settings in a NDR. This allows atomicity to ensure that modifications to the multiple tenant settings either succeed as a single transaction or fail entirely, even if only one tenant setting modification fails. In another example, multiple users of a single tenant might attempt to modify tenant settings simultaneously. In this case, the NDR might allow only one transaction at a time to ensure that a newer version of the tenant settings does not overwrite an older version.
[0008] Several embodiments of the disclosed technology can address aspects of the aforementioned drawbacks of non-relational databases by implementing a database management system configured to provide specific transaction support for non-relational databases. In a particular implementation, the non-relational database can include a set of key-value pairs and a set of control records. In one embodiment, the key-value pairs can include a key that includes a version value corresponding to the value of the key-value pair. For example, a key-value pair for the parameter "A1" of version "V0" can have the key "V0:A1" and the value "1", while another key-value pair for version "V1" can include the key "V1:A1" and the value "2". Thus, the parameter "A1" can have multiple key-value pairs, each corresponding to a different version of the parameter "A1". In other embodiments, the key-value pairs can include version values appended to the key-value pairs as metadata or can be included in other suitable ways.
[0009] In a particular implementation, the control record may include a committed version record, a latest version record, and a version index. The committed version record may contain data indicating that one or more versions corresponding to a transaction have been successfully completed in the non-relational database. The latest version record may contain data indicating that the latest version has been used in the non-relational database to update any key-value pair in the key-value pair. In a particular embodiment, when no transaction is executed in the non-relational database, the latest version record and the committed version record may individually contain a default version value (e.g., "V0"). When at least one transaction is executed, the latest version record may include a new version value different from the default version value. When at least one transaction is executed and successfully completed, the committed version record may include a new version value corresponding to the successfully completed transaction. The version index may include one or more entries, each entry identifying one or more parameters that have been modified for a specific version value. For example, an entry in the version index may identify that version "V1" involves a change to the parameter "A1" in the key-value pair.
[0010] In operation, the database management system can be configured to ensure atomicity by monitoring the successful completion of transactions and selectively updating the committed version records. For example, a non-relational database may include key-value pairs for a parameter "A1" with a default version value, such as "V0:A1" and the value "1". Upon receiving a transaction request to update parameter "A1" to a new value (e.g., "2"), the database management system can be configured to determine the latest version already in use in the non-relational database by determining the current value (e.g., "V0") in the latest version record. After determining the current value in the latest version record, the database management system can be configured to assign a new version value, such as "V1", to the latest version record and create a new key for parameter "A1", such as "V1:.A1", with the new version value. The database management system can then be configured to create a new key-value pair in the non-relational database with the new key (i.e., "V1:A1") and assign the new value (e.g., "2") to the newly created key-value pair. The database management system can then be configured to update the version index to indicate that version "V1" affects parameter "A1".
[0011] The database management system can then be configured to determine whether all operations of a transaction (such as those described above) have been successfully completed. In response to determining that all operations of the transaction have been successfully completed, the database management system can be configured to update the committed version record with the new version value, i.e., from "V0" to "V1". Conversely, if at least one operation of the transaction fails, the database management system can be configured to prevent the committed version record from being updated, instead maintaining the current value of the committed version record. Thus, in the example above, the committed version record can still contain the value "V0", even if the key-value pair includes a newly created key-value pair for the parameter "A1" (i.e., the value of "V1:A1" is "2"), and the latest version record contains the value "V1".
[0012] During the read operation of the query parameter "A1", the database management system can be configured to determine the commit version value in the non-relational database by consulting the commit version record. In the example above, when the transaction failed, the commit version record contained the value "V0". In response, the database management system can be configured to locate a key-value pair whose key has the version value "V0" for parameter "A1", i.e., "V0:A1". The database management system can then read the corresponding value, for example, "1", from the key-value pair with the key "V0:A1" and provide the value in response to the query. Therefore, even if another key-value pair exists in the non-relational database, i.e., "V1:A1→2", no corresponding value is provided in response to the query, i.e., "2" for "V1:A1", because the transaction corresponding to version "V1" failed. In this way, atomicity is achieved in the non-relational database.
[0013] The database management system can also be configured to ensure isolation by implementing a timer that maintains the elapsed time since the creation of a new version value. For example, in the example above, when the database management system modifies the value of the latest version record from "V0" to "V1", a timer can be started. Subsequently, the database management system can receive new transaction requests to the non-relational database. In response, the database management system can be configured to determine whether the latest version record is included in the committed version record as a committed version value. In response to determining that the latest version record is included in the committed version record as a committed version value, the database management system can be configured to initialize processing for the new transaction request. On the other hand, in response to determining that the latest version record is included in the committed version record as a version value not indicated as committed, the database management system can be configured to determine whether the elapsed time of the timer has exceeded a threshold. If so, the database management system can be configured to treat the previous transaction as failed and initialize processing for the new transaction request. Otherwise, the database management system can reject or delay processing the new transaction request, thereby isolating the processing of previous transaction requests from the processing of the new transaction request.
[0014] Several embodiments of the disclosed technology thus enable specific transaction support for non-relational databases to ensure atomicity and isolation. For example, by creating new key-value pairs for each modification to a parameter (e.g., "A1") and selectively updating the committed version record, the version value corresponding to a failed transaction is not provided as the current value for the parameter. On the other hand, by implementing a timer to maintain the elapsed time when a new version is created in the latest version record, transactions in the non-relational database can be isolated from other transactions as long as the elapsed time does not exceed a threshold. Therefore, the database management system can ensure that transactions are reliably processed in the non-relational database. Attached Figure Description
[0015] Figure 1 This is a schematic diagram illustrating a distributed computing system that implements specific transaction support for a non-relational database according to an embodiment of the disclosed technology.
[0016] Figure 2 The illustration depicts an embodiment of the disclosed technology for providing cloud services to tenants. Figure 1 A schematic diagram of specific hardware and software components of a distributed computing system.
[0017] Figures 3A-3F This is a schematic block diagram illustrating a management system that provides atomic transaction support in a non-relational database within a distributed computing system, according to an embodiment of the present technology.
[0018] Figures 4A-4D This is a schematic block diagram illustrating a management system that provides isolated transaction support in a non-relational database within a distributed computing system, according to an embodiment of the present technology.
[0019] Figures 5A-5D This is a flowchart illustrating various aspects of a process for implementing specific transaction support for a non-relational database according to an embodiment of the present technology.
[0020] Figure 6 It is applicable Figure 1 A computing device that is a specific component of a distributed computing system. Detailed Implementation
[0021] The following describes specific embodiments of systems, devices, components, modules, routines, data structures, and procedures for implementing specific transaction support for non-relational databases in distributed computing systems. Specific details of the components are included in the following description to provide a thorough understanding of specific embodiments of the disclosed technology. Those skilled in the art will also understand that the technology can have additional embodiments. It is also possible to implement this technology without phase reference. Figure 1-6 The technique is practiced in the context of several details of the described embodiments.
[0022] In some examples, a distributed computing system can include a computing facility with a computer network that interconnects multiple hosts to each other or to an external network (e.g., the Internet). Examples of such a computing facility can include data centers for providing cloud computing services. The computing network can include multiple network devices. "Network devices" can include physical network devices, examples of which include routers, switches, hubs, bridges, load balancers, security gateways, or firewalls. "Hosts" can be servers or other suitable types of hardware / software computing devices configured to provide hypervisors supporting one or more virtual machines, virtual switches, or other suitable types of virtual components.
[0023] In some examples, a hypervisor can include computer software, firmware, and / or hardware that creates, manages, and runs one or more virtual machines on a host machine. A virtual machine, or "VM," can be a simulation of a physical computing system using computer software. Different virtual machines can be configured to provide suitable computing environments to execute different processes for the same or different users on a single host machine. During operation, the hypervisor on the host machine can present different virtual machines with virtual operating platforms to the hardware resources on the host machine and manage the execution of various processes for the virtual machines.
[0024] In some examples, computing services or cloud services include one or more computing resources provided via computer networks such as the Internet. Exemplary cloud services include Software as a Service (“SaaS”), Platform as a Service (“PaaS”), and Infrastructure as a Service (“IaaS”). SaaS is a software distribution technology in which software applications are hosted by a cloud service provider in, for example, a data center and accessed by users via a computer network. PaaS includes the delivery of operating systems and associated services via a computer network without the need for downloading or installation. IaaS includes outsourced equipment used to support storage, hardware, servers, network devices, or other components, all of which are accessible via a computer network.
[0025] In some examples, a database comprises an organized collection of structured information stored electronically in a computing system. A database can be a relational database that allows the identification and access of data items related to another data item in multiple tables within the same database. A database can also be a non-relational database that identifies and accesses data within the database without relying on relationships between different data items. Conversely, a non-relational database can comprise a collection of key-value pairs.
[0026] In some examples, key-value pairs comprise data records that include searchable keys and corresponding values. For example, a key-value pair can include a parameter name (e.g., "A1") as the key and a value for the parameter "A1" (e.g., "1") as the value. In the description below, key-value pairs are indicated using arrows to indicate the value corresponding to the key in the key-value pair. For example, an exemplary key-value pair could be "A1→1", which indicates the key "A1" having the value "1". As described in more detail herein, according to embodiments of the disclosed technology, individual key-value pairs can also use both a version value and a parameter name as the key. For example, the parameter "A1" can comprise multiple key-value pairs with different version values, such as "V0:A1", "V1:A1", "V2:A1", etc., each with a different value. Such key-value pairs can be searched in a database to locate the corresponding value.
[0027] Furthermore, in some examples, the version value for a key-value pair in the database can be a value corresponding to a change in the database. For example, a first version value can correspond to an update to a first parameter, while a second version value, which is newer than the first version value, can correspond to an update to a second parameter. The latest version record can be a control record in the database containing the most recently used version value. The committed version record can be another control record containing data indicating that the corresponding transaction has been successfully completed in the database.
[0028] Typically, relational databases offer specific transaction support from which non-relational databases can also benefit. For example, Structured Query Language (“SQL”) and other relational database programming languages provide atomicity, consistency, isolation, and durability (“ACID”). Atomicity guarantees that each transaction with multiple operations is treated as a single “unit” that either succeeds completely or fails completely. Consistency ensures that a transaction can only bring the database from one valid state to another. Isolation ensures that concurrent execution of transactions leaves the database in the same state as if the transactions were executed sequentially. Durability guarantees that once a transaction has been committed, it remains committed in the database in the event of system failure (e.g., power outage).
[0029] While NoSQL databases are generally better suited for distributed deployments than relational databases, the specific transaction support offered by relational databases can be useful for NoSQL databases. For example, cloud service tenants can introduce transactions to modify multiple tenant settings in a NoSQL database. This ensures atomicity, guaranteeing that modifications to multiple tenant settings either succeed as a single transaction or fail entirely, even if only one tenant setting modification fails. In another example, multiple users of a single tenant might attempt to modify tenant settings simultaneously. In this case, the NoSQL database might allow only one transaction at a time to ensure that a new version of the tenant settings does not overwrite an older version.
[0030] Several embodiments of the disclosed technology can address aspects of the aforementioned drawbacks of non-relational databases by implementing a database management system configured to provide specific transaction support for non-relational databases. For example, by creating new key-value pairs for each modification of a parameter (e.g., "A1") and selectively updating the committed version record, the version value corresponding to a failed transaction is not provided as the current value for the parameter. In another example, by implementing a timer to maintain the elapsed time when a new version is created, transactions in the non-relational database can be isolated from other transactions as long as the elapsed time does not exceed a threshold. Therefore, the database management system can ensure that transactions are reliably processed in the non-relational database, as referenced below. Figure 1-6 More detailed description.
[0031] Figure 1 This is a schematic diagram illustrating a distributed computing system 100 having a host implementing specific transaction support for non-relational databases, according to an embodiment of the disclosed technology. (As shown in...) Figure 1 As shown, the distributed computing system 100 can include a computer network (shown as "underlying network 108") interconnected with multiple host machines of server 106, multiple client devices 102 of user 101, and resource manager 110. Resource manager 110 can be a cluster controller, infrastructure controller, database controller, and / or other suitable type of controller configured to monitor and manage the resources and operations of server 106 and / or other components in the distributed computing system 100. Although... Figure 1 The image shows specific components of the computing system 100, but in other embodiments, the computing system 100 may also include network storage devices, a maintenance manager, and / or other components besides or replacing them. Figure 1 Other suitable components (not shown) of the components shown.
[0032] As in Figure 1As shown, the underlying network 108 can include multiple network devices 112 interconnecting multiple servers 106 with client devices 102. In a particular embodiment, the servers 106 can be organized into racks, action zones, groups, sets, or other suitable partitions. For example, in the illustrated embodiment, the servers 106 are divided into three clusters, designated as first, second, and third clusters 107a-107c, respectively. In the illustrated embodiment, each cluster in clusters 107a-107c is operatively coupled to a corresponding network device 112a-112c. Network devices 112a-112c can then be operatively coupled to additional network devices 112 to form a hierarchical, planar, mesh, or other suitable type of network topology. The computer network allows communication between the servers 106 and client devices 102. In other embodiments, multiple host machine sets 107a-107c can share a single network device 112 or can have other suitable arrangements.
[0033] Server 106 can be individually configured to provide computing, storage, and / or other suitable cloud computing services to individual users 101. For example, see the following reference. Figure 2 In more detail, each of the servers 106 is capable of initiating and maintaining one or more virtual machines 144 (as in...) upon request from user 101. Figure 2 (As shown in the diagram). User 101 can then utilize the instantiated virtual machine 144 to perform appropriate processes for computing, communication, and / or other suitable tasks. In a particular embodiment, one of the servers 106 can provide the virtual machine 144 to multiple users 101. In other embodiments, multiple servers 106 can host the virtual machine 144 for one or more users 101a-101c.
[0034] Client devices 102 may each include a computing device that facilitates access by the corresponding user 101 or administrator 104 to computing services provided by server 106 via the underlying network 108. For example, in the illustrated embodiment, client device 102 individually includes a desktop computer. In other embodiments, client device 102 may also include a laptop computer, tablet computer, smartphone, or other suitable computing device. Although for illustrative purposes... Figure 1 The illustration shows three users 101, but in other embodiments, the distributed computing system 100 can facilitate access to cloud and / or other suitable types of computing services provided by the server 106 and / or other components in the distributed computing system 100, by any suitable number of users 101 or administrators.
[0035] Figure 2 The illustration shows an embodiment based on the disclosed technology. Figure 1A schematic diagram of the overlay network 108' implemented on the underlying network 108. Figure 2 For clarity, only [the text] is shown. Figure 1 Specific components of the underlying network 108. For example, in Figure 2 As shown, the first server 106a and the second server 106b may each include a CPU 132, a memory 134, and a network interface 136 operably coupled to each other. The CPU 132 may include one or more processors, microprocessors, field-programmable gate arrays, and / or other suitable logic devices. The memory 134 may include volatile and / or non-volatile media (e.g., ROM; RAM, disk storage media; optical storage media; flash memory devices, and / or other suitable storage media) and / or other types of computer-readable storage media configured to store data received from the CPU 132 and instructions for the CPU 132 (e.g., instructions for performing actions referenced below). Figure 5A and Figure 5B (Instructions for the methods discussed). Network interface 136 may include network interface cards, connection converters, and / or other suitable types of input / output devices configured to accept input from and provide output to other components on overlay network 108'.
[0036] First server 106a and second server 106b can individually contain instructions in memory 134, which can be executed by CPU 132 to cause individual servers 106a and 106b to provide a hypervisor 140 (individually identified as first hypervisor 140a and second hypervisor 140b). The hypervisor 140 can be individually configured to create, monitor, terminate, and / or otherwise manage one or more virtual machines 144 organized into tenant site 142. For example, as in... Figure 2 As shown, the first server 106a is capable of providing a first management program 140a to manage the first tenant site 142a and the second tenant site 142b respectively. The second server 106b is capable of providing a second management program 140b to manage the first tenant site 142a' and the second tenant site 142b' respectively. Management program 140b... Figure 2 Individually, the hypervisor 140 is shown as a software component. However, in other embodiments, the hypervisor 140 may also include firmware and / or hardware components.
[0037] Tenant sites 142 can each include multiple virtual machines 144 for a specific tenant. For example, both first server 106a and second server 106b can host tenant sites 142a and 142a' for a first user 101a. Both first server 106a and second server 106b can host tenant sites 142b and 142b' for a second user 101b. Each virtual machine 144 can be executing an application or process 147 corresponding to an operating system, middleware, and / or suitable application and / or providing access to data storage 148. The executed application or process 147 can each correspond to one or more computing services or other suitable types of computing services. An exemplary application 147 is a management system 170 (shown in Figure 3) configured to access data storage 148 with specific transaction support. Exemplary components of the management system 170 and data storage 148 will be referenced below. Figures 3A-3F Let's discuss this in more detail.
[0038] Also in Figure 2 As shown, the computing system 100 can include an overlay network 108' having one or more virtual networks 146 interconnecting tenant sites 142a and 142b across a first server 106a and a second server 106b. For example, a first virtual network 146a interconnects first tenant sites 142a and 142a' at the first server 106a and the second server 106b. A second virtual network 146b interconnects second tenant sites 142b and 142b' at the first server 106a and the second server 106b. Although a single virtual network 146 is shown to correspond to a single tenant site 142, in other embodiments, multiple virtual networks (not shown) may be configured to correspond to a single tenant site 146.
[0039] Virtual machine 144 on virtual network 146 can be accessed via underlying network 108 ( Figure 1 They can communicate with each other even if virtual machines 144 are located on or hosted on different servers 106. Communication within each virtual network 146 can be isolated from other virtual networks 146. In certain embodiments, communication can be allowed to cross from one virtual network 146 to another via a security gateway or in other controlled manner. A virtual network address can correspond to one of the virtual machines 144 in a particular virtual network 146. Therefore, different virtual networks 146 can use the same one or more virtual network addresses. Exemplary virtual network addresses can include IP addresses, MAC addresses, and / or other suitable addresses.
[0040] In operation, server 106 facilitates communication between virtual machines and / or applications running in virtual machine 144. For example, the CPU 132 of the first server 106a can perform appropriate network communication operations to facilitate communication between the first virtual machine 144a and the first virtual machine 144a via network interface 136 and underlying network 108 on the first server 106a. Figure 1 The network interface 136 on the first server 106b transmits packets to the second virtual machine 144b via the virtual network 146a. In this way, the first virtual machine 144a of the tenant site 142a on the first server 106a can cooperate with another virtual machine 144b on the other server 106b to execute appropriate applications or processes 147 in order to provide appropriate computing services to the user 101.
[0041] Figures 3A-3F This is a schematic block diagram illustrating a management system that provides atomic transaction support in a non-relational database within a distributed computing system 100, according to an embodiment of the present technology. Figures 3A-3F As with other figures in this document, individual software components, objects, classes, modules, and routines can be computer programs, procedures, or processes written in C, C++, C#, Java, and / or other suitable programming languages. Components can include, but are not limited to, one or more modules, objects, classes, routines, properties, processes, threads, executables, libraries, or other components. Components can be source code or binary form. Components can also include aspects of uncompiled source code (e.g., classes, properties, procedures, routines), compiled binary units (e.g., libraries, executables), or artifacts instantiated and used at runtime (e.g., objects, processes, threads).
[0042] Components within a system can take different forms. As an example, a system may include a first component, a second component, and a third component. These components can include, but are not limited to, a system where the first component is an attribute in source code, the second component is a binary compiled library, and the third component is a thread created at runtime. Computer programs, procedures, or processes can be compiled into objects, intermediate code, or machine code and presented for execution by one or more processors of a personal computer, tablet computer, web server, laptop computer, smartphone, and / or other suitable computing device.
[0043] Similarly, components may include hardware circuitry. In certain examples, hardware can be considered rigid software, and software can be considered liquefied hardware. As an example only, software instructions in a component may be burned into a programmable logic array circuit or may be designed as a hardware component with appropriate integrated circuits. Likewise, hardware can be emulated by software. Various implementations of source code, intermediate code, and / or object code and associated data may be stored in computer memory, including read-only memory, random access memory, disk storage media, optical storage media, flash memory devices, and / or other suitable computer-readable storage media. As used herein, the term "computer-readable storage media" does not include propagating signals.
[0044] As in Figure 3A As shown, data storage 148 can include a set of key-value pairs 166 and a set of control records 161. Each key-value pair 166 can include a key 166a and a corresponding value 166b. In one embodiment, each key-value pair 166 can include a key 166a having a version value corresponding to the value 166b of the key-value pair 166. For example, as in Figure 3A As illustrated, key-value pair 166 for parameter "A1" of version "V0" can have the key "V0:A1" and the value "1", while another key-value pair 166 for version "V1" can include the key 166a of "V1:A1" and the value 166b of "2". Thus, parameter "A1" can have multiple key-value pairs 166, each corresponding to a different version of parameter "A1". In other embodiments, key-value pairs 166 can include a version value (not shown) appended to key-value pairs 166 as metadata or can be included in other suitable ways.
[0045] As in Figure 3A As shown, in a particular implementation, control record 161 may include committed version record 160, latest version record 162, and version index 164. Committed version record 160 may contain data indicating one or more versions or version values that have been successfully completed in data storage 148 for a corresponding transaction. Latest version record 162 may contain data indicating the latest version or version value that has been used to update any key-value pair in key-value pair 166 in data storage 148. In a particular embodiment, latest version record 162 and committed version record 160 may individually include a default version value (e.g., "V0") when no transaction has been executed in data storage 148 to modify any key-value pair in key-value pair 166. When at least one transaction is executed, as in... Figure 3AAs illustrated, the latest version record 162 can include a new version value (e.g., "V1") that differs from the default version value. When at least one transaction is executed and successfully completed, the committed version record 160 can include a new version value (e.g., "V1") corresponding to the successfully completed transaction. The version index 164 can include one or more entries, each identifying one or more parameters (e.g., "A1") that have been modified for a specific version value (e.g., "V1"). For example, an entry in the version index can identify that version "V1" involves a change to parameter "A1" in key-value pair 166.
[0046] Also in Figure 3A As shown, the management system 170 can include an interface component 172 and a control component 174 that are operatively coupled to each other. Although in Figure 3A Only the aforementioned components are shown in the other accompanying drawings, but in other embodiments, the management system 170 may also include a network, storage device, or other suitable types of components. Figures 3A-3F The operations shown are used to illustrate how atomicity in data storage 148 is maintained by monitoring the successful completion of transactions and selectively updating the committed version record 160. Various example values for control record 161 and key-value pair 166 are used for illustrative purposes.
[0047] Interface component 172 can be configured to receive request 150, which is used to execute a transaction that modifies one or more key-value pairs 166 in data store 148. For example, as in Figure 3A As shown, request 150 includes the requested operations to modify the value of parameter "A1", delete parameter "A2", and add a new parameter "A3" with a corresponding value (i.e., "456"). In response, interface component 172 can be configured to retrieve the current value of the latest version of record 162 from data storage 148. For example, as in... Figure 3A As shown, the current value in the latest version record 162 is "V1".
[0048] As in Figure 3BAs shown, interface component 172 can then pass the retrieved current value of latest version record 162 to control component 174 for further processing. Control component 174 can be configured to generate a new version value 162' for latest version record 162 based on the retrieved current value of latest version record 162, in response to a received request 150. In the illustrated example, the new version value 162' of latest version record 162 is generated by incrementing from "V1" to "V2". In other examples, a numerical value or other suitable method can be used to generate the new version value 162'. When generating the new version value, control component 174 can instruct interface component 172 to write the new version value 162' into latest version record 162.
[0049] Control component 174 can also be configured to create a new key 166a for each parameter in the received request 150. For example, the new key 166a for parameter "A1" with a new version value could be "V2:A1"; for parameter "A2" it could be "V2:A2"; and for parameter "A3" it could be "V2:A3". Control component 174 can then be configured to create new key-value pairs 166' in data storage 148 using the new keys (i.e., "V2:A1", "V2:A2", and "V2:A3"), and assign new values (e.g., "3", "deleted", and "456") to the newly created key-value pairs 166' respectively. Control component 174 can then be configured to update the version index 164 to indicate that version "V2" affects parameters "A1", "A2", and "A3".
[0050] Control component 174 can be configured to determine whether all operations of a transaction (i.e., operations associated with each of the parameters “A1”, “A2”, and “A3”) have been successfully completed. Figure 3C The illustration shows an example where all operations have been successfully completed. For example, in... Figure 3C As shown, in response to determining that all operations of the transaction have been successfully completed, the control component 174 can be configured to update the committed version record 160 to include the new version value, “V2”, as well as the previously committed versions, “V0” and “V1”.
[0051] On the other hand, such as in Figure 3DAs illustrated, when at least one operation of the transaction fails, control component 174 can be configured to prevent committed version record 160 from being updated to a new version value. For example, in the illustrated example, creating a new key-value pair 166' for parameter "A3" fails (shown in dashed lines). In response, control component 174 can be configured to maintain the current values(s) of committed version record 160, namely, "V0" and "V1". Thus, in the illustrated example, even if key-value pair 166 includes a newly created key-value pair 166' for "V2" for parameters "A1" and "A2", committed version record 160 can still contain the previously committed version values "V0" and "V1".
[0052] Control component 174 can be configured to utilize the version value in the submitted version record 160 when responding to a query for the current value of a parameter (e.g., “A1”, “A2”, and “A3”). Figure 3E The diagram shows the corresponding Figure 3C In this scenario, the entire transaction is successfully completed. Thus, in response to receiving a query for the current values “A1”, “A2”, and “A3”, control component 174 can be configured to retrieve the version value from the committed version record 160. Control component 174 can then be configured to determine whether the latest version value (i.e., “V2”) corresponds to a value change for the parameter by consulting version index 164. In the illustrated example, all three parameters “A1”, “A2”, and “A3” correspond to “V2”. In response, control component 174 can be configured to retrieve key-value pairs 166 for each of the parameters “A1”, “A2”, and “A3” using the version value (i.e., “V2”) and the parameter name as keys 166a (i.e., “V2:A1”, “V2:A2”, and “V2:A3”). Then, the control component 174 can be configured to provide a corresponding value 166b from the retrieved key-value pair 166 (shown in shaded for clarity) as a response 152 to the query.
[0053] Figure 3F The diagram shows the corresponding Figure 3D In a scenario where the entire transaction fails to complete successfully, such as in... Figure 3FAs shown, the version values retrieved from the submitted version record 160 include only “V0” and “V1”. Control component 174 can then determine whether the latest version value (i.e., “V1”) affects both parameters “A1” and “A2”. In response to determining that the latest version value “V1” only affects parameter “A1”, control component 174 can be configured to determine whether the previous version value (i.e., “V0”) affects parameter “A2”. In the illustrated example, “V0” represents the default version value and therefore affects parameter “A2”. Thus, control component 174 can be configured to retrieve key-value pairs 166 (shown in shaded for clarity) using the determined version values and parameter names as keys 166a (i.e., “V1:A1” and “V0:A2”). Control component 174 can then be configured to provide a corresponding value 166b from the retrieved key-value pairs 166 (shown in shaded for clarity) as a response 152 to the query. Therefore, even if another key-value pair 166 (i.e., "V2:A1→3") exists in data storage 148, no corresponding value (i.e., "3" for "V2:A1") is provided in response to the query because at least one operation of the transaction corresponding to version "V2" has failed. In this way, atomicity is achieved in data storage 148.
[0054] Figures 4A-4D This is a schematic block diagram illustrating a management system 170 that provides isolated transaction support in a database within a distributed computing system 100 according to an embodiment of the present technology. (As shown in...) Figures 4A-4D As shown, the management system 100 can also be configured to monitor the version values in the submitted version record 160 and the latest version record 162 and be configured to maintain the creation of new version values 162' in the latest version record 162 (as shown in...). Figure 4B The timer 176 (as shown) is used to ensure isolation by elapsed time. For example, in Figure 4A In the example shown, interface component 172 can be configured to receive signals similar to those in... Figure 3A The illustrated request is 150. In response, interface component 172 can be configured to retrieve a version value from both the committed version record 160 and the latest version record 162. Then, control component 174 can be configured to determine whether the latest version record 162 contains a version value indicated as committed in the committed version record 160. In the illustrated example, the latest version record 162 contains the version value "V1," which is included in the committed version record 160. In response, control component 174 can consider the transaction associated with the version value "V1" to have been successfully completed, and therefore allow modification of parameters "A1," "A2," and "A3" to continue the request.
[0055] Figure 4BThe illustration depicts an exemplary scenario where the latest version record 162 is not included in the version value included in the committed version record 160. For example, as in... Figure 4B As shown, the latest version record 162 can contain the version value "V2" for a version that was not indicated as committed in the committed version record 160. In response, as in Figure 4C As shown, control component 174 can retrieve elapsed time 178 from timer 176, which was started when control component 174 modified the version value of latest version record 162 from "V1" to "V2". Control component 174 can be configured to determine whether the elapsed time 178 of timer 176 exceeds a threshold. In response to determining that the elapsed time 178 has not exceeded the threshold, control component 174 can be configured to reject or delay processing of the new transaction corresponding to request 150, so that previous transactions can be isolated from the processing of the new transaction. In response to determining that the elapsed time 178 has exceeded the threshold, control component 174 can be configured to consider the previous transaction corresponding to version "V2" to have failed and initiate processing of the new transaction related to the received request 150, as in Figure 4D As shown. For example, control component 174 can be configured to generate a new version value, such as "V3" for the latest version record 162, and continue to the above reference. Figures 3A-3F The described operation.
[0056] Therefore, several embodiments of the disclosed technology can provide specific transaction support for the data storage 148 with key-value pairs 166 to ensure atomicity and isolation. For example, by creating a new key-value pair 166' for each modification of a parameter (e.g., "A1") and selectively updating the committed version record 160, the value of the version corresponding to a failed transaction is not provided as the current value for the parameter. In another aspect, by implementing a timer 176 to maintain the elapsed time 178 when a new version is created in the latest version record 162, transactions in the data storage 148 can be isolated from other transactions as long as the elapsed time 178 does not exceed a threshold. Therefore, the management system 170 can ensure reliable transaction processing in the data storage 148.
[0057] Figures 5A-5D This is a flowchart illustrating various aspects of a process for implementing specific transaction support for a non-relational database according to embodiments of the present technology. Although in Figure 1-4D The embodiments of the process are described in the context of the distributed computing system 100, but in other embodiments, aspects of the process may also be implemented in computing systems with different and / or additional components.
[0058] As in Figure 5AAs shown, process 200 can include receiving a transaction request at stage 202. The transaction request can include multiple operations to be performed on the database. Process 200 can then include performing the multiple operations on the transaction at stage 204. See below for further details. Figure 5B An exemplary operation for performing the operation is described. Process 200 can then include a decision phase 206 to determine whether all operations of the transaction have been successfully completed. In response to determining that all operations of the transaction have been successfully completed, process 200 continues to update the committed version record in the database with the new version corresponding to the executed transaction. In response to determining that at least one operation has failed, process 200 continues to maintain the version in the committed version record without updating to the new version corresponding to the transaction.
[0059] As in Figure 5B As shown, an exemplary operation for executing the transaction can include: generating a new version value at stage 212, and calculating the difference between the existing value of the parameter and the new value included in the received transaction request at stage 214. The exemplary operation can then include creating a new key-value pair at stage 216 using the generated new version value and the parameter name as keys and the new value as the corresponding value of the key-value pair, as referenced above. Figures 3A-3F More detailed description. An exemplary operation could also include updating the version index at stage 218 to indicate the identity of parameters affected by the new version.
[0060] Figure 5C This is a flowchart illustrating the process 220 of reading parameter values from a database with key-value pairs. (For example, in...) Figure 5C As shown, process 220 can include receiving a read request or query at stage 222. Process 220 can also include determining, at stage 226, the commit version in the database based on, for example, one or more version values in the committed version record and retrieving key-value pairs based on said commit version, as referenced above. Figures 3A-3F As described.
[0061] Figure 5D This is a flowchart illustrating process 230, which provides isolated transaction support in a database with key-value pairs. (As shown in...) Figure 5DAs shown, process 230 can include receiving a transaction request at stage 232 to update one or more parameter values in the database. Process 230 can then include a decision stage 234 to determine whether the current value in the latest version record matches the value in the committed version record. In response to determining that the current value in the latest version record matches the value in the committed version record, process 230 proceeds to allow the transaction corresponding to the received request to proceed at stage 236. Otherwise, process 230 proceeds to another decision stage 238 to determine whether the time elapsed since the value of the latest version record was modified exceeds a threshold. In response to determining that the elapsed time exceeds the threshold, process 230 proceeds to allow the transaction to proceed at stage 236. Otherwise, process 230 proceeds to reject or delay the transaction at stage 240, as referenced above. Figures 4A-4D More detailed description.
[0062] Figure 6 It is applicable Figure 1 The computing device 300 is a specific component of the distributed computing system 100, such as a server 106, a client device 102, or a resource manager 110. In a very basic configuration 302, the computing device 300 may include one or more processors 304 and system memory 306. A memory bus 308 may be used to communicate between the processor 304 and the system memory 306. Depending on the desired configuration, the processor 304 may be of any type, including but not limited to: a microprocessor (μR), a microcontroller (μC), a digital signal processor (DSP), or any combination thereof. The processor 304 may include one or more levels of cache (such as a level 1 cache 310 and a level 2 cache 312), a processor core 314, and registers 316. An exemplary processor core 314 may include an arithmetic logic unit (ALU), a floating-point unit (FPU), a digital signal processing core (DSP core), or any combination thereof. An exemplary memory controller 318 may also be used with the processor 304, or in some implementations, the memory controller 318 may be an internal part of the processor 304.
[0063] Depending on the desired configuration, system memory 306 can be of any type, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 306 can include operating system 320, one or more applications 322, and program data 324. As shown in Figure 7, operating system 320 can include hypervisor 140 for managing one or more virtual machines 144. This describes the basic configuration 302 in... Figure 6 The components within the dashed lines are shown in the diagram.
[0064] Computing device 300 may have additional features or functions and additional interfaces to facilitate communication between basic configuration 302 and any other devices and interfaces. For example, bus / interface controller 330 may be used to facilitate communication between basic configuration 302 and one or more data storage devices 332 via storage interface bus 334. Data storage device 332 may be removable storage device 336, non-removable storage device 338, or a combination thereof. Examples of removable and non-removable storage devices include disk drives (such as floppy disk drives and hard disk drives (HDDs)), optical disk drives (such as compact disc (CD) drives or digital versatile disk (DVD) drives), solid-state drives (SSDs), and magnetic tape drives, etc. Exemplary computer storage media may include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). The terms "computer-readable storage medium" or "computer-readable storage device" do not include signal propagation and communication media.
[0065] System memory 306, removable storage device 336, and non-removable storage device 338 are examples of computer-readable storage media. Computer-readable storage media include, but are not limited to: RAM, ROM, EEPROM, flash memory or other storage technologies, CD-ROM, digital versatile disk (DVD) or other optical storage devices, magnetic tape, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by computing device 300. Any such computer-readable storage medium can be part of computing device 300. The term "computer-readable storage medium" does not include signal propagation and communication media.
[0066] The computing device 300 may also include an interface bus 340 for facilitating communication from various interface devices (e.g., output devices 342, peripheral interfaces 344, and communication devices 346) to the basic configuration 302 via a bus / interface controller 330. An exemplary output device 342 includes a graphics processing unit 348 and an audio processing unit 350, which can be configured to communicate with various external devices (such as displays or speakers) via one or more A / V ports 352. An exemplary peripheral interface 344 includes a serial interface controller 354 or a parallel interface controller 356, which can be configured to communicate with external devices such as input devices (e.g., keyboards, mice, pens, voice input devices, touch input devices, etc.) or other peripheral devices (e.g., printers, scanners, etc.) via one or more I / O ports 358. An exemplary communication device 346 includes a network controller 360, which can be arranged to facilitate communication with one or more other computing devices 362 over a network communication link via one or more communication ports 364.
[0067] A network communication link can be an example of a communication medium. A communication medium can typically be embodied in computer-readable instructions, data structures, program modules, or other data in a modulated data signal, such as a carrier wave or other transmission mechanism, and can include any information delivery medium. A “modulated data signal” can be a signal whose characteristics are set or altered in a way that encodes information in the signal. By way of example, and not limitation, a communication medium can include wired media, such as wired networks or direct wired connections; and wireless media, such as acoustic, radio frequency (RF), microwave, infrared (IR), and other wireless media. As used herein, the term “computer-readable medium” can include both storage media and communication media.
[0068] The computing device 300 can be implemented as part of a small-form-factor portable (or mobile) electronic device, such as a mobile phone, personal data assistant (PDA), personal media player device, wireless network watch device, personal headset device, application-specific device, or hybrid device including any of the above functions. The computing device 300 can also be implemented as a personal computer, including laptop and non-laptop configurations.
[0069] Based on the foregoing, it should be understood that specific embodiments of this disclosure have been described herein for illustrative purposes, but various modifications may be made without departing from this disclosure. Furthermore, many elements of one embodiment may be combined with other embodiments to supplement or replace elements of other embodiments. Therefore, this technology is not limited to those specified in the appended claims.
Claims
1. A method for providing transaction support for a database hosted in a computing system having multiple servers, the database having a collection of key-value pairs, each key-value pair having a key and a corresponding value, the method comprising: At the server in the computing system, a request is received to update a parameter using a new value from the database, the parameter corresponding to an existing key-value pair with an existing value; as well as At the server in the computing system, in response to receiving the request, Generate a new version value for the key-value pairs in the database; In the database, a new key-value pair corresponding to the parameter is created. For the newly created key-value pair, both the generated new version value and the name of the parameter are used as keys, and the new value is used as the corresponding value. Determine whether the creation of the new key-value pair corresponding to the parameter in the database was successfully completed. as well as In response to determining that the creation of the new key-value pair corresponding to the parameter has not been successfully completed, a version value is maintained in the committed version record in the database, without updating the committed version record using the generated new version value. The maintained version value corresponds to the existing key-value pair of the parameter, such that in response to a query for the current value of the parameter, the existing value is returned as the current value of the parameter, instead of returning the new value.
2. The method according to claim 1, wherein, Generating the new version value includes: Access the latest version record in the database to determine the current version value in the database; and The new version value is generated by adding the determined current version value to the database.
3. The method of claim 1, further comprising updating the version index to indicate that the new version value is related to the parameter.
4. The method according to claim 1, further comprising: In response to determining that the creation of the new key-value pair corresponding to the parameter has been successfully completed, the committed version record in the database is updated with the new version value to indicate that the new version value is the committed version value, such that in response to a query for the current value of the parameter, the new value is returned as the current value of the parameter.
5. The method according to claim 1, wherein: The parameter is the first parameter; The new value is the first new value; The new key-value pair is the first new key-value pair; The request also includes updating the second parameter using a second new value from the database; and The method further includes creating a second new key-value pair corresponding to the second parameter in the database, and using both the generated new version value and the name of the second parameter as keys for the created second new key-value pair, and using the second new value as the corresponding value.
6. The method according to claim 1, wherein: The parameter is the first parameter; The new value is the first new value; The new key-value pair is the first new key-value pair; The request also includes updating the second parameter using another new value from the database; as well as Determining whether the creation of the new key-value pair corresponding to the parameter in the database was successfully completed includes: Determine whether the creation of the first new key-value pair corresponding to the first parameter and the second new key-value pair corresponding to the second parameter in the database was successfully completed; as well as In response to determining that the creation of at least one of the first new key-value pair or the second new key-value pair has not been successfully completed, the version value in the commit version record in the database is maintained without updating the commit version record using the generated new version value.
7. The method according to claim 1, wherein: The parameter is the first parameter; The new value is the first new value; The new key-value pair is the first new key-value pair; The request also includes updating the second parameter using another new value from the database; as well as Determining whether the creation of the new key-value pair corresponding to the parameter in the database was successfully completed includes: Determine whether the creation of the first new key-value pair corresponding to the first parameter and the second new key-value pair corresponding to the second parameter in the database was successfully completed; as well as In response to determining that the creation of both the first new key-value pair and the second new key-value pair has been successfully completed, the committed version record in the database is updated with the new version value to indicate that the new version value is the committed version value, such that the first new value is returned as the current value of the first parameter in response to a query for the current value of the first parameter, and the other new value is returned as the current value of the second parameter in response to a query for the current value of the second parameter.
8. The method according to claim 1, wherein: The parameter is the first parameter; The new value is the first new value; The request is the first request; as well as The method further includes: Receive a second request to update the second parameter using the second new value in the database; In response to receiving the second request, Determine whether the current version value in the database matches the version value in the submitted version record; and In response to determining that the current version value matches the version value in the submitted version record, processing of the second request in the database is permitted.
9. The method according to claim 1, wherein: The parameter is the first parameter; The new value is the first new value; The request is the first request; as well as The method further includes: Receive a second request to update the second parameter using the second new value in the database; In response to receiving the second request, determine whether the current version value in the database matches the version value in the submitted version record; and In response to determining that the current version value does not match the version value in the committed version record, Determine whether the time elapsed since the generation of the new version value exceeds a threshold. In response to determining that the elapsed time exceeds the threshold, Allowing processing of the second request in the database; and In response to determining that the elapsed time has not exceeded the threshold, the processing of the second request in the database is rejected or delayed.
10. A computing device in a distributed computing system, the computing device comprising: processor; as well as A memory operatively coupled to the processor, the memory containing instructions operable by the processor to cause the computing device to perform the method according to any one of claims 1-9.
Citation Information
Patent Citations
Data storage method, device and equipment and storage medium
CN109710190A
Distributed, Transactional Key-Value Store
US20140156618A1
ORDER CONSTRAINT FOR TRANSACTION PROCESSING WITH SNAPSHOT ISOLATION ON NON-TRANSACTIONAL NoSQL SERVERS
US20170185636A1