Data recovery method and device from a replica node, electronic equipment and readable medium
By prioritizing log data based on the recovery status of data files in a distributed storage system, the problems of high latency and backlog in log recovery when replica nodes fail are solved, thus achieving efficient data recovery.
Patent Information
- Application Number
- CN202210115044.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-29
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2042-01-29
AI Technical Summary
In distributed storage systems, when replica nodes fail, log application latency is high during log recovery, especially under high IOPS conditions, leading to log backlog and data recovery failure.
By responding to the log synchronization command of the primary replica node, the log data to be recovered is identified, and the priority is determined or the corresponding log data is discarded according to the recovery status of the data file, thereby reducing the latency in the log recovery process. Priority is given to recovering data files that have been recovered or are being recovered, and log data that has not yet started to be recovered is discarded.
It effectively reduced latency during log recovery, prevented log backlog, ensured smooth data recovery, and solved the problem of data recovery failure.
Smart Images

Figure CN114461453B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of data recovery, in particular, to a data recovery method and device from a replica node, an electronic device and a readable medium. BACKGROUND
[0002] At present, a distributed storage system adopts a multi-replica mode to ensure data reliability, multiple replicas form a replica group, and a primary replica (node) is set for each replica group, and other replicas are slave replicas (nodes). After the primary replica receives the data of a user, a log is generated and written into the log file of the primary replica, and is synchronized to other slave replicas.
[0003] In the related art, when a replica fails, the failed replica needs to be deleted, a new replica is added and data is recovered to ensure data reliability. When the new replica recovers full data, it recovers each data file in units of data files, and a single data file is recovered in order of data blocks.
[0004] However, when the data block corresponding to the log file has not been recovered, the data block corresponding to the log needs to be recovered first, which increases the delay of log application, thereby causing log accumulation. Especially when the IOPS (Input / Output Operations Per Second, the number of read / write operations per second of a computer storage device) written by the user is higher, the problem is more serious. If the log of the new replica accumulates too much, it cannot catch up with the earliest log of the primary replica (the log space is limited, and after the log is applied, the space will be recycled and reused), then this data recovery fails, and the data recovery process needs to be restarted.
[0005] It should be noted that the information disclosed in the above background section is only used to strengthen the understanding of the background of the present disclosure, and therefore can include information that does not constitute prior art known to those of ordinary skill in the art. SUMMARY
[0006] The purpose of the present disclosure is to provide a data recovery method and device from a replica node, an electronic device and a readable medium, which at least partially overcome the problem of high log application delay in the log recovery process due to the limitations and defects of the related art.
[0007] According to a first aspect of an embodiment of the present disclosure, a data recovery method from a replica node is provided, comprising: in response to a log synchronization instruction of a primary replica node, determining log data to be recovered; writing the log data into a log space of the replica node and determining a correspondence between the log data and a data file of the replica node; detecting a data recovery state of the data file; and determining a recovery data priority of the data file or discarding corresponding log data according to the data recovery state.
[0008] In an example embodiment of the present disclosure, determining the recovery data priority of the data file or discarding the corresponding log data according to the data recovery state comprises: if it is detected that the data recovery state of a first data file is that recovery is completed, determining first log data corresponding to the first data file; and applying the first log data to data blocks corresponding to the first data file, wherein the data file comprises the first data file.
[0009] In an example embodiment of the present disclosure, determining the recovery data priority of the data file or discarding the corresponding log data according to the data recovery state further comprises: if it is detected that the data recovery state of a second data file is that recovery is being completed, determining to preferentially recover data blocks corresponding to the second data file; determining second log data corresponding to the second data file; and after recovery of the second log data is completed, applying the second log data to data blocks corresponding to the second data file, wherein the data file comprises the second data file and the log file comprises the second log data.
[0010] In an example embodiment of the present disclosure, determining the recovery data priority of the data file or discarding the corresponding log data according to the data recovery state further comprises: if it is detected that the data recovery state of a third data file is that recovery is not started, determining third log data corresponding to the third data file; and determining to discard the third log data, wherein the data file comprises the third data file and the log file comprises the third log data.
[0011] In an example embodiment of the present disclosure, further comprising: if it is detected that the data recovery state of the third data file is that recovery is started, requesting the master replica node to obtain log data to be synchronized.
[0012] In an example embodiment of the present disclosure, before responding to the log synchronization instruction of the master replica node, further comprising: determining that one of the master replica node and at least one of the slave replica nodes is included in one replica group; in response to a read-write request of a client, establishing a connection between the client and the master replica; detecting updated data of the master replica node, generating log data corresponding to the updated data; requesting the master replica node for the log data corresponding to the updated data, and synchronizing the log data corresponding to the updated data.
[0013] In an example embodiment of the present disclosure, further comprising: after the synchronization recovery of the log data corresponding to the updated data is completed, feeding back an instruction of completing log synchronization to the master replica node, so that the master replica node determines whether to apply the synchronized log data to the slave replica node according to the number of slave replica nodes that complete log synchronization.
[0014] According to a second aspect of the embodiments of the present disclosure, a data recovery apparatus from a slave copy node is provided, comprising: a determining module configured to determine log data to be recovered in response to a log synchronization instruction of a master copy node; a writing module configured to write the log data into a log space of the slave copy node and determine a correspondence between the log data and a data file of the slave copy node; a detecting module configured to detect a data recovery state of the data file; and the determining module is configured to determine a recovery data priority of the data file or discard corresponding log data according to the data recovery state.
[0015] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, comprising: a memory; and a processor coupled to the memory, the processor is configured to execute the method according to any one of the preceding method embodiments based on instructions stored in the memory.
[0016] According to a fourth aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, having a program stored thereon, which, when executed by a processor, implements the data recovery method from a slave copy node according to any one of the preceding method embodiments.
[0017] According to the embodiments of the present disclosure, the log data to be recovered is determined in response to a log synchronization instruction of a master copy node, and then the log data is written into a log space of the slave copy node, and a correspondence between the log data and a data file of the slave copy node is determined. If a data recovery state of the data file is detected, a recovery data priority of the data file is determined or corresponding log data is discarded according to the data recovery state. The log application time delay in the log recovery process is reduced. When a new copy applies logs during data recovery, only one data file being recovered will have a delay. When logs fall on a data file that has not started recovery, the logs are directly discarded, and there is no delay in normal log application. Therefore, there is no backlog of log files, and the recovery and synchronization of logs follow the master copy, and the problem of data recovery failure is also solved.
[0018] It should be understood that the general description above and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0019] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present disclosure and serve to explain the principles of the present disclosure. It is apparent that the accompanying drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative labor based on these drawings.
[0020] Figure 1A schematic diagram showing a system architecture of a data recovery scheme from a replica node to which embodiments of the present application can be applied is shown;
[0021] Figure 2 is a flowchart of a data recovery method from a replica node according to an exemplary embodiment of the present disclosure;
[0022] Figure 3 is a flowchart of a data recovery method from a replica node according to another exemplary embodiment of the present disclosure;
[0023] Figure 4 is a flowchart of a data recovery method from a replica node according to another exemplary embodiment of the present disclosure;
[0024] Figure 5 is a flowchart of a data recovery method from a replica node according to another exemplary embodiment of the present disclosure;
[0025] Figure 6 is a flowchart of a data recovery method from a replica node according to another exemplary embodiment of the present disclosure;
[0026] Figure 7 is a flowchart of a data recovery method from a replica node according to another exemplary embodiment of the present disclosure;
[0027] Figure 8 is a flowchart of a data recovery method from a replica node according to another exemplary embodiment of the present disclosure;
[0028] Figure 9 is an interaction schematic diagram of a data recovery scheme from a replica node according to an exemplary embodiment of the present disclosure;
[0029] Figure 10 is a block diagram of a data recovery apparatus from a replica node according to an exemplary embodiment of the present disclosure;
[0030] Figure 11 is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] Example implementations are now described with reference to the drawings. Example implementations can, however, be implemented in many different forms and should not be construed as limited to the examples set forth herein; rather, these implementations are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the example implementations to those skilled in the art. The described features, structures, or characteristics can be combined in one or more implementations. In the following description, numerous specific details are provided, such as examples of programming, software modules, user selections, network transactions, database queries, database structures, hardware modules, hardware- specific details and
[0032] In addition, the accompanying drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification. The drawings illustrate examples of the present disclosure and, as such, a change in the size or proportion of some of the elements in the drawings can be exaggerated to clearly show the nature and principles of the present disclosure. In the drawings:
[0033] Figure 1 A schematic diagram of a system architecture of a data recovery scheme from a replica node is shown.
[0034] As Figure 1 shown, the system architecture 100 can include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0035] It should be appreciated that the number of terminal devices, networks, and servers in Figure 1 the system architecture 100 is merely illustrative. Any number of terminal devices, networks, and servers can be present according to implementation needs. For example, the server 105 can be a server cluster composed of multiple servers, etc.
[0036] A user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. The terminal devices 101, 102, 103 can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, portable computers, and desktop computers, etc.
[0037] In some embodiments, the method for recovering data from a slave node is generally executed by the terminal 105, and the corresponding data recovery device from a slave node is generally arranged in the terminal device 103 (or the terminal device 101 or 102). In other embodiments, some servers can have similar functions as the terminal device to execute the method. Therefore, the method for recovering data from a slave node is not limited to be executed by the terminal device.
[0038] The example embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0039] Figure 2 is a flowchart of the method for recovering data from a slave node in the example embodiments of the present disclosure.
[0040] Reference Figure 2 The method for recovering data from a slave node can include:
[0041] In step S202, log data to be recovered is determined in response to a log synchronization instruction of a master slave node.
[0042] In step S204, the log data is written into a log space of the slave node, and a corresponding relationship between the log data and a data file of the slave node is determined.
[0043] In step S206, a data recovery state of the data file is detected.
[0044] In step S208, a recovery data priority of the data file is determined according to the data recovery state or corresponding log data is discarded.
[0045] According to the example embodiments of the present disclosure, the log data to be recovered is determined in response to the log synchronization instruction of the master slave node, and then the log data is written into the log space of the slave node, and the corresponding relationship between the log data and the data file of the slave node is determined. If the data recovery state of the data file is detected, the recovery data priority of the data file is determined according to the data recovery state or the corresponding log data is discarded. The log application time delay in the log recovery process is reduced. When the new slave node applies the log during the data recovery, only one data file being recovered will have a delay. When the log falls on the data file that has not started to be recovered, the log is directly discarded, and there is no delay in the normal log application. Therefore, the log file no longer accumulates, the recovery and synchronization of the log follow the master slave node, and the problem of data recovery failure is solved.
[0046] Next, each step of the method for recovering data from a slave node is described in detail.
[0047] In an example embodiment of the present disclosure, as shown in Figure 3 determining a recovery data priority of the data file or discarding corresponding log data according to the data recovery status comprises:
[0048] At step S302, if it is detected that the data recovery status of the first data file is already recovered, then first log data corresponding to the first data file is determined.
[0049] At step S304, the first log data is applied to data blocks corresponding to the first data file, and the data files include the first data file.
[0050] In the above embodiment, if the data file corresponding to the log is already recovered, then the corresponding data block on the data file is directly updated.
[0051] In an example embodiment of the present disclosure, as shown in Figure 4 determining a recovery data priority of the data file or discarding corresponding log data according to the data recovery status further comprises:
[0052] At step S402, if it is detected that the data recovery status of the second data file is being recovered, then data blocks corresponding to the second data file are determined to be recovered first.
[0053] At step S404, second log data corresponding to the second data file is determined.
[0054] At step S406, after the recovery of the second log data is completed, the second log data is applied to data blocks corresponding to the second data file, and the data files include the second data file, and the log files include the second log data.
[0055] In the above embodiment, if the data file corresponding to the log is being recovered, and the data block corresponding to the log has not been recovered, then the data block corresponding to the log is recovered first, and then the log is updated to the corresponding data block.
[0056] In an example embodiment of the present disclosure, as shown in Figure 5 determining a recovery data priority of the data file or discarding corresponding log data according to the data recovery status further comprises:
[0057] At step S502, if it is detected that the data recovery status of the third data file is not started to be recovered, then third log data corresponding to the third data file is determined.
[0058] At step S504, it is determined to discard the third log data, and the data files include the third data file, and the log files include the third log data.
[0059] In the above embodiment, if the log falls on the data file without starting recovery, it is directly discarded, without any delay of applying normal log, and the log file no longer has backlog, solving the problem of data recovery failure.
[0060] In an exemplary embodiment of the present disclosure, as shown in Figure 6 The data recovery method of the slave node further includes:
[0061] Step S602, if it is detected that the data recovery state of the third data file is starting recovery, requesting the master node to obtain the log data to be synchronized.
[0062] In an exemplary embodiment of the present disclosure, as shown in Figure 7 Before responding to the log synchronization instruction of the master node, it further includes:
[0063] Step S702, determining one of the master node and at least one of the slave nodes included in one replica group.
[0064] Step S704, in response to the read-write request of the client, establishing a connection between the client and the master node.
[0065] Step S706, detecting the updated data of the master node, and generating the log data corresponding to the updated data.
[0066] Step S708, requesting the log data corresponding to the updated data from the master node, and synchronizing the log data corresponding to the updated data.
[0067] In the above embodiment, the read-write operation is realized through the connection between the master node and the client, the master node generates the log according to the operation of the user data, and the master node and the slave node further perform log synchronization (recovery) and application.
[0068] In an exemplary embodiment of the present disclosure, as shown in Figure 8 The data recovery method of the slave node further includes:
[0069] Step S802, after completing the synchronization recovery of the log data corresponding to the updated data, feeding back the instruction of completing log synchronization to the master node, so that the master node determines whether to apply the synchronized log data to the slave node according to the number of slave nodes completing log synchronization.
[0070] In the above embodiment, after the slave replica receives the log of the master replica, the log file written in the slave replica is returned to the master replica to indicate that the log saving is completed. The master replica counts the number of slave replicas that return successfully, and adds the master replica itself. When the total number reaches the majority of the total number of replicas (assuming the total number of replicas is N, and the majority is N / 2+1), the master replica applies the log to the master replica and notifies the slave replicas to apply the log.
[0071] As shown in Figure 9 An exemplary embodiment in the present disclosure includes a master replica node 902 and a plurality of slave replica nodes in a data recovery scheme of a slave replica node, which may, for example, include a slave replica node 904 and a slave replica node 906. The master replica node 902 generates log A, log B and log C according to the received user data. The slave replica node 904 has completed synchronization of log data, and the slave replica node 904 is in data recovery. According to the data recovery state, the recovery data priority of the data file or the discarding of the corresponding log data is determined, which specifically includes the following three cases:
[0072] Log A: The corresponding data file A has been recovered and completed, and the corresponding data block on the data file A is directly updated.
[0073] Log B: The corresponding data file B is recovering data, and the data block corresponding to the log has not been recovered. The data block corresponding to the log is preferentially recovered, and then the log is updated to the corresponding data block.
[0074] Log C: The corresponding data file C has not started data recovery, and the log is discarded. When the data file C starts data recovery, the latest data recovered from the master replica node 902 is recovered, and the logs before the start of recovery can be discarded.
[0075] After the improvement, when the new replica applies the log during data recovery, only one data file being recovered will have a delay. When the log falls on a data file that has not started recovery, it is directly discarded, and there is no delay in applying the log. The log file no longer has a backlog, and follows the log of the master replica, avoiding the problem of data recovery failure.
[0076] Corresponding to the above method embodiment, the present disclosure also provides a data recovery device of a slave replica node, which can be used to execute the above method embodiment.
[0077] Figure 10 is a block diagram of a data recovery device of a slave replica node in an exemplary embodiment of the present disclosure.
[0078] Referring to Figure 10 The data recovery device 1000 of the slave replica node can include:
[0079] The determining module 1002 is configured to determine the log data to be recovered in response to a log synchronization instruction of the primary replica node.
[0080] The writing module 1004 is configured to write the log data into a log space of the replica node and determine a correspondence between the log data and the data file of the slave replica node.
[0081] The detecting module 1006 is configured to detect a data recovery state of the data file.
[0082] The determining module 1002 is configured to determine a recovery data priority of the data file or discard the corresponding log data according to the data recovery state.
[0083] In an example embodiment of the present disclosure, the determining module 1002 is further configured to: if it is detected that the data recovery state of a first data file is that recovery is completed, determine first log data corresponding to the first data file; and apply the first log data to a data block corresponding to the first data file, wherein the data file includes the first data file.
[0084] In an example embodiment of the present disclosure, the determining module 1002 is further configured to: if it is detected that the data recovery state of a second data file is that recovery is being completed, determine to preferentially recover a data block corresponding to the second data file; determine second log data corresponding to the second data file; and after recovery of the second log data is completed, apply the second log data to a data block corresponding to the second data file, wherein the data file includes the second data file and the log file includes the second log data.
[0085] In an example embodiment of the present disclosure, the determining module 1002 is further configured to: if it is detected that a data recovery state of a third data file is that recovery is not started, determine third log data corresponding to the third data file; and determine to discard the third log data, wherein the data file includes the third data file and the log file includes the third log data.
[0086] In an example embodiment of the present disclosure, the determining module 1002 is further configured to: if it is detected that the data recovery state of the third data file is that recovery is started, request the primary replica node to acquire log data to be synchronized.
[0087] In an example embodiment of the present disclosure, the determining module 1002 is further configured to: before responding to the log synchronization instruction of the master replica node, determine the master replica node and at least one slave replica node included in a replica group; in response to a read-write request of a client, establish a connection between the client and the master replica; detect updated data of the master replica node, and generate log data corresponding to the updated data; request the log data corresponding to the updated data from the master replica node, and synchronize the log data corresponding to the updated data.
[0088] In an example embodiment of the present disclosure, the determining module 1002 is further configured to: after completing the synchronization recovery of the log data corresponding to the updated data, feed back an instruction of completing log synchronization to the master replica node, so that the master replica node determines whether to apply the synchronized log data to the slave replica node according to the number of slave replica nodes that complete log synchronization.
[0089] Since the functions of the apparatus 1000 have been described in detail in the corresponding method embodiments, the present disclosure will not be repeated here.
[0090] It should be noted that although several modules or units of the device for action execution are mentioned in the foregoing detailed description, such division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into embodied by multiple modules or units.
[0091] In an example embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0092] Those skilled in the art can understand that each aspect of the present disclosure can be implemented as a system, a method or a program product. Therefore, each aspect of the present disclosure can be embodied as a complete hardware embodiment, a complete software embodiment (including firmware, microcode, etc.), or an embodiment combining hardware and software aspects, which can be collectively referred to as "circuitry", "module" or "system" here.
[0093] The electronic device 1100 according to this embodiment of the present disclosure will be described below with reference to Figure 11 Figure 11 The displayed electronic device 1100 is only an example and should not impose any limitation on the functions and use range of the embodiments of the present disclosure.
[0094] As Figure 11 As shown, the electronic device 1100 is in the form of a general computing device. Components of the electronic device 1100 can include, but are not limited to, the at least one processing unit 1110 described above, the at least one memory unit 1120 described above, and a bus 1130 that connects the different system components including the memory unit 1120 and the processing unit 1110.
[0095] The memory unit stores program codes which can be executed by the processing unit 1110, so that the processing unit 1110 performs the steps according to various exemplary embodiments of the present application described in the above “Exemplary Methods” section of the present specification. For example, the processing unit 1110 can perform the method as shown in the embodiments of the present disclosure.
[0096] The memory unit 1120 can include a readable medium in the form of volatile memory units, such as a random access memory (RAM) 11201 and / or a cache memory unit 11202, and can further include a read-only memory (ROM) 11203.
[0097] The memory unit 1120 can further include program / utility 11204 having a set of the program modules 11205, such as an operating system, one or more application programs, other program modules, and program data, and each of these examples, or some combination thereof, can include implementation of a network environment.
[0098] The bus 1130 can represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration bus, a processor or local bus using any of a variety of bus architectures.
[0099] The electronic device 1100 can also communicate with one or more external devices 1140 such as a keyboard or pointing device, a Bluetooth device, or a database, and can communicate with one or more devices that enable a user to interact with the electronic device 1100 and / or one or more devices (e.g., a router, a modem, and so forth) that enable the electronic device 1100 to communicate with one or more other computing devices. Such communication can occur via Input / Output (I / O) interface(s) 1150. Still yet, the electronic device 1100 can communicate with one or more networks, such as one or more local area networks (LANs), wide area networks (WANs), and / or the Internet, through network adapter 1160. As depicted, network adapter 1160 communicates with the other components of the electronic device 1100 via bus 1130. It should be appreciated that although not shown, other hardware and / or software modules could be used in connection with the electronic device 1100. Such modules can include, but are not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archival storage systems, etc.
[0100] From the above description of the embodiments, those skilled in the art will readily appreciate that the example embodiments described herein can be implemented by software and / or by hardware. Embodiments according to the present disclosure can be implemented by a method comprising computer program code to implement the methods described herein on a computing device, such as a personal computer, server, terminal device, or network device.
[0101] In the example embodiments of the present disclosure, a computer readable storage medium having stored thereon a program product capable of implementing the above-described methods of the specification is also provided. In some possible embodiments, various aspects of the present disclosure can also be implemented in the form of a program product including program code to make the terminal device perform the steps described in the above-mentioned "Example Method" section according to various example embodiments of the present disclosure when the program product is run on the terminal device.
[0102] The program product for implementing the above-described methods according to the embodiments of the present disclosure can take the form of a portable compact disc read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0103] The program product can employ any combination of one or more computer-readable media. The computer-readable media can be a computer-readable storage medium or a computer-readable signal medium. The computer-readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include the following: an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0104] The computer-readable signal medium can include a computer-readable storage medium that is propagated as a carrier wave. The computer-readable signal medium can further be any computer-readable medium that is not a storage medium. The computer-readable signal medium can be a computer-readable storage medium that is a propagated signal on a computer-readable storage medium.
[0105] The program code embodied on the computer-readable media can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0106] The program code can be executed by one or more programmable processors, which can be implemented in one or more computer systems. In this context, a computer system generally includes a plurality of these programmable processors, which work in concert to perform a task. Additionally, the program code can be downloaded from an external source, including the internet, through a computer network, or through a broadcast medium.
[0107] Furthermore, the above-described diagrams are merely schematic illustrations of the processes included in the method according to the exemplary embodiments of the present application, and are not intended to be limiting. It is readily understood that the processes shown in the above-described diagrams do not indicate or limit the time sequence of the processes. In addition, it is readily understood that the processes can be executed synchronously or asynchronously, for example, in a plurality of modules.
[0108] Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the features disclosed herein. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
Claims
1. A method for data recovery from a replica node, characterized in that, include: In response to the log synchronization command from the primary replica node, determine the log data to be recovered; Write the log data into the log space of the replica node, and determine the correspondence between the log data and the data file of the replica node; Detect the data recovery status of the data file; Determining the priority of data recovery for the data file or discarding the corresponding log data based on the data recovery status includes: If the data recovery status of the first data file is detected as "recovery complete", then the first log data corresponding to the first data file is determined; The first log data is applied to the data block corresponding to the first data file, wherein the data file includes the first data file; If the data recovery status of the second data file is detected as "recovery in progress", then it is determined to prioritize the recovery of the data blocks corresponding to the second data file. Determine the second log data corresponding to the second data file; After the recovery of the second log data is completed, the second log data is applied to the data block corresponding to the second data file, wherein the data file includes the second data file and the log data includes the second log data; If the data recovery status of the third data file is detected as not having started, then the third log data corresponding to the third data file is determined; It is determined that the third log data will be discarded, the data file includes the third data file, and the log data includes the third log data.
2. The data recovery method from a replica node as described in claim 1, characterized in that, Also includes: If the data recovery status of the third data file is detected as "starting recovery", then request the log data to be synchronized from the primary replica node.
3. The data recovery method from a replica node as described in claim 1 or 2, characterized in that, Before responding to the log synchronization command on the primary replica node, it also includes: Determine a replica group that includes one primary replica node and at least one secondary replica node; In response to a client's read / write request, a connection is established between the client and the primary replica; Upon detecting updated data from the primary replica node, log data corresponding to the updated data is generated. Request the log data corresponding to the updated data from the primary replica node, and synchronize the log data corresponding to the updated data.
4. The data recovery method from a replica node as described in claim 1 or 2, characterized in that, Also includes: After completing the synchronization and recovery of the log data corresponding to the updated data, the primary replica node sends a log synchronization completion instruction to the primary replica node, so that the primary replica node can determine whether to apply the synchronized log data to the secondary replica nodes based on the number of secondary replica nodes that have completed log synchronization.
5. A data recovery apparatus from a replica node, characterized in that, include: The module is configured to respond to log synchronization commands from the primary and replica nodes and determine the log data to be recovered. The writing module is configured to write the log data to the log space of the replica node and determine the correspondence between the log data and the data file of the replica node; The detection module is configured to detect the data recovery status of the data file; The determining module is configured to determine the priority of the data file to be recovered or to discard the corresponding log data based on the data recovery status, including: If the data recovery status of the first data file is detected as "recovery complete", then the first log data corresponding to the first data file is determined; The first log data is applied to the data block corresponding to the first data file, wherein the data file includes the first data file; If the data recovery status of the second data file is detected as "recovery in progress", then it is determined to prioritize the recovery of the data blocks corresponding to the second data file. Determine the second log data corresponding to the second data file; After the recovery of the second log data is completed, the second log data is applied to the data block corresponding to the second data file, wherein the data file includes the second data file and the log data includes the second log data; If the data recovery status of the third data file is detected as not having started, then the third log data corresponding to the third data file is determined; It is determined that the third log data will be discarded, the data file includes the third data file, and the log data includes the third log data.
6. An electronic device, characterized in that, include: Memory; as well as A processor coupled to the memory, the processor being configured to execute the data recovery method from the replica node as described in any one of claims 1-4 based on instructions stored in the memory.
7. A computer-readable storage medium having a program stored thereon that, when executed by a processor, implements the data recovery method from a replica node as described in any one of claims 1-4.
Citation Information
Patent Citations
Data synchronizing method, device and system
CN106817387A
Database synchronization recovery method, device, computer readable storage medium, and electronic device
CN109271442A