distributing rows of a table across a distributed database system

CN116868183BActive Publication Date: 2026-10-20INTERNATIONAL BUSINESS MACHINE CORPORATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202280014536.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2021-02-18
Filing Date
2022-02-16
Publication Date
2026-10-20
Estimated Expiration
2042-02-16

AI Technical Summary

Technical Problem

然而,该过程可能是资源密集型任务

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116868183B_ABST
    Figure CN116868183B_ABST
Patent Text Reader

Abstract

In a method of replicating table rows across logical nodes in a distributed database system comprising a plurality of logical nodes, for each of the plurality of logical nodes, a connection is made to a current logical node of the plurality of logical nodes. One or more rows are selected from a source node of the logical nodes to store in a target table on the current logical node, wherein the one or more rows are selected based on a distribution rule for distributing data in the distributed database system. The rows are stored into the target table, wherein the rows are pulled from the source node and stored in the current logical node.
Need to check novelty before this filing date? Find Prior Art

Description

Background Technology

[0001] This invention relates to the field of digital computer systems, and more specifically to a method for distributing the rows of a table in a distributed database system.

[0002] Storing tables in a distributed database system can be done by assigning the rows of the tables to the logical nodes on which they must be stored. After the rows are assigned to logical nodes, they can be stored in the corresponding logical nodes. However, this process can be a resource-intensive task. Summary of the Invention

[0003] Embodiments of the present invention include a computer-implemented method, computer program product, and system for distributing rows of a table in a distributed database system. In a first embodiment, for each of a plurality of logical nodes, a connection is made to the current logical node among the plurality of logical nodes. One or more rows are selected from the source node of the logical node to be stored in a target table on the current logical node, wherein the one or more rows are selected based on distribution rules for distributing data in the distributed database system. Rows are stored in the target table, wherein rows are pulled from the source node and stored in the current logical node.

[0004] In another aspect, the present invention relates to a computer program product including a computer-readable storage medium having computer-readable program code implemented therewith, the computer-readable program code being configured to implement all the steps of the method according to the foregoing embodiments.

[0005] In another aspect, the present invention relates to a computer system for a distributed database system comprising multiple logical nodes. The computer system is configured to: connect to each logical node of the distributed database system; and control each connected to the logical node to: identify or select rows from source nodes of the multiple logical nodes in a target table to be stored on the logical node; and retrieve the identified rows and store them in the target table. Attached Figure Description

[0006] The embodiments of the invention are explained in more detail below with reference to the accompanying drawings, in which:

[0007] Figure 1 This section shows an example of a distributed database system based on this topic.

[0008] Figure 2A This is a flowchart illustrating a method for distributing table rows in a distributed database system, based on examples from this topic.

[0009] Figure 2BThe data flow in a distributed database system according to an example distributed approach based on this topic is illustrated.

[0010] Figure 2C The data flow in a distributed database system according to an example distributed approach based on this topic is illustrated.

[0011] Figure 2D The data flow in a distributed database system according to an example distributed approach based on this topic is illustrated.

[0012] Figure 3 This is a flowchart of a method based on an example from this topic.

[0013] Figure 4 This is a flowchart of a method based on an example from this topic.

[0014] Figure 5 This refers to a computerized system suitable for implementing one or more method steps involved in this disclosure. Detailed Implementation

[0015] The description of different embodiments of the present invention is presented for illustrative purposes and is not intended to be exhaustive or limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein has been chosen to best explain the principles of the embodiments, their practical application, or technical improvements to technologies found in the market, or to enable those skilled in the art to understand the embodiments disclosed herein.

[0016] A distributed database system may include multiple computers or machines. Two or more logical nodes can coexist on the same machine in a distributed database system. Logical nodes coexisting on the same machine can share processing resources such as CPU and can have their own or different storage areas for storing data. This allows the machine to operate as if it were two or more independent machines. Logical nodes can be associated with identifiers such as numbers.

[0017] A distributed database system can be configured to store one or more tables on the logical nodes of the distributed database system. To do this, distribution rules can be used to assign each row of a table to one of the logical nodes on which it is to be stored. After the rows are assigned to the appropriate nodes, storage methods can be used to store the rows in the corresponding logical nodes. A row or record is a collection of related data items (such as a specific user's name, date of birth, and category). A row represents an entity, where an entity refers to a user, object, or concept whose information is stored in a record.

[0018] For example, if the table is not already stored in a distributed database system, distribution rules can be applied to the table, and the storage method can require rows to be copied from the current location of the stored table to the corresponding logical nodes. This initial storage can result in each of at least a portion of multiple logical nodes having an initial or original table containing rows of the stored table. The distribution rules of the initial storage method can be called initial distribution rules.

[0019] In another example, if the table is already stored on a distributed storage system (e.g., after initial storage) and the initial distribution rules have changed, the new distribution rules can be applied to the original table stored on each logical node, and a storage method can be advantageously executed to replicate rows to the corresponding logical nodes. In this case, the newly distributed rows are stored on a table referred to as the new table. That is, a logical node can include both the original table and the new table, where the original table includes rows according to the initial distribution method, and the new table includes rows according to a distribution method that may differ from the initial distribution method. The distribution method can include the application of distribution rules and the execution of a storage method. The distribution rules of the distribution method applied after the initial distribution of the table or after the redistribution of the table can be referred to as the new distribution rules.

[0020] Distribution rules can include one or more conditions regarding one or more attributes of a table to be stored on a distributed storage system. These attributes may be referred to as distribution keys. For example, a distribution rule might require that rows representing entities with names beginning with the letter A be stored on logical node 1.

[0021] This topic allows for efficient storage of distributed rows. Instead of processing all locally stored rows and distributing them to the desired target nodes, it selects the rows that should be stored on the current node from all logical nodes and pulls them to the current node. In other words, instead of pushing rows from all logical nodes to the current node, it pulls rows from the source node, and the current logical node is the target node. This topic saves resources compared to the push method. For example, the push method might require a single logical node to handle redistribution. This single node retrieves all rows from all logical nodes. For each row, it calculates the target node and sends the row there. Therefore, for each row, three logical nodes are involved: the source node, the current node handling redistribution, and the target node. This method improves upon this push method because the target node and the current node handling redistribution are the same node, and there is no longer a need to send rows from the current node to the target node. The rows are already at the target node. As a result, the current node handling redistribution may not process all rows, but only a subset of the rows that should be stored at this node.

[0022] According to one embodiment, rows of a table are associated with each of at least a subset of a plurality of nodes, based on an initial distribution rule. The method further includes creating a physical target table in each of the at least a subset of the plurality of logical nodes for storing rows associated with each node, wherein retrieval of identified rows is performed from an original table.

[0023] According to one embodiment, the initial distribution rule may be different from or the same as the new distribution rule. In cases where the structure of the distributed database system has changed, a new distribution rule that is the same as the initial distribution rule may be advantageous. For example, if the initial distribution rule requires rows to be evenly distributed across existing nodes, reapplying that rule to a system with changes such as additional nodes may result in a different distribution of rows.

[0024] According to one embodiment, identifying rows involves applying initial distribution rules to determine rows associated with at least a portion of multiple logical nodes without storing them. That is, it may not be necessary to initially store tables in the corresponding original tables of the logical nodes. For example, it may not be necessary to first create physical original tables, as data can be collected from other tables and stored directly in a new table along with the new distribution rules.

[0025] According to one embodiment, a distributed database system is configured to distribute rows of a table across multiple logical nodes according to a distribution method. The distribution method includes, at each specific logical node among the multiple logical nodes: a row-to-node allocation step, which includes identifying a target node and rows to be replicated to a specific logical node within the target node according to distribution rules; and a push step, which includes replicating rows from the specific logical node to the corresponding identified target node. The method further includes adjusting the distribution method such that, at each current logical node: determining candidate source nodes among the multiple logical nodes, triggering the row-to-node allocation step at each candidate source node, wherein the identified source nodes are nodes among the candidate source nodes that have already identified the current logical node as the target node, and replacing the push step with a pull step, performing a pull step at the current logical node for performing the retrieval.

[0026] This embodiment enables the application of new distribution rules to the original table of each candidate node to identify which rows go to which nodes, and the execution of a storage method on the target node (rather than on the source node) to replicate data according to the distribution method. This embodiment can be advantageous because it can be seamlessly integrated into existing systems. For example, existing distribution methods can be adapted to the improved distribution based on this topic by keeping the distribution rules unchanged and adjusting the storage method.

[0027] According to one embodiment, a candidate source node is: all logical nodes among a plurality of logical nodes, or a node among a plurality of logical nodes predicted to provide data to the current logical node according to the distribution rules. The current logical node can query candidate source nodes to identify which rows should be replicated to the current logical node. Candidate logical nodes can be all logical nodes in the distributed database system. This can be advantageous because it can improve the efficiency of distribution, since the probability of missing a node with data to be replicated to the current logical node is almost zero. In another example, a candidate logical node can be a node among a plurality of logical nodes expected to contain data to be replicated to the current logical node, for example, due to the fact that the original table may not exist on all logical nodes but only on a proper subset thereof. This can be predicted using, for example, historical data, including log data generated from performing the distribution method on a previous table. This can be advantageous because it saves processing resources that would otherwise be required to unnecessarily apply distribution rules on some nodes that do not contain data to be replicated to the current logical node.

[0028] According to one embodiment, the row-to-node assignment step includes: creating a lookup table that includes distinct values ​​of the distribution key for the distribution rule and associated target nodes, and using the created table to identify the target nodes and their corresponding rows. For example, the lookup table can be created once, and then each node can use it.

[0029] This implementation can be advantageous because building a lookup table can be much faster than copying all rows from the original table to the new table, since the lookup table has far fewer columns. Therefore, the lookup table has a significantly smaller data volume, meaning fewer resources are required to build it—even if each lookup row requires 2x network communication. If the values ​​used for the distribution rule in the new table are not unique and have duplicates, the lookup table can have significantly fewer rows. For example, only one row can be created in the lookup table for each distinct value. For instance, if an index exists on column C of the original table, and that column C is used for the new distribution rule, scanning only the index is sufficient, which can be much faster than scanning the entire table. Therefore, building the lookup table itself can be very fast overall.

[0030] According to one embodiment, the method further includes sorting the retrieved rows and storing them in a target table according to the sorting order. This embodiment enables the rows to be physically sorted / aligned to optimize the storage layout. This embodiment is further advantageous because all retrieved rows are sorted at once. This contrasts with push methods, in which the sorting can be repeated multiple times for the same number of rows to be stored.

[0031] According to one embodiment, a distributed database system is configured to distribute rows of a table across multiple logical nodes according to a first distribution method. This method is executed in response to receiving a request to redistribute rows according to a second distribution method involving distribution rules.

[0032] Figure 1 A distributed database system 100, an example according to this subject matter, is illustrated illustratively. The distributed database system 100 includes logical nodes 101.1, 101.2, and 101.3 (collectively referred to as node 101). Nodes 101 can be communicatively coupled to each other via a computer network (not shown). Figure 1 The diagram shows three nodes, which is merely an example. In practice, there could be hundreds of nodes. A node can also be called a logical database partition, where a database partition is a part of a database consisting of its own data, indexes, configuration files, and transaction logs. Thus, the distributed database system 100 implements a partitioned database environment. The difference between a logical database partition and a physical partition is that a logical database partition is not given control over the entire machine. While the machine has shared resources, database partitions do not necessarily share resources. Processors are shared, but disks and storage are not. For example, two or more database partitions can coexist on the same machine (regardless of the number of processors).

[0033] Distributed database system 100 can be configured to store data such as IBM databases. The data in table T is analyzed by applications such as the Analysis Accelerator (IDAA) tool 103. The distributed database system 100 can be configured to execute a data organization scheme according to an initial distribution method, where rows of table T are partitioned on node 101 based on values ​​in one or more table columns. For example... Figure 1 As shown, each of nodes 101 has an original table (referred to as the "Original Table") that stores rows initially allocated to that node according to the initial distribution method. Data partitioning or distribution can improve performance and simplify data management. Application 103 can be configured to store, manage, and access data in the distributed database system 100. Tables initially distributed in the distributed database system 100 can be created on the fly, for example, from other existing tables. Based on a pull method using, for example, the following SQL statement, the original table of each logical node can be populated with its corresponding set of rows: INSERT INTO <original table>; SELECT *; FROM (SELECT data FROM other table 1, other table 2 WHERE ...); WHERE <predicate identifying rows to be stored in the currently connected node>; ORDER BY ...

[0034] This initial storage in the corresponding original table from table T to the logical node can be optional. For example, it may not be necessary to first create a physical "original table" because the data can be collected from other tables and stored directly in the "new table" with the desired distribution, as described below. In this case, the "original table" can be virtual, and its data is the result set of the statement "(SELECT data FROM...WHERE...)". This prevents the creation of the "original table" as a physical table and the storage of data in it.

[0035] After initially storing table T in distributed database system 100, distributed database system 100 can be configured to (re)distribute the rows of table T across multiple logical nodes 101.1 to 101.3 according to a second distribution method. The second distribution method can be executed at each of the multiple logical nodes 101.1 to 101.3. Figure 1 The diagram illustrates the execution of a second distribution method in logical node 101.1, which is thus considered the coordinator node. The second distribution method may include a row-to-node allocation step and a push step. Performing the row-to-node allocation step in a specific logical node involves identifying the target node and rows from the original table of the specific logical node to be copied to the target node, according to distribution rules. Distribution rules may, for example, relate to conditions concerning the distribution key of table T. The distribution key may include one or more attributes of table T. The distribution key of the second distribution method may differ from the distribution key of the initial distribution method. The push step involves copying rows from the original table from the specific logical node to the corresponding identified target node. This is indicated by three arrows from the coordinator node 101.1 to the new table. Thus, after the second distribution method is executed in each of nodes 101.1 to 101.3, table rows can be stored across nodes 101.1 to 101.3 according to the distribution rules in the new table (each named "New Table"). Therefore, a logical node can include an original table and a new table, where the original table includes rows of table T distributed according to an initial distribution method, and the new table includes rows of table T distributed according to another different distribution method.

[0036] For example, suppose the distribution key for the second distribution method is the attribute ID of table T. The distribution rule can be applied using the function MOD(ID, 3) to each value of the distribution key using a round-robin algorithm. This function provides the value of attribute ID and the remainder of a division by 3, where 3 refers to the number of nodes 101.1 to 101.3. The result of the function MOD(ID, 3) can be a number identifying one of nodes 101.1 to 101.3. For example, performing the second distribution method at node 101.1 can identify three sets of rows that need to be stored in nodes 101.1, 101.2, and 101.3 respectively. Node 101.1 can then send two sets of rows to the corresponding nodes for storage, for example, using an INSERT statement, and store the third set of rows assigned to node 101.1 locally in a new table. Similarly, performing the second distribution method at node 101.2 can identify three sets of rows that need to be stored in nodes 101.1, 101.2, and 101.3 respectively, and so on. Figure 1 As shown, the redistributed rows are stored in a new table in node 101. Therefore, after redistribution, each node can include an original table and a new table, each containing different rows from table T, where the original and new tables can be associated, for example, with different distribution keys. However, these distribution methods can be challenging because the joins to each node and the execution of INSERT statements on each node can result in n concurrently running INSERT statements on each node, each of which requires space (data pages / extents) to store the rows to be written. By using [see...] Figure 2A , 2B The topic further improves this distribution of rows in table T by using another distribution method described in 2C and 2D.

[0037] Figure 2A This is a flowchart of a method for distributing table rows in a distributed database system. Figure 2A The method described in [the document] can be used in [the following context] Figure 1 The system described herein is implemented, but is not limited to this implementation method. Figure 2A The method can be executed for each of logical nodes 101.1, 101.2, and 101.3. The results of these executions are used... Figure 2B , 2C And shown in 2D. Figure 2A The method may, for example, provide alternative implementations of the initial or second distribution method described above.

[0038] In step 201, application 103 can connect to the current logical node. Therefore, the current logical node can be the coordinator node. Since all logical nodes are part of the same database system, the coordinator node can be responsible for the overall processing of SQL statements, for example, by delegating parts of the SQL statements to other nodes.

[0039] For example, a connection to a specific node can be established in ODBC with the attribute "ConnectNode = X", where X is a numeric identifier for the specific node. Database requests from application 103 can be translated into a communication protocol suitable for use in the distributed database system 100. These requests are received and processed by the node at the other end of the connection. This allows application 103 to operate as if it were accessing a local database.

[0040] In step 203, the current logical node can identify rows from the source nodes among multiple logical nodes that will be stored in the new table on the current logical node according to specific distribution rules. For example, step 203 can execute an SQL statement that selects only those rows from all logical nodes that will be stored on the current logical node according to specific distribution rules. Figure 1 For example, the original table in each logical node can be used to select rows that need to be copied to the current logical node according to distribution rules including the MOD function.

[0041] The identified rows can be retrieved from the original table and stored in a new table in the current logical node in step 205. This allows rows to be pulled from the source node to the current logical node. The execution of steps 203 and 205 can be triggered or initiated by application 103. For example, application 103 can control the current logical node (e.g., via control signals) to execute steps 203 and 205.

[0042] For example, steps 203 and 205 can be executed using the following SQL statements: INSERT INTO "new table"; SELECT * FROM "original table"; WHERE <predicate that identifies the rows to be stored in the currently joined node>; ORDER BY...

[0043] The last statement, ORDER BY, allows the selected rows to be sorted before being inserted into or stored in a new table according to sort order. The coordinator node can prepare the SQL statement and send the query portion of the SQL statement (i.e., the SELECT statement including the WHERE clause) to each logical node. Each logical node executes the SELECT statement and produces a (partial) result set for the data it has already stored. Each logical node sends its (partial) result set back to the coordinator node. Those by... Figure 2B , 2CAnd the black arrow in 2D pointing from the original table to the coordinator node. The coordinator node combines all partial result sets (including the result set it produces itself), sorts all rows, and then writes all rows to a new table.

[0044] The predicate of the WHERE statement allows you to select the rows to be copied in the current logical node. It identifies all those rows that will be stored in the current logical node.

[0045] In the first predicate example, the predicate can be defined using the following distribution rules. Following the distribution rules related to the MOD function described above, the predicate (and consequently the WHERE statement) can be defined as follows: WHERE MOD(ID, 3) = CURRENTDBPARTITIONNUM, where CURRENTDBPARTITIONNUM refers to the identifier of the current logical node.

[0046] In the second predicate example, the predicate can be defined as follows. A lookup table can be created in each node as follows: CREATE TABLE "lookup table" (<new distribution key column>) DISTRIBUTE BY (...); INSERT INTO "lookup table"; SELECT UNIQUE <new distribution key column>; FROM "original table".

[0047] The lookup table contains all the values ​​upon which the row distribution is based. Because the lookup table is a regular table and it uses the same distribution key as the new table, all rows inserted into the lookup table will already have the target distribution. The benefit is that building a lookup table is much faster than copying all rows from the original table to the new table because the lookup table has far fewer columns. Therefore, the lookup table has a significantly smaller data volume, meaning that building it requires fewer resources—even if each lookup row might require 2x network communication.

[0048] When a lookup table exists, the WHERE clause can be defined as follows: WHERE <distribution key column> IN; (SELECT *; FROM "lookup table"; WHERE DBPARTITITONNUM(id) = CURRENT DBPARTITIONUM).

[0049] Here, the argument `id` refers to one of the columns in the "lookup table". The `WHERE` clause identifies all rows from the "original table" that should be stored on the current logical node according to the new distribution rules. This is done by identifying all values ​​(or combinations thereof) of the distribution key that are actually stored on the current node. Therefore, all rows from the "original table" that have the same value in the distribution key will also be stored on the current logical node. Since each of these rows includes only those columns of the (new) distribution key, it can be used to identify all rows from the original table that should be copied to the current logical node.

[0050] If implementing the algorithm for steps 203 and 205 is more complex, it can be considered to implement it in a user-defined function instead of native SQL. Therefore, in the third predicate example, a user-defined function (e.g., named getTargetLogicalNode) can be used. The distributed database system 100 may already have an implementation of the distribution method. A user-defined function can be written to utilize it. The user-defined function can receive the values ​​of the columns participating in the new distribution key as input. The user-defined function passes the values ​​along with a list of distribution key columns to the database system. The database system determines the target node for the received values. The function returns the target node. In this case, the SQL statement becomes: INSERT INTO "new table"; SELECT * FROM "original table"; WHERE getTargetLogicalNode(<distribution key column>) = CURRENT DBPARTITIONUM; ORDER BY...

[0051] according to Figure 1 As an example of a distributed database system 100, the method in Figure 2 allows steps 201 to 205 to be executed three times on each of the three logical nodes 101; that is, steps 201 to 205 can be executed on each of the three logical nodes 101. This is in Figure 2B , Figure 2C and Figure 2D As shown in the image. Figure 2B Instructs the execution of steps 201 to 205 for logical node 101.1 (which is considered the coordinator node). Figure 2B The arrows pointing from the original tables to the coordinator node indicate the transmission of selected rows from each original table that need to be stored in coordinator node 101.1. All received rows are sorted by coordinator node 101.1 and then stored in a new table in coordinator node 101.1. Similarly, Figure 2C Instructs the execution of steps 201 to 205 for logical node 101.2 (which is considered the coordinator node). Figure 2C The arrows pointing from the original tables to the coordinator node indicate the transmission of selected rows from each original table that need to be stored in coordinator node 101.2. All received rows are sorted by coordinator node 101.2 and then stored in a new table in coordinator node 101.2. Figure 2D The instructions specify the results of steps 201 to 205 for logical node 101.3, which is considered the coordinator node. Figure 2D The arrows pointing from the original tables to the coordinator node indicate the transmission of selected rows from each original table in coordinator node 101.3 that need to be stored. All received rows are sorted by coordinator node 101.3 and then stored in a new table in coordinator node 101.3.

[0052] Figure 3 This is a flowchart of a method for distributing table rows in a distributed database system. Figure 3 The method described in [the document] can be used in [the following context] Figure 1 The implementation described herein is not limited to this embodiment. Figure 3 The method can be executed by each of the logical nodes 101.1 to 101.3, where each logical node can be referred to as the coordinated node.

[0053] In step 301, the coordinated node may receive a request from the coordinator node to select rows to be stored in the coordinator node. Upon receiving this request, the coordinated node may select rows from its original table in step 303 to be stored on the coordinator node. For this purpose, the distribution rules of the distribution method may be applied to the rows of the original table to identify the rows to be assigned to the coordinator node. In step 305, the coordinated node may send the selected rows to the coordinator node.

[0054] Figure 4 This is a flowchart of a method for distributing table rows in a distributed database system. Figure 4 The method described in [the document] can be used in [the following context]. Figure 1 The system described herein is implemented, but is not limited to this implementation method. Figure 4 The method can be executed by each of the logical nodes 101.1 to 101.3, where each logical node may be referred to as a coordinator node.

[0055] In step 401, the coordinator node may receive a request from application 103. This request may be to store rows from a table into the coordinator node according to a distribution method. The received request may include, for example, the following SQL statements: INSERT INTO <new table>; SELECT * FROM <old table>; WHERE <predicate identifying rows to be stored in the currently connected node>; ORDER BY...

[0056] The coordinator node can execute the SQL statement in step 403. Since all logical nodes are part of the same database system, the coordinator node is responsible for the overall processing of the SQL statement. It does delegate parts of its processing to other nodes. More specifically, the coordinator node prepares the SQL statement and sends the query portion (only the following line: "SELECT * FROM...WHERE...") to each logical node. Each logical node executes the SELECT statement and produces a (partial) result set for the data it already stores. Each node sends its (partial) result set back to the coordinator node. The coordinator can also execute the SELECT statement locally to produce its own partial results.

[0057] In step 405, the coordinator node combines all partial result sets (including the result set it generates itself), sorts all rows, and then writes all rows to a new table.

[0058] Figure 5 This refers to a general computerized system 700 suitable for implementing at least a portion of the method steps involved in this disclosure.

[0059] It should be understood that the methods described herein are at least partially non-interactive and are automated by computerized systems such as servers or embedded systems. However, in exemplary embodiments, the methods described herein can be implemented in (partially) interactive systems. These methods can be further implemented in software 712, 722 (including firmware 722), hardware (processor) 705, or combinations thereof. In exemplary embodiments, the methods described herein are implemented as executable programs in software and executed by a dedicated or general-purpose digital computer (such as a personal computer, workstation, minicomputer, or mainframe computer). Thus, the most general system 700 includes a general-purpose computer 701.

[0060] In an exemplary embodiment, in terms of hardware architecture, such as Figure 5 As shown, computer 701 includes processor 705, memory (main memory) 710 coupled to memory controller 715, and one or more input and / or output (I / O) devices 10, 745 communicatively coupled via local input / output controller 735. Input / output controller 735 may be, but is not limited to, one or more buses or other wired or wireless connections as known in the art. Input / output controller 735 may have additional elements omitted for simplicity, such as controllers, buffers (caches), drivers, repeaters, and receivers, to enable communication. Furthermore, the local interface may include address, control, and / or data connections to enable appropriate communication between the aforementioned components. As described herein, I / O devices 10, 745 may generally include any general-purpose cryptographic card or smart card known in the art.

[0061] Processor 705 is a hardware device for executing software (particularly software stored in memory 710). Processor 705 may be any custom or commercially available processor, central processing unit (CPU), auxiliary processor, semiconductor-based microprocessor (in the form of a microchip or chipset), or any device typically used for executing software instructions, among several processors associated with computer 701.

[0062] Memory 710 may include any one or a combination of volatile memory elements (e.g., random access memory (RAM, such as DRAM, SRAM, SDRAM, etc.)) and non-volatile memory elements (e.g., ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM)). Note that memory 710 may have a distributed architecture, in which different components are located far apart from each other, but can be accessed by processor 705.

[0063] The software in memory 710 may include one or more separate programs, each program including an ordered list of executable instructions for implementing logical functions (particularly those involved in embodiments of the invention). Figure 5 In the example, the software in memory 710 includes instructions, such as instructions for managing a database (such as a database management system).

[0064] The software in memory 710 should also typically include a suitable operating system (OS) 711. OS 711 essentially controls the execution of other computer programs, such as possible software 712 for implementing the methods described herein.

[0065] The method described herein in software 712 can be in the form of a source program, an executable program (object code), a script, or any other entity including a set of instructions to be executed. When it is a source program, it needs to be translated by a compiler, assembler, interpreter, etc., which may or may not be included in memory 710 to operate appropriately in conjunction with OS 711. Furthermore, the method can be written in an object-oriented programming language with classes of data and methods, or in a procedural programming language with routines, subroutines, and / or functions.

[0066] In an exemplary embodiment, a conventional keyboard 750 and mouse 755 may be coupled to an input / output controller 735. Other output devices (such as I / O devices 745) may include input devices, such as, but not limited to, printers, scanners, microphones, etc. Finally, I / O devices 10, 745 may further include devices for transmitting both input and output, such as, but not limited to, network interface cards (NICs) or modulators / demodulators (for accessing other files, devices, systems, or networks), radio frequency (RF) or other transceivers, telephone interfaces, bridges, routers, etc. I / O devices 10, 745 may be any general-purpose cryptographic cards or smart cards known in the art. System 700 may further include a display controller 725 coupled to a display 730. In an exemplary embodiment, system 700 may further include a network interface for coupling to a network 765. Network 765 may be an IP-based network for communication between computer 701 and any external servers, clients, etc., via a broadband connection. Network 765 transmits and receives data between computer 701 and external system 30, which may be used to perform some or all of the steps of the methods discussed herein. In an exemplary embodiment, network 765 may be a managed IP network managed by a service provider. Network 765 may be implemented wirelessly, for example using wireless protocols and technologies such as WiFi, WiMAX, etc. Network 765 may also be a packet-switched network, such as a local area network, wide area network, metropolitan area network, Internet network, or other similar type of network environment. Network 765 may be a fixed wireless network, wireless local area network (WLAN), wireless wide area network (WWAN), personal area network (PAN), virtual private network (VPN), intranet, or other suitable network system, and includes devices for receiving and transmitting signals.

[0067] If the computer 701 is a PC, workstation, intelligent device, etc., the software in the memory 710 may also include a Basic Input / Output System (BIOS) contained in firmware 722. The BIOS is a collection of basic software routines that initialize and test the hardware at startup, boot the OS 711, and support data transfer between hardware devices. The BIOS is stored in ROM so that it can be executed when the computer 701 is activated.

[0068] When the computer 701 is running, the processor 705 is configured to execute software 712 stored in memory 710 to transfer data to and from memory 710, and to control the operation of the computer 701 in general according to the software. The methods and OS 711 described herein, in whole or in part (but usually the latter), are read by the processor 705, may be buffered within the processor 705, and then executed.

[0069] When the systems and methods described herein are implemented in software 712, such as Figure 5 As shown, these methods can be stored on any computer-readable medium (such as storage device 720) for use by or in conjunction with any computer-related system or method. Storage device 720 may include disk storage devices, such as HDD storage devices.

[0070] This invention can be a system, method, and / or computer program product with any possible level of technical detail integration. The computer program product may include a computer-readable storage medium (or media) having computer-readable program instructions thereon for causing a processor to execute aspects of the invention.

[0071] Computer-readable storage media can be a tangible means for retaining and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example, but not limited to, electronic storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of computer-readable storage media includes: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disk read-only memory (CD-ROM), digital universal disk (DVD), memory sticks, floppy disks, mechanical encoding devices such as punch cards or protrusions in slots having instructions recorded thereon, and any suitable combination of the foregoing. As used herein, computer-readable storage media should not be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses passing through fiber optic cables), or electrical signals transmitted through wires.

[0072] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to a suitable computing / processing device via a network (e.g., the Internet, a local area network, a wide area network, and / or a wireless network), or to an external computer or external storage device. The network may include copper cables, optical fibers, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to a computer-readable storage medium within the suitable computing / processing device.

[0073] Computer-readable program instructions used to perform the operations of this invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, integrated circuit configuration data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​(such as Smalltalk, C++, etc.) and procedural programming languages ​​(such as the "C" programming language or similar programming languages). The computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as a standalone software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN)) or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs) may execute computer-readable program instructions by utilizing state information from the computer-readable program instructions to personalize the electronic circuitry in order to perform aspects of this invention.

[0074] The present invention will now be described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0075] These computer-readable program instructions may be provided to a processor of a computer or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / actions specified in one or more blocks of a flowchart and / or block diagram. These computer-readable program instructions may also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner, such that the computer-readable storage medium storing the instructions includes an article of manufacture containing instructions that implement aspects of the functions / actions specified in one or more blocks of a flowchart and / or block diagram.

[0076] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus, or other device to produce computer-implemented processing, such that the instructions executed on the computer, other programmable apparatus, or other device perform the functions / actions specified in one or more blocks of a flowchart and / or block diagram.

[0077] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, segment, or portion of instructions, including one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the figures. For example, two blocks shown consecutively may actually be completed as a single step, executed simultaneously, substantially simultaneously, or with partial or complete temporal overlap, or the blocks may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action or executes a combination of dedicated hardware and computer instructions.

Claims

1. A computer-implemented method for replicating rows of a table across logical nodes in a distributed database system, comprising, for each of a plurality of logical nodes: The current logical node among the plurality of logical nodes is connected by one or more computer processors; The one or more computer processors select one or more rows from one or more source nodes among the plurality of logical nodes to be stored in a target table on the current logical node, wherein the one or more rows are selected based on distribution rules for distributing data in the distributed database system; In each of the plurality of logical nodes, a physical target table is created for storing rows associated with the plurality of logical nodes, wherein the retrieval of the identified rows is performed from the original table; The distributed database system is adjusted such that it replaces the push step with a pull step at the current logical node, wherein the pull step is performed at the current logical node to perform the retrieval, and wherein the distributed database system is located at each of the logical nodes in the current logical node: Trigger the execution of a row-to-node allocation step on each candidate source node, wherein the identified source node is a node among the candidate source nodes that has already identified the current logical node as the target node; as well as The one or more rows are stored in the target table by the one or more computer processors, wherein the one or more rows are pulled from the one or more source nodes and stored in the current logical node.

2. The computer-implemented method of claim 1, wherein selecting one or more rows from the one or more source nodes among the plurality of logical nodes to be stored in the target table on the current logical node, wherein the one or more rows are selected based on distribution rules for distributing data in the distributed database system, further comprising: The one or more computer processors create an original table in each of the plurality of logical nodes to store the one or more rows from the one or more source nodes among the plurality of logical nodes associated with each node.

3. The computer-implemented method of claim 1, wherein selecting one or more rows from the one or more source nodes among the plurality of logical nodes to be stored in the target table on the current logical node, wherein the one or more rows are selected based on distribution rules for distributing data in the distributed database system, further comprising: The one or more computer processors apply initial distribution rules to select one or more rows from the one or more source nodes among the plurality of logical nodes to be stored in the target table, wherein the one or more rows are not stored in the target table.

4. The computer-implemented method according to claim 3, wherein the distribution rule is different from the initial distribution rule, wherein the initial distribution rule is associated with the initial storage of the distributed database system.

5. The computer-implemented method of claim 3, wherein the distribution rule is the same as the initial distribution rule, wherein the initial distribution rule is associated with the initial storage of the distributed database system.

6. The computer-implemented method of claim 1, wherein selecting one or more rows from the one or more source nodes among the plurality of logical nodes to be stored in the target table on the current logical node, wherein the one or more rows are selected based on distribution rules for distributing data in the distributed database system, further comprising: The one or more computer processors determine one or more candidate source nodes from the plurality of logical nodes, wherein the candidate source nodes are selected from a group including all logical nodes of the plurality of logical nodes and all predicted nodes of the plurality of logical nodes that are predicted to provide data to the current logical node; and further, wherein the one or more candidate source nodes of the plurality of logical nodes have identified the current logical node as the target node; as well as The one or more computer processors assign each of the one or more rows to one of the plurality of logical nodes for storage, wherein each of the one or more rows is stored on the one logical node, and wherein each of the one or more rows is assigned using the distribution rules for distributing the data in the distributed database system.

7. The computer-implemented method of claim 1, wherein storing the one or more rows into the target table, wherein the one or more rows are retrieved from the source node and stored in the current logical node, further comprises: The one or more computer processors create a lookup table that includes distinct values ​​of the distribution key for the distribution rule; as well as The target node and one or more corresponding rows are identified by the lookup table using the one or more computer processors.

8. The computer-implemented method according to claim 1, further comprising: In response to the row being pulled, the one or more rows selected from the one or more source nodes among the plurality of logical nodes are sorted. and The one or more rows are stored in the target table according to the sort order, wherein the one or more rows are physically aligned to optimize the storage layout.

9. The computer-implemented method of claim 1, wherein the distributed database system is configured to distribute the one or more rows of the table on the plurality of logical nodes according to a first distribution method, and further wherein the distribution is performed in response to receiving a request to redistribute the rows according to a second distribution method using the distribution rules.

10. The computer-implemented method of claim 9, wherein the first distribution method is an initial distribution method configured to initially distribute rows of the table in the distributed database system, thereby causing the plurality of logical nodes to include the corresponding rows of the table.

11. The computer-implemented method of claim 1, wherein the one or more computer processors select, from the one or more source nodes of the plurality of logical nodes, the one or more rows to be stored in the target table on the current logical node, wherein the one or more rows are selected based on distribution rules for distributing data in the distributed database system, further comprising: One or more candidate source nodes among the plurality of logical nodes are determined by the one or more computer processors; The one or more computer processors send a selection request to each of the plurality of logical nodes, the selection request being used to select a row to be stored in the current logical node; as well as In response to sending the selection request, the one or more computer processors receive one or more identified rows from the candidate source nodes.

12. The computer-implemented method of claim 11, wherein the one or more candidate source nodes among the plurality of logical nodes are selected from a group comprising all logical nodes of the plurality of logical nodes and all predicted nodes of the plurality of logical nodes that are predicted to provide data to the current logical node; and further, wherein the one or more candidate source nodes among the plurality of logical nodes have identified the current logical node as the target node.

13. The computer-implemented method of claim 1, wherein the distribution rule includes at least one of the following: uniformly distributing rows across the plurality of logical nodes; grouping all rows within a specified range of the distribution key into the same logical node; and grouping all rows having similar values ​​of the distribution key into the same logical node.

14. A computer program product for replicating rows of a table across logical nodes in a distributed database system, the computer program product comprising program instructions, the program instructions including instructions for each of a plurality of logical nodes, the instructions being used to: Connect to the current logical node among the plurality of logical nodes; Select one or more rows from one or more source nodes among the plurality of logical nodes to be stored in the target table on the current logical node, wherein the one or more rows are selected based on distribution rules for distributing data in the distributed database system; In each of the plurality of logical nodes, a physical target table is created for storing rows associated with the plurality of logical nodes, wherein the retrieval of the identified rows is performed from the original table; The distributed database system is adjusted such that it replaces the push step with a pull step at the current logical node, wherein the pull step is performed at the current logical node to perform the retrieval, and wherein the distributed database system is located at each of the logical nodes in the current logical node: Trigger the execution of a row-to-node allocation step on each candidate source node, wherein the identified source node is a node among the candidate source nodes that has already identified the current logical node as the target node; as well as Store the one or more rows into the target table, wherein the one or more rows are pulled from the source node and stored in the current logical node.

15. The computer program product of claim 14, wherein the selection of one or more rows from the one or more source nodes of the plurality of logical nodes to be stored in the target table on the current logical node, wherein the one or more rows are selected based on distribution rules for distributing data in the distributed database system, further comprising one or more program instructions stored on the one or more computer-readable storage media for: Create an original table in each of the plurality of logical nodes to store the one or more rows from the one or more source nodes among the plurality of logical nodes associated with each node.

16. The computer program product of claim 14, wherein the selection of one or more rows from the one or more source nodes of the plurality of logical nodes to be stored in the target table on the current logical node, wherein the one or more rows are selected based on distribution rules for distributing data in the distributed database system, further comprising one or more program instructions stored on the one or more computer-readable storage media for: An initial distribution rule is applied to select one or more rows from one or more source nodes among the plurality of logical nodes to be stored in the target table, wherein the one or more rows are not stored in the target table.

17. The computer program product of claim 16, wherein the distribution rule is different from the initial distribution rule, wherein the initial distribution rule is associated with the initial storage of the distributed database system.

18. A computer system for replicating rows of a table across logical nodes in a distributed database system, the computer system comprising: One or more computer processors; One or more computer-readable storage media; as well as Program instructions stored on the one or more computer-readable storage media, for execution by at least one of the one or more computer processors, the stored program instructions including instructions for each of a plurality of logical nodes, the instructions being used to: Connect to the current logical node among the plurality of logical nodes; Select one or more rows from one or more source nodes among the plurality of logical nodes to be stored in the target table on the current logical node, wherein the one or more rows are selected based on distribution rules for distributing data in the distributed database system; In each of the plurality of logical nodes, a physical target table is created for storing rows associated with the plurality of logical nodes, wherein the retrieval of the identified rows is performed from the original table; The distributed database system is adjusted such that it replaces the push step with a pull step at the current logical node, wherein the pull step is performed at the current logical node to perform the retrieval, and wherein the distributed database system is located at each of the logical nodes in the current logical node: Trigger the execution of a row-to-node allocation step on each candidate source node, wherein the identified source node is a node among the candidate source nodes that has already identified the current logical node as the target node; as well as Store the one or more rows into the target table, wherein the one or more rows are pulled from the source node and stored in the current logical node.

19. The computer system of claim 18, wherein selecting one or more rows from the one or more source nodes of the plurality of logical nodes to be stored in the target table on the current logical node, wherein the one or more rows are selected based on distribution rules for distributing data in the distributed database system, further comprising one or more program instructions stored on the one or more computer-readable storage media for: Create an original table in each of the plurality of logical nodes to store the one or more rows from the one or more source nodes among the plurality of logical nodes associated with each node.

20. The computer system of claim 18, wherein selecting one or more rows from the one or more source nodes of the plurality of logical nodes to be stored in the target table on the current logical node, wherein the one or more rows are selected based on distribution rules for distributing data in the distributed database system, further comprising one or more program instructions stored on the one or more computer-readable storage media for: An initial distribution rule is applied to select one or more rows from one or more source nodes among the plurality of logical nodes to be stored in the target table, wherein the one or more rows are not stored in the target table.