GLOBAL UNIQUENESS CHECKING IN DISTRIBUTED DATABASES
20230229655 · 2023-07-20
Assignee
Inventors
Cpc classification
G06F16/27
PHYSICS
International classification
G06F11/14
PHYSICS
Abstract
A distributed database processing system for a database composed of data records organized into tables which processes unique index atoms consistently and concurrently. Each attempt to insert a new key value into such a unique index atom in any given node is routed to a unique index atom chairman for processing. The chairman determines whether the request will be granted. If the request is not granted, the requesting unique index atom continues to try to submit the insert. If the request is granted, the requesting unique index atom modifies the content thereof and broadcasts a replicated given unique index atom all other nodes that contain the replicated unique index atom.
Claims
1. (canceled)
2. A node in a distributed database, the node comprising: a processor; a network interface to receive a request to insert a new key value into an index atom, the index atom comprising a fragment of data and/or metadata associated with an index of a table included in the distributed database; and a memory, operably coupled to the processor and storing a local copy of an index atom and instructions, which, when executed by the processor, cause the node to: determine, in response to the request to insert the new key value into the index atom, if new key value is unique; in response to determining that the new key value is unique, (i) insert the new key value into the local copy of the index atom and (ii) broadcast instructions, to other nodes in the distributed database containing copies of the index atom, to insert the new key value into the index atom; and in response to determining that the new key value is not unique, generate a failure message.
3. The node of claim 2, wherein the request indicates that the new key value should be inserted into all copies of the index atom in the distributed database and identifies (i) the index atom, (ii) the new key value, and (iii) a proposed table row and/or record in the distributed database.
4. The node of claim 2, wherein the node is configured to determine if the new key value is unique by testing the new key value for uniqueness against the local copy of the index atom.
5. The node of claim 2, wherein the node is configured to determine if the new key value by determining that no two rows of data in the table have identical key values.
6. The node of claim 2, wherein the node is further configured to generate a local-only flag associated with the new key value.
7. The node of claim 6, wherein the node is further configured to clear the local-only flag associated with the new key value in response to the instructions from another node in the distributed database.
8. The node of claim 2, wherein the node is further configured to initiate insertion of the new key value into the index atom.
9. The node of claim 2, wherein the node is further configured to remove the new key value from the local copy of the index atom in response to another node in the distributed database determining that the new key value is not unique.
10. The node of claim 2, wherein the new key value identifies a unique row in the table.
11. A distributed database comprising: nodes comprising respective central processing systems and respective memories to store atoms representing data stored in the distributed database, the atoms comprising an index atom comprising a fragment of data and/or metadata associated with an index of a table included in the distributed database, wherein a subset of the nodes are configured to store respective copies of the index atom, and wherein a first node in the subset of the nodes is designated as a chairman for the index atom and configured to receive a new key value for insertion into a chairman’s copy of the index atom, determine that the new key value is unique, and broadcast, to each other node in the subset of nodes, instructions to insert the new key value into the index atom in response to determining that the new key value is unique, the instructions causing the nodes in the subset of nodes to attempt to insert the new key value into the respective copies of the index atom.
12. The distributed database of claim 11, wherein the nodes are further configured to communicate with each other via asynchronous messaging.
13. The distributed database of claim 11, wherein one node in the subset of the nodes is configured to transmit a request to the chairman to insert the new key value into the index atom to the chairman.
14. The distributed database of claim 11, wherein the nodes include transactional nodes configured to provide user applications access to the distributed database and archival nodes to maintain respective disk archives of the distributed database.
15. The distributed database of claim 11, wherein each of the nodes is configured to communicate directly with each other node.
16. The distributed database of claim 11, wherein the index atom includes an element pointing to the chairman.
17. The distributed database of claim 11, wherein the index atom includes a list of the nodes in the subset of the nodes.
18. The distributed database of claim 11, wherein the chairman is further configured to insert the new key value into the chairman’s copy of the index atom with a local-only flag before determining that the new key value is unique and to clear the local-only flag in response to determining that the new key value is unique.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The appended claims particularly point out and distinctly claim the subject matter of this invention. The various objects, advantages and novel features of this invention will be more fully apparent from a reading of the following detailed description in conjunction with the accompanying drawings in which like reference numerals refer to like parts, and in which:
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS
[0020] A specific database management system in
[0021] Each node in
[0022]
[0023] In this system, the classes/objects set 42 is divided into a subset 43 of “atom classes,” a subset 44 of “message classes” and a subset 45 of “helper classes.” Additional details of certain of these classes that are relevant to this invention are described. As will become apparent, at any given time a transactional node only contains those portions of the total database that are then relevant to active user applications. Moreover, the various features of this distributed database management system enable all portions of database in use at a given time to be resident in random access memory 38. There is no need for providing supplementary storage, such as disk storage, at a transactional node during the operation of this system.
[0024] Referring to
[0025]
[0026] Each atom has certain common elements and other elements that are specific to its type.
[0027] Each time a copy of an atom is changed in any transactional node, it receives a new change number. Element 76E records that change number. Whenever a node requests an atom from another node, there is an interval during which time the requesting node will not be known to other transactional nodes. Element 76F is a list of all the nodes to which the supplying node must relay messages that contain the atom until the request is completed.
[0028] Operations of the database system are also divided into cycles. A cycle reference element 76G provides the cycle number of the last access to the atom. Element 76H is a list of the all active nodes that contain the atom. Element 761 includes several status indicators. Elements 76J contains a binary tree of index nodes to provide a conventional indexing function. Element 76K contains an index level. Such index structures and operations are known to those in skilled in the art.
[0029] As previously indicated, communications between any two nodes is by way of serialized messages which are transmitted asynchronously using the TCP or another protocol with controls to maintain messaging sequences.
[0030]
[0031] With this as background,
[0032] Referring to the process 200, the chairman sets a “local-only” flag in step 202 to indicate that the insert process is underway. The “local-only” flag can be a component of the status states element 761 in
[0033] If step 204 determines that the attempt is successful, step 204 control transfers to step 207. In step 208 the chairman first clears the “local-only” flag associated with the inserted key and then broadcasts the modified index atom to all other nodes that contain a replication of that index atom. More specifically, the chairman transmits an Index Node Added message 150 in
[0034] When a non-chairman attempts to insert a new index key value in the process 201, step 211 attempts to insert the key value in the index atom and sets a local-only flag associated with the inserted key. If this attempt fails, step 212 diverts control to step 213 whereupon further processing terminates and a failure indication is generated. As will be apparent, a failure means that the modified index was in conflict with the contents of the existing index atom at the requesting node.
[0035] If, however, the insert index is entered, step 212 diverts control to step 214 whereupon the non-chairman attempts to send an Insert Request message, such as the Insert Request message 160 in
[0036] In step 220, the requesting non-chairman node processes this Insert Status message. If the Insert Status message indicates that the chairman had accepted the modification to the insert atom, step 221 transfers control to step 222 that clears the local-only flag that was set in step 211.
[0037] If the non-chairman request is not inserted by the chairman in step 203, an Insert Status message is generated with a failed state at step 224 and transmitted at step 216 whereupon step 221 diverts to step 223 that removes the local-only flag for the specific key value status of the insert in the requesting node. Then control returns to step 211 to repeat the process. Such a situation may result when the index atom has been updated by a previous request from node N2 in
[0038] Thus in the case of an insert request by either the chairman or a non-chairman, the chairman is the sole arbiter of whether an index atom is updated with a new key value. In either case, the modified index atom is also replicated to all other nodes containing that index atom. Thus, such an index atom modification occurs consistently and concurrently.
[0039] With this understanding, it will be apparent that a database management system for a distributed database that processes requested entries into a unique index atom in accordance with this invention does so in an orderly fashion so that the all copies of the index atom remains remain in a consistent and concurrent state. This method does not introduce any significant performance degradation of those nodes that contain a copy of the unique index atom. Moreover, the process operates without any involvement of nodes that do not include that unique index atom.
[0040] This invention has been disclosed in terms of certain embodiments. It will be apparent that many modifications can be made to the disclosed apparatus without departing from the invention. Therefore, it is the intent of the appended claims to cover all such variations and modifications as come within the true spirit and scope of this invention.