A method to speed up the processing of operations with dependencies

By constructing the target directed acyclic graph and calculating the node priority values, operations with high complexity and many unbound nodes are prioritized, solving the problem of high synchronization delay of dependency operations and achieving faster operation processing.

CN119046507BActive Publication Date: 2025-09-26HANGZHOU WOQU NETWORK TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411185135.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2025-09-26
Estimated Expiration
2044-08-27

AI Technical Summary

Technical Problem

In the prior art, operations with dependencies cannot be effectively executed in parallel when synchronized in a standby database, resulting in a high synchronization delay.

Method used

By constructing the target directed acyclic graph, the complexity of descendant nodes and the number of unbound nodes of each first-layer node are obtained, the first priority value is calculated, and the node with the largest first priority value is added to the ready queue first to execute operations concurrently.

Benefits of technology

It effectively avoids node blocking, improves operation processing speed, increases the number of nodes that can be executed concurrently, and reduces synchronization delay.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046507B_ABST
    Figure CN119046507B_ABST
Patent Text Reader

Abstract

The present application relates to the field of electronic digital data processing technology, and in particular to a method for accelerating the processing of operations with dependencies. The method comprises: obtaining a target directed acyclic graph; the operation corresponding to any child node in the target directed acyclic graph depends on the operation corresponding to the corresponding parent node; if the number of first-layer nodes in the target directed acyclic graph is greater than a first preset number, obtaining the descendant node complexity f of the jth first-layer node in the target directed acyclic graph; j ; Get the number of unbound nodes s of the jth first-layer node in the target directed acyclic graph j ; Get the first priority value y of the jth first-layer node in the target directed acyclic graph j The first preset number of first-layer nodes with the largest first priority value in the target directed acyclic graph are added to the ready queue to concurrently execute the operations corresponding to all first-layer nodes in the ready queue. The present invention can improve the processing speed of operations with dependencies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic digital data processing, and in particular to a method for accelerating the processing of operations with dependency relationships. Background Art

[0002] When synchronizing operations executed in the primary database with the standby database, if the operations executed in the primary database are interdependent, the existing method of bucketing the operations according to their corresponding keys and executing them in parallel cannot be used. Instead, the existing method typically uses serial execution, executing only one operation at a time. This takes a long time to synchronize the operations executed in the primary database with the standby database, resulting in high synchronization latency. Accelerating the processing of interdependent operations is an urgent problem to be solved. Summary of the Invention

[0003] The present invention aims to provide a method for accelerating the processing of operations with dependency relationships, so as to improve the processing speed of operations with dependency relationships.

[0004] According to the present invention, a method for accelerating the processing of operations with dependencies is provided, the method comprising the following steps:

[0005] S100, obtaining a target directed acyclic graph; the target directed acyclic graph includes several layers of nodes, each layer of nodes includes several nodes, each node represents an operation sequence number, and different nodes represent different operation sequence numbers; the operation corresponding to any child node in the target directed acyclic graph depends on the operation corresponding to the corresponding parent node, and the operation corresponding to any first-layer node in the target directed acyclic graph does not depend on the operation corresponding to any other node in the target directed acyclic graph.

[0006] S200: If the number of first-layer nodes in the target directed acyclic graph is greater than a first preset number, proceed to S300.

[0007] S300, obtain the descendant node complexity f of the j-th first-layer node in the target directed acyclic graph j , f j =∑ T(j) t=1 (∏ Q(t) q=1 num t,q ), num t,qis the number of parent nodes of the qth node of the tth branch connected to the jth first-layer node in the target directed acyclic graph, q ranges from 1 to Q(t), Q(t) is the number of nodes included in the tth branch connected to the jth first-layer node in the target directed acyclic graph; t ranges from 1 to T(j), T(j) is the number of branches connected to the jth first-layer node in the target directed acyclic graph; j ranges from 1 to m, m is the number of first-layer nodes in the target directed acyclic graph.

[0008] S400, obtain the number s of unbound nodes of the jth first-layer node in the target directed acyclic graph j ; If the j-th first-layer node in the target directed acyclic graph does not have a child node, then s j = 0; if the j-th first-level node in the target directed acyclic graph has a child node, and the j-th first-level node in the target directed acyclic graph has z j There is only one parent node for each child node, then s j =z j .

[0009] S500, obtaining the first priority value y of the j-th first-layer node in the target directed acyclic graph j ;y j With f j Positive correlation, y j With s j Positive correlation.

[0010] S600: Add a first preset number of first-layer nodes with the largest first priority value in the target directed acyclic graph to a ready queue, so as to concurrently execute operations corresponding to all first-layer nodes in the ready queue.

[0011] Compared with the prior art, the present invention has at least the following beneficial effects:

[0012] In the present invention, the first-layer nodes in the target directed acyclic graph represent operation sequence numbers corresponding to operations that do not depend on any operations, and the operations corresponding to the child nodes in the target directed acyclic graph depend on the operations corresponding to the corresponding parent nodes. Based on obtaining the target directed acyclic graph, if the number of first-layer nodes in the target directed acyclic graph is greater than a first preset number, the complexity of the descendant nodes and the number of unbound nodes of each first-layer node are obtained, and the first priority value of the corresponding first-layer node is determined based on the complexity of the descendant nodes and the number of unbound nodes. In the present invention, the greater the complexity of the descendant nodes, the greater the corresponding first priority value, and the greater the number of unbound nodes, the greater the corresponding first priority value. Therefore, the present invention adds the first-preset number of first-layer nodes with the largest first priority values ​​in the target directed acyclic graph to the ready queue, so that the operations corresponding to the first-layer nodes with large descendant node complexity and large number of unbound nodes are executed first, avoiding serious node blocking caused by the failure to execute the operations corresponding to the first-layer nodes with large descendant node complexity and large number of unbound nodes, and facilitating increasing the number of nodes in the remaining nodes of the target directed acyclic graph that can be added to the ready queue at one time, thereby improving the processing speed of the operations corresponding to the target directed acyclic graph. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0014] Figure 1 A flowchart of a method for accelerating the processing of operations with dependencies provided by an embodiment of the present invention;

[0015] Figure 2 A schematic diagram of a target directed acyclic graph provided by an embodiment of the present invention;

[0016] Figure 3 A schematic diagram of a target directed acyclic graph after the first update provided by an embodiment of the present invention;

[0017] Figure 4 A schematic diagram of a target directed acyclic graph after the second update provided by an embodiment of the present invention;

[0018] Figure 5 A schematic diagram of a target directed acyclic graph after the third update provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present invention.

[0020] According to this embodiment, Figure 1 As shown, a method for accelerating the processing of operations with dependencies is provided, the method comprising the following steps:

[0021] S100, obtaining a target directed acyclic graph; the target directed acyclic graph includes several layers of nodes, each layer of nodes includes several nodes, each node represents an operation sequence number, and different nodes represent different operation sequence numbers; the operation corresponding to any child node in the target directed acyclic graph depends on the operation corresponding to the corresponding parent node, and the operation corresponding to any first-layer node in the target directed acyclic graph does not depend on the operation corresponding to any other node in the target directed acyclic graph.

[0022] As a specific embodiment, the target directed acyclic graph is obtained based on the target log table, and the target log table is used to record the operations performed on the table in the main database during the target historical time period; the target log table includes a number of records, each record corresponds to an operation, and each record includes a corresponding operation sequence number, a corresponding table name, a corresponding operation name, a value of the primary unique key of the corresponding table, a value of other unique keys of the corresponding table, and a sequence number of a corresponding dependent operation. Optionally, the operation corresponding to each record is named insert new data (insert new) or delete old data (delete old) or delete old data when updating (update delete old) or insert new data when updating (update insert new); wherein, the delete old data operation when updating and the insert new data operation when updating together constitute an update operation, and the delete old data operation when updating and the insert new data operation when updating included in the same update operation share the same operation sequence number. Optionally, the operation sequence number included in the first record in the target log table is 1; if the operation corresponding to a record in the target log table does not depend on any other operation, the sequence numbers of the dependent operations corresponding to the record are all composed of 0, and the number of 0s is the number of unique keys of the corresponding table. Those skilled in the art know that duplicate values ​​are not allowed to appear in any column corresponding to a unique key of a table.

[0023] As a specific implementation, the target log table is shown in Table 1, where the id field corresponds to the operation serial number, the table field corresponds to the table name, the op field corresponds to the operation name, the PK field corresponds to the value of the primary unique key of the table, the UK field corresponds to the value of other unique keys of the table, and the dependent field corresponds to the serial number of the dependent operation.

[0024] Table 1

[0025]

[0026]

[0027] In Table 1, the value of the id field of the first record in the target log table is 1, indicating that the operation sequence number corresponding to the record is 1, that is, the operation corresponding to the record is the first operation performed on the primary database during the target historical time period; the value of the table field of the first record in the target log table is A, indicating that the table name corresponding to the record is A, that is, the operation corresponding to the record is an operation in table A; the value of the op field of the first record in the target log table is Insert_new, indicating that the operation name corresponding to the record is Insert_new, that is, the operation corresponding to the record is an insert operation; the first record in the target log table is The value of the PK field of the record is 1 and the value of the UK field of the first record in the target log table is 1,1, indicating that the value of the primary unique key of the table corresponding to the record is 1 and the values ​​of the other unique keys are 1,1. That is, the operation corresponding to the record is to insert a record into table A (table A includes two other unique keys in addition to the primary unique key), and the value of the primary unique key of the inserted record is 1 and the values ​​of the other two unique keys are 1 respectively; the value of the dependent field of the first record in the target log table is 0,0,0, indicating that the sequence number of the dependent operation corresponding to the record is 0,0,0, that is, the operation corresponding to the record does not depend on any other operation.

[0028] In Table 1, the value of the id field of the 15th record in the target log table is 15, indicating that the operation sequence number corresponding to the record is 15, that is, the operation corresponding to the record is the 15th operation performed on the primary database during the target historical time period; the value of the table field of the 15th record in the target log table is B, indicating that the table name corresponding to the record is B, that is, the operation corresponding to the record is an operation in table B; the value of the op field of the 15th record in the target log table is Delete_old, indicating that the operation name corresponding to the record is Delete_old, that is, the operation corresponding to the record is a delete operation; the 15th record in the target log table The value of the PK field of the record is 12 and the value of the UK field of the 15th record in the target log table is james, indicating that the primary unique key value of the table corresponding to the record is 12 and the value of the other unique key is james, that is, the operation corresponding to the record is to delete a record in table B (table B includes 1 other unique key in addition to the primary unique key), and the primary unique key value of the deleted record is 12 and the value of the other unique key is james; the value of the dependent field of the 15th record in the target log table is 9,9, indicating that the serial number of the dependent operation corresponding to the record is 9,9, that is, the operation corresponding to the record depends on the operation with operation serial number 9.

[0029] In this embodiment, any i+1th layer node in the target directed acyclic graph is a child node of several i-th layer nodes, the value range of i is 1 to n-1, and n is the number of layers included in the target directed acyclic graph.

[0030] In this example, if the dependent operation number corresponding to the record corresponding to the first operation number includes the second operation number, then the node representing the second operation number is determined to be the parent node of the node representing the first operation number, that is, the node representing the first operation number is determined to be the child node of the node representing the second operation number. As a specific implementation method, the target directed acyclic graph corresponding to Table 1 is as follows: Figure 2 As shown, the nodes corresponding to 1, 2, 3, 8, 9, 10 and 16 are first-layer nodes, the nodes corresponding to 4, 5, 6, 11 and 15 are second-layer nodes, the nodes corresponding to 7, 12 and 13 are third-layer nodes, and the node corresponding to 14 is a fourth-layer node. The node corresponding to 1 is the parent node of the node corresponding to 4 (that is, the node corresponding to 4 is the child node of the node corresponding to 1), the node corresponding to 2 is the parent node of the node corresponding to 5, the node corresponding to 3 is the parent node of the node corresponding to 6, the node corresponding to 4, the node corresponding to 5 and the node corresponding to 6 are all parent nodes of the node corresponding to 7, the node corresponding to 8 is the parent node of the node corresponding to 11, the node corresponding to 11 is the parent node of the node corresponding to 12 and the node corresponding to 13, the node corresponding to 13 is the parent node of the node corresponding to 14, and the node corresponding to 9 is the parent node of the node corresponding to 15.

[0031] S200: If the number of first-layer nodes in the target directed acyclic graph is greater than a first preset number, proceed to S300.

[0032] In this embodiment, the first preset number is a preset concurrent processing number.

[0033] In this embodiment, if the number of first-layer nodes in the target directed acyclic graph is less than or equal to a first preset number, all first-layer nodes in the target directed acyclic graph are added to a ready queue to concurrently execute operations corresponding to all first-layer nodes in the ready queue, and steps S300-S600 are no longer executed. In this embodiment, the operations corresponding to the nodes in the target directed acyclic graph are operations executed in the primary database within the target historical time period. In order to synchronize the operations executed in the primary database in the standby database, the above-mentioned concurrent execution is performed concurrently in the standby database.

[0034] S300, obtain the descendant node complexity f of the j-th first-layer node in the target directed acyclic graph j , num t,q is the number of parent nodes of the qth node of the tth branch connected to the jth first-layer node in the target directed acyclic graph, q ranges from 1 to Q(t), Q(t) is the number of nodes included in the tth branch connected to the jth first-layer node in the target directed acyclic graph; t ranges from 1 to T(j), T(j) is the number of branches connected to the jth first-layer node in the target directed acyclic graph; j ranges from 1 to m, m is the number of first-layer nodes in the target directed acyclic graph.

[0035] like Figure 2As shown, the number of branches connected by the nodes corresponding to 10 and 16 is 0, the number of branches connected by the nodes corresponding to 1, 2, 3 and 9 is all 1, and the number of branches connected by 8 is 2; among them, the first node included in the branch connected by the node corresponding to 1 is the node corresponding to 4, and the second node included in the branch connected by the node corresponding to 1 is the node corresponding to 7; the first node included in the branch connected by the node corresponding to 2 is the node corresponding to 5, and the second node included in the branch connected by the node corresponding to 2 is the node corresponding to 7; the first node included in the branch connected by the node corresponding to 3 is the node corresponding to 6, and the second node included in the branch connected by the node corresponding to 3 is the node corresponding to 7; the node corresponding to 9 The first node included in the connected branch is the node corresponding to 15; the first node included in the first branch connected to the node corresponding to 8 is the node corresponding to 11, and the second node included in the first branch connected to the node corresponding to 8 is the node corresponding to 12; the first node included in the second branch connected to the node corresponding to 8 is the node corresponding to 11; the second node included in the second branch connected to the node corresponding to 8 is the node corresponding to 13; the third node included in the second branch connected to the node corresponding to 8 is the node corresponding to 14; the number of parent nodes of the nodes corresponding to 4, 5, 6, 11, 12, 13, 14 and 15 is all 1, and the number of parent nodes of the node corresponding to 7 is 3.

[0036] S400, obtain the number s of unbound nodes of the jth first-layer node in the target directed acyclic graph j ; If the j-th first-layer node in the target directed acyclic graph does not have a child node, then s j = 0; if the j-th first-level node in the target directed acyclic graph has a child node, and the j-th first-level node in the target directed acyclic graph has z j There is only one parent node for each child node, then s j =z j .

[0037] In this embodiment, the number of unbound nodes of any first-layer node is the number of newly added first-layer nodes after the corresponding first-layer node is deleted. Figure 2 As shown, the number of unbound nodes for nodes 10 and 16 is 0, and the number of unbound nodes for nodes 1, 2, 3, 8, and 9 is 1.

[0038] S500, obtaining the first priority value y of the j-th first-layer node in the target directed acyclic graph j ;y j With f j Positive correlation, y j With s j Positive correlation.

[0039] As a preferred embodiment, j=w1×f' j +w2×s' j , w1 and w2 are the weights corresponding to the complexity of descendant nodes and the number of unbound nodes, f' j and s' j are the normalized f j and the normalized s j , w1 and w2 are both greater than 0 and less than 1, w1+w2=1. The process of obtaining w2 includes:

[0040] S510 , obtaining the number g of first-layer nodes in the target directed acyclic graph whose number of unbound nodes is 0.

[0041] S520, if m-min(h,g)≥4, the first preset weight value is determined to be w2; otherwise, the second preset weight value is determined to be w2; the first preset weight and the second preset weight are both greater than 0 and less than 1, and the second preset weight is greater than the first preset weight; min() is the minimum value, and h is the first preset number.

[0042] Optionally, the first preset weight and the second preset weight are both empirical values; for example, the first preset weight is 0.5, and the second preset weight is 0.7.

[0043] Based on the above preferred specific implementation method, the value of w2 is related to the number of first-layer nodes in the target directed acyclic graph whose number of unbound nodes is 0. If the first-layer nodes in the target directed acyclic graph whose number of unbound nodes is 0 are preferentially added to the ready queue at one time, it will cause the number of nodes in the remaining nodes of the target directed acyclic graph that can be added to the ready queue at one time next time to be less than the first preset value. In this case, a larger value is assigned to w2 so that the first-layer nodes in the target directed acyclic graph whose number of unbound nodes is not 0 are preferentially added to the ready queue, thereby achieving the purpose of increasing the number of nodes in the remaining nodes of the target directed acyclic graph that can be added to the ready queue at one time next time. Since the number of operations that can be executed concurrently next time is increased, this preferred specific implementation method can further speed up the processing speed of operations corresponding to nodes in the target directed acyclic graph.

[0044] S600: Add a first preset number of first-layer nodes with the largest first priority value in the target directed acyclic graph to a ready queue, so as to concurrently execute operations corresponding to all first-layer nodes in the ready queue.

[0045] As a preferred embodiment, S600 includes:

[0046] S610, sorting the first layer nodes in the target directed acyclic graph in descending order according to the corresponding first priority values ​​to obtain a first node sequence D; D = [d1, d2, ..., d r ,…,dm ], d r is the rth first-layer node in D, and the value of r ranges from 1 to m.

[0047] S620, if d h The first priority value is equal to d h+1 The first priority value is , then enter S630; h is the first preset number.

[0048] S630, if d h If the first priority value of is 0, the first h first-layer nodes in D are determined as the first preset number of first-layer nodes with the largest first priority value in the target directed acyclic graph; otherwise, enter S640.

[0049] S640, obtain the first priority value in D and d h The set E of first-layer nodes with equal first priority values, E={e1,e2,…,e x ,…,e R}, e x is the xth first-level node in E, where x ranges from 1 to R, and R is the first priority value in D and d h The first priority value is equal to the number of first layer nodes.

[0050] S650, traverse E, get e x The second priority value of e x The second priority value is e x The maximum value of the first priority value of all child nodes.

[0051] In this embodiment, if e x There is only one child node, then e x The second priority value is e x The first priority value of the child node; if e x There are more than 2 child nodes, then e x The second priority value is e x The maximum value of the first priority value of all child nodes. x The first priority value of any child node is also based on e x The complexity of the descendant nodes and the number of unbound nodes of the corresponding child node are obtained, which will not be repeated here.

[0052] S660, sort the first-layer nodes in E in descending order according to the corresponding second priority values ​​to obtain a second node sequence C; C = [c1, c2, ..., c v ,…,c R ], c v is the vth first-layer node in C, and the value of v ranges from 1 to R.

[0053] S670, if c h-l The second priority value is not equal to c h-l+1 The first hl first-layer nodes in C and the first l first-layer nodes in D are determined as the first first preset number of first-layer nodes with the largest first priority value in the target directed acyclic graph; l is the first priority value in D greater than d h The number of first-layer nodes.

[0054] In this embodiment, if c h-l The second priority value is equal to c h-l+1 The second priority value of c is processed in a similar manner to S630-S670, that is, first determine c h-l Is the second priority value of equal to 0? If so, the first hl first-layer nodes in C and the first l first-layer nodes in D are determined as the first preset number of first-layer nodes with the largest first priority value in the target directed acyclic graph; if not, the second priority value in C and the first priority value in D are obtained. h-l The set F of first-layer nodes with the same second priority value as that of the first-layer nodes is obtained, and then the first-layer nodes in F are sorted according to the third priority value of each first-layer node in F to obtain a third node sequence G; if the third priority value of the hl-nth first-layer node in G is not equal to the third priority value of the hl-n+1th first-layer node, then the first hl-nth first-layer nodes in G, the first nth first-layer nodes in C, and the first lth first-layer nodes in D are determined as the first first preset number of first-layer nodes with the largest first priority value in the target directed acyclic graph; n is the number of nodes in C with the second priority value greater than c h-l The number of first-layer nodes with the same second priority value as the first-layer node in G is 1. If the third priority value of the hl-nth first-layer node in G is equal to the third priority value of the hl-n+1th first-layer node, then the process is similar to S630-S670 and will not be repeated here. The third priority value of any first-layer node is the maximum of the first priority values ​​of all grandchild nodes of the corresponding first-layer node.

[0055] As a specific implementation, after S600, the method further includes the following steps:

[0056] S700, if the number of nodes included in the target directed acyclic graph is greater than the number of first-layer nodes selected to be added to the ready queue in the target directed acyclic graph, then obtain the target directed acyclic graph after the first update; the target directed acyclic graph after the first update is the directed acyclic graph obtained after deleting the first-layer nodes selected to be added to the ready queue from the target directed acyclic graph.

[0057] In this embodiment, if the number of nodes included in the target directed acyclic graph is equal to the number of first-layer nodes selected to be added to the ready queue in the target directed acyclic graph, the determination process ends and subsequent steps are no longer executed.

[0058] In this embodiment, the method for processing the target directed acyclic graph after the first update is similar to the above-mentioned method for processing the target directed acyclic graph, and will not be repeated here.

[0059] As a specific implementation, the target directed acyclic graph is as follows Figure 2 As shown, the first preset number is 4. The first layer nodes added to the ready queue in the target directed acyclic graph determined by the method of this embodiment are nodes corresponding to 1, 2, 3 and 8. Then the target directed acyclic graph obtained after the first update is as follows: Figure 3 As shown; According to the method of this embodiment, the first layer nodes added to the ready queue in the target directed acyclic graph after the first update are the nodes corresponding to 4, 5, 9 and 11, then the target directed acyclic graph after the second update is as shown Figure 4 As shown; According to the method of this embodiment, the first layer nodes added to the ready queue in the target directed acyclic graph after the second update are the nodes corresponding to 6, 10, 12 and 13, then the target directed acyclic graph after the third update is as shown Figure 5 As shown; Figure 5 The nodes corresponding to 7, 14, 15 and 16 in the target log table are added to the ready queue, and the operations corresponding to all records included in the target log table are completed.

[0060] In this embodiment, the first-layer nodes in the target directed acyclic graph represent operation sequence numbers corresponding to operations that do not depend on any other operations, and the operations corresponding to the child nodes in the target directed acyclic graph depend on the operations corresponding to the corresponding parent nodes. Based on the target directed acyclic graph, if the number of first-layer nodes in the target directed acyclic graph is greater than a first preset number, the complexity of the descendant nodes and the number of unbound nodes of each first-layer node are obtained, and the first priority value of the corresponding first-layer node is determined based on the complexity of the descendant nodes and the number of unbound nodes. In this embodiment, the greater the complexity of the descendant nodes, the greater the corresponding first priority value, and the greater the number of unbound nodes, the greater the corresponding first priority value. Therefore, in this embodiment, adding the first-preset number of first-layer nodes with the largest first priority values ​​in the target directed acyclic graph to the ready queue can enable operations corresponding to first-layer nodes with large descendant node complexity and a large number of unbound nodes to be executed first, avoiding serious node blocking caused by the failure to execute operations corresponding to first-layer nodes with large descendant node complexity and a large number of unbound nodes. This is beneficial to increasing the number of nodes in the remaining nodes of the target directed acyclic graph that can be added to the ready queue at one time, thereby improving the processing speed of operations corresponding to nodes in the target directed acyclic graph.

[0061] Although some specific embodiments of the present invention have been described in detail by way of example, it should be understood by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It should also be understood by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.

Claims

1. A method for accelerating the processing of operations with dependencies, characterized in that: The method comprises the following steps: S100, obtaining a target directed acyclic graph; the target directed acyclic graph includes several layers of nodes, each layer of nodes includes several nodes, each node represents an operation sequence number, and different nodes represent different operation sequence numbers; the operation corresponding to any child node in the target directed acyclic graph depends on the operation corresponding to the corresponding parent node, and the operation corresponding to any first-layer node in the target directed acyclic graph does not depend on the operation corresponding to any other node in the target directed acyclic graph; S200, if the number of first-layer nodes in the target directed acyclic graph is greater than a first preset number, proceed to S300; S300, obtain the descendant node complexity f of the j-th first-layer node in the target directed acyclic graph j , f j =∑ T(j) t=1 (∏ Q(t) q=1 num t,q ), num t,q is the number of parent nodes of the qth node of the tth branch connected to the jth first-layer node in the target directed acyclic graph, where q ranges from 1 to Q(t), where Q(t) is the number of nodes included in the tth branch connected to the jth first-layer node in the target directed acyclic graph; t ranges from 1 to T(j), where T(j) is the number of branches connected to the jth first-layer node in the target directed acyclic graph; j ranges from 1 to m, where m is the number of first-layer nodes in the target directed acyclic graph; S400, obtain the number s of unbound nodes of the jth first-layer node in the target directed acyclic graph j ; If the j-th first-layer node in the target directed acyclic graph does not have a child node, then s j = 0; if the j-th first-level node in the target directed acyclic graph has a child node, and the j-th first-level node in the target directed acyclic graph has z j There is only one parent node for each child node, then s j =z j ; S500, obtaining the first priority value y of the j-th first-layer node in the target directed acyclic graph j ;y j With f j Positive correlation, y j With s j Positive correlation; S600: Add a first preset number of first-layer nodes with the largest first priority value in the target directed acyclic graph to a ready queue, so as to concurrently execute operations corresponding to all first-layer nodes in the ready queue.

2. The method for accelerating the processing of operations with dependencies according to claim 1, characterized in that: S600 includes: S610, sorting the first layer nodes in the target directed acyclic graph in descending order according to the corresponding first priority values ​​to obtain a first node sequence D; D = [d1, d2, ..., d r ,…,d m ], d r is the rth first-layer node in D, where r ranges from 1 to m; S620, if d h The first priority value is equal to d h+1 The first priority value of , then enter S630; h is the first preset number; S630, if d h If the first priority value of is 0, the first h first-layer nodes in D are determined as the first first preset number of first-layer nodes with the largest first priority value in the target directed acyclic graph; otherwise, proceed to S640; S640, obtain the first priority value in D and d h The set E of first-layer nodes with equal first priority values, E={e1,e2,…,e x ,…,e R }, e x is the xth first-level node in E, where x ranges from 1 to R, and R is the first priority value in D and d h The first priority value is equal to the number of first layer nodes; S650, traverse E, get e x The second priority value of e x The second priority value is e x The maximum value of the first priority value of all child nodes; S660, sort the first-layer nodes in E in descending order according to the corresponding second priority values ​​to obtain a second node sequence C; C = [c1, c2, ..., c v ,…,c R ], c v is the vth first-layer node in C, where the value of v ranges from 1 to R; S670, if c h-l The second priority value is not equal to c h-l+1 The first hl first-layer nodes in C and the first l first-layer nodes in D are determined as the first first preset number of first-layer nodes with the largest first priority value in the target directed acyclic graph; l is the first priority value in D greater than d h The number of first-layer nodes.

3. The method for accelerating the processing of operations with dependencies according to claim 1, wherein: y j =w1×f' j +w2×s' j , w1 and w2 are the weights corresponding to the complexity of descendant nodes and the number of unbound nodes, f' j and s' j are the normalized f j and the normalized s j , w1 and w2 are both greater than 0 and less than 1, w1+w2=1.

4. The method for accelerating the processing of operations with dependencies according to claim 3, characterized in that: The process of obtaining w2 includes: S510, obtaining the number g of first-layer nodes in the target directed acyclic graph whose number of unbound nodes is 0; S520, if m-min(h,g)≥4, the first preset weight value is determined to be w2; otherwise, the second preset weight value is determined to be w2; the first preset weight and the second preset weight are both greater than 0 and less than 1, and the second preset weight is greater than the first preset weight; min() is the minimum value, and h is the first preset number.

5. The method for accelerating the processing of operations with dependencies according to claim 1, wherein: S200 also includes: if the number of first-layer nodes in the target directed acyclic graph is less than or equal to a first preset number, all first-layer nodes in the target directed acyclic graph are added to a ready queue to concurrently execute operations corresponding to all first-layer nodes in the ready queue.

6. The method for accelerating the processing of operations with dependencies according to claim 1, characterized in that: After S600, the method further includes the following steps: S700, if the number of nodes included in the target directed acyclic graph is greater than the number of first-layer nodes selected to be added to the ready queue in the target directed acyclic graph, then obtain the target directed acyclic graph after the first update; the target directed acyclic graph after the first update is the directed acyclic graph obtained after deleting the first-layer nodes selected to be added to the ready queue from the target directed acyclic graph.

7. The method for accelerating the processing of operations with dependencies according to claim 1, characterized in that: The target directed acyclic graph is obtained according to a target log table, and the target log table is used to record operations performed on a table in a primary database within a target historical time period.

Citation Information

Patent Citations

  • Log processing method and system and graph generation method

    CN116049127A

  • Event-driven scheduling using directed acyclic graphs

    US20180276040A1