Data synchronization method, device, equipment, computer readable medium and program product
By parsing the full amount of data during the data migration process, determining the migration duration and delaying the expiration time of the incremental key, the problem of the inability of the incremental data key to be synchronized to the target during data migration is solved, and the number of times the incremental data cannot be queried is reduced. , improving the reliability and efficiency of data synchronization.
Patent Information
- Application Number
- CN202310323804.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-03-29
AI Technical Summary
During the data migration process, when the source end increases the key expiration time of incremental data, the migration tool still uses the original expiration time, resulting in the inability of the incremental data key to be synchronized to the target end, which in turn results in the increment being unable to be queried when querying data. The number of data is higher.
By receiving and parsing the full amount of data sent by the source end, the migration time of the full data is determined, and based on this time, the expiration time of the incremental key that meets the preset expiration time conditions is delayed to increase its expiration time, so as to achieve the goal of migration at the target. Sync incremental data on the end.
It reduces the number of times when incremental data cannot be queried when switching to the target end to query data, ensures that the expiration time of incremental data keys is delayed, and improves the reliability and efficiency of data synchronization.
Smart Images

Figure CN118733669A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a data synchronization method, apparatus, device, computer-readable medium, and program product. Background Art
[0002] Remote dictionary service is an unstructured key-value database. Currently, the demand for data migration between remote dictionary service clusters hosted on cloud computing platforms is increasing. At present, the common method for data migration is to use migration tools to achieve data migration. The expiration time of the key of incremental data is based on the expiration time initially determined in the migration tool.
[0003] However, the inventors have discovered that when the above method is used for data migration, the following technical problems often occur: when the source end increases the expiration time of the key of the incremental data, the migration tool still uses the original expiration time as the basis, causing the key of the incremental data in the migration tool to expire and be unable to be synchronized to the target end, resulting in a large number of times when the incremental data cannot be queried when switching to the target end to query data.
[0004] The above information disclosed in this Background section is only for enhancement of understanding of the background of the inventive concept and therefore it may contain information that does not form the prior art that is already known in this country to a person of ordinary skill in the art. Summary of the invention
[0005] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.
[0006] Some embodiments of the present disclosure propose data synchronization methods, devices, electronic devices, computer-readable media, and computer program products to solve one or more of the technical problems mentioned in the above background technology section.
[0007] In a first aspect, some embodiments of the present disclosure provide a data synchronization method, which includes: in response to receiving full data corresponding to a target data migration request sent by a source end, parsing the full data to obtain full data synchronization information; in response to receiving incremental data synchronization information corresponding to the target data migration request sent by the source end, adding the incremental data synchronization information to an incremental data synchronization information set; determining a migration duration corresponding to the full data; synchronizing the full data to a target end according to the full data synchronization information; in response to determining that there are incremental keys that meet a preset expiration time condition among the incremental keys corresponding to the incremental data synchronization information set, delaying the expiration time of each incremental key that meets the preset expiration time condition according to the migration duration, wherein the preset expiration time condition includes that the expiration time corresponding to the incremental key is less than the migration time corresponding to the migration duration; synchronizing each incremental data of the corresponding incremental data synchronization information set to the target end according to the incremental data synchronization information set.
[0008] Optionally, before parsing the full data in response to receiving the full data corresponding to the target data migration request sent by the source end to obtain full data synchronization information, the method further includes: sending the target data migration request to the source end.
[0009] Optionally, the above determination of the migration duration corresponding to the above full data includes: determining the number of each key included in the above full data as the total number of keys; and determining the migration duration corresponding to the above full data based on the ratio of the above total number of keys to a preset number of keys.
[0010] Optionally, the migration duration corresponding to the above-mentioned full amount of data is determined based on the ratio of the above-mentioned total number of keys to the preset number of keys, including: rounding up the ratio of the above-mentioned total number of keys to the preset number of keys to obtain a migration integer; and determining the product of the above-mentioned migration integer and the preset duration as the migration duration corresponding to the above-mentioned full amount of data.
[0011] Optionally, the above-mentioned expiration time of each incremental key that meets the above-mentioned preset expiration time condition is delayed according to the above-mentioned migration duration, including: determining the difference between the above-mentioned migration duration and the expiration time of the above-mentioned incremental key as the remaining migration duration; determining the sum of the above-mentioned remaining migration duration and the preset duration as the migration increase duration; determining the sum of the above-mentioned expiration time and the above-mentioned migration increase duration as the expiration time after the delayed processing of the expiration time of the above-mentioned incremental key.
[0012] Optionally, the method further includes: in response to detecting that synchronization of each incremental data of the corresponding incremental data synchronization information set is completed, sending synchronization feedback information corresponding to the above-mentioned target data migration request to the target client.
[0013] In a second aspect, some embodiments of the present disclosure provide a data synchronization device, the device comprising: a parsing unit, configured to parse the full data in response to receiving the full data corresponding to the target data migration request sent by the source end, and obtain full data synchronization information; an adding unit, configured to add the incremental data synchronization information to the incremental data synchronization information set in response to receiving the incremental data synchronization information corresponding to the target data migration request sent by the source end; a determining unit, configured to determine the migration duration corresponding to the full data; a first synchronization unit, configured to perform a migration according to the full data synchronization. step information, synchronizes the above-mentioned full data to the target end; a delay unit is configured to, in response to determining that there is an incremental key that meets the preset expiration time condition among the incremental keys corresponding to the above-mentioned incremental data synchronization information set, delay the expiration time of each incremental key that meets the above-mentioned preset expiration time condition according to the above-mentioned migration duration, wherein the above-mentioned preset expiration time condition includes that the expiration time corresponding to the incremental key is less than the migration time corresponding to the above-mentioned migration duration; a second synchronization unit is configured to synchronize each incremental data corresponding to the incremental data synchronization information set to the above-mentioned target end according to the incremental data synchronization information set.
[0014] Optionally, before the parsing unit, the data synchronization device further includes: a request sending unit configured to send a target data migration request to the above-mentioned source end.
[0015] Optionally, the determination unit is further configured to: determine the number of keys included in the above-mentioned full data as the total number of keys; and determine the migration duration corresponding to the above-mentioned full data based on the ratio of the above-mentioned total number of keys to the preset number of keys.
[0016] Optionally, the determination unit is further configured to: round up the ratio of the above-mentioned total number of keys to the preset number of keys to obtain a migration integer; and determine the product of the above-mentioned migration integer and the preset duration as the migration duration corresponding to the above-mentioned full amount of data.
[0017] Optionally, the delay unit is further configured to: determine the difference between the above-mentioned migration duration and the expiration duration of the above-mentioned incremental key as the remaining migration duration; determine the sum of the above-mentioned remaining migration duration and the preset duration as the migration increase duration; determine the sum of the above-mentioned expiration time and the above-mentioned migration increase time as the expiration time after the delay processing of the expiration time of the above-mentioned incremental key.
[0018] Optionally, the data synchronization device further includes: a synchronization feedback information sending unit configured to send synchronization feedback information corresponding to the target data migration request to the target client in response to detecting that synchronization of each incremental data of the corresponding incremental data synchronization information set is completed.
[0019] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner of the above-mentioned first aspect.
[0020] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner of the above-mentioned first aspect is implemented.
[0021] In a fifth aspect, some embodiments of the present disclosure provide a computer program product, including a computer program, which implements the method described in any implementation manner of the above-mentioned first aspect when executed by a processor.
[0022] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the data synchronization method of some embodiments of the present disclosure, the expiration time of the key of the incremental data can be automatically delayed, reducing the number of times that the incremental data cannot be queried when switching to the target end to query data. Specifically, the reason why the incremental data cannot be queried many times when switching to the target end to query data is that when the source end increases the expiration time of the key of the incremental data, the migration tool still takes the original expiration time as the basis, resulting in the expiration of the key of the incremental data in the migration tool, and cannot be synchronized to the target end, thereby resulting in the number of times that the incremental data cannot be queried when switching to the target end to query data. Based on this, the data synchronization method of some embodiments of the present disclosure, first, in response to receiving the full amount of data corresponding to the target data migration request sent by the source end, the full amount of data is parsed to obtain the full amount of data synchronization information. Therefore, when the full amount of data sent by the source end is received, the full amount of data can be parsed into the full amount of data synchronization information that can be synchronized to the target end. Then, in response to receiving the incremental data synchronization information corresponding to the target data migration request sent by the above-mentioned source end, the above-mentioned incremental data synchronization information is added to the incremental data synchronization information set. Thus, when the incremental data synchronization information sent by the source end is received, the incremental data synchronization information can be accumulated locally first. Afterwards, the migration duration corresponding to the above-mentioned full data is determined. Thus, the total duration required for synchronizing the full data can be determined. Secondly, according to the above-mentioned full data synchronization information, the above-mentioned full data is synchronized to the target end. Thus, the parsed full data synchronization information can be written to the target end. Next, in response to determining that there are incremental keys that meet the preset expiration time condition in each incremental key corresponding to the above-mentioned incremental data synchronization information set, according to the above-mentioned migration duration, the expiration time of each incremental key that meets the above-mentioned preset expiration time condition is delayed. Among them, the above-mentioned preset expiration time condition includes that the expiration time corresponding to the incremental key is less than the migration time corresponding to the above-mentioned migration duration. Thus, when the expiration time of the incremental key is less than the migration time corresponding to the migration duration, the expiration time of the incremental key can be automatically delayed to increase the expiration time of the incremental key. Finally, according to the incremental data synchronization information set, each incremental data corresponding to the incremental data synchronization information set is synchronized to the above-mentioned target end. Thus, the synchronization information of each accumulated incremental data can be written to the target end to achieve synchronization of the incremental data. Also, because the expiration time of the incremental data key is delayed, the expiration time of the incremental data key is increased. This can reduce the situation where the incremental data key expires and cannot be synchronized to the target end, and further reduce the number of times that the incremental data cannot be queried when switching to the target end to query data. Thus, the expiration time of the incremental data key can be automatically delayed, reducing the number of times that the incremental data cannot be queried when switching to the target end to query data. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
[0024] Figure 1 is an architectural diagram of an exemplary system in which some embodiments of the present disclosure may be applied;
[0025] Figure 2 is a flow chart of some embodiments of the data synchronization method according to the present disclosure;
[0026] Figure 3 are flow charts of other embodiments of the data synchronization method according to the present disclosure;
[0027] Figure 4 is a schematic diagram of delaying the expiration time of an incremental key in other embodiments of the data synchronization method disclosed herein;
[0028] Figure 5 is a schematic diagram of the structure of some embodiments of the data synchronization device according to the present disclosure;
[0029] Figure 6 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0030] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0031] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.
[0032] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0033] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0034] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0035] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0036] Figure 1 An exemplary system architecture 100 is shown to which a data synchronization method or a data synchronization device according to some embodiments of the present disclosure can be applied.
[0037] like Figure 1 As shown, the system architecture 100 may include a terminal device 101, and networks 102, 103, 104 and 105, a source terminal 106, a migration terminal 107 and a target terminal 108. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the source terminal 106. The network 103 is used to provide a medium for a communication link between the source terminal 106 and the migration terminal 107. The network 104 is used to provide a medium for a communication link between the migration terminal 107 and the target terminal 108. The network 105 is used to provide a medium for a communication link between the terminal device 101 and the target terminal 108. The networks 102, 103, 104 and 105 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0038] The user can use the terminal device 101 to interact with the source end 106 through the network 102, and interact with the target end 108 through the network 105 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, data synchronization applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0039] The terminal device 101 can be hardware or software. When the terminal device 101 is hardware, it can be various electronic devices with a display screen and supporting data storage and information display, including but not limited to smart phones, tablet computers, e-book readers, laptop portable computers and desktop computers, etc. When the terminal device 101 is software, it can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules for providing distributed services, or it can be implemented as a single software or software module. No specific limitation is made here.
[0040] The source end 106, the migration end 107 and the target end 108 may be servers that provide various services. For example, the source end 106 and the target end 108 may be servers that provide data storage and query for the terminal device 101. The source end 106 and the target end 108 may analyze and process the received data such as data storage requests and data reading requests, and feed back the processing results to the terminal device. The migration end 107 may be a server for synchronizing the data of the source end 106 to the target end 108.
[0041] It should be noted that the data synchronization method provided in the embodiment of the present disclosure may be executed by the migration terminal 107. Accordingly, the data synchronization device may be disposed in the migration terminal 107.
[0042] It should be noted that the server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules for providing distributed services, or it can be implemented as a single software or software module. No specific limitation is made here.
[0043] It should be understood that Figure 1 The number of terminal devices, networks, source terminals, migration terminals, and target terminals in the embodiment is only for illustration. Any number of terminal devices, networks, source terminals, migration terminals, and target terminals may be provided according to implementation requirements.
[0044] Continue to refer Figure 2 , shows a process 200 of some embodiments of the data synchronization method according to the present disclosure. The data synchronization method comprises the following steps:
[0045] Step 201 , in response to receiving full data corresponding to a target data migration request sent by a source end, the full data is parsed to obtain full data synchronization information.
[0046] In some embodiments, the execution body of the data synchronization method (eg Figure 1The migration end 107 shown can parse the full data in response to receiving the full data corresponding to the target data migration request sent by the source end to obtain full data synchronization information. Among them, the source end can be a server that stores the data to be migrated. For example, the source end can be a Redis node that stores data written by the client. The target data migration request can be a request sent by the execution entity to the source end to migrate data to the target end. The target end can be a server that will provide data storage, query and other services to the client instead of the source end. The full data can be the full update data that needs to be synchronized to the target end. In practice, the execution entity can parse the full data into a full data synchronization operation command, and determine the parsed full data synchronization operation command as the full data synchronization information.
[0047] It should be noted that the source end and the execution subject, the target end and the execution subject may be connected to each other by wired connection or wireless connection. The wireless connection may include but is not limited to 3G / 4G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.
[0048] Optionally, before step 201, the execution subject may send a target data migration request to the source end, thereby synchronizing data from the source end.
[0049] Step 202: in response to receiving the incremental data synchronization information corresponding to the target data migration request sent by the source end, add the incremental data synchronization information to the incremental data synchronization information set.
[0050] In some embodiments, the above-mentioned execution subject may add the above-mentioned incremental data synchronization information to the incremental data synchronization information set in response to receiving the incremental data synchronization information corresponding to the above-mentioned target data migration request sent by the above-mentioned source end. The incremental data synchronization information may be an incremental data synchronization command sent by the source end. The incremental data synchronization command may be a command for synchronizing incremental data. The incremental data synchronization information set may be each incremental data synchronization information previously sent by the source end corresponding to the above-mentioned target data migration request. In the initial state, the incremental data synchronization information set may be empty. Through the incremental data synchronization information set, each incremental data synchronization information may be accumulated. In practice, the above-mentioned execution subject may add the above-mentioned incremental data synchronization information to the end of the incremental data synchronization information set.
[0051] Step 203: Determine the migration duration corresponding to the full amount of data.
[0052] In some embodiments, the execution subject may determine the migration duration corresponding to the full amount of data. In practice, the execution subject may determine the migration duration as the duration required to migrate the full amount of data based on the data size of the full amount of data.
[0053] Step 204: synchronize the full data to the target end according to the full data synchronization information.
[0054] In some embodiments, the execution subject may synchronize the full data to the target end according to the full data synchronization information. In practice, the execution subject may write the full data synchronization information to the target end to synchronize the full data to the target end.
[0055] Step 205, in response to determining that there is an incremental key that meets the preset expiration time condition among the incremental keys corresponding to the incremental data synchronization information set, the expiration time of each incremental key that meets the preset expiration time condition is delayed according to the migration duration.
[0056] In some embodiments, the execution subject may, in response to determining that there is an incremental key that satisfies a preset expiration time condition among the incremental keys corresponding to the incremental data synchronization information set, perform delay processing on the expiration time of each incremental key that satisfies the preset expiration time condition according to the migration duration. Among them, the preset expiration time condition may include that the expiration time corresponding to the incremental key is less than the migration time corresponding to the migration duration. The incremental key may be a key of incremental data. The expiration time corresponding to the incremental key may be a moment after its expiration time has passed since the start of migrating data. The migration time corresponding to the migration duration may be a moment after the start of migrating data has passed since the migration duration. In practice, the execution subject may determine the difference between the migration duration and the expiration time of the incremental key as the increase duration. Then, the sum of the increase duration and the expiration time may be determined as the expiration time after the delay processing.
[0057] Optionally, the above-mentioned preset expiration time condition may also include an expiration time delay operation information record of the incremental key corresponding to the source end. The expiration time delay operation information record may be an operation information record of the client extending the expiration time of the incremental key stored in the source end. The expiration time delay operation information record may be stored in log data. The logical relationship between the various sub-conditions included in the above-mentioned preset expiration time condition may be and or or.
[0058] Step 206: synchronize each incremental data corresponding to the incremental data synchronization information set to the target end according to the incremental data synchronization information set.
[0059] In some embodiments, the execution subject may synchronize each incremental data of the corresponding incremental data synchronization information set to the target end according to the incremental data synchronization information set. In practice, the execution subject may write each incremental data synchronization information in the incremental data synchronization information set to the target end to synchronize each incremental data of the corresponding incremental data synchronization information set to the target end.
[0060] Optionally, the execution subject may also send synchronization feedback information corresponding to the target data migration request to the target client in response to detecting that the synchronization of each incremental data of the corresponding incremental data synchronization information set is completed. The synchronization feedback information may be information related to feedback on the progress of the synchronization. For example, when the full data and each incremental data are synchronized successfully, the synchronization feedback information may indicate that the data synchronization is successful. When the synchronization of the full data or the incremental data in each incremental data fails, the synchronization feedback information may indicate that the data synchronization is abnormal. The target client may be the client that writes the data corresponding to the target data migration request to the source end. In this way, the user of the client may be informed of the progress of the data migration.
[0061] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the data synchronization method of some embodiments of the present disclosure, the expiration time of the key of the incremental data can be automatically delayed, reducing the number of times that the incremental data cannot be queried when switching to the target end to query data. Specifically, the reason why the incremental data cannot be queried many times when switching to the target end to query data is that when the source end increases the expiration time of the key of the incremental data, the migration tool still takes the original expiration time as the basis, resulting in the expiration of the key of the incremental data in the migration tool, and cannot be synchronized to the target end, thereby resulting in the number of times that the incremental data cannot be queried when switching to the target end to query data. Based on this, the data synchronization method of some embodiments of the present disclosure, first, in response to receiving the full amount of data corresponding to the target data migration request sent by the source end, the full amount of data is parsed to obtain the full amount of data synchronization information. Therefore, when the full amount of data sent by the source end is received, the full amount of data can be parsed into the full amount of data synchronization information that can be synchronized to the target end. Then, in response to receiving the incremental data synchronization information corresponding to the target data migration request sent by the above-mentioned source end, the above-mentioned incremental data synchronization information is added to the incremental data synchronization information set. Thus, when the incremental data synchronization information sent by the source end is received, the incremental data synchronization information can be accumulated locally first. Afterwards, the migration duration corresponding to the above-mentioned full data is determined. Thus, the total duration required for synchronizing the full data can be determined. Secondly, according to the above-mentioned full data synchronization information, the above-mentioned full data is synchronized to the target end. Thus, the parsed full data synchronization information can be written to the target end. Next, in response to determining that there are incremental keys that meet the preset expiration time condition in each incremental key corresponding to the above-mentioned incremental data synchronization information set, according to the above-mentioned migration duration, the expiration time of each incremental key that meets the above-mentioned preset expiration time condition is delayed. Among them, the above-mentioned preset expiration time condition includes that the expiration time corresponding to the incremental key is less than the migration time corresponding to the above-mentioned migration duration. Thus, when the expiration time of the incremental key is less than the migration time corresponding to the migration duration, the expiration time of the incremental key can be automatically delayed to increase the expiration time of the incremental key. Finally, according to the incremental data synchronization information set, each incremental data corresponding to the incremental data synchronization information set is synchronized to the above-mentioned target end. Thus, the synchronization information of each accumulated incremental data can be written to the target end to achieve synchronization of the incremental data. Also, because the expiration time of the incremental data key is delayed, the expiration time of the incremental data key is increased. This can reduce the situation where the incremental data key expires and cannot be synchronized to the target end, and further reduce the number of times that the incremental data cannot be queried when switching to the target end to query data. Thus, the expiration time of the incremental data key can be automatically delayed, reducing the number of times that the incremental data cannot be queried when switching to the target end to query data.
[0062] Further references Figure 3, which shows a process 300 of another embodiment of a data synchronization method. The process 300 of the data synchronization method includes the following steps:
[0063] Step 301, in response to receiving full data corresponding to a target data migration request sent by a source end, the full data is parsed to obtain full data synchronization information.
[0064] Step 302: in response to receiving the incremental data synchronization information corresponding to the target data migration request sent by the source end, add the incremental data synchronization information to the incremental data synchronization information set.
[0065] In some embodiments, the specific implementation of steps 301-302 and the technical effects brought about can be referred to Figure 2 The corresponding steps 201-202 in the embodiments are not described in detail here.
[0066] Step 303: determine the number of each key included in the full amount of data as the total number of keys.
[0067] In some embodiments, the execution entity (eg, Figure 1 The migration terminal 107 shown may determine the number of keys included in the above-mentioned full data as the total number of keys. Here, the key may be understood as the key (Key) corresponding to the key-value pair.
[0068] Step 304: Determine the migration duration of the corresponding full data according to the ratio of the total number of keys to the preset number of keys.
[0069] In some embodiments, the execution entity may determine the migration duration corresponding to the full amount of data based on the ratio of the total number of keys to the preset number of keys. The preset number of keys may be a preset unit number of keys. For example, the preset number of keys may be 5 million. In practice, the execution entity may determine the product of the ratio and the preset duration as the migration duration corresponding to the full amount of data. The preset duration may be a preset unit duration. For example, the preset duration may be 30 minutes.
[0070] In some optional implementations of some embodiments, first, the execution subject may round up the ratio of the total number of keys to the preset number of keys to obtain a migration integer. Then, the product of the migration integer and the preset duration may be determined as the migration duration corresponding to the full amount of data. Thus, the migration duration of the full amount of data may be determined from the dimensions of the unit duration and the number of key units.
[0071] Step 305: synchronize the full data to the target end according to the full data synchronization information.
[0072] In some embodiments, the specific implementation of step 305 and the technical effects brought about can be referred to Figure 2 The corresponding step 204 in the embodiments will not be described in detail here.
[0073] Step 306: The difference between the migration duration and the expiration duration of the incremental key is determined as the remaining migration duration.
[0074] In some embodiments, the execution entity may determine the difference between the migration duration and the expiration duration of the incremental key as the remaining migration duration.
[0075] Step 307: The sum of the remaining migration duration and the preset duration is determined as the migration increase duration.
[0076] In some embodiments, the execution entity may determine the sum of the remaining migration duration and the preset duration as the migration increase duration. The preset duration may be a preset duration for adjusting the migration increase duration. For example, the preset duration may be 1 minute. The specific setting of the preset duration is not limited here.
[0077] Step 308: Determine the sum of the expiration time and the migration increase duration as the expiration time after the expiration time delay processing of the incremental key.
[0078] In some embodiments, the execution subject may determine the sum of the expiration time and the migration increase time as the expiration time after the delay processing of the expiration time of the incremental key. Thus, the expiration time of the incremental key can be made greater than the time when the final migration ends. Thus, the data consistency of the key on the source and target ends in the hot migration scenario can be ensured.
[0079] As an example, the incremental key may be KeyA. For details on the delay processing of the expiration time of the incremental key KeyA, please refer to Figure 4 . Figure 4 In the example, the migration duration may be T minutes. The expiration duration of the incremental key KeyA may be t minutes. The expiration time of the incremental key KeyA may be t1. The expiration time of the incremental key KeyA after the delay processing may be t3=t1+T-t+1. The expiration time t3 of the incremental key KeyA is greater than the migration time t2.
[0080] Step 309: synchronize each incremental data corresponding to the incremental data synchronization information set to the target end according to the incremental data synchronization information set.
[0081] In some embodiments, the specific implementation of step 309 and the technical effects brought about can be referred to Figure 2 The corresponding step 206 in the embodiments will not be described in detail here.
[0082] from Figure 3It can be seen that Figure 2 Compared with the description of some corresponding embodiments, Figure 3 The process 300 of the data synchronization method in some corresponding embodiments reflects the extended steps for the migration duration and the delayed processing of the expiration time. Therefore, the schemes described in these embodiments can ensure the data consistency of the key at the source and target ends in the hot migration scenario, releasing more human operation and maintenance resources.
[0083] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a data synchronization device. These device embodiments are similar to Figure 2 Corresponding to the method embodiments shown, the device can be specifically applied to various electronic devices.
[0084] like Figure 5 As shown, the data synchronization device 500 of some embodiments includes: a parsing unit 501, an adding unit 502, a determining unit 503, a first synchronization unit 504, a delay unit 505 and a second synchronization unit 506. Among them, the parsing unit 501 is configured to parse the full data in response to receiving the full data corresponding to the target data migration request sent by the source end to obtain the full data synchronization information; the adding unit 502 is configured to add the incremental data synchronization information to the incremental data synchronization information set in response to receiving the incremental data synchronization information corresponding to the target data migration request sent by the source end; the determination unit 503 is configured to determine the migration duration corresponding to the full data; the first synchronization unit 504 is configured to synchronize the full data to the target end according to the full data synchronization information; the delay unit 505 is configured to delay the expiration time of each incremental key that meets the preset expiration time condition according to the migration duration in response to determining that there are incremental keys that meet the preset expiration time condition among the incremental keys corresponding to the incremental data synchronization information set, wherein the preset expiration time condition includes that the expiration time corresponding to the incremental key is less than the migration time corresponding to the migration duration; the second synchronization unit 506 is configured to synchronize each incremental data of the corresponding incremental data synchronization information set to the target end according to the incremental data synchronization information set.
[0085] Optionally, before the parsing unit 501 , the data synchronization device 500 may further include: a request sending unit (not shown in the figure), configured to send a target data migration request to the above-mentioned source end.
[0086] Optionally, the determination unit 503 may be further configured to: determine the number of keys included in the full data as the total number of keys; and determine the migration duration corresponding to the full data based on the ratio of the total number of keys to the preset number of keys.
[0087] Optionally, the determination unit 503 can be further configured to: round up the ratio of the above-mentioned total number of keys to the preset number of keys to obtain a migration integer; and determine the product of the above-mentioned migration integer and the preset duration as the migration duration corresponding to the above-mentioned full amount of data.
[0088] Optionally, the delay unit 505 can be further configured to: determine the difference between the above-mentioned migration duration and the expiration duration of the above-mentioned incremental key as the remaining migration duration; determine the sum of the above-mentioned remaining migration duration and the preset duration as the migration increase duration; determine the sum of the above-mentioned expiration time and the above-mentioned migration increase time as the expiration time after the delay processing of the expiration time of the above-mentioned incremental key.
[0089] Optionally, the data synchronization device 500 may also include: a synchronization feedback information sending unit (not shown in the figure), which is configured to send synchronization feedback information corresponding to the above-mentioned target data migration request to the target client in response to detecting that the synchronization of each incremental data of the corresponding incremental data synchronization information set is completed.
[0090] It is understood that the units described in the device 500 are similar to those described in the reference Figure 2 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the device 500 and the units included therein, and will not be described in detail here.
[0091] Reference below Figure 6 , which shows an electronic device 600 (eg, Figure 1 A schematic diagram of the structure of the migration end 107). Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0092] like Figure 6 As shown, the electronic device 600 may include a processing device 601 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0093] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 6 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0094] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.
[0095] It should be noted that the computer-readable medium recorded in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0096] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0097] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: in response to receiving the full data corresponding to the target data migration request sent by the source end, parse the full data to obtain full data synchronization information; in response to receiving the incremental data synchronization information corresponding to the target data migration request sent by the source end, add the incremental data synchronization information to the incremental data synchronization information set; determine the migration duration corresponding to the full data; synchronize the full data to the target end according to the full data synchronization information; in response to determining that there is an incremental key that meets the preset expiration time condition among the incremental keys corresponding to the incremental data synchronization information set, according to the migration duration, delay the expiration time of each incremental key that meets the preset expiration time condition, wherein the preset expiration time condition includes that the expiration time corresponding to the incremental key is less than the migration time corresponding to the migration duration; according to the incremental data synchronization information set, synchronize each incremental data corresponding to the incremental data synchronization information set to the target end.
[0098] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0099] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0100] The units described in some embodiments of the present disclosure may be implemented by software or by hardware. The described units may also be provided in a processor, for example, may be described as: a processor including a parsing unit, an adding unit, a determining unit, a first synchronization unit, a delay unit, and a second synchronization unit. Among them, the names of these units do not constitute a limitation on the unit itself under certain circumstances. For example, the parsing unit may also be described as "a unit that, in response to receiving the full amount of data corresponding to the target data migration request sent by the source end, parses the above full amount of data to obtain full amount of data synchronization information".
[0101] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0102] Some embodiments of the present disclosure further provide a computer program product, including a computer program, which implements any of the above-mentioned data synchronization methods when executed by a processor.
[0103] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.
Claims
1. A data synchronization method, comprising: In response to receiving the full data corresponding to the target data migration request sent by the source end, parsing the full data to obtain full data synchronization information; In response to receiving the incremental data synchronization information corresponding to the target data migration request sent by the source end, adding the incremental data synchronization information to the incremental data synchronization information set; Determine the migration duration corresponding to the full amount of data; Synchronize the full data to the target end according to the full data synchronization information; In response to determining that there is an incremental key that meets a preset expiration time condition among the incremental keys corresponding to the incremental data synchronization information set, delaying the expiration time of each incremental key that meets the preset expiration time condition according to the migration duration, wherein the preset expiration time condition includes that the expiration time corresponding to the incremental key is less than the migration time corresponding to the migration duration; According to the incremental data synchronization information set, each incremental data corresponding to the incremental data synchronization information set is synchronized to the target end.
2. The method according to claim 1, wherein: Before parsing the full data in response to receiving the full data corresponding to the target data migration request sent by the source end to obtain the full data synchronization information, the method further includes: Sending a target data migration request to the source end.
3. The method according to claim 1, wherein: The determining of the migration duration corresponding to the full amount of data includes: Determine the number of each key included in the full amount of data as the total number of keys; The migration duration corresponding to the full amount of data is determined according to the ratio of the total number of keys to the preset number of keys.
4. The method according to claim 3, wherein: The determining, according to the ratio of the total number of keys to the preset number of keys, the migration duration corresponding to the full amount of data includes: Rounding up the ratio of the total number of keys to the preset number of keys to obtain a migration integer; The product of the migration integer and the preset duration is determined as the migration duration corresponding to the full amount of data.
5. The method according to claim 1, wherein: The delaying of the expiration time of each incremental key that meets the preset expiration time condition according to the migration time includes: Determine the difference between the migration duration and the expiration duration of the incremental key as the remaining migration duration; Determine the sum of the remaining migration duration and the preset duration as the migration increase duration; The sum of the expiration time and the migration increase duration is determined as the expiration time after the expiration time delay processing of the incremental key.
6. The method according to any one of claims 1 to 5, wherein: The method further comprises: In response to detecting that synchronization of each incremental data of the corresponding incremental data synchronization information set is completed, synchronization feedback information corresponding to the target data migration request is sent to the target client.
7. A data synchronization device, comprising: a parsing unit configured to, in response to receiving the full amount of data corresponding to the target data migration request sent by the source end, parse the full amount of data to obtain full amount of data synchronization information; an adding unit, configured to, in response to receiving the incremental data synchronization information corresponding to the target data migration request sent by the source end, add the incremental data synchronization information to the incremental data synchronization information set; A determination unit, configured to determine a migration duration corresponding to the full amount of data; A first synchronization unit is configured to synchronize the full data to a target end according to the full data synchronization information; a delay unit configured to, in response to determining that there is an incremental key satisfying a preset expiration time condition among the incremental keys corresponding to the incremental data synchronization information set, delay the expiration time of each incremental key satisfying the preset expiration time condition according to the migration duration, wherein the preset expiration time condition includes that the expiration time corresponding to the incremental key is less than the migration time corresponding to the migration duration; The second synchronization unit is configured to synchronize each incremental data corresponding to the incremental data synchronization information set to the target end according to the incremental data synchronization information set.
8. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer readable medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device of synchronizing incremental data in distributed non-relational database
CN107515874A
Block data synchronization method and device, equipment and storage medium
CN109684414A
Method and device for carrying out incremental synchronization
CN110019510A
Big data synchronization method and device based on Binlog, HBase and Hive
CN112286941A
Incremental synchronization delay determination method and device, equipment and readable storage medium
CN115455112A
