Deadlock detection method and device, electronic equipment and storage medium

By allocating path identification and passing on to the waiting graph nodes in a distributed database, the deadlock detection process is simplified, the problem of inefficient deadlock detection in the existing technology is solved, and the performance and service quality of the database system are improved.

CN119292800AActive Publication Date: 2025-01-10BEIJING OCEANBASE TECHNOLOGY CO LTD

Patent Information

Application Number
CN202411834226.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-01-10
Estimated Expiration
2044-12-12

AI Technical Summary

Technical Problem

In the prior art, the deadlock detection algorithm in distributed databases is complex, resulting in inefficiency and difficulty in accurately detecting cycle waiting conditions, which affects the performance and service quality of the database system.

Method used

By determining the path identification for each first node in the waiting relationship diagram, and controlling the node to pass the path identification to the downstream node, if the received path identification is the same as the saved identification, it is determined to form a deadlock and realize deadlock detection. This method simplifies the detection process of the waiting relationship graph, reduces network overhead, and improves detection efficiency.

Benefits of technology

It realizes fast and accurate deadlock detection, improves the throughput and scalability of the database system, reduces the system tail delay, and ensures the service quality of the database system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119292800A_ABST
    Figure CN119292800A_ABST
Patent Text Reader

Abstract

The invention provides a deadlock detection method and device, electronic equipment and a storage medium, and the method comprises the steps: determining a path identifier for each head node in a waiting relation graph, so that the path identifiers of different head nodes in the waiting relation graph are different, and the head nodes are nodes of which the in-degree is 0; controlling each head node in the waiting relation graph to send a path identifier to a downstream node, and controlling other nodes in the waiting relation graph to store the received path identifier and transmit the received path identifier to the downstream node after receiving the path identifier sent by the upstream node; if a first node in the waiting relation graph receives a path identifier which is sent by a second node and is the same as the path identifier stored by the first node, it is determined that deadlock is formed between the first node and the second node, and the first node and the second node are any two nodes in the waiting relation graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of database technology, and in particular, to a deadlock detection method and device, an electronic device, and a storage medium. Background Art

[0002] Distributed databases often use the mechanism of transaction resource locking to control transaction concurrency. Due to the mutual exclusion, hold-and-wait, and non-preemption characteristics of the above mechanisms, during the transaction concurrency process, the contention for resources by transactions may cause a circular wait (commonly known as a deadlock). For example, after transaction A successfully locks data row 1, it attempts to lock data row 2. At the same time, after transaction B successfully locks data row 2, it attempts to lock data row 1. Due to the mutual exclusion and non-preemption characteristics, neither transaction A nor transaction B will give up the locks that have been successfully acquired, and then fall into a circular wait situation, causing a deadlock. In order to detect deadlock nodes in distributed databases, WFG (Wait-ForGraph, a mathematical model that represents the waiting relationship between transactions) can be used to construct a waiting relationship graph between transactions and / or tasks, and the waiting relationship graph can be detected using a detection algorithm to unlock the detected deadlock.

[0003] However, in the related art, the deadlock detection algorithm for the waiting relationship graph is relatively complex, resulting in low deadlock detection efficiency. Summary of the invention

[0004] In view of this, one or more embodiments of the present specification provide a deadlock detection method and device, an electronic device, and a storage medium.

[0005] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions: According to a first aspect of one or more embodiments of this specification, a deadlock detection method is proposed, the method comprising: Determine a path identifier for each head node in the waiting relationship graph, so that the path identifiers of different head nodes in the waiting relationship graph are different, wherein the head node is a node with an in-degree of 0; Control each head node in the waiting relationship graph to send a path identifier to a downstream node, and control other nodes in the waiting relationship graph to save and transmit the received path identifier to the downstream node after receiving the path identifier sent by the upstream node; If the first node in the waiting relationship graph receives a path identifier sent by the second node that is identical to the path identifier saved by the first node, it is determined that a deadlock is formed between the first node and the second node, wherein the first node and the second node are any two nodes in the waiting relationship graph.

[0006] In a possible embodiment of the present specification, controlling each head node in the waiting relationship graph to send a path identifier to a downstream node includes: If the first node has at least two downstream nodes, determine a path identifier for each downstream node of the first node according to the path identifier of the first node, so that the path identifiers of different downstream nodes of the first node are different; The first node is controlled to send a corresponding path identifier to each downstream node respectively.

[0007] In a possible embodiment of the present specification, the controlling other nodes in the waiting relationship graph to save the received path identifier and transmit it to the downstream node after receiving the path identifier sent by the upstream node includes: If there are at least two downstream nodes of the third node, and the third node receives a path identifier sent by an upstream node, the received path identifier is saved, and a path identifier of each downstream node of the third node is determined according to the received path identifier, so that the path identifiers of different downstream nodes of the third node are different, wherein the third node is any node in the waiting relationship graph except the first node; The third node is controlled to send a corresponding path identifier to each downstream node respectively.

[0008] In a possible embodiment of this specification, the method further includes: If the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node; Wherein, the fourth node and the fifth node are any two nodes in the waiting relationship graph; For any path identifier, the path identifier is a source identifier of other path identifiers formed when the path identifier is transmitted downstream.

[0009] In a possible embodiment of the present specification, for any path identifier, if the path identifier is passed from one node to another node in the waiting relationship graph, it remains unchanged; if the path identifier is passed from one node to another plurality of nodes in the waiting relationship graph, different suffixes are added to the path identifier to form a path identifier for each node in the other plurality of nodes; If the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node, determining that a deadlock is formed between the fourth node and the fifth node includes: If the path identifier stored in the fourth node in the waiting relationship graph is a prefix of the path identifier received and sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node.

[0010] In a possible embodiment of this specification, the method further includes: If the path identifier saved by the sixth node in the waiting relationship graph is different from the received path identifier and is not the source identifier of the received path identifier, the sixth node is controlled to save the received path identifier and pass it to the downstream node, wherein the sixth node is any node in the waiting relationship graph.

[0011] In a possible embodiment of the present specification, if a first node in the waiting relationship graph receives a path identifier sent by a second node that is identical to a path identifier saved by the first node, determining that a deadlock is formed between the first node and the second node includes: If a first node in the waiting relationship graph receives a path identifier sent by a second node that is identical to any path identifier stored by the first node, it is determined that a deadlock is formed between the first node and the second node; If the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node, determining that a deadlock is formed between the fourth node and the fifth node includes: If any path identifier stored in the fourth node in the waiting relationship graph is a source identifier of a path identifier received and sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node; If the path identifier stored in the sixth node in the waiting relationship graph is different from the received path identifier and is not the source identifier of the received path identifier, controlling the sixth node to store the received path identifier and transmit it to the downstream node includes: If each path identifier stored in the sixth node in the waiting relationship diagram is different from the received path identifier and is not the source identifier of the received path identifier, the sixth node is controlled to store the received path identifier and pass it to the downstream node.

[0012] In a possible embodiment of the present specification, if a first node in the waiting relationship graph receives a path identifier sent by a second node that is identical to a path identifier saved by the first node, determining that a deadlock is formed between the first node and the second node includes: If a first node in the waiting relationship graph receives a path identifier sent by a second node that is identical to the path identifier stored by the first node, it is determined that a deadlock is formed between the first node and the second node with the first node as the head and the second node as the tail; If the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node, determining that a deadlock is formed between the fourth node and the fifth node includes: If any path identifier saved by the fourth node in the waiting relationship graph is the source identifier of the path identifier received from the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node with the fourth node as the head and the fifth node as the tail.

[0013] According to a second aspect of one or more embodiments of this specification, a deadlock detection device is provided, the device comprising: An initialization module, used for determining a path identifier for each head node in a waiting relationship graph, so that the path identifiers of different head nodes in the waiting relationship graph are different, wherein the head node is a node with an in-degree of 0; A transmission module, used to control each head node in the waiting relationship graph to send a path identifier to a downstream node, and control other nodes in the waiting relationship graph to save and transmit the received path identifier to the downstream node after receiving the path identifier sent by the upstream node; A detection module is used to determine that a deadlock is formed between a first node and a second node in the waiting relationship graph if the first node receives a path identifier sent by a second node that is identical to the path identifier saved by the first node, wherein the first node and the second node are any two nodes in the waiting relationship graph.

[0014] According to a third aspect of one or more embodiments of this specification, a computer program product is provided, comprising a computer program / instruction, which implements the steps of the method described in the first aspect when executed by a processor.

[0015] According to a fourth aspect of one or more embodiments of this specification, an electronic device is provided, including: processor; a memory for storing processor-executable instructions; The processor implements the method as described in the first aspect by running the executable instructions.

[0016] According to a fifth aspect of one or more embodiments of the present specification, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.

[0017] The technical solutions provided by the embodiments of this specification may have the following beneficial effects: The deadlock detection method provided in the embodiment of this specification first determines the path identifier for each head node in the waiting relationship graph, so that the path identifiers of different head nodes in the waiting relationship graph are different, and then controls each head node in the waiting relationship graph to send the path identifier to the downstream node, and controls other nodes in the waiting relationship graph to save the received path identifier after receiving the path identifier sent by the upstream node and pass it to the downstream node; if a node in the waiting relationship graph receives the same path identifier as the path identifier it saves, it is determined that a deadlock is formed between the node and the node that sent the path identifier to it. In this method, each node in the waiting relationship graph only needs to send a path identifier to its downstream node, and the deadlock of circular waiting can be accurately detected, that is, the deadlock detection is completed with extremely low network overhead, which is fast and convenient, with low latency, thereby improving the throughput, scalability and other key performance of the database system, while reducing the system tail delay and ensuring the service quality of the database system. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 It is a schematic diagram of the architecture of a distributed database provided by an exemplary embodiment.

[0019] Figure 2 is a flowchart of a deadlock detection method provided by an exemplary embodiment.

[0020] Figure 3 The figure is a schematic diagram of path label transmission in the case of a downstream node provided by an exemplary embodiment.

[0021] Figure 4 The figure is a schematic diagram of path label transmission in the case of multiple downstream nodes provided by an exemplary embodiment.

[0022] Figure 5 It is a schematic diagram of path label transmission in the case of multiple upstream nodes provided by an exemplary embodiment.

[0023] Figure 6 It is a schematic diagram of the transmission of a path number list provided by an exemplary embodiment.

[0024] Figure 7 It is a structural schematic diagram of a device provided by an exemplary embodiment.

[0025] Figure 8 is a block diagram of a deadlock detection device provided by an exemplary embodiment. DETAILED DESCRIPTION

[0026] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.

[0027] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.

[0028] Next, some concepts involved in this specification are explained.

[0029] Transaction: A collection of one or more tasks that is atomic. That is, from the perspective of transaction execution results, all tasks within a transaction are either successfully executed or not executed at all.

[0030] Resources: data rows, that is, data to be read and written by tasks within a transaction.

[0031] Waiting relationship: Transaction A has read and write permissions for resource R. If another transaction B wants to read and write resource R, it needs to wait for A to complete. Then B and A are said to have a waiting relationship, and B waits for A. Waiting relationships can be one-to-one, one-to-many, or many-to-one.

[0032] Downstream node: If A waits for B, then B is A's downstream node.

[0033] Upstream node: If A waits for B, then A is the upstream node of B.

[0034] Indegree: The number of upstream nodes of a node.

[0035] Out-degree: The number of downstream nodes of a node.

[0036] Granularity: The smallest unit of the waiting relationship, which can be a task or a transaction. When the granularity is a task, task A1 of transaction A can wait for transaction B or task B1 of transaction B.

[0037] Deadlock: Transactions are always blocked and no transaction can be successfully executed. Deadlock meets the following conditions: mutual exclusion of resources, that is, a resource can only be owned by one transaction at a time; requesting and holding resources, that is, when a transaction is blocked due to requesting resources, it holds on to the obtained resources; non-preemption, that is, before a transaction actively releases the resources, other transactions cannot forcibly seize the resources; circular waiting, that is, the waiting relationship between transactions forms a loop.

[0038] Deadlock detection: Identify deadlocked transactions through algorithms.

[0039] Waiting relationship graph: A graph consisting of the waiting relationships of all transactions in the system, where the nodes are transactions or tasks of transactions and the edges are waiting relationships.

[0040] When a data system deadlocks, it will at least cause the following impacts: Waste of resources. Deadlock will cause the resources in the system to be occupied for a long time and cannot be effectively utilized. These resources may include memory, files, locks, network connections, etc.

[0041] The program becomes unresponsive. The process or thread affected by the deadlock stops responding and cannot continue to execute, thus affecting the overall system performance and user experience.

[0042] System crash. If the deadlock affects critical resources or processes, it may cause the entire system to crash or fail.

[0043] Difficult to debug. Deadlock problems are usually hidden and complex, and difficult to discover and debug at runtime, which increases the difficulty of system maintenance and tuning.

[0044] Data corruption, when concurrently accessing shared data, deadlock may cause data inconsistency or corruption, seriously affecting the data integrity and reliability of the system.

[0045] Based on the above technical problems, at least one embodiment of the present specification provides a deadlock detection method, which can perform deadlock detection on a waiting relationship graph constructed by a data system, thereby completing the deadlock detection with extremely low network overhead, and solving the technical problems of complex algorithms and low efficiency existing in retrieval detection algorithms in related technologies.

[0046] For example, the method can be applied to Figure 1 In the distributed database shown as an example.

[0047] Please refer to the attached Figure 2 , which exemplarily shows a flowchart of a deadlock detection method, including steps S201 to S203.

[0048] First of all, it should be stated that the upstream nodes mentioned below are all first-level upstream nodes, that is, the adjacent nodes of the upstream; the downstream nodes mentioned below are all first-level downstream nodes, that is, the adjacent nodes of the downstream.

[0049] In step S201, a path identifier is determined for each head node in a waiting relationship graph, so that the path identifiers of different head nodes in the waiting relationship graph are different, wherein the head node is a node with an in-degree of 0.

[0050] For example, all the first nodes in the waiting relationship graph are sorted according to the node numbers, and path identifiers (such as path numbers) are assigned in sequence according to the sorting results. If there are n first nodes, the order of the first nodes in the above sorting results can be used as their path identifiers, that is, the path identifier of the first first node is 1, the path identifier of the second first node is 2... The path identifier of the nth first node is n.

[0051] In step S202, each head node in the waiting relationship graph is controlled to send a path identifier to a downstream node, and other nodes in the waiting relationship graph are controlled to save and transmit the received path identifier to the downstream node after receiving the path identifier sent by the upstream node.

[0052] For example, please refer to the attached Figure 3 If the first node has a downstream node, the path identifier of the first node is directly sent to its downstream node. Figure 4 , if the first node has at least two downstream nodes, then the path identifier is determined for each downstream node of the first node according to the path identifier of the first node, so that the path identifiers of different downstream nodes of the first node are different; and the first node is controlled to send the corresponding path identifier to each downstream node. Preferably, different suffixes are added after the path number to form the path identifiers of different downstream nodes, such as adding 1 to the path number of the first node to form the path identifier of the first downstream node, adding 2 to the path number of the first node to form the path identifier of the second downstream node, and so on, until the path number of the last downstream node of the first node.

[0053] For example, the third node is used to represent any node in the waiting relationship graph except the first node. If the third node has one downstream node, the path identifier saved by the third node is directly sent to its downstream node. If the third node has at least two downstream nodes, and the third node receives the path identifier sent by the upstream node, the received path identifier is saved, and the path identifier of each downstream node of the third node is determined according to the received path identifier, so that the path identifiers of different downstream nodes of the third node are different; and the third node is controlled to send the corresponding path identifier to each downstream node respectively. Preferably, different suffixes are added after the path number to form the path identifiers of different downstream nodes, such as adding 1 to the path number saved by the third node to form the path identifier of the first downstream node, adding 2 to the path number saved by the third node to form the path identifier of the second downstream node, and so on, until the path number of the last downstream node of the third node.

[0054] Please refer to the attached Figure 5 If a node has multiple upstream nodes, the path identifiers sent by the multiple upstream nodes can be saved separately, and sent to its downstream nodes in the form of a path identifier list (such as a path number list); if the node has multiple downstream nodes, the above path identifier transfer operation can be performed once for each path identifier it saves, that is, for each path identifier it saves, the path identifier of each downstream node is determined according to the path identifier and sent to each downstream node. For example, a node has two upstream nodes and two downstream nodes, and the two upstream nodes send path identifiers 1 and 2 to it respectively; then the node can add suffix 1 after path identifier 1 to form 11, add suffix 1 after path identifier 2 to form 21, and send path identifiers 11 and 21 to one of its downstream nodes, then add suffix 2 after path identifier 1 to form 12, and add suffix 2 after path identifier 2 to form 22, and send path identifiers 21 and 22 to another downstream node.

[0055] In step S203, if the first node in the waiting relationship graph receives a path identifier sent by the second node that is identical to the path identifier saved by the first node, it is determined that a deadlock is formed between the first node and the second node, wherein the first node and the second node are any two nodes in the waiting relationship graph.

[0056] That is, if a node in the waiting relationship graph receives a path identifier that is the same as the path identifier it stores, it is determined that a deadlock is formed between the node and the node that sends the path identifier to the node.

[0057] Specifically, if the first node in the waiting relationship graph receives a path identifier sent by the second node that is identical to the path identifier saved by the first node, it is determined that a deadlock is formed between the first node and the second node with the first node as the head and the second node as the tail.

[0058] It should be noted that if the first node saves multiple path identifiers, this step includes: if the first node in the waiting relationship graph receives a path identifier sent by the second node that is identical to any path identifier saved by the first node, it is determined that a deadlock is formed between the first node and the second node.

[0059] Exemplarily, the method may also include: if the path identifier saved by the fourth node in the waiting relationship graph is the source identifier of the path identifier received and sent by the fifth node, then determining that a deadlock is formed between the fourth node and the fifth node; wherein the fourth node and the fifth node are any two nodes in the waiting relationship graph; for any path identifier, the path identifier is the source identifier of other path identifiers formed by the path identifier during the process of being transmitted downstream.

[0060] That is, if the path identifier stored by a node in the waiting relationship graph is the source identifier of the path identifier received by the node, it is determined that a deadlock is formed between the node and the node that sends the path identifier to the node.

[0061] Specifically, if any path identifier saved by the fourth node in the waiting relationship graph is the source identifier of the path identifier received and sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node with the fourth node as the head and the fifth node as the tail.

[0062] Preferably, if the path identifier is passed from one node to another node in the waiting relationship graph, it remains unchanged; if the path identifier is passed from one node to multiple other nodes in the waiting relationship graph, different suffixes are added to the path identifier to form the path identifier of each of the multiple other nodes. Then the example can be: if the path identifier saved by the fourth node in the waiting relationship graph is a prefix of the path identifier sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node. For example, if the path identifier saved by a node is (1,2), and the newly received path identifier is (1,2,1), then a deadlock is formed between the node and the node that sends the path identifier (1,2,1) to it.

[0063] It should be noted that if the fourth node stores multiple path identifiers, this example may include: if any path identifier stored by the fourth node in the waiting relationship graph is the source identifier of the path identifier received and sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node.

[0064] Based on the above examples of this step, the sixth node represents any node in the waiting relationship graph, and if the path identifier saved by the sixth node in the waiting relationship graph is different from the received path identifier and is not the source identifier of the received path identifier, the sixth node is controlled to save the received path identifier and pass it to the downstream node, wherein the sixth node is any node in the waiting relationship graph. That is, if a node receives a new path identifier when there is already a saved path identifier, the newly received path identifier is saved to the node if no deadlock occurs.

[0065] It should be noted that if the sixth node stores multiple path identifiers, this example may include: if each path identifier stored by the sixth node in the waiting relationship graph is different from the received path identifier and is not the source identifier of the received path identifier, then the sixth node is controlled to save the received path identifier and pass it to the downstream node.

[0066] Please refer to the attached Figure 6 , which exemplarily shows a state in the path identification transmission process of the deadlock detection method. At this time, the node with node number 4 saves the path label list [0,0], and receives the path label list [0,0] sent by the node with node number 5, thus forming a deadlock with the node with node number 4 as the head and the node with node number 5 as the tail. At this time, the node with node number 4 saves the path label list [0,0], and receives the path label list [0,0,1] sent by the node with node number 7, thus forming a deadlock with the node with node number 4 as the head and the node with node number 7 as the tail. At this time, the node with node number 3 saves the path label list [0,1], and receives the path label list [0,0,0] sent by the node with node number 8, so the node with node number 3 can save the path label list [0,0,0] locally, and does not pass the path label list because it has no downstream node temporarily.

[0067] The deadlock detection method provided in the embodiment of this specification first determines the path identifier for each head node in the waiting relationship graph, so that the path identifiers of different head nodes in the waiting relationship graph are different, and then controls each head node in the waiting relationship graph to send the path identifier to the downstream node, and controls other nodes in the waiting relationship graph to save the received path identifier after receiving the path identifier sent by the upstream node and pass it to the downstream node; if a node in the waiting relationship graph receives the same path identifier as the path identifier it saves, it is determined that a deadlock is formed between the node and the node that sent the path identifier to it. In this method, each node in the waiting relationship graph only needs to send a path identifier to its downstream node, and the deadlock of circular waiting can be accurately detected, that is, the deadlock detection is completed with extremely low network overhead, which is fast and convenient, with low latency, thereby improving the throughput, scalability and other key performance of the database system, while reducing the system tail delay and ensuring the service quality of the database system.

[0068] Figure 7 is a schematic structural diagram of a device provided by an exemplary embodiment. Figure 7 At the hardware level, the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710, and may also include hardware required for other tasks. One or more embodiments of this specification may be implemented based on software, such as the processor 702 reading the corresponding computer program from the non-volatile memory 710 into the memory 708 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0069] Please refer to Figure 8 , the deadlock detection device can be applied to Figure 7 The deadlock detection device may include: Initialization module 801, used for determining a path identifier for each head node in the waiting relationship graph, so that the path identifiers of different head nodes in the waiting relationship graph are different, wherein the head node is a node with an in-degree of 0; The transmission module 802 is used to control each head node in the waiting relationship graph to send a path identifier to a downstream node, and control other nodes in the waiting relationship graph to save and transmit the received path identifier to the downstream node after receiving the path identifier sent by the upstream node; The detection module 803 is used to determine that a deadlock is formed between the first node and the second node if the first node in the waiting relationship graph receives a path identifier sent by the second node that is identical to the path identifier saved by the first node, wherein the first node and the second node are any two nodes in the waiting relationship graph.

[0070] In a possible embodiment of the present specification, the transmission module is used to control each head node in the waiting relationship graph to send a path identifier to a downstream node, and is used to: If the first node has at least two downstream nodes, determine a path identifier for each downstream node of the first node according to the path identifier of the first node, so that the path identifiers of different downstream nodes of the first node are different; The first node is controlled to send a corresponding path identifier to each downstream node respectively.

[0071] In a possible embodiment of the present specification, the transmission module is used to control other nodes in the waiting relationship graph to save and transmit the received path identifier to the downstream node after receiving the path identifier sent by the upstream node, and is used to: If there are at least two downstream nodes of the third node, and the third node receives a path identifier sent by an upstream node, the received path identifier is saved, and a path identifier of each downstream node of the third node is determined according to the received path identifier, so that the path identifiers of different downstream nodes of the third node are different, wherein the third node is any node in the waiting relationship graph except the first node; The third node is controlled to send a corresponding path identifier to each downstream node respectively.

[0072] In a possible embodiment of this specification, the detection module is further used for: If the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node; Wherein, the fourth node and the fifth node are any two nodes in the waiting relationship graph; For any path identifier, the path identifier is a source identifier of other path identifiers formed when the path identifier is transmitted downstream.

[0073] In a possible embodiment of the present specification, for any path identifier, if the path identifier is passed from one node to another node in the waiting relationship graph, it remains unchanged; if the path identifier is passed from one node to another plurality of nodes in the waiting relationship graph, different suffixes are added to the path identifier to form a path identifier for each node in the other plurality of nodes; The detection module is used for determining that a deadlock is formed between the fourth node and the fifth node if the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node: If the path identifier stored in the fourth node in the waiting relationship graph is a prefix of the path identifier received and sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node.

[0074] In a possible embodiment of the present specification, the transmission module is further used for: If the path identifier saved by the sixth node in the waiting relationship graph is different from the received path identifier and is not the source identifier of the received path identifier, the sixth node is controlled to save the received path identifier and pass it to the downstream node, wherein the sixth node is any node in the waiting relationship graph.

[0075] In a possible embodiment of the present specification, the detection module is used for, when determining that a deadlock is formed between a first node and a second node if a first node in the waiting relationship graph receives a path identifier sent by a second node that is identical to a path identifier saved by the first node, to: If a first node in the waiting relationship graph receives a path identifier sent by a second node that is identical to any path identifier stored by the first node, it is determined that a deadlock is formed between the first node and the second node; The detection module is used for determining that a deadlock is formed between the fourth node and the fifth node if the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node: If any path identifier stored in the fourth node in the waiting relationship graph is a source identifier of a path identifier received and sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node; The transmission module is used for controlling the sixth node to save and transmit the received path identifier to a downstream node if the path identifier saved by the sixth node in the waiting relationship graph is different from the received path identifier and is not the source identifier of the received path identifier: If each path identifier stored in the sixth node in the waiting relationship diagram is different from the received path identifier and is not the source identifier of the received path identifier, the sixth node is controlled to store the received path identifier and pass it to the downstream node.

[0076] In a possible embodiment of the present specification, the detection module is used for, when determining that a deadlock is formed between a first node and a second node if a first node in the waiting relationship graph receives a path identifier sent by a second node that is identical to a path identifier saved by the first node, to: If a first node in the waiting relationship graph receives a path identifier sent by a second node that is identical to the path identifier stored by the first node, it is determined that a deadlock is formed between the first node and the second node with the first node as the head and the second node as the tail; The detection module is used for determining that a deadlock is formed between the fourth node and the fifth node if the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node: If any path identifier saved by the fourth node in the waiting relationship graph is the source identifier of the path identifier received from the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node with the fourth node as the head and the fifth node as the tail.

[0077] One or more embodiments of the present specification also provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the method provided in any of the above embodiments.

[0078] One or more embodiments of the present specification further provide a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method provided in any of the above embodiments.

[0079] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.

[0080] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0081] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0082] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0083] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0084] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0085] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0086] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0087] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0088] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.

Claims

1. A deadlock detection method, the method comprising: Determine a path identifier for each head node in the waiting relationship graph, so that the path identifiers of different head nodes in the waiting relationship graph are different, wherein the head node is a node with an in-degree of 0; Control each head node in the waiting relationship graph to send a path identifier to a downstream node, and control other nodes in the waiting relationship graph to save and transmit the received path identifier to the downstream node after receiving the path identifier sent by the upstream node; If the first node in the waiting relationship graph receives a path identifier sent by the second node that is identical to the path identifier saved by the first node, it is determined that a deadlock is formed between the first node and the second node, wherein the first node and the second node are any two nodes in the waiting relationship graph.

2. The deadlock detection method according to claim 1, wherein the step of controlling each head node in the waiting relationship graph to send a path identifier to a downstream node comprises: If the first node has at least two downstream nodes, determine a path identifier for each downstream node of the first node according to the path identifier of the first node, so that the path identifiers of different downstream nodes of the first node are different; The first node is controlled to send a corresponding path identifier to each downstream node respectively.

3. The deadlock detection method according to claim 1, wherein the step of controlling other nodes in the waiting relationship graph to store the received path identifier after receiving the path identifier sent by the upstream node and transmitting the received path identifier to the downstream node comprises: If there are at least two downstream nodes of the third node, and the third node receives a path identifier sent by an upstream node, the received path identifier is saved, and a path identifier of each downstream node of the third node is determined according to the received path identifier, so that the path identifiers of different downstream nodes of the third node are different, wherein the third node is any node in the waiting relationship graph except the first node; The third node is controlled to send a corresponding path identifier to each downstream node respectively.

4. The deadlock detection method according to claim 2 or 3, further comprising: If the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node; Wherein, the fourth node and the fifth node are any two nodes in the waiting relationship graph; For any path identifier, the path identifier is a source identifier of other path identifiers formed when the path identifier is transmitted downstream.

5. The deadlock detection method according to claim 4, for any path identifier, if the path identifier is passed from one node to another node in the waiting relationship graph, it remains unchanged; if the path identifier is passed from one node to another plurality of nodes in the waiting relationship graph, different suffixes are added to the path identifier to form the path identifier of each node in the other plurality of nodes; If the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node, determining that a deadlock is formed between the fourth node and the fifth node includes: If the path identifier stored in the fourth node in the waiting relationship graph is a prefix of the path identifier received and sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node.

6. The deadlock detection method according to claim 4, further comprising: If the path identifier saved by the sixth node in the waiting relationship graph is different from the received path identifier and is not the source identifier of the received path identifier, the sixth node is controlled to save the received path identifier and pass it to the downstream node, wherein the sixth node is any node in the waiting relationship graph.

7. The deadlock detection method according to claim 6, wherein if a first node in the waiting relationship graph receives a path identifier sent by a second node that is identical to the path identifier saved by the first node, then determining that a deadlock is formed between the first node and the second node comprises: If a first node in the waiting relationship graph receives a path identifier sent by a second node that is identical to any path identifier stored by the first node, it is determined that a deadlock is formed between the first node and the second node; If the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node, determining that a deadlock is formed between the fourth node and the fifth node includes: If any path identifier stored in the fourth node in the waiting relationship graph is a source identifier of a path identifier received and sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node; If the path identifier stored in the sixth node in the waiting relationship graph is different from the received path identifier and is not the source identifier of the received path identifier, controlling the sixth node to store the received path identifier and transmit it to the downstream node includes: If each path identifier stored in the sixth node in the waiting relationship diagram is different from the received path identifier and is not the source identifier of the received path identifier, the sixth node is controlled to store the received path identifier and pass it to the downstream node.

8. The deadlock detection method according to claim 6, wherein if a first node in the waiting relationship graph receives a path identifier sent by a second node that is identical to a path identifier saved by the first node, then determining that a deadlock is formed between the first node and the second node comprises: If a first node in the waiting relationship graph receives a path identifier sent by a second node that is identical to the path identifier stored by the first node, it is determined that a deadlock is formed between the first node and the second node with the first node as the head and the second node as the tail; If the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node, determining that a deadlock is formed between the fourth node and the fifth node includes: If any path identifier saved by the fourth node in the waiting relationship graph is the source identifier of the path identifier received from the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node with the fourth node as the head and the fifth node as the tail.

9. A deadlock detection device, comprising: An initialization module, used for determining a path identifier for each head node in a waiting relationship graph, so that the path identifiers of different head nodes in the waiting relationship graph are different, wherein the head node is a node with an in-degree of 0; A transmission module, used to control each head node in the waiting relationship graph to send a path identifier to a downstream node, and control other nodes in the waiting relationship graph to save and transmit the received path identifier to the downstream node after receiving the path identifier sent by the upstream node; A detection module is used to determine that a deadlock is formed between a first node and a second node in the waiting relationship graph if the first node receives a path identifier sent by a second node that is identical to the path identifier saved by the first node, wherein the first node and the second node are any two nodes in the waiting relationship graph.

10. The deadlock detection device according to claim 9, wherein the transmission module is used to control each head node in the waiting relationship graph to send a path identifier to a downstream node, and is used to: If the first node has at least two downstream nodes, determine a path identifier for each downstream node of the first node according to the path identifier of the first node, so that the path identifiers of different downstream nodes of the first node are different; The first node is controlled to send a corresponding path identifier to each downstream node respectively.

11. The deadlock detection device according to claim 10, wherein the transmission module is used to control other nodes in the waiting relationship graph to store and transmit the received path identifier to the downstream node after receiving the path identifier sent by the upstream node, and is used to: If the third node has at least two downstream nodes, and the third node receives a path identifier sent by an upstream node, the received path identifier is saved, and the path identifier of each downstream node of the third node is determined according to the received path identifier, so that the path identifiers of different downstream nodes of the third node are different, wherein, The third node is any node in the waiting relationship graph except the first node; The third node is controlled to send a corresponding path identifier to each downstream node respectively.

12. The deadlock detection device according to claim 10 or 11, wherein the detection module is further used for: If the path identifier stored in the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node; in, The fourth node and the fifth node are any two nodes in the waiting relationship graph; For any path identifier, the path identifier is a source identifier of other path identifiers formed when the path identifier is transmitted downstream.

13. The deadlock detection device according to claim 12, for any path identifier, if the path identifier is passed from one node to another node in the waiting relationship graph, it remains unchanged; if the path identifier is passed from one node to another plurality of nodes in the waiting relationship graph, different suffixes are added to the path identifier to form the path identifier of each node in the other plurality of nodes; The detection module is used for determining that a deadlock is formed between the fourth node and the fifth node if the path identifier saved by the fourth node in the waiting relationship graph is the source identifier of the path identifier sent by the fifth node, and is used for: If the path identifier stored in the fourth node in the waiting relationship graph is a prefix of the path identifier received and sent by the fifth node, it is determined that a deadlock is formed between the fourth node and the fifth node.

14. The deadlock detection device according to claim 12, wherein the transmission module is further used for: If the path identifier stored in the sixth node in the waiting relationship graph is different from the received path identifier and is not the source identifier of the received path identifier, the sixth node is controlled to store the received path identifier and transmit it to the downstream node, wherein, The sixth node is any node in the waiting relationship graph.

15. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 8.

16. An electronic device, comprising: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 8 by running the executable instructions.

17. A computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Loop detection method and device, electronic equipment and storage medium

    CN113111099A

  • Loop detection method and apparatus, electronic device, and storage medium

    US20240241771A1

  • Loop detection method and apparatus, electronic device, and storage medium

    US20240370269A1

  • Detection and resolution of resource deadlocks in a distributed data processing system

    US5459871A

  • Secure path cross-domain establishment method and system

    WO2014094449A1

Cited By

  • Database deadlock processing method and device and database deadlock processing system

    CN121597698A