Data query method and device, electronic equipment and storage medium

By releasing the global blockade of data pages in the database cluster in advance and using mirrored data pages for querying, the problem of high cost of blocking data pages in the database cluster is solved, and the concurrency efficiency and data consistency of data processing are improved.

CN118885508AActive Publication Date: 2024-11-01WUHAN DAMENG DATABASE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410905038.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-11-01
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

In a shared storage database cluster, the cost of performing global blocking of data pages is high, resulting in query operations that may block data pages or rollback pages for a long time, affecting the efficiency of data processing in the cluster.

Method used

During the data query process, the global blockade of the data page to be queried is released in advance, and data query is carried out based on its mirrored data page. The consistency of data is ensured through mirrored data pages and concurrent blocking control, and lock conflicts are reduced.

Benefits of technology

The efficiency of data processing in clusters is improved, and the concurrent data processing lock conflicts of data pages to be queried is reduced, ensuring the stability and efficiency of the data query process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885508A_ABST
    Figure CN118885508A_ABST
Patent Text Reader

Abstract

The invention discloses a data query method and device, electronic equipment and a storage medium. The method is applied to any node in a database cluster, and comprises the following steps: executing global blocking and local read-write locking on a to-be-queried data page, and obtaining all physical records in the to-be-queried data page; releasing the global blockade of the to-be-queried data page, and keeping a local read-write lock of the to-be-queried data page; and traversing the obtained physical record, generating a mirror image data page corresponding to the to-be-queried data page under the condition of determining that the to-be-queried data page has a concurrent blocking request in the traversing process, and performing data query based on the mirror image data page. The global blockade of the to-be-queried data page is released in advance in the data query process, the consistency of data is ensured through mirroring data page and concurrent blockade control, the lock conflict for concurrent data processing of the to-be-queried data page is reduced while data query is not affected, and the efficiency of cluster concurrent data processing is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of database technology, and in particular to a data query method, device, electronic device and storage medium. Background Art

[0002] In a shared storage database cluster (DSC), multi-version transaction concurrency control is supported. Each time the data in the data table is updated, the latest data can be saved through physical records, and the historical version data at the row level can be maintained through rollback records.

[0003] When performing a query operation on a data page, it is necessary to globally block the data page and batch scan and output all visible physical records on the data page. If the physical records are not visible, the data page is kept blocked, and the historical version data is obtained from the rollback record of the rollback page. After the query operation is completed, the global block of the data page is released. However, in the DSC environment, the cost of performing a global block on a data page is high, and the query operation may block the data page or rollback page for a long time, affecting the efficiency of concurrent data processing in the cluster. Summary of the invention

[0004] The present invention provides a data query method, device, electronic device and storage medium, which can improve the efficiency of cluster concurrent data processing.

[0005] In a first aspect, an embodiment of the present invention provides a data query method, which is applied to any node in a database cluster, and the method includes:

[0006] Perform global blocking and local read-write lock on the data page to be queried, and obtain all physical records in the data page to be queried;

[0007] Release the global lock of the data page to be queried, and keep the local read-write lock of the data page to be queried;

[0008] The obtained physical records are traversed, and when it is determined during the traversal process that there is a concurrent blocking request for the data page to be queried, a mirror data page corresponding to the data page to be queried is generated, and data query is performed based on the mirror data page.

[0009] In a second aspect, an embodiment of the present invention provides a data query device, which is configured in any node in a database cluster, and the device includes:

[0010] A blocking module is used to perform global blocking and local read-write lock on the data page to be queried, and obtain all physical records in the data page to be queried;

[0011] A release module, used for releasing the global lock of the data page to be queried and maintaining the local read-write lock of the data page to be queried;

[0012] The query module is used to traverse the acquired physical records, and if it is determined during the traversal process that there is a concurrent blocking request for the data page to be queried, generate a mirror data page corresponding to the data page to be queried, and perform data query based on the mirror data page.

[0013] In a third aspect, an embodiment of the present invention provides an electronic device, including:

[0014] at least one processor; and

[0015] a memory communicatively connected to the at least one processor; wherein,

[0016] 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 so that the at least one processor can perform the method according to the first aspect.

[0017] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0018] According to the technical solution of the embodiment of the present invention, any node in the database cluster releases the global block of the data page to be queried before the query is completed during the process of querying the data page to be queried. If there is a concurrent block request for the data page to be queried, the data query is performed based on the mirror data page corresponding to the data page to be queried. During the data query process, the global block of the data page to be queried is released in advance, and the consistency of the data is guaranteed by the mirror data page and the concurrent block control, which does not affect the data query and reduces the lock conflict of the concurrent data processing of the data page to be queried, thereby improving the efficiency of the cluster's concurrent data processing.

[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1is a flow chart of a data query method provided according to Embodiment 1 of the present invention;

[0022] Figure 2 is a structural diagram of a data query device provided according to Embodiment 2 of the present invention;

[0023] Figure 3 It is a schematic diagram of the structure of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first", "second", etc. in the present invention are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0026] Before describing a data query method provided by an embodiment of the present invention, the application background of the embodiment of the present invention is introduced as follows:

[0027] In a shared storage database cluster (DSC), multi-version transaction concurrency control is supported. Each time the data in a data table is updated, the latest data can be saved through a physical record, and the historical version data at the row level can be maintained through a rollback record. A physical record can be a record indicating the latest version of the data in the data table. A rollback record can be a record indicating the historical version data corresponding to the data included in the physical record.

[0028] In DSC, a physical record can include four fields: the latest data field, which is used to store the latest version of data; the row number identifier field (also known as ROWID), which indicates the row number automatically generated when data is inserted; the transaction identifier field (also known as TID), which indicates the identifier of the transaction that updates the data; the rollback record address field (also known as RPTR), which indicates the physical address of the latest rollback record corresponding to the physical record, and points to the latest rollback record corresponding to the physical record through RPTR.

[0029] In DSC, a rollback record may include four fields: the historical version data field, which is used to store the historical version data corresponding to the rollback record; the ROWID field, which indicates the row number corresponding to the rollback record; the TID field, which indicates the transaction identifier corresponding to the rollback record; and the RPTR field, which indicates the physical address of the previous version of the rollback record corresponding to the rollback record, and is used to point to the previous version of the rollback record corresponding to the rollback record. A one-way linked list can be formed through the physical record and one or more corresponding rollback records, and a one-way linked list can record the change process of a row of data.

[0030] In DSC, user requests can be processed concurrently. Concurrent operations may read and modify the same data page at the same time. DSC protects the consistency of data pages through "concurrent blocking control". Concurrent operations may include, but are not limited to, concurrent operations generated by Data Definition Language (DDL), Data Manipulation Language (DML) or Data Query Language (DQL).

[0031] In a single-machine environment, concurrent access requests to data pages are controlled by read-write locks. Before reading a data page, apply for an S lock (also known as a shared lock) for the data page; before modifying a data page, apply for an X lock (also known as an exclusive lock) for the data page. Data page read operations are executed concurrently, and data page write operations are executed mutually exclusive. After the operation is completed, the read-write lock is released.

[0032] In the DSC environment, multiple database instances may access the same data page concurrently, and concurrent access requests to the data page are controlled by global locking and local read-write locks. Global locking can be understood as concurrent locking control for the global instance performed by the Global Buffer System (GBS) and the Local Buffer System (LBS). All database instances in DSC support GBS / LBS services. GBS coordinates locking requests between nodes and is responsible for the authorization and recovery of global data page locking. LBS proxy users initiate locking requests to GBS, or recover local locking authorizations based on GBS commands. Local read-write locks can be understood as concurrent locking control for local instances performed by shared locks and exclusive locks.

[0033] In the DSC environment, when a data page is blocked, you need to apply for a global GBS / LBS authorization first, and then apply for a local read-write lock to ensure the consistency of the data page between instances. Data page read operations allow multiple instances to execute concurrently, and data page write operations are executed exclusively by a single instance. After the operation is completed, first release the global GBS / LBS authorization, and then release the local read-write lock.

[0034] Currently, when performing a query operation on a data page in a DSC environment, it is necessary to globally block the data page and obtain all physical records of the data page; traverse the physical records and determine visibility, output the visible physical records, obtain the historical version data from the rollback records of the rollback page for invisible physical records, and further search for visible records from the historical version data; release the global block of the data page after the query operation is completed. However, the cost of performing a global block on a data page in a DSC environment is high, and the query operation may block the data page or rollback page for a long time, affecting the efficiency of concurrent data processing in the cluster.

[0035] By using a data query method provided by an embodiment of the present invention, the above-mentioned query operation process and concurrent blocking control are optimized, thereby solving the above-mentioned problem.

[0036] Embodiment 1

[0037] Figure 1 This is a flow chart of a data query method provided according to the first embodiment of the present invention. This embodiment is applicable to the case of performing data query in a data page to be queried. The method can be executed by a data query device, which can be implemented in the form of software and / or hardware and integrated in an electronic device that serves as any node in a database cluster. Furthermore, the electronic device includes but is not limited to: a computer, a laptop, etc.

[0038] like Figure 1As shown, the method includes S110-S130, and S110-S130 can be understood as steps in which any node in the database cluster performs a query operation in the data page to be queried. Optionally, the database cluster can be a DSC. The query operation can be an operation of querying data, specifically, an operation of querying the visible version of data in the data page to be queried.

[0039] S110 , executing global locking and local read-write lock on the data page to be queried, and acquiring all physical records in the data page to be queried.

[0040] The data page to be queried may be a data page to be queried, that is, a data page whose visible version of data is to be queried through a query operation. Optionally, the data page to be queried may be any data page stored in the DSC.

[0041] In this step, firstly, a global block is performed on the data page to be queried, that is, a global GBS / LBS authorization is performed; then a local read-write lock is performed on the data page to be queried, that is, a shared lock and an exclusive lock are performed on the data page to be queried; finally, all physical records in the data page to be queried are obtained, and the number of physical records is not limited.

[0042] S120: Release the global lock of the data page to be queried, and keep the local read-write lock of the data page to be queried.

[0043] In this step, releasing the global blockade of the data page to be queried can be understood as the query operation releasing the LBS authorization of the data page to be queried. Compared with releasing the LBS authorization of the data page to be queried after the query operation is completed, the advantage of releasing the LBS authorization in advance is that after the query operation releases the global blockade of the data page to be queried, the operations on the data page to be queried concurrently with the query operation in the cluster can execute the global blockade of the data page to be queried.

[0044] In one embodiment, the operation on the data page to be queried concurrently with the query operation in the cluster may be a data modification operation on the data page to be queried initiated by a node different from any of the above-mentioned nodes in the cluster. Among them, any of the above-mentioned nodes may be a local node, and the node different from any of the above-mentioned nodes may be a remote node. The data modification operation may be an operation to modify the data of the data page to be queried. For the remote node, after the query operation of the local node releases the global blockade of the data page to be queried, the data modification operation may request authorization for the global blockade of the data page to be queried, and then modify the data of the data page to be queried. That is, while the local node is performing a query operation on the data page to be queried, the remote node may concurrently perform a data modification operation on the data page to be queried.

[0045] In one embodiment, the operation on the data page to be queried concurrently with the query operation in the cluster may be a data synchronization operation on the data page to be queried initiated by any of the above nodes. The data synchronization operation may be an operation for synchronizing the data of the data page to be queried, such as synchronizing the data page to be queried modified by the above remote node based on the data modification operation to any of the above nodes. For any of the above nodes, after the query operation releases the global blockade of the data page to be queried, the data synchronization operation may request authorization for the global blockade of the data page to be queried, so as to achieve data synchronization.

[0046] In this step, maintaining the local read-write lock of the data page to be queried can be understood as the query operation not releasing the authorization of the local read-write lock of the data page to be queried, so that any of the above nodes can still perform the query operation of the data page to be queried.

[0047] In one embodiment, the method further comprises:

[0048] A query mark is set in the data page to be queried, and the query mark indicates that a data query is being performed in the data page to be queried.

[0049] The query mark may be a mark indicating that a data query is being performed in the data page to be queried, that is, indicating that the data page to be queried is being accessed by a query operation. The query mark is not limited, and may be a mark R, for example.

[0050] In an embodiment of the present invention, while releasing the global block of the data page to be queried and maintaining the local read-write lock of the data page to be queried, a query mark can be set in the data page to be queried, so that operations concurrent with the query operation in any of the above nodes, such as data synchronization operations, can determine that there are concurrent query operations and data synchronization operations in the data page to be queried.

[0051] S130, traversing the obtained physical records, and if it is determined during the traversal process that there is a concurrent blocking request for the data page to be queried, generating a mirror data page corresponding to the data page to be queried, and performing data query based on the mirror data page.

[0052] The mirror data page corresponding to the data page to be queried may be a copy of the data page to be queried generated by duplicating the data page to be queried. The physical records in the mirror data page may be considered to be consistent with the physical records in the data page to be queried. The rollback record corresponding to a physical record in the mirror data page may be considered to be consistent with the rollback record corresponding to a physical record in the data page to be queried that is consistent with the aforementioned physical record.

[0053] In this step, the obtained physical records are traversed, and for each obtained physical record, a judgment is made as to whether a mirror data page corresponding to the data page to be queried is generated. If it is determined that there is a concurrent blocking request for the data page to be queried, that is, it is determined that there is an operation concurrent with the query operation in any of the above nodes, such as a data synchronization operation, requesting authorization for a global blocking of the data page to be queried, then a mirror data page corresponding to the data page to be queried is generated, and data query is subsequently performed in the mirror data page.

[0054] In one embodiment, when there is a concurrent blocking request mark in the data page to be queried, it is determined that there is a concurrent blocking request for the data page to be queried.

[0055] The concurrent blocking request mark may be a mark indicating that there is an operation concurrent with the query operation in any of the above nodes, and requesting global blocking authorization for the data page to be queried.

[0056] The concurrent blocking request mark may be an operation concurrent with the query operation in any of the above nodes. When applying for global blocking authorization of the data page to be queried, the mark set in the data page to be queried is not limited to the concurrent blocking request mark, such as mark W. In the case where the concurrent blocking request mark is set for the operation concurrent with the query operation, the query operation can determine the existence of a concurrent blocking request for the data page to be queried through the concurrent blocking request mark.

[0057] In one embodiment, performing data query based on the mirror data page includes:

[0058] Obtaining all physical records in the mirror data page;

[0059] If the physical record obtained from the mirror data page is visible, it is output; otherwise, a visible record is obtained from the rollback record corresponding to the invisible physical record.

[0060] If the physical record obtained from the mirror data page is visible, it is output; if it is not visible, the physical address of the latest rollback record indicated by the invisible physical record is read to further find out whether there is a visible version of the record.

[0061] The rollback record is loaded according to the physical address of the latest rollback record. If the record is visible, it is output; if it is not visible, the next rollback record is obtained to further determine the visibility. If there is no visible record in the one-way linked list formed by the rollback record, the record is considered invisible to the user. After the rollback record is read, the mirror data page is cleaned up.

[0062] It should be noted that the embodiment of the present invention does not limit the method of determining whether a record is visible or invisible, and it can be implemented by using the existing method of determining whether a record is visible or invisible.

[0063] According to the technical solution of the embodiment of the present invention, any node in the database cluster releases the global block of the data page to be queried before the query is completed during the process of querying the data page to be queried. If there is a concurrent block request for the data page to be queried, the data query is performed based on the mirror data page corresponding to the data page to be queried. During the data query process, the global block of the data page to be queried is released in advance, and the consistency of the data is guaranteed by the mirror data page and the concurrent block control, which does not affect the data query and reduces the lock conflict of the concurrent data processing of the data page to be queried, thereby improving the efficiency of the cluster's concurrent data processing.

[0064] In one embodiment, the method further comprises:

[0065] When a mirror data page corresponding to the data page to be queried is generated, releasing a local read-write lock of the data page to be queried;

[0066] A blocking request for the data page to be queried is awakened.

[0067] When a mirror data page corresponding to the data page to be queried is generated, the query operation can be performed in the mirror data page, so the query mark R in the data page to be queried can be cleared and the local read-write lock of the data page to be queried can be released.

[0068] In any of the above nodes, before the query operation releases the local read-write lock of the data page to be queried, because the query operation applies for the local read-write lock of the data page to be queried, when the operation concurrent with the query operation, such as the data synchronization operation, needs to apply for the local read-write lock of the data page to be queried, it will be blocked and waited. After the query operation releases the local read-write lock of the data page to be queried, any node can wake up the blocking and waiting blocking request for the data page to be queried, and clear the blocking request mark W in the data page to be queried, so that the operation concurrent with the query operation, such as the data synchronization operation, can apply for the local read-write lock of the data page to be queried.

[0069] The following is the process of data synchronization in any of the above nodes for operations concurrent with query operations, such as data synchronization operations:

[0070] In one embodiment, the method further comprises:

[0071] In the case of applying for a global blockade for the data page to be queried, if the data page to be queried is updated and there is a query mark in the data page to be queried, setting a concurrent block request mark in the data page to be queried;

[0072] A global block is performed on the data page to be queried.

[0073] In the case of applying for global blocking GBS / LBS authorization for data synchronization operation, the data page to be queried is checked during LBS authorization. If the data page to be queried is modified by the remote node, it is determined that the updated data page to be queried needs to be synchronized to any of the above nodes through data synchronization operation. At the same time, if there is a query mark R in the data page to be queried, it indicates that there are concurrent blocking requests for query operation and data synchronization operation in the data page to be queried. Therefore, the concurrent blocking request mark W can be set in the data page to be queried, so that the query operation determines the existence of a blocking request concurrent with the query operation based on the mark W.

[0074] After setting the concurrent blocking request flag in the data page to be queried, the data synchronization operation can perform GBS / LBS authorization normally.

[0075] In one embodiment, after globally blocking the data page to be queried, the method further includes:

[0076] In the case of applying for a local read-write lock for the data page to be queried, if there is a query mark in the data page to be queried, blocking and waiting until the data query operation corresponding to the query mark releases the local read-write lock;

[0077] Execute a local read-write lock on the data page to be queried;

[0078] The data page to be queried after synchronization update.

[0079] When a local read-write lock is applied for a data synchronization operation, the mark in the data page to be queried is checked. If the data page to be queried has a query mark R, it indicates that the data page to be queried is being accessed by a query operation, so blocking and waiting are performed.

[0080] When the data query operation corresponding to the query tag, that is, the query operation, releases the local read-write lock, the blocking waiting blocking request of the data synchronization operation will be awakened, and the data synchronization operation can execute the local read-write lock on the data page to be queried, and synchronize the updated data page to be queried to any of the above nodes.

[0081] In the above technical solution, during the execution of a query operation at any node, the remote node concurrently updates the data page to be queried; when a data synchronization operation concurrent with the query operation in any node initiates a blocking request, the updated data page to be queried will be synchronized to the local. At this time, the query operation can generate a mirror data page, avoiding invalid data page duplication.

[0082] Embodiment 2

[0083] Figure 21 is a schematic diagram of the structure of a data query device provided according to the second embodiment of the present invention. This embodiment is applicable to the case of performing data query in a data page to be queried. The device can be configured in an electronic device as any node in a database cluster. Figure 2 As shown, the specific structure of the device includes:

[0084] The blocking module 21 is used to perform global blocking and local read-write lock on the data page to be queried, and obtain all physical records in the data page to be queried;

[0085] A release module 22, used for releasing the global lock of the data page to be queried and maintaining the local read-write lock of the data page to be queried;

[0086] The query module 23 is used to traverse the acquired physical records, and if it is determined during the traversal process that there is a concurrent blocking request for the data page to be queried, generate a mirror data page corresponding to the data page to be queried, and perform data query based on the mirror data page.

[0087] The technical solution provided by this embodiment is to perform global blocking and local read-write lock on the data page to be queried through the blocking module, and obtain all physical records in the data page to be queried; release the global blocking of the data page to be queried through the release module, and maintain the local read-write lock of the data page to be queried; traverse the acquired physical records through the query module, and if it is determined during the traversal process that there is a concurrent blocking request for the data page to be queried, generate a mirror data page corresponding to the data page to be queried, and perform data query based on the mirror data page. In the process of data query, the global blocking of the data page to be queried is released in advance, and the consistency of data is ensured through the mirror data page and concurrent blocking control, which does not affect the data query while reducing the lock conflict for concurrent data processing of the data page to be queried, and improves the efficiency of concurrent data processing of the cluster.

[0088] Further, when a concurrent blocking request mark exists in the data page to be queried, it is determined that a concurrent blocking request exists for the data page to be queried.

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

[0090] Obtaining all physical records in the mirror data page;

[0091] If the physical record obtained from the mirror data page is visible, it is output; otherwise, a visible record is obtained from the rollback record corresponding to the invisible physical record.

[0092] Furthermore, the device also includes a query mark setting module, which is used to:

[0093] A query mark is set in the data page to be queried, and the query mark indicates that a data query is being performed in the data page to be queried.

[0094] Furthermore, the device also includes a wake-up module, which is used to:

[0095] When a mirror data page corresponding to the data page to be queried is generated, releasing a local read-write lock of the data page to be queried;

[0096] A blocking request for the data page to be queried is awakened.

[0097] Furthermore, the device also includes a concurrent global blocking module, which is used to:

[0098] In the case of applying for a global blockade for the data page to be queried, if the data page to be queried is updated and there is a query mark in the data page to be queried, setting a concurrent block request mark in the data page to be queried;

[0099] A global block is performed on the data page to be queried.

[0100] Furthermore, the device also includes a concurrent local blocking module, which is used to:

[0101] After executing global blocking on the data page to be queried, in the case of applying for a local read-write lock for the data page to be queried, if there is a query mark in the data page to be queried, blocking and waiting until the data query operation corresponding to the query mark releases the local read-write lock;

[0102] Execute a local read-write lock on the data page to be queried;

[0103] The data page to be queried after synchronization update.

[0104] The data query device provided in the embodiment of the present invention can execute the data query method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0105] Embodiment 3

[0106] Figure 3Schematic diagram of the structure of the electronic device implementing the embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0107] like Figure 3 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to 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.

[0108] A number of 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, speakers, etc.; a storage unit 18, such as a 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.

[0109] The processor 11 may be a variety of general and / or special 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 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 executes the various methods and processes described above, such as a data query method.

[0110] In some embodiments, the data query method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the data query method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the data query method in any other appropriate manner (e.g., by means of firmware).

[0111] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0112] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0113] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0114] To provide interaction with a user, the systems and techniques described herein may 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 trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0115] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may 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.

[0116] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may 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 difficult management and weak business scalability in traditional physical hosts and VPS services.

[0117] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0118] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A data query method, characterized in that: Applied to any node in a database cluster, the method includes: Perform global blocking and local read-write lock on the data page to be queried, and obtain all physical records in the data page to be queried; Release the global lock of the data page to be queried, and keep the local read-write lock of the data page to be queried; The obtained physical records are traversed, and when it is determined during the traversal process that there is a concurrent blocking request for the data page to be queried, a mirror data page corresponding to the data page to be queried is generated, and data query is performed based on the mirror data page.

2. The method according to claim 1, characterized in that When a concurrent blocking request mark exists in the data page to be queried, it is determined that a concurrent blocking request exists for the data page to be queried.

3. The method according to claim 1, characterized in that: Performing data query based on the mirror data page includes: Obtaining all physical records in the mirror data page; If the physical record obtained from the mirror data page is visible, it is output; otherwise, a visible record is obtained from the rollback record corresponding to the invisible physical record.

4. The method according to claim 1, characterized in that Also includes: A query mark is set in the data page to be queried, and the query mark indicates that a data query is being performed in the data page to be queried.

5. The method according to claim 1, characterized in that Also includes: When a mirror data page corresponding to the data page to be queried is generated, releasing a local read-write lock of the data page to be queried; A blocking request for the data page to be queried is awakened.

6. The method according to claim 1, characterized in that Also includes: In the case of applying for a global blockade for the data page to be queried, if the data page to be queried is updated and there is a query mark in the data page to be queried, setting a concurrent block request mark in the data page to be queried; A global block is performed on the data page to be queried.

7. The method according to claim 6, characterized in that After globally blocking the data page to be queried, the method further includes: In the case of applying for a local read-write lock for the data page to be queried, if there is a query mark in the data page to be queried, blocking and waiting until the data query operation corresponding to the query mark releases the local read-write lock; Execute a local read-write lock on the data page to be queried; The data page to be queried after synchronization update.

8. A data query device, characterized in that: Configured at any node in the database cluster, the device includes: A blocking module is used to perform global blocking and local read-write lock on the data page to be queried, and obtain all physical records in the data page to be queried; A release module, used for releasing the global lock of the data page to be queried and maintaining the local read-write lock of the data page to be queried; The query module is used to traverse the acquired physical records, and if it is determined during the traversal process that there is a concurrent blocking request for the data page to be queried, generate a mirror data page corresponding to the data page to be queried, and perform data query based on the mirror data page.

9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, 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 so that the at least one processor can perform the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Virtual machine startup acceleration method and apparatus

    CN108255577A

  • Method of controlling computer resource

    JP1993204872A