A blocking method, device, apparatus and storage medium

By restricting transaction locking operations in database fault handling, locking is only allowed if it was executed by an active node before the fault and the schema is compatible. This solves the problem of reconstruction failure caused by inconsistent object states in database fault handling, and achieves the integrity of database objects and the elimination of conflicting locking.

CN115757452BActive Publication Date: 2025-12-23SHANGHAI DAMENG DATABASE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211486415.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-24
Publication Date
2025-12-23
Estimated Expiration
2042-11-24

AI Technical Summary

Technical Problem

During database fault handling, after the active node transaction reawakens the database service, some database objects are in an inconsistent state, causing the reconstruction of the faulty node transaction and the locking to fail.

Method used

During fault handling, the active node obtains the lock mode and the identification information of the target database object carried by the locking instruction, queries the target mapping table to obtain the first lock mode set, and generates the second lock mode set according to the compatible lock mode. The transaction is allowed to execute the lock only if it has been locked by the active node before the fault occurred and the mode is compatible.

Benefits of technology

It ensures the integrity of database objects accessed during fault handling, prevents conflicting locks after data recovery, and ensures successful reconstruction of transactions and locks at the faulty node.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115757452B_ABST
    Figure CN115757452B_ABST
Patent Text Reader

Abstract

The application discloses a kind of blocking method, device, equipment and storage medium.The method comprises: when receiving the blocking instruction for target database object, active node obtains the first lock mode carried by the blocking instruction and the identification information of the target database object;The active node obtains first lock mode set according to the identification information of the target database object inquiring target mapping table;The active node generates second lock mode set according to the compatible lock mode of each lock mode in the first lock mode set;If the second lock mode set includes the first lock mode, the active node executes the blocking instruction for target database object, by the technical scheme of the application, it can be guaranteed that the total database object of transaction access is always complete during fault handling process, and there is no blocking conflict with active transaction of fault node after data recovery is completed, to ensure that fault node transaction and blocking can be successfully reconstructed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of computer technology, and particularly relate to a blocking method and device, equipment and storage medium. BACKGROUND

[0002] During database operation, concurrent access of database resources by transactions is controlled through blocking to ensure the integrity and consistency of database objects (tables, indexes, files, table spaces, etc.) during transaction execution. A lock object is composed of a lock ID and a lock mode, and each lock object can be uniquely represented by a lock ID. Each lock ID corresponds to a database object (such as a table space, a table, etc., which can be blocked), and the lock mode can be divided into a shared (Share) lock (S lock), an exclusive (Exclusive) lock (X lock), an intensive share (Intensive Share) lock (IS lock), and an intensive exclusive (Intensive Exclusive) lock (IX lock). To improve database performance and reduce unnecessary transaction waiting, blocking is performed on database objects at different levels during transaction execution. For example, when updating a row of data in a table, an IS lock is performed on the table object, and an X lock is performed on the row of data to avoid deletion of the table object (an X lock is performed on the table object during deletion) or update of the row of data by other transactions during the update operation.

[0003] When a node failure occurs in a database cluster, a failure processing procedure is started, and the main steps include data recovery (i.e., log replay), reconstruction of active node (i.e., a node that has not failed) transaction and lock information, reconstruction of failure node transaction and lock information, and rollback of active transactions of the failure node (i.e., undoing uncommitted modifications), so as to restore the data, transactions, locks, etc. of the database cluster to the state before the failure. The active node still holds transactions and locks, but the running information of the transactions of the failure node has been lost, and the transactions and locks of the failure node can only be reconstructed after the data recovery is completed.

[0004] The inventor found that during database failure processing, after the active node transactions reactivated the database service, some database objects were in an inconsistent state (i.e., the current state of the database object was inconsistent with the state before the database failure), which caused the problem of failure in reconstructing the transactions and locks of the failure node. SUMMARY

[0005] Embodiments of the present application provide a locking method, device, equipment and storage medium, to solve the problem that in the database fault processing process, after the active node transaction re-wakes up the database service, part of the database objects are in inconsistent state, leading to the failure of reconstructing the fault node transaction and locking. The locking performed by the transaction in the fault processing process is limited, only when the object which is only executed by the active node before the fault occurs and the locking mode is compatible with the lock held by the fault node, the transaction is allowed to execute the locking. Then it is ensured that the transaction always accesses the complete database object in the fault processing process, and there is no locking conflict with the active transaction of the fault node after the data recovery is completed, ensuring that the fault node transaction and locking can be successfully reconstructed.

[0006] According to an aspect of the present application, a locking method is provided, comprising:

[0007] When receiving a locking instruction for a target database object, the active node acquires the first lock mode carried by the locking instruction and the identification information of the target database object;

[0008] The active node queries a target mapping table according to the identification information of the target database object to obtain a first lock mode set;

[0009] The active node generates a second lock mode set according to the compatible lock mode corresponding to each lock mode in the first lock mode set;

[0010] If the second lock mode set includes the first lock mode, the active node executes the locking instruction for the target database object.

[0011] According to another aspect of the present application, a locking device is provided, which is configured in an active node, and the locking device comprises:

[0012] The acquisition module is configured to acquire the first lock mode carried by the locking instruction and the identification information of the target database object when receiving the locking instruction for the target database object;

[0013] The query module is configured to query a target mapping table according to the identification information of the target database object to obtain a first lock mode set;

[0014] The generation module is configured to generate a second lock mode set according to the compatible lock mode corresponding to each lock mode in the first lock mode set;

[0015] The execution module is configured to execute the locking instruction for the target database object if the second lock mode set includes the first lock mode.

[0016] According to another aspect of the present application, an electronic device is provided, which comprises:

[0017] at least one processor; and

[0018] a memory communicatively connected with the at least one processor; wherein

[0019] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the blocking method according to any one of the embodiments of the present application.

[0020] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to implement the blocking method according to any one of the embodiments of the present application when executed.

[0021] The embodiments of the present application solve the problem that, in the database fault processing process, after the active node transaction re-wakes up the database service, part of the database objects are in an inconsistent state, resulting in the failure of reconstructing the fault node transaction and blocking, by acquiring, when a blocking instruction for a target database object is received, a first lock mode carried by the blocking instruction and identification information of the target database object; querying, by the active node, a target mapping table according to the identification information of the target database object to obtain a first lock mode set; generating, by the active node, a second lock mode set according to the compatible lock mode corresponding to each lock mode in the first lock mode set; and executing, by the active node, the blocking instruction for the target database object if the second lock mode set includes the first lock mode. The embodiments of the present application limit the blocking performed by the transaction in the fault processing process, and only allow the transaction to execute the blocking if the object is only executed by the active node before the fault occurs and the blocking mode is compatible with the lock held by the fault node. Thus, it is ensured that the transaction always accesses a complete database object in the fault processing process, and there is no blocking conflicting with the active transaction of the fault node after the data recovery is completed, so as to ensure that the fault node transaction and blocking can be successfully reconstructed.

[0022] It should be understood that the content described in this section is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be considered as limiting the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0024] Figure 1 is a flow chart of a blocking method in an embodiment of the present application;

[0025] Figure 2 is a structural schematic diagram of a blocking device in an embodiment of the present application;

[0026] Figure 3 is a structural schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the personnel in the technical field better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by the personnel in the field without creative labor should belong to the protection scope of the present application.

[0028] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0029] Embodiment one

[0030] The blocking method provided by the embodiments of the present application is executed by a blocking system, and the blocking system comprises a plurality of server nodes, one of the plurality of server nodes is a control node, and the control node is used to control other nodes. The server nodes are divided according to running states, including fault nodes and active nodes. It should be noted that if the fault node is the control node, a new control node needs to be selected from other active nodes, and if the fault node is not the control node, the control node remains unchanged.

[0031] Figure 1 The flow chart of the blocking method provided by the embodiments of the present application, the present embodiment can be applicable to the blocking situation, and the method can be executed by the blocking device in the embodiments of the present application. The device can be realized in the form of software and / or hardware, such as Figure 1As shown, the method specifically comprises the following steps:

[0032] S110, when receiving the blocking instruction for the target database object, the active node acquires the first lock mode carried by the blocking instruction and the identification information of the target database object.

[0033] The first lock mode can be any one of a shared lock, an exclusive lock, an intention shared lock and an intention exclusive lock.

[0034] The identification information of the target database object can be a lock ID corresponding to a transaction blocking database object; the identification information of the target database object can also be an ID of a database object, which is not limited by the embodiment of the application.

[0035] It should be noted that when receiving the blocking instruction for the target database object, the active node acquires the first lock mode carried by the blocking instruction and the identification information of the target database object. This occurs in the process of detecting the fault node and processing the fault.

[0036] S120, the active node queries a target mapping table according to the identification information of the target database object to obtain a first lock mode set.

[0037] The target mapping table can be generated in the following manner: when detecting the fault node, a control node acquires blocking information of an active node; the control node constructs a target mapping table about lock identification and lock mode according to the blocking information of the active node; the control node sends the target mapping table to the active node, and the active node receives the target mapping table sent by the control node.

[0038] The target mapping table can include lock identification information and a lock mode corresponding to the lock identification, and each lock identification corresponds to at least one lock mode; the target mapping table can also include database object identification information and a lock mode corresponding to the database object identification, and each database object identification information corresponds to at least one lock mode. For example, the target mapping table can include a lock mode corresponding to a first lock ID, which includes a shared lock and an exclusive lock, and a lock mode corresponding to a second lock ID, which includes a shared lock and an intention exclusive lock. Or the target mapping table can include a lock mode corresponding to identification information of a database object A, which includes a shared lock and an exclusive lock, and a lock mode corresponding to identification information of a database object B, which includes a shared lock and an intention exclusive lock.

[0039] Specifically, the active node can query the target mapping table according to the identification information of the target database object to obtain the first lock mode set. If the identification information of the target database object is the identification information of the database object A, the active node can query the target mapping table according to the identification information of the database object A to obtain the shared lock and the exclusive lock, that is, the first lock mode set includes the shared lock and the exclusive lock.

[0040] In S130, the active node generates a second lock mode set according to the compatible lock mode corresponding to each lock mode in the first lock mode set.

[0041] The compatible lock mode corresponding to each lock mode in the first lock mode set can be obtained by querying the compatibility table. The compatibility table can be as shown in Table 1.

[0042] Table 1

[0043] Lock mode IS IX S X IS Y Y Y N IX Y Y N N S Y N Y N X N N N N

[0044] As shown in Table 1, the IS lock and the IS lock are compatible, the IX lock and the IS lock are compatible, the S lock and the IS lock are compatible, and the X lock and the IS lock are incompatible; the IX lock and the IX lock are compatible, the S lock and the IX lock are incompatible, the X lock and the IX lock are incompatible; the S lock and the S lock are compatible, the X lock and the S lock are incompatible; and the X lock and the X lock are incompatible.

[0045] The second lock mode set can be generated in the following manner: obtaining the lock mode that can be held by the fault node corresponding to each lock mode in the first lock mode set, and generating the second lock mode set according to the compatible lock mode of the lock mode that can be held by the fault node. For example, if the first lock mode set includes a first lock mode and a second lock mode, at least one lock mode that can be held by the fault node corresponding to the first lock mode is obtained. If the number of the lock mode that can be held by the fault node corresponding to the first lock mode is one, the compatible lock mode of the lock mode that can be held by the fault node corresponding to the first lock mode is obtained. If the number of the lock mode that can be held by the fault node corresponding to the first lock mode is greater than or equal to two, the intersection of the compatible lock mode of the lock mode that can be held by the fault node corresponding to the first lock mode is obtained. Similarly, at least one lock mode that can be held by the fault node corresponding to the second lock mode is obtained, the compatible lock mode of the lock mode that can be held by the fault node corresponding to the second lock mode is obtained, and the union of the compatible lock mode of the lock mode that can be held by the fault node corresponding to the first lock mode and the compatible lock mode of the lock mode that can be held by the fault node corresponding to the second lock mode is used to generate the second lock mode set.

[0046] Specifically, the way of generating the second lock mode set according to the compatible lock mode corresponding to each lock mode in the first lock mode set can be: determining the lock mode possibly held by the faulty node according to each lock mode in the first lock mode set, obtaining the compatible lock mode corresponding to the lock mode possibly held by the faulty node, and generating the second lock mode set according to the union set of the compatible lock modes determined according to each lock mode in the first lock mode set. For example, if the first lock mode set includes an X lock and an S lock, since the first lock mode set includes the X lock, it is determined that the faulty node cannot hold any type of lock mode, and the compatible lock mode corresponding to the X lock is the S lock, the X lock, the IX lock, and the IS lock. Since the first lock mode set includes the S lock, it is determined that the faulty node cannot hold the IX lock and the X lock, and the faulty node can hold the S lock or the IS lock. The lock modes compatible with the S lock, i.e., the S lock and the IS lock, and the lock modes compatible with the IS lock, i.e., the S lock, the IS lock, and the IX lock, are obtained. The intersection of the lock modes compatible with the S lock and the lock modes compatible with the IS lock is the S lock and the IS lock. The S lock and the IS lock are determined as the compatible lock mode corresponding to the S lock. Therefore, the second lock mode set includes the S lock, the X lock, the IX lock, and the IS lock.

[0047] In a specific example, if the lock ID corresponding to the database object that the current transaction wants to lock is not in the target mapping table, it is considered that the object is incomplete, and locking is not allowed to be performed, and the thread is blocked until the fault processing is completed. If the lock ID corresponding to the database object that the current transaction wants to lock is in the target mapping table, it is further judged whether the lock mode corresponding to the lock ID in the target mapping table:

[0048] 1) It is judged whether the lock mode includes an X lock. If yes, the faulty node cannot hold any type of lock, and any type of lock is allowed to be performed;

[0049] 2) It is judged whether the lock mode includes an S lock. If yes, the faulty node cannot hold the IX lock and the X lock, and the faulty node can hold the S lock or the IS lock. The active node is allowed to apply a lock mode compatible with the lock possibly held by the faulty node, i.e., the S lock or the IS lock is allowed to be applied;

[0050] 3) It is judged whether the lock mode includes an IX lock. If yes, the IX lock or the IS lock is allowed to be applied;

[0051] 4) It is judged whether the lock mode includes an IS lock. If yes, the IS lock is allowed to be applied.

[0052] If the lock mode corresponding to the lock ID in the target mapping table includes two or more, the union set of the above conclusions is taken as the final lock mode allowed to be applied.

[0053] If the current transaction is allowed to perform the corresponding lock after the above judgment, the lock is directly performed, otherwise the thread is blocked until the fault processing is completed.

[0054] After the fault handling is completed, the blocked thread is woken up and no longer checks the target mapping table to re-execute the lock.

[0055] S140, if the second lock mode set includes the first lock mode, the active node executes the lock instruction for the target database object.

[0056] Specifically, the second lock mode set includes the first lock mode, which means that the first lock mode is allowed to be applied by the active node, and thus the lock instruction for the target database object can be executed.

[0057] Optionally, the active node queries the target mapping table according to the identification information of the target database object to obtain the first lock mode set, including:

[0058] The active node determines the first lock identification according to the identification information of the target database object.

[0059] The active node queries the target mapping table according to the first lock identification to obtain the first lock mode set corresponding to the first lock identification.

[0060] The target mapping table can be obtained in the following manner: when a fault node is detected, the control node obtains the lock information of the active node; the control node constructs the target mapping table about lock identification and lock mode according to the lock information of the active node; the control node sends the target mapping table to the active node, and the active node receives the target mapping table sent by the control node.

[0061] Optionally, it further includes:

[0062] If the second lock mode set does not include the first lock mode, the active node blocks the lock instruction for the target database object.

[0063] After detecting that the fault handling is completed, the active node executes the lock instruction for the target database object.

[0064] Specifically, if the second lock mode set includes the IS lock, and the first lock mode is not the IS lock, the active node blocks the lock instruction for the target database object until it is detected that the fault handling is completed, and then the active node directly executes the lock instruction for the target database object without lock mode judgment.

[0065] Optionally, before the active node generates the second lock mode set according to the compatible lock mode corresponding to each lock mode in the first lock mode set, it further includes:

[0066] The active node queries a lock compatibility matrix according to the first set of lock modes, to obtain a compatible lock mode corresponding to each lock mode in the first set of lock modes.

[0067] Specifically, the active node queries a lock compatibility matrix according to the first set of lock modes, to obtain a compatible lock mode corresponding to each lock mode in the first set of lock modes, determines a lock mode possibly held by the faulty node according to the compatible lock mode corresponding to each lock mode, acquires a lock mode compatible with the lock mode possibly held by the faulty node, and generates a second set of lock modes according to the lock mode compatible with the lock mode possibly held by the faulty node.

[0068] Optionally, before the active node acquires the first lock mode carried by the blocking instruction and the identification information of the target database object when receiving the blocking instruction for the target database object, the method further includes:

[0069] When the faulty node is detected, the control node acquires blocking information of the active node.

[0070] The control node constructs a target mapping table about lock identification and lock mode according to the blocking information of the active node.

[0071] The control node sends the target mapping table to the active node.

[0072] The blocking information includes the lock identification and the lock mode.

[0073] Specifically, if the server cluster includes one faulty node, one control node and three active nodes, the control node acquires the blocking information of each active node, generates a target mapping table according to the blocking information of the three active nodes, and sends the target mapping table to each active node.

[0074] Optionally, before the active node queries the target mapping table according to the identification information of the target database object to obtain the first set of lock modes, the method further includes:

[0075] The active node receives the target mapping table sent by the control node.

[0076] It should be noted that, since the active transaction (an active transaction is a transaction that has not been executed completely) and the blocking information of the faulty node are lost, the active transaction of the faulty node cannot be accurately obtained, and the active transaction and the blocking information of the active node can only be obtained. However, the compatibility rule of the blocking can be used for judgment. If there is a blocking of an object on the active node, it can be inferred that the faulty node cannot hold a blocking on the object that is incompatible with the blocking.

[0077] The specific judgment rule is as follows:

[0078] 1. If the active node does not hold the lock of an object, it cannot determine whether the object is modified by the failed node, cannot guarantee the integrity of the object, and cannot determine that the object is not occupied by the failed node.

[0079] 2. If the active node holds the lock of an object, other nodes cannot execute incompatible locks on the object, and the integrity of the object can be guaranteed. At this time, according to the lock compatibility matrix, it can be known that: when the active node holds the S lock, the failed node cannot hold the X lock or the IX lock on the object; when the active node holds the X lock, the failed node cannot hold any lock on the object; when the active node holds the IS lock, the failed node cannot hold the X lock on the object; when the active node holds the IX lock, the failed node cannot hold the S lock or the X lock on the object.

[0080] According to the above rules, the locks executed by the transaction in the fault handling process are limited, and only the object on which the lock is executed only by the active node before the fault occurs and the lock mode is compatible with the lock held by the failed node is allowed to execute the lock (the specific limitation rules are described in detail below). After applying the limitation, it can be guaranteed that the object accessed by the transaction in the fault handling process is always the complete database object, and there is no lock conflict with the active transaction of the failed node after the data recovery is completed, and the fault node transaction and lock can be successfully reconstructed.

[0081] When the fault handling starts, all active node lock information is collected to create a HASH table with lock ID and lock mode as key / value pairs, denoted as LOCK HASH. Among them, one lock ID corresponds to multiple lock modes, indicating different lock modes held by all active node transactions on the database object corresponding to the lock ID.

[0082] The technical solution of this embodiment involves the following steps: When a locking instruction for a target database object is received, the active node obtains the first lock mode carried by the locking instruction and the identification information of the target database object; the active node queries a target mapping table based on the identification information of the target database object to obtain a first lock mode set; the active node generates a second lock mode set based on the compatible lock mode corresponding to each lock mode in the first lock mode set; if the second lock mode set includes the first lock mode, the active node executes the locking instruction for the target database object. This addresses the problem that during database fault handling, after the active node transaction reawakens the database service, some database objects are in an inconsistent state, leading to the failure to reconstruct the fault node transaction and locks. The solution restricts the locking executed by transactions during fault handling, allowing transactions to execute locks only on objects that were locked only by the active node before the fault occurred, and whose locking mode is compatible with the locks held by the fault node. This ensures that during fault handling, transactions always access complete database objects, and that after data recovery, there are no locks conflicting with the active transactions of the fault node, guaranteeing the successful reconstruction of the fault node transaction and locks.

[0083] Example 2

[0084] Figure 2 This is a schematic diagram of a blocking device provided in an embodiment of the present invention. This embodiment is applicable to blocking situations. The device can be implemented using software and / or hardware, and can be integrated into any device that provides blocking functionality, such as… Figure 2 As shown, the blocking device specifically includes: an acquisition module 210, a query module 220, a generation module 230, and an execution module 240.

[0085] The acquisition module is used to acquire the first lock mode and the identification information of the target database object carried by the blocking instruction when a blocking instruction for the target database object is received.

[0086] The query module is used to query the target mapping table based on the identification information of the target database object to obtain the first lock mode set;

[0087] The generation module is used to generate a second lock mode set based on the compatible lock mode corresponding to each lock mode in the first lock mode set;

[0088] An execution module is configured to execute a locking instruction for a target database object if the second lock pattern set includes the first lock pattern.

[0089] Optionally, the query module is specifically used for:

[0090] The active node determines a first lock identifier according to the identification information of the target database object;

[0091] The active node queries a target mapping table according to the first lock identifier to obtain a first lock mode set corresponding to the first lock identifier.

[0092] The product can execute the method provided by any embodiment of the application, has the corresponding function module and beneficial effects of executing the method.

[0093] The technical scheme of the embodiment, when receiving a blocking instruction for a target database object, the active node acquires the first lock mode carried by the blocking instruction and the identification information of the target database object; the active node queries a target mapping table according to the identification information of the target database object to obtain a first lock mode set; the active node generates a second lock mode set according to the compatible lock mode corresponding to each lock mode in the first lock mode set; if the second lock mode set includes the first lock mode, the active node executes the blocking instruction for the target database object. To solve the problem that in the database fault processing process, after the active node transaction wakes up the database service, part of the database objects are in inconsistent state, resulting in the failure of reconstructing the fault node transaction and blocking, the blocking executed by the transaction in the fault processing process is limited, only the objects blocked by the active node before the fault occurs, and the blocking mode is compatible with the lock held by the fault node, the transaction is allowed to execute the blocking. Further, it is ensured that in the fault processing process, the transaction always accesses the complete database object, and there is no blocking conflict with the active transaction of the fault node after the data recovery is completed, and the fault node transaction and blocking can be successfully reconstructed.

[0094] Embodiment three

[0095] Figure 3 A structural schematic diagram of an electronic device 10 that can be used to implement embodiments of the application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the applications described and / or claimed in this document.

[0096] As Figure 3As shown, the electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., communicatively connected to the at least one processor 11, where the memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0097] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0098] The processor 11 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the blocking method.

[0099] In some embodiments, the blocking method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded onto the RAM 13 and executed by the processor 11, one or more steps of the blocking method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the blocking method by any other appropriate means, such as by means of firmware.

[0100] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a load programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0101] Computer programs used to implement the processes of the application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program

[0102] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, 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 fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0103] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0104] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0105] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.

[0106] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, executed in sequence, or executed in a different order, as long as the desired results of the present disclosure are achieved, and the present disclosure is not limited herein.

[0107] The specific embodiments described above are not intended to be limiting, and persons skilled in the art will appreciate that various modifications, combinations, sub-combinations and alternatives can be made to the specific embodiments without departing from the spirit and principles of the disclosure. Accordingly, the disclosure is not limited to the specific embodiments described above, but only by the scope of the appended claims.

Claims

1. A blocking method, characterized in that, The blocking methods include: When a blocking instruction is received for a target database object, the active node obtains the first locking mode and the identification information of the target database object carried by the blocking instruction, wherein the active node is a node that has not experienced a failure; The active node queries the target mapping table based on the identification information of the target database object to obtain the first lock mode set; The active node generates a second lock mode set based on the compatible lock mode corresponding to each lock mode in the first lock mode set; If the second lock pattern set includes the first lock pattern, then the active node executes a locking instruction for the target database object; The active node generates a second lock mode set based on the compatible lock mode corresponding to each lock mode in the first lock mode set, including: the active node determines the lock mode held by the faulty node based on each lock mode in the first lock mode set, obtains the compatible lock mode corresponding to the lock mode held by the faulty node, and generates a second lock mode set based on the union of the compatible lock modes determined by each lock mode in the first lock mode set.

2. The method according to claim 1, characterized in that, The active node queries the target mapping table based on the identification information of the target database object to obtain a first lock mode set, including: The active node determines the first lock identifier based on the identifier information of the target database object; The active node queries the target mapping table based on the first lock identifier to obtain the first lock mode set corresponding to the first lock identifier.

3. The method according to claim 1, characterized in that, Also includes: If the second lock pattern set does not include the first lock pattern, then the active node blocks the locking instruction for the target database object; After the fault handling is completed, the active node executes the blocking command for the target database object.

4. The method according to claim 1, characterized in that, Before the active node generates the second lock mode set based on the compatible lock mode corresponding to each lock mode in the first lock mode set, the method further includes: The active node queries the lock compatibility matrix based on the first lock mode set to obtain the compatible lock mode corresponding to each lock mode in the first lock mode set.

5. The method according to claim 1, characterized in that, Before the active node obtains the first lock mode and the identification information of the target database object carried in the blocking instruction when it receives a blocking instruction for the target database object, the process also includes: When a faulty node is detected, the control node obtains the blocking information of the active node; The control node constructs a target mapping table about lock identifiers and lock modes based on the blocking information of the active nodes; The control node sends the target mapping table to the active node.

6. The method according to claim 5, characterized in that, Before the active node queries the target mapping table based on the identification information of the target database object to obtain the first lock mode set, the process further includes: The active node receives the target mapping table sent by the control node.

7. A sealing device, characterized in that, The blocking device is configured in the active node, and the blocking device includes: The acquisition module is used to acquire, when receiving a blocking instruction for a target database object, the first locking mode carried by the blocking instruction and the identification information of the target database object, wherein the active node is a node that has not experienced a failure; The query module is used to query the target mapping table based on the identification information of the target database object to obtain the first lock mode set; The generation module is used to generate a second lock mode set based on the compatible lock mode corresponding to each lock mode in the first lock mode set; An execution module is configured to execute a locking instruction for a target database object if the second lock pattern set includes the first lock pattern. The generation module is specifically used for: the active node to determine the lock mode held by the faulty node according to each lock mode in the first lock mode set, to obtain the compatible lock mode corresponding to the lock mode held by the faulty node, and to generate a second lock mode set according to the union of the compatible lock modes determined by each lock mode in the first lock mode set.

8. The apparatus according to claim 7, characterized in that, The query module is specifically used for: The active node determines the first lock identifier based on the identifier information of the target database object; The active node queries the target mapping table based on the first lock identifier to obtain the first lock mode set corresponding to the first lock identifier.

9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor to enable the at least one processor to perform the blocking method according to any one of claims 1-6.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the blocking method of any one of claims 1-6.

Citation Information

Patent Citations

  • Data access method and device, server and storage medium

    CN109710629A

  • Database operation control method and device, computer equipment and storage medium

    CN109857745A