Method for refreshing memory data and database system

By offloading refresh operations to back-end computing nodes, the problem of performance jitter and extended fault restart time caused by memory data refresh in the database is solved, achieving more efficient data persistence and fast fault recovery.

CN118760478APending Publication Date: 2024-10-11HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310308949.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-27
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

In the database, when the amount of memory data exceeds a certain threshold, the process of refreshing the memory data to the disk will occupy the central processor resources of the front-end business node, causing performance jitters, and leading to a long startup time due to the accumulation of pre-written logs when a fault restarts. .

Method used

The refresh operation is offloaded to the back-end computing node, and the data is read from the shared disk and written to the disk through the second computing node to avoid excessive load on the front-end business node and reduce the startup time when a failure occurs and restarts.

Benefits of technology

It effectively avoids performance jitters and extended fault restart times of front-end business nodes, and improves database performance and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760478A_ABST
    Figure CN118760478A_ABST
Patent Text Reader

Abstract

The invention provides a method for refreshing memory data, and belongs to the technical field of databases. The method is applied to a database system adopting a shared storage architecture and comprises the steps that a second computing node reads data from a pre-write log in a shared disk, and the data is stored as a first data file in a memory of a first computing node; the second computing node writes the data into a second data file in the shared disk; when the second computing node meets the target condition, an identifier is provided for the first computing node, and the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node; and the first computing node distinguishes the first data file from the memory of the first computing node according to the identifier, and deletes the first data file. According to the method, the flush operation is unloaded to the rear-end computing node, so that the problems of high load and delay jitter of the foreground service node caused by the flush operation are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of database technology, and in particular to a method for refreshing memory data, a database system, a computing device cluster, a computer-readable storage medium, and a computer program product. Background Art

[0002] When using the database, when the amount of data stored in the memory exceeds a certain threshold, the data in the memory will be transferred to the disk. This process is called flushing the memory data. Usually, the database will start a background thread on the foreground business node to perform the flush operation, but the background thread will still occupy a part of the central processing unit resources of the foreground business node, making the foreground business node overloaded, which can easily cause database performance jitter and affect the execution of foreground read and write tasks. In addition, when the amount of memory data is large, since the background thread cannot flush the memory data to the disk in time, when the database restarts due to a failure, it needs to first read the data from the write-ahead log (WAL) to the memory, and then flush the data from the memory to the disk. This process takes a lot of time and directly affects the fault recovery time of the service. Summary of the invention

[0003] The present application provides a method for refreshing (flushing) memory data, by offloading the flush operation to the back-end computing node, avoiding the impact of the flush operation on the foreground business node, and at the same time, the back-end computing node can flush the data in the memory of the foreground business node to the disk more timely, avoiding the problem of long startup time caused by the accumulation of write-ahead logs (WAL) when the foreground business node fails and restarts. The present application also provides a corresponding database system, a computing device cluster, a computer-readable storage medium, and a computer program product.

[0004] In a first aspect, the present application provides a method for flushing memory data. The method is applied to a database system, the database system comprising a first computing node, a second computing node, and a shared disk shared by the first computing node and the second computing node, the shared disk being used to store a write-ahead log and a second data file accessed by the first computing node and the second computing node.

[0005] Specifically, the method includes:

[0006] The second computing node reads data from the write-ahead log in the shared disk, the data being stored as a first data file in the memory of the first computing node;

[0007] The second computing node writes the data into a second data file in the shared disk;

[0008] When the target condition is met, the second computing node provides the identifier to the first computing node, where the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node;

[0009] The first computing node distinguishes the first data file from the memory of the first computing node according to the identifier, and deletes the first data file.

[0010] Before the second computing node reads the data from the write-ahead log in the shared disk, the method further includes:

[0011] The first computing node writes the data into a write-ahead log in a shared disk;

[0012] The first computing node stores the data in the memory of the first computing node as a first data file.

[0013] In a possible implementation, when the target condition is met, the second computing node provides an identifier to the first computing node, where the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node, specifically including:

[0014] The second computing node provides the identifier to the first computing node at a target time interval, and the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node.

[0015] In another possible implementation, when the target condition is met, the second computing node provides an identifier to the first computing node, where the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node, specifically including:

[0016] When the data volume of the second data file exceeds the target threshold, the second computing node provides the identifier to the first computing node, and the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node.

[0017] In a second aspect, the present application provides a database system, the database system comprising a first computing node, a second computing node, and a shared disk shared by the first computing node and the second computing node, the shared disk being used to store a write-ahead log and a second data file accessed by the first computing node and the second computing node, wherein:

[0018] A second computing node, configured to read data from the write-ahead log in the shared disk, the data being stored as a first data file in the memory of the first computing node;

[0019] A second computing node, used for writing the data into a second data file in the shared disk;

[0020] The second computing node is used to provide an identifier to the first computing node when the target condition is met, wherein the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node;

[0021] The first computing node is used to distinguish the first data file from the memory of the first computing node according to the identifier, and delete the first data file.

[0022] In addition, in the database system, the first computing node is also used for:

[0023] Writing the data into a write-ahead log in a shared disk;

[0024] The data is stored in the memory of the first computing node as a first data file.

[0025] In a possible implementation, the second computing node is used to provide an identifier to the first computing node at target time intervals, where the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node.

[0026] In another possible implementation, the second computing node is used to provide an identifier to the first computing node when the target condition is met, and the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node.

[0027] In a third aspect, the present application provides a computing device cluster, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes a method for refreshing memory data as provided in the first aspect or any possible implementation of the first aspect.

[0028] In a fourth aspect, the present application provides a computer program product comprising instructions, which, when executed by a computing device cluster, enables the computing device cluster to execute a method for flushing memory data as provided in the first aspect or any possible implementation of the first aspect.

[0029] In a fifth aspect, the present application provides a computer-readable storage medium comprising computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes a method for flushing memory data as provided in the first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 It is a schematic diagram of the architecture of a database system provided in an embodiment of the present application.

[0031] Figure 2 It is a flowchart of a method for refreshing memory data provided in an embodiment of the present application.

[0032] Figure 3 It is a schematic diagram of a computing device provided in an embodiment of the present application.

[0033] Figure 4 It is a schematic diagram of a computing device cluster provided in an embodiment of the present application.

[0034] Figure 5 It is a schematic diagram of an implementation method of a computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] The technical solution provided by the present application will be described in detail below in conjunction with the accompanying drawings.

[0036] In order to make the technical solution provided by the present application clearer, before describing the technical solution provided by the present application in detail, the relevant terms are first explained.

[0037] (1) Write Ahead Log (WAL): It is a log commonly used in database systems to record data operations and is used to ensure the atomicity and persistence of data operations. In a database that uses WAL, all operations that update the database (such as write operations, delete operations, etc.) need to be recorded in a log file before execution. The log file is the WAL. The WAL records each operation that updates the database and the timestamp and operation sequence number corresponding to each operation. The maximum amount of data contained in each WAL can be pre-set by the technician. When the amount of data corresponding to a WAL reaches the data volume threshold pre-set by the technician, the WAL can be archived.

[0038] (2) Memtable: A data structure that stores data in memory before it is written to disk. New data written to memory will always be stored in the memtable. There is often a threshold for the amount of data that a memtable can store. When a memtable is full, it becomes a read-only memtable (immutable memtable), which means that the data in the memtable needs to be flushed to disk and a new memtable will be created.

[0039] (3) Sorted Strings Table (SST): It is a data structure that stores data on disk when data in memory is written to disk. Newly written data on disk will be stored in SST files, which are persistent, ordered, and immutable file formats. The data in SST files are stored in the form of key-value pairs, where the key and value can be any string. SST files provide operations to find the value associated with a specified key or traverse all key-value pairs within a specified key range.

[0040] (4) Refresh (flush) memory data: During the use of the database, the data written by the user will first be written to the write-ahead log (WAL) on the disk, and then written to the memory table (Memtable) in the memory. When the amount of data in the Memtable or the amount of data in the WAL exceeds a certain threshold, the data in the Memtable will be transferred to the SST file on the disk. This process is called refreshing (flush) memory data. After all the data in a Memtable is transferred to the SST file on the disk, the Memtable in the memory can be deleted to free up space in the memory for writing new data.

[0041] (5) Metadata: refers to information that describes data attributes, including information about the organization of data, data domains, and the relationship between data, which is used to support functions such as indicating data storage location, data search, and file records. Simply put, metadata is data that describes data, which can describe the content and location of data, thereby achieving the purpose of assisting in data retrieval when accessing data. For example, in an embodiment of the present application, the metadata information of the data in the shared disk records the content of the data in all WAL and SST files stored in the shared disk, the timestamp of the data, and the serial number of the data.

[0042] The following is a brief description of the application scenarios and system architecture involved in the embodiments of the present application.

[0043] The embodiments of the present application relate to a scenario in which a database refreshes memory data to a disk for data persistence. Figure 1 The following is an exemplary diagram of the architecture of a database system provided by the present application. Figure 1As shown, the database system 100 includes a first computing node 110, a second computing node 120 and a shared disk 130, and the shared disk 130 can be accessed by the first computing node 110 and the second computing node 120. Among them, a database instance is deployed on the first computing node 110 and the second computing node 120, and a user can operate the database through the database instance. The first computing node 110 and the second computing node 120 can be a physical node such as a computer, or a logical node on a computer. The computer includes but is not limited to devices such as a terminal or a server. The logical node on the computer can be obtained by virtualization, for example, the logical node on the computer can be a virtual machine or a container on the computer.

[0044] The memory 112 of the first computing node 110 stores immutable Memtable 114, immutableMemtable 116, and Memtable 118. Among them, Memtable 114 containing only data A has been filled and transformed into immutable Memtable 114; Memtable 116 containing only data B and data C has been filled and transformed into immutable Memtable 116; Memtable 118 has been written with data D but has not yet been filled. Data A, data B, data C, and data D are written into the memory 112 in sequence, with data A being written into the memory 112 first and data D being written into the memory 112 last.

[0045] The shared disk 130 stores the WAL 132 and the SST file 134, and the first computing node 110 and the second computing node 120 can access the data from the WAL 132 and the SST file 134 through the shared disk 130. Data A, data B, data C, and data D are all written to the WAL 132 in the shared disk before being written to the memory 112 by the first computing node 110; when the data in the memory 112 of the first computing node 110 is flushed to the shared disk 130, data A, data B, data C, and data D are all flushed to the SST file 134. Data A, data B, data C, and data D are written to the SST file 134 in sequence, and data A is written to the SST file 134 first, and data D is written to the SST file 134 last.

[0046] In the prior art, when it is necessary to flush the data in the memory 112 of the first computing node 110 to the shared disk 130, the database will start a background thread on the first computing node 110 to perform the flush operation, but the background thread will still occupy a part of the central processing unit resources of the first computing node 110, which is easy to make the load of the first computing node 110 too high, affecting the execution speed of the first computing node 110 for the read and write tasks, thereby causing database performance jitter. In addition, when the amount of data in the memory 112 is large, since the background thread cannot flush all the data in the memory 112 to the shared disk 130 in time, when the database fails to restart, the first computing node 110 needs to first read the data from the WAL stored in the shared disk 130 to the memory 112 of the first computing node 110, and then flush the data from the memory 112 to the shared disk 130. This process will take a lot of time and slow down the service failure recovery speed.

[0047] To this end, this application is Figure 1 The database system 100 shown provides a method for refreshing memory data. In the method, the second computing node 120 will build a partnership with the first computing node 110, and the second computing node 120 will flush the data in the memory 112 of the first computing node 110 to the shared disk 130. Specifically, the second computing node 120 builds a partnership with the first computing node 110 in the following manner: before the second computing node 120 performs the flush operation, the first computing node 110 will first register its own information with the second computing node 120, so that the second computing node 120 obtains the storage path of the WAL 132 written by the first computing node 110 in the shared disk 130, and obtains the metadata information of the data in the shared disk 130. In addition, in the embodiment of the present application, the first computing node 110 has read and write permissions to the WAL 132 and read-only permissions to the SST file 134; the second computing node 120 has read-only permissions to the WAL 132 and read and write permissions to the SST file 134.

[0048] An embodiment of the present application provides a method for refreshing (flushing) memory data, which offloads the operation of flushing the data in the memory 112 of the first computing node 110 to the second computing node 120, thereby avoiding the problem of excessive load on the first computing node 110 and delay jitter when the first computing node 110 performs read and write tasks due to the flush operation. At the same time, the second computing node 120 can flush the data in the memory 112 of the first computing node 110 to the disk more promptly, thereby avoiding the problem of long startup time caused by WAL accumulation in the shared disk 130 when the first computing node 110 restarts due to a failure.

[0049] Next, combine Figure 2 The flowchart shown in the figure describes in detail a method for flushing memory data provided by the present application, which is applied to Figure 1 The database system shown specifically includes the following steps S201 to S206.

[0050] Step S201: The first computing node writes data to a write-ahead log in a shared disk.

[0051] When the first computing node receives a write request, it will first write the data to the write-ahead log in the shared disk. For example, when the first computing node 110 receives a write request for data A, the first computing node 110 will first write data A to the WAL 132 in the shared disk 130.

[0052] Step S202: The first computing node stores the data in the memory of the first computing node as a first data file.

[0053] For example, the first computing node 110 writes data A to the Memtable 114 in the memory 112 of the first computing node 110 according to the above write request for data A, and after data A is written to the Memtable 114, the Memtable 114 is filled and converted to the immutable Memtable 114, that is, the immutable Memtable 114 only contains data A. In the embodiment of the present application, the first data file refers to the immutable Memtable 114.

[0054] Step S203: the second computing node reads the data from the write-ahead log in the shared disk.

[0055] Because the first computing node writes the data to the WAL in the shared disk before writing the data to the memory of the first computing node, and the second computing node can access the data in the WAL through the shared disk, when the data in the memory of the first computing node needs to be flushed to the shared disk, the second computing node can directly read the data to be flushed from the WAL in the shared disk. For example, when the Memtable 114 containing only data A in the memory 112 of the first computing node 110 needs to be flushed to the shared disk 130, the second computing node 120 first reads data A from the WAL 132 in the shared disk 130.

[0056] Step S204: the second computing node writes the data into a second data file in the shared disk.

[0057] For example, the second computing node 120 writes data A to the SST file 134 in the shared disk 130. In the embodiment of the present application, the second data file is the SST file 134. In other possible embodiments, the second data file may be one or more SST files.

[0058] Step S205: When the target condition is met, the second computing node provides an identifier to the first computing node, where the identifier is used by the first computing node to distinguish the first data file from the memory of the first computing node.

[0059] Since the amount of data that can be stored in the memory is limited, after the old data in the memory is written to the shared disk, the old data in the memory can be deleted to release space in the memory for writing new data. This is the significance of flushing memory data in the database.

[0060] In actual applications, on the one hand, the first computing node will continue to respond to new write requests and write new data to the WAL in the shared disk and the memory of the first computing node; on the other hand, the second computing node will continue to read the newly written data of the first computing node from the WAL in the shared disk and write the data to one or more SST files in the shared disk. Usually, the second computing node will not immediately notify the first computing node to delete the first data from the memory of the first computing node after writing the first data to the shared disk. The second computing node will notify the first computing node to delete the multiple data or one or more immutable Memtables composed of part of the multiple data from the memory of the first computing node after writing multiple data to the shared disk.

[0061] Specifically, in an embodiment of the present application, when the target condition is met, the second computing node needs to provide the first computing node with an identifier for the first computing node to distinguish the first data file from the memory of the first computing node, so that the first computing node can delete the corresponding first data file according to the identifier.

[0062] For example, after writing data A to the SST file 134 in the shared disk 130, the second computing node 120 also writes data B, data C, and data D to the SST file 134 in the shared disk 130 in sequence. Moreover, after data B is written to the SST file 134 in the shared disk 130, the target condition has been met, and the second computing node 120 then notifies the first computing node 110 to delete the immutable Memtable that meets the condition from the memory 112 of the first computing node 110, and all the data in these immutable Memtables have been flushed to the shared disk 130.

[0063] In an embodiment of the present application, when the second computing node 120 notifies the first computing node 110 to delete the qualified immutable Memtable from the memory 112 of the first computing node 110 after writing the data B to the SST file 134 in the shared disk 130, firstly, the Memtable 118 where the data D is located has not been fully written, that is, the Memtable 118 is still mutable, and secondly, the data C in the immutable Memtable 116 has not been flushed to the shared disk 130, so the only immutable Memtable that meets the conditions is the immutable Memtable 114, that is, the first data file in step S202.

[0064] In an optional implementation, the second computing node provides the first computing node with an identifier used for the first computing node to distinguish the first data file from the memory of the first computing node at a target time interval.

[0065] In another optional implementation, when the data volume of the second data file exceeds a target threshold, the second computing node provides the first computing node with an identifier for the first computing node to distinguish the first data file from the memory of the first computing node.

[0066] In practical applications, the identifier used for the first computing node to distinguish the first data file from the memory of the first computing node can be the maximum sequence number of all data written to the second data file. When the data is written to the SST file, it will be assigned a sequence number. The later the data is written, the larger the sequence number of the data. Therefore, according to the maximum sequence number, it can be determined that the data with a sequence number less than the maximum sequence number has been flushed to the shared disk 130. In the embodiment of the present application, the sequence numbers of data A, data B, data C, and data D increase in sequence. After data B is written to the SST file 134 in the shared disk 130, the target condition has been met, and the second computing node 120 will provide the maximum sequence number of data A and data B, that is, the sequence number of data B, to the first computing node 110. Since the sequence numbers of all data contained in immutable Memtable 114, namely data A, are all less than the maximum sequence number, the first computing node 110 can determine that all data in immutable Memtable 114 has been flushed to the shared disk 130 based on the maximum sequence number, which further means that the first computing node 110 can determine that immutable Memtable 114 can be deleted based on the maximum sequence number. Immutable Memtable 116 contains data C, and the sequence number of data C is greater than the sequence number of data B, indicating that the data in immutable Memtable 116 has not been fully flushed to the shared disk 130, so the first computing node 110 determines that immutable Memtable 116 does not need to be deleted. Similarly, the first computing node 110 can determine that Memtable 118 does not need to be deleted.

[0067] Specifically, after the second computing node 120 writes data A, data B, data C, and data D to the shared disk 130, the second computing node 120 will record the metadata update information of the data in the shared disk 130. The metadata update information records the maximum sequence numbers of data A, data B, data C, and data D. Therefore, the second computing node 120 can provide the maximum sequence numbers of data A, data B, data C, and data D to the first computing node 110 by synchronizing the metadata update information to the first computing node 110.

[0068] It should be noted that the identifier used by the first computing node to distinguish the first data file from the memory of the first computing node may also be other information that can be used to identify data except the serial number, and this application does not limit this.

[0069] Step S206: the first computing node distinguishes the first data file from the memory of the first computing node according to the above identifier, and deletes the first data file.

[0070] For example, after the first computing node 110 determines that all data in the immutableMemtable 114 has been flushed to the shared disk 130 based on the maximum sequence number of the data A and the data B, it deletes the immutable Memtable 114 .

[0071] The present application also provides a database system, which can be Figure 1 The database system 100 shown in FIG. 1 includes a first computing node, a second computing node, and a shared disk shared by the first computing node and the second computing node, wherein the shared disk is used to store a write-ahead log and a second data file for access by the first computing node and the second computing node, wherein:

[0072] a second computing node, configured to read data from the write-ahead log in the shared disk, the data being stored as a first data file in the memory of the first computing node;

[0073] A second computing node, used for writing the data into a second data file in the shared disk;

[0074] The second computing node is used to provide an identifier to the first computing node when the target condition is met, wherein the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node;

[0075] The first computing node is used to distinguish the first data file from the memory of the first computing node according to the identifier, and delete the first data file.

[0076] Before the second computing node reads data from the write-ahead log in the shared disk, the first computing node is further configured to:

[0077] Writing the data into the write-ahead log in the shared disk;

[0078] The data is stored in the memory of the first computing node as the first data file.

[0079] In a possible implementation, the second computing node is used to: provide the identifier to the first computing node at target time intervals, and the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node.

[0080] In another possible implementation, the second computing node is used to provide the identifier to the first computing node when the data volume of the second data file exceeds a target threshold, and the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node.

[0081] Specifically, the specific implementation of various operations of the method for refreshing memory data by the database system provided in the above embodiment can refer to the description of the relevant content in the above method embodiment, which will not be repeated here.

[0082] In the embodiment of the present application, the first computing node and the second computing node in the above database system can be implemented by software or hardware. The implementation of the first computing node and the second computing node is introduced below by taking the first computing node as an example.

[0083] The first computing node may include code running on a computing instance. The computing instance may be at least one of a physical host (computing device), a virtual machine, a container, and other computing devices. Furthermore, the computing device may be one or more. For example, the first computing node may include code running on multiple hosts, or virtual machines, or containers. It should be noted that the multiple hosts, or virtual machines, or containers used to run the code may be distributed in the same AZ or in different AZs, and each AZ includes a data center or multiple data centers with similar geographical locations. The multiple hosts, or virtual machines, or containers used to run the code may be distributed in the same region or in different regions. Typically, a region may include multiple AZs, and a VPC is set in a region. Cross-region communication between two VPCs in the same region and between VPCs in different regions requires the setting of a communication gateway in each VPC, and the interconnection between VPCs is realized through the communication gateway.

[0084] Similarly, multiple hosts or virtual machines or containers for running the code may be distributed in the same VPC or in multiple VPCs, wherein usually a region may include multiple AZs.

[0085] The first computing node may include at least one computing device, such as a server, etc. Alternatively, the first computing node may also be a device implemented using ASIC or PLD, etc. The PLD may be implemented using CPLD, FPGA, GAL or any combination thereof.

[0086] The multiple computing devices included in the first computing node can be distributed in the same AZ or in different AZs. The multiple computing devices included in the node can be distributed in the same region or in different regions. Similarly, the multiple computing devices included in the node can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0087] The present application also provides a computing device 300, Figure 3 300 is a schematic diagram of the structure of a computing device 300. The computing device 300 may be a master node or a standby node in the above embodiment, and includes: a bus 302, a processor 304, a memory 306, and a communication interface 308. The processor 304, the memory 306, and the communication interface 308 communicate with each other via the bus 302. The computing device 300 may be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 300.

[0088] The bus 302 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 The bus 302 may include a path for transmitting information between various components of the computing device 300 (eg, the memory 306, the processor 304, and the communication interface 308).

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

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

[0091] The memory 306 stores executable program codes, and the processor 304 executes the executable program codes to respectively implement the functions of the first computing node and the second computing node in the aforementioned database system, thereby implementing a method for flushing memory data. That is, the memory 306 stores instructions for executing a method for flushing memory data.

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

[0093] The present application also provides a computing device cluster, Figure 4 is a schematic diagram of the computing device cluster, which can implement the method of refreshing memory data in the above embodiment. Figure 4 As shown, the computing device cluster includes at least one Figure 3 The computing device 300 shown may be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device may also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.

[0094] Instructions for executing a method for flushing memory data may be stored in the memory 306 of one or more computing devices 300 in the computing device cluster. When at least one computing device in the computing device cluster executes the instruction, the computing device cluster may implement the method for flushing memory data as described in the embodiment.

[0095] In some possible implementations, the memory 306 of one or more computing devices 300 in the computing device cluster may also store partial instructions for executing the method for flushing memory data. In other words, the combination of one or more computing devices 300 may jointly execute the instructions for executing the method for flushing memory data.

[0096] It should be noted that the memory 306 in different computing devices 300 in the computing device cluster can store different instructions, which are respectively used to execute part of the functions of the database system. That is, the instructions stored in the memory 306 in different computing devices 300 can implement the functions of one or more nodes in the first computing node and the second computing node.

[0097] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Figure 5 A possible implementation is shown. Figure 5 As shown, two computing devices 300A and 300B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 306 in the computing device 300A stores instructions for the functions of the first computing node 110. At the same time, the memory 306 in the computing device 300B stores instructions for executing the functions of the second computing node 120.

[0098] It should be understood that Figure 5 The functions of the computing device 300A shown in FIG. 300A may also be completed by multiple computing devices 300. Similarly, the functions of the computing device 300B may also be completed by multiple computing devices 300.

[0099] The present application also provides a computer program product comprising instructions. The computer program product may be software or a program product comprising instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device is caused to execute a method of flushing memory data.

[0100] The present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute a method for flushing memory data, or instruct the computing device to execute a method for flushing memory data.

[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for flushing memory data, It is characterized in that The method is applied to a database system, the database system comprising a first computing node, a second computing node, and a shared disk shared by the first computing node and the second computing node, the shared disk being used to store a write-ahead log and a second data file accessed by the first computing node and the second computing node, the method comprising: The second computing node reads data from the write-ahead log in the shared disk, and the data is stored as a first data file in the memory of the first computing node; The second computing node writes the data into the second data file in the shared disk; When the target condition is met, the second computing node provides an identifier to the first computing node, where the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node; The first computing node distinguishes the first data file from the memory of the first computing node according to the identifier, and deletes the first data file.

2. The method according to claim 1, It is characterized in that Before the second computing node reads data from the write-ahead log in the shared disk, the method further includes: The first computing node writes the data into the write-ahead log in the shared disk; The first computing node stores the data in the memory of the first computing node as the first data file.

3. The method according to claim 1 or 2, It is characterized in that When the target condition is met, the second computing node provides an identifier to the first computing node, where the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node, including: The second computing node provides the identifier to the first computing node at a target time interval, and the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node.

4. The method according to claim 1 or 2, It is characterized in that When the target condition is met, the second computing node provides an identifier to the first computing node, where the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node, including: When the data volume of the second data file exceeds a target threshold, the second computing node provides the identifier to the first computing node, where the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node.

5. A database system, It is characterized in that The database system includes a first computing node, a second computing node, and a shared disk shared by the first computing node and the second computing node, wherein the shared disk is used to store a write-ahead log and a second data file accessed by the first computing node and the second computing node, wherein: The second computing node is used to read data from the write-ahead log in the shared disk, the data being stored as a first data file in the memory of the first computing node; The second computing node is used to write the data into the second data file in the shared disk; The second computing node is used to provide an identifier to the first computing node when a target condition is met, wherein the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node; The first computing node is used to distinguish the first data file from the memory of the first computing node according to the identifier, and delete the first data file.

6. The database system according to claim 5, It is characterized in that The first computing node is used to write the data into the write-ahead log in the shared disk; The first computing node is used to store the data as the first data file in the memory of the first computing node.

7. The database system according to claim 5 or 6, It is characterized in that The second computing node is used to provide the identifier to the first computing node at a target time interval, and the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node.

8. The database system according to claim 5 or 6, It is characterized in that The second computing node is used to provide the identifier to the first computing node when the data volume of the second data file exceeds a target threshold, and the identifier is used for the first computing node to distinguish the first data file from the memory of the first computing node.

9. A computing device cluster, It is characterized in that comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method for flushing memory data according to claims 1 to 4.

10. A computer program product comprising instructions, It is characterized in that When the instruction is executed by a computing device cluster, the computing device cluster executes the method for flushing memory data as claimed in claims 1 to 4.

11. A computer-readable storage medium, It is characterized in that The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method for flushing memory data according to claims 1 to 4.