A data prefetching method for a database shared cluster and related products

CN122885059APending Publication Date: 2026-10-09CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611096553.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-22
Publication Date
2026-10-09

AI Technical Summary

Benefits of technology

[0017]本发明的数据库共享集群的数据预取方法中,多写数据库集群的任一节点具有与查询任务对应的预期数据访问序列,并基于预期数据访问序列确定待访问的一个或多个目标数据块。该节点在访问目标数据块之前,就把需要使用的缓存一致性锁授权准备好,不需要在访问目标数据块时,再去获取对应的缓存一致性锁授权。这样,该节点在进行对目标数据块的数据访问操作时,就无需等待管理节点授权缓存一致性锁,或者减少等待管理节点授权缓存一致性锁的情况,进而能够提高资源利用率,目标数据块的查询响应时间显著缩短,可提高多写数据库集群的性能。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122885059A_ABST
    Figure CN122885059A_ABST
Patent Text Reader

Abstract

The application provides a data prefetching method for a database shared cluster and related products. The method comprises the following steps: in response to a query task starting, obtaining an expected data access sequence corresponding to the query task, and determining a target data block to be accessed according to the expected data access sequence; initiating a cache consistency lock prefetching request for the target data block; after initiating the cache consistency lock prefetching request, asynchronously obtaining a cache consistency lock authorization, and performing a data access operation on the target data block based on the obtained cache consistency lock authorization. The scheme of the application realizes that when the data access operation on the target data block is performed, the cache consistency lock authorization from a management node is not needed to wait for, the resource utilization rate can be improved, the query response time of the target data block is significantly shortened, and the performance of a multi-write database cluster can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to database technology, and in particular to a data prefetching method and related products for a database shared cluster. Background Technology

[0002] Multi-Master Database Cluster (MLC) technology allows multiple database nodes to concurrently read and write to the same data directory. Through a cluster coordination mechanism, the database instances of each node are organized to provide a unified database service, thereby achieving horizontal scaling of system processing capacity and high availability of services.

[0003] In existing multi-write database cluster implementations, cache fusion technology is commonly used to ensure data consistency, isolation, and persistence when multiple nodes concurrently access the shared storage data directory. The core design idea of ​​cache fusion technology is to make the entire cluster logically appear as a single buffer through a global cache consistency control mechanism, thereby shielding the complexity of physical multi-node concurrent operations.

[0004] Specifically, existing cache fusion mechanisms primarily rely on global cache consistency locks. The workflow is roughly as follows: When the SQL service process on any node in the cluster needs to read or modify a data block in the buffer, the process first checks whether the node already holds a local cache consistency lock with sufficient permissions corresponding to that data block. If the node already holds a cache consistency lock of the same or higher level, a cache hit is determined, and the service process can directly operate on the buffer, avoiding the costly cross-node overhead. If the node does not hold a valid lock, it initiates a lock authorization request to the resource management node in the cluster, which performs resource management functions, through a communication process. This resource management node is responsible for maintaining the granting status information of the global cache consistency lock and adjudicating according to the global concurrency control policy, ultimately granting the corresponding lock permissions to the requesting node. Only after obtaining the cache consistency lock can the node continue to perform operations on the buffer.

[0005] However, those skilled in the art have found in practical applications that the existing cache fusion lock mechanism exhibits significant performance bottlenecks and resource waste when handling large-scale data query scenarios. Specifically, during the execution of a large-scale data query, the query engine needs to traverse and access massive amounts of data blocks. The query execution process must independently initiate a cache consistency lock authorization check and acquisition process for each data block to be accessed. When the lock is not hit on the local node, a complete cross-node remote request is triggered. More critically, the lock acquisition mechanism of the existing technology adopts a strict synchronous blocking mode. That is, when the SQL service process sends a lock authorization request to the resource management node, the execution thread of that process is immediately suspended until the management node returns the authorization result. Since all lock requests from all nodes converge to a single resource management node, the query process frequently encounters situations where the system is waiting for the management node to authorize the cache consistency lock, resulting in low system resource utilization, prolonged query response time, and impact on cluster performance. Summary of the Invention

[0006] In view of the above problems, the present invention is proposed to provide a data prefetching method and related products for database shared clusters that overcome or at least partially solve the above problems. This method can reduce the frequent occurrence of waiting for management node authorization cache consistency locks during the query process, thereby improving system resource utilization, reducing query response time, and improving the performance of multi-write database clusters.

[0007] Specifically, the present invention provides a data prefetching method for a database shared cluster, comprising: In response to the initiation of a query task, the expected data access sequence corresponding to the query task is obtained, and one or more target data blocks to be accessed are determined based on the expected data access sequence. Initiate a cache consistency lock prefetch request for the target data block, wherein the cache consistency lock prefetch request is used to pre-acquire the cache consistency lock authorization of the target data block before accessing the target data block; After initiating the cache consistency lock prefetch request, the cache consistency lock authorization is obtained asynchronously, and data access operations for the target data block are performed based on the obtained cache consistency lock authorization.

[0008] Optionally, obtaining the expected data access sequence corresponding to the query task includes: Obtain the data access path description information for the query task; Based on the data scanning order and / or connection order indicated by the data access path description information, the access order of the target data blocks to be accessed during the execution of the query task is determined, and the information of the target data blocks is organized into the expected data access sequence according to the access order, wherein the information of the target data blocks includes identity identifier and distribution location.

[0009] Optionally, the data prefetching method for the database shared cluster further includes, before initiating a cache consistency lock prefetch request for the target data block: Query whether the target data block has been stored in the buffer area of ​​the database shared cluster; Since the target data block has been stored in the buffer area and the corresponding cache consistency lock is in a valid state, it is determined that there is no need to initiate the cache consistency lock prefetch request. In response to the fact that the target data block has been stored in the buffer area and the corresponding cache consistency lock is in an invalid state, it is determined that the cache consistency lock prefetch request needs to be initiated. In response to the fact that the target data block is not stored in the buffer area, it is determined that the cache consistency lock prefetch request needs to be initiated.

[0010] Optionally, initiating a cache consistency lock prefetch request for the target data block includes: The request lock mode corresponding to the target data block is determined based on the query operation type of the target data block. If the query operation type is a read-only operation, the request lock mode is a shared lock; if the query operation type is a write operation or an update operation, the request lock mode is a mutex lock. Based on the identity of the target data block and the request lock mode, a cache consistency lock prefetch request is generated.

[0011] Optionally, generating the cache consistency lock prefetch request based on the identity of the target data block and the request lock mode includes: The identity and distribution location of the target data block are associated and mapped with the request lock mode of the target data block to generate a prefetch request list; The priority order of each prefetch request in the prefetch request list is determined according to the access order of the target data block; The cache consistency lock prefetch request is generated based on the prefetch request list and the priority order of each prefetch request.

[0012] Optionally, asynchronously acquiring the cache consistency lock authorization includes: The system receives an authorization decision result returned in response to the cache consistency lock prefetch request. The authorization decision result includes the authorization status and authorization information corresponding to each target data block in the prefetch request list. If the authorization status of the target data block is successful, the authorization information includes at least one of authorization sequence number, validity period, lock mode, and authorization timestamp. If the authorization status of the target data block is failed, the authorization information includes a failure reason identifier. For the target data block that has been successfully authorized, update the cache consistency lock of the database shared cluster according to the authorization information; For the target data block where authorization failed, the corresponding prefetch status is marked as failed.

[0013] Optionally, the data prefetching method for the database shared cluster further includes, after marking the corresponding prefetching state as failed: The retry interval is determined based on the failure reason identifier, and a synchronization lock request is sent after the retry interval; the synchronization lock request carries the identity identifier of the target data block and the lock request mode; If the authorization decision result is not obtained from the database shared cluster management node within the preset number of retries, or if the authorization decision result is an authorization failure, the retries will stop and an access failure message will be returned. The access failure message includes the identity identifier of the target data block and the failure reason identifier.

[0014] According to another aspect of the present invention, a computer-readable storage medium is also provided, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the data prefetching method for any of the above-described database sharing clusters.

[0015] According to another aspect of the present invention, a computer program product is also provided, comprising a computer program that, when executed by a processor, implements the steps of the data prefetching method for any of the above-described database shared clusters.

[0016] According to another aspect of the present invention, a computer device is also provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any data prefetching method for a database sharing cluster.

[0017] In the data prefetching method for a shared database cluster of the present invention, any node in the multi-write database cluster has an expected data access sequence corresponding to a query task, and determines one or more target data blocks to be accessed based on the expected data access sequence. Before accessing the target data block, the node prepares the necessary cache consistency lock authorization, eliminating the need to acquire the corresponding cache consistency lock authorization when accessing the target data block. Thus, when performing data access operations on the target data block, the node does not need to wait for the management node to authorize the cache consistency lock, or reduces the need to wait for the management node to authorize the cache consistency lock, thereby improving resource utilization, significantly shortening the query response time of the target data block, and improving the performance of the multi-write database cluster.

[0018] The above and other objects, advantages and features of the present invention will become more apparent to those skilled in the art from the following detailed description of specific embodiments of the invention in conjunction with the accompanying drawings. Attached Figure Description

[0019] The following sections will describe some specific embodiments of the invention in detail by way of example and not limitation, with reference to the accompanying drawings. The same reference numerals in the drawings denote the same or similar parts or portions. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings: Figure 1 This is a schematic flowchart of a data prefetching method for a database shared cluster according to an embodiment of the present invention; Figure 2 This is a schematic flowchart illustrating the process of obtaining the expected data access sequence corresponding to a query task in a data prefetching method for a database shared cluster according to an embodiment of the present invention. Figure 3 This is a schematic flowchart of a data prefetching method for a database shared cluster according to an embodiment of the present invention; Figure 4 This is a schematic flowchart illustrating the generation of a cache consistency lock prefetch request based on the identity of the target data block and the request lock mode in a data prefetching method for a database shared cluster according to an embodiment of the present invention. Figure 5 This is a schematic flowchart illustrating the asynchronous acquisition of cache consistency lock authorization in a data prefetching method for a database shared cluster according to an embodiment of the present invention; Figure 6 This is a schematic flowchart of a data prefetching method for a database shared cluster according to an embodiment of the present invention; Figure 7 This is a schematic diagram of a computer program product according to an embodiment of the present invention; Figure 8 This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention; Figure 9 This is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation

[0020] This embodiment provides a solution for a data prefetching method for a database shared cluster.

[0021] Figure 1 This is a schematic flowchart of a data prefetching method for a database shared cluster according to an embodiment of the present invention. The method generally includes: Step S100: In response to the start of the query task, obtain the expected data access sequence corresponding to the query task, and determine one or more target data blocks to be accessed based on the expected data access sequence.

[0022] Step S200: Initiate a cache consistency lock prefetch request for the target data block. The cache consistency lock prefetch request is used to pre-acquire the cache consistency lock authorization of the target data block before accessing the target data block.

[0023] Step S300: After initiating the cache consistency lock prefetch request, asynchronously obtain the cache consistency lock authorization, and perform data access operations on the target data block based on the obtained cache consistency lock authorization.

[0024] In this embodiment of the invention, any node in the multi-write database cluster has an expected data access sequence corresponding to a query task, and determines one or more target data blocks to be accessed based on the expected data access sequence. Before accessing the target data blocks, the node prepares the necessary cache consistency lock authorization, eliminating the need to acquire the corresponding cache consistency lock authorization when accessing the target data blocks. Thus, when performing data access operations on the target data blocks, the node does not need to wait for the management node to authorize the cache consistency lock, or reduces the need to wait for the management node to authorize the cache consistency lock, thereby improving resource utilization, significantly shortening the query response time of the target data blocks, and improving the performance of the multi-write database cluster.

[0025] In other words, in this embodiment of the invention, an active predictive prefetching trigger is adopted to proactively predict the data blocks to be accessed subsequently, thereby initiating an asynchronous pre-request for cache consistency locks in advance. The object of prefetching is the authorization of cache consistency locks. During query execution, the access requirements of subsequent target data blocks are predicted based on the query plan. Before accessing these target data blocks, the cache consistency lock authorizations corresponding to the target data blocks are obtained in advance, so that the SQL service process does not need to go through the waiting process for cache consistency lock authorizations during subsequent accesses.

[0026] In large-scale data query scenarios, lock authorization waiting optimization is needed. Before the SQL service process accesses each data block, it needs to obtain the corresponding cache consistency lock authorization. By pre-acquiring these lock authorizations, the waiting time for subsequent accesses is transformed into asynchronous processing time, eliminating the blocking caused by frequent synchronization waiting for lock authorization during query execution.

[0027] An asynchronous decoupled division of labor model is adopted between the SQL service process and the communication process. The SQL service process is only responsible for initiating lock prefetching requests based on the query plan, and then continues to execute other parts of the query plan without being blocked by lock authorization waiting. All subsequent lock authorization interaction processes (including initiating requests to the management node, receiving responses from the management node or holding node, updating local cache consistency lock information, and sending confirmation authorization messages to the management node) are completed independently and asynchronously by the communication process of this node.

[0028] In some embodiments of the present invention, such as Figure 2 As shown, the expected data access sequence for the query task includes: Step S101: Obtain the data access path description information for the query task.

[0029] Step S102: Based on the data scanning order and / or connection order indicated by the data access path description information, determine the access order of the target data blocks to be accessed during the execution of the query task, and organize the information of the target data blocks into the expected data access sequence according to the access order. The information of the target data blocks includes identity identifier and distribution location.

[0030] In this embodiment of the invention, the query plan has clear information such as the data scanning order and / or the connection order, so that the data access order and range are determined before the query plan is executed. Prefetching provides a precise information source, making the prefetching behavior deterministic and plannable. For example, the cache consistency lock authorization corresponding to the target data block accessed first is prefetched first, and the cache consistency lock authorization corresponding to the target data block accessed later is prefetched later.

[0031] In some embodiments of the present invention, such as Figure 3 As shown, before initiating a cache consistency lock prefetch request for the target data block, the data prefetching method of the database shared cluster also includes: Step S106: Query whether the target data block has been stored in the buffer area of ​​the database shared cluster.

[0032] Step S108: If the target data block is stored in the buffer area and the corresponding cache consistency lock is valid, it is determined that no cache consistency lock prefetch request needs to be initiated. If the target data block is stored in the buffer area and the corresponding cache consistency lock is invalid, it is determined that a cache consistency lock prefetch request needs to be initiated. If the target data block is not stored in the buffer area, it is determined that a cache consistency lock prefetch request needs to be initiated.

[0033] In this embodiment of the invention, by pre-determining the storage status of the target data block in the buffer area and the validity of the cache consistency lock, a cache consistency lock prefetch request is triggered when the target data block is missing or the cache consistency lock fails, which effectively alleviates the pressure on the resource management node, significantly reduces the response latency of large-scale queries, and significantly improves the system resource utilization and cluster expansion stability.

[0034] In some embodiments of the present invention, initiating a cache consistency lock prefetch request for a target data block includes: The lock request mode for the target data block is determined based on the query operation type. If the query operation type is read-only, the lock request mode is a shared lock. If the query operation type is write or update, the lock request mode is a mutex lock.

[0035] Generate a cache consistency lock prefetch request based on the identity of the target data block and the request lock mode.

[0036] In this embodiment of the invention, when it is determined that a cache consistency lock prefetch request needs to be initiated, the corresponding request lock mode is determined based on the query operation type of the target data block. If the query operation type is a read-only operation, the request lock mode corresponding to the target data block is determined to be a shared lock to allow concurrent access by read-only operations of other nodes; if the query operation type is a write operation or an update operation, the request lock mode is determined to be a mutex lock to ensure the current node's exclusive modification rights to the data block. After determining the request lock mode, the present invention generates the cache consistency lock prefetch request based on the identity of the target data block and the request lock mode, and sends the prefetch request to the resource management node or the corresponding holding node in the cluster to complete the lock authorization preparation in advance, thereby eliminating lock waiting obstacles before actually accessing the buffer area.

[0037] In some embodiments of the present invention, such as Figure 4 As shown, based on the identity of the target data block and the request lock mode, a cache consistency lock prefetch request is generated, including: Step S201: Associate and map the identity and distribution location of the target data block with the request lock mode of the target data block to generate a prefetch request list.

[0038] Step S202: Determine the priority order of each prefetch request in the prefetch request list according to the access order of the target data block.

[0039] Step S203: Generate cache consistency lock prefetch requests based on the prefetch request list and the priority order of each prefetch request.

[0040] In this embodiment of the invention, the identity and distribution location of the target data block are associated with the lock request mode to generate a prefetch request list, realizing the aggregated batch management of lock requirements. Then, the priority of each prefetch request is determined according to the actual access order in the query plan, so that the lock prefetch rhythm strictly matches the time sequence of data block access, avoiding invalid prefetching and resource preemption. Finally, cache consistency lock prefetch requests are generated and sent in batches according to priority, transforming scattered synchronous lock applications into ordered asynchronous batch tasks, effectively reducing the frequency of cross-node interactions, optimizing the processing queue scheduling of resource management nodes, and ensuring that lock resources are ready in advance when query execution threads access data blocks, thereby minimizing the blocking waiting time of execution threads and improving the overall query throughput efficiency of the cluster.

[0041] In some embodiments of the present invention, such as Figure 5 As shown, asynchronous acquisition of cache consistency lock authorization includes: Step S301: Receive the authorization decision result returned for the cache consistency lock prefetch request. The authorization decision result includes the authorization status and authorization information corresponding to each target data block in the prefetch request list. If the authorization status of the target data block is successful, the authorization information includes at least one of the following: authorization sequence number, validity period, lock mode, and authorization timestamp. If the authorization status of the target data block is failed, the authorization information includes a failure reason identifier.

[0042] Step S302: For the target data block that was successfully authorized, update the cache consistency lock of the database shared cluster according to the authorization information. For the target data block that failed to be authorized, mark the corresponding prefetch status as failed.

[0043] In this embodiment of the invention, the node receives the authorization decision result returned by the resource management node. For the target data block that is successfully authorized, the node updates the metadata such as the status, authorization sequence number, and validity period of the local cache consistency lock according to the authorization information, so that the lock resource is ready before the query thread actually accesses it. For the target data block that fails to be authorized, the corresponding prefetch status is marked as failed instead of blocked waiting or terminated query. This avoids the thread from being suspended for a long time due to the failure of a single lock authorization, and retains the flexibility of subsequent on-demand retry or degradation processing. Thus, under the premise of ensuring global consistency, the interference of lock prefetch failure on the main query process is effectively isolated, and the fault tolerance and execution stability of the cluster in large-scale concurrency scenarios are enhanced.

[0044] In some embodiments of the present invention, such as Figure 5 As shown, after marking the corresponding prefetch state as failed, the data prefetching method for the database shared cluster also includes: Step S303: Determine the retry interval based on the failure reason identifier, and send a synchronization lock request after the retry interval. The synchronization lock request carries the identity identifier of the target data block and the lock request mode.

[0045] Step S304: If the authorization decision result returned by the database shared cluster management node is not obtained within the preset number of retries, or if the authorization decision result is authorization failure, stop retries and return an access failure message. The access failure message includes the identity identifier of the target data block and the failure reason identifier.

[0046] In this embodiment of the invention, after a prefetch request authorization fails, a retry interval is dynamically determined based on the failure reason identifier. After this retry interval, a synchronous lock request carrying the target data block identifier and the lock request mode is sent, achieving a smooth degradation from asynchronous prefetching to synchronous compensation in failure scenarios. In other words, for a target data block where authorization has failed, a synchronous blocking lock acquisition mechanism is used when accessing the target data block to ensure the querying of the target data.

[0047] Meanwhile, by setting a maximum number of retries, if authorization is not obtained within the limit or an authorization failure result is received again, the retries will be terminated and an access failure message containing the identity identifier and the reason for failure will be returned. This provides a reasonable self-repair opportunity in scenarios of network jitter or momentary lock contention, and avoids long-term thread blocking and unnecessary resource consumption caused by infinite retries. It effectively ensures the controllable termination and rapid feedback of the query execution process, and improves the robustness and operational observability of the system in high-concurrency lock contention environments.

[0048] In some embodiments of the present invention, such as Figure 6 As shown, the data prefetching methods for a database shared cluster include: Step S510: The requesting node predicts the target data blocks to be accessed. During query execution, the target data blocks to be accessed are predicted according to the query plan. That is, in response to the start of the query task, the expected data access sequence corresponding to the query task is obtained, and one or more target data blocks to be accessed are determined according to the expected data access sequence.

[0049] Step S520: Obtain the buffer. When any node in the cluster accesses data, it needs to obtain a buffer to hold the accessed data. The SQL service process of the requesting node checks whether the target data block already exists in the buffer. If the target data block already exists, the prefetching of the corresponding cache consistency lock is canceled; otherwise, a buffer is obtained, and the corresponding cache consistency lock is prefetched. In some embodiments, it is also necessary to determine whether the corresponding cache consistency lock has expired. If the cache consistency lock has expired, the corresponding cache consistency lock needs to be prefetched.

[0050] Step S530: The requesting node pre-requests a cache consistency lock. The SQL service process of the requesting node sends a cache consistency lock prefetch request to the communication process of this node, which then forwards the cache consistency lock prefetch request to the communication process of the corresponding management node.

[0051] Step S540: Management Node Authorization. Upon receiving a cache consistency lock prefetch request, the management node's communication process checks the corresponding global cache consistency lock information and processes it. If no holding node exists or it doesn't need to be forwarded to a holding node, the processing result is returned to the requesting node; otherwise, the cache consistency lock prefetch request is forwarded to all holding nodes for processing. After processing, the holding nodes return the processing result to the requesting node.

[0052] Step S550: The requesting node receives a reply. After receiving a reply from the management node or the holding node, the requesting node's communication process stores the received information in the corresponding local cache consistency lock. If there are multiple holding nodes, processing continues only after receiving reply messages from all holding nodes.

[0053] Step S560: The requesting node updates its local cache consistency lock. After receiving the reply message, the communication process updates the local cache consistency lock based on the received information and sends an authorization confirmation message to the management node's communication process.

[0054] Step S570: The management node updates the global cache consistency lock. After receiving the message, the management node's communication process updates the global cache consistency lock information to complete the authorization.

[0055] Step S580: The requesting node wakes up the SQL service process waiting for authorization. It checks if any SQL service process is waiting to acquire a cache consistency lock; if so, it wakes the waiting process; otherwise, the process ends.

[0056] In step S590, the SQL service process accesses the data in the target data block. When query execution requires access to this data, it accesses it directly, avoiding waiting for cache consistency lock authorization.

[0057] The flowchart provided in this embodiment is not intended to indicate that the operations of the method will be performed in any particular order, or that all operations of the method are included in every case. Furthermore, the method may include additional operations. Within the scope of the technical concept provided by the method in this embodiment, additional variations can be made to the above method.

[0058] It should be understood that in some embodiments, the components may be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods may be implemented using software or firmware stored in memory and executed by a suitable instruction execution system.

[0059] This embodiment also provides a computer program product 10, a computer-readable storage medium 20, and a computer device 30. Figure 7 This is a schematic diagram of a computer program product 10 according to an embodiment of the present invention. Figure 8 This is a schematic diagram of a computer-readable storage medium 20 according to an embodiment of the present invention. Figure 9 This is a schematic diagram of a computer device 30 according to an embodiment of the present invention. The computer program product 10 includes a computer program 11, which, when executed by the processor 32, implements the steps of the data prefetching method for the database shared cluster described above. A computer-readable storage medium 20 stores the computer program 11 thereon, which, when executed by the processor 32, implements the steps of the data prefetching method for the database shared cluster described above. The computer device 30 may include a memory 31, a processor 32, and the computer program 11 stored on the memory 31 and running on the processor 32.

[0060] The computer program 11 used to perform the operations of this invention may be assembly instructions, Instruction Set Architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, integrated circuit configuration data, or source code or object code written in any combination of one or more programming languages ​​and procedural programming languages. The computer program 11 may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer. In some embodiments, to perform aspects of this invention, electronic circuits, including, for example, programmable logic circuits, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), may execute computer-readable program instructions to personalize the electronic circuits by utilizing status information of the computer-readable program instructions.

[0061] For the purposes of this embodiment, computer program product 10 is a related product that includes computer program 11.

[0062] For the purposes of this embodiment, computer-readable storage medium 20 is a tangible device capable of holding and storing a computer program 11. It can be any device capable of containing, storing, communicating, propagating, or transmitting the program 11 for use by or in conjunction with an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable storage medium 20 include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable optical disc read-only memory (CD-ROM), digital versatile disc (DVD), memory stick, floppy disk, mechanical encoding device, and any suitable combination thereof.

[0063] Computer device 30 can be, for example, a server, desktop computer, laptop computer, tablet computer, or smartphone. In some examples, computer device 30 can be a cloud computing node. Computer device 30 can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules can include routines, programs, object programs, components, logic, data structures, etc., that perform specific tasks or implement specific abstract data types. Computer device 30 can be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can reside on local or remote computing system storage media, including storage devices.

[0064] Computer device 30 may include a processor 32 adapted to execute stored instructions and a memory 31 that provides temporary storage space for the operation of instructions during operation. The processor 32 may be a single-core processor, a multi-core processor, a computing cluster, or any other configuration. The memory 31 may include random access memory (RAM), read-only memory, flash memory, or any other suitable storage system.

[0065] Computer device 30 may also include a network adapter / interface and an input / output (I / O) interface. The I / O interface allows external devices that can be connected to the computer device to input and output data. The network adapter / interface provides communication between the computer device and a network, typically represented as a communication network.

[0066] Therefore, those skilled in the art should recognize that although numerous exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications conforming to the principles of the present invention can be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the invention. Thus, the scope of the present invention should be understood and construed as covering all such other variations or modifications.

Claims

1. A data prefetching method for a database shared cluster, characterized in that, include: In response to the initiation of a query task, the expected data access sequence corresponding to the query task is obtained, and one or more target data blocks to be accessed are determined based on the expected data access sequence. Initiate a cache consistency lock prefetch request for the target data block, wherein the cache consistency lock prefetch request is used to pre-acquire the cache consistency lock authorization of the target data block before accessing the target data block; After initiating the cache consistency lock prefetch request, the cache consistency lock authorization is obtained asynchronously, and data access operations for the target data block are performed based on the obtained cache consistency lock authorization.

2. The data prefetching method for a database shared cluster according to claim 1, characterized in that, Obtaining the expected data access sequence corresponding to the query task includes: Obtain the data access path description information for the query task; Based on the data scanning order and / or connection order indicated by the data access path description information, the access order of the target data blocks to be accessed during the execution of the query task is determined, and the information of the target data blocks is organized into the expected data access sequence according to the access order, wherein the information of the target data blocks includes identity identifier and distribution location.

3. The data prefetching method for a database shared cluster according to claim 1, characterized in that, Before initiating a cache consistency lock prefetch request for the target data block, the process also includes: Query whether the target data block has been stored in the buffer area of ​​the database shared cluster; Since the target data block has been stored in the buffer area and the corresponding cache consistency lock is in a valid state, it is determined that there is no need to initiate the cache consistency lock prefetch request. In response to the fact that the target data block has been stored in the buffer area and the corresponding cache consistency lock is in an invalid state, it is determined that the cache consistency lock prefetch request needs to be initiated. In response to the fact that the target data block is not stored in the buffer area, it is determined that the cache consistency lock prefetch request needs to be initiated.

4. The data prefetching method for a database shared cluster according to claim 1, characterized in that, Initiating a cache consistency lock prefetch request for the target data block includes: The request lock mode corresponding to the target data block is determined based on the query operation type of the target data block. If the query operation type is a read-only operation, the request lock mode is a shared lock; if the query operation type is a write operation or an update operation, the request lock mode is a mutex lock. Based on the identity of the target data block and the request lock mode, a cache consistency lock prefetch request is generated.

5. The data prefetching method for a database shared cluster according to claim 4, characterized in that, Generating the cache consistency lock prefetch request based on the identity of the target data block and the request lock mode includes: The identity and distribution location of the target data block are associated and mapped with the request lock mode of the target data block to generate a prefetch request list; The priority order of each prefetch request in the prefetch request list is determined according to the access order of the target data block; The cache consistency lock prefetch request is generated based on the prefetch request list and the priority order of each prefetch request.

6. The data prefetching method for a database shared cluster according to claim 1, characterized in that, Asynchronously acquiring the cache consistency lock authorization includes: The system receives an authorization decision result returned in response to the cache consistency lock prefetch request. The authorization decision result includes the authorization status and authorization information corresponding to each target data block in the prefetch request list. If the authorization status of the target data block is successful, the authorization information includes at least one of authorization sequence number, validity period, lock mode, and authorization timestamp. If the authorization status of the target data block is failed, the authorization information includes a failure reason identifier. For the target data block that has been successfully authorized, update the cache consistency lock of the database shared cluster according to the authorization information; For the target data block where authorization failed, the corresponding prefetch status is marked as failed.

7. The data prefetching method for a database shared cluster according to claim 6, characterized in that, After marking the corresponding prefetch state as failed, the following is also included: The retry interval is determined based on the failure reason identifier, and a synchronization lock request is sent after the retry interval; the synchronization lock request carries the identity identifier of the target data block and the lock request mode; If the authorization decision result is not obtained from the database shared cluster management node within the preset number of retries, or if the authorization decision result is an authorization failure, the retries will stop and an access failure message will be returned. The access failure message includes the identity identifier of the target data block and the failure reason identifier.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the data prefetching method for a database shared cluster as described in any one of claims 1 to 7.

9. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the data prefetching method for a database shared cluster as described in any one of claims 1 to 7.

10. A computer device, characterized in that, The system includes a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the data prefetching method for a database shared cluster as described in any one of claims 1 to 7.