Data processing method and device and computing equipment
By identifying and recording changes in data pages on the main data node, and using data pages for data backup and synchronization, the WAL backlog problem on the main data node is solved, data backup efficiency is improved, resource usage is reduced, and data synchronization is highly efficient. .
Patent Information
- Application Number
- CN202310126693.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-16
- Publication Date
- 2024-08-23
AI Technical Summary
The write-ahead log (WAL) backlog problem on the primary data node (DN) results in excessive disk usage and long data synchronization time. Especially when the backup data node fails or the data is massively modified, existing technology is difficult to effectively solve it.
By identifying and recording changes in data pages on the primary data node, data backup and synchronization are performed using data pages instead of relying on time sequences and events. The primary data node sends the changed data pages to the standby data node, and the standby data node is replaced. Corresponding data page, thereby achieving data synchronization, and continue to use WAL playback mode for data synchronization after the backup data node is restored.
It effectively solves the WAL backlog problem of the main data node, improves data backup efficiency, reduces the resource occupation of the main data node, and ensures data integrity.
Smart Images

Figure CN118535638A
Abstract
Description
Technical Field
[0001] The present application relates to the field of information technology (IT) technology, and in particular to a data processing method, device and computing equipment. Background Art
[0002] In order to avoid data loss on the primary data node (DN), data is often backed up on the backup data node (abbreviated as "backup DN"). Data backup between the primary DN and the backup DN is mainly performed through write ahead logging (WAL). Currently, after the backup DN fails for a long time and / or a large amount of data on the primary DN is modified, WAL backlog often occurs on the primary DN, which in turn causes excessive disk usage on the primary DN. At the same time, since WAL requires linear playback, when there is too much WAL backlog on the primary DN, it takes too long for the backup DN to synchronize data. Therefore, how to solve the problem of WAL backlog on the primary DN is a technical problem that urgently needs to be solved. Summary of the invention
[0003] The present application provides a data processing method, apparatus, computing device, computing device cluster, computer storage medium and computer product, which can solve the WAL backlog problem on the primary DN.
[0004] In the first aspect, the present application provides a data processing method, in which, when a standby data node fails or the amount of data modification in the database of the master data node within a preset time is greater than a preset value, the master data node identifies the data page where data has changed in the storage medium of the master data node based on the operation event recorded by at least one write-ahead log WAL generated by the master data node; the master data node records the data page where data has changed in the storage medium of the master data node; after the master data node writes the operation event recorded by at least one WAL into the storage medium of the master data node, it deletes at least one WAL; when synchronizing data between the master data node and the standby data node, the master data node sends all the data pages where data has changed in its own storage medium recorded by itself to the standby data node. Among them, after the standby data node obtains the data pages sent by the master data node, it can replace the data pages corresponding to these data pages in its storage medium with these data pages, thereby completing data synchronization. Exemplarily, the storage medium can be a local disk or a cloud disk, etc., and the database can be a local database or a cloud database, etc.
[0005] In this way, data changes are described in data pages instead of time sequence and events, so that multiple events can be described through one data page, and data backup can be performed through data copying, thereby solving the problem of WAL backlog in the master data node while ensuring that data backup can be performed. At the same time, data synchronization between the master and backup data nodes is achieved through data copying, which improves the efficiency of data backup. Exemplarily, the master data node can also be called the master DN.
[0006] In a possible implementation, in the case of a failure of the standby data node, at least one WAL is a WAL generated by the primary data node after the target log sequence number LSN, and the target LSN is the LSN of the latest WAL that the standby data node has written into the storage medium of the standby data node. That is to say, after the failure of the standby data node, the primary data node describes the data changes in the form of data pages, so that the size of the WAL in the primary data node is always maintained between the two LSNs, reducing the resources occupied by the WAL in the primary data node.
[0007] In a possible implementation, after the standby data node recovers from a failure, or after the user completes modifying the data in the database of the primary data node, data needs to be synchronized between the primary data node and the standby data node.
[0008] In a possible implementation, the method further includes: after the standby data node recovers from the failure, the master data node stops identifying the data page in which the data in the storage medium of the master data node has changed; after the master data node writes the operation event recorded in the target WAL into the storage medium of the master data node and sends the target WAL to the standby data node, the master data node deletes the target WAL, where the target WAL is the WAL generated by the master data node after the standby data node recovers from the failure. That is to say, after the standby data node recovers from the failure, data synchronization can continue to be performed by replaying the cause WAL.
[0009] In a possible implementation, the method further includes: when the operation actions described by the operation events recorded by the primary data node in the WAL corresponding to the data page associated with the target file are all target actions, the target file identifier and the target instruction generated based on the target action are sent to the standby data node; wherein the target action includes: creating, deleting or clearing, and the target instruction is creating a new target file, deleting a target file or clearing a target file. In this way, when a user deletes, creates or clears a file, the standby data node can quickly delete, create or clear the corresponding file during backup, thereby improving data backup efficiency.
[0010] In a possible implementation, the method further includes: the file path of the file associated with the data page in the storage medium of the master data node where data has changed, recorded by the master data node, and / or whether the operation actions described in the operation events recorded in the WAL corresponding to the data page associated with the same file where data has changed in the storage medium of the master data node are all target actions, and the target actions include: creating, deleting or clearing. This allows the location of the file where the data page has changed, and whether the corresponding file has been deleted, created or cleared, etc. to be quickly known.
[0011] In a possible implementation, the master data node records the data pages in the storage medium of the master data node where data has changed, specifically including: the master data node records the data pages in the storage medium of the master data node where data has changed through a bitmap, thereby saving storage space.
[0012] In a second aspect, the present application provides a data processing device, which can be deployed on a master data node. The device includes: an identification module, which is used to identify data pages with data changes in the storage medium of the master data node based on at least one write-ahead log WAL generated by the master data node when the standby data node fails or the amount of data modification in the database of the master data node within a preset time is greater than a preset value; a recording module, which is used to record data pages with data changes in the storage medium of the master data node; a processing module, which is used to delete at least one WAL after writing at least one WAL recorded operation event to the storage medium of the master data node; a synchronization module, which is used to send all data pages with data changes in the storage medium of the master data node recorded by the recording module to the standby data node when data synchronization is required between the master data node and the standby data node.
[0013] In one possible implementation, in the event of a failure of a standby data node, at least one WAL is a WAL generated by the primary data node after a target log sequence number LSN, where the target LSN is the LSN of the latest WAL that the standby data node has written to the storage medium of the standby data node.
[0014] In a possible implementation, after the standby data node recovers from a failure, or after the user completes modifying the data in the database of the primary data node, data needs to be synchronized between the primary data node and the standby data node.
[0015] In a possible implementation, the recording module is further used to stop identifying data pages with changed data in the storage medium of the primary data node after the standby data node recovers from a failure; the processing module is further used to write the operation events recorded by the target WAL into the storage medium of the primary data node in the processing module, and delete the target WAL after the synchronization module sends the target WAL to the standby data node, the target WAL being the WAL generated by the primary data node after the standby data node recovers from a failure.
[0016] In a possible implementation, the synchronization module is further used to: when the operation actions described by the operation events recorded in the WAL corresponding to the data page associated with the target file are all target actions, send the identifier of the target file and the target instruction generated based on the target action to the standby data node; wherein the target action includes: creating, deleting or clearing, and the target instruction is creating a new target file, deleting the target file or clearing the target file.
[0017] In one possible implementation, the recording module is further used to: record the file path of the file associated with the data page where data in the storage medium of the primary data node has changed, and / or, record whether the operation actions described in the operation events recorded in the WAL corresponding to the data page associated with the same file where data in the storage medium of the primary data node has changed are all target actions, and the target actions include: create, delete or clear.
[0018] In a possible implementation, when recording the data page where data in the storage medium of the primary data node has changed, the recording module is specifically configured to: record the data page where data in the storage medium of the primary data node has changed through a bitmap.
[0019] In a third aspect, the present application provides a computing device, comprising: at least one memory for storing programs; and at least one processor for executing the programs stored in the memory; wherein, when the program stored in the memory is executed, the processor is used to execute the method described in the first aspect or any possible implementation of the first aspect.
[0020] In a fourth 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 at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster performs the method described in the first aspect or any possible implementation of the first aspect.
[0021] In a fifth aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method described in the first aspect or any possible implementation of the first aspect.
[0022] In a sixth aspect, the present application provides a computer program product. When the computer program product runs on a processor, the processor executes the method described in the first aspect or any possible implementation of the first aspect.
[0023] It can be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a schematic diagram of the architecture of a data backup system provided in an embodiment of the present application;
[0025] Figure 2 This is a schematic diagram of a data backup process provided by an embodiment of the present application;
[0026] Figure 3 It is a flowchart of a data processing method provided in an embodiment of the present application;
[0027] Figure 4 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;
[0028] Figure 5 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0029] Figure 6 is a schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application;
[0030] Figure 7 It is a structural diagram of another computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] The term "and / or" in this article is a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The symbol " / " in this article indicates that the associated objects are in an or relationship, for example, A / B means A or B.
[0032] The terms "first" and "second" in the specification and claims herein are used to distinguish different objects rather than to describe a specific order of the objects. For example, a first response message and a second response message are used to distinguish different response messages rather than to describe a specific order of the response messages.
[0033] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0034] In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more than two. For example, multiple processing units refer to two or more processing units, etc.; multiple elements refer to two or more elements, etc.
[0035] For example, Figure 1 FIG. 1 shows a schematic diagram of the architecture of a data backup system. Figure 1 As shown, the data backup system 100 includes: a primary DN 110 and at least one backup DN 120. The primary DN 110 and each backup DN 120 are connected via a network. The data on the primary DN 110 can be synchronized to the backup DN 120 in a WAL manner. For data synchronization between the primary DN 110 and the backup DN 120, as shown in FIG. Figure 2 As shown, in S201, the two can first establish a connection through the transmission control protocol / internet protocol (TCP / IP) protocol. In S202, the backup DN120 can send the log sequence number (LSN) of the latest WAL written to the disk to the primary DN110. In S203, the primary DN110 compares the LSN of the latest WAL generated in it with the LSN obtained from the backup DN120. In S204, when the latest LSN in the primary DN110 is greater than the LSN obtained from the backup DN120, all WALs after the LSN obtained from the backup DN120 are sent to the backup DN120. In S205, the backup DN120 replays the WALs it receives to read the data in these WALs and write them to the physical disk. In this way, data synchronization between the primary and backup DNs is completed through WAL. For example, the WAL may record the user's operations on tables in the database. The database may be, but is not limited to, a local database or a cloud database. For example, the primary DN 110 may be referred to as a primary data node, and the backup DN 120 may be referred to as a backup data node.
[0036] Continue reading Figure 2After the connection between the primary DN110 and the backup DN120 is established, the backup DN120 can periodically send its own heartbeat information to the primary DN110. This allows the primary DN110 to understand the status of the backup DN120. When the primary DN110 learns that the backup DN120 has failed, the primary DN110 will store all WALs after the last LSN obtained from the backup DN120 before the failure of the backup DN120, so that data can be synchronized based on these WALs after the backup DN120 recovers from the failure. However, when the failure of the backup DN120 lasts for a long time, a large backlog of WALs will appear on the primary DN110, causing excessive resource usage on the primary DN110. At the same time, when the backup DN120 plays back the WAL, it needs to play back the LSN of each WAL in sequence (i.e., linear playback), and there are a lot of WALs, which makes it take a long time for the backup DN120 to synchronize data, making it difficult for the data in the backup DN120 to quickly catch up with the data in the primary DN110, and the data backup efficiency is low. Of course, after a large amount of data on the primary DN is modified, there will be a large backlog of WALs, which will also cause the above problems.
[0037] In view of this, an embodiment of the present application provides a data processing method that can describe data changes in the form of data pages rather than in time sequence and events, so that multiple events can be described through one data page, thereby solving the problem of WAL backlog in the main DN110 while ensuring that data backup can be performed.
[0038] For example, Figure 3 A schematic diagram of a data processing method provided in an embodiment of the present application is shown. Figure 3 The data processing method shown in the figure can be applied to the master DN 110 described above but is not limited thereto. The master DN 110 is referred to as the master data node and the backup DN 120 is referred to as the backup data node. Figure 3 As shown, the data backup method may include the following steps:
[0039] S301. When a standby data node fails or the amount of data modification in the database of the primary data node within a preset period of time is greater than a preset value, the primary data node identifies data pages where data changes occur in the storage medium of the primary data node based on an operation event of at least one WAL record generated by itself (i.e., the primary data node).
[0040] In this embodiment, when the standby data node fails or the amount of data modification in the database of the master data node within a preset time is greater than a preset value, the master data node can replay these WALs after generating WALs to write the data in these WALs to the storage medium of the master data node (such as a local disk or a cloud disk, etc.). Since the WAL records the user's operation events on the data in the database of the master data node, the master data node can parse the operation events recorded in each WAL during the playback of the WAL. Afterwards, the master data node can identify the data page where the data in the storage medium of the master data node has changed based on the data page required for each operation event. For example, when an operation event recorded in a WAL is to modify A in the 10th row of data in the 10th data page to B, the operation event can identify that the data page where the data in the storage medium has changed is the 10th data page.
[0041] In some embodiments, in the case of a failure of a standby data node, at least one WAL is a WAL generated by the primary data node after a target LSN, and the target LSN is the LSN of the latest WAL that the standby data node has written into the storage medium of the standby data node. That is to say, after the failure of the standby data node, the primary data node describes the data changes in the form of data pages, so that the size of the WAL in the primary data node is always maintained between the two LSNs, reducing the resources occupied by the WAL in the primary data node.
[0042] In some embodiments, the amount of data modification in the database of the master data node within a preset time period is greater than a preset value, which can be understood as a large amount of data in the database being modified within a short period of time.
[0043] S302: The master data node records the data page where data has changed in the storage medium of the master data node.
[0044] In this embodiment, after the master data node identifies the data pages in the storage medium of the master data node where data has changed, the master data node may record these data pages. For example, the page numbers of these data pages may be recorded. In addition, these data pages may be recorded through a changed block bitmap (CBM) to save storage space. Exemplarily, the CBM may also be referred to as a bitmap.
[0045] S303: After writing the operation event recorded in at least one WAL into the storage medium of the master data node, the master data node deletes at least one WAL.
[0046] In this embodiment, after recording the data page in which the data in the storage medium of the master data node has changed, the master data node can delete the at least one WAL after writing the operation event recorded in the at least one WAL to the storage medium of the master data node. In this way, the problem of WAL backlog in the master data node is avoided. At the same time, since the master data node has recorded which data pages have changed, the resources required for data synchronization will not be lost.
[0047] S304: When synchronizing data between the primary data node and the backup data node, the primary data node sends all data pages recorded by the primary data node and in which data changes occur in the storage medium of the primary data node to the backup data node.
[0048] In this embodiment, when synchronizing data between the primary data node and the backup data node, the primary data node can send all data pages recorded by the primary data node in the storage medium of the primary data node where data changes occur to the backup data node. After obtaining the data pages sent by the primary data node, the backup data node can use these data pages to replace the data pages corresponding to these data pages in its storage medium, thereby completing data backup by data copying and improving data backup efficiency. In some embodiments, after the backup data node recovers from a failure, or after the user completes the modification of the data in the database of the primary data node (for example, when a checkpoint is reached), data synchronization is required between the primary data node and the backup data node.
[0049] In this way, data changes are described in data pages instead of time sequence and events, so that multiple events can be described through one data page, and data backup can be performed through data copying, thus solving the problem of WAL backlog in the master data node while ensuring data backup. At the same time, data synchronization between the master and backup data nodes is achieved through data copying, which improves the efficiency of data backup.
[0050] In some embodiments, after the standby data node recovers from a failure, the master data node may stop identifying data pages in the storage medium of the master data node where data has changed. In addition, the master data node may delete the target WAL after writing the operation event recorded in the target WAL to the storage medium of the master data node and sending the target WAL to the standby data node. The target WAL is the WAL generated by the master data node after the standby data node recovers from a failure. In other words, after the standby data node recovers from a failure, data synchronization can continue to be performed by replaying the cause WAL.
[0051] In some embodiments, when recording the data pages in which data in the storage medium of the master data node has changed, the master data node may also record the correspondence between each data page and the corresponding WAL LSN. In this way, when data synchronization is required between the master data node and the standby data node, the master data node can query the data pages that need to be sent to the standby data node based on the latest WAL LSN that the standby data node has written to the disk before the standby data node fails and the latest WAL LSN that the master data node has generated before the standby data node recovers from the failure.
[0052] In some embodiments, in the aforementioned S302, the master data node may also record the file path of the file associated with the data page in the storage medium of the master data node where the data has changed, and / or record whether the actions described by the operation events recorded in the WAL corresponding to the data page in the storage medium where the data has changed and is associated with the same file are all new creation, deletion or clearing, etc. When all are new creation, the master data node may record the identifier of the file and the operation actions corresponding to all data pages related to the file (i.e. new creation). When all are deleted, the master data node may record the identifier of the file and the operation actions corresponding to all data pages related to the file (i.e. deletion). When all are cleared, the master data node may record the identifier of the file and the operation actions corresponding to all data pages related to the file (i.e. clearing). Exemplarily, when the operation actions corresponding to all data pages related to a certain file are all new creation, it indicates that the file is newly created; when the operation actions corresponding to all data pages related to a certain file are all deletion, it indicates that the file is deleted; when the operation actions corresponding to all data pages related to a certain file are all clearing, it indicates that the file is cleared. Exemplarily, the file path may be understood as the storage location of the file, which may include but is not limited to the folder to which the file belongs, the name of the file, and the like.
[0053] For example, when the 13th data page in file (file) 1 in the master data node is modified, the master data node can record it in the manner shown in Table 1. In Table 1, file_path is the file path, changed block bitmap is the changed block bitmap, is_create indicates whether the file is newly created, is_drop indicates whether the file is deleted, is_truncate indicates whether the file is emptied, and f corresponding to is_create indicates that file 1 is not newly created, f corresponding to is_drop indicates that file 1 is not deleted, and f corresponding to is_truncate indicates that file 1 is not emptied. When f corresponding to is_create is changed to T, it means that file 1 is newly created, that is, file 1 is newly created.
[0054]
[0055] Table 1
[0056] Furthermore, when the primary data node synchronizes data with the standby data node, if the operation actions described by the operation events recorded in the WAL corresponding to the data page associated with a certain file are all target actions, wherein the target actions include: creating, deleting or clearing, then the primary data node may also send the identifier of the file and the target instruction generated based on the target action to the standby data node, so that the standby data node operates on the file according to the target instruction. The target instruction is to create the file, delete the file or clear the file.
[0057] It is understandable that the size of the serial numbers of the steps in the above-mentioned embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0058] Based on the method in the above embodiment, the embodiment of the present application also provides a data processing device.
[0059] For example, Figure 4 FIG. 1 shows a schematic diagram of the structure of a data processing device. The data processing device can be deployed in the aforementioned main DN 110. Figure 4 As shown, the data processing device 400 may include: an identification module 401, a recording module 402, a processing module 403 and a synchronization module 404. Among them, the identification module 401 is used to identify the data pages with data changes in the storage medium of the primary data node based on the operation events recorded by at least one write-ahead log WAL generated by the primary data node when the standby data node fails or the amount of data modification in the database of the primary data node within a preset time is greater than a preset value. The recording module 402 is used to record the data pages with data changes in the storage medium of the primary data node. The processing module 403 is used to delete at least one WAL after writing the operation event recorded by at least one WAL to the storage medium of the primary data node. The synchronization module 404 is used to send all the data pages with data changes in the storage medium of the primary data node recorded by the recording module 402 to the standby data node when data synchronization is required between the primary data node and the standby data node.
[0060] In some embodiments, in the event of a failure of a standby data node, at least one WAL is a WAL generated by the primary data node after a target log sequence number LSN, where the target LSN is the LSN of the latest WAL that the standby data node has written to the storage medium of the standby data node.
[0061] In some embodiments, after the standby data node recovers from a failure, or after the user completes modifying the data in the database of the primary data node, data needs to be synchronized between the primary data node and the standby data node.
[0062] In some embodiments, the recording module 402 is further used to stop identifying data pages with data changes in the storage medium of the primary data node after the standby data node recovers from a failure. The processing module 403 is further used to delete the target WAL after the processing module 403 writes the operation event recorded in the target WAL to the storage medium of the primary data node and the synchronization module 404 sends the target WAL to the standby data node. The target WAL is the WAL generated by the primary data node after the standby data node recovers from a failure.
[0063] In some embodiments, the synchronization module 404 is also used to send the identifier of the target file and the target instruction generated based on the target action to the backup data node when the operation actions described by the operation events recorded in the WAL corresponding to the data page associated with the target file are all target actions; wherein the target action includes: creating, deleting or clearing, and the target instruction is to create a new target file, delete a target file or clear a target file.
[0064] In some embodiments, the recording module 402 is also used to: record the file path of the file associated with the data page where the data in the storage medium of the primary data node has changed, and / or, record the data in the storage medium of the primary data node and whether the operation actions described in the operation events recorded in the WAL corresponding to the data page associated with the same file are all target actions, and the target actions include: create, delete or clear.
[0065] In some embodiments, when recording the data page where data has changed in the storage medium of the primary data node, the recording module 402 is specifically configured to: record the data page where data has changed in the storage medium of the primary data node through a bitmap.
[0066] In some embodiments, the identification module 401, the recording module 402, the processing module 403 and the synchronization module 404 can be implemented by software or by hardware. Exemplarily, the implementation of the identification module 401 is described below by taking the identification module 401 as an example. Similarly, the implementation of the recording module 402, the processing module 403 and the synchronization module 404 can refer to the implementation of the identification module 401.
[0067] As an example of a software functional unit, the identification module 401 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the identification module 401 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple data centers with similar geographical locations. Among them, usually a region may include multiple AZs.
[0068] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0069] As an example of a hardware functional unit, the identification module 401 may include at least one computing device, such as a server, etc. Alternatively, the identification module 401 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logic device (CPLD), a field programmable gate array (FPGA), a general array logic (GAL), or any combination thereof.
[0070] The multiple computing devices included in the identification module 401 can be distributed in the same region or in different regions. The multiple computing devices included in the identification module 401 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the identification module 401 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.
[0071] It should be noted that, in other embodiments, the identification module 401 can be used to execute any step in the method described above, the recording module 402 can be used to execute any step in the method provided by the above embodiment, the processing module 403 can be used to execute any step in the method provided by the above embodiment, and the synchronization module 404 can be used to execute any step in the method provided by the above embodiment, or, the steps that the identification module 401, the recording module 402, the processing module 403 and the synchronization module 404 are responsible for implementing can be specified as needed, and all functions of the data processing device 400 are realized by respectively implementing different steps in the method provided by the above embodiment through the identification module 401, the recording module 402, the processing module 403 and the synchronization module 404.
[0072] The present application also provides a computing device 500. Figure 5 As shown, computing device 500 includes: bus 502, processor 504, memory 506 and communication interface 508. Processor 504, memory 506 and communication interface 508 communicate through bus 502. Computing device 500 can 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 computing device 500.
[0073] The bus 502 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 5 The bus 504 is represented by only one line, but it does not mean that there is only one bus or one type of bus. The bus 504 may include a path for transmitting information between various components of the computing device 500 (eg, the memory 506, the processor 504, and the communication interface 508).
[0074] The processor 504 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).
[0075] The memory 506 may include a volatile memory, such as a random access memory (RAM). The processor 504 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).
[0076] The memory 506 stores executable program codes, and the processor 504 executes the executable program codes to respectively implement the functions of the aforementioned identification module 401, the recording module 402, the processing module 403, and the synchronization module 404, thereby implementing all or part of the steps of the method in the above embodiment. That is, the memory 506 stores instructions for executing all or part of the steps in the method in the above embodiment.
[0077] Alternatively, the memory 506 stores executable codes, and the processor 504 executes the executable codes to respectively implement the functions of the aforementioned data processing device 400, thereby implementing all or part of the steps in the above-mentioned embodiment method. That is, the memory 506 stores instructions for executing all or part of the steps in the above-mentioned embodiment method.
[0078] The communication interface 503 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 500 and other devices or a communication network.
[0079] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can 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 can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0080] like Figure 6As shown, the computing device cluster includes at least one computing device 500. The memory 506 in one or more computing devices 500 in the computing device cluster may store the same instructions for executing all or part of the steps in the above embodiment method.
[0081] In some possible implementations, the memory 506 of one or more computing devices 500 in the computing device cluster may also store partial instructions for executing all or part of the steps in the above-mentioned embodiment method. In other words, the combination of one or more computing devices 500 may jointly execute instructions for executing all or part of the steps in the above-mentioned embodiment method.
[0082] It should be noted that the memory 506 in different computing devices 500 in the computing device cluster may store different instructions, which are respectively used to execute part of the functions of the data processing apparatus 400. That is, the instructions stored in the memory 506 in different computing devices 500 may implement the functions of one or more of the aforementioned identification module 401, recording module 402, processing module 403 and synchronization module 404.
[0083] 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 7 A possible implementation is shown. Figure 7 As shown, two computing devices 500A and 500B 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 506 in the computing device 500A stores instructions for executing the functions of the identification module 401 and the recording module 402. At the same time, the memory 506 in the computing device 500B stores instructions for executing the functions of the processing module 403 and the synchronization module 404.
[0084] It should be understood that Figure 7 The functions of the computing device 500A shown in FIG. 5A may also be completed by multiple computing devices 500. Similarly, the functions of the computing device 500B may also be completed by multiple computing devices 500.
[0085] The present application embodiment also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to that of Figure 6 and Figure 7 The connection mode of the computing device cluster is different in that the memory 506 in one or more computing devices 500 in the computing device cluster may store the same instructions for executing the aforementioned data processing method.
[0086] In some possible implementations, the memory 506 of one or more computing devices 500 in the computing device cluster may also store partial instructions for executing the aforementioned data processing method. In other words, the combination of one or more computing devices 500 may jointly execute instructions for executing the aforementioned data processing method.
[0087] Based on the method in the above embodiment, the embodiment of the present application provides a computer-readable storage medium, which 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), etc. The computer-readable storage medium includes instructions that instruct the computing device to execute the aforementioned data processing method.
[0088] Based on the method in the above embodiment, the embodiment of the present application provides a computer program product, which may be software or a program product containing instructions and capable of running 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 executes the aforementioned data processing method.
[0089] It is understandable that the processor in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0090] The method steps in the embodiments of the present application can be implemented by hardware, or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0091] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions may be transmitted from a website site, a computer, a server or a data center to another website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may 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 drive (SSD)), etc.
[0092] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: In the case where a standby data node fails or the amount of data modification in the database of the primary data node within a preset period is greater than a preset value, the primary data node identifies a data page in which data has changed in the storage medium of the primary data node based on an operation event recorded in at least one write-ahead log WAL generated by the primary data node; The master data node records the data page where data changes occur in the storage medium of the master data node; After the master data node writes the operation event recorded by the at least one WAL into the storage medium of the master data node, the master data node deletes the at least one WAL; When synchronizing data between the primary data node and the backup data node, the primary data node sends all data pages recorded by the primary data node and in which data changes occur in the storage medium of the primary data node to the backup data node.
2. The method according to claim 1, characterized in that In the event that the standby data node fails, the at least one WAL is a WAL generated by the primary data node after a target log sequence number LSN, and the target LSN is the LSN of the latest WAL that the standby data node has written into the storage medium of the standby data node.
3. The method according to claim 1 or 2, characterized in that: After the standby data node recovers from a failure, or the user completes modifying the data in the database of the primary data node, the primary data node and the standby data node synchronize data.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: After the standby data node recovers from the failure, the primary data node stops identifying data pages in the storage medium of the primary data node where data has changed; The primary data node deletes the target WAL after writing the operation events recorded in the target WAL into the storage medium of the primary data node and sending the target WAL to the standby data node. The target WAL is the WAL generated by the primary data node after the standby data node recovers from a failure.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: When all the operation actions described by the operation events recorded by the primary data node in the WAL corresponding to the data page associated with the target file are target actions, the primary data node sends the identifier of the target file and the target instruction generated based on the target action to the standby data node; wherein the target action includes: creating, deleting or clearing, and the target instruction is to create the target file, delete the target file or clear the target file.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: The master data node records the file path of the file associated with the data page where data changes in the storage medium of the master data node, and / or records whether the operation actions described in the operation events recorded in the WAL corresponding to the data page associated with the same file where data changes in the storage medium of the master data node are all target actions, and the target actions include: create, delete or clear.
7. The method according to any one of claims 1 to 6, characterized in that: The master data node records the data page where data changes in the storage medium of the master data node, specifically including: The master data node records data pages in which data changes occur in the storage medium of the master data node through a bitmap.
8. A data processing device, characterized in that: Deployed on the primary data node, including: an identification module, configured to identify a data page in which data in a storage medium of the primary data node has changed, based on an operation event recorded in at least one write-ahead log (WAL) generated by the primary data node, when a standby data node fails or the amount of data modification in the database of the primary data node within a preset time period is greater than a preset value; A recording module, used to record data pages in which data changes occur in the storage medium of the master data node; A processing module, configured to delete the at least one WAL after writing the operation event recorded by the at least one WAL into the storage medium of the primary data node; The synchronization module is used to send all data pages in which data changes are recorded by the recording module in the storage medium of the primary data node to the backup data node when synchronizing data between the primary data node and the backup data node.
9. The device according to claim 8, characterized in that In the event that the standby data node fails, the at least one WAL is a WAL generated by the primary data node after a target log sequence number LSN, and the target LSN is the LSN of the latest WAL that the standby data node has written into the storage medium of the standby data node.
10. The device according to claim 8 or 9, characterized in that After the standby data node recovers from a failure, or the user completes modifying the data in the database of the primary data node, the primary data node and the standby data node synchronize data.
11. The device according to any one of claims 8 to 10, characterized in that: The recording module is further configured to stop identifying data pages in which data changes occur in the storage medium of the primary data node after the backup data node recovers from a failure; The processing module is further configured to delete the target WAL after the processing module writes the operation events recorded in the target WAL into the storage medium of the primary data node and the synchronization module sends the target WAL to the standby data node, wherein the target WAL is the WAL generated by the primary data node after the standby data node recovers from a failure.
12. The device according to any one of claims 8 to 11, characterized in that: The synchronization module is further used for: When all operation actions described by the operation events recorded in the WAL corresponding to the data page associated with the target file are target actions, the identifier of the target file and the target instruction generated based on the target action are sent to the standby data node; wherein the target action includes: creating, deleting or clearing, and the target instruction is to create the target file, delete the target file or clear the target file.
13. The device according to any one of claims 8 to 12, characterized in that: The recording module is further used for: Record the file path of the file associated with the data page where data in the storage medium of the primary data node changes, and / or record whether the operation actions described in the operation events recorded in the WAL corresponding to the data page associated with the same file where data in the storage medium of the primary data node changes are all target actions, wherein the target actions include: create, delete or clear.
14. The device according to any one of claims 8 to 13, characterized in that: When recording a data page in which data in the storage medium of the primary data node has changed, the recording module is specifically used to: The data pages in which data changes occur in the storage medium of the master data node are recorded through a bitmap.
15. A computing device, characterized in that: include: at least one memory for storing a program; at least one processor, configured to execute the program stored in the memory; Wherein, when the program stored in the memory is executed, the processor is used to execute the method according to any one of claims 1-7.
16. A computing device cluster, 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 according to any one of claims 1-7.
17. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device or a computing device cluster, the computing device or the computing device cluster executes the method according to any one of claims 1 to 7.
18. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the method according to any one of claims 1 to 7.
Citation Information
Cited By
Log synchronization system, method and equipment of database and medium
CN120353770A
A log synchronization system, method, device and medium for a database
CN120353770B
Log data compression method and device, electronic equipment and medium
CN120687423A
A log data compression method and device, electronic equipment and medium
CN120687423B
