Distributed lock method, device and system, medium and product

By placing the management permissions of distributed locks on the storage nodes, the problems of increased communication requirements between computing nodes and long failure recovery time are solved, and the high availability and scalability of the database system are achieved.

CN119226300APending Publication Date: 2024-12-31HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311192848.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-06-30
Filing Date
2023-09-14
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

In database systems, the management of distributed locks in the prior art is usually the responsibility of computing nodes, which leads to an increase in communication requirements between computing nodes and a long failure recovery time, affecting the availability of the database.

Method used

Put the management permissions of distributed locks on the storage node, and the storage node serves as a coordinator to manage the allocation and release of locks, reducing direct communication between computing nodes, and without redefining the manager of distributed locks in the event of a failure.

Benefits of technology

Reduces network traffic between compute nodes, improves database availability and scalability, and reduces failure recovery time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226300A_ABST
    Figure CN119226300A_ABST
Patent Text Reader

Abstract

The invention relates to a distributed lock method, device and system, a computer readable storage medium and a computer program product. The method includes receiving, by a target storage node in a database system, an allocation request for a distributed lock from a first computing node in the database system, where the target storage node is a manager of the distributed lock, the allocation request for requesting the target storage node to change a holder of the distributed lock, the database system comprises a plurality of computing nodes and a plurality of storage nodes, the plurality of computing nodes provide data access, and the plurality of storage nodes store data of the plurality of computing nodes. The method also includes allocating, by the target storage node, a holder for the distributed lock. According to the embodiment of the invention, the distributed lock management authority is put on the storage node, the communication requirement between the computing nodes is reduced, the storage node can be used as a coordinator, the distribution and release of the lock are managed, and necessary information is transmitted to the related computing nodes, so that the direct communication between the computing nodes is reduced, and the communication efficiency is improved. Therefore, the network flow between the computing nodes can be saved. And in some embodiments, when the computing node has a fault, a manager of the distributed lock does not need to be determined again, so that the fault recovery time is saved, and the availability of the database is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technology, and more particularly to a distributed lock method, device, system, computer-readable storage medium, and computer program product. Background Art

[0002] Database computing integration is a traditional database architecture. In this architecture, the database analyzer, database optimizer, and database executor are usually referred to as database computing nodes, while the database storage serves as the database storage node. When computing and storage programs are deployed on the same physical machine, it is usually called a storage-computing integration deployment mode. Taking the database with one master and two slaves (backups) as an example, each master and slave node has its own computing unit (CPU) and storage (hard disk), which are deployed on different machines.

[0003] Database computing separation is another database architecture in which computing and storage are separated, and the storage space is shared for access by all database computing nodes, such as through a high-speed network. In a database architecture with storage and computing separation, only one copy of the storage space is required, the storage space is shared between computing nodes, and the storage nodes ensure high availability of the storage. This architecture is widely used in cloud storage. Summary of the invention

[0004] A distributed lock solution is provided. Through this solution, the distributed lock management authority can be placed on the storage node, reducing the need for communication between computing nodes. The storage node can act as a coordinator to manage the allocation and release of locks and pass necessary information to related computing nodes, thereby reducing direct communication between computing nodes and saving network traffic of computing nodes. In some implementation schemes, when a computing node fails, there is no need to re-determine the manager of the distributed lock, thereby reducing the fault recovery time and improving the availability of the database.

[0005] In the first aspect of the present disclosure, a method for distributed locks in a database system is provided. The method includes receiving a request for allocating a distributed lock from a first computing node in the database system by a target storage node in the database system, wherein the target storage node is a manager of the distributed lock, and the allocation request is used to request the storage node to change the holder of the distributed lock. The database system includes multiple computing nodes and multiple storage nodes, multiple computing nodes provide data access, and multiple storage nodes store data of multiple computing nodes. The method also includes allocating a holder for the distributed lock by the target storage node. According to the distributed lock method of the first aspect of the present disclosure, the distributed lock management authority is placed on the storage node, reducing the demand for communication between computing nodes. The storage node can act as a coordinator to manage the allocation and release of the lock and pass the necessary information to the relevant computing nodes, thereby reducing the direct communication between the computing nodes, so that the network traffic of the computing nodes can be saved. And in some implementation schemes, when a computing node fails, since the computing node only needs to register and register from the storage node, no additional resource reallocation processing is required, and the resource information managed by the computing node has been dispersed and stored on a highly available storage device, so the computing node does not need to re-determine the manager of the distributed lock, thereby reducing the fault recovery time and improving the availability of the database.

[0006] In an implementation scheme of the first aspect, the method may further include querying by the target storage node that the holder of the distributed lock is a second computing node in the database system. The method may further include sending a notification of releasing the distributed lock by the target storage node to a second computing node other than the first computing node. And the method may further include allocating the distributed lock to the first computing node. In this way, querying the holder of the distributed lock through the storage node, and sending a notification of releasing the distributed lock to the holder of the queried distributed lock, the management authority of the distributed lock can be unloaded from the computing node to the storage node, thereby improving the expansion capability of the computing node.

[0007] In an implementation of the first aspect, allocating a distributed lock to a first computing node may include receiving, by a target storage node, a notification from a second computing node that the distributed lock has been released. It may also include registering, by the target storage node, the holder of the distributed lock as the first computing node. And it may also include sending, by the target storage node, a notification that a request for a distributed lock has been successful to the first computing node. In this way, the allocation of a distributed lock to the first computing node is completed by the storage node, so that the management authority of the distributed lock can be offloaded from the computing node to the storage node, thereby improving the expansion capability of the computing node.

[0008] In an implementation of the first aspect, the target storage node can manage multiple distributed locks, wherein multiple registration information of the multiple distributed locks can be obtained from multiple computing nodes in the database system. In some implementations, the distributed locks can be used to read or write resources shared by multiple computing nodes in the database system, and the resources can include at least one of a page, a table, and a library. By enabling the storage node to manage multiple distributed locks, the management efficiency of the multiple distributed locks can be improved and the communication overhead between nodes can be reduced.

[0009] In an implementation of the first aspect, the method may further include registering the multiple distributed locks by the target storage node as the manager of the multiple distributed locks based on the multiple registration information of the multiple distributed locks. In some implementations, the multiple registration information of the multiple distributed locks may include information of the computing node where each of the multiple distributed locks is located, and information of at least one of the manager, holder, or requester of each distributed lock. In this way, the information of the multiple distributed locks can be saved in the storage node, further improving efficiency and reducing the overhead between the storage node and the computing node.

[0010] In an implementation of the first aspect, registering multiple distributed locks by the target storage node may include registering a portion of all distributed locks in the database system managed by the target storage node, and the multiple managers of all distributed locks may include multiple storage nodes including the target storage node. By registering a portion of the multiple distributed locks managed by the storage node, the multiple distributed locks can be evenly distributed to the corresponding storage nodes, avoiding excessive number of distributed locks managed by a certain storage node, thereby avoiding the risk of affecting distributed lock management due to storage node failure.

[0011] In the second aspect of the present disclosure, a method for distributed locks is provided. The method includes sending a request for allocating a distributed lock to a target storage node in the database system by a first computing node in the database system, wherein the target storage node is a manager of the distributed lock, and the allocation request is used to request the target storage node to change the holder of the distributed lock. The database system includes multiple computing nodes and multiple storage nodes, multiple computing nodes provide data access, and multiple storage nodes store data of multiple computing nodes. The method also includes receiving a notification from the target storage node that the distributed lock has been successfully requested. According to the method for distributed locks in the second aspect of the present disclosure, the distributed lock management authority is placed on the storage node, reducing the demand for communication between computing nodes. The storage node can act as a coordinator to manage the allocation and release of the lock and pass the necessary information to the relevant computing nodes, thereby reducing the direct communication between the computing nodes, so that the network traffic of the computing nodes can be saved. And in some implementation schemes, when a computing node fails, since the computing node only needs to register and register from the storage node, no additional resource reallocation processing is required, and the resource information managed by the computing node has been dispersed and stored on a highly available storage device, so the computing node does not need to re-determine the manager of the distributed lock, thereby reducing the fault recovery time and improving the availability of the database.

[0012] In an implementation of the second aspect, the request for the distributed lock is successful when the target storage node queries and notifies a second computing node other than the first computing node as the holder of the distributed lock to release the distributed lock. In this way, by querying the holder of the distributed lock through the storage node and sending a notification of releasing the distributed lock to the queried holder of the distributed lock, the management authority of the distributed lock can be unloaded from the computing node to the storage node, thereby improving the expansion capability of the computing node.

[0013] In the third aspect of the present disclosure, a method for distributed locks is provided. The method includes receiving a notification of releasing a distributed lock from a target storage node in the database system by a second computing node in the database system, wherein the target storage node is a manager of the distributed lock, and the database system includes multiple computing nodes and multiple storage nodes, the multiple computing nodes provide data access, and the multiple storage nodes store data of the multiple computing nodes. The method also includes sending a notification that the distributed lock has been released to the target storage node by the second computing node. According to the method for distributed locks in the third aspect of the present disclosure, the distributed lock management authority is placed on the storage node, reducing the demand for communication between computing nodes. The storage node can act as a coordinator to manage the allocation and release of locks and pass necessary information to the relevant computing nodes, thereby reducing direct communication between computing nodes, and thus saving network traffic of computing nodes. And in some implementation schemes, when a computing node fails, since the computing node only needs to register and register from the storage node, no additional resource reallocation processing is required, and the resource information managed by the computing node has been dispersed and stored on a highly available storage device, so the computing node does not need to re-determine the manager of the distributed lock, thereby reducing the fault recovery time and improving the availability of the database.

[0014] In an implementation of the third aspect, the target storage node receives an allocation request for a distributed lock from a first computing node other than a second computing node, and finds out that the holder of the distributed lock is the second computing node, wherein the allocation request is used to request the target storage node to change the holder of the distributed lock. In this way, by querying the holder of the distributed lock through the storage node, and sending a notification of releasing the distributed lock to the queried holder of the distributed lock, the management authority of the distributed lock can be unloaded from the computing node to the storage node, thereby improving the expansion capability of the computing node.

[0015] In the fourth aspect of the present disclosure, a distributed lock device is provided. The device includes a receiving module, which is configured to receive a request for allocating a distributed lock from a first computing node in the database system by a target storage node in the database system, wherein the target storage node is a manager of the distributed lock, and the allocation request is used to request the storage node to change the holder of the distributed lock, and the database system includes multiple computing nodes and multiple storage nodes, the multiple computing nodes provide data access, and the multiple storage nodes store data of multiple computing nodes. The device also includes an allocation module, which is configured to allocate a holder for the distributed lock by the target storage node. According to the distributed lock device of the fourth aspect of the present disclosure, the network traffic of the computing node can be saved, and in some implementation schemes, the distributed lock management authority is placed on the storage node to reduce the demand for communication between the computing nodes. The storage node can act as a coordinator to manage the allocation and release of the lock and pass the necessary information to the relevant computing nodes, thereby reducing the direct communication between the computing nodes, and thus saving the network traffic of the computing nodes. In some implementations, when a computing node fails, since the computing node only needs to register and register with the storage node, no additional resource reallocation processing is required, and the resource information managed by the computing node has been stored in a distributed manner on a highly available storage device. Therefore, when a computing node fails, there is no need to redetermine the manager of the distributed lock, thereby reducing the fault recovery time and improving the availability of the database.

[0016] In the fifth aspect of the present disclosure, a distributed lock device is provided. The device includes a sending module, which is configured to send a request for the allocation of a distributed lock from a first computing node in a database system to a target storage node in the database system, wherein the target storage node is the manager of the distributed lock, and the allocation request is used to request the storage node to change the holder of the distributed lock. The database system includes multiple computing nodes and multiple storage nodes, and the multiple computing nodes provide data access, and the multiple storage nodes store data of multiple computing nodes. The device also includes a receiving module, which is configured to receive a notification from the target storage node that the request for the distributed lock has been successful. According to the distributed lock device of the fifth aspect of the present disclosure, the distributed lock management authority is placed on the storage node, reducing the need for communication between computing nodes. The storage node can act as a coordinator to manage the allocation and release of the lock and pass the necessary information to the relevant computing nodes, thereby reducing the direct communication between the computing nodes, and thus saving the network traffic of the computing nodes. In some implementations, when a computing node fails, since the computing node only needs to register and register with the storage node, no additional resource reallocation processing is required, and the resource information managed by the computing node has been stored in a distributed manner on a highly available storage device. Therefore, when a computing node fails, there is no need to redetermine the manager of the distributed lock, thereby reducing the fault recovery time and improving the availability of the database.

[0017] In the sixth aspect of the present disclosure, a distributed lock device is provided. The device includes a receiving module, which is configured to receive a notification of releasing a distributed lock from a target storage node in the database system by a second computing node in the database system, wherein the target storage node is a manager of the distributed lock, and the database system includes multiple computing nodes and multiple storage nodes, the multiple computing nodes provide data access, and the multiple storage nodes store data of the multiple computing nodes. The device also includes a sending module, which is configured to send a notification that the distributed lock has been released to the target storage node by the second computing node. According to the distributed lock device of the sixth aspect of the present disclosure, the distributed lock management authority is placed on the storage node, reducing the need for communication between computing nodes. The storage node can act as a coordinator to manage the allocation and release of locks and pass necessary information to the relevant computing nodes, thereby reducing direct communication between computing nodes, and thus saving network traffic of computing nodes. In some implementations, when a computing node fails, since the computing node only needs to register and register with the storage node, no additional resource reallocation processing is required, and the resource information managed by the computing node has been stored in a distributed manner on a highly available storage device. Therefore, when a computing node fails, there is no need to redetermine the manager of the distributed lock, thereby reducing the fault recovery time and improving the availability of the database.

[0018] According to a seventh aspect of the present disclosure, a database system is provided. The database system includes a storage node, the storage node includes a processor and a memory, the processor is used to execute instructions stored in the memory, so that the storage node executes the method according to the first aspect; a first computing node, the first computing node includes a processor and a memory, the processor is used to execute instructions stored in the memory, so that the first computing node executes the method according to the second aspect; and a second computing node, the second computing node includes a processor and a memory, the processor is used to execute instructions stored in the memory, so that the second computing node executes the method according to the third aspect.

[0019] According to an eighth aspect of the present disclosure, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions, which, when executed by a computing device, cause the computer to execute the method according to the first aspect, the second aspect, or the third aspect of the present disclosure. In some implementations, the computer-readable storage medium may be non-transient. The computer-readable storage medium includes, but is not limited to, volatile memory (e.g., random access memory), non-volatile memory (e.g., flash memory, hard disk (Hard Disk Drive, HDD), solid state disk (Sol id State Drive, SSD), etc.).

[0020] According to a ninth aspect of the present disclosure, a computer program product is provided. The computer program product includes instructions, which, when executed by a computing device, cause the computing device to perform the method according to the first aspect, the second aspect, or the third aspect of the present disclosure. In some implementations, the computer program product may include one or more software installation packages, and when the method provided by the first aspect, the second aspect, or the third aspect or its possible variations needs to be used, the software installation packages may be downloaded or copied and executed on the computing device.

[0021] It should be understood that the database system according to the seventh aspect of the present disclosure, the computer-readable storage medium according to the eighth aspect, or the computer program product according to the ninth aspect is used to execute the method described in the first aspect, the second aspect, or the third aspect. Therefore, the explanation or description of the first aspect, the second aspect, or the third aspect is also applicable to the seventh aspect, the eighth aspect, and the ninth aspect. In addition, the beneficial effects that can be achieved in the seventh aspect, the eighth aspect, and the ninth aspect can refer to the beneficial effects in the corresponding method, which will not be repeated here.

[0022] Please note that the invention summary is provided to introduce a series of concepts in a simplified form, which will be further described in the detailed description below. The invention summary is not intended to identify key features or essential features of the present disclosure, nor is it intended to limit the scope of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0024] Figure 1 A schematic diagram schematically illustrates an example environment in which exemplary embodiments of the present disclosure can be implemented;

[0025] Figure 2 A schematic diagram schematically shows a database-computing integrated architecture related to an exemplary embodiment of the present disclosure;

[0026] Figure 3 A schematic diagram schematically shows a database storage logic architecture according to an exemplary embodiment of the present disclosure;

[0027] Figure 4 Schematically illustrates a signaling diagram of a distributed lock according to an exemplary embodiment of the present disclosure;

[0028] Figure 5 A schematic diagram schematically illustrates a role conversion of a distributed lock according to an exemplary embodiment of the present disclosure;

[0029] Figure 6A schematic diagram schematically illustrates a method for re-determining a manager of a distributed lock related to an exemplary embodiment of the present disclosure;

[0030] Figure 7 A schematic diagram schematically shows a schematic diagram of offloading a manager of a distributed lock to a storage node according to an exemplary embodiment of the present disclosure;

[0031] Figure 8 A schematic diagram schematically illustrates a distributed lock offloading logic architecture according to an exemplary embodiment of the present disclosure;

[0032] Fig. 9 A flowchart of a distributed lock method according to an exemplary embodiment of the present disclosure is schematically shown;

[0033] Fig.10 A flowchart of another distributed lock method according to an exemplary embodiment of the present disclosure is schematically shown;

[0034] Fig.11 A flowchart schematically illustrates another distributed lock method according to an exemplary embodiment of the present disclosure;

[0035] Fig.12 A block diagram schematically shows a distributed lock device according to an exemplary embodiment of the present disclosure;

[0036] Fig.13 A block diagram schematically shows another distributed lock device according to an exemplary embodiment of the present disclosure;

[0037] Fig.14 A block diagram schematically shows another distributed lock device according to an exemplary embodiment of the present disclosure;

[0038] Fig.15 A schematic diagram of the structure of a computing device provided in an embodiment of the present application is shown;

[0039] Fig.16 A schematic diagram showing the structure of a computing device cluster provided in an embodiment of the present application is shown; and

[0040] Fig.17 A schematic diagram of a structure in which a computing device cluster provided by an embodiment of the present application is connected via a network is shown.

[0041] Throughout the drawings, the same or similar reference numbers denote the same or similar elements. DETAILED DESCRIPTION

[0042] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0043] In the description of the embodiments of the present disclosure, the term "including" and its variations should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. may refer to different or the same objects, unless explicitly indicated to be different.

[0044] As mentioned above, if the database adopts the traditional storage-computing integrated architecture, it is usually composed of several parts: database analyzer, optimizer, executor, and storage. These analyzers, optimizers, and executors are the computing nodes of the database, while storage is the storage node of the database. When the computing and storage programs are deployed on the same physical machine, it can be called the storage-computing integrated deployment mode. Each node has its own CPU and storage resources, and different nodes are independent of each other. If the storage-computing separation deployment method is adopted, the storage space can be shared, and all database computing nodes can access the storage space, while the computing and storage space are accessed through high-speed network connections. This architecture only requires one storage space, which is shared by computing nodes to ensure high availability. The storage nodes ensure the high availability of data. This storage-computing separation architecture is more common in cloud storage architecture.

[0045] In the database, a high-availability architecture can refer to a deployment architecture that uses storage and computing separation, and implements multi-threaded concurrent access control through a database global distributed lock. Within the cluster, only one node can hold the lock at the same time and can modify shared resources. Multiple nodes can have shared locks at the same time to read shared resources. Traditional database products have global distributed lock services. High-availability architectures usually have multiple distributed nodes. When a node fails, other nodes can continue to work. In active-active (AA) writes, each node can handle business, that is, each node is equal, can read and write, and can perform operations through each computing node.

[0046] The reason for this implementation is that the data is shared, that is, shared storage is used, which means that there is only one copy of the data. If one node wants to modify it, other nodes cannot modify it at the same time, and they need to access the resource by locking. In a distributed architecture, a distributed lock service is needed for coordination and resource management. Existing lock management (master) is usually managed by the computing node side. In an environment with multiple node computing sides, resources are also managed by the computing node side, so the allocation of locks is also performed by the computing node side. In some implementations, locks can be evenly distributed to each computing node. Multiple locks will be evenly distributed to all computing nodes. When a computing node fails and exits, the resources on it must be migrated. Because the resources are actually pure memory resources (for example, tables, pages, and libraries) managed by the computing node side, once the node fails, the data on it needs to be migrated to other computing nodes according to the consistency algorithm.

[0047] When a node fails and exits, the system control will use a certain algorithm to migrate its resources to other nodes. This process is called master switching. During the switching process, the entire system has an impact on the database conversion time. During the database switching process, the entire cluster may become inaccessible until the switch is completed. The reason for the database switch may be that a node is damaged and needs to be replaced, or the server loses power, the process crashes, etc. In either case, the cluster control can redistribute resources and take over the business on the failed node.

[0048] Therefore, when an abnormality occurs in the node, such as a hardware failure that causes the node to stop working, the resources of the node need to be reselected and redistributed. For example, the redistribution of lock resources will affect the availability of the database, because the redistribution of lock resources takes time, so it is necessary to minimize the target recovery time (Recovery Time Objective), that is, the time required for the system to recover to a normal state after a failure. In addition, in some distributed systems, the number of computing nodes may increase, and the Master node and the Owner node are not on the same node. When data needs to be obtained from a node, if the data is not stored on the same node, the request will be slow. The communication requirements between nodes will also increase.

[0049] In view of this, in order to at least solve some of the above problems and other potential problems, a distributed lock solution according to an embodiment of the present disclosure is proposed. This solution is different from the distributed lock resource management used by the traditional database multi-write cluster, which also completes the management of distributed locks on the computing node side. The embodiment of the present disclosure separates the distributed lock resource from the computing node side and unloads it to the storage node, so that the target recovery time of the database after a failure can be reduced.

[0050] In a distributed system, the Master node is responsible for coordinating communication and task allocation between different nodes, while the Owner node is responsible for managing the storage and access to specific data or tasks. This design can improve the reliability and scalability of the system because even if some nodes fail, the system can continue to run from other nodes. When the number of computing nodes increases, the system can process data and tasks more efficiently because more computing resources can work simultaneously. However, as the number of nodes increases, the management and coordination overhead also increases. Therefore, designing an efficient and scalable distributed system requires weighing various factors, including the number of nodes, the overhead of network communication, data locality, and the cost of management and coordination. In addition, this optimization can reduce the overhead of communication between nodes. In large-scale distributed systems, the number of nodes is usually large, so the amount of data required for the request will also be large. This will lead to the consumption of network bandwidth and may have an impact on the scalability of the system.

[0051] Therefore, the management function of the resource group of the distributed system can be unloaded to the storage device, so the computing node only needs to register and register from the storage node. When an abnormality occurs in the computing node, no additional processing is required. This is because the resource information originally managed by the computing node has been dispersed and stored on a highly available storage device, and the stability and reliability of such a storage device are very high. In some embodiments, these resource information can be stored on two nodes or more nodes. These resource information can be stored on these two nodes in a predictable and decentralized manner. If a node fails, whether it is a hardware failure or a process failure, there is no need to perform a resource redistribution process because the resource management function is performed on the storage node. Therefore, even if the node fails, it will not affect the operation of the entire system. In addition, data can be stored on the same node, so that requests will be faster. This design is called data locality or data locality of a distributed system. It is an optimization strategy that reduces the overhead of network communication and data transmission by storing data on nodes that may be frequently accessed.

[0052] Reference below Figures 1 to 16 It should be understood that these exemplary embodiments are provided only to enable those skilled in the art to better understand and implement the embodiments of the present disclosure, and are not intended to limit the scope of the present disclosure in any way.

[0053] Figure 1 1 is a schematic diagram illustrating an example environment 100 in which methods and / or processes according to embodiments of the present disclosure may be implemented. Figure 1As exemplarily shown in FIG. 1 , the example environment 100 may represent a database system, which includes a computing node 102 (also referred to as a first computing node) and a computing node 104 (also referred to as a second computing node), and a storage node 106 (also referred to as a target storage node). Figure 1 The number and arrangement of components shown are provided as examples. Figure 1 The example environment 100 may include additional components, fewer components, different components, or differently arranged components than those shown in . For example, the example environment 100 may include more computing nodes or storage nodes.

[0054] As an example, computing node 102 can communicate with storage node 106, and computing node 104 can communicate with storage node 106. Computing node 102 can participate in lock management through a lock agent, such as managing lock 1 and lock 2 (i.e., the ID numbers of the locks are 1 and 2, the same below). Computing node 104 can participate in lock management through a lock agent, such as managing lock 3 and lock 4. Storage node 106 can implement authorization management functions for locks managed by computing node 102 and computing node 104 through a lock server.

[0055] In order to better understand the concept of the present disclosure, some concepts associated with or used in the present disclosure are introduced below. In AA write mode (also called multi-write), each node can process business operations, each node is treated equally, and can perform read and write operations. The reason for this implementation is that the data is shared and shared storage is used, which means that there is only one copy of the data. When a node is to be modified, other nodes cannot modify it at the same time, and need to access the resource by acquiring a lock. Acquiring a lock can ensure that during the modification process, other nodes cannot access or modify the resource at the same time, and only the node holding the lock can access it. This locking mechanism can avoid concurrency conflicts and ensure the consistency and integrity of the data. This lock usually adopts a distributed architecture to evenly distribute resources on each node, rather than being limited to a certain node. For example, if there are four locks, they will be evenly distributed on four nodes. If other nodes want to access or obtain a lock, they need to find the node that owns the lock and request access. Therefore, this lock is also called a distributed lock.

[0056] Distributed locks have three types of roles and three locking modes. One role is the manager (master), that is, the owner of the lock, who can manage the lock. Another role is the owner, that is, the person who currently holds the lock. Another role is the requester, that is, the person who currently wants to request the lock. In addition, three resource locking modes are defined. In invalid mode, no one requests to use the lock. In shared mode, all users can share the lock without making any modifications, just for access. In exclusive mode, for example, when user A needs to modify a resource, it involves a modification operation, so the lock must be exclusively occupied, and other users cannot access or modify the resource at the same time.

[0057] When a requester requests a lock, the master needs to find the owner of the lock. If the master finds that another node already holds the lock, it will notify the node to release the lock. If the node has finished using the lock, it can release it to the master. The master will then change the ownership of the lock from the original requester to the new requester (i.e. the node). At this point, the requester (i.e. the node) can access the required resources. This process implements a role change, from requester to owner. This involves the management method of lock resources to ensure the correct use and coordination of locks.

[0058] The following is a detailed example to describe the operation process of a node obtaining write permission. For example, the current lock resource is stored in node 1, and the node has added the lock. Now other nodes need to access the resources of a neighbor and find that they need to add the lock. The node uses a hash algorithm to calculate which node the lock belongs to. If it is found that the lock belongs to node 1, other nodes will send a request to node 1 to release the lock. After receiving the request, node 1 will check whether it still owns the lock. If it does, it will release the lock and notify the requesting node that it has been authorized. If node 1 has already released the lock, the requesting node will send a request to the master node to transfer the ownership of the lock to itself. After receiving the application, the master node will check whether the node meets the requirements. If it does, it will transfer the ownership of the lock to the node. Then the node can perform the write operation.

[0059] Figure 2 The schematic diagram of the database storage and computing integrated architecture 200 related to the exemplary embodiment of the present disclosure is schematically shown, which is to better compare the difference with the database of the traditional storage and computing integrated architecture. Figure 2As shown, the architecture 200 includes an application 202, a master database 204, a slave database 206, and a slave database 208. The master database includes a master node 210 and a hard disk 212. The slave database 206 includes a slave node 214 and a hard disk 216. The slave database 208 includes a slave node 218 and a hard disk 220.

[0060] The master database 204 or the slave databases 206, 208 can interact with the external application 202. The application 202 can read or write data through the network connection with the master database 204 or the slave databases 206, 208. In this case, the data in the master database 204 can be safely accessed and updated. The slave databases 206 and 208 can handle data queries and reads. The master database 204 can manage the transactions of the entire database system and process all requests. The hard disk 212, 216 or 220 is a hardware device for storing the data of each database.

[0061] In this way, if the database adopts the traditional storage-computing integrated architecture, each node has its own CPU and storage resources, which means that each node can independently process computing tasks and store data. This storage-computing integrated architecture also has some limitations. For example, since each node needs to independently process computing and storage tasks, resource contention may occur between the CPU and I / O, thus affecting performance. In addition, since data is dispersed across multiple nodes, additional communication overhead may be generated when performing cross-node data operations.

[0062] Figure 3 Schematically shows a schematic diagram of a database storage logic architecture 300 according to an exemplary embodiment of the present disclosure. Figure 3 As shown, the architecture 300 includes a plurality of clients, such as client 302 and client 304. In the architecture 300, a plurality of nodes, such as node 0 and node 1, are also included. Each node includes a first engine (e.g., a MySQL engine), a second engine (e.g., a Santian database engine) and a cluster management service (CMS). Taking node 0 as an example, node 0 includes a first engine 306, a second engine 310 and a CMS 326. Among them, the second engine 310 includes a resource management service (DRC) 314. DRC 314 includes a lock resource distribution management (DLS) 318, and a resource cache fusion module (DCS) 322. Similarly, taking node 1 as an example, node 1 includes a first engine 308, a second engine 312 and a CMS 328. Among them, the second engine 312 includes DRC 316. DRC 316 includes DLS320, and DCS 324.

[0063] CMS can provide a cluster management software that can uniformly manage computing, storage, network and other resources, and provide cluster management, tenant management, task management, visual management and other functions. DRC allows users to obtain and manage various resources such as servers, storage devices, network devices, etc. through the cloud platform. DCS can provide all database caches in the database as a shared database cache, which is shared by all nodes. This can improve the utilization of the cache and the overall performance of the system. DLS manages shared resources through distributed locks to ensure data consistency and mutual exclusivity during concurrent access. This management method can avoid multiple nodes modifying the same data at the same time, thereby reducing data inconsistency. Because distributed locks are distributed on multiple nodes instead of being concentrated on a certain node. This design can avoid single point failures and improve the reliability and availability of the system.

[0064] In the architecture 300, no matter how many nodes are included (for example, there are nodes not shown), these nodes share a shared storage 332. Nodes can communicate with each other. For example, taking node 0 and node 1 as an example, they can communicate through the interconnection communication module (MES) 330. Other nodes can also communicate through MES. Through such an architecture 300, data can be processed in parallel on multi-core CPUs and multiple disks, high throughput and low latency can be achieved, and the capacity and performance of the system can be easily expanded.

[0065] Figure 4 Schematically shows a signaling diagram 400 of a distributed lock according to an exemplary embodiment of the present disclosure. Figure 4 As shown, it includes a requester 402, a holder 404, and a manager 406. Figure 4 In the case of a requester 402, the requester may correspond to Figure 1 In computing node 102, requester 404 may correspond to Figure 1 The computing node 104 in the embodiment, and the manager 406 may correspond to Figure 1 Therefore, in Figure 4 Also hereinafter, requester 402 may be used interchangeably with compute node 102 , requester 404 may be used interchangeably with compute node 104 , and manager 406 may be used interchangeably with storage node 106 .

[0066] The requester 402 sends (408) a request 412 for allocation of lock authority to the manager 406. The manager 406 receives (410) the request 412 for allocation of lock authority. The manager 406 queries (414) the current holder of the lock, and finds that the current holder of the lock is the holder 404. The manager 406 sends (418) a notification 420 of releasing the lock to the holder 404. The holder 404 receives (416) the notification 420 of releasing the lock. In some embodiments, after receiving the notification 420, the holder can check whether the condition for releasing the lock is met and release the lock after the condition is met.

[0067] Holder 404 sends (422) notification 426 of successful lock release to manager 406. Manager 406 receives (424) notification 426 of successful lock release. Manager 406 registers (428) the holder as requester 402. In this way, the latest holder is updated to requester 402. It is worth noting that in order to unify the entire text and avoid confusion, the original names of each component are kept unchanged below. Manager 406 sends (432) notification 434 of successful request for the lock to requester 402. Requester 402 receives (430) notification 434 of successful request for the lock.

[0068] In this way, the management authority of querying and changing the lock is delegated to the storage node. Therefore, by implementing the embodiment according to the signaling diagram 400, the network traffic between the computing nodes can be saved, and in some embodiments, when a computing node fails, there is no need to re-determine the manager of the distributed lock, thereby saving the fault recovery time and improving the availability of the database.

[0069] Figure 5 A schematic diagram of a role conversion 500 of a distributed lock according to an exemplary embodiment of the present disclosure is schematically shown. As shown in the figure, a requester 502 can send a request (510) to an administrator 506, which can be a request to become the holder of a certain distributed lock. The administrator 506 can save and maintain a status list of the distributed lock, and the current holder of the distributed lock can be the holder 504. After querying that the current holder is the holder 504, the administrator 506 can send a notification to the holder 504 to release the distributed lock (512). After receiving the notification, the holder 504 can release the distributed lock and send a notification to the administrator 506 that the distributed lock has been released (514).

[0070] After receiving the notification that the distributed lock has been released, the manager 506 can register the new holder as the requester 502 (516). After registering the new holder as the requester 502, the manager 506 can send a notification to the requester 502 that it has been authorized as the new manager of the distributed lock (518).

[0071] In this way, fairness can be guaranteed by implementing the conversion of the roles of distributed locks at the storage nodes. By using distributed locks, it can be ensured that in a multi-threaded environment, only one requester can obtain the lock, thereby preventing multiple threads from modifying the same resource at the same time, ensuring data consistency and fairness. It can also improve efficiency, that is, the use of distributed locks can avoid conflicts when multiple nodes operate on the same resource, thereby improving the efficiency and throughput of the system. In addition, data consistency can be guaranteed. When using a distributed database or a distributed system, the use of distributed locks can ensure data consistency and avoid data inconsistency. It can also prevent deadlock. When using distributed locks, it can avoid the situation where multiple threads or multiple processes wait for each other to release the lock, thereby avoiding the occurrence of deadlock.

[0072] Figure 6 A schematic diagram 600 of redetermining a manager of a distributed lock related to an exemplary embodiment of the present disclosure is schematically shown. Figure 6 In the example above, the management authority of distributed locks is on the computing nodes. Initially, computing node 0 manages distributed locks with IDs 0, 4, 8, and 12 (hereinafter referred to as lock 0, lock 4, and so on). Computing node 1 manages locks 1, 5, 9, and 13. Computing node 2 manages locks 2, 6, 10, and 14. Computing node 3 manages locks 3, 7, 11, and 15.

[0073] At this time, computing node 2 fails. For example, computing node 2 has a hardware failure, such as a damaged hard disk or poor memory contact. Or, computing node 2 has a software failure, such as too many requests exceeding the upper limit of the server's processing capacity, which makes it impossible to process, or the machine is attacked, causing the machine to crash. For another example, a network failure occurs, such as in a distributed cluster, nodes cannot communicate with each other. This may be caused by router failure, DNS failure, network line breakage, etc. In this case, it is necessary to transfer the business on computing node 2 to other computing nodes. This process is also called resource redistribution.

[0074] In some implementations, a hash consistency algorithm can be used for resource redistribution. For example, a hash function H can be selected and applied to the resources to be distributed. The hash value range is mapped to the nodes of the distributed system. Specifically, the hash value range can be divided into N segments, where N is the number of nodes in the distributed system. Then, according to the properties of the hash function, the hash value of each segment is assigned to a node. When a resource needs to be added to the distributed system, the hash value of the resource is calculated using the hash function H, and the resource is placed on the corresponding node. When a resource needs to be deleted from the distributed system, the hash value of the resource is calculated using the hash function H, and the corresponding node is notified to delete the resource. When a node fails, the resources of the node (for example, distributed locks 2, 6, 10, and 14 on computing node 2) can be reallocated according to the hash value range to achieve load balancing and failover. Specifically, the hash value range of the node can be recalculated, and the resources in the range can be moved to other nodes. As Figure 6 As shown, distributed lock 2 on computing node 2 can be allocated to computing node 0, distributed locks 6 and 10 on computing node 2 can be allocated to computing node 1, and distributed lock 14 on computing node 2 can be allocated to computing node 3.

[0075] In this way, using a hash consistency algorithm to achieve resource redistribution can improve the performance and reliability of distributed systems and facilitate system expansion and failover processing. Specifically, the hash consistency algorithm has fast computing performance, can quickly calculate the hash value of resources, and allocate resources to corresponding nodes. The hash consistency algorithm can distribute the load to different nodes to achieve load balancing. This can avoid the situation where some nodes are overloaded while other nodes are idle. When a node fails, the hash consistency algorithm can be used to reallocate the resources of the node to achieve failover. This can improve the reliability and availability of the system.

[0076] Figure 7 A schematic diagram 700 schematically shows an exemplary embodiment of offloading a distributed lock manager to a storage node according to the present disclosure. Figure 7 In the example, the management authority of the distributed lock is on the storage node, for example, storage node 0 and storage node 1. Storage node 0 manages locks 0, 2, 4, 8, and 10. Storage node 1 manages locks 1, 3, 5, 7, 9, and 11.

[0077] In the storage-computing separation architecture, storage nodes are responsible for data storage and management, while computing nodes are responsible for processing data and generating data that needs to be persisted. This data is transmitted to the storage node through a network connection and then stored on a persistent storage device, such as a hard disk. Each computing node needs to establish a network connection with the storage node so that data can be transmitted to the storage node for persistence. This connection can be a direct connection or an indirect connection through a network switch or other network device.

[0078] As an example, the storage node is compared to a box, similar to the mainframe of a computer, and the compute node is compared to the two controllers on the mainframe. This metaphor vividly illustrates the architectural relationship between storage and compute nodes. When a request needs to be sent, it can be sent directly to any node because a communication connection has been established between them. In short, the network connection between storage and compute nodes is a key part of implementing the storage-compute separation architecture, which enables the compute node to transfer data to the storage node for persistence and ensures the availability and reliability of the data. Therefore, Figure 7 As shown, when computing node 2 fails, there is no need to reselect a manager because the management authority has been offloaded to storage node 0 and storage node 1. In this way, the failure recovery time can be reduced and the availability of the database can be improved.

[0079] In many scenarios, storage devices are viewed as a standardized, plug-and-play infrastructure, similar to a CPU or other computer components. They can be used directly after purchase without the need for deep customization or modification. However, the solution disclosed herein collaborates database functions with storage devices to meet the needs of specific scenarios. These customized storage solutions may have more advanced functions, higher performance, or better scalability to adapt to specific application scenarios. This customized storage can be understood as a storage with database capabilities, which has more functions and higher performance and can better meet the needs of specific scenarios.

[0080] Figure 8 Schematically shows a schematic diagram of a distributed lock offloading logic architecture 800 according to an exemplary embodiment of the present disclosure. Figure 8In the example, computing node 0 includes a lock agent 802, which is equivalent to an interface for accessing locks 1 and 2 and is responsible for providing lock permission operations to the database. Computing node 1 includes a lock agent 804, which is equivalent to an interface for accessing locks 3 and 5. The storage node can obtain information about distributed locks from the lock agent, such as various permission information. Specifically, the lock server 806 of storage node 0 can obtain information about distributed locks 1 and 2 from the lock agent 802 of computing node 0, and may also include information about other locks not shown. The lock server 808 of storage node 1 can obtain information about distributed locks 3 and 5 from the lock agent 804 of computing node 1, and may also include information about other locks not shown.

[0081] As an example, if multiple users want to edit a shared document, they need to obtain the same lock to ensure the mutual exclusivity of the editing operations. The client first requests the lock through the computing node, and then the computing node interacts with the storage node to obtain the lock. This process can be understood as: the client requests the lock through the computing node. The client establishes a connection with the computing node and sends a signal to the computing node to request the lock. After receiving the signal, the computing node establishes a connection with the storage node and sends a signal to the storage node to request the lock. The client obtains the lock through the lock agent. The client informs the lock agent of the identifier (such as the file name, editing area, etc.) of the lock to be obtained by calling the interface provided by the lock agent. The lock agent directly establishes a connection with the storage node based on the information provided by the client and requests the corresponding lock resources. The storage node allocates the lock resources based on the request information and returns the allocation result to the lock agent. The lock agent informs the client of the allocation result. In this way, the client can obtain the lock resource by calling the lock agent's interface without directly establishing a connection with the storage node. For the user, this process can be regarded as a "black box". The user only needs to call the corresponding interface to complete the operation.

[0082] In this way, the communication overhead between the client (computing node) and the storage node can be reduced: the client directly establishes a connection with the storage node through the lock agent, reducing the communication between the client and the computing node. This can reduce network congestion and improve communication efficiency, and reduce the load pressure on the computing node. With such a mechanism, the responsibilities of lock management can be distributed to different nodes, reducing the impact of a single node failure on the system. At the same time, through the implementation of distributed locks, better data consistency and fault tolerance can be provided, and the reliability and stability of the system can be improved.

[0083] Fig. 9 The flowchart of the method 900 of distributed lock according to the exemplary embodiment of the present disclosure is schematically shown. The method 900 may be Figure 1 The storage node 106 in is used for execution. Fig. 9 Will combine Figure 1To describe. At 902, the storage node 106 in the database system receives an allocation request for a distributed lock from the computing node 104 in the database system, wherein the storage node 106 is the manager of the distributed lock, and the allocation request is used to request the storage node to change the holder of the distributed lock. The database system includes multiple computing nodes and multiple storage nodes, the multiple computing nodes provide data access, and the multiple storage nodes store data of multiple computing nodes. At 904, the storage node 106 allocates a holder for the distributed lock. This can save network traffic of the computing node, and in some embodiments, when a computing node fails, there is no need to re-determine the manager of the distributed lock, thereby reducing the fault recovery time and improving the availability of the database.

[0084] In some embodiments, the storage node 106 may query that the holder of the distributed lock is the computing node 104 in the database system. The storage node 104 may also send a notification of releasing the distributed lock to the computing node 104. The storage node 106 may also allocate the distributed lock to the computing node 102. In this way, by querying the holder of the distributed lock through the storage node and sending a notification of releasing the distributed lock to the queried holder of the distributed lock, the management authority of the distributed lock may be unloaded from the computing node to the storage node, thereby improving the expansion capability of the computing node.

[0085] In some embodiments, the storage node 106 may receive a notification that the distributed lock has been released from the computing node 104. The storage node 106 may register the holder of the distributed lock as the computing node 102. The storage node may also send a notification that the request for the distributed lock has been successful to the computing node 102. In this way, the allocation of the distributed lock to the computing node 102 is completed by the storage node 104, so that the management authority of the distributed lock can be offloaded from the computing node to the storage node, so that the expansion capability of the computing node can be improved.

[0086] In some embodiments, the storage node 106 can manage multiple distributed locks, wherein multiple registration information of the multiple distributed locks can be obtained from multiple computing nodes in the database system. In some embodiments, the distributed locks can be used to read or write resources shared by multiple computing nodes in the database system, and the resources may include at least one item in a page, a table, and a library. By enabling the storage node to manage multiple distributed locks, the management efficiency of multiple distributed locks can be improved and the communication overhead between nodes can be reduced.

[0087] In some embodiments, the storage node 106 may also register multiple distributed locks as managers of the multiple distributed locks based on the information of the multiple distributed locks. In some embodiments, the multiple registration information of the multiple distributed locks includes information of the computing node where each of the multiple distributed locks is located, and information of at least one of the manager, holder, or requester of each distributed lock. In this way, the information of multiple distributed locks can be saved in the storage node, further improving efficiency and reducing the overhead between the storage node and the computing node.

[0088] In some embodiments, a portion of all distributed locks in the database system managed by the storage node 106 may be registered, and the multiple managers of all distributed locks include multiple storage nodes including the storage node 106. By registering a portion of the multiple distributed locks managed by the storage node 106, the multiple distributed locks may be evenly distributed to the corresponding storage nodes, thereby avoiding excessive number of distributed locks managed by a certain storage node, thereby avoiding the risk of affecting the management of distributed locks due to storage node failure.

[0089] Fig.10 The flowchart of another distributed lock method 1000 according to an exemplary embodiment of the present disclosure is schematically shown. The method 1000 may be Figure 1 The computing node 102 in the system is used for execution. Fig.10 Will combine Figure 1 To describe. At 1002, the computing node 102 in the database system sends an allocation request for a distributed lock to the storage node 106 in the database system, wherein the storage node 106 is the manager of the distributed lock, and the allocation request is used to request the storage node to change the holder of the distributed lock. The database system includes multiple computing nodes and multiple storage nodes, the multiple computing nodes provide data access, and the multiple storage nodes store data of multiple computing nodes. The computing node 102 receives a notification from the storage node 106 that the request for the distributed lock has been successful. In this way, the network traffic of the computing node can be saved, and in some embodiments, when a computing node fails, there is no need to re-determine the manager of the distributed lock, thereby reducing the fault recovery time and improving the availability of the database.

[0090] In some embodiments, the storage node 106 queries and notifies the computing node 104, which is the holder of the distributed lock, to release the distributed lock. In this way, by querying the holder of the distributed lock through the storage node and sending a notification of releasing the distributed lock to the queried holder of the distributed lock, the management authority of the distributed lock can be unloaded from the computing node to the storage node, thereby improving the expansion capability of the computing node.

[0091] Fig.11Schematically shows a flowchart of another distributed lock method 1100 according to an exemplary embodiment of the present disclosure. The method 1100 may be Figure 1 104 in the database system. At 1102, the computing node 104 in the database system receives a notification of releasing the distributed lock from the storage node 106 in the database system, wherein the storage node 106 is the manager of the distributed lock, and the database system includes multiple computing nodes and multiple storage nodes, the multiple computing nodes provide data access, and the multiple storage nodes store data of multiple computing nodes. At 1104, the computing node 104 sends a notification that the distributed lock has been released to the storage node 106. In this way, the network traffic of the computing node can be saved, and in some embodiments, when a computing node fails, there is no need to re-determine the manager of the distributed lock, thereby reducing the fault recovery time and improving the availability of the database.

[0092] In some embodiments, the storage node 106 receives an allocation request for a distributed lock from the computing node 102, and finds out that the holder of the distributed lock is the computing node 104, wherein the allocation request is used to request the storage node to change the holder of the distributed lock. In this way, by querying the holder of the distributed lock by the storage node and sending a release notification to the queried holder, the management authority of the distributed lock can be transferred from the computing node to the storage node, thereby improving the expansion capability of the computing node.

[0093] Fig.12 A block diagram of a distributed lock device 1200 according to an exemplary embodiment of the present disclosure is schematically shown. In some exemplary embodiments, a device capable of executing method 900 (e.g., storage node 106) may include a device for executing each step of method 900. The device may be implemented in any suitable form. For example, the device may be implemented in a circuit or a software module. Fig.12 Will combine Figure 1 to describe.

[0094] The device 1200 includes a receiving module 1202, which is configured to receive a distributed lock allocation request from a computing node 102 in the database system by a storage node 106 in the database system, wherein the storage node 106 is a manager of the distributed lock, and the allocation request is used to request the storage node to change the holder of the distributed lock. The database system includes multiple computing nodes and multiple storage nodes, and the multiple computing nodes provide data access, and the multiple storage nodes store data of multiple computing nodes. The device 1200 also includes an allocation module 1204, which is configured to allocate a holder for the distributed lock by the storage node 106. In this way, the holder of the distributed lock is queried through the storage node, and a notification of releasing the distributed lock is sent to the queried holder of the distributed lock, so that the management authority of the distributed lock can be unloaded from the computing node to the storage node, thereby improving the expansion capability of the computing node.

[0095] In some embodiments, the apparatus 1200 may further include a query module 1208, which is configured to query the storage node 106 to find that the holder of the distributed lock is the computing node 104 in the database system. The allocation module 1204 may further include a sending module 1206, which is configured to send a notification of releasing the distributed lock from the storage node 106 to the computing node 104. The allocation module 1204 may also be configured to allocate the distributed lock from the storage node 106 to the computing node 102. In this way, by querying the holder of the distributed lock through the storage node and sending a notification of releasing the distributed lock to the holder of the queried distributed lock, the management authority of the distributed lock can be unloaded from the computing node to the storage node, thereby improving the expansion capability of the computing node.

[0096] In some embodiments, the receiving module 1202 may also be configured to receive a notification that the distributed lock has been released from the computing node 104 by the storage node 106. The apparatus 1200 may also include a registration module 1210, which is configured to register the holder of the distributed lock as the computing node 102 by the storage node 106. The sending module 1206 may also be configured to send a notification that the distributed lock has been successfully requested by the storage node 106 to the computing node 102. In this way, the allocation of the distributed lock to the computing node 102 is completed by the storage node 104, so that the management authority of the distributed lock can be unloaded from the computing node to the storage node, so that the expansion capability of the computing node can be improved.

[0097] In some embodiments, the allocation module 1202 may also be configured to manage multiple distributed locks by the storage node 106, wherein the information of the multiple distributed locks may be obtained from multiple computing nodes in the database system. In some embodiments, the distributed locks may be used to read or write resources shared by multiple computing nodes in the database system, and the resources may include at least one of a page, a table, and a library. By enabling the storage node to manage multiple distributed locks, the management efficiency of multiple distributed locks may be improved, and the communication overhead between nodes may be reduced.

[0098] In some embodiments, the registration module 1210 may also be configured to register the multiple distributed locks by the storage node 106 as managers of the multiple distributed locks based on the information of the multiple distributed locks. In some embodiments, the information of the multiple distributed locks includes information of the computing node where each of the multiple distributed locks is located, and information of at least one of the managers, holders, or requesters of each distributed lock. In this way, the information of the multiple distributed locks can be saved in the storage node, further improving efficiency and reducing the overhead between the storage node and the computing node.

[0099] In some embodiments, the registration module 1210 may also be configured to register, by the storage node 106, a portion of all distributed locks in the database system managed by the storage node 106, and the multiple managers of all distributed locks include multiple storage nodes including the storage node 106. By registering a portion of the multiple distributed locks managed by the storage node 106, the multiple distributed locks may be evenly distributed to the corresponding storage nodes, thereby avoiding excessive number of distributed locks managed by a certain storage node, thereby avoiding the risk of affecting the management of distributed locks due to storage node failure.

[0100] Fig.13 A block diagram of another distributed lock device 1300 according to an exemplary embodiment of the present disclosure is schematically shown. In some exemplary embodiments, a device (e.g., computing node 102) capable of executing method 1000 may include a device for executing each step of method 1000. The device may be implemented in any suitable form. For example, the device may be implemented in a circuit or a software module. Fig.13 Will combine Figure 1 to describe. Fig.13 Will combine Figure 1 to describe.

[0101] The device 1300 includes a sending module 1302, which is configured to send a distributed lock allocation request from a computing node 102 in a database system to a storage node 106 in the database system, wherein the storage node 106 is a manager of the distributed lock, and the allocation request is used to request the storage node to change the holder of the distributed lock. The database system includes multiple computing nodes and multiple storage nodes, the multiple computing nodes provide data access, and the multiple storage nodes store data of multiple computing nodes. The device 1300 also includes a receiving module 1304, which is configured to receive a notification from the storage node 106 that the distributed lock has been successfully requested. In this way, the network traffic of the computing node can be saved, and in some embodiments, when a computing node fails, there is no need to re-determine the manager of the distributed lock, thereby reducing the fault recovery time and improving the availability of the database.

[0102] In some embodiments, the storage node 106 queries and notifies the computing node 104, which is the holder of the distributed lock, to release the distributed lock. In this way, by querying the holder of the distributed lock through the storage node and sending a notification of releasing the distributed lock to the queried holder of the distributed lock, the management authority of the distributed lock can be unloaded from the computing node to the storage node, thereby improving the expansion capability of the computing node.

[0103] Fig.14 A block diagram of another distributed lock device 1400 according to an exemplary embodiment of the present disclosure is schematically shown. In some exemplary embodiments, a device (e.g., computing node 104) capable of executing method 1100 may include a device for executing each step of method 1100. The device may be implemented in any suitable form. For example, the device may be implemented in a circuit or a software module. Fig.14 Will combine Figure 1 to describe.

[0104] The apparatus 1400 includes a receiving module 1402, which is configured to receive a notification of releasing a distributed lock from a storage node 106 in the database system by a computing node 104 in the database system, wherein the storage node 106 is a manager of the distributed lock, and the database system includes multiple computing nodes and multiple storage nodes, the multiple computing nodes provide data access, and the multiple storage nodes store data of the multiple computing nodes. The apparatus 1400 also includes a sending module 1404, which is configured to send a notification that the distributed lock has been released by the computing node 104 to the storage node 106. In this way, the network traffic of the computing node can be saved, and in some embodiments, when a computing node fails, there is no need to re-determine the manager of the distributed lock, thereby reducing the fault recovery time and improving the availability of the database.

[0105] In some embodiments, the storage node 106 queries and notifies the computing node 104 as the holder of the distributed lock to release the distributed lock, wherein the allocation request is used to request the storage node to change the holder of the distributed lock. In this way, the holder of the distributed lock is queried through the storage node, and a notification of releasing the distributed lock is sent to the queried holder of the distributed lock, so that the management authority of the distributed lock can be unloaded from the computing node to the storage node, thereby improving the expansion capability of the computing node.

[0106] Fig.15 1 shows a schematic block diagram of an example computing device 1500 that can be used to implement an example implementation of the present disclosure. Fig.15 As shown, computing device 1500 includes: bus 1502, processor 1504, memory 1506 and communication interface 1508. Processor 1504, memory 1506 and communication interface 1508 communicate through bus 1502. Computing device 1500 can be a server, a storage device with computing capabilities, or a terminal device. It should be understood that the present disclosure does not limit the number of processors and memories in computing device 1500.

[0107] The bus 1502 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.15 The bus 1502 may include a path for transmitting information between various components of the computing device 1500 (eg, the memory 1506, the processor 1504, and the communication interface 1508).

[0108] The processor 1504 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0109] The memory 1506 may include a volatile memory, such as a random access memory (RAM). The processor 1504 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0110] The memory 1506 stores executable program codes, and the processor 1504 executes the executable program codes to respectively implement the functions of one or more of the aforementioned receiving module 1202, the allocation module 1204, the sending module 1302, the receiving module 1304, the receiving module 1402, or the sending module 1404, thereby implementing the distributed lock method according to the embodiment of the present disclosure. That is, the memory 1506 stores instructions for executing the distributed lock method according to the embodiment of the present disclosure.

[0111] Alternatively, the memory 1506 stores executable codes, and the processor 1504 executes the executable codes to respectively implement the functions of the aforementioned apparatus 1200, 1300, or 1400, thereby implementing the distributed lock method according to the embodiment of the present disclosure. That is, the memory 1506 stores instructions for executing the distributed lock method according to the embodiment of the present disclosure.

[0112] The communication interface 1508 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1500 and other devices or communication networks.

[0113] The disclosed embodiments also provide a computing device cluster, such as a database system. Fig.16 A schematic block diagram of an example computing device cluster 1600 that can be used to implement an exemplary implementation of the present disclosure is shown. The computing device cluster 1600 includes at least one computing device. The computing device can be a server, such as a central server, an edge server, a storage device with computing capabilities, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.

[0114] like Fig.16 As shown, the computing device cluster 1600 includes at least one computing device 1500. The memory 1506 in one or more computing devices 1500 in the computing device cluster 1600 may store the same instructions for executing the distributed lock method according to the embodiment of the present disclosure.

[0115] In some possible implementations, the memory 1506 of one or more computing devices 1500 in the computing device cluster 1600 may also store partial instructions for executing the distributed lock method according to the embodiment of the present disclosure. In other words, the combination of one or more computing devices 1500 can jointly execute the instructions for executing the distributed lock method according to the embodiment of the present disclosure.

[0116] It should be noted that the memory 1506 in different computing devices 1500 in the computing device cluster 1600 may store different instructions, which are respectively used to execute part of the functions of the apparatus 1200, 1300 or 1400. That is, the instructions stored in the memory 1506 in different computing devices 1500 may implement the functions of one or more of the aforementioned receiving module 1202, allocating module 1204, sending module 1302, receiving module 1304, receiving module 1402 or sending module 1404.

[0117] In some possible implementations, one or more computing devices in the computing device cluster 1600 may be connected via a network, which may be a wide area network or a local area network. Fig.17 A possible implementation is shown. Fig.16 As shown, three computing devices 1500A, 1500B and 1500C are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 1506 in the computing device 1500A stores instructions for executing the functions of the receiving module 1202 and the distribution module 1204. The memory 1506 in the computing device 1500B stores instructions for executing the functions of the sending module 1302 and the receiving module 1304. The memory 1506 in the computing device 1500C stores instructions for executing the functions of the receiving module 1402 and the sending module 1404.

[0118] It should be understood that Fig.17 The functions of the computing device 1500A shown in FIG. 1 may also be completed by multiple computing devices 1500. Similarly, the functions of the computing device 1500B may also be completed by multiple computing devices 1500, and the functions of the computing device 1500C may also be completed by multiple computing devices 1500.

[0119] The present disclosure also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to that of Fig.15 and Fig.16The connection mode of the computing device cluster 1600. The difference is that the memory 1506 in one or more computing devices 1500 in the computing device cluster may store the same instructions for executing the distributed lock method according to the embodiment of the present disclosure.

[0120] In some possible implementations, the memory 1506 of one or more computing devices 1500 in the computing device cluster may also store partial instructions for executing the distributed lock according to the embodiment of the present disclosure. In other words, the combination of one or more computing devices 1500 can jointly execute the instructions for executing the distributed lock according to the embodiment of the present disclosure.

[0121] The embodiments of the present disclosure also provide a computer program product including instructions, which may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the method and function of any of the above embodiments.

[0122] The embodiments of the present disclosure also provide a computer-readable storage medium, which may be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc. The computer-readable storage medium includes instructions that instruct the computing device to execute the method and function of any of the above embodiments.

[0123] In general, various embodiments of the present disclosure may be implemented in hardware or dedicated circuits, software, logic, or any combination thereof. Some aspects may be implemented in hardware, while other aspects may be implemented in firmware or software, which may be performed by a controller, microprocessor, or other computing device. Although various aspects of the embodiments of the present disclosure are shown and described as block diagrams, flow charts, or using some other graphical representation, it should be understood that the blocks, devices, systems, techniques, or methods described herein may be implemented as, by way of non-limiting example, hardware, software, firmware, dedicated circuits or logic, general purpose hardware or controllers or other computing devices, or some combination thereof.

[0124] The present disclosure also provides at least one computer program product tangibly stored on a non-transitory computer-readable storage medium. The computer program product includes computer executable instructions, such as instructions included in a program module, which are executed in a device on a real or virtual processor of the target to perform the process / method as described above with reference to the accompanying drawings. Typically, program modules include routines, programs, libraries, objects, classes, components, data structures, etc. that perform specific tasks or implement specific abstract data types. In various embodiments, the functions of program modules can be combined or divided between program modules as needed. Machine executable instructions for program modules can be executed in local or distributed devices. In distributed devices, program modules can be located in local and remote storage media.

[0125] The computer program code for realizing the method of the present disclosure can be written in one or more programming languages. These computer program codes can be provided to the processor of general-purpose computer, special-purpose computer or other programmable data processing device, so that the program code, when being executed by computer or other programmable data processing device, causes the function / operation specified in flow chart and / or block diagram to be implemented. The program code can be executed completely on computer, partly on computer, as independent software package, partly on computer and partly on remote computer or completely on remote computer or server.

[0126] In the context of the present disclosure, computer program codes or related data may be carried by any appropriate carrier to enable a device, apparatus or processor to perform the various processes and operations described above. Examples of carriers include signals, computer readable media, and the like. Examples of signals may include electrical, optical, radio, acoustic or other forms of propagation signals, such as carrier waves, infrared signals, and the like.

[0127] A computer-readable medium may be any tangible medium containing or storing a program for or related to an instruction execution system, apparatus or device, or a data storage device such as a data center containing one or more available media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared or semiconductor system, apparatus or device, or any suitable combination thereof. More detailed examples of computer-readable storage media include an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0128] In addition, although the operation of the method of the present disclosure is described in a particular order in the accompanying drawings, this does not require or imply that these operations must be performed in this particular order, or that all the operations shown must be performed to achieve the desired result. On the contrary, the steps depicted in the flow chart can change the order of execution. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution. It should also be noted that the features and functions of two or more devices according to the present disclosure can be embodied in one device. Conversely, the features and functions of a device described above can be further divided into being embodied by multiple devices.

[0129] The various implementations of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed implementations. Although the present invention has been described in detail with reference to the aforementioned embodiments, it should be understood by those of ordinary skill in the art that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features therein can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the protection scope of the technical solutions of the various embodiments of the present invention. Without departing from the scope and spirit of the various implementations described, many modifications and changes are obvious to those of ordinary skill in the art. The choice of terms used in this article is intended to explain the principles of each implementation, practical application or improvement of technology in the market, or to enable other ordinary skill in the art to understand the various implementations disclosed herein.

Claims

1. A distributed lock method, characterized in that: The method comprises: A target storage node in a database system receives an allocation request for the distributed lock from a first computing node in the database system, wherein the target storage node is a manager of the distributed lock, and the allocation request is used to request the target storage node to change the holder of the distributed lock, and the database system includes multiple computing nodes and multiple storage nodes, the multiple computing nodes provide data access, and the multiple storage nodes store data of the multiple computing nodes; and The target storage node assigns a holder to the distributed lock.

2. The method according to claim 1, characterized in that The method further comprises: When the target storage node queries that the holder of the distributed lock is a second computing node other than the first computing node in the database system; The target storage node sends a notification of releasing the distributed lock to the second computing node; and The distributed lock is allocated to the first computing node.

3. The method according to claim 2, characterized in that Wherein allocating the distributed lock to the first computing node comprises: The target storage node receives a notification from the second computing node that the distributed lock has been released; The target storage node registers the holder of the distributed lock as the first computing node; and The target storage node sends a notification to the first computing node that the request for the distributed lock has been successful.

4. The method according to claim 1, characterized in that The target storage node manages a plurality of distributed locks, wherein a plurality of registration information of the plurality of distributed locks is obtained from the plurality of computing nodes in the database system.

5. The method according to claim 4, characterized in that Also includes: Based on the registration information of the distributed locks, the target storage node registers the distributed locks to serve as the manager of the distributed locks.

6. The method according to claim 1, characterized in that The plurality of registration information of the plurality of distributed locks includes information of a computing node where each of the plurality of distributed locks is located, and information of at least one of a manager, a holder or a requester of each distributed lock.

7. The method according to claim 1, characterized in that The distributed lock is used to read or write resources shared by the multiple computing nodes in the database system, and the resource includes at least one of a page, a table, and a library.

8. The method according to claim 5, characterized in that Registering the multiple distributed locks by the target storage node includes registering a portion of all distributed locks in the database system managed by the target storage node, and the multiple managers of all distributed locks include the multiple storage nodes including the target storage node.

9. A distributed lock method, characterized in that: The method comprises: A first computing node in a database system sends an allocation request for the distributed lock to a target storage node in the database system, wherein the target storage node is a manager of the distributed lock, and the allocation request is used to request the storage node to change the holder of the distributed lock, wherein the database system includes multiple computing nodes and multiple storage nodes, the multiple computing nodes provide data access, and the multiple storage nodes store data of the multiple computing nodes; and A notification is received from the storage node that a request for the distributed lock has been successful.

10. The method according to claim 9, characterized in that The success of the request for the distributed lock is achieved by the target storage node querying and notifying a second computing node other than the first computing node, which is the holder of the distributed lock, to release the distributed lock.

11. A distributed lock method, characterized in that: The method comprises: A second computing node in a database system receives a notification of releasing the distributed lock from a target storage node in the database system, wherein the target storage node is a manager of the distributed lock, and the database system includes a plurality of computing nodes and a plurality of storage nodes, the plurality of computing nodes provide data access, and the plurality of storage nodes store data of the plurality of computing nodes; and The second computing node sends a notification to the target storage node that the distributed lock has been released.

12. The method according to claim 11, characterized in that The target storage node receives an allocation request for the distributed lock from a first computing node other than a second computing node, and finds out that the holder of the distributed lock is the second computing node, wherein the allocation request is used to request the storage node to change the holder of the distributed lock.

13. A distributed lock device, characterized in that: The device comprises: A receiving module, configured to receive, by a target storage node in a database system, an allocation request for the distributed lock from a first computing node in the database system, wherein the target storage node is a manager of the distributed lock, and the allocation request is used to request the target storage node to change the holder of the distributed lock, and the database system includes a plurality of computing nodes and a plurality of storage nodes, the plurality of computing nodes provide data access, and the plurality of storage nodes store data of the plurality of computing nodes; and The allocation module is configured to allocate a holder for the distributed lock by the target storage node.

14. A distributed lock device, characterized in that: The device comprises: a sending module, configured to send, by a first computing node in a database system, an allocation request for the distributed lock to a target storage node in the database system, wherein the target storage node is a manager of the distributed lock, and the allocation request is used to request the target storage node to change the holder of the distributed lock, wherein the database system includes a plurality of computing nodes and a plurality of storage nodes, the plurality of computing nodes provide data access, and the plurality of storage nodes store data of the plurality of computing nodes; and The receiving module is configured to receive a notification from the storage node that the request for the distributed lock has been successful.

15. A distributed lock device, characterized in that: The device comprises: a receiving module configured to receive, by a second computing node in a database system, a notification of releasing the distributed lock from a target storage node in the database system, wherein the target storage node is a manager of the distributed lock, and the database system comprises a plurality of computing nodes and a plurality of storage nodes, the plurality of computing nodes providing data access, and the plurality of storage nodes storing data of the plurality of computing nodes; and The sending module is configured to send a notification that the distributed lock has been released from the second computing node to the target storage node.

16. A database system comprising: A storage node, the storage node comprising a processor and a memory, the processor being configured to execute instructions stored in the memory, so that the storage node executes the method according to any one of claims 1 to 8; A first computing node, the first computing node comprising a processor and a memory, the processor being configured to execute instructions stored in the memory, so that the first computing node executes the method according to any one of claims 9 to 10; as well as A second computing node, wherein the second computing node comprises a processor and a memory, wherein the processor is configured to execute instructions stored in the memory, so that the second computing node executes the method according to any one of claims 11 to 12.

17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed by a computing device, cause the computing device to perform a method according to any one of claims 1-8, 9-10 or 11-12.

18. A computer program product, characterized in that The computer program product comprises instructions which, when executed by a computing device, cause the computing device to perform a method according to any one of claims 1-8, 9-10 or 11-12.