Lock management associated with key-value database systems
By adopting a transaction management system in the database system and utilizing multiple data structures and lock management processes, the high competitive problem caused by locking a single data structure of the lock manager is solved, and lock management with high concurrency and throughput is achieved.
Patent Information
- Application Number
- CN202011605181.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-06-25
- Filing Date
- 2020-12-30
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2040-12-30
AI Technical Summary
Prior art When managing locks in database systems to achieve high concurrency and throughput, there is a problem that a single data structure lock of the lock manager leads to high competition, preventing concurrent execution threads.
Using a transaction management system, through multiple data structures and lock management processes, data locks are identified and released, delaying the release of the lock associated with a completed transaction until it is determined that the global oldest active transaction will begin after a completed transaction commit or abort.
This enables more efficient search, identification and release of data locks, promotes high-level transaction concurrency and throughput, and avoids the high competitive problems caused by locks in a single data structure of the lock manager.
Smart Images

Figure CN113127211B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates generally to memory subsystems and, more particularly, to lock management associated with key-value database systems. Background Art
[0002] The memory subsystem may include one or more memory devices that store data. The memory devices may be, for example, non-volatile memory devices and volatile memory devices. Typically, the host system may utilize the memory subsystem to store data at the memory devices and retrieve data from the memory devices. Summary of the invention
[0003] In one aspect, the present application relates to a method, comprising: acquiring a first data structure lock to access a first data structure in a first set of data structures to perform an operation associated with a transaction; performing the operation associated with the transaction, wherein the operation is one of the following: inserting a transaction into the first data structure or removing a transaction from the first data structure; identifying the oldest active transaction of the first data structure; determining a global oldest active transaction of the first set of data structures based on the oldest active transaction; accessing a second set of data structures containing information associated with completed transactions to identify a set of data locks associated with the completed transactions, each completed transaction having a transaction completion identifier that satisfies a condition when compared with a transaction start identifier associated with the global oldest active transaction; and releasing the set of data locks by a processing device.
[0004] In another aspect, the present application relates to a system comprising: a plurality of memory components; and a processing device operably coupled to the memory components to perform operations comprising: a transaction thread executed by a host system identifies an active transaction having a transaction start identifier as a globally oldest active transaction associated with a first set of data structures; compares a first tag value of a first data structure in a second set of data structures with the transaction start identifier to determine whether a first condition is satisfied; accesses the first data structure to identify a first set of data locks associated with one or more transactions, each transaction having a transaction completion identifier that satisfies a second condition when compared with the transaction start identifier; and releases the first set of data locks.
[0005] In another aspect, the present application relates to a non-transitory computer-readable medium comprising instructions, which, when executed by a processor, cause the processor to perform operations comprising: acquiring a first data structure lock to access a first data structure in a first set of data structures to perform an operation associated with a transaction; performing an operation associated with the transaction, wherein the operation is one of: inserting a transaction into the first data structure or removing a transaction from the first data structure; identifying an oldest active transaction of the first data structure; determining a global oldest active transaction of the first set of data structures based on the oldest active transaction; accessing a second set of data structures containing information associated with completed transactions to identify a set of data locks associated with the completed transactions, each completed transaction having a transaction completion identifier that satisfies a condition when compared with a transaction start identifier associated with the global oldest active transaction; and releasing, by a processing device, the set of data locks. BRIEF DESCRIPTION OF THE DRAWINGS
[0006] The present disclosure will be more fully understood from the detailed description given below and from the accompanying drawings of various embodiments of the present disclosure.
[0007] Figure 1 An exemplary computing system is shown that includes a host system coupled to a memory subsystem according to some embodiments of the present disclosure.
[0008] Figure 2 Management of multiple data structures to identify a globally oldest active transaction associated with a database system is shown in accordance with some embodiments of the present disclosure.
[0009] Figure 3 is a flow chart of an exemplary method 300 of managing active transaction groups to identify a globally oldest active transaction according to some embodiments of the present disclosure.
[0010] Figure 4 An exemplary set of lock data structures used by transaction management system 126 to identify and release eligible lock groups associated with a database system is shown.
[0011] Figure 5 is a flow chart of an exemplary method 500 of managing a set of lock data structures to identify a set of data locks to be released according to some embodiments of the present disclosure.
[0012] Figure 6 An example of lock inheritance processing performed by a transaction management system according to some embodiments of the present disclosure is shown.
[0013] Figure 7 is a block diagram of an exemplary computer system in which embodiments of the present disclosure may operate. DETAILED DESCRIPTION
[0014] Various aspects of the present disclosure relate to managing locks in a storage architecture based on a non-relational database type such as a key-value database (KVDB). A KVDB is an example of a collection of key-value groups (also referred to as a key-value store (KVS)) in a host system coupled to a memory subsystem. Each KVS can be a collection of keys and values. A KVS can be a tree of nodes, where each node contains a list of trees of key / value pairs. The memory subsystem can be a storage device, a memory module, or a mixture of a storage device and a memory module. Figure 1 Examples of storage devices and memory modules are described. In general, a host system may utilize a memory subsystem that includes one or more memory components, such as a memory device that stores data. The host system may provide data to be stored at the memory subsystem and may request data to be retrieved from the memory subsystem.
[0015] Key-value data structures accept key-value pairs (i.e., contain a key and a value) and are configured to be accessed by a host system thread to perform changes or modifications to a particular key (K) in the context of a transaction (T). The data structures used to manage key-value pairs may include dictionaries (e.g., maps, hash maps, etc.) and lists of keys in which links (or containing) corresponding values are stored. These database systems provide a set of operations to application software to store, retrieve, query, and transform data objects. Application software groups these operations into logical units called "transactions."
[0016] Each key in the KVDB is associated with a lock that a client thread attempts to acquire in order to modify it (e.g., as part of a transaction). In a KVDB, a memory location (e.g., volatile and / or non-volatile memory) may contain one or more versions of each key-value pair. If the lock is held by another transaction, the modification operation fails and the transaction is aborted. If the lock is not currently held, the transaction acquires the lock, performs the modification, and when the transaction commits, other client threads accessing the KVDB may see the corresponding changes.
[0017] After a lock associated with a transaction is acquired and held, the lock will be released. However, if a particular transaction commits, the lock cannot be released until every other transaction that has a history that overlaps with the particular transaction commits or aborts (e.g., if T1 starts after T0 starts; and T1 starts before T0 commits or aborts, then transactions T0 and T1 overlap each other). This places a significant burden on the system to manage and release locks held on behalf of previously committed transactions in response to committing or aborting overlapping transactions. To this end, conventional systems employ various techniques to manage one or more searchable data structures that contain information identifying locks currently held in conjunction with transactions being executed by one or more host system threads. The searchable data structures themselves are protected by locks (referred to herein as "data structure locks") that need to be exclusively acquired and held by a thread in order to access the data structure containing the data lock information. However, the data structure locks that protect the lock manager's searchable data structures are highly contended system resources that can only be held by a single thread at a given time, thereby preventing concurrent execution of threads.
[0018] For example, a transaction may involve transferring M dollars from bank account A to bank account B. In this example, the various operations associated with this transaction may include: operation 1.) start transaction; operation 2.) read the balance of account A as N dollars; operation 3.) read the balance of account B as P dollars; operation 4.) update the balance of account A to NM dollars; operation 5.) update the balance of account B to P+M dollars; operation 6.) commit transaction.
[0019] The exemplary operations described above may be executed as if they were simultaneous. Thus, each transaction is executed in isolation in time from any other transaction, i.e., there is a single serial order in which the transactions occur, also referred to as "full serializability". This can be achieved by preventing overlapping transactions, greatly limiting concurrency and performance. Full serializability can also be achieved by conceptually locking and unlocking data objects according to a complex protocol, but the complexity of such a mechanism still substantially limits performance.
[0020] However, application software does not typically require full serializability for correct operation. A "weaker" or less strict model may be employed, such as the "snapshot isolation" model. Snapshot isolation is implemented by acquiring and releasing conceptual locks associated with data objects, but it has a more efficient implementation than full serializability. A given transaction T acquires a lock for each data object it updates, resulting in a set of locks L(T) when T commits at time. The locks in L(T) must remain locked until every transaction whose execution overlaps with the execution of T commits or aborts. At this point, all locks in L(T) may be unlocked.
[0021] Aspects of the present disclosure address the above and other deficiencies by employing a transaction management system to employ data structures and lock management procedures to achieve high levels of transaction concurrency and throughput. The transaction management system identifies and registers a unique sequence number (e.g., a start sequence number) corresponding to each instance of a host system thread that begins executing a transaction. The transaction management system also identifies and registers a unique sequence number (e.g., a completion sequence number) corresponding to the completion (e.g., commit or abort) of each transaction.
[0022] The transaction management system can maintain multiple data structures (e.g., multiple separate transaction lists) to track and record the sequence numbers (e.g., start sequence numbers and completion sequence numbers) of each transaction in the system. For each of the corresponding lists (also referred to as "active transaction groups"), the transaction management system identifies the oldest active transaction.
[0023] Based on the oldest active transaction of each of the identified active transaction groups, the transaction management system can identify an overall or global oldest active transaction associated with all lists (e.g., all different active transaction groups). The global oldest active transaction information can be used to traverse a set of data structures (e.g., a set of buckets) to identify completed (e.g., committed or aborted) transactions and any sub-sets of locks held by the corresponding transactions during transaction execution. Release of a set of data locks associated with the completed transaction is delayed until it is determined that the global oldest active transaction was started after the completed transaction was committed (or aborted).
[0024] The transaction management system also manages the inheritance of one or more locks by transactions. In an embodiment, the transaction management system tracks the completion times (e.g., commit times or abort times) of all transactions (and the corresponding locks held by those transactions). The transaction management system enables a transaction to inherit one or more locks based on a comparison of the start time (e.g., start sequence number) of the transaction with the completion time (e.g., completion sequence number) of another transaction from which any subset of locks are to be inherited. For example, if a transaction (T1) starts after another transaction (T0) commits, then T1 does not overlap with T0, and T1 can acquire any subset of locks held by T0.
[0025] An advantage of the present disclosure is that the transaction management system described can more efficiently search, identify and release data locks to facilitate high levels of transaction concurrency. The transaction management system of the present disclosure employs an extensible configuration of data structures that avoids the lock manager having a single data structure protected by a single data structure lock. Advantageously, a high throughput of concurrently executing transactions is achieved using the lock reservation, release and inheritance protocols described herein.
[0026] According to aspects of the present disclosure, a database system is managed to provide consistency guarantees to application software according to a snapshot isolation model. According to an embodiment, locks can be conceptual in nature, such that locks are an artifact of the database system implementation that provides consistency guarantees. In an embodiment, the system tracks the oldest currently executing transaction to enable the system to determine when to release locks held by previously committed transactions while still maintaining the guarantees of snapshot isolation.
[0027] Figure 1 An exemplary computing system 100 is shown that includes a memory subsystem 110 according to some embodiments of the present disclosure. Memory subsystem 110 may include media such as one or more volatile memory devices (e.g., memory device 140), one or more non-volatile memory devices (e.g., memory device 130), or a combination thereof.
[0028] The memory subsystem 110 may be a storage device, a memory module, or a mixture of storage devices and memory modules. Examples of storage devices include solid-state drives (SSDs), flash drives, universal serial bus (USB) flash drives, embedded multimedia controllers (eMMC) drives, universal flash storage (UFS) drives, secure digital (SD) cards, and hard disk drives (HDDs). Examples of memory modules include dual inline memory modules (DIMMs), small outline DIMMs (SO-DIMMs), and various types of non-volatile dual inline memory modules (NVDIMMs).
[0029] The computing system 100 may be a computing device such as a desktop computer, a laptop computer, a network server, a mobile device, a vehicle (e.g., an airplane, a drone, a train, a car, or other transportation), an Internet of Things (IoT) enabled device, an embedded computer (e.g., a computer included in a vehicle, industrial equipment, or a networked business device), or such a computing device that includes a memory and a processing device.
[0030] The computing system 100 may include a host system 120 coupled to one or more memory subsystems 110. In some embodiments, the host system 120 is coupled to memory subsystems 110 of different types. Figure 1 An example of a host system 120 coupled to one memory subsystem 110 is shown. As used herein, "coupled to" or "coupled with" generally refers to a connection between components, such connection may be an indirect communication connection or a direct communication connection (e.g., without intervening components), whether wired or wireless, including connections such as electrical, optical, magnetic, etc.
[0031] The host system 120 may include a processor chipset and a software stack executed by the processor chipset. The processor chipset may include one or more cores, one or more caches, a memory controller (e.g., an NVDIMM controller), and a storage protocol controller (e.g., a PCIe controller, a SATA controller). For example, the host system 120 uses the memory subsystem 110 to write data to the memory subsystem 110 and read data from the memory subsystem 110.
[0032] The host system 120 may be coupled to the memory subsystem 110 via a physical host interface. Examples of the physical host interface include, but are not limited to, a serial advanced technology attachment (SATA) interface, a peripheral component interconnect (PCIe) interface, a universal serial bus (USB) interface, a fiber channel, a serial attached SCSI (SAS), a double data rate (DDR) memory bus, a small computer system interface (SCSI), a dual in-line memory module (DIMM) interface (e.g., a DIMM slot interface supporting double data rate (DDR)), etc. The physical host interface may be used to transfer data between the host system 120 and the memory subsystem 110. When the memory subsystem 110 is coupled to the host system 120 through a PCIe interface, the host system 120 may also utilize an NVM Express (NVMe) interface to access components (e.g., the memory device 130). The physical host interface may provide an interface for passing control, address, data, and other signals between the memory subsystem 110 and the host system 120. Figure 1 Memory subsystem 110 is shown as an example. In general, host system 120 can access multiple memory subsystems via the same communication connection, multiple separate communication connections, and / or a combination of communication connections.
[0033] The memory devices 130, 140 may include any combination of different types of non-volatile memory devices and / or volatile memory devices. Volatile memory devices (e.g., memory device 140) may be, but are not limited to, random access memory (RAM) such as dynamic random access memory (DRAM) and synchronous dynamic random access memory (SDRAM).
[0034] Some examples of non-volatile memory devices (e.g., memory device 130) include negative-AND (NAND) type flash memory and write-in-place memory, such as three-dimensional cross-point ("3D cross-point") memory. A cross-point array of non-volatile memory can be combined with a stackable cross-grid data access array to perform bit storage based on changes in body resistance. In addition, in contrast to many flash-based memories, cross-point non-volatile memory can perform write-in-place operations, where non-volatile memory cells can be programmed without previously erasing the non-volatile memory cells. NAND-type flash memory includes, for example, two-dimensional NAND (2D NAND) and three-dimensional NAND (3D NAND).
[0035] Each of the memory devices 130 may include one or more memory cell arrays. One type of memory cell, such as a single-level cell (SLC), may store one bit per cell. Other types of memory cells, such as multi-level cells (MLC), triple-level cells (TLC), and quad-level cells (QLC), may store multiple bits per cell. In some embodiments, each of the memory devices 130 may include one or more memory cell arrays, such as SLC, MLC, TLC, QLC, or any combination thereof. In some embodiments, a particular memory device may include an SLC portion, an MLC portion, a TLC portion, or a QLC portion of memory cells. The memory cells of the memory devices 130 may be grouped into pages, which may refer to logical units of a memory device for storing data. For certain types of memory (e.g., NAND), pages may be grouped to form blocks.
[0036] Although nonvolatile memory components such as a 3D cross-point array of nonvolatile memory cells and NAND-type flash memory (e.g., 2D NAND, 3D NAND) are described, the memory device 130 may be based on any other type of nonvolatile memory, such as read-only memory (ROM), phase change memory (PCM), self-select memory, other chalcogenide-based memories, ferroelectric transistor random access memory (FeTRAM), ferroelectric random access memory (FeRAM), magnetic random access memory (MRAM), spin transfer torque (STT)-MRAM, conductive bridging RAM (CBRAM), resistive random access memory (RRAM), oxide-based RRAM (OxRAM), negative OR (NOR) flash memory, electrically erasable programmable read-only memory (EEPROM), and a cross-point array of nonvolatile memory cells.
[0037] The memory subsystem controller 115 (or, for simplicity, the controller 115) may communicate with the memory device 130 to perform operations such as reading data, writing data, or erasing data at the memory device 130 and other such operations. The memory subsystem controller 115 may include hardware such as one or more integrated circuits and / or discrete components, buffer memory, or a combination thereof. The hardware may include digital circuits with dedicated (i.e., hard-coded) logic to perform the operations described herein. The memory subsystem controller 115 may be a microcontroller, a dedicated logic circuit (e.g., a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), etc.), or other suitable processor.
[0038] The memory subsystem controller 115 may include a processor 117 (e.g., a processing device) configured to execute instructions stored in a local memory 119. In the illustrated example, the local memory 119 of the memory subsystem controller 115 includes an embedded memory configured to store instructions for executing various processes, operations, logic flows, and routines that control the operation of the memory subsystem 110, including handling communications between the memory subsystem 110 and the host system 120.
[0039] In some embodiments, local memory 119 may include memory registers for storing memory pointers, fetch data, etc. Local memory 119 may also include read-only memory (ROM) for storing microcode. Figure 1 The exemplary memory subsystem 110 is shown to include a memory subsystem controller 115, but in another embodiment of the present disclosure, the memory subsystem 110 does not include a memory subsystem controller 115 and may instead rely on external control (e.g., provided by an external host, or by a processor or controller separate from the memory subsystem).
[0040] In general, the memory subsystem controller 115 may receive commands or operations from the host system 120, and may transform the commands or operations into instructions or appropriate commands to achieve the desired access to the memory device 130. The memory subsystem controller 115 may be responsible for other operations, such as wear leveling operations, garbage collection operations, error detection and error correction code (ECC) operations, encryption operations, cache operations, and address conversion between logical addresses (e.g., logical block address (LBA) namespace) and physical addresses (e.g., physical block addresses) associated with the memory device 130. The memory subsystem controller 115 may also include a host interface circuit to communicate with the host system 120 via a physical host interface. The host interface circuit may transform commands received from the host system into command instructions for accessing the memory device 130, and transform responses associated with the memory device 130 into information for the host system 120.
[0041] The memory subsystem 110 may also include additional circuits or components not shown. In some embodiments, the memory subsystem 110 may include a cache or buffer (e.g., DRAM) and address circuits (e.g., row decoders and column decoders) that receive addresses from the memory subsystem controller 115 and decode the addresses to access the memory device 130.
[0042] In some embodiments, the memory device 130 includes a local media controller 135 that operates with the memory subsystem controller 115 to perform operations on one or more memory units of the memory device 130. An external controller (e.g., the memory subsystem controller 115) can manage the memory device 130 externally (e.g., perform media management operations on the memory device 130). In some embodiments, the memory device 130 is a managed memory device, which is a raw memory device combined with a local controller (e.g., the local controller 135) for media management within the same memory device package. An example of a managed memory device is a managed NAND (MNAND) device.
[0043] The host system 120 includes one or more instances of KVDBs 125A to 125N. The host system 120 also includes a transaction management system 126 capable of managing transaction-related data structures associated with data stored in the KVDB. The controller 115 may include a processor 117 (processing device) configured to execute instructions stored in a local memory 119 for performing some of the operations described herein.
[0044] The transaction management system 126 assigns a unique sequence number corresponding to the start of the transaction to each transaction executed by an execution thread of the host system 120. The transaction and the corresponding unique sequence number (also referred to as a "transaction start identifier", "start sequence number" or "view sequence number") are registered (e.g., inserted) in a data structure (e.g., an active transaction group). The transaction management system 126 maintains a plurality of different data structures (a plurality of active transaction sets), each of which is associated with a corresponding data structure lock. In order to insert (or remove) a transaction into an active transaction group, the execution thread acquires a data structure lock (also referred to as a "mutex") corresponding to the active transaction group. In an embodiment, lock contention is distributed by employing a plurality of different active transaction groups, each of which requires a thread to acquire a corresponding data structure lock to access the active transaction group.
[0045] The transaction management system 126 identifies and registers unique sequence numbers (referred to as "transaction completion sequence numbers") for transaction completions (e.g., commits or aborts) corresponding to the active transaction group. The transaction start identifier and the transaction completion identifier are unique sequence numbers and are used to order starts (e.g., view sequence numbers) and commits (e.g., commit sequence numbers) in chronological order.
[0046] The transaction management system 126 identifies the oldest active transaction (e.g., the active transaction with the lowest value transaction start identifier of the active transactions listed in the active transaction group). In an embodiment, when a transaction is to be added or removed from the active transaction group, the corresponding thread acquires a data structure lock of the active transaction group to access the list to perform the add or remove operation.
[0047] Once the oldest active transaction for a particular active transaction group is identified, the transaction management system 126 identifies an overall or global oldest active transaction associated with all lists (e.g., all different active transaction groups). In an embodiment, the transaction management system 126 may acquire a global lock (also referred to as a "global view lock" or "minimum view lock") to access other active transaction groups to identify the corresponding oldest active transaction in each group. The respective oldest active transactions from each of the plurality of active transaction groups may then be compared to identify the global oldest active transaction (e.g., the active (e.g., uncommitted and unaborted) transaction with the lowest or oldest active transaction start sequence number).
[0048] The transaction management system 126 may use the global oldest active transaction information to compare with information stored in a separate set of data structures (e.g., a set of buckets) associated with completed transactions (referred to herein as "lock data structures" or "buckets"), the information containing information associated with completed (e.g., committed or aborted) transactions and corresponding one or more locks held by the respective completed transactions during the execution of those transactions. The transaction management system 126 may traverse the lock data structures to identify completed transactions having transaction completion identifiers (e.g., commit sequence numbers) that satisfy a condition when compared to a transaction start identifier (e.g., view sequence number) associated with the global oldest active transaction. In an embodiment, if the value of the transaction completion identifier of the completed transaction is lower than the value of the transaction start identifier of the global oldest active transaction, the condition is satisfied, indicating that the completed transaction was committed or aborted before the global oldest active transaction was started. When the condition is satisfied, a set of data locks associated with the completed transaction are safely released. In an embodiment, the release of the set of data locks associated with the completed transaction is delayed until it is determined that the global oldest active transaction was started after the completed transaction was committed (or aborted).
[0049] In an embodiment, the lock data structures are logically arranged in a circular configuration so that the transaction management system 126 can start traversal at any single lock data structure and move to the next lock data structure in the circular configuration (e.g., moving in a clockwise direction). Each of the lock data structures is protected by a corresponding data structure lock or mutex, which is acquired by a thread in order to access and traverse the lock data structure to identify a lock group to be released.
[0050] The transaction management system 126 manages the inheritance of one or more locks by transactions. In an embodiment, the transaction management system tracks the completion times (e.g., commit times or abort times) of all transactions (and the corresponding locks held by those transactions). The transaction management system enables a transaction to inherit one or more locks based on a comparison of the start time (e.g., start sequence number) of the transaction with the completion time (e.g., completion sequence number) of another transaction from which any subset of locks are to be inherited. For example, if a transaction (T1) starts after another transaction (T0) commits, then T1 does not overlap with T0, and T1 can acquire any subset of locks held by T0.
[0051] Figure 2 Management of multiple data structures (Active Transaction Sets ("ATS")) is shown to identify the globally oldest active transaction associated with a KVDB (also referred to as a "database system"). Figure 2 Three specific examples of active transaction groups (eg, data structure 1, data structure 2, and data structure N) are shown, but the scope of the present disclosure is not limited to the transaction management system (eg, Figure 1The transaction management system 126 may include any specific number of active transaction groups managed by the transaction management system 126 of the database system. Each of the active transaction groups contains a list of active transactions in the database system (e.g., transactions that have not yet been identified as committed or aborted). The transaction management system 126 may use the active transaction groups to track and identify the oldest active transaction (in the order of the oldest active transaction in each list) of each of the separate active transaction groups (e.g., the oldest active transaction in each list). Figure 2 The smallest view in the Figure 2 is called the “global minimum view”).
[0052] In an embodiment, an ATS (e.g., ATS 1, ATS 2 ... ATS N) may contain a list of active transactions sorted by corresponding transaction start identifiers (e.g., view sequence numbers) from lowest (e.g., oldest) to highest. In an embodiment, a transaction start identifier is obtained by a transaction to establish its view sequence number before any changes occur or locks are acquired. In an embodiment, a transaction start identifier is obtained by a transaction to establish its snapshot view of the KVDB before any operation (put, get, or delete) is started in the context of the transaction. In an embodiment, a view sequence number may be established even if no changes occur in the context of the transaction.
[0053] In an embodiment, an execution thread (e.g., thread ABC) of the host system 120 is designated to perform an operation associated with a transaction. In an embodiment, the operation may be to insert a transaction into an ATS (e.g., in response to the start of a new transaction) or to remove a transaction from an ATS (e.g., in response to the completion of a previously active transaction, such as a commit or abort). To perform the operation, the thread acquires a data structure lock to obtain access to the corresponding ATS. In an embodiment, the data structure selected for inserting the new transaction is derived from the current CPU to enable lock contention to be distributed among multiple data structure locks protecting the various ATSs.
[0054] In an embodiment, a transaction thread may access an ATS to perform one of the following operations: a transaction thread may insert a new transaction into an empty ATS, which results in a change or alteration of the minimum view of the ATS; a transaction thread may insert a new transaction into a non-empty ATS, which may change or alter the minimum view of the ATS; or a transaction thread may remove a transaction from a non-empty ATS, which may change or alter the minimum view of the ATS. In an embodiment, if any of these operations changes the global minimum view, further processing will be performed.
[0055] In an embodiment, a transaction thread may access an ATS to insert a transaction into a non-empty ATS, which does not change the minimum view of the ATS. In this case, the transaction management process may be terminated. For example, a thread that performs an operation to insert transaction T74 onto ATS 2 may determine that the ATS contains an older transaction (e.g., T3). Thus, the thread does not need to perform further processing after inserting T74 onto ATS 2. Similarly, a thread that performs an operation to remove transaction T290 from ATS N may determine that ATS N contains an older active transaction (e.g., T72). Therefore, the thread does not need to perform further processing after removing T290 from ATS N.
[0056] In an embodiment, if the operation to be performed by the thread is to insert a new transaction onto an empty ATS (e.g., a list containing no active transactions), or if the operation to be performed by the thread is to remove an active transaction from a non-empty ATS, or if the operation to be performed by the thread is to insert a new transaction onto an empty ATS, the thread may perform further transaction management processing to determine whether the particular transaction is the oldest active transaction of the ATS (e.g., a minimum view of the ATS), and if so, determine whether the global minimum view corresponding to all ATSs has been changed or updated.
[0057] In an instance of inserting a new transaction into an empty ATS, the thread identifies the inserted transaction as the oldest active transaction of the ATS (e.g., the smallest view of the ATS). The thread may then proceed to determine the global oldest active transaction across all ATSs. In an embodiment, the thread may acquire a lock that allows access to other ATSs (referred to herein as a "global smallest view lock"). Using the global smallest view lock, the thread may access other ATSs, identify the smallest view of each of the various ATSs (e.g., the oldest active transaction of each ATS), and compare these transactions to each other to identify the global smallest view (e.g., the global oldest active transaction).
[0058] In the instance of removing the oldest active transaction from the ATS (such as Figure 2 ), the thread acquires a data structure lock corresponding to the ATS in which the transaction is listed (as a subsequent active transaction). The thread uses the data structure lock to access the corresponding ATS and determines whether the transaction being removed is the oldest active transaction of the ATS. If so, the thread determines an updated or new oldest active transaction (e.g., the transaction with the lowest or oldest active transaction start identifier on the ATS after the transaction previously designated as the oldest active transaction is removed). In an embodiment, if the transaction to be removed is not the oldest active transaction in the ATS, the transaction management process can be ended.
[0059] exist Figure 2In the example shown, thread ABC acquires a data structure lock of ATS 1 to access the data structure to perform a removal operation associated with transaction T2. In this example, the operation is to remove T2 from ATS 1 in view of the completion (e.g., commit) of transaction T2. As shown, since T2 was the previously oldest active transaction, thread ABC determines the updated oldest active transaction of ATS 1. When removing T2 from ATS 1, thread ABC identifies T90 as the updated oldest active transaction of ATS 1. Thread ABC then acquires a minimum view lock to access other ATSs (e.g., ATS 2...ATS N) to compare T90 with the current minimum views of these other ATSs (e.g., T3 of ATS 2, T72 of ATS N). In this example, thread ABC identifies and designates T3 as the global minimum view of the system. Thread ABC can then use the global minimum view (e.g., T3) to identify a set of data locks associated with completed transactions that are eligible for release, as shown in reference. Figure 4 and 5 Described in more detail.
[0060] Figure 3 1 is a flow chart of an exemplary method 300 for managing active transaction groups to identify the oldest global active transaction according to some embodiments of the present disclosure. The method 300 may be performed by processing logic, which may include hardware (e.g., a processing device, a circuit, dedicated logic, programmable logic, microcode, hardware of a device, an integrated circuit, etc.), software (e.g., instructions running or executed on a processing device), or a combination thereof. In some embodiments, the method 300 may be performed by Figure 1 The transaction management system 126 of the host system 120 is executed. Although shown in a specific order or sequence, unless otherwise specified, the order of the processes can be modified. Therefore, the embodiments shown should be understood as examples only, and the processes shown can be performed in different orders, and some processes can be performed in parallel. In addition, one or more processes can be omitted in various embodiments. Therefore, not all processes are required in every embodiment. Other process flows are also possible.
[0061] At operation 310, processing logic acquires a first data structure lock to access a first data structure in a first set of data structures to perform an operation associated with a transaction associated with a database system. In an embodiment, the first set of data structures or an active transaction group (e.g., Figure 2 ATS 1, ATS 2 ... ATS N) of the database system contains multiple different lists of active transactions in the database system. In an embodiment, only a single execution thread can acquire the first data structure lock at a time.
[0062] At operation 320, processing logic performs an operation associated with the transaction, wherein the operation is one of: inserting the transaction into the first data structure or removing the transaction from the first data structure (i.e., when the transaction is the oldest active transaction on the ATS). In an embodiment, processing logic performs the operation (e.g., inserting or removing the transaction) after obtaining access to the first data structure using the acquired lock. In an embodiment, if the operation includes inserting the transaction in addition to or after an older active transaction already in the first data structure, processing logic terminates method 300.
[0063] At operation 330, processing logic identifies the oldest active transaction of the first data structure. In an embodiment, if the transaction is inserted into an empty first data structure, processing logic identifies the transaction as the oldest active transaction (e.g., corresponding to the smallest view of the ATS). In an embodiment, if the operation involves the removal of a transaction and the transaction is the current oldest active transaction in the first data structure, processing logic identifies the newer or next oldest active transaction (e.g., after the transaction is removed) and designates this transaction as the oldest active transaction. For example, if Figure 2 As shown, for an operation involving removal of T2 from ATS 1, processing logic identifies T90 as the next oldest active transaction listed in ATS 1 and designates T90 as the oldest active transaction (eg, the smallest view of the corresponding ATS).
[0064] At operation 340, processing logic determines the global oldest active transaction in the plurality of sets of data structures based on the oldest active transaction. In an embodiment, processing logic may acquire a lock (e.g., a minimum view lock) to access other data structures in the first set of data structures after identifying the oldest active transaction in the first data structure. Figure 2 In the example shown, processing logic uses the minimum view lock to access ATS 2 ... ATS N to identify the corresponding oldest active transaction listed in each of these data structures. Using the view sequence number and the commit sequence number corresponding to each corresponding transaction, the transaction management system can track the oldest active transaction in the system and use this information to traverse the data structure containing data lock information (i.e., the lock manager) representing completed (e.g., committed or aborted) transactions to identify data locks that are eligible for release. The transaction management system also implements an inheritance protocol to enable data locks to be inherited or acquired by a transaction from another non-overlapping transaction.
[0065] In an embodiment, if processing logic determines that the global minimum view sequence number (currently the oldest active transaction) is greater than the transaction start identifier of the transaction being removed (which may occur due to thread scheduling), processing logic may not perform operation 340 (e.g., processing logic does not acquire the minimum view lock).
[0066] At operation 350, processing logic accesses a second set of data structures containing information associated with completed transactions to identify a set of data locks associated with the completed transactions, each completed transaction having a transaction completion identifier that satisfies a condition when compared to a transaction start identifier associated with the oldest globally active transaction. In an embodiment, the second set of data structures (also referred to as "lock data structures", as shown in FIG. Figure 4 and 5 Detailed description and illustration of the invention) lists expired or completed transactions that hold a set of data locks that are eligible for release. In an embodiment, in response to determining that the global minimum view sequence number has changed due to the removal of transactions from the ATS, the second set of data structures is traversed. In an embodiment, if the global minimum view sequence number changes, the second set of data structures is traversed to potentially vacate or release the lock set.
[0067] In an embodiment, the transactions listed in each of the lock data structures of the second set of data structures are associated with a transaction completion identifier (e.g., a commit sequence number). In an embodiment, if the commit sequence number associated with the transaction listed in the lock data structure is lower than the view sequence number of the global oldest active transaction, the processing logic determines that the condition is satisfied. In an embodiment, the condition is satisfied indicating that the completed transaction was committed (or aborted) before the global oldest active transaction began, and as a result, the two transactions do not overlap and a set of data locks associated with the completed transaction can be released. In an embodiment, the lock group represents a list of all locks held by the transaction during the execution of the transaction. When the transaction is completed (aborted or committed), the lock set is placed or inserted into the lock data structure of the second set of data structures. In an embodiment, the corresponding lock groups of the transactions and lock data structures can be sorted by the commit sequence number (lowest to highest).
[0068] In an embodiment, processing logic acquires a lock (i.e., a data structure lock or a mutex) corresponding to each of the second set of data structures in order to access information contained in the data structures to determine which locks can be released. In an embodiment, the second set of data structures are arranged in a circular configuration (e.g., Figure 4 ), so that the processing logic can initiate operation 350 at any lock data structure of the second set of data structures to improve the lock contention associated with the data structure lock corresponding to the corresponding lock data structure. In an embodiment, in operation 350, the processing logic can move from one lock data structure in the second set of data structures to another lock data structure (e.g., in a clockwise manner) and acquire the corresponding data structure lock of each to perform a traversal of the second set of data structures in operation 350. In an embodiment, the processing logic can search and traverse a portion of the lock data structure of the second set of data structures, as described in more detail below.
[0069] At operation 360, processing logic releases a set of data locks. In an embodiment, the set of data locks identified in operation 350 may be collected by processing logic and released upon completion of traversal of the second set of data structures.
[0070] Figure 4 An exemplary set of more than 400 lock data structures 401 to 405 (eg, as described above in conjunction with Figure 3 The exemplary set of more than 400 lock data structures 401 to 405 are used by the transaction management system 126 to identify and release eligible lock groups associated with the KVDB. Figure 4 As shown, the lock data structures 401 to 405 may be arranged in a circular configuration so that the lock release process (e.g., Figure 5 The thread of the method 500 shown in FIG. 5 may initiate a traversal of multiple lock data structures by starting at any corresponding lock data structure and moving clockwise to the next lock data structure (eg, moving from 402 to 403), such as Figure 4 As shown by the arrow shown. In an embodiment, in order to access the corresponding lock data structure, the thread acquires the corresponding data structure lock (for example, lock 1 is acquired by the thread to access lock data structure 1).
[0071] Each lock data structure 401 to 405 in a set of lock data structures 400 contains information identifying completed transactions (e.g., transactions that have been submitted or aborted) and associated lock group information held by each transaction. In an embodiment, the lock data structure can list completed transactions in order of corresponding submission sequence numbers (from lowest to highest). For example, the content of lock data structure 2 contains a list of completed transactions (e.g., T1, T2, and T16), corresponding submission sequence numbers, and associated lock groups held by each transaction. As shown, T1 has the lowest submission sequence number (00047), followed by T2 (00063) and T16 (00119).
[0072] In an embodiment, when accessing the corresponding lock data structure, the thread traverses the transaction list (starting with the lowest commit sequence number) and uses the globally oldest active transaction (e.g., Figure 3 The thread determines whether a set of data locks (e.g., LS A, LS B, and LS C) can be released. In an embodiment, the thread compares the transaction start identifier associated with the globally oldest active transaction (i.e., the global minimum view sequence number) and the commit sequence number (e.g., T1) associated with the transaction listed in the lock data structure to determine whether the condition is met. In an embodiment, if the commit sequence number is lower than the global minimum view sequence number, the condition is met, indicating that the completed transaction (e.g., T1) was committed before the start of the globally oldest active transaction. If the condition is met, the thread determines that the corresponding lock group (e.g., LS A) can be released.
[0073] In an embodiment, a thread may not traverse the entire list of transactions in a lock data structure. For example, once a thread identifies a lock data structure that does not contain a lock group that can be released, the thread may terminate the search. In another example, a thread may terminate the traversal of a particular lock data structure upon identifying a transaction that does not meet a condition (e.g., has a commit sequence number that is higher than the global minimum view sequence number).
[0074] In an embodiment, each lock data structure is associated with a tag (e.g., tag 1, tag 2, tag 3, tag 4 ... tag N). The tag represents the last or most recently used "global minimum view sequence number" for traversing this particular lock data structure (e.g., during a previous iteration of a lock release process by another thread). In an embodiment, before traversing the lock data structure, the thread may compare the current global minimum view sequence (e.g., the minimum view sequence number that the thread plans to use to traverse the lock data structure) with the tag. In an embodiment, if the tag value is higher than the minimum view sequence number that the thread plans to apply, the thread may terminate the traversal of a set of lock data structures 400. In an embodiment, a lock data structure with a tag value that has a value higher than the global minimum view sequence number held by the thread indicates that this lock data structure has been previously traversed and the associated lock group has been released using the newer minimum view sequence number.
[0075] For example, if the global minimum view sequence number to be applied by the thread is 00058 and the corresponding tag (tag 2) for lock data structure 2 is 00009, the thread accesses the lock data structure to determine whether any lock groups can be released. In this example, during the traversal of the list of completed transactions in lock data structure 2, the thread compares the global minimum view sequence number (00058) with the commit sequence number (00047) of T1 and determines that T1 satisfies the condition (e.g., T1 is committed before the global oldest active transaction begins). Therefore, the thread proceeds to release LSA. Continuing this list, the thread compares the global minimum view sequence number (00058) with the commit sequence number (00063) of T2 and determines that T2 does not satisfy the condition and terminates the traversal of lock data structure 2.
[0076] In one example, if the thread continues to traverse the set of lock data structures and encounters lock data structure 4 with a tag value of 00061, the thread may terminate processing because lock data structure 4 has been traversed using a higher (eg, newer) minimum view sequence number.
[0077] Figure 5is a flow chart of an exemplary method 500 of managing a set of lock data structures to identify a set of data locks to be released according to some embodiments of the present disclosure. The method 500 may be performed by processing logic, which may include hardware (e.g., a processing device, a circuit, dedicated logic, programmable logic, microcode, hardware of a device, an integrated circuit, etc.), software (e.g., instructions running or executed on a processing device), or a combination thereof. In some embodiments, the method 500 may be performed by Figure 1 The transaction management system 126 of the host system 120 is executed. Although shown in a specific order or sequence, unless otherwise specified, the order of the processes can be modified. Therefore, the embodiments shown should be understood as examples only, and the processes shown can be performed in different orders, and some processes can be performed in parallel. In addition, one or more processes can be omitted in various embodiments. Therefore, not all processes are required in every embodiment. Other process flows are also possible.
[0078] At operation 510, processing logic identifies the active transaction with the transaction start identifier as the global oldest active transaction of the first set of data structures. In an embodiment, the global oldest active transaction (e.g., the transaction with the global smallest view sequence number) can be identified by the thread according to the above combination Figure 2 and 3 In an embodiment, the first plurality of data structures refers to an active transaction group, such as Figure 2 shown.
[0079] At operation 520, the processing logic compares the first tag value of the first data structure in the second set of data structures with the transaction start identifier to determine whether the first condition is satisfied. In an embodiment, the second set of data structures refers to a lock data structure, such as Figure 4 As described above, the tag value associated with the first data structure represents a previous "global minimum view sequence number" used to traverse the first data structure during a previous iteration of the lock release process of another thread. In an embodiment, the first condition is satisfied if the tag value is less than the transaction start identifier of the globally oldest active transaction. If the first condition is satisfied, the method 500 continues to operation 530.
[0080] At operation 530, processing logic accesses a first data structure to identify a first set of data locks associated with one or more transactions, each transaction having a transaction completion identifier that satisfies a second condition when compared to a transaction start identifier. In an embodiment, a thread acquires a lock associated with the first data structure to gain access to the lock data structure. In an embodiment, the thread compares the transaction start identifier (global minimum view sequence number) with the transaction completion identifiers (commit sequence numbers) of the transactions listed in the first data structure and determines whether the second condition is satisfied. If the transaction completion identifier is less than the transaction start identifier, the second condition is satisfied. If the second condition is satisfied, the thread identifies the first set of data locks associated with the completed transaction and determines that those locks can be released. In an embodiment, processing logic updates the tag value of the first data structure in the second set of data structures to reflect or identify the transaction start identifier.
[0081] At operation 540, processing logic compares a second tag value of a second data structure in the second set of data structures with the transaction start identifier to determine whether the first condition is satisfied. In an embodiment, when the thread moves in a clockwise direction between the plurality of lock data structures, the second data structure is the next lock data structure in the loop configuration, such as Figure 4 In an embodiment, the thread moves to a second data structure of a circular arrangement of data structures (eg, moves in a clockwise manner) and repeats the steps and functions of operation 520 .
[0082] At operation 550, processing logic accesses a second data structure to identify a second set of data locks associated with one or more transactions, each transaction having a transaction completion identifier that satisfies a second condition when compared to a transaction start identifier. In an embodiment, to access the second data structure, a thread acquires a lock configured to enable access to the second data structure. Note that when a thread is in a second set of data structures (e.g., Figure 4 When moving between multiple lock data structures within the lock data structures 1 to N), operations 540 and 550 can be iteratively repeated.
[0083] At operation 560, processing logic determines that the tag value of another data structure in the plurality of data structure groups does not satisfy the second condition. In an embodiment, the second condition is not satisfied if the tag value associated with the other data structure is higher than the transaction start identifier of the globally oldest active transaction. In this case, the thread uses the newer minimum view sequence number as part of a previous iteration of the lock release process to determine that the other data structure has been traversed by another thread. In an embodiment, if the first condition is not satisfied, method 500 proceeds to operation 570.
[0084] At operation 570, processing logic releases the first set of data locks (identified in operation 530) and the second set of data locks (identified in operation 550). In an embodiment, processing logic releases all lock sets identified during the traversal of the plurality of lock data structures in the set of lock data structures.
[0085] Figure 6 An example of lock inheritance processing performed by a transaction management system according to an embodiment of the present disclosure is shown. The example shown involves Figure 4 As shown, the thread can traverse the lock data structure 2 to identify transactions T1, T2, and T16 with ascending commit sequence numbers (e.g., 00047, 00063, and 00119, respectively). These transactions are associated with lock groups (T1 is associated with lock group A, T2 is associated with lock group B, and T19 is associated with lock group C), which contain locks held by the corresponding transactions.
[0086] In an embodiment, the transaction management system performs a lock inheritance process to enable a transaction to inherit one or more locks from another transaction. In an embodiment, a timeline is shown, which shows T1 of the lock structure 2. Each lock is associated with the commit sequence number of the transaction that successfully acquired the lock. When a transaction Tx attempts to acquire a lock currently held by another transaction (T1), the view sequence number of Tx is compared with the commit sequence number of T1. If the commit sequence number of T1 is greater than the view sequence number of Tx (or T1 has not yet been committed), an overlap is detected and Tx cannot inherit any subgroups from T1. In an embodiment, if the commit sequence number of T1 is less than the view sequence number of Tx (i.e., Tx starts after T1 commits), Tx inherits any subgroups from T1.
[0087] like Figure 6 As shown, before performing the inheritance operation, T1 holds locks K1, K6, and K8 and has a commit sequence number of 00047. Transaction Tx starts and acquires view sequence number
[00061] , and attempts to acquire locks K1, K6, and K8 during execution. In an embodiment, the thread executing Tx compares the commit sequence number of T1 (00047) with the view sequence number of Tx (000061). Based on this comparison, the thread determines that the commit sequence number T1 (00047) is less than the view sequence number Tx (000061). Therefore, the thread determines that Tx can inherit the lock from T1. The inheritance operation is performed, and Tx inherits K1, K6, and K8 from T1, as shown Figure 6 shown.
[0088] In an embodiment, after the inheritance operation, the transaction management system may determine that Tx aborted. Since Tx inherited locks from another transaction, when Tx aborts, the inherited locks are returned to the transaction from which the locks were inherited (T1). In an embodiment, an indication identifying the source of the inherited locks (e.g., the transaction from which one or more locks were inherited) is tracked relative to any subgroup of transactions that inherited the locks. Figure 6 In the example shown, Tx stores an indication identifying T1 because Tx inherited the lock from T1. If Tx is later aborted, this indication is used to identify T1, and the inherited locks (K1, K6, and K8) are returned to the source transaction T1. In an embodiment, any locks inherited by Tx are managed as if those locks had been acquired by Tx through a normal acquisition process (e.g., as if those locks were not inherited from T1). For example, if Tx acquires a lock (e.g., K7), the entry on the second set of data structures (lock data structure 2) may contain K1, K6, K7, and K8 with start and end sequence numbers associated with Tx.
[0089] Figure 7 An exemplary machine of computer system 700 is shown, within which a set of instructions for causing the machine to perform any one or more of the methodologies discussed herein may be executed. For example, computer system 700 may correspond to a host system (e.g., Figure 1 1) a host system 120 that includes, is coupled to, or utilizes a memory subsystem (e.g., Figure 1 host system 110), or can be used to perform operations of the controller (for example, execute an operating system to perform operations corresponding to Figure 1 In some embodiments, the machine may be connected (e.g., using a network) to other machines in a peer-to-peer (or distributed) network environment, or as a server or a client machine in a client-server network environment.
[0090] The machine may be a personal computer (PC), a tablet PC, a set-top box (STB), a personal digital assistant (PDA), a cellular phone, a web appliance, a server, a network router, a switch or a bridge, or any machine capable of executing a set of instructions (sequentially or otherwise) that specify actions to be taken by the machine. Furthermore, while a single machine is shown, the term "machine" should also be construed to include any collection of machines that individually or jointly execute a set (or multiple sets) of instructions to perform any one or more of the methodologies discussed herein.
[0091] The exemplary computer system 700 includes a processing device 702, a main memory 704 (e.g., read-only memory (ROM), flash memory, dynamic random access memory (DRAM) such as synchronous DRAM (SDRAM) or Rambus DRAM (RDRAM)), a static memory 706 (e.g., flash memory, static random access memory (SRAM), etc.), and a data storage device 718, which communicate with each other via a bus 730.
[0092] The processing device 702 represents one or more general-purpose processing devices, such as a microprocessor, a central processing unit, etc. More specifically, the processing device may be a complex instruction set computing (CISC) microprocessor, a reduced instruction set computing (RISC) microprocessor, a very long instruction word (VLIW) microprocessor, or a processor that implements other instruction sets, or a processor that implements a combination of instruction sets. The processing device 702 may also be one or more special-purpose processing devices, such as an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a digital signal processor (DSP), a network processor, etc. The processing device 702 is configured to execute instructions 726 for performing the operations and steps discussed herein. The computer system 700 may also include a network interface device 708 to communicate over a network 720. The data storage device 718 may include a machine-readable storage medium 724 (also referred to as a computer-readable medium) on which one or more sets of instructions or software 726 that represent any one or more methods or functions described herein are stored. The instructions 726 may also reside completely or at least partially within the main memory 704 and / or within the processing device 702, during execution of the instructions 726 by the computer system 700, the main memory 704 and the processing device 702 also constituting machine-readable storage media. The machine-readable storage medium 724, the data storage device 718, and / or the main memory 704 may correspond to Figure 1 Memory subsystem 110.
[0093] In one embodiment, instructions 726 include implementing instructions corresponding to a particular component (e.g. Figure 1 The machine-readable storage medium 724 is a single medium, but the term "machine-readable storage medium" should be understood to include a single medium or multiple media (e.g., a centralized or distributed database, and / or associated caches and servers) storing one or more sets of instructions. The term "machine-readable storage medium" should also be understood to include any medium capable of storing or encoding a set of instructions for execution by a machine and causing the machine to perform any one or more methods of the present disclosure. Therefore, the term "machine-readable storage medium" should be understood to include, but not limited to, solid-state memory, optical media, and magnetic media.
[0094] Some parts of the foregoing detailed description have been given according to the algorithm and symbolic representation of the operation of the data bits in the computer memory. These algorithmic descriptions and representations are the ways that the technical personnel in the field of data processing use to most effectively convey the essence of their work to other technical personnel in the field. The algorithm here is generally considered to be a self-consistent sequence of operations that leads to a desired result. These operations are operations that require physical manipulation of physical quantities. Usually, although not necessarily, these quantities take the form of electrical or magnetic signals that can be stored, combined, compared and otherwise manipulated. Mainly for the reason of common use, it is sometimes proved to be convenient to refer to these signals as bits, values, elements, symbols, characters, items, numbers, etc.
[0095] It should be remembered, however, that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless otherwise noted, as is apparent from the above discussion, it should be understood that throughout this specification, discussions utilizing terms such as "receive" or "serve" or "publish" refer to the actions and processes of a computer system or similar electronic computing device that processes and transforms data represented as physical (electronic) quantities within the computer system's registers and memories into other data similarly represented as physical quantities within the computer system's memories or registers or other such information storage devices.
[0096] The present disclosure also relates to an apparatus for performing the operations herein. This apparatus may be specially constructed for the intended purpose, or it may comprise a general purpose computer selectively activated or reconfigured by a computer program stored in the computer. Such a computer program may be stored in a computer readable storage medium, such as, but not limited to, any type of disk, including floppy disks, optical disks, CD-ROMs and magneto-optical disks, read-only memories (ROMs), random access memories (RAMs), EPROMs, EEPROMs, magnetic or optical cards, or any type of medium suitable for storing electronic instructions, each coupled to a computer system bus.
[0097] The algorithms and displays presented herein are not inherently related to any particular computer or other device. According to the teachings herein, various general purpose systems may be used with the program, or it may prove convenient to construct more specialized equipment to perform the method. The structures of various these systems will be set forth in the following description. In addition, the present disclosure is not described with reference to any particular programming language. It will be appreciated that various programming languages may be used to implement the teachings of the present invention as described herein.
[0098] The present invention may be provided as a computer program product or software, which may include a machine-readable medium having instructions stored thereon, which may be used to program a computer system (or other electronic device) to perform a process according to the present disclosure. A machine-readable medium includes any mechanism for storing information in a machine (e.g., computer) readable form. For example, a machine-readable (e.g., computer-readable) medium includes a machine (e.g., computer) readable storage medium such as a read-only memory ("ROM"), a random access memory ("RAM"), a magnetic disk storage medium, an optical storage medium, a flash memory device, etc.
[0099] In the foregoing description, embodiments of the present disclosure have been described with reference to specific exemplary embodiments of the present disclosure. Obviously, various modifications may be made thereto without departing from the broader spirit and scope of the embodiments of the present disclosure as set forth in the appended claims. Therefore, the description and the accompanying drawings are to be regarded as illustrative rather than restrictive.
Claims
1. A method for lock management, comprising: Acquiring a first data structure lock to access a first data structure in the first set of data structures to perform an operation associated with the transaction; performing the operation associated with the transaction, wherein the operation is one of: inserting the transaction into the first data structure or removing the transaction from the first data structure; identifying the oldest active transaction of said first data structure; Acquiring a global lock to access remaining data structures in the first set of data structures; accessing the remaining data structures in the first set of data structures using the global lock to determine a globally oldest active transaction for the first set of data structures based on the oldest active transaction; accessing a second set of data structures containing information associated with completed transactions to identify a set of data locks associated with completed transactions, each of the completed transactions having a transaction completion identifier that satisfies a condition when compared to a transaction start identifier associated with the globally oldest active transaction; as well as The set of data locks is released by the processing device.
2. The method according to claim 1, wherein: Each data structure in the first set of data structures includes a list of active transactions associated with a database system.
3. The method according to claim 2, wherein: Each active transaction is associated with an automatically incremented transaction start identifier.
4. The method according to claim 1, wherein: The operation includes inserting the transaction into the first data structure, and wherein the first data structure is empty.
5. The method according to claim 1, wherein: An oldest active transaction is identified for each data structure in the first set of data structures.
6. The method according to claim 5, wherein: Determining the global oldest active transaction further includes: comparing a plurality of transaction start identifiers, each of the transaction start identifiers being associated with an oldest active transaction identified for each data structure in the first set of data structures; and The globally oldest active transaction having a lowest transaction start identifier among the plurality of transaction start identifiers is identified.
7. The method according to claim 1, wherein: The condition is satisfied when the transaction start identifier associated with the globally oldest active transaction is greater than a transaction completion identifier associated with a completed transaction stored in the second set of data structures.
8. A system for lock management, comprising: multiple memory components; as well as a processing device operably coupled to the memory component to perform operations comprising: A transaction thread executed by the host system acquires a global lock to access a first set of data structures; accessing the first set of data structures using the global lock; identifying, by the transaction thread, an active transaction having a transaction start identifier as a globally oldest active transaction associated with the first set of data structures; comparing a first tag value of a first data structure in the second set of data structures with the transaction start identifier to determine whether a first condition is satisfied; accessing the first data structure to identify a first set of data locks associated with one or more transactions, each of the transactions having a transaction completion identifier that satisfies a second condition when compared to the transaction start identifier; as well as The first set of data locks is released.
9. The system according to claim 8, wherein: The first condition is satisfied when the first marker value is lower than the transaction start identifier.
10. The system according to claim 8, wherein: The second set of data structures includes a plurality of lock data structures including a list of completed transactions and associated lock information.
11. The system according to claim 10, wherein: The processing device also performs operations including acquiring a first lock to obtain access to the first data structure.
12. The system according to claim 11, wherein: The processing device also performs the following operations: A second tag value of a second data structure in the second set of data structures is compared to the transaction start identifier to determine whether the first condition is satisfied.
13. The system according to claim 12, wherein: The processing device also performs operations including traversing the second data structure to identify a second set of data locks associated with one or more transactions, each of the transactions having a transaction completion identifier that satisfies the second condition when compared to the transaction start identifier.
14. The system according to claim 13, wherein: The processing device also performs operations including releasing the second set of data locks.
15. The system of claim 13, wherein: The processing device also performs the following operations: It is determined that a tag value of another data structure in the second set of data structures does not satisfy the first condition, wherein the transaction thread does not acquire another lock corresponding to the another data structure.
16. The system according to claim 8, wherein: The processing device also performs the following operations: identifying an additional transaction attempting to acquire a set of data locks from the first completed transaction; determining that the additional transaction is associated with a transaction start identifier that is higher than a transaction completion identifier of the first completed transaction; as well as An inheritance operation is performed to enable the additional transaction to acquire the set of data locks from the first completed transaction.
17. The system of claim 16, wherein: The processing device also performs the following operations: determining that the additional transaction is aborted; and An operation is performed to return the set of data locks to the first completed transaction.
18. A non-transitory computer readable medium comprising instructions that, when executed by a processor, cause the processor to perform operations comprising: Acquiring a first data structure lock to access a first data structure in the first set of data structures to perform an operation associated with the transaction; performing the operation associated with the transaction, wherein the operation is one of: inserting the transaction into the first data structure or removing the transaction from the first data structure; identifying the oldest active transaction of said first data structure; Acquiring a global lock to access remaining data structures in the first set of data structures; accessing the remaining data structures in the first set of data structures using the global lock to determine a globally oldest active transaction for the first set of data structures based on the oldest active transaction; accessing a second set of data structures containing information associated with completed transactions to identify a set of data locks associated with completed transactions, each of the completed transactions having a transaction completion identifier that satisfies a condition when compared to a transaction start identifier associated with the globally oldest active transaction; as well as The set of data locks is released by the processing device.
19. The non-transitory computer readable medium of claim 18, wherein: An oldest active transaction is identified for each data structure in the first set of data structures.
20. The non-transitory computer readable medium of claim 18, wherein: Determining the global oldest active transaction further includes: comparing a plurality of transaction start identifiers, each of the transaction start identifiers being associated with an oldest active transaction identified for each data structure in the first set of data structures; and The globally oldest active transaction having a lowest transaction start identifier among the plurality of transaction start identifiers is identified.
Citation Information
Patent Citations
Method, apparatus and system for strong atomicity in a transactional memory system
CN103544054A
Method and system for processing distributed transaction
CN106033437A