WO2020025124A1 - Device and method for rollback of a structure modification operation - Google Patents

Device and method for rollback of a structure modification operation Download PDF

Info

Publication number
WO2020025124A1
WO2020025124A1 PCT/EP2018/070821 EP2018070821W WO2020025124A1 WO 2020025124 A1 WO2020025124 A1 WO 2020025124A1 EP 2018070821 W EP2018070821 W EP 2018070821W WO 2020025124 A1 WO2020025124 A1 WO 2020025124A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
replica
retired
parent
structure modification
Prior art date
Application number
PCT/EP2018/070821
Other languages
French (fr)
Inventor
Oren AMOR
Liran MISHALI
Shay Goikhman
Original Assignee
Huawei Technologies Co., Ltd.
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co., Ltd. filed Critical Huawei Technologies Co., Ltd.
Priority to PCT/EP2018/070821 priority Critical patent/WO2020025124A1/en
Publication of WO2020025124A1 publication Critical patent/WO2020025124A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing

Definitions

  • the present invention relates to the field of data structures, in particular for relational database management systems (RDBMSs). More specifically, the present invention provides a device for safe and consistent rollback of a structure modification operation that was applied to said data structure.
  • RDBMSs relational database management systems
  • RDBMSs use a lot of data structures, e.g. tables, catalogs, primary and secondary indexes for transaction processing with ACID properties.
  • ACID atomicity, consistency, isolation, durability
  • ACID is a set of properties of database transactions intended to guarantee validity even in the event of errors.
  • the changes of operations performed on these data structures should become visible on the transaction’s commit to all other running transactions. If the transaction aborts, any modifications on any involved index or other data caused by the transaction should be un-done. While the data structures can be globally locked by a transaction to avoid races among concurrently executing queries and updates of transactions, this would totally serialize transaction processing, prohibiting any intent of scalability.
  • node stands for an element of a data structure, such that the data structure (also called a“dynamic object”) is a collection of nodes. Nodes could be heterogeneous. The dynamic object also holds explicitly relationships between the nodes in the collection, e.g., tree or liked-list, or a priority queue.
  • a data structure definition in terms of nodes is usually recursive, i.e. refer to other nodes, such as for example, a binary tree is a node (root) that has two sub-tree roots as children.
  • the present invention aims to improve the conventional lock-free structure modification operation.
  • the present invention has the object to provide a device and method for safe and consistent rollback of a structure modification operation.
  • the present invention therefore utilizes lock-free update techniques and hazard pointers, to build an SMO rollback mechanism.
  • the rollback is based on the particulars of these techniques and guarantees safety and consistency.
  • a SMO a replica node of a node is created, the structure modification operation is applied to the replica node, while the node is becoming a retired node.
  • the present invention is based on the effect that the retired node is in 1:1 correspondence to the node installed by the SMO.
  • a safety condition of the present invention is based on an atomic reinstallation of the retired node which is the pre-SMO image of the replica node.
  • a consistency condition of the present invention guarantees that a reachability of any possibly affected node after the rollback is performed is the same as it is before the SMO, in particular by checking for common children between the replica node and the retired node.
  • the present invention provides a new operation called rollback on a lock-free object.
  • the rollback is applied to the node affected by an SMO.
  • Logically, rollback is equivalent to an inversed SMO, i.e. undoing the SMO from the perspective of the dynamic object.
  • Rollback of an SMO is in particular implemented by atomically reinstalling a corresponding retired node from an undo list, thereby replacing the node affected by the SMO. Thereby, conditions guaranteeing consistency and safety of rollback are provided, and an expensive full-fledged logical reverse operation of the protocol can be avoided.
  • a first aspect of the present invention provides a device for safe and consistent rollback of a structure modification operation, wherein the structure comprises a plurality of nodes, the device being configured to, for structure modification, create a replica node of a node, of the plurality of nodes; apply the structure modification operation to the replica node; associate the replica node with a parent node; remove an association of the node and the parent node, thereby making the node a retired node; and store the retired node as an entry in an undo list; and for rollback, associate the retired node with the parent node; and remove association of the replica node and the parent node, thereby rolling back the structure modification operation.
  • the entry in the undo list maintains a first pointer to the parent node and a second pointer to the replica node.
  • An advantage of the device is that, since if no rollback operation is available in the pior art, a full-fledged reverse SMO had to be performed, starting with a search of a node from a root node, and while finding the node, executing a possible multi-step inverse SMO protocol. Another advantage is, that the solution of the present invention is cheap since it leverages well known infrastructure and no significant additional infrastructure is required. Additional an advantage is that the rollback is fast, and it avoids overhead on some other transaction that has read the node.
  • the device is further configured to determine, by means of the first pointer and the second pointer, if the replica node is associated with the parent node.
  • the device is further configured to skip associating the retired node with the parent node, and removing association of the replica node and the parent node, if the replica node is not associated with the parent node, thereby verifying that no intermediate structure modification operation was applied to the replica node.
  • the structure modification operation includes adding and/or associating a child node to the replica node.
  • the device is further configured to determine a state of the child node of the replica node, after the structure modification operation is performed.
  • the entry in the undo list further includes information regarding the child node.
  • the device is further configured to skip associating the retired node with the parent node, and removing association of the replica node and the parent node, based on the state of the child node.
  • associating the retired node with the parent node and removing the association of the replica node and the parent node includes applying a compare and swap operation to the parent node.
  • the device is further configured to determine, whether a hazard pointer is pointing at the retired node in the undo list.
  • the device is further configured to remove the entry from the undo list, if no hazard pointer is pointing at the retired node in the undo list.
  • the undo list is a private thread list.
  • replica node and the node are data- structures, in particular for use in a relational database management system.
  • the structure modification operation is an update operation, an insert operation, a delete operation, or any kind of operation or transaction, for use in a relational database management system.
  • a second aspect of the present invention provides a method for safe and consistent rollback of a structure modification operation, wherein the structure comprises a plurality of nodes, the method comprising the steps of, for structure modification, creating a replica node of a node of the plurality of nodes; applying the structure modification operation to the replica node; associating the replica node with a parent node; removing an association of the node and the parent node, thereby making the node a retired node; and storing the retired node as an entry in an undo list; and for rollback associating the retired node with the parent node, and removing association of the replica node and the parent node, thereby rolling back the structure modification operation.
  • the entry in the undo list maintains a first pointer to the parent node and a second pointer to the replica node.
  • the method further includes the step of determining, by means of the first pointer and the second pointer, if the replica node is associated with the parent node.
  • the method further includes the step of skipping associating the retired node with the parent node, and removing association of the replica node and the parent node, if the replica node is not associated with the parent node, thereby verifying that no intermediate structure modification operation was applied to the replica node.
  • the structure modification operation includes adding and/or associating a child node to the replica node.
  • the method further includes the step of determining a state of the child node of the replica node, after the structure modification operation is performed.
  • the entry in the undo list further includes information regarding the child node.
  • the method further includes the step of skipping associating the retired node with the parent node, and removing association of the replica node and the parent node, based on the state of the child node.
  • associating the retired node with the parent node and removing the association of the replica node and the parent node includes applying a compare and swap operation to the parent node.
  • the method further includes the step of determining, whether a hazard pointer is pointing at the retired node in the undo list.
  • the method further includes the step of removing the entry from the undo list, if no hazard pointer is pointing at the retired node in the undo list.
  • the undo list is a private thread list.
  • replica node and the node are data-structures, in particular for use in a relational database management system.
  • the structure modification operation is an update operation, an insert operation, a delete operation, or any kind of operation or transaction, for use in a relational database management system.
  • the method of the second aspect and its implementation forms include the same advantages as the device according to the first aspect and its implementation forms.
  • a third aspect of the present invention provides a computer program product comprising a program code for controlling the device according to the first aspect or any one of its implementation forms, or for performing, when running on a computer, the method according to the second aspect or any one of its implementation forms.
  • the computer program product of the third aspect includes the same advantages as the device according to the first aspect and its implementation forms.
  • FIG. 1 shows a schematic view of a device according to an embodiment of the present invention.
  • FIG. 2 shows a schematic view of a device according to an embodiment of the present invention in more detail.
  • FIG. 3 shows a schematic view of operations performed on nodes by means of the device.
  • FIG. 4 shows another schematic view of operations performed on nodes by means of the device.
  • FIG. 5 shows a schematic view of an operating principle for rollback according to the present invention.
  • FIG. 6 shows another schematic view of an operating principle for rollback according to the present invention.
  • FIG. 7 shows another schematic view of an operating principle for rollback according to the present invention regarding rollback reduction
  • FIG. 8 shows a schematic view of a method according to an embodiment of the present invention.
  • Fig. 1 shows, in Fig. 1A, 1B and 1C, a device 100 for rollback R of a structure modification M operation.
  • the device 100 in particular allows for a safe and consistent way of rollback, i.e. of undoing a structure modification M operation that was applied to a data- structure.
  • the data- structure is in particular a data- structure suitable for use in an RDBMS.
  • the structure modification M operation can e.g. be an update operation, or an insert operation, or a delete operation, or any kind of operation or transaction, for use in an RDBMS.
  • the device 100 is configured to, for structure modification M: Create a replica node 101 of a node 102; apply the structure modification M operation to the replica node 101; associate the replica node 101 with a parent node 103; remove an association of the node 101 and the parent node 103, thereby making the node 102 a retired node 102’; and store the retired node 102’ as an entry in an undo list 104.
  • This process is in particular illustrated in Fig. 1A and Fig. 1B.
  • the structure modification M operation is illustrated by the arrow labelled by“M”.
  • the steps of associating the replica node 101 with the parent node 103; and removing an association of the node 101 and the parent node 103 are in particular performed as one single step.
  • the replica node 101, the node 102, and the parent node 103 thereby represent the above data- structure or a part of the above data- structure.
  • the undo list 104 can in particular be a private thread list.
  • the device 100 For performing the rollback operation, that is, for undoing the structure modification M operation, the device 100 is configured to associate the retired node 102’ with the parent node 103, and to remove association of the replica node 101 and the parent node 103, thereby rolling back R the structure modification M operation.
  • This process is in particular illustrated in Figs. 1B and Fig. 1C.
  • the rollback R operation is illustrated by the arrow labelled by“R”.
  • Fig. 2 shows, in Fig. 2A, 2B and 2C, a device 100 according to an embodiment of the present invention in more detail.
  • the device 100 of Fig. 2 includes all features and functionality as the device 100 of Fig. 1. To this end, identical features are labelled with identical reference signs. All features that are going to be described in view of Fig. 2 are optional features of the device 100.
  • the entry in the undo list 104 can maintain a first pointer 201 to the parent node 103 and a second pointer 202 to the replica node 101.
  • the first pointer 201 and the second pointer 202 can in particular be stored related to the retired node 102’.
  • the device 100 can in particular determine, if the replica node 101 is associated with the parent node 103. Based on said two pointers 201, 202, the device 100 can determine if a further structure modification is applied to the replica node 101, that is, if the replica node still corresponds to the retired node 102’ in the undo list, or not.
  • the device 100 is configured to skip associating the retired node 102’ with the parent node 103, and also skip removing association of the replica node 101 and the parent node 103, if the replica node 101 is not associated with the parent node 103, thereby verifying that an intermediate structure modification operation was applied to the replica node 101.
  • the structure modification M operation can include adding and/or associating a child node 203 to the replica node 101.
  • Information regarding the child node 203 can be evaluated by the device 100 when determining, if a desired rollback R operation is possible or not.
  • the device 100 is further configured to determine a state of the child node 203 of the replica node 101, after the structure modification M operation is performed.
  • the state in particular includes information if the child node 203 was modified after the SMO, or not. This state allows to determine if a rollback R operation is possible or not.
  • the entry in the undo list 104 further can include information regarding the child node 203, which can also be considered when deciding if a rollback is possible.
  • the device 100 can be further configured to skip associating the retired node 102’ with the parent node 103, and removing association of the replica node 101 and the parent node 103, based on the state of the child node 203.
  • the child node 203 is a leaf
  • rollback is possible, if it is no leaf (i.e. if others nodes depend on the child node 203), then no rollback is possible.
  • the retired node 102’ is associated again with the parent node 103 and the association of the replica 101 node and the parent node 103 is removed.
  • the associating the retired node 102’ with the parent node 103 and the removing the association of the replica 101 node and the parent node 103 may include applying a compare and swap (CAS) operation to the parent node 103.
  • CAS compare and swap
  • the replica node 101 (being a newly retired node) is moved to the undo list. It can be decided to remove the replica node 101 from the undo list 104, to safe resources. This is implemented in particular by means of using a hazards pointers. To this end, the device 100 further can be configured to determine, whether some hazard pointer is pointing at the replica node 10 G in the undo list 104, or not. The entry can be removed from the undo list 104, if no hazard pointer 204 is pointing at the retired node 10 G in the undo list 104.
  • version numbers are kept on index nodes, as it is also required by a commit protocol (e.g. silo).
  • An update, insert, or delete, operation, also referred to as an SMO, on an internal node data index can in particular done as described in the following:
  • a replica node 101 of a node 102 with higher version is created by an updating thread.
  • the update i.e. the SMO
  • the update is then applied on the replica node 102.
  • a compare-and-swap (CAS) operation is performed on the parent node 103 of the node 102, installing the replica node 101 (i.e. the new node) in place of the node 102, thereby removing the node 102.
  • CAS compare-and-swap
  • the removed node 102 now called retired node 102’, is held in a private thread list (undo list 104), until its reclamation time (i.e. the reclamation time of the retired node 102’) as determined by hazard pointers of all other threads.
  • a commit protocol e.g. silo
  • hazard pointers 204 can be used for safe memory reclamation.
  • Hazard pointers 204 are an established technique for reclamation of memory of removed nodes in a lock-free algorithm.
  • the basic idea of hazard pointers 204 is as follows: Any thread in a lock-free algorithm is free to proceed autonomously and access or modify atomically any node in an object (e.g. the data- structure on which the device 100 operates). Therefore, a thread may hold a reference (hazard reference) to a node that might be removed by another thread. A thread removing a node places the removed node in its private list until reclamation of the node is allowed. This invention makes use of a modified version of such a private list, as it is going to be described below.
  • Each thread announces its guaranteed hazardous access by setting its hazard pointer 204 to the hazard reference.
  • a removing thread periodically scans hazard pointer references of all other threads. If a hazard reference / hazard pointer 204 to a removed thread is found, the node cannot be reclaimed yet. Otherwise the node can be reclaimed.
  • Fig. 3 in particular shows an update operation in a lock-free protocol.
  • a replica node 101 of a node 102 is created, including required modification, and including an additional child node 203.
  • a pointer from a parent node 103 to the node 102 is atomically modified to point from the parent node 103 to the replica node 101 using a CAS operation.
  • the retired node 102’ is then placed in a thread’s private undo list 104.
  • the retired node 102’ holds a pointer 201 to its previous parent node 103, and a pointer 202 to the newly installed node 101 (i.e. the replica node 101), and to other information in the undo list 104.
  • the tread performs the operation CAS (103,101,102’ - i.e. a compare and swap operation with parameters “parent node 103”, “replica node 101”, and “retired node 102”’. If successful, the structure depicted on the right side of Fig. 4 is obtained by the rollback R operation. It is to be noted that newly installed node 101 has an additional child (the rightmost). The other children are common to the new node 101 and the retired node 102’.
  • CTART ctrie -based concurrent art
  • ART adaptive radix tree
  • CTART employs hazard pointers for memory reclamation. Since an insert in an ART performs lazy evaluation and path compression resulting in growth of the tree height, the related delete operation needs to reduce the height of the tree, performing reverse path compression after a leaf’s removal, thereby propagating modifications up towards the root of the tree.
  • the ctrie protocol introduces specialized“tomb” nodes in the multi-step method of path compression, and CTART protocol adapts it, specifically for ART topology.
  • the present invention supplements CTART with a rollback R operation using the hazard pointer framework, as described above.
  • the private retired node list 104 is implemented as a stack of rollback records containing quadruples (retired node 102’, parent 103, node 101, differentiating child 203). At each SMO, this stack 104 is pushed with a new quadruple. After successful rollback, the quadruple can be reclaimed. If no hazard pointer 204 is pointing at the SMO node 102’ (i.e. the retired node 102’), this node 102’ can also be reclaimed.
  • the differentiating child 203 has a new subtree, it can be checked if an insert of the root of the subtree with the differentiating child 203 into the retired node 102’ is possible, safe and is simple enough. If the differentiating child is a leaf, it has been installed by the SMO, and it can be rolled back, see Fig. 5. Otherwise if it is an I- node, there might have been another SMO that has modified the subtree under the differentiating child 203. Then, rollback R is not possible.
  • the resulting implementation is stable and enables rolling back SMOs and a reduction of processing steps that are necessary for rollback.
  • Fig. 6 shows a reduction of a series of rollback operations. Reduction of several rollback operations to one operation is possible, when the retired node of one SMO is the node of the previous SMO. For example, a transaction that included several SMOs ⁇ SMOl, SM02, ... , SMOn ⁇ , can be rolled back at once. In other words, if a sequence of rollbacks is needed, and the stack in the undo list satisfies reachability conditions, then the sequence of rollbacks can be fulfilled with one CAS operation. Correct order relationship and rollback correctness can be checked by a stack of quadruples and by performing check as described in view of Fig. 5.
  • Fig. 7 shows a reduction algorithm used in the description regarding Fig. 6.
  • Fig. 8 shows a method 800 for operating the device 100. That is, the method 800 also is for safe and consistent rollback of a structure modification M operation, and comprises the following steps:
  • the method comprises a first step of creating 801 a replica node 101 of a node 102, a second step of applying 802 the structure modification M operation to the replica node 101, a third step of associating 803 the replica node 101 with a parent node 103, a fourth step of removing 804 an association of the node 102 and the parent node 103, thereby making the node 102 a retired node 102’, and a fifth step of storing 805 the retired node 102’ as an entry in an undo list 104.
  • the method comprises a sixth step of associating 806 the retired node 102’ with the parent node 103, and a seventh step of removing 807 association of the replica node 101 and the parent node 103, thereby rolling back R the structure modification M operation.
  • the present invention also provides a computer program product comprising a program code for controlling a device 100 or for performing, when running on a computer, the method 800.
  • the computer program product includes any kind of computer readable data, including e.g. any kind of storage, or information that is transmitted via a communication network.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention relates to the field of data structures, in particular for relational database management systems and provides a device for safe and consistent rollback of a structure modification operation which was applied to said data structure. To this end, the device is configured to, for structure modification: create a replica node of a node; apply the structure modification operation to the replica node; associate the replica node with a parent node; remove an association of the node and the parent node, thereby making the node a retired node; and store the retired node as an entry in an undo list; and for rollback: associate the retired node with the parent node; and remove association of the replica node and the parent node, thereby rolling back the structure modification operation.

Description

DEVICE AND METHOD FOR ROLLBACK OF A
STRUCTURE MODIFICATION OPERATION
TECHNICAL FIELD
The present invention relates to the field of data structures, in particular for relational database management systems (RDBMSs). More specifically, the present invention provides a device for safe and consistent rollback of a structure modification operation that was applied to said data structure.
BACKGROUND
RDBMSs use a lot of data structures, e.g. tables, catalogs, primary and secondary indexes for transaction processing with ACID properties. ACID (atomicity, consistency, isolation, durability) is a set of properties of database transactions intended to guarantee validity even in the event of errors. In order to ensure atomicity and isolation, if a transaction commits, the changes of operations performed on these data structures should become visible on the transaction’s commit to all other running transactions. If the transaction aborts, any modifications on any involved index or other data caused by the transaction should be un-done. While the data structures can be globally locked by a transaction to avoid races among concurrently executing queries and updates of transactions, this would totally serialize transaction processing, prohibiting any intent of scalability.
Recently more conventional lock-free data structure designs are increasingly used in RDBM architectures. In such data- structures, any thread in a conventional lock-free algorithm never blocks and is free to proceed autonomously, and to access and modify atomically any node in an object. When uncontended, the performance of the conventional lock- free data structures is comparable to the best lock-based alternatives. Conventional lock-free data structures outperform lock-based protocols at multiprogramming and contention. Further, they are robust at thread and system failures.
However, complexity of conventional lock-free index modification protocols together with garbage collection still causes significant overhead and performance penalties. Therefore, when a conventional lock-free operation needs to be undone, the conventional practice of performing a logically inverse lock-free operation has significant performance penalties.
In the prior art, complex protocols of lock-free structure modification operations (SMO) are defined in a way to decompose an SMO into globally visible, predefined steps, such that transactional visibility is still controlled and any thread can carry out the next SMO step, if the thread of the pervious step is delayed for some reason, e.g. is preempted. The most complicated SMOs occur at a delete operation, where global restructuring changes need to propagate across many nodes for preserving the structure’s layout invariant. Further, at a node removal, an epoch design is employed to avoid too early reclamation of the node’s memory, while it still might be accessed by other threads. After the node is eligible for reclamation, it is registered the for a garbage collection pass. That is, a drawback in prior art solutions is that an aborted insertion might need an expensive multi step delete operation involving many nodes, and therefore carrying large performance penalty. It is further required, that undoing an operation meets the above mentioned criteria regarding safety and consistency.
Within this application“node” stands for an element of a data structure, such that the data structure (also called a“dynamic object”) is a collection of nodes. Nodes could be heterogeneous. The dynamic object also holds explicitly relationships between the nodes in the collection, e.g., tree or liked-list, or a priority queue. A data structure definition in terms of nodes is usually recursive, i.e. refer to other nodes, such as for example, a binary tree is a node (root) that has two sub-tree roots as children.
SUMMARY
In view of the above-mentioned problems and disadvantages, the present invention aims to improve the conventional lock-free structure modification operation.
The present invention has the object to provide a device and method for safe and consistent rollback of a structure modification operation. The present invention therefore utilizes lock-free update techniques and hazard pointers, to build an SMO rollback mechanism. The rollback is based on the particulars of these techniques and guarantees safety and consistency. During a SMO, a replica node of a node is created, the structure modification operation is applied to the replica node, while the node is becoming a retired node. The present invention is based on the effect that the retired node is in 1:1 correspondence to the node installed by the SMO. A safety condition of the present invention is based on an atomic reinstallation of the retired node which is the pre-SMO image of the replica node. A consistency condition of the present invention guarantees that a reachability of any possibly affected node after the rollback is performed is the same as it is before the SMO, in particular by checking for common children between the replica node and the retired node.
In other words, the present invention provides a new operation called rollback on a lock-free object. The rollback is applied to the node affected by an SMO. Logically, rollback is equivalent to an inversed SMO, i.e. undoing the SMO from the perspective of the dynamic object.
Rollback of an SMO is in particular implemented by atomically reinstalling a corresponding retired node from an undo list, thereby replacing the node affected by the SMO. Thereby, conditions guaranteeing consistency and safety of rollback are provided, and an expensive full-fledged logical reverse operation of the protocol can be avoided.
The objective of the present invention is achieved by the solution provided in the enclosed independent claims. Advantageous implementations of the present invention are further defined in the dependent claims.
A first aspect of the present invention provides a device for safe and consistent rollback of a structure modification operation, wherein the structure comprises a plurality of nodes, the device being configured to, for structure modification, create a replica node of a node, of the plurality of nodes; apply the structure modification operation to the replica node; associate the replica node with a parent node; remove an association of the node and the parent node, thereby making the node a retired node; and store the retired node as an entry in an undo list; and for rollback, associate the retired node with the parent node; and remove association of the replica node and the parent node, thereby rolling back the structure modification operation. In an implementation form of the first aspect, the entry in the undo list maintains a first pointer to the parent node and a second pointer to the replica node.
An advantage of the device is that, since if no rollback operation is available in the pior art, a full-fledged reverse SMO had to be performed, starting with a search of a node from a root node, and while finding the node, executing a possible multi-step inverse SMO protocol. Another advantage is, that the solution of the present invention is cheap since it leverages well known infrastructure and no significant additional infrastructure is required. Additional an advantage is that the rollback is fast, and it avoids overhead on some other transaction that has read the node.
In a further implementation form of the first aspect, the device is further configured to determine, by means of the first pointer and the second pointer, if the replica node is associated with the parent node.
This ensure that particularly safety and consistency, can be met and that no intermediate update was performed on the replica node.
In a further implementation form of the first aspect, the device is further configured to skip associating the retired node with the parent node, and removing association of the replica node and the parent node, if the replica node is not associated with the parent node, thereby verifying that no intermediate structure modification operation was applied to the replica node.
This ensure that in particular safety and consistency, can be met and that the rollback is skipped, if an intermediate update was performed on the replica node.
In a further implementation form of the first aspect, the structure modification operation includes adding and/or associating a child node to the replica node.
This ensures that multiple types of structure modification operations can be performed. In a further implementation form of the first aspect, the device is further configured to determine a state of the child node of the replica node, after the structure modification operation is performed.
This ensures that the consistency can be met and that no rollback is performed on a node that has child nodes which were altered after the structure modification operation.
In a further implementation form of the first aspect, the entry in the undo list further includes information regarding the child node.
This allows for a safe and efficient way of storing the information regarding the child node.
In a further implementation form of the first aspect, the device is further configured to skip associating the retired node with the parent node, and removing association of the replica node and the parent node, based on the state of the child node.
This ensures that the consistency can be met and that no rollback is performed on a node that has child nodes which were altered after the structure modification operation.
In a further implementation form of the first aspect, associating the retired node with the parent node and removing the association of the replica node and the parent node includes applying a compare and swap operation to the parent node.
This allows for a safe and consistent way of associating the retired node with the parent node and removing the association of the replica node.
In a further implementation form of the first aspect, the device is further configured to determine, whether a hazard pointer is pointing at the retired node in the undo list.
This allows for a safe and efficient way of determining, whether a retired node is illegible for reclamation. In a further implementation form of the first aspect, the device is further configured to remove the entry from the undo list, if no hazard pointer is pointing at the retired node in the undo list.
This ensures that a node is only removed, if it is no longer needed for rollback, by means of hazard pointers.
In a further implementation form of the first aspect, the undo list is a private thread list.
This ensures that the undo list can be provided by means of a safe and efficient concept.
In a further implementation form of the first aspect, the replica node and the node are data- structures, in particular for use in a relational database management system.
This ensures that the device is in particular suited for relational database management systems.
In a further implementation form of the first aspect, the structure modification operation is an update operation, an insert operation, a delete operation, or any kind of operation or transaction, for use in a relational database management system.
This ensures that the device is in particular suited for relational database management systems.
A second aspect of the present invention provides a method for safe and consistent rollback of a structure modification operation, wherein the structure comprises a plurality of nodes, the method comprising the steps of, for structure modification, creating a replica node of a node of the plurality of nodes; applying the structure modification operation to the replica node; associating the replica node with a parent node; removing an association of the node and the parent node, thereby making the node a retired node; and storing the retired node as an entry in an undo list; and for rollback associating the retired node with the parent node, and removing association of the replica node and the parent node, thereby rolling back the structure modification operation.
In an implementation form of the second aspect, the entry in the undo list maintains a first pointer to the parent node and a second pointer to the replica node.
In a further implementation form of the second aspect, the method further includes the step of determining, by means of the first pointer and the second pointer, if the replica node is associated with the parent node.
In a further implementation form of the second aspect, the method further includes the step of skipping associating the retired node with the parent node, and removing association of the replica node and the parent node, if the replica node is not associated with the parent node, thereby verifying that no intermediate structure modification operation was applied to the replica node.
In a further implementation form of the second aspect, the structure modification operation includes adding and/or associating a child node to the replica node.
In a further implementation form of the second aspect, the method further includes the step of determining a state of the child node of the replica node, after the structure modification operation is performed.
In a further implementation form of the second aspect, the entry in the undo list further includes information regarding the child node.
In a further implementation form of the second aspect, the method further includes the step of skipping associating the retired node with the parent node, and removing association of the replica node and the parent node, based on the state of the child node.
In a further implementation form of the second aspect, associating the retired node with the parent node and removing the association of the replica node and the parent node includes applying a compare and swap operation to the parent node. In a further implementation form of the second aspect, the method further includes the step of determining, whether a hazard pointer is pointing at the retired node in the undo list.
In a further implementation form of the second aspect, the method further includes the step of removing the entry from the undo list, if no hazard pointer is pointing at the retired node in the undo list.
In a further implementation form of the second aspect, the undo list is a private thread list.
In a further implementation form of the second aspect, the replica node and the node are data-structures, in particular for use in a relational database management system.
In a further implementation form of the second aspect, the structure modification operation is an update operation, an insert operation, a delete operation, or any kind of operation or transaction, for use in a relational database management system.
The method of the second aspect and its implementation forms include the same advantages as the device according to the first aspect and its implementation forms.
A third aspect of the present invention provides a computer program product comprising a program code for controlling the device according to the first aspect or any one of its implementation forms, or for performing, when running on a computer, the method according to the second aspect or any one of its implementation forms.
The computer program product of the third aspect includes the same advantages as the device according to the first aspect and its implementation forms.
It has to be noted that all devices, elements, units and means described in the present application could be implemented in the software or hardware elements or any kind of combination thereof. All steps which are performed by the various entities described in the present application as well as the functionalities described to be performed by the various entities are intended to mean that the respective entity is adapted to or configured to perform the respective steps and functionalities. Even if, in the following description of specific embodiments, a specific functionality or step to be performed by external entities is not reflected in the description of a specific detailed element of that entity which performs that specific step or functionality, it should be clear for a skilled person that these methods and functionalities can be implemented in respective software or hardware elements, or any kind of combination thereof.
BRIEF DESCRIPTION OF DRAWINGS
The above-described aspects and implementation forms of the present invention will be explained in the following description of specific embodiments in relation to the enclosed drawings, in which
FIG. 1 shows a schematic view of a device according to an embodiment of the present invention.
FIG. 2 shows a schematic view of a device according to an embodiment of the present invention in more detail.
FIG. 3 shows a schematic view of operations performed on nodes by means of the device.
FIG. 4 shows another schematic view of operations performed on nodes by means of the device. FIG. 5 shows a schematic view of an operating principle for rollback according to the present invention.
FIG. 6 shows another schematic view of an operating principle for rollback according to the present invention.
FIG. 7 shows another schematic view of an operating principle for rollback according to the present invention regarding rollback reduction FIG. 8 shows a schematic view of a method according to an embodiment of the present invention.
DETAILED DESCRIPTION OF EMBODIMENTS
Fig. 1 shows, in Fig. 1A, 1B and 1C, a device 100 for rollback R of a structure modification M operation. The device 100 in particular allows for a safe and consistent way of rollback, i.e. of undoing a structure modification M operation that was applied to a data- structure. The data- structure is in particular a data- structure suitable for use in an RDBMS. The structure modification M operation can e.g. be an update operation, or an insert operation, or a delete operation, or any kind of operation or transaction, for use in an RDBMS.
To this end, the device 100 is configured to, for structure modification M: Create a replica node 101 of a node 102; apply the structure modification M operation to the replica node 101; associate the replica node 101 with a parent node 103; remove an association of the node 101 and the parent node 103, thereby making the node 102 a retired node 102’; and store the retired node 102’ as an entry in an undo list 104. This process is in particular illustrated in Fig. 1A and Fig. 1B. The structure modification M operation is illustrated by the arrow labelled by“M”.
The steps of associating the replica node 101 with the parent node 103; and removing an association of the node 101 and the parent node 103 are in particular performed as one single step.
The replica node 101, the node 102, and the parent node 103 thereby represent the above data- structure or a part of the above data- structure. The undo list 104 can in particular be a private thread list.
For performing the rollback operation, that is, for undoing the structure modification M operation, the device 100 is configured to associate the retired node 102’ with the parent node 103, and to remove association of the replica node 101 and the parent node 103, thereby rolling back R the structure modification M operation. This process is in particular illustrated in Figs. 1B and Fig. 1C. The rollback R operation is illustrated by the arrow labelled by“R”. Fig. 2 shows, in Fig. 2A, 2B and 2C, a device 100 according to an embodiment of the present invention in more detail. The device 100 of Fig. 2 includes all features and functionality as the device 100 of Fig. 1. To this end, identical features are labelled with identical reference signs. All features that are going to be described in view of Fig. 2 are optional features of the device 100.
As it is illustrated in Fig. 2B, the entry in the undo list 104 can maintain a first pointer 201 to the parent node 103 and a second pointer 202 to the replica node 101. In the undo list 104, the first pointer 201 and the second pointer 202 can in particular be stored related to the retired node 102’. By means of the first pointer 201 and the second pointer 202, the device 100 can in particular determine, if the replica node 101 is associated with the parent node 103. Based on said two pointers 201, 202, the device 100 can determine if a further structure modification is applied to the replica node 101, that is, if the replica node still corresponds to the retired node 102’ in the undo list, or not. Then, the device 100 is configured to skip associating the retired node 102’ with the parent node 103, and also skip removing association of the replica node 101 and the parent node 103, if the replica node 101 is not associated with the parent node 103, thereby verifying that an intermediate structure modification operation was applied to the replica node 101.
As it is illustrated in Fig. 2B, the structure modification M operation can include adding and/or associating a child node 203 to the replica node 101. Information regarding the child node 203 can be evaluated by the device 100 when determining, if a desired rollback R operation is possible or not. In particular, the device 100 is further configured to determine a state of the child node 203 of the replica node 101, after the structure modification M operation is performed. The state in particular includes information if the child node 203 was modified after the SMO, or not. This state allows to determine if a rollback R operation is possible or not. The entry in the undo list 104 further can include information regarding the child node 203, which can also be considered when deciding if a rollback is possible.
That is, the device 100 can be further configured to skip associating the retired node 102’ with the parent node 103, and removing association of the replica node 101 and the parent node 103, based on the state of the child node 203. In particular, if the child node 203 is a leaf, rollback is possible, if it is no leaf (i.e. if others nodes depend on the child node 203), then no rollback is possible.
In case that the device 100 determines that a rollback R operation is possible and can be carried out, the retired node 102’ is associated again with the parent node 103 and the association of the replica 101 node and the parent node 103 is removed. In such a case, the associating the retired node 102’ with the parent node 103 and the removing the association of the replica 101 node and the parent node 103 may include applying a compare and swap (CAS) operation to the parent node 103.
When a rollback R operation was successful, the replica node 101 (being a newly retired node) is moved to the undo list. It can be decided to remove the replica node 101 from the undo list 104, to safe resources. This is implemented in particular by means of using a hazards pointers. To this end, the device 100 further can be configured to determine, whether some hazard pointer is pointing at the replica node 10 G in the undo list 104, or not. The entry can be removed from the undo list 104, if no hazard pointer 204 is pointing at the retired node 10 G in the undo list 104.
To further describe implementation details of the device 100, operations performed on nodes by means of the device 100 are going to be described in view of Fig. 3.
To allow for rolling back an SMO, version numbers are kept on index nodes, as it is also required by a commit protocol (e.g. silo). An update, insert, or delete, operation, also referred to as an SMO, on an internal node data index can in particular done as described in the following:
• A replica node 101 of a node 102 with higher version is created by an updating thread. The update (i.e. the SMO) is then applied on the replica node 102.
• A compare-and-swap (CAS) operation is performed on the parent node 103 of the node 102, installing the replica node 101 (i.e. the new node) in place of the node 102, thereby removing the node 102.
• The removed node 102, now called retired node 102’, is held in a private thread list (undo list 104), until its reclamation time (i.e. the reclamation time of the retired node 102’) as determined by hazard pointers of all other threads. • Then, a commit protocol (e.g. silo) checks version numbers of index nodes and verifies that no SMO has occurred on the read-set nodes 101 in a validation phase.
In the present invention, hazard pointers 204 can be used for safe memory reclamation. Hazard pointers 204 are an established technique for reclamation of memory of removed nodes in a lock-free algorithm. The basic idea of hazard pointers 204 is as follows: Any thread in a lock-free algorithm is free to proceed autonomously and access or modify atomically any node in an object (e.g. the data- structure on which the device 100 operates). Therefore, a thread may hold a reference (hazard reference) to a node that might be removed by another thread. A thread removing a node places the removed node in its private list until reclamation of the node is allowed. This invention makes use of a modified version of such a private list, as it is going to be described below. Each thread announces its guaranteed hazardous access by setting its hazard pointer 204 to the hazard reference. A removing thread periodically scans hazard pointer references of all other threads. If a hazard reference / hazard pointer 204 to a removed thread is found, the node cannot be reclaimed yet. Otherwise the node can be reclaimed.
Fig. 3 in particular shows an update operation in a lock-free protocol. In the left part of the figure, a replica node 101 of a node 102 is created, including required modification, and including an additional child node 203. A pointer from a parent node 103 to the node 102 is atomically modified to point from the parent node 103 to the replica node 101 using a CAS operation. The retired node 102’ is then placed in a thread’s private undo list 104.
As it is e.g. shown in Fig. 4, in order to guarantee safety of a rollback R operation, while keeping the retired node 102’ in the undo list 104, it is supplemented with a pointer 201 to its previous parent node and a pointer 202 to the replica node 101 installed by the transaction (i.e. the SMO). It can thus be checked that no intermediate update took place on the replica node 101, if the previous parent node 103 still points to the newly installed node 101 at the time that a CAS operation is intended re-install the retired node 102’. Additional conditions are provided regarding the children of the new node 101. On the left hand side of Fig. 4, the retired node 102’ holds a pointer 201 to its previous parent node 103, and a pointer 202 to the newly installed node 101 (i.e. the replica node 101), and to other information in the undo list 104. For rollback R, the tread performs the operation CAS (103,101,102’ - i.e. a compare and swap operation with parameters “parent node 103”, “replica node 101”, and “retired node 102”’. If successful, the structure depicted on the right side of Fig. 4 is obtained by the rollback R operation. It is to be noted that newly installed node 101 has an additional child (the rightmost). The other children are common to the new node 101 and the retired node 102’.
In the following, an algorithm according to an embodiment of the present invention is described in view of Fig. 5 to Fig. 7. As it is now described, a specific design and implementation of the present invention is ctrie -based concurrent art (CTART), a concurrent version of an adaptive radix tree (ART) based on the ctrie protocol. CTART employs hazard pointers for memory reclamation. Since an insert in an ART performs lazy evaluation and path compression resulting in growth of the tree height, the related delete operation needs to reduce the height of the tree, performing reverse path compression after a leaf’s removal, thereby propagating modifications up towards the root of the tree. The ctrie protocol introduces specialized“tomb” nodes in the multi-step method of path compression, and CTART protocol adapts it, specifically for ART topology.
The present invention supplements CTART with a rollback R operation using the hazard pointer framework, as described above. The private retired node list 104 is implemented as a stack of rollback records containing quadruples (retired node 102’, parent 103, node 101, differentiating child 203). At each SMO, this stack 104 is pushed with a new quadruple. After successful rollback, the quadruple can be reclaimed. If no hazard pointer 204 is pointing at the SMO node 102’ (i.e. the retired node 102’), this node 102’ can also be reclaimed.
In the case the differentiating child 203 has a new subtree, it can be checked if an insert of the root of the subtree with the differentiating child 203 into the retired node 102’ is possible, safe and is simple enough. If the differentiating child is a leaf, it has been installed by the SMO, and it can be rolled back, see Fig. 5. Otherwise if it is an I- node, there might have been another SMO that has modified the subtree under the differentiating child 203. Then, rollback R is not possible.
The resulting implementation is stable and enables rolling back SMOs and a reduction of processing steps that are necessary for rollback.
Fig. 6 shows a reduction of a series of rollback operations. Reduction of several rollback operations to one operation is possible, when the retired node of one SMO is the node of the previous SMO. For example, a transaction that included several SMOs {SMOl, SM02, ... , SMOn}, can be rolled back at once. In other words, if a sequence of rollbacks is needed, and the stack in the undo list satisfies reachability conditions, then the sequence of rollbacks can be fulfilled with one CAS operation. Correct order relationship and rollback correctness can be checked by a stack of quadruples and by performing check as described in view of Fig. 5.
Fig. 7 shows a reduction algorithm used in the description regarding Fig. 6.
Fig. 8 shows a method 800 for operating the device 100. That is, the method 800 also is for safe and consistent rollback of a structure modification M operation, and comprises the following steps:
For structure modification M, the method comprises a first step of creating 801 a replica node 101 of a node 102, a second step of applying 802 the structure modification M operation to the replica node 101, a third step of associating 803 the replica node 101 with a parent node 103, a fourth step of removing 804 an association of the node 102 and the parent node 103, thereby making the node 102 a retired node 102’, and a fifth step of storing 805 the retired node 102’ as an entry in an undo list 104. Further, for rollback R, the method comprises a sixth step of associating 806 the retired node 102’ with the parent node 103, and a seventh step of removing 807 association of the replica node 101 and the parent node 103, thereby rolling back R the structure modification M operation. The present invention also provides a computer program product comprising a program code for controlling a device 100 or for performing, when running on a computer, the method 800. The computer program product includes any kind of computer readable data, including e.g. any kind of storage, or information that is transmitted via a communication network.
The present invention has been described in conjunction with various embodiments as examples as well as implementations. However, other variations can be understood and effected by those persons skilled in the art and practicing the claimed invention, from the studies of the drawings, this disclosure and the independent claims. In the claims as well as in the description the word“comprising” does not exclude other elements or steps and the indefinite article“a” or“an” does not exclude a plurality. A single element or other unit may fulfill the functions of several entities or items recited in the claims. The mere fact that certain measures are recited in the mutual different dependent claims does not indicate that a combination of these measures cannot be used in an advantageous implementation.

Claims

Claims
1. A device (100) for safe and consistent rollback (R) of a structure modification (M) operation, wherein the structure comprises a plurality of nodes, the device (100) being configured to,
for structure modification (M):
- create a replica node (101) of a node (102) of the plurality of nodes,
- apply the structure modification (M) operation to the replica node (101),
- associate the replica node (101) with a parent node (103)
- remove an association of the node (101) and the parent node (103), thereby making the node (102) a retired node (102’), and
- store the retired node (102’) as an entry in an undo list (104),
and for rollback (R):
- associate the retired node (102’) with the parent node (103), and
- remove association of the replica node (101) and the parent node (103), thereby rolling back (R) the structure modification (M) operation.
2. The device (100) according to claim 1, wherein the entry in the undo list (104) maintains a first pointer (201) to the parent node (103) and a second pointer (202) to the replica node (101).
3. The device (100) according to claim 1 or 2, further configured to determine, by means of the first pointer (201) and the second pointer (202), if the replica node (101) is associated with the parent node (103).
4. The device (100) according to any one of the preceding claims, wherein the device (100) is further configured to skip associating the retired node (102’) with the parent node (103), and removing association of the replica node (101) and the parent node (103), if the replica node (101) is not associated with the parent node (103), thereby verifying that no intermediate structure modification operation was applied to the replica node (101).
5. The device (100) according to any one of the preceding claims, wherein the structure modification (M) operation includes adding and/or associating a child node (203) to the replica node (101).
6. The device (100) according to any one of the preceding claims, wherein the device (100) is further configured to determine a state of the child node (203) of the replica node (101), after the structure modification (M) operation is performed.
7. The device (100) according to any one of the preceding claims, wherein the entry in the undo list (104) further includes information regarding the child node (203).
8. The device (100) according to any one of the preceding claims, wherein the device (100) is further configured to skip associating the retired node (102’) with the parent node (103), and removing association of the replica node (101) and the parent node (103), based on the state of the child node (203).
9. The device (100) according to any one of the preceding claims, wherein associating the retired node (102’) with the parent node (103) and removing the association of the replica (101) node and the parent node (103) includes applying a compare and swap operation to the parent node (103).
10. The device (100) according to any one of the preceding claims, wherein the device (100) is further configured to determine, whether a hazard pointer (204) is pointing at the retired node (102’) in the undo list (104).
11. The device (100) according to any one of the preceding claims, wherein the device (100) is further configured to remove the entry from the undo list (104), if no hazard pointer (204) is pointing at the retired node (102’) in the undo list (104).
12. The device (100) according to any one of the preceding claims, wherein the undo list (104) is a private thread list.
13. The device (100) according to any one of the preceding claims, wherein the replica node (101) and the node (102) are data- structures, in particular for use in a relational database management system.
14. The device (100) according to any one of the preceding claims, wherein the structure modification (M) operation is an update operation, an insert operation, a delete operation, or any kind of operation or transaction, for use in a relational database management system.
15. A method for safe and consistent rollback of a structure modification (M) operation, wherein the structure comprises a plurality of nodes, the method comprising the steps of, for structure modification (M):
- creating a replica node (101) of a node (102) of the plurality of nodes,
- applying the structure modification (M) operation to the replica node (101),
- associating the replica node (101) with a parent node (103)
- removing an association of the node (102) and the parent node (103), thereby making the node (102) a retired node (102’), and
- storing the retired node (102’) as an entry in an undo list (104),
and for rollback (R):
- associating the retired node (102’) with the parent node (103), and
- removing association of the replica node (101) and the parent node (103), thereby rolling back (R) the structure modification (M) operation.
PCT/EP2018/070821 2018-08-01 2018-08-01 Device and method for rollback of a structure modification operation WO2020025124A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/EP2018/070821 WO2020025124A1 (en) 2018-08-01 2018-08-01 Device and method for rollback of a structure modification operation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/EP2018/070821 WO2020025124A1 (en) 2018-08-01 2018-08-01 Device and method for rollback of a structure modification operation

Publications (1)

Publication Number Publication Date
WO2020025124A1 true WO2020025124A1 (en) 2020-02-06

Family

ID=63108554

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/EP2018/070821 WO2020025124A1 (en) 2018-08-01 2018-08-01 Device and method for rollback of a structure modification operation

Country Status (1)

Country Link
WO (1) WO2020025124A1 (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8010491B2 (en) * 2003-02-28 2011-08-30 Microsoft Corporation Method for managing multiple file states for replicated files

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8010491B2 (en) * 2003-02-28 2011-08-30 Microsoft Corporation Method for managing multiple file states for replicated files

Similar Documents

Publication Publication Date Title
US11775499B2 (en) Update and query of a large collection of files that represent a single dataset stored on a blob store
US10678808B2 (en) Eager replication of uncommitted transactions
EP3117348B1 (en) Systems and methods to optimize multi-version support in indexes
CN109891402B (en) Revocable and online mode switching
Couceiro et al. D2STM: Dependable distributed software transactional memory
US11321299B2 (en) Scalable conflict detection in transaction management
EP3278239B1 (en) Processing database transactions in a distributed computing system
US20180322156A1 (en) Atomic processing of compound database transactions that modify a metadata entity
US9336258B2 (en) Reducing database locking contention using multi-version data record concurrency control
US9208191B2 (en) Lock-free, scalable read access to shared data structures
US7873612B2 (en) Atomically moving list elements between lists using read-copy update
US8407195B2 (en) Efficient multi-version locking for main memory databases
US20220197896A1 (en) Transactional database layer above a distributed key/value store
WO2013059361A1 (en) Method and system for generating domain specific in-memory database management system
WO2007108859A1 (en) Concurrency control within an enterprise resource planning system
Fatourou et al. Persistent non-blocking binary search trees supporting wait-free range queries
US20140310253A1 (en) Out-of-order execution of strictly-ordered transactional workloads
US9164793B2 (en) Prioritized lock requests to reduce blocking
EP3213229A1 (en) Online schema and data transformations
WO2023124242A1 (en) Transaction execution method and apparatus, device, and storage medium
WO2020025124A1 (en) Device and method for rollback of a structure modification operation
Siakavaras et al. RCU‐HTM: A generic synchronization technique for highly efficient concurrent search trees
US10459810B2 (en) Technique for higher availability in a multi-node system using replicated lock information to determine a set of data blocks for recovery
Arora et al. Typhon: Consistency semantics for multi-representation data processing
CN117348977A (en) Method, device, equipment and medium for controlling transaction concurrency in database

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18750155

Country of ref document: EP

Kind code of ref document: A1