Shared storage database management
By traversing lease locks and migrating tasks in the shared storage database, the problem of data operation termination caused by abnormal nodes in a multi-master architecture is solved, achieving efficient exception handling and data task recovery.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2026-03-19
AI Technical Summary
In a shared storage database with a multi-master architecture, abnormal nodes can cause data read and write tasks to terminate, and existing technologies struggle to effectively handle read/write conflicts and abnormal states.
By traversing the lease locks in the shared storage database through the functional nodes, acquiring the target lease lock in the holdable state, migrating the pending data operation tasks of the abnormal nodes to the target nodes, and having the target nodes execute the tasks, the allocation of lease locks and data operations are realized.
Ensure the smooth execution of data operation tasks, reduce the complexity of the decision-making process, improve the accuracy and timeliness of anomaly handling, and shorten anomaly recovery time.
Smart Images

Figure CN2025113058_19032026_PF_FP_ABST
Abstract
Description
Shared storage database management TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of computer, and particularly, to shared storage database management. BACKGROUND
[0002] The cloud-native database is a write-many-read-one and shared storage form. The database in this form has only one write node, and the management of high availability and synchronization links is relatively simple. Currently, cloud vendors begin to implement multi-master architecture based on shared storage databases to evolve to the next generation of cloud-native databases. This means that for the same storage data, multiple master nodes with read and write permissions can be mounted. Under the multi-master architecture, although multiple master nodes have write permissions, the data written by different master nodes needs to be handled for conflicts. When the shared storage database provides services, a reasonable exception handling strategy needs to be formulated to ensure that the shared storage database can operate normally.
[0003] In the related art, the databases that can be read and written by the nodes are usually specified, and different nodes can read and write different databases, so as to avoid read-write conflicts. However, this will result in that in the case of node exception, the database of the exception node cannot perform normal data read and write, and the data read and write task is terminated. Therefore, there is an urgent need for an effective shared storage database management method to solve the above problems. SUMMARY
[0004] Therefore, the embodiments of the present disclosure provide a shared storage database management method. One or more embodiments of the present disclosure also provide a shared storage database management system, a shared storage database management apparatus, a computing device, a computer readable storage medium, and a computer program product to solve the technical defects in the related art.
[0005] According to a first aspect of the embodiments of the present disclosure, a shared storage database management method is provided, including: traversing a lease lock in a shared storage database by using a function node corresponding to the shared storage database; in a case where a target lease lock in a holdable state is traversed, occupying the target lease lock by using the function node; selecting a target node in a node cluster associated with the shared storage database, and migrating a to-be-executed data operation task of an exception node corresponding to the target lease lock to the target node; in a case where the task migration is completed, allocating the target lease lock to the target node, and executing the to-be-executed data operation task based on the target lease lock by using the target node.
[0006] According to a second aspect of the embodiments of the present disclosure, a shared storage database management system is provided, comprising a function node, a target node and a shared storage node, the shared storage node containing at least one lease lock; the function node is configured to traverse the at least one lease lock contained in the shared storage node, and in the case of traversing to a target lease lock in a holdable state, occupy the target lease lock, migrate a to-be-executed data operation task of an abnormal node corresponding to the target lease lock to the target node, and in the case of completing the task migration, allocate the target lease lock to the target node; the target node is configured to execute the to-be-executed data operation task based on the target lease lock.
[0007] According to a third aspect of the embodiments of the present disclosure, a shared storage database management apparatus is provided, comprising: a traversal module configured to traverse a lease lock in a shared storage database by using a function node corresponding to the shared storage database; an occupation module configured to, in the case of traversing to a target lease lock in a holdable state, occupy the target lease lock by using the function node; a migration module configured to select a target node in a node cluster associated with the shared storage database, and migrate a to-be-executed data operation task of an abnormal node corresponding to the target lease lock to the target node; and an execution module configured to, in the case of completing the task migration, allocate the target lease lock to the target node, and execute the to-be-executed data operation task based on the target lease lock by using the target node.
[0008] According to a fourth aspect of the embodiments of the present disclosure, a computing device is provided, comprising: a memory and a processor; the memory is configured to store computer executable instructions, and the processor is configured to execute the computer executable instructions, which, when executed by the processor, implement the steps of the shared storage database management method.
[0009] According to a fifth aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, which stores computer executable instructions, which, when executed by a processor, implement the steps of the shared storage database management method.
[0010] According to a sixth aspect of the embodiments of the present disclosure, a computer program product is provided, comprising a computer program or instructions, which, when executed by a processor, implement the steps of the shared storage database management method.
[0011] In one embodiment of the present disclosure, by traversing the lease lock in the shared storage database by using the corresponding function node of the shared storage database, if the target lease lock in a holdable state is traversed, the target lease lock can be occupied by the function node. The successful occupation of the target lease lock by the function node indicates that the master node corresponding to the target lease lock is an abnormal node, and the master node does not continuously renew the target lease lock, resulting in the successful preemption of the target lease lock by the function node. At this time, a target node is selected from the node cluster associated with the shared storage database, and the to-be-executed data operation task of the abnormal node corresponding to the target lease lock is migrated to the target node. After the task migration is completed, the abnormal node can be offline, the target lease lock is allocated to the target node, the target node occupies the target lease lock, and the target node executes the to-be-executed data operation task based on the target lease lock. Thus, the smooth execution of the data operation task is ensured, and the termination of the data operation task due to the abnormal state of the abnormal node is avoided. By traversing the lease lock in the shared storage database by using the function node, the availability of the lease lock can be detected, and once the lease lock in a holdable state is detected, the abnormal processing process can be triggered, the complexity of the decision link can be reduced, the accuracy and timeliness of the abnormal processing can be improved, and the abnormal recovery time can be shortened. BRIEF DESCRIPTION OF DRAWINGS
[0012] FIG. 1 is a schematic diagram of a processing process of a shared storage database management method according to one embodiment of the present disclosure;
[0013] FIG. 2 is a flowchart of a shared storage database management method according to one embodiment of the present disclosure;
[0014] FIG. 3 is a schematic diagram of node abnormal processing of a shared storage database management method according to one embodiment of the present disclosure;
[0015] FIG. 4 is a synchronization schematic diagram of a shared storage database management method according to one embodiment of the present disclosure;
[0016] FIG. 5 is a node replacement schematic diagram of a shared storage database management method according to one embodiment of the present disclosure;
[0017] FIG. 6 is a node targeted replacement schematic diagram of a shared storage database management method according to one embodiment of the present disclosure;
[0018] FIG. 7 is a structural schematic diagram of a shared storage database management system according to one embodiment of the present disclosure;
[0019] FIG. 8 is a structural schematic diagram of a shared storage database management apparatus according to one embodiment of the present disclosure;
[0020] FIG. 9 is a structural block diagram of a computing device according to one embodiment of the present disclosure. DETAILED DESCRIPTION
[0021] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure. However, the present disclosure can be practiced without the specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail so as not to obscure the present disclosure. Some portions of the detailed description are presented in terms of algorithms, symbolic representations of operations on data bits or binary digital signals stored within a computer memory. These algorithmic descriptions and representations are the means used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art.
[0022] The terminology used in the description of one or more embodiments of the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the present disclosure. As used in one or more embodiments of the present disclosure and the accompanying claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be understood that the terms "and / or," "comprises" and / or "comprising" when used in one or more embodiments of the present disclosure are open-ended transitions that specify the presence of stated features, integers, steps or components but do not preclude the presence or addition of one or more other features, integers, steps, components, or groups thereof.
[0023] It will be understood that, although the terms first, second, etc. can be used herein to describe various information, these terms are not intended to denote a temporal or chronological order. Rather, these terms are used solely to distinguish one from another only. For example, without departing from the scope of one or more embodiments of the present disclosure, first can be termed second; likewise, second can be termed first. The term "if' as used herein means "when" or "upon" or "in response to the determination" depending on the context.
[0024] In addition, it should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present disclosure are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.
[0025] First, the nomenclature involved in one or more embodiments of the present disclosure is explained.
[0026] Lease Lock: A mechanism for implementing exclusive access to resources in a distributed system. Compared with traditional locking mechanisms, Lease Lock has more flexible time control and better scalability.
[0027] I / O Fencing: An IO fencing concept, used to perform read-write permission management of computing nodes to storage nodes. Inhibiting a node from writing at the storage level is called I / O Fencing.
[0028] Master: a computing node used to provide read-write service.
[0029] Read-only node: a computing node used to provide read-only service.
[0030] Standby node: also known as disaster recovery node, which can be reused as read-only node. After the failure of the master node, it is used to replace the new master node to restore read-write service.
[0031] RTO (Recovery Time Objective): Recovery Time Objective, mainly refers to the maximum time that can be tolerated for system service stop, that is, the shortest time period required for system to recover service function from disaster.
[0032] try_lock: refers to non-blocking attempt to acquire lock. If the lock is currently available, the acquisition is successful and returns immediately; if the lock has been occupied, the attempt fails and returns immediately without blocking the current thread.
[0033] force_lock: regardless of whether the lock is available, it will wait until the lock is acquired. This means that if the lock is currently occupied by another client, the client requesting force_lock will wait for the lock to be released. Once the lock is available, the requesting client will obtain the lock.
[0034] Figure 1 is a schematic diagram of the processing procedure of a data processing method according to an embodiment of the present disclosure; as shown in Figure 1, the shared storage database contains multiple lease locks, and a node needs to lease a lease lock to obtain the permission to read and write the data in the shared storage database. By traversing the lease locks in the shared storage database using the corresponding functional node of the shared storage database, the target lease lock in the holdable state can be found, and the target lease lock can be occupied by the functional node. The successful occupation of the target lease lock by the functional node indicates that the master node corresponding to the target lease lock has not renewed the target lease lock, so the master node is an abnormal node, which leads to the successful occupation of the target lease lock by the functional node. At this time, a target node is selected from the node cluster associated with the shared storage database, and the data operation task to be executed of the abnormal node corresponding to the target lease lock is migrated to the target node. After the task migration is completed, the abnormal node can be offline, the target lease lock is allocated to the target node, the target node leases the target lease lock, and the target node executes the data operation task to be executed based on the target lease lock. Thus, the smooth execution of the data operation task is ensured, and the termination of the data operation task due to the abnormal state of the abnormal node is avoided. By traversing the lease locks in the shared storage database using the functional node, the availability of the lease locks can be detected, and once a lease lock in the holdable state is detected, the abnormal processing procedure can be triggered, which can reduce the complexity of the decision link, improve the accuracy and timeliness of the abnormal processing, and shorten the abnormal recovery time.
[0035] It should be noted that the lease lock is a mechanism for coordinating resource access in a distributed system. It combines the traditional locking mechanism and the concept of lease to manage access rights to shared resources. The operation mechanism of the lease lock is as follows (taking the case that a client requests a lease lock from a lock service), the client requests a lease from the lock service. If the resource is available and no other client holds a lease for the resource, the lock service will grant the requester a lease and set an expiration time. The client that obtains the lease can safely access the resource within the valid period of the lease. The client can request the lock service for renewal before the lease expires to extend its exclusive access to the resource. When the client finishes the operation on the resource, it should actively release the lease so that other clients can request the resource. If the client fails to renew or release the lease before the lease expires, the lock service will automatically reclaim the lease and possibly redistribute it to other waiting clients.
[0036] In practical applications, in a shared storage scenario, the shared storage provides multiple lease locks, different lease locks belong to different slots, and the lease locks under each slot have independent lock holders. External requests can also independently perform try_lock and force_lock on one or more slots. This requires adding a slot id parameter to the index item of try_lock and force_lock. Changing the lock holder of a slot or the write permission does not affect the status of other slots. In this way, fine-grained permission management can be provided for a multi-master architecture database. In addition, an additional metadata file can be used to simplify the maintenance of the information synchronization link. Since read-only nodes need to maintain an information synchronization link with master nodes, for local read-only nodes, this synchronization link is a one-to-one relationship; for global read-only nodes, it is a many-to-one relationship. In order to facilitate read-only nodes to quickly obtain the address of one or more master nodes, a metadata file is added to each lease lock. The metadata file is consistent with a normal file and is maintained by the lock holder. When a master node successfully acquires a lock or forces a lock, the address (such as ip, port) of the master node is updated to the metadata file.
[0037] In the present disclosure, a shared storage database management method is provided, and the present disclosure also relates to a shared storage database management system, a shared storage database management device, a computing device, a computer readable storage medium and a computer program product, which are described in detail one by one in the following embodiments.
[0038] Referring to FIG. 2, FIG. 2 shows a flowchart of a shared storage database management method according to an embodiment of the present disclosure, which specifically includes the following steps.
[0039] Step 202: traversing the lease lock in the shared storage database by using the function node corresponding to the shared storage database.
[0040] Specifically, the shared storage database is a database system in a multi-server environment, in which all server nodes share the same physical storage space. The design purpose of this architecture is to improve the scalability and availability of the system, while reducing maintenance costs. In the shared storage database architecture, each server node can directly access the data stored on the shared storage device without the need to copy or synchronize data copies. The function node is one of the server nodes, or a node created for the shared storage server to have the function of coordinating and supervising the server nodes in the shared storage database. The function node can detect the abnormal node corresponding to the shared storage database, and then perform abnormal processing on the abnormal node. The lease lock is a mechanism for realizing exclusive access to resources in a distributed system. The server node corresponding to the shared storage database rents the lease lock, that is, obtains the read and write permissions of the data corresponding to the lease lock.
[0041] Based on this, at least one lease lock in the shared storage database is determined, and the function node corresponding to the shared storage database is used to traverse the lease lock in the shared storage database. The function node tries to rent the lease lock rented by the server node. In the case that the server node does not renew the lease lock it rents for a long time, the function node can successfully rent the lease lock rented by the server node and not renewed for a long time.
[0042] Further, considering that the function node itself does not have the ability to traverse the lease lock in the shared storage database, the function node can create a background thread to complete the traversal of the lease lock in the shared storage database. The specific implementation is as follows: a background thread is created by using the function node corresponding to the shared storage database; and the lease lock in the shared storage database is traversed based on a lease lock traversal order by using the background thread.
[0043] Specifically, the background thread is used to traverse the lease lock in the shared storage database. The background thread traverses the lease lock in the shared storage database by trying to renew each lease lock. The lease lock traversal order can be the arrangement order of the lease lock in the shared storage database. The purpose of traversing the lease lock in the shared storage database by using the function node is to find the lease lock that is not renewed for a long time and rent it.
[0044] Based on this, a background thread is created by using the corresponding function node of the shared storage database; by using the background thread, the lease locks in the shared storage database are traversed one by one based on the traversal order of the lease locks; when the lease locks in the shared storage database are traversed, each lease lock is attempted to be rented; if the function node succeeds in renting the lease lock, it means that the lease lock has not been renewed for a long time and has been in an overdue state. The function node polls the lease locks in the shared storage database until it succeeds in locking a certain lease lock. At this time, it means that the server node corresponding to the lease lock is detected to have a failure.
[0045] For example, in the shared storage scenario, the shared storage provides multiple lease locks, different lease locks belong to different storage locations, the lease locks under each storage location have independent lock holders, and external requests can also independently perform try_lock (attempt to lock) and force_lock (force lock) on one or more lease locks. In the case that the server node of the shared storage database succeeds in renting the lease lock, it has the read and write permissions of the data, the lease lock has a validity period, and the server node group needs to renew the lease lock in the case that the lease expires. The function node can detect the server node of the shared storage database by traversing the lease locks in the shared storage database and check whether the server node has a failure. The function node creates a background thread, and traverses the lease locks in the shared storage database by using the background thread, and attempts to rent the lease lock while polling the lease lock. If the rental succeeds, it means that the server node with a failure is detected.
[0046] In summary, the function node creates a background thread, and traverses the lease locks in the shared storage database by using the background thread, which can improve the efficiency of traversing the lease locks.
[0047] Step 204: In the case that the target lease lock in the holdable state is traversed, the target lease lock is occupied by using the function node.
[0048] Specifically, after the above-mentioned traversal of the lease locks in the shared storage database by using the corresponding function node of the shared storage database, in the case that the target lease lock in the holdable state is traversed, the target lease lock is occupied by using the function node, wherein the target lease lock in the holdable state refers to a lease lock that is not rented by a server node for a long time, and the duration that the server node cannot serve exceeds a duration threshold. The duration threshold can be the lease duration set for the lease lock. The target lease lock is occupied by using the function node, which means that the node information of the function node is written into the metadata of the target lease lock, and the writing succeeds, which means that the function node succeeds in renting the target lease lock.
[0049] Based on this, in the case that the function node corresponding to the shared storage database is used to traverse the lease lock in the shared storage database, and the target lease lock in the holdable state is traversed, the function node can occupy the target lease lock, and the node information of the function node is written into the metadata of the target lease lock. If the writing is successful, it means that the function node rents the target lease lock.
[0050] Further, the lease locks in the shared storage database all exist in the rented nodes, are not renewed by the nodes, and the lease lock whose non-renewal duration exceeds the lease duration can be regarded as the holdable state. The determination of the target lease lock in the holdable state includes: determining n lease locks in the shared storage database; determining the ith lease lock in the lease locks, where i starts from 1 and is a positive integer; in the case that the ith lease lock is in the non-serviceable state, determining the non-serviceable duration of the ith lease lock; judging whether the non-serviceable duration of the ith lease lock is greater than the duration threshold; if not, i is incremented by 1, and the step of determining the ith lease lock in the lease locks is executed; if yes, the ith lease lock is determined as the holdable state, and the ith lease lock is taken as the target lease lock.
[0051] Specifically, the rental node of the ith lease lock is the ith node. When the ith lease lock expires, the ith node can renew the ith lease lock within the lease duration. In the case that the ith node is in the non-serviceable state for a long time, and the duration of the non-serviceable state is greater than the duration threshold, it means that the ith lease lock is in the overdue state, and the non-serviceable duration of the ith lease lock is greater than the duration threshold. The ith lease lock in the overdue state means that the ith lease lock is in the holdable state.
[0052] Based on this, n lease locks in the shared storage database are determined; the first lease lock in the lease locks is determined. In the case that the first lease lock is not renewed, the first lease lock is in the non-serviceable state, the non-serviceable duration of the ith lease lock is determined, and whether the non-serviceable duration of the ith lease lock is greater than the duration threshold is judged; if not, it means that the first lease lock is not renewed, but the non-renewal duration is short, the second lease lock in the n lease locks is determined, and the candidate is judged. If yes, it means that the first lease lock is not renewed, and the non-renewal duration is long, and the first lease lock is in the overdue state. The first lease lock is determined as the holdable state, and the first lease lock is taken as the target lease lock.
[0053] In the above example, in the case of containing lease lock 1, lease lock 2 and lease lock 3 in the shared storage database, lease lock 1 is determined first in the order of the label, it is judged whether lease lock 1 is in the un-serviceable state, if lease lock 1 is not rented, it is determined that lease lock 1 is in the un-serviceable state, in the case that the duration of the un-serviceable state of lease lock 1 is greater than the duration threshold, it is indicated that lease lock 1 is in the overdue state, and lease lock 1 is taken as the target lease lock.
[0054] In summary, the lease lock in the shared storage database is polled in a convenient way until the target lease lock with the un-serviceable duration greater than the duration threshold is obtained, and the accuracy of the target lease lock determination is improved.
[0055] Step 206: Select a target node in the node cluster associated with the shared storage database, and migrate the to-be-executed data operation task of the abnormal node corresponding to the target lease lock to the target node.
[0056] Specifically, in the case of the above target lease lock in the traversable state, after the functional node occupies the target lease lock, a target node can be selected in the node cluster associated with the shared storage database, and the to-be-executed data operation task of the abnormal node corresponding to the target lease lock can be migrated to the target node. The node cluster refers to the cluster where the server node of the shared storage database is located. The target node can be a master node occupying other lease locks in the node cluster, and the target node can also be a functional node. The abnormal node refers to a server node that has rented the target lease lock and whose un-serviceable duration exceeds the duration threshold. The to-be-executed data operation task refers to a data operation task that has not been executed by the abnormal node, and the to-be-executed data operation task can be a data read-write task.
[0057] Based on this, in the case of the above target lease lock in the traversable state, it is indicated that the target lease lock has not been renewed for a long time, the renewal of the target lease lock is abnormal, and the target lease lock is in the overdue and unrenewed state. At this time, the functional node can be used to occupy the target lease lock, a target node that can continue to process the to-be-executed data operation task of the abnormal node or a target node that can assist the abnormal node to process the to-be-executed data operation task can be selected in the node cluster associated with the shared storage database, and the to-be-executed data operation task of the abnormal node corresponding to the target lease lock can be migrated to the target node.
[0058] Further, the function node can be a coordination node, which, after determining the abnormal node, coordinates the nodes to determine a first master node for the abnormal node to replace the abnormal node to continue to perform the to-be-executed data operation task, and the specific implementation is as follows: in the case that the function node is a coordination node, the function node plays a role of a relay node, a first master node associated with the abnormal node is selected in the node cluster associated with the shared storage database, and the first master node is taken as the target node.
[0059] Specifically, the coordination node is used to detect the availability of the server nodes in the shared storage database and perform abnormal detection on the server nodes in the shared storage database. In the case that an abnormal node is detected, the coordination node temporarily takes over the write point of the abnormal node as a relay node and migrates the write point of the abnormal node to another master node in the shared storage database.
[0060] Based on this, a first master node associated with the abnormal node is selected in the node cluster associated with the shared storage database. The first master node can be any master node corresponding to the shared storage database, and the first master node and the abnormal master node are both master nodes of the shared storage database. The first master node is taken as the target node, and the first master node replaces the abnormal node to perform the to-be-executed data operation task.
[0061] In the above example, the shared storage database corresponds to multiple master nodes. In the case that the function node determines that master node 1 is an abnormal node by traversing the lease lock, master node 2 is selected as the first master node, and the write point of master node 1 is migrated to master node 2 by the function node. After this, master node 2 replaces master node 1 to continue to perform the to-be-executed data operation task of master node 1.
[0062] In summary, in the case that the function node is a coordination node, the coordination node can select a first master node as a backup node of the abnormal node to replace the abnormal master node to continue to perform the to-be-executed data operation task, thereby ensuring that the to-be-executed data operation task can be successfully performed, and at the same time, the abnormal recovery is realized.
[0063] Further, the function node can also be a backup node, which is used to replace the abnormal node to continue to perform the to-be-executed data operation task of the abnormal node, and the specific implementation is as follows: in the case that the function node is a backup node, the target node is selected in the node cluster associated with the shared storage database, including: taking the function node as the target node; after migrating the to-be-executed data operation task of the abnormal node corresponding to the target lease lock to the target node, it further includes: in the case that the task migration is completed, the target node performs the to-be-executed data operation task based on the target lease lock.
[0064] Specifically, the backup node is a backup node, which is also a disaster recovery node of the abnormal node.
[0065] Based on this, in the case that the function node is a backup node, the function node plays a role of disaster recovery, that is, the function node can be used as a target node. After the target lease lock corresponding to the abnormal node is migrated to the target node, in the case that the migration is completed, it is indicated that the target node can replace the abnormal node at this time, and then the target node is used to execute the to-be-executed data operation task based on the target lease lock.
[0066] In addition, the function node can also be a global read-only node, which can determine the abnormal node by polling the lease lock in the shared storage database, and replace the abnormal node to execute the to-be-executed data operation task as a backup node. After the abnormal node is determined, the global read-only node and the backup node can synchronize the to-be-executed data operation task of the abnormal node through the synchronization link.
[0067] In the above example, in the case that the function node is used to traverse the lease lock to determine that the primary node 1 is an abnormal node, the function node can be used as a target node to continue to execute the to-be-executed data operation task of the abnormal node.
[0068] In summary, in the case that the function node is a backup node, the backup node can be used as a backup node of the abnormal node to replace the abnormal node to continue to execute the to-be-executed data operation task of the abnormal node which has not been executed, so as to realize the node disaster recovery of the shared storage database and guarantee the efficiency and safety of data reading and writing.
[0069] Further, after the function node is used as a target node and the target node executes the to-be-executed data operation task based on the target lease lock, in the case that there is no function node for traversing the lease lock in the shared storage database, a backup function node can be constructed to replace the node detection task of the function node, and the specific implementation is as follows: a backup function node is constructed for the shared storage database, and the backup function node is used as the function node to execute the step of traversing the lease lock in the shared storage database by using the function node corresponding to the shared storage database.
[0070] Specifically, the backup function node is used to replace the function node to continue to detect the node corresponding to the shared storage database, and traverse the lease lock in the shared storage database to detect whether there is an abnormal primary node.
[0071] Based on this, a backup function node is constructed for the shared storage database, and the backup function node is used as the function node, so that the backup function node can be used to continue to traverse the lease lock in the shared storage database to detect whether there is an abnormal primary node in the shared storage database.
[0072] In the above example, in the case of replacing the abnormal node with the function node as the target node, an operator or through the management and control platform can add a backup function node to the shared storage database, and the backup function node can continue to detect the master node corresponding to the shared storage database in the form of traversing the lease lock by replacing the function node.
[0073] In summary, the backup function node is constructed for the shared storage database, and the backup function node is used as the function node. The backup function node can continue to detect the master node corresponding to the shared storage database in the form of traversing the lease lock by replacing the function node, and can timely detect the node corresponding to the shared storage database in an abnormal state.
[0074] Step 208: In the case of completing the task migration, the target lease lock is allocated to the target node, and the target node is used to execute the to-be-executed data operation task based on the target lease lock.
[0075] Specifically, after selecting the target node in the node cluster associated with the shared storage database and migrating the to-be-executed data operation task of the abnormal node corresponding to the target lease lock to the target node, in the case of completing the task migration, the target lease lock is allocated to the target node, and the target node is used to execute the to-be-executed data operation task based on the target lease lock until the to-be-executed data operation task is completed.
[0076] Based on this, after selecting the target node in the node cluster associated with the shared storage database and migrating the to-be-executed data operation task of the abnormal node corresponding to the target lease lock to the target node, in the case of completing the task migration, the to-be-executed data operation task of the abnormal node can be completed by the target node, and the abnormal node can be offline. The target lease lock is allocated to the target node, so that the target node has the permission to read and write the data corresponding to the abnormal node. At this time, the target node is used to execute the to-be-executed data operation task based on the target lease lock until the to-be-executed data operation task is completed.
[0077] Further, considering that the master node in the shared storage database can choose to lease the lease lock, or can choose not to continue leasing the lease lock after the lease lock reaches the lease duration. In the case of the function node being a local read-only node, the function node needs to maintain the synchronization link, and the specific implementation is as follows: in the case of the function node being a local read-only node, a local maintenance node corresponding to the local read-only node is determined; the local read-only node reads the local lease lock metadata of the local maintenance node, and in the case that the local lease lock metadata meets the local data change condition, the local information synchronization link of the local maintenance node is updated.
[0078] Specifically, the function node is a local read-only node, indicating that the function node only performs node fault detection on a local maintenance node and maintains the local maintenance node. The local maintenance node is the maintenance object of the local read-only node. The local lease lock metadata is the data written in the metadata corresponding to the lease lock when the local maintenance node rents the lease lock. The local data change condition refers to whether the local lease lock metadata changes. If the first read local lease lock metadata is different from the second read local lease lock metadata, it indicates that the local lease lock metadata meets the local data change condition, and the lease lock rented by the local maintenance node is rented by other nodes.
[0079] Based on this, in the case that the function node is a local read-only node, the local maintenance node corresponding to the local read-only node is determined, and the local read-only node only performs node maintenance on the local maintenance node. The local lease lock metadata of the local maintenance node is read by the local read-only node. In the case that the local lease lock metadata meets the local data change condition, it indicates that the first read local lease lock metadata is different from the second read local lease lock metadata, the lease lock rented by the local maintenance node is rented by other nodes, and the local information synchronization link of the local maintenance node is updated.
[0080] In the above example, a local read-only node is set for the master node 1. The local read-only node periodically reads the metadata of the lease lock 1 rented by the master node 1. In the case that the metadata read twice is different, it is determined that the lease lock 1 is rented by other master nodes, and then the information synchronization link of the master node 1 is modified.
[0081] In summary, in the case that the function node is a local read-only node and the local lease lock metadata meets the local data change condition, the local information synchronization link of the local maintenance node is updated, the synchronization link of the local maintenance node is maintained, and data consistency is ensured.
[0082] Further, considering that the master node in the shared storage database can choose to rent a lease lock or can choose not to continue to rent the lease lock after the lease lock reaches the rental duration. In the case that the function node is a global read-only node, the function node needs to maintain the synchronization link, and the specific implementation is as follows: in the case that the function node is a global read-only node, at least one global maintenance node corresponding to the global read-only node is determined; the global lease lock metadata of the at least one global read-only node is traversed and read according to the node traversal order until the target global lease lock metadata meeting the global data change condition is obtained, and the target global information synchronization link of the target global maintenance node corresponding to the target global lease lock metadata is updated.
[0083] Specifically, the function node is a global read-only node, indicating that the function node can detect the global master node of the shared storage database. The global master node is at least one global maintenance node corresponding to the shared storage database. The at least one global maintenance node is the maintenance object of the function node. The node traversal order can be the arrangement order of each node in the at least one global maintenance node. The global lease lock metadata refers to the data written in the metadata corresponding to the lease lock when the at least one global read-only node rents the lease lock. The global data change condition refers to whether the global lease lock metadata changes. If the global lease lock metadata read for the first time is different from the global lease lock metadata read for the second time, it indicates that the global lease lock metadata satisfies the global data change condition, and at the same time, it also indicates that the lease lock rented by the global maintenance node is rented by other nodes.
[0084] Based on this, in the case that the function node is a global read-only node, at least one global maintenance node corresponding to the global read-only node is determined, and the global read-only node performs node maintenance on the at least one global maintenance node. The global lease lock metadata of the at least one global read-only node is traversed and read according to the node traversal order, and it is judged whether the read global lease metadata satisfies the global data change condition. If not, it indicates that the global lease metadata read for the first time is the same as the global lease metadata read for the second time, and the global lease lock metadata of the next global read-only node can be read; if yes, it indicates that the global lease metadata read for the first time is different from the global lease metadata read for the second time. At this time, the target global information synchronization link of the target global maintenance node corresponding to the target global lease lock metadata is updated.
[0085] In the above example, in the case that the shared storage database has two master nodes, global read-only nodes are set for master node 1 and master node 2. The global read-only nodes periodically and sequentially read the metadata of the lease lock 1 and the metadata of the lease lock 2 rented by the master node 1 and the master node 2. After reading the metadata of the lease lock 1, in the case that the metadata of the lease lock 1 read twice is different, it is determined that the lease lock 1 is rented by other master nodes, and then the information synchronization link of the master node 1 is modified; in the case that the metadata of the lease lock 1 read twice is the same, the metadata of the lease lock 2 is read, and in the case that the metadata of the lease lock 2 read twice is different, it is determined that the lease lock 2 is rented by other master nodes, and then the information synchronization link of the master node 2 is modified.
[0086] In summary, in the case that the function node is a global read-only node, the global lease lock metadata of at least one global read-only node is traversed to maintain the synchronization link of at least one global maintenance node, thereby ensuring data consistency.
[0087] Further, the function node can be a master local read-only node corresponding to a second master node of the shared storage database, used for performing abnormal processing on the second master node to realize high availability of the second master node, and the implementation is as follows: in the case where the function node is the master local read-only node corresponding to the second master node of the shared storage database, a polling time is determined, and the master local read-only node is used to poll a master lease lock corresponding to the second master node based on the polling time; in the case where it is determined based on a polling result that the master lease lock is in an overdue state, the master local read-only node is used to occupy the master lease lock, and a master synchronization link between the second master node and the master local read-only node is used to synchronize a master operation task corresponding to the second master node to the master local read-only node.
[0088] Specifically, the master local read-only node is a local read-only node set for the second master node, and only performs abnormal detection on the second master node. The second master node can be any one of the master nodes corresponding to the shared storage database. The polling time refers to a time interval for querying a lease lock rented by the second master node, and the polling result refers to a rental result of renting the lease lock rented by the second master node by using the master local read-only node. In the case where the master local read-only node rents the lease lock rented by the second master node and succeeds in the rental, it indicates that the lease lock rented by the second master node is in an overdue state, and the lease lock has not been rented by the second master node for a long time, and the second master node is in a fault state.
[0089] Based on this, in the case where the function node is the master local read-only node corresponding to the second master node of the shared storage database, the master local read-only node only performs abnormal detection on the second master node. A polling time is determined, and the master local read-only node is used to poll a master lease lock corresponding to the second master node based on the polling time, and attempt to rent the master lease lock corresponding to the second master node. In the case where it is determined based on a polling result that the master lease lock is in an overdue state, it indicates that the master lease lock is in an overdue state, and the master lease lock has not been rented by the second master node for a long time. At this time, the master local read-only node succeeds in renting the master lease lock. The master local read-only node occupies the master lease lock. A master synchronization link between the second master node and the master local read-only node is constructed, and a master operation task corresponding to the second master node is synchronized to the master local read-only node based on the master synchronization link between the second master node and the master local read-only node. The master local read-only node replaces the second master node and continues to perform data operations.
[0090] In the above example, in the case where the function node is a local read-only node set for the master node 1, the function node only performs detection on the master node 1, and in the case where it is detected that the master node 1 is abnormal, a synchronization link between the function node and the master node 1 is constructed, and the function node replaces the master node 1 to continue data reading and writing.
[0091] In summary, the function node can be a master local read-only node corresponding to a second master node of a shared storage database, used for abnormal processing of the second master node, and can realize high availability of the second master node.
[0092] In an embodiment of the present disclosure, by using the function node corresponding to the shared storage database to traverse the lease lock in the shared storage database, if the target lease lock in a holdable state is found, the function node can occupy the target lease lock. If the function node successfully occupies the target lease lock, it means that the master node corresponding to the target lease lock is an abnormal node, and the master node does not continuously renew the target lease lock, resulting in that the target lease lock is successfully preempted by the function node. At this time, a target node is selected from the node cluster associated with the shared storage database, and the to-be-executed data operation task of the abnormal node corresponding to the target lease lock is migrated to the target node. After the task migration is completed, the abnormal node can be offline, the target lease lock is allocated to the target node, the target node occupies the target lease lock, and the target node executes the to-be-executed data operation task based on the target lease lock. Thus, the smooth execution of the data operation task is ensured, and the termination of the data operation task due to the abnormal state of the abnormal node is avoided. By using the function node to traverse the lease lock in the shared storage database, the availability of the lease lock can be detected, and once the lease lock in the holdable state is detected, the abnormal processing process can be triggered, the complexity of the decision link can be reduced, the accuracy and timeliness of the abnormal processing can be improved, and the abnormal recovery time can be shortened.
[0093] The shared storage database management method provided by the present disclosure is further described below in combination with FIG. 3, taking the application of the shared storage database management method provided by the present disclosure in the case where multiple master nodes are each other's standby nodes as an example. FIG. 3 shows a node exception processing schematic diagram of a shared storage database management method according to an embodiment of the present disclosure. In the first application scenario, as shown in FIG. 3, the shared storage database provides multiple lease locks such as lease lock 1-lease lock Max (maximum lease lock), each lease lock has an independent lock holder (there is a case where a lease lock has no holder. The lease lock can be created in advance. If 128 lease locks are created by default, there are only two master nodes. In this case, the lease lock can have no holder), master node 1 holds lease lock 1, and master node 2 holds lease lock 2. In the case where master node 1 rents lease lock 1, the address information of master node 1 is updated to the metadata file corresponding to lease lock 1 as metadata 1. The lock holder has a storage write permission. The lease lock has a certain rental time. In the case where the lease lock expires, master node 1 can renew lease lock 1 in the try_lock mode (the renewal needs to be performed before the current lease expires. The renewal period is less than the lease period, otherwise the node corresponding to the lease lock can be mistakenly considered as malfunctioning due to the failure to renew in time). Correspondingly, master node 2 can also renew lease lock 2 in the try_lock mode. The main work of the coordination node is to detect the availability of master node 1-Max in the try_lock mode, temporarily take over the write point as a relay node, and migrate the write point to other master nodes.
[0094] When a certain master node is not serviceable, any other master node can take over the load of the write point. The coordination node is a stateless process, and has a low cost, only requiring a small amount of CPU and memory resources. The coordination node does not provide services to the outside, but only serves as a relay for the migration of the write point. In addition, in the decision process of migration, the coordination node can also detect the load of different master nodes, and realize a self-defined balancing strategy.
[0095] In actual application, each master node corresponds to a lease lock, and the master node creates a background thread to perform try_lock renewal for the lease lock periodically. Normally, the holder of all lease locks is always the respective master node. The coordination node also has a background thread to periodically poll each lease lock and perform try_lock operation for each lease lock. Since all master nodes renew normally, the try_lock of the coordination node will fail. When master node 1 fails, such as host downtime, and the duration of unavailability exceeds the predefined lease time (1-5 seconds), lease lock 1 will be in an overdue state. At this time, when the coordination node polls lease lock 1, it will be successfully locked, representing that master node 1 failure is detected. At this time, the write point migration work can be initiated, and during the migration process, the coordination node also continuously renews. After the current migration task is completed, the coordination node stops renewal and returns to the detection state to continue detecting other lease locks except lease lock 1.
[0096] In addition, for lease lock 1, the coordination node can periodically read metadata 1. When it is found that metadata 1 is updated (indicating that master node 1 failure is recovered), the write point migration back operation is automatically initiated, and the previous migration behavior is rolled back to restore the cluster to the initial state. When metadata 1 is not updated for a long time, it is determined that the write point instance is offline, and when the write point is restarted subsequently, the coordination node can be prompted to start detecting lease lock 1 again by sending an online notification message. It should be noted that since no standby node is set, if a master node fails, the total resources of the cluster will be less. Therefore, the write point migration back operation is required in the first application scenario. If a standby node, global read-only node, or other redundant resources are set, the write point migration back operation is not required.
[0097] The second application scenario is that the local read-only node and the global read-only node can maintain the information synchronization link for the master node. As shown in FIG. 4, the shared storage database provides multiple lease locks such as lease lock 1 to lease lock Max. The local read-only node is connected to master node 1, and the global read-only node is connected to master node 1 and master node 2. The local read-only node can create a background thread to periodically read the information in metadata 1, and when the address in metadata 1 changes, the information synchronization link is automatically modified. For the global read-only node, a background thread can be created to periodically read the metadata information of master node 1 and master node 2, and when the address of a certain metadata changes, the information synchronization link of this part is automatically modified.
[0098] The third application scenario is to realize "one backup for multiple" by means of an independent backup node or a global read-only node. That is, a single backup node is used as a disaster backup for multiple master nodes. The backup node uses the same CPU and memory resources as the master nodes and is idle most of the time. When a master node fails, the resources of the backup node can directly bear the load of the original master node. As shown in FIG. 5, the shared storage database provides multiple lease locks such as lease lock 1-lease lock Max. Master node 1 holds lease lock 1, and master node 2 holds lease lock 2. Master node 1 can renew lease lock 1 by means of try_lock, and correspondingly, master node 2 can renew lease lock 2 by means of try_lock. The backup node or the global read-only node periodically polls each lease lock and performs a try_lock operation on each lease lock. The backup node or the global read-only node has a respective synchronization link with master node 1 and master node 2.
[0099] The backup node and the coordination node have similar functions. Taking the backup node as an example, the backup node creates a background thread that periodically polls 1-Max each lease lock and performs a try_lock operation on each lease lock. Since all master nodes are normally renewed, the try_lock of the backup node will fail. When master node 1 fails and the duration of being out of service exceeds the predefined lease time, lease lock 1 will be overdue. When the backup node polls lease lock 1, it will be successfully locked, indicating that master node 1 has failed. After successfully trying to lock lease lock 1, the backup node is upgraded to the new master node 1 and provides services to the outside. After such a round of high-availability switching, the number of master nodes in the entire cluster remains unchanged, and one backup node is missing. After that, an operation and maintenance personnel or a management platform can add a new backup node. Meanwhile, the "N backup M" function is also supported, where N < M, N is the number of master nodes, and M is the number of backup nodes or global read-only nodes. Up to N master nodes can be simultaneously out of service, but more resources need to be reserved. In addition, the backup node also serves as a global read-only node. While performing try_lock on each lease lock, the backup node reads all lease lock metadata information and maintains a synchronization link. Most of the time, only non-critical read-only tasks are served externally. When high-availability switching is triggered, these non-critical read-only tasks are downgraded, and resources are left for the load of the original master node. In this scenario, resources can be fully utilized, and when a fault occurs, the quality of service of critical tasks can be guaranteed first.
[0100] The fourth application scenario is to realize high availability of a single master node by means of a local read-only node. A local read-only node can be added to a certain master node. This requirement is generally for multi-tenant scenarios, such as a tenant serving important customers or critical tasks, and the tenant does not want to share resources with other nodes. Therefore, a master node is created for such requests, and the read-only service is also not shared globally, but uses independent resources, that is, a local read-only node. As shown in FIG. 6, the shared storage database provides multiple lease locks such as lease lock 1 to lease lock Max. Master node 1 holds lease lock 1, and master node 2 holds lease lock 2. Master node 1 can renew lease lock 1 by try_lock, and correspondingly, master node 2 can renew lease lock 2 by try_lock. A local read-only node is added to master node 1, and a synchronization link is established between the local read-only node and master node 1. The local read-only node periodically detects lease lock 1 by try_lock, that is, periodically polls lease lock 1 and performs a try_lock operation. When master node 1 fails and the duration of the unavailability exceeds the predefined lease time, lease lock 1 is in an overdue state. The local read-only node succeeds in locking, which represents that the failure of master node 1 is detected, and the local read-only node is upgraded to a new master node 1 to provide services to the outside. After such a round of high-availability switching, the number of master nodes in the entire cluster remains unchanged, and one local read-only node is reduced. Then, an operation personnel or a management platform can add a new local read-only node to master node 1.
[0101] In this embodiment, the detection, triggering, and execution of the high-availability logic are directly integrated in the database system, the decision link is simple, the dependence is small, the accuracy and efficiency are higher, and higher RTO can be provided for data. The independent management of permissions is realized by using multiple lease locks, and the multi-master architecture database supporting the function of multi-point writing is suitable. For the multi-master architecture shared storage database, based on the lease lock interface and the metadata file, a high-availability scheme of different node types is described, including a coordination node, a backup node, a local read-only node, and a global read-only node.
[0102] Corresponding to the method embodiments described above, the present disclosure also provides shared storage database management system embodiments. FIG. 7 shows a structural schematic diagram of a shared storage database management system according to an embodiment of the present disclosure. As shown in FIG. 7, the shared storage database management system 700 includes a functional node 710, a target node 720, and a shared storage node 730. The functional node 710 is configured to traverse the at least one lease lock contained in the shared storage node 730. In a case where a target lease lock in a holdable state is traversed, the target lease lock is occupied, a to-be-executed data operation task of an abnormal node corresponding to the target lease lock is migrated to the target node 720, and in a case where the task migration is completed, the target lease lock is allocated to the target node 720. The target node 720 is configured to execute the to-be-executed data operation task based on the target lease lock.
[0103] In actual applications, the shared storage database includes a functional node and a shared storage node, the shared storage node includes a plurality of lease locks, the plurality of lease locks correspond to different slots, and each slot corresponds to a write node of a database. The write node can be a master node of the shared storage database. The shared storage database management system includes a functional node, a target node, and a shared storage node. The shared storage node contains at least one lease lock. The functional node traverses the at least one lease lock contained in the shared storage node. In a case where a target lease lock in a holdable state is traversed, the target lease lock is occupied, a to-be-executed data operation task of an abnormal node corresponding to the target lease lock is migrated to the target node, and in a case where the task migration is completed, the target lease lock is allocated to the target node. The target node executes the to-be-executed data operation task based on the target lease lock. The functional node in the shared storage database management system traverses the lease lock in the shared storage database. In a case where a target lease lock in a holdable state is traversed, the functional node occupies the target lease lock. The successful occupation of the target lease lock by the functional node indicates that the master node corresponding to the target lease lock is an abnormal node. The master node does not continuously renew the target lease lock, resulting in successful preemption of the target lease lock by the functional node. At this time, a target node is selected from a node cluster associated with the shared storage database, and a to-be-executed data operation task of an abnormal node corresponding to the target lease lock is migrated to the target node.
[0104] In the case that the task migration is completed, the abnormal node can be offline, the target lease lock is allocated to the target node, and the target node occupies the target lease lock. The target node executes the to-be-executed data operation task based on the target lease lock. Thus, the smooth execution of the data operation task is ensured, and the termination of the data operation task caused by the abnormal state of the abnormal node is avoided. The functional node can traverse the lease locks in the shared storage database, can detect the availability of the lease locks, and can trigger the abnormal processing procedure as soon as a lease lock in the holdable state is detected. In this way, the complexity of the decision link is reduced, the accuracy and timeliness of the abnormal processing are improved, and the abnormal recovery time is shortened.
[0105] The above is a schematic scheme of the shared storage database management system of the embodiment. It should be noted that the technical scheme of the shared storage database management system and the technical scheme of the shared storage database management method described above belong to the same concept. The details of the technical scheme of the shared storage database management system that are not described in detail can be referred to the description of the technical scheme of the shared storage database management method.
[0106] Corresponding to the method embodiment, the disclosure also provides a shared storage database management device embodiment. FIG. 8 shows a structural schematic diagram of a shared storage database management device according to an embodiment of the disclosure. As shown in FIG. 8, the device comprises: a traversal module 802 configured to traverse the lease locks in the shared storage database by using the functional node corresponding to the shared storage database; an occupation module 804 configured to occupy the target lease lock by using the functional node in the case that the target lease lock in the holdable state is traversed; a migration module 806 configured to select a target node in the node cluster associated with the shared storage database, and migrate the to-be-executed data operation task of the abnormal node corresponding to the target lease lock to the target node; and an execution module 808 configured to allocate the target lease lock to the target node in the case that the task migration is completed, and execute the to-be-executed data operation task based on the target lease lock by using the target node.
[0107] In an optional embodiment, the traversal module 802 is further configured to: in the case that the functional node is a local read-only node, determine a local maintenance node corresponding to the local read-only node; read the local lease lock metadata of the local maintenance node by using the local read-only node, and update the local information synchronization link of the local maintenance node in the case that the local lease lock metadata meets the local data change condition.
[0108] In an optional embodiment, the traversal module 802 is further configured to, in the case that the function node is a global read-only node, determine at least one global maintenance node corresponding to the global read-only node; traverse and read global lease lock metadata of the at least one global read-only node according to a node traversal order until target global lease lock metadata meeting a global data change condition is obtained, and update a target global information synchronization link of a target global maintenance node corresponding to the target global lease lock metadata.
[0109] In an optional embodiment, the traversal module 802 is further configured to create a background thread by using a function node corresponding to a shared storage database; and traverse lease locks in the shared storage database based on a lease lock traversal order by using the background thread.
[0110] In an optional embodiment, the occupancy module 804 is further configured to determine n lease locks in the shared storage database; determine an i-th lease lock in the lease locks, where i is an integer starting from 1 and increasing by 1; in the case that the i-th lease lock is in an un-serviceable state, determine an un-serviceable duration of the i-th lease lock; determine whether the un-serviceable duration of the i-th lease lock is greater than a duration threshold; if not, increase i by 1 and perform the step of determining an i-th lease lock in the lease locks; if yes, determine that the i-th lease lock is in a serviceable state, and take the i-th lease lock as the target lease lock.
[0111] In an optional embodiment, the migration module 806 is further configured to select a first master node associated with the abnormal node from a node cluster associated with the shared storage database, and take the first master node as the target node.
[0112] In an optional embodiment, the migration module 806 is further configured to take the function node as the target node; after the step of migrating the to-be-executed data operation task of the abnormal node corresponding to the target lease lock to the target node, the method further includes: in the case that the task migration is completed, executing the to-be-executed data operation task based on the target lease lock by using the target node.
[0113] In an optional embodiment, the traversal module 802 is further configured to construct a backup function node for the shared storage database, and take the backup function node as the function node to perform the step of traversing the lease locks in the shared storage database by using a function node corresponding to the shared storage database.
[0114] In an optional embodiment, the traversal module 802 is further configured to, in the case that the functional node is a master local read-only node corresponding to a second master node of the shared storage database, determine a polling time, and poll a master lease lock corresponding to the second master node based on the polling time by using the master local read-only node; in the case that it is determined based on a polling result that the master lease lock is in an overdue state, occupy the master lease lock by using the master local read-only node, and synchronize a master operation task corresponding to the second master node to the master local read-only node based on a master synchronization link between the second master node and the master local read-only node.
[0115] In an embodiment of the present disclosure, by using the functional node to traverse the lease locks in the shared storage database, in the case that a target lease lock in a holdable state is traversed, the target lease lock can be occupied by the functional node. The successful occupation of the target lease lock by the functional node indicates that the master node corresponding to the target lease lock is an abnormal node, which does not continuously renew the target lease lock, resulting in the successful preemption of the target lease lock by the functional node. At this time, a target node is selected from the node cluster associated with the shared storage database, and a to-be-executed data operation task of the abnormal node corresponding to the target lease lock is migrated to the target node. In the case that the task migration is completed, the abnormal node can be offline, the target lease lock is allocated to the target node, the target lease lock is occupied by the target node, and the to-be-executed data operation task based on the target lease lock is executed by the target node. Thus, the smooth execution of the data operation task is ensured, and the termination of the data operation task due to the abnormal state of the abnormal node is avoided. By using the functional node to traverse the lease locks in the shared storage database, the availability of the lease locks can be detected, the abnormal processing flow can be triggered once a lease lock in a holdable state is detected, the complexity of the decision link can be reduced, the accuracy and timeliness of the abnormal processing can be improved, and the abnormal recovery time can be shortened.
[0116] The above is a schematic scheme of a shared storage database management apparatus in the embodiment. It should be noted that the technical scheme of the shared storage database management apparatus and the technical scheme of the shared storage database management method described above belong to the same concept, and the details of the technical scheme of the shared storage database management apparatus that are not described in detail can be referred to the description of the technical scheme of the shared storage database management method.
[0117] FIG. 9 shows a structural block diagram of a computing device 900 according to an embodiment of the present disclosure. The components of the computing device 900 include but are not limited to a memory 910 and a processor 920. The processor 920 is connected with the memory 910 through a bus 930, and a database 950 is used to save data.
[0118] The computing device 900 also includes an access device 940 that enables the computing device 900 to communicate via one or more networks 960. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or combinations of such networks, such as the Internet. The access device 940 can include one or more of any type of network interface (for example, a network interface card (NIC)) such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC).
[0119] In one embodiment of the present disclosure, the above-mentioned components of the computing device 900 and other components not shown in FIG. 9 can also be connected to each other, for example, through a bus. It should be understood that the computing device structure block diagram shown in FIG. 9 is only for the purpose of example, and is not a limitation on the scope of the present disclosure. Those skilled in the art can add or replace other components as needed.
[0120] The computing device 900 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (for example, a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (for example, a smartphone), a wearable computing device (for example, a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 900 can also be a mobile or stationary server.
[0121] The processor 920 is configured to execute computer-executable instructions, which, when executed by the processor, implement the steps of the shared storage database management method described above.
[0122] The above is a schematic scheme of the computing device of the embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the shared storage database management method described above belong to the same concept, and the details of the technical scheme of the computing device that are not described in detail can be referred to the description of the technical scheme of the shared storage database management method.
[0123] An embodiment of the present disclosure further provides a computer readable storage medium, which stores computer executable instructions, and the computer executable instructions realize the steps of the shared storage database management method when executed by a processor.
[0124] The above is a schematic scheme of the computer readable storage medium of the embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the shared storage database management method described above belong to the same concept, and the details of the technical scheme of the storage medium that are not described in detail can be referred to the description of the technical scheme of the shared storage database management method.
[0125] An embodiment of the present disclosure further provides a computer program product, which comprises a computer program or instructions, and the computer program or instructions realize the steps of the shared storage database management method when executed by a processor.
[0126] The above is a schematic scheme of the computer program product of the embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the shared storage database management method described above belong to the same concept, and the details of the technical scheme of the computer program product that are not described in detail can be referred to the description of the technical scheme of the shared storage database management method.
[0127] The above describes specific embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the acts or steps recited in the claims can be performed in a different order than the order described in the embodiments and still achieve the desired results. Also, the processes depicted in the figures do not necessarily require the particular order shown or sequential order in order to achieve the desired results. In some implementations, multitasking and parallel processing can be advantageous.
[0128] The computer readable medium can include any entity or apparatus capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable medium can include appropriate additions or subtractions according to the requirements of patent practice. For example, according to the patent practice in some regions, the computer readable medium does not include electrical carrier signals and telecommunication signals.
[0129] It should be noted that, for the foregoing method embodiments, in order to facilitate description, they are all described as a combination of a series of actions, but those skilled in the art should know that the disclosed embodiments are not limited to the order of the actions described, because according to the disclosed embodiments, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the disclosed embodiments.
[0130] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0131] The preferred embodiments of the disclosure disclosed above are only used to help explain the disclosure. The alternative embodiments do not describe all the details and do not limit the invention to the specific embodiments described. Obviously, according to the content of the disclosed embodiments, many modifications and changes can be made. The disclosure selects and describes these embodiments in order to better explain the principles and practical applications of the disclosed embodiments, so that those skilled in the art can well understand and utilize the disclosure. The disclosure is limited only by the claims and their full scope and equivalents.
Claims
1. A shared storage database management method, comprising: traversing, by a function node corresponding to a shared storage database, a lease lock in the shared storage database; in a case where a target lease lock in a holdable state is traversed, occupying the target lease lock by the function node; selecting a target node in a node cluster associated with the shared storage database, and migrating a to-be-executed data operation task of an abnormal node corresponding to the target lease lock to the target node; in a case where the task migration is completed, assigning the target lease lock to the target node, and executing the to-be-executed data operation task based on the target lease lock by the target node. 2.The shared storage database management method of claim 1, further comprising: in a case where the function node is a local read-only node, determining a local maintenance node corresponding to the local read-only node; reading, by the local read-only node, local lease lock metadata of the local maintenance node, and in a case where the local lease lock metadata satisfies a local data change condition, updating a local information synchronization link of the local maintenance node. 3.The shared storage database management method of claim 1, further comprising: in a case where the function node is a global read-only node, determining at least one global maintenance node corresponding to the global read-only node; traversing and reading global lease lock metadata of the at least one global read-only node according to a node traversal order, until target global lease lock metadata satisfying a global data change condition is obtained, and updating a target global information synchronization link of a target global maintenance node corresponding to the target global lease lock metadata. 4.The shared storage database management method of claim 1, wherein the traversing, by a function node corresponding to a shared storage database, a lease lock in the shared storage database comprises: creating, by the function node corresponding to the shared storage database, a background thread; traversing, by the background thread, the lease lock in the shared storage database based on a lease lock traversal order. 5.The shared storage database management method of claim 1, wherein the determining a target lease lock in a holdable state comprises: determining n lease locks in the shared storage database; determining an i-th lease lock in the lease locks, wherein i is an integer starting from 1 and increasing by 1; in a case where the i-th lease lock is in an un-serviceable state, determining an un-serviceable duration of the i-th lease lock; judging whether the un-serviceable duration of the i-th lease lock is greater than a duration threshold; if not, increasing i by 1, and performing the determining an i-th lease lock in the lease locks; if yes, determining the i-th lease lock as the target lease lock. 6.The shared storage database management method of claim 1, wherein in a case where the function node is a coordination node, the selecting a target node in a node cluster associated with the shared storage database comprises: select a first master node associated with the abnormal node from a node cluster associated with the shared storage database, and set the first master node as the target node.
7. The shared storage database management method of claim 1, wherein in a case where the functional node is a standby node, the selecting a target node from a node cluster associated with the shared storage database comprises: setting the functional node as the target node; after the migrating the to-be-executed data operation task of the abnormal node corresponding to the target lease lock to the target node, the method further comprises: in a case where the task migration is completed, executing the to-be-executed data operation task based on the target lease lock by using the target node.
8. The shared storage database management method of claim 7, wherein after the executing the to-be-executed data operation task based on the target lease lock by using the target node in the case where the task migration is completed, the method further comprises: constructing a standby functional node for the shared storage database, and setting the standby functional node as the functional node to perform the step of traversing the lease locks in the shared storage database by using the functional node corresponding to the shared storage database.
9. The shared storage database management method of claim 1, wherein the method further comprises: in a case where the functional node is a master local read-only node corresponding to a second master node of the shared storage database, determining a polling time, and polling a master lease lock corresponding to the second master node based on the polling time by using the master local read-only node; in a case where it is determined based on a polling result that the master lease lock is in an overdue state, occupying the master lease lock by using the master local read-only node, and synchronizing a master operation task corresponding to the second master node to the master local read-only node based on a master synchronization link between the second master node and the master local read-only node.
10. A shared storage database management system, comprising a functional node, a target node, and a shared storage node, wherein the shared storage node contains at least one lease lock; the functional node is configured to traverse the at least one lease lock contained in the shared storage node, in a case where a target lease lock in a holdable state is traversed, occupy the target lease lock, migrate a to-be-executed data operation task of an abnormal node corresponding to the target lease lock to the target node, and in a case where the task migration is completed, allocate the target lease lock to the target node; the target node is configured to execute the to-be-executed data operation task based on the target lease lock.
11. A shared storage database management apparatus, comprising: a traversal module configured to traverse lease locks in a shared storage database by using a functional node corresponding to the shared storage database; an occupying module configured to, in a case where a target lease lock in a holdable state is traversed, occupy the target lease lock by using the functional node; a migration module configured to select a target node from a node cluster associated with the shared storage database, and migrate a to-be-executed data operation task of an abnormal node corresponding to the target lease lock to the target node. An execution module configured to, in the event of completion of the task migration, allocate the target lease lock to the target node and perform the data operation task to be performed by the target node based on the target lease lock.
12. A computing device comprising: a memory and a processor; the memory is configured to store a computer program or instructions, and the processor is configured to execute the computer program or instructions, and the computer program or instructions, when executed by the processor, implement the steps of the shared storage database management method according to any one of claims 1-9.
13. A computer readable storage medium storing a computer program or instructions, and the computer program or instructions, when executed by a processor, implement the steps of the shared storage database management method according to any one of claims 1-9.
14. A computer program product comprising a computer program or instructions, and the computer program or instructions, when executed by a processor, implement the steps of the shared storage database management method according to any one of claims 1-9.
Citation Information
Patent Citations
Hybrid locking using network and on-disk based schemes
CN101800763A
High availability method and device based on multi-master DNS architecture
CN111669452A
Write-write conflict detection for multi-master shared storage database
CN113168371A
Database disaster recovery method, device and system and storage medium
CN116107814A
Shared locking mechanism for storage centric leases
US20140068127A1