Information display method, device, computer equipment, readable storage medium and program product
By building a global graph data structure in a distributed database system and using shared memory and hash algorithms to display deadlock loops, the problem of low deadlock detection efficiency in distributed databases is solved, and real-time and accurate deadlock loop display and business logic adjustment are achieved.
Patent Information
- Application Number
- CN202510461810.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-14
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2045-04-14
AI Technical Summary
Deadlock detection and deactivation in distributed databases are inefficient, especially in cross-node resource management, which is difficult to detect and display deadlock loops in real time and accurately.
By obtaining dependency information in the auxiliary process of the second node at the first node, a global graph data structure is constructed, and deadlock loops are detected and displayed, including transaction information and lock waiting relationship information, and information display is optimized using shared memory and hash algorithms.
Real-time detection and accurate display of deadlock rings in distributed database systems is realized, and developers' ability to check and locate defects is improved, and users can adjust business logic to avoid deadlocks.
Smart Images

Figure CN120011428B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of database technology, and in particular to an information display method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] A distributed database is a database system that stores data across multiple computers (nodes), connected via a network and working together. With the widespread adoption of distributed databases, deadlock issues have become a significant challenge in system design and maintenance.
[0003] Deadlock occurs when two or more processes become blocked and unable to continue executing due to each other holding resources they need. In a distributed database, multiple transactions can simultaneously deadlock on multiple nodes. This deadlock involves not only local resources but also remote resources across multiple nodes. The complexity of distributed environments and the dispersed nature of resources make deadlock detection and resolution more difficult. Summary of the Invention
[0004] Based on this, it is necessary to provide an information display method, device, computer equipment, computer-readable storage medium and computer program product that can improve the efficiency of deadlock resolution in order to address the above technical problems.
[0005] In a first aspect, the present application provides an information display method, applied to a first node, the method comprising:
[0006] When a first target transaction is in a lock-waiting state, in response to dependency information sent by a target node, sending an information acquisition request to a second node to instruct the second node to acquire dependency information in an auxiliary process and send the dependency information to the first node; wherein the dependency information includes that the first target transaction is in a lock-holding state; the target node is any one of the second nodes, and the second node is a node other than the first node in the distributed database system;
[0007] Generate a corresponding graph data structure based on the dependency information stored in the system and the dependency information received; the nodes in the graph data structure contain transaction information, and the edges in the graph data structure contain lock waiting relationship information between transactions;
[0008] In response to a loop existing in the graph data structure, transaction information included in the loop and lock wait relationship information between transactions are displayed.
[0009] In one embodiment, when the first target transaction is in a lock wait state, in response to dependency information sent by the target node, sending an information acquisition request to the second node, the process includes:
[0010] In response to a first target transaction being in a lock waiting state, first dependency information between the first target transaction and a second target transaction is constructed; the second target transaction holds the lock that the first target transaction is waiting for;
[0011] The first dependency information is sent to a second node where the second target transaction is located; wherein the second node is used to construct second dependency information between the second target transaction and a third target transaction in response to the second target transaction being in a lock waiting state, and send the second dependency information to the node where the third target transaction is located; the third target transaction holds the lock that the second target transaction is waiting for.
[0012] In one embodiment, when the first target transaction is in a lock wait state, in response to dependency information sent by the target node, sending an information acquisition request to the second node to instruct the second node to acquire dependency information in the auxiliary process and send the dependency information to the first node includes:
[0013] When the first target transaction is in a lock wait state, in response to the dependency information sent by the target node, an information acquisition request is sent to the second node to instruct the second node to send a write signal to the auxiliary process in response to the information acquisition request, and read the dependency information in the shared memory and send it to the first node; wherein the auxiliary process is used to write the dependency information stored in itself into the shared memory of the second node in response to the write signal.
[0014] In one embodiment, in response to a loop in the graph data structure, displaying transaction information included in the loop and lock wait relationship information between transactions includes:
[0015] Assigning a unique identifier to the transaction information of each transaction in the graph data structure;
[0016] In response to a loop existing in the graph data structure, unique identifiers corresponding to the transaction information contained in the loop are concatenated according to a preset sorting rule to obtain identification information of the loop;
[0017] Based on the identification information, the transaction information included in the loop and the lock waiting relationship information between the transactions are displayed.
[0018] In one embodiment, in response to the presence of a loop in the graph data structure, unique identifiers corresponding to transaction information included in the loop are concatenated according to a preset sorting rule to obtain identification information of the loop, followed by:
[0019] Calculate and save the hash value corresponding to the identification information;
[0020] The stored identification information is deduplicated based on the hash value.
[0021] In one embodiment, in response to a loop in the graph data structure, displaying transaction information included in the loop and lock wait relationship information between transactions, followed by:
[0022] A transaction with the lowest priority is determined from the loop, and execution of the transaction is suspended.
[0023] In a second aspect, the present application further provides an information display device, comprising:
[0024] an information acquisition module, configured to, when a first target transaction is in a lock-waiting state, send an information acquisition request to a second node in response to dependency information sent by a target node, thereby instructing the second node to acquire dependency information in an auxiliary process and send the dependency information to the first node; wherein the dependency information includes that the first target transaction is in a lock-holding state; the target node is any one of the second nodes, and the second node is a node other than the first node in the distributed database system;
[0025] A graph model construction module is configured to generate a corresponding graph data structure based on the dependency information stored in the module and the dependency information received; the nodes in the graph data structure contain transaction information, and the edges in the graph data structure contain lock wait relationship information between transactions;
[0026] The information display module is used to display the transaction information contained in the loop and the lock waiting relationship information between the transactions in response to the existence of the loop in the graph data structure.
[0027] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above methods when executing the computer program.
[0028] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of any of the above-described methods when the computer program is executed by a processor.
[0029] In a fifth aspect, the present application also provides a computer program product, comprising a computer program, which implements the steps of any of the above methods when executed by a processor.
[0030] The above-mentioned information display method, apparatus, computer equipment, computer-readable storage medium and computer program product can achieve real-time aggregation of dependency information by obtaining dependency information saved by auxiliary processes in other nodes when a deadlock is detected based on local dependency information; by constructing a global graph data structure based on the obtained dependency information, searching for deadlock loops in the graph data structure and displaying the information contained in the loop, it can achieve real-time detection of deadlock loops and quickly and accurately draw deadlock loop information, which can facilitate developers to troubleshoot and locate defects, allow users to more intuitively see which transactions have deadlocked, and facilitate users to adjust business logic strategies to avoid deadlocks. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without any creative work.
[0032] Figure 1 Schematic diagram of centralized deadlock detection in related art;
[0033] Figure 2 Schematic diagram of distributed deadlock detection in related art;
[0034] Figure 3 1 is a flow chart of an information display method according to an embodiment;
[0035] Figure 4 is a flow chart of an information display method according to another embodiment;
[0036] Figure 5 A schematic diagram of obtaining dependency information in one embodiment;
[0037] Figure 6 1 is a flow chart of an information display method in another embodiment;
[0038] Figure 7 This is a structural block diagram of an information display device in one embodiment;
[0039] Figure 8 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0041] In the description of this application, it should be understood that if the terms "first" and "second" appear, these terms are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of such features. In the description of this application, if the term "plurality" appears, "plurality" means at least two, for example, two, three, etc., unless otherwise clearly and specifically defined.
[0042] In related technologies, the methods of deadlock detection in distributed databases are mainly divided into centralized and distributed methods. Figure 1 Centralized deadlock detection mainly involves requesting transaction waiting information from all other nodes through the central node, and then constructing the dependency relationship between all transactions (such as Figure 1 ), and then find deadlock loops through these dependencies. Figure 1 a, b, c, d, and e represent transactions; WFG (Wait-for Graph) is a waiting graph. After obtaining the global dependency relationship, the central node usually searches for deadlocks by regularly calling interface functions. Therefore, the centralized deadlock detection in related technologies has poor real-time performance. Figure 2 In distributed deadlock detection, each node can only perform detection based on local dependency information and cooperate with other nodes through message passing to detect whether a deadlock occurs. Since each node only stores local dependency information, the distributed deadlock detection in related technologies cannot obtain the complete dependency information of the deadlock loop in real time and accurately. For example, when Figure 2 Node 1 in the example is the first node to send a message. The message can be transmitted back to node 1 via node 2, node 3, and node 4 in sequence, or it can be transmitted back to node 1 via node 3 and node 4 in sequence. At this time, node 1 can detect the occurrence of deadlock, but node 1 cannot know the path of the deadlock loop.
[0043] Based on this, the embodiment of the present application provides an information display method that can be applied to nodes in a distributed database system. Here, the distributed database system can be implemented based on PostgreSQL, MySQL, etc. Figure 3 As shown, the method is applied to the first node in a distributed database system as an example. The method includes the following steps S102 to S106.
[0044] Step S102, when the first target transaction is in a lock waiting state, in response to the dependency information sent by the target node, an information acquisition request is sent to the second node to instruct the second node to obtain the dependency information in the auxiliary process and send the dependency information to the first node; wherein the dependency information includes that the first target transaction is in a lock holding state; the target node is any node among the second nodes, and the second node is a node other than the first node in the distributed database system.
[0045] The first node / second node can be used to maintain its own dependency information (e.g., dependency information related to local transactions). That is, the first node / second node can store local dependency information of the distributed database system. In one possible implementation, the distributed database system can perform distributed deadlock detection on each node, so that each node maintains its own dependency information. The first node / second node can be a computing node. The first node can be any computing node in the distributed database system.
[0046] The first target transaction can be executed on the first node. The first target transaction may be in a lock-wait state, meaning that the first target transaction is waiting to acquire a lock on a resource, but because the lock is already held by another transaction, it cannot continue execution and enters a blocked state. Specifically, when a wait relationship occurs between transactions, a transaction dependency pair is generated. A transaction dependency pair includes a waiting transaction and a waited transaction, which are in a lock-wait state and a lock-holding state, respectively. The waited transaction holds the lock that the waiting transaction is waiting for. In a distributed database system, each transaction dependency pair may occur on any node.
[0047] For example, when the first node determines that the first target transaction is in a lock-waiting state (that is, the first target transaction is waiting for a certain resource), and receives dependency information sent by the target node, including that the first target transaction is in a lock-holding state (that is, the first target transaction occupies a certain resource), it can send an information acquisition request to all second nodes in the distributed database system to instruct the second nodes to each acquire their own stored dependency information and send the acquired dependency information to the first node. In this way, the first node can obtain all the dependency information of the distributed database system. The first node / second node can store its own dependency information based on an auxiliary process. The auxiliary process can be generated when the first node / second node executes the main process. The main process can be used for deadlock detection, cross-node communication, etc., and each node can have one auxiliary process.
[0048] Specifically, when the first node determines that the first target transaction is in a lock-waiting state, and receives dependency information sent by the target node including that the first target transaction is in a lock-holding state, it can determine whether a deadlock exists based on the necessary conditions for deadlock. If a deadlock exists, the first node can send an information acquisition request to all second nodes in the distributed database system to instruct the second nodes to each acquire the dependency information stored in themselves and send the acquired dependency information to the first node. Deadlock refers to a situation where two or more processes hold resources required by each other, causing them to be unable to continue execution and enter a blocking state that cannot be resolved. The necessary conditions for deadlock include: mutual exclusion, hold and wait, non-preemption, and circular waiting.
[0049] Step S104: Generate a corresponding graph data structure based on the dependency information stored in the system and the received dependency information; the points in the graph data structure contain transaction information, and the edges in the graph data structure contain lock waiting relationship information between transactions.
[0050] Exemplarily, the first node can store its own stored dependency information and received dependency information in a graph data structure. The graph data structure can be implemented based on an array and a linked list, where each position in the array corresponds to a transaction node and contains a list of downstream nodes for this transaction node. In one possible implementation, the graph data structure can be a directed wait graph (Wait For Graph, WFG). The edges in a directed wait graph are all directed edges. With transactions as nodes and the wait relationships between transactions as edges, a global or local wait relationship graph for a distributed database system can be drawn. The graph data structure can also be a resource allocation graph.
[0051] Step S106 , in response to the existence of a loop in the graph data structure, displaying transaction information included in the loop and lock wait relationship information between transactions.
[0052] For example, the first node can detect deadlock cycles in the graph data structure based on a depth-first search (DFS) algorithm. After processing the entire graph data structure, the first node can save all deadlock cycles found in a log or print them to a terminal for visual display.
[0053] In the above information display method, when a deadlock is detected based on local dependency information, the dependency information saved by the auxiliary process in other nodes is obtained, so that the dependency information can be aggregated in real time. By constructing a global graph data structure based on the obtained dependency information, the deadlock loop is searched in the graph data structure and the information contained in the loop is displayed. It is possible to detect the deadlock loop in real time and draw the deadlock loop information quickly and accurately, which makes it easier for developers to troubleshoot and locate defects, allowing users to more intuitively see which transactions have deadlocked, and facilitating users to adjust business logic strategies to avoid deadlocks.
[0054] In an exemplary embodiment, Figure 4 As shown, the above information display method may further include:
[0055] Step S1011 : in response to the first target transaction being in a lock waiting state, constructing first dependency information between the first target transaction and the second target transaction; the second target transaction holds the lock that the first target transaction is waiting for.
[0056] The second target transaction may be executed on a different node from the first target transaction.
[0057] Step S1012: Send the first dependency information to the second node where the second target transaction is located; wherein the second node is used to construct second dependency information between the second target transaction and the third target transaction in response to the second target transaction being in a lock waiting state, and send the second dependency information to the node where the third target transaction is located; the third target transaction holds the lock that the second target transaction is waiting for.
[0058] The third target transaction can be executed on a different node than the second target transaction. The first dependency information / second dependency information can include transaction information and lock wait relationship information between transactions. The node where the third target transaction is located can be the first node / the second node. It is understood that when the node where the third target transaction is located is the first node, the deadlock loop includes two transaction nodes; when the node where the third target transaction is located is the second node, the deadlock loop includes at least three transaction nodes.
[0059] Illustratively, the first node / the second node can be used to execute a distributed deadlock detection algorithm. By executing the distributed deadlock detection algorithm, the distributed database system can detect the existence of a deadlock. In one possible implementation, the steps of the distributed deadlock detection algorithm may include: each node (including the first node and the second node) in the distributed database system generates dependency information while executing a background process, and each node stores the dependency information in its own auxiliary process. Each node sends the dependency information to the node where the downstream transaction is located, using the transaction as the basic unit of detection.
[0060] In this embodiment, when a transaction is blocked, a corresponding dependency relationship is generated and transmitted to the node where the downstream transaction is located, thereby ensuring the real-time performance of distributed deadlock detection.
[0061] In an exemplary embodiment, the above step S102 may include:
[0062] Step S1021, when the first target transaction is in a lock wait state, in response to the dependency information sent by the target node, an information acquisition request is sent to the second node to instruct the second node to respond to the information acquisition request, send a write signal to the auxiliary process, and read the dependency information in the shared memory and send it to the first node; wherein the auxiliary process is used to write the dependency information stored in itself into the shared memory of the second node in response to the write signal.
[0063] The shared memory can be obtained based on the storage area of the pre-divided node, and one node can be divided into one shared memory.
[0064] For example, please refer to Figure 5 , a dependency acquisition interface function can be implemented in advance (for example, it can be implemented by defining a user function). This function is used to execute on the background process of each node of the distributed database system to obtain all dependency information stored in the auxiliary process. When this function is called, the background process will send a write signal to the auxiliary process. After receiving the write signal, the auxiliary process will write all dependency information stored in the process to the shared memory, and set the shared memory flag write_done to true after the write is completed. The background process will continue to access the flag, and when it reads write_done as true, it will start reading all dependency information from the shared memory and return. After detecting a deadlock based on distributed deadlock detection, the first node / second node can build a list of computing nodes and remotely execute the dependency acquisition interface function on all computing nodes.
[0065] In this embodiment, by reusing local dependency information in the auxiliary process and opening it to other nodes for reading through shared memory, efficient dependency information sharing can be achieved, ensuring the real-time performance of deadlock detection.
[0066] In an exemplary embodiment, Figure 6 As shown, the above step S106 may include:
[0067] Step S1061 , assigning a unique identifier to the transaction information of each transaction in the graph data structure.
[0068] In one possible implementation, a unique identifier corresponding to each transaction's transaction information can be determined based on the order in which the transaction information is stored in the graph data structure and used as a subscript. For example, a smaller number can be assigned as a unique identifier to the transaction information stored first in the graph data structure.
[0069] Step S1062 : In response to a loop existing in the graph data structure, unique identifiers corresponding to the transaction information contained in the loop are concatenated according to a preset sorting rule to obtain identification information of the loop.
[0070] Step S1063: Based on the identification information, the transaction information included in the loop and the lock waiting relationship information between the transactions are displayed.
[0071] In one possible implementation, whenever a deadlock loop is detected, the unique identifiers corresponding to the transaction information contained in the loop are concatenated into a string according to a preset sorting rule. For example, the concatenation can be started with the smallest / largest unique identifier as the starting point. At this time, based on the identification information of the loop, the path of the deadlock loop can be clearly identified. For example, when there is a deadlock loop consisting of three transactions with transaction information of "0:994:2", "1:876:9", and "1:723:5", and their subscripts in the graph data structure are 7, 5, and 14 respectively, you can first find the smallest subscript "5", and then use "5" as the starting point to concatenate the remaining subscripts according to the lock waiting relationship between transactions to obtain the string "5->14->7".
[0072] For further information, please refer to Figure 6 , the above information display method may further include:
[0073] Step B1: Calculate and save the hash value corresponding to the identification information.
[0074] Step B2: Deduplication processing is performed on the stored identification information based on the hash value.
[0075] In one possible implementation, a hash table can be constructed, storing the hash value corresponding to the identification information as the key and the identification information as the value. Each time an identification information is generated, the corresponding hash value is calculated. Based on the hash value, the hash table is checked to see if the current deadlock loop already exists. If not, the identification information and the corresponding hash value are saved as a new key-value pair.
[0076] In this embodiment, by concatenating the unique identifiers corresponding to the transaction information contained in the loop according to a preset sorting rule, the same deadlock loop can be prevented from being repeatedly constructed. Furthermore, by storing the concatenated identifier information based on a hash algorithm, the time complexity of managing the information contained in the deadlock loop can be reduced.
[0077] In an exemplary embodiment, after the above step S106, the following steps may be included:
[0078] Step S107: determine the transaction with the lowest priority from the loop and terminate the execution of the transaction.
[0079] Exemplarily, when the first target transaction is the transaction with the lowest priority, the first node can suspend the execution of the first target transaction. In one possible implementation, a priority identifier can be pre-set for each transaction, which can be a number (for example, 1 to 100, the smaller the number, the lower the priority), or other forms of identifiers. The transaction priority information is stored together with other relevant information of the transaction (such as transaction ID, transaction status, data resources involved, etc.) in a data structure or database table related to transaction management. Once the transaction with the lowest priority is determined, the system can call the corresponding transaction management interface or function to suspend the execution of the transaction to release all lock resources held by the transaction. In this way, the lock waiting relationship in the loop can be broken, and the system can continue to perform distributed deadlock detection.
[0080] To summarize, in the above information display method, when a deadlock is detected based on local dependency information, the dependency information saved by the auxiliary processes in other nodes is obtained, so that the dependency information can be aggregated in real time. By constructing a global graph data structure based on the obtained dependency information, searching for deadlock loops in the graph data structure and displaying the information contained in the loops, the deadlock loops can be detected in real time, and the deadlock loop information can be quickly and accurately drawn, which makes it easier for developers to troubleshoot and locate defects, allowing users to more intuitively see which transactions have deadlocked, and facilitating users to adjust business logic strategies to avoid deadlocks.
[0081] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0082] Based on the same inventive concept, the present application also provides an information display device for implementing the aforementioned information display method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more information display device embodiments provided below can be found in the above-mentioned limitations of the information display method and will not be repeated here.
[0083] In an exemplary embodiment, Figure 7As shown, an information display device 300 is provided, comprising: an information acquisition module 301, a graph model construction module 302 and an information display module 303, wherein:
[0084] The information acquisition module 301 is used to send an information acquisition request to the second node in response to dependency information sent by the target node when the first target transaction is in a lock waiting state, so as to instruct the second node to obtain dependency information in the auxiliary process and send the dependency information to the first node; wherein the dependency information includes that the first target transaction is in a lock holding state; the target node is any node among the second nodes, and the second node is a node other than the first node in the distributed database system.
[0085] The graph model construction module 302 is used to generate a corresponding graph data structure based on the dependency information stored in itself and the dependency information received; the points in the graph data structure contain transaction information, and the edges in the graph data structure contain lock waiting relationship information between transactions.
[0086] The information display module 303 is configured to display transaction information included in the loop and lock wait relationship information between transactions in response to the existence of a loop in the graph data structure.
[0087] In an exemplary embodiment, the information display device 300 further includes an information transmission module for:
[0088] In response to the first target transaction being in a lock waiting state, first dependency information between the first target transaction and a second target transaction is constructed; the second target transaction holds the lock that the first target transaction is waiting for;
[0089] The first dependency information is sent to a second node where the second target transaction is located; wherein the second node is used to construct second dependency information between the second target transaction and a third target transaction in response to the second target transaction being in a lock wait state, and send the second dependency information to the node where the third target transaction is located; the third target transaction holds the lock that the second target transaction is waiting for.
[0090] In an exemplary embodiment, the information acquisition module 301 is further configured to:
[0091] When the first target transaction is in a lock wait state, in response to the dependency information sent by the target node, an information acquisition request is sent to the second node to instruct the second node to send a write signal to the auxiliary process in response to the information acquisition request, and read the dependency information in the shared memory and send it to the first node; wherein the auxiliary process is used to write the dependency information stored in itself into the shared memory of the second node in response to the write signal.
[0092] In an exemplary embodiment, the information display module 303 is further configured to:
[0093] Assign a unique identifier to the transaction information of each transaction in the graph data structure;
[0094] In response to a loop existing in the graph data structure, unique identifiers corresponding to the transaction information contained in the loop are concatenated according to a preset sorting rule to obtain identification information of the loop;
[0095] Based on the identification information, the transaction information included in the loop and the lock waiting relationship information between transactions are displayed.
[0096] In an exemplary embodiment, the information display module 303 is further configured to:
[0097] Calculate the hash value corresponding to the identification information and save it;
[0098] De-duplicate the stored identification information based on the hash value.
[0099] In an exemplary embodiment, the information display device 300 further includes a transaction abort module configured to:
[0100] Identify the lowest priority transaction from the loop and abort its execution.
[0101] Each module in the above-mentioned information display device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0102] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store local dependency information. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an information display method is implemented.
[0103] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0104] In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0105] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0106] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0107] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.
[0108] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0109] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. An information display method, characterized in that: Applied to a first node, where the first node is any node in a distributed database system, the method includes: When a first target transaction is in a lock-waiting state, based on dependency information sent by a target node, including that the first target transaction is in a lock-holding state, determining that a deadlock exists in the distributed database system based on a distributed deadlock detection method, sending an information acquisition request to a second node to instruct the second node to send a write signal to an auxiliary process in response to the information acquisition request, and to read dependency information in a shared memory and send the dependency information to the first node; wherein the target node is any one of the second nodes, and the second node is a node in the distributed database system other than the first node; the auxiliary process is generated when the second node executes a main process, the main process is used for deadlock detection or cross-node communication, and the auxiliary process is used to store dependency information maintained by the second node, and write the dependency information stored in the auxiliary process to the shared memory of the second node in response to the write signal; Generate a corresponding graph data structure based on the dependency information stored in the system and the dependency information received; the nodes in the graph data structure contain transaction information, and the edges in the graph data structure contain lock waiting relationship information between transactions; In response to a loop existing in the graph data structure, transaction information included in the loop and lock wait relationship information between transactions are displayed.
2. The method according to claim 1, characterized in that When the first target transaction is in a lock-waiting state, according to the dependency information sent by the target node, including that the first target transaction is in a lock-holding state, determining that a deadlock exists in the distributed database system based on a distributed deadlock detection method, and sending an information acquisition request to the second node, the process includes: In response to a first target transaction being in a lock waiting state, first dependency information between the first target transaction and a second target transaction is constructed; the second target transaction holds the lock that the first target transaction is waiting for; The first dependency information is sent to a second node where the second target transaction is located; wherein the second node is used to construct second dependency information between the second target transaction and a third target transaction in response to the second target transaction being in a lock waiting state, and send the second dependency information to the node where the third target transaction is located; the third target transaction holds the lock that the second target transaction is waiting for.
3. The method according to claim 1, characterized in that In response to a loop in the graph data structure, displaying transaction information included in the loop and lock wait relationship information between transactions includes: Assigning a unique identifier to the transaction information of each transaction in the graph data structure; In response to a loop existing in the graph data structure, unique identifiers corresponding to the transaction information contained in the loop are concatenated according to a preset sorting rule to obtain identification information of the loop; Based on the identification information, the transaction information included in the loop and the lock waiting relationship information between the transactions are displayed.
4. The method according to claim 3, characterized in that In response to the presence of a loop in the graph data structure, unique identifiers corresponding to the transaction information included in the loop are concatenated according to a preset sorting rule to obtain identification information of the loop, followed by: Calculate and save the hash value corresponding to the identification information; The stored identification information is deduplicated based on the hash value.
5. The method according to claim 1, wherein In response to the existence of a loop in the graph data structure, displaying transaction information included in the loop and lock wait relationship information between transactions, followed by: A transaction with the lowest priority is determined from the loop, and execution of the transaction is suspended.
6. An information display device, characterized in that: Applied to a first node, where the first node is any node in a distributed database system, the apparatus includes: An information acquisition module is configured to, when a first target transaction is in a lock-waiting state, determine, based on dependency information sent by a target node, that the first target transaction is in a lock-holding state, that a deadlock exists in the distributed database system based on a distributed deadlock detection method, and send an information acquisition request to a second node to instruct the second node to send a write signal to an auxiliary process in response to the information acquisition request, and to read dependency information in a shared memory and send it to the first node; wherein the target node is any one of the second nodes, and the second node is a node in the distributed database system other than the first node; the auxiliary process is generated when the second node executes a main process, the main process is used for deadlock detection or cross-node communication, the auxiliary process is used to store dependency information maintained by the second node, and in response to the write signal, write the dependency information stored in the auxiliary process to the shared memory of the second node; A graph model construction module is configured to generate a corresponding graph data structure based on the dependency information stored in the module and the dependency information received; the nodes in the graph data structure contain transaction information, and the edges in the graph data structure contain lock wait relationship information between transactions; The information display module is used to display the transaction information contained in the loop and the lock waiting relationship information between the transactions in response to the existence of the loop in the graph data structure.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Distributed database deadlock detection method, device and equipment
CN118796949A
Detection and resolution of resource deadlocks in a distributed data processing system
US5459871A