CN111241047B - File synchronization method and device - Google Patents

File synchronization method and device Download PDF

Info

Publication number
CN111241047B
CN111241047B CN202010337002.5A CN202010337002A CN111241047B CN 111241047 B CN111241047 B CN 111241047B CN 202010337002 A CN202010337002 A CN 202010337002A CN 111241047 B CN111241047 B CN 111241047B
Authority
CN
China
Prior art keywords
file
original
synchronization
data block
format
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010337002.5A
Other languages
Chinese (zh)
Other versions
CN111241047A (en
Inventor
刘国庆
窦志刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Infosec Technologies Co Ltd
Original Assignee
Beijing Infosec Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Infosec Technologies Co Ltd filed Critical Beijing Infosec Technologies Co Ltd
Priority to CN202010337002.5A priority Critical patent/CN111241047B/en
Publication of CN111241047A publication Critical patent/CN111241047A/en
Application granted granted Critical
Publication of CN111241047B publication Critical patent/CN111241047B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • G06F16/137Hash-based
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • G06F16/1794Details of file format conversion

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the technical field of computers, in particular to a file synchronization method and a device, a main synchronization device determines whether the data content of an original file before synchronization corresponding to a standby synchronization device is the same or not, if so, file difference information is generated according to the original file and a modified latest file, the file difference information is subjected to format conversion and is converted into a target format which can be identified by the standby synchronization device, so that the standby synchronization device performs file synchronization on the original file in the standby synchronization device according to the file difference information of the target format, if not, the modified latest file is subjected to format conversion and is converted into the target format which can be identified by the standby synchronization device, so that the standby synchronization device performs file synchronization on the original file in the standby synchronization device according to the latest file in the target format, therefore, files in different formats can be synchronized, and the file synchronization efficiency is improved.

Description

File synchronization method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a file synchronization method and apparatus.
Background
In practice, the same data is often used in the same type of devices or different types of devices, and when files with the same data in different devices need to be synchronized, the problem that all files need to be completely resynchronized may be caused due to different formats of the files that can be identified among the devices, so how to improve the efficiency in the file synchronization process becomes a problem to be solved.
Disclosure of Invention
The embodiment of the application provides a file synchronization method and device, so that the efficiency in the data synchronization process is improved.
The embodiment of the application provides the following specific technical scheme:
a file synchronization method, comprising:
the method comprises the steps that a primary synchronization device determines whether the data content of an original file to be synchronized in a standby synchronization device is the same or not, wherein the primary synchronization device and the standby synchronization device are different in format;
if the file difference information is the same as the original file, generating file difference information according to the original file and the modified latest file, and converting the format of the file difference information into a target format which can be identified by the standby synchronization equipment so that the standby synchronization equipment can perform file synchronization on the original file in the standby synchronization equipment according to the file difference information of the target format;
if the files are different, format conversion is carried out on the modified latest file, and the file is converted into a target format which can be identified by the standby synchronization equipment, so that the standby synchronization equipment carries out file synchronization on the original file in the standby synchronization equipment according to the latest file in the target format.
Optionally, the determining, by the primary synchronization device, whether the data content of the original file to be synchronized before the primary synchronization device is the same as that of the original file to be synchronized in the secondary synchronization device includes:
sending an original file verification request to the standby synchronization equipment, wherein the original file verification request at least comprises a first hash value of an original file in the main synchronization equipment and/or a second hash value generated by the original file and a preset special character;
and receiving a verification result returned by the standby synchronization equipment, and determining whether the data content of the original file to be synchronized in the standby synchronization equipment is the same as that of the original file, wherein the verification result is obtained by determining a third hash value of a locally corresponding original file and/or a fourth hash value of the locally corresponding original file and a preset special character after the standby synchronization equipment receives an original file verification request, and comparing the third hash value with the first hash value and/or comparing the fourth hash value with the second hash value.
Optionally, generating file difference information according to the original file and the modified latest file, specifically including:
dividing the original file into a plurality of original data blocks according to a preset dividing mode, and recording the number of each original data block;
comparing original data blocks with the same number with modified data blocks in sequence according to the minimum unit size, wherein the modified data blocks are obtained by modifying the original data blocks, and the modified latest file is generated by combining the modified data blocks and the original data blocks which are not modified;
and generating a data block difference list and a file synchronization list according to the comparison result, wherein the data block difference list at least comprises the minimum unit position and the difference content corresponding to the original data blocks with differences, each original data block with differences corresponds to one data block difference list, and the file synchronization list at least comprises the number of the original data block with differences, the number of the data block difference list corresponding to the original data block with differences and the hash value of the corresponding modified data block.
Optionally, the target format is a standard format of an original file in the standby synchronization device; performing format conversion on the file difference information to convert the file difference information into a target format which can be identified by the synchronization equipment, and specifically comprising the following steps:
carrying out format conversion on the file difference information to convert the file difference information into a public format;
carrying out format conversion on the file difference information in the public format, and converting the file difference information into a standard format which can be identified by the synchronous equipment;
or, if the target format is a public format, performing format conversion on the file difference information to convert the file difference information into a target format which can be identified by the synchronization device, specifically including:
and converting the format of the file difference information into a common format so that the synchronization equipment can convert the file difference information in the common format into a standard format.
Optionally, the target format is a standard format of an original file in the standby synchronization device; if the determination is different, performing format conversion on the modified latest file, and converting the format into a target format which can be identified by the synchronization device, specifically including:
carrying out format conversion on the modified latest file to convert the latest file into a public format;
carrying out format conversion on the modified latest file in the public format, and converting the format into a standard format which can be identified by the synchronous equipment;
or, if the target format is a common format, if the target format is determined to be different from the common format, performing format conversion on the modified latest file, and converting the modified latest file into a target format which can be identified by the synchronization device, specifically including:
and converting the format of the modified latest file into a common format so that the synchronization equipment can convert the modified latest file in the common format into a standard format.
Optionally, if the determination is different, performing format conversion on the modified latest file, and converting the format into a target format that can be identified by the standby synchronization device, so that the standby synchronization device performs file synchronization on the original file in the standby synchronization device according to the latest file in the target format, specifically including:
dividing the modified latest file into a plurality of modified data blocks, and generating a data block numbering list according to the dividing sequence, wherein the data block head of each modified data block at least comprises a data block numbering, and the data block numbering list at least comprises the number of the modified data block and the corresponding number representing the splitting sequence;
and sending the data block numbering list and the modified data blocks to the standby synchronization equipment so that the standby synchronization equipment performs file synchronization on the original file in the standby synchronization equipment according to the data block numbering list in the target format and the plurality of modified data blocks.
A file synchronization method, comprising:
the standby synchronization equipment determines whether the data content of the original file to be synchronized in the main synchronization equipment is the same or not according to the original file verification request sent by the main synchronization equipment, and returns a verification result to the main synchronization equipment;
receiving file difference information of a target format sent by the main synchronization equipment, and performing file synchronization on an original file according to the file difference information, wherein the file difference information of the target format is obtained by performing format conversion after generating file difference information according to the original file and a modified latest file when the main synchronization equipment determines that the verification results are the same; or the like, or, alternatively,
and receiving the latest file in the target format sent by the main synchronization equipment, and synchronizing the original file in the standby synchronization equipment according to the latest file, wherein the latest file in the target format is obtained by converting the format of the latest file after modification when the main synchronization equipment determines that the verification results are different.
Optionally, the method for determining, by the standby synchronization device, whether data content of an original file to be synchronized before the original file is the same as that of a corresponding original file to be synchronized in the primary synchronization device according to an original file verification request sent by the primary synchronization device includes:
determining a third hash value of the locally corresponding original file and/or a fourth hash value of the locally corresponding original file and a preset special character according to the original file verification request, wherein the original file verification request at least comprises a first hash value of the original file in the main synchronization equipment and/or a second hash value generated by the original file and the preset special character;
and comparing the third hash value with the first hash value and/or comparing the fourth hash value with the second hash value, if the comparison results are determined to be the same, determining that the data content of the original file to be synchronized in the main synchronization device is the same, and if any comparison result is determined to be different, determining that the data content of the original file to be synchronized in the main synchronization device is different.
Optionally, the file difference information at least includes a data block difference list and a file synchronization list; receiving file difference information of a target format sent by the master synchronization device, and performing file synchronization on an original file according to the file difference information, specifically comprising:
determining corresponding original data blocks with differences in original files in the standby synchronization equipment according to the numbers of the original data blocks with differences in the file synchronization list, wherein the corresponding original files in the primary synchronization equipment and the standby synchronization equipment are divided into a plurality of original data blocks according to a preset dividing mode respectively, the latest file in the primary synchronization equipment is generated by combining a modified data block and an unmodified original data block, the modified data block is obtained by modifying the original data block, and the file synchronization list at least comprises the numbers of the original data blocks with differences, the numbers of the data block difference lists corresponding to the original data blocks with differences and the hash values of the corresponding modified data blocks;
according to the serial number of a data block difference list corresponding to the original data blocks with differences in the file synchronization list and the data block difference list, modifying the corresponding original data blocks with differences in the original file in the standby synchronization equipment respectively to generate modified data blocks, wherein the data block difference list at least comprises the minimum unit position and difference content corresponding to the original data blocks with differences, and each original data block with differences corresponds to one data block difference list;
and combining the unmodified original data blocks in the original file in the standby synchronization equipment with the generated modified data blocks, and replacing the original file with the combined generated file to realize file synchronization.
Optionally, receiving the latest file in the target format sent by the primary synchronization device, and synchronizing the original file in the secondary synchronization device according to the latest file, specifically including:
receiving a modified data block and a data block number list of the latest file in a target format, which are sent by the master synchronization device, wherein the latest file is divided into a plurality of modified data blocks according to a preset dividing mode, and the data block number list at least comprises the numbers of the modified data blocks and the corresponding numbers representing the splitting sequence;
storing the modified data block of the latest file into a temporary storage area;
and sequentially reading the modified data blocks in the temporary storage area according to the numbers which are corresponding to the modified data blocks and represent the splitting sequence, combining the read modified data blocks according to the reading sequence, and replacing the original file with the file generated by combination to realize file synchronization.
Optionally, further comprising:
receiving a fifth hash value of the latest file sent by the master synchronization device, and/or a sixth hash value of the latest file and a preset special character;
determining a seventh hash value of the file generated by combination and/or an eighth hash value of the file generated by combination and a preset special character;
and comparing the fifth hash value with the seventh hash value and/or comparing the sixth hash value with the eighth hash value, if the comparison results are the same, determining that the file generated by the combination is correct, and if any comparison result is different, determining that the file generated by the combination is incorrect.
Optionally, after generating each modified data block, the method further includes:
respectively determining ninth hash values of the generated modified data blocks;
and comparing the ninth hash value of each modified data block with the hash value of the corresponding modified data block in the file synchronization list, if the comparison result is the same, determining that each generated modified data block is correctly modified, and if the comparison result is different, determining that the generated modified data block is incorrectly modified.
A file synchronization device applied to a master synchronization device comprises:
the device comprises a determining module, a synchronization module and a synchronization module, wherein the determining module is used for determining whether the data content of an original file to be synchronized in a standby synchronization device is the same or not, and the formats of the original file in the main synchronization device and the original file in the standby synchronization device are different;
the first processing module is used for generating file difference information according to the original file and the modified latest file if the original file and the modified latest file are the same, converting the format of the file difference information into a target format which can be identified by the standby synchronization equipment, and enabling the standby synchronization equipment to perform file synchronization on the original file in the standby synchronization equipment according to the file difference information of the target format;
and the second processing module is used for converting the format of the modified latest file into a target format which can be identified by the standby synchronization equipment if the determination result is different, so that the standby synchronization equipment can perform file synchronization on the original file in the standby synchronization equipment according to the latest file in the target format.
Optionally, the determining module is specifically configured to:
sending an original file verification request to the standby synchronization equipment, wherein the original file verification request at least comprises a first hash value of an original file in the main synchronization equipment and/or a second hash value generated by the original file and a preset special character;
and receiving a verification result returned by the standby synchronization equipment, and determining whether the data content of the original file to be synchronized in the standby synchronization equipment is the same as that of the original file, wherein the verification result is obtained by determining a third hash value of a locally corresponding original file and/or a fourth hash value of the locally corresponding original file and a preset special character after the standby synchronization equipment receives an original file verification request, and comparing the third hash value with the first hash value and/or comparing the fourth hash value with the second hash value.
Optionally, the first processing module is specifically configured to:
dividing the original file into a plurality of original data blocks according to a preset dividing mode, and recording the number of each original data block;
comparing original data blocks with the same number with modified data blocks in sequence according to the minimum unit size, wherein the modified data blocks are obtained by modifying the original data blocks, and the modified latest file is generated by combining the modified data blocks and the original data blocks which are not modified;
and generating a data block difference list and a file synchronization list according to the comparison result, wherein the data block difference list at least comprises the minimum unit position and the difference content corresponding to the original data blocks with differences, each original data block with differences corresponds to one data block difference list, and the file synchronization list at least comprises the number of the original data block with differences, the number of the data block difference list corresponding to the original data block with differences and the hash value of the corresponding modified data block.
Optionally, the target format is a standard format of an original file in the standby synchronization device; the first processing module is specifically configured to:
carrying out format conversion on the file difference information to convert the file difference information into a public format;
carrying out format conversion on the file difference information in the public format, and converting the file difference information into a standard format which can be identified by the synchronous equipment;
or, if the target format is a public format, the first processing module is specifically configured to:
and converting the format of the file difference information into a common format so that the synchronization equipment can convert the file difference information in the common format into a standard format.
Optionally, the target format is a standard format of an original file in the standby synchronization device; the second processing module is specifically configured to:
carrying out format conversion on the modified latest file to convert the latest file into a public format;
carrying out format conversion on the modified latest file in the public format, and converting the format into a standard format which can be identified by the synchronous equipment;
or, if the target format is a common format, and if the target format is determined to be different from the common format, the second processing module is specifically configured to:
and converting the format of the modified latest file into a common format so that the synchronization equipment can convert the modified latest file in the common format into a standard format.
Optionally, the second processing module is specifically configured to:
dividing the modified latest file into a plurality of modified data blocks, and generating a data block numbering list according to the dividing sequence, wherein the data block head of each modified data block at least comprises a data block numbering, and the data block numbering list at least comprises the number of the modified data block and the corresponding number representing the splitting sequence;
and sending the data block numbering list and the modified data blocks to the standby synchronization equipment so that the standby synchronization equipment performs file synchronization on the original file in the standby synchronization equipment according to the data block numbering list in the target format and the plurality of modified data blocks.
A file synchronization device is applied to a standby synchronization device and comprises:
the first processing module is used for determining whether the data content of an original file to be synchronized in the main synchronization equipment is the same as the data content of the original file to be synchronized before the original file is determined according to an original file verification request sent by the main synchronization equipment, and returning a verification result to the main synchronization equipment;
the second processing module is used for receiving the file difference information of the target format sent by the main synchronization equipment and carrying out file synchronization on the original file according to the file difference information, wherein the file difference information of the target format is obtained by carrying out format conversion after the original file and the modified latest file generate the file difference information when the main synchronization equipment determines that the verification results are the same; or the like, or, alternatively,
and the third processing module is used for receiving the latest file in the target format sent by the main synchronization equipment and synchronizing the original file in the standby synchronization equipment according to the latest file, wherein the latest file in the target format is obtained by converting the format of the latest file after modification when the main synchronization equipment determines that the verification results are different.
Optionally, the first processing module is specifically configured to:
determining a third hash value of the locally corresponding original file and/or a fourth hash value of the locally corresponding original file and a preset special character according to the original file verification request, wherein the original file verification request at least comprises a first hash value of the original file in the main synchronization equipment and/or a second hash value generated by the original file and the preset special character;
and comparing the third hash value with the first hash value and/or comparing the fourth hash value with the second hash value, if the comparison results are determined to be the same, determining that the data content of the original file to be synchronized in the main synchronization device is the same, and if any comparison result is determined to be different, determining that the data content of the original file to be synchronized in the main synchronization device is different.
Optionally, the file difference information at least includes a data block difference list and a file synchronization list; the second processing module is specifically configured to:
determining corresponding original data blocks with differences in original files in the standby synchronization equipment according to the numbers of the original data blocks with differences in the file synchronization list, wherein the corresponding original files in the primary synchronization equipment and the standby synchronization equipment are divided into a plurality of original data blocks according to a preset dividing mode respectively, the latest file in the primary synchronization equipment is generated by combining a modified data block and an unmodified original data block, the modified data block is obtained by modifying the original data block, and the file synchronization list at least comprises the numbers of the original data blocks with differences, the numbers of the data block difference lists corresponding to the original data blocks with differences and the hash values of the corresponding modified data blocks;
according to the serial number of a data block difference list corresponding to the original data blocks with differences in the file synchronization list and the data block difference list, modifying the corresponding original data blocks with differences in the original file in the standby synchronization equipment respectively to generate modified data blocks, wherein the data block difference list at least comprises the minimum unit position and difference content corresponding to the original data blocks with differences, and each original data block with differences corresponds to one data block difference list;
and combining the unmodified original data blocks in the original file in the standby synchronization equipment with the generated modified data blocks, and replacing the original file with the combined generated file to realize file synchronization.
Optionally, the third processing module is specifically configured to:
receiving a modified data block and a data block number list of the latest file in a target format, which are sent by the master synchronization device, wherein the latest file is divided into a plurality of modified data blocks according to a preset dividing mode, and the data block number list at least comprises the numbers of the modified data blocks and the corresponding numbers representing the splitting sequence;
storing the modified data block of the latest file into a temporary storage area;
and sequentially reading the modified data blocks in the temporary storage area according to the numbers which are corresponding to the modified data blocks and represent the splitting sequence, combining the read modified data blocks according to the reading sequence, and replacing the original file with the file generated by combination to realize file synchronization.
Optionally, further comprising: a first verification module to:
receiving a fifth hash value of the latest file sent by the master synchronization device, and/or a sixth hash value of the latest file and a preset special character;
determining a seventh hash value of the file generated by combination and/or an eighth hash value of the file generated by combination and a preset special character;
and comparing the fifth hash value with the seventh hash value and/or comparing the sixth hash value with the eighth hash value, if the comparison results are the same, determining that the file generated by the combination is correct, and if any comparison result is different, determining that the file generated by the combination is incorrect.
Optionally, after generating each modified data block, the method further includes: a second verification module to:
respectively determining ninth hash values of the generated modified data blocks;
and comparing the ninth hash value of each modified data block with the hash value of the corresponding modified data block in the file synchronization list, if the comparison result is the same, determining that each generated modified data block is correctly modified, and if the comparison result is different, determining that the generated modified data block is incorrectly modified.
An electronic device comprises a memory, a processor and a computer program stored on the memory and operable on the processor, wherein the processor implements the steps of the file synchronization method when executing the program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned file synchronization method.
In the embodiment of the application, if the primary synchronization device determines that the original file is the same as the corresponding original file to be synchronized in the standby synchronization device, file difference information is generated according to the original file and the modified latest file, format conversion is performed on the file difference information in the original file format and is converted into a target format which can be identified by the standby synchronization device, and then file synchronization is achieved.
Drawings
FIG. 1 is a flowchart of a file synchronization method according to an embodiment of the present application;
FIG. 2 is a flow chart of another file synchronization method in an embodiment of the present application;
FIG. 3 is a diagram illustrating another exemplary file synchronization method according to the present application;
FIG. 4 is a flowchart of file synchronization when original files are the same in the embodiment of the present application;
FIG. 5 is a flowchart illustrating synchronization of files when the original files are different according to an embodiment of the present disclosure;
FIG. 6 is a flowchart illustrating checking correctness of a file according to an embodiment of the present application;
FIG. 7 is a flow chart of correctness checking of modified data blocks in the embodiment of the present application;
FIG. 8 is a diagram illustrating an exemplary file synchronization apparatus;
FIG. 9 is a diagram of another file synchronization apparatus according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In practical applications, the same file data is often used in the same type of devices or different types of devices, but when the same file data in different devices needs to be synchronized, the received file cannot be identified and further cannot be synchronized due to different identifiable file formats between different devices, so that all transmitted files need to be completely re-synchronized to achieve file synchronization, which may result in a problem of low file synchronization efficiency.
Therefore, in view of the above problems, in the embodiments of the present application, a file synchronization method is provided, where it is determined whether data contents of original files to be synchronized in a primary synchronization device and a secondary synchronization device are the same, if the data contents are determined to be the same, file difference information is generated, the file difference information is converted into a target format, and then the secondary synchronization device synchronizes the original files in the secondary synchronization device according to a latest file in the target format, or, when the original files are determined to be different, the latest file after modification is converted into a target format that can be recognized by the secondary synchronization device, so that the secondary synchronization device synchronizes the original files.
Based on the foregoing embodiment, referring to fig. 1, a flowchart of a file synchronization method in the embodiment of the present application is mainly applied to a master synchronization device, and specifically includes:
step 100: the primary synchronization equipment determines whether the data content of the original file to be synchronized is the same as that of the corresponding original file to be synchronized in the standby synchronization equipment.
The original file formats in the main synchronization device and the standby synchronization device are different.
Specifically, when step 100 is executed, the method specifically includes:
s1: the primary synchronization device sends an original file verification request to the standby synchronization device.
The original file verification request at least comprises a first hash value of an original file in the master synchronization device and/or a second hash value generated by the original file and a preset special character.
Specifically, in executing step S1, the original file authentication request can be divided into three different cases.
In the first case: the original file verification request at least comprises a first hash value of the original file in the master synchronization device.
In the embodiment of the application, the original file in the primary synchronization device obtains a first hash value of the original file according to a hash algorithm, and then stores the first hash value of the original file in an original file verification request and sends the first hash value of the original file to the standby synchronization device.
For example, the primary synchronization device performs a hash operation on the original file to obtain a first hash value Ha0 of the original file, and then stores the first hash value Ha0 in the original file verification request to send to the backup synchronization device.
In the second case: the original file verification request at least comprises a second hash value generated by the original file and the preset special character.
In the embodiment of the application, the original file in the master synchronization device performs hash operation on the original file and the preset special character according to the hash operation to obtain a second hash value of the original file and the preset special character, and then stores the second hash value in the original file verification request and sends the second hash value to the slave synchronization device.
For example, the primary synchronization device performs hash operation on the original file and a preset special character to obtain a second hash value Ha1, stores the second hash value Ha1 in the original file verification request, and further sends the original file verification request to the standby synchronization device.
In the third case: the original file verification request at least comprises a first hash value of the original file in the master synchronization device and a second hash value generated by the original file and the preset special characters.
In the embodiment of the application, the primary synchronization device performs hash operation on an original file to be synchronized to obtain a first hash value of the original file, and the primary synchronization device performs hash operation on the original file to be synchronized and a special character to obtain a second hash value of the original file, and then stores the first hash value and the second hash value of the original file in an original file verification request and sends the first hash value and the second hash value to the standby synchronization device.
For example, the original file in the master synchronization device is subjected to a hash operation to obtain a first hash value of the original file as Ha0, the master synchronization device performs a hash operation on the original file and preset special characters to obtain a second hash value of the original file as Ha1, and the master synchronization device stores the first hash value Ha0 and the second hash value Ha1 in the original file verification request and sends the first hash value Ha0 and the second hash value Ha1 to the slave synchronization device together.
In the embodiment of the application, the first hash value and/or the second hash value is carried in the original file verification request, so that the standby synchronization device can determine whether corresponding original files are the same, and may only use the first hash value or the second hash value, and may also use the first hash value and the second hash value simultaneously in order to improve accuracy.
Further, based on the three different situations, the original file verification request further includes at least a file number of the original file, where the file number is stored in a file storage list, the file storage list is used to store correspondence between files in the primary synchronization device and the secondary synchronization device, and includes at least the file number and a local file storage path, the primary synchronization device and the secondary synchronization device correspond to one file storage list respectively, and when the secondary synchronization device receives the file number, the file storage path corresponding to the file number can be found according to the corresponding file storage list, so as to obtain the corresponding original file to be synchronized.
S2: and the main synchronization equipment receives the verification result returned by the standby synchronization equipment and determines whether the data content of the original file to be synchronized in the standby synchronization equipment is the same or not.
And the verification result is obtained by determining a third hash value of the original file corresponding to the local and/or a fourth hash value of the original file corresponding to the local and a preset special character after the original file verification request is received by the standby synchronization equipment, and comparing the third hash value with the first hash value and/or comparing the fourth hash value with the second hash value.
In this embodiment of the application, the step S2 is executed, which specifically includes:
1) and the standby synchronization equipment retrieves the original file in the standby synchronization equipment according to the file number stored in the file storage list.
In the embodiment of the application, when the standby synchronization device receives an original file verification request, a file storage path of an original file in the standby synchronization device is retrieved from a file storage list according to a file number in the original file verification request, and a corresponding original file to be synchronized in the standby synchronization device is obtained.
For example, if the file number in the original file verification request is a, after the standby synchronization device receives the file number a sent by the master synchronization device, the file storage path of the corresponding original file is found in the file storage list of the standby synchronization device according to the file number a, so as to obtain the corresponding original file.
The file storage list is used for storing the corresponding relation of the original files of the main synchronization device and the standby synchronization device. The main synchronization equipment only needs to send the file number of the original file to the standby synchronization equipment, and the standby synchronization equipment can find the corresponding original file according to the file number. As shown in table 1 below, a list example is stored for the files.
Table 1.
Figure 985882DEST_PATH_IMAGE001
As shown in table 1, the file storage lists respectively correspond to the main synchronization device and the backup synchronization device, for example, if the file number of the main synchronization device is a, the file number a corresponding to the backup synchronization device is found according to the file number a, and then the corresponding file storage path D: \ text.xml in the backup synchronization device is found, then data synchronization is performed between the original files corresponding to the two file storage paths, i.e., C: \ text.txt and D: \ text.xml, and if the file number of the main synchronization device is b, then data synchronization is performed between the original files corresponding to the file storage paths C: \\ text 0.txt and C: \\ text 0.pdf, which correspond to the file number b.
2) And the standby synchronization equipment returns the verification result to the main synchronization equipment, and the main synchronization equipment receives the verification result returned by the standby synchronization equipment and determines whether the data content of the original file to be synchronized in the standby synchronization equipment is the same as that of the original file to be synchronized.
Correspondingly, the verification result returned by the standby synchronization device can also be obtained by comparison according to different situations, and the method is specifically divided into the following three situations:
in the first case: the verification result is obtained according to the comparison of the third hash value and the first hash value.
In the embodiment of the application, the standby synchronization device obtains a third hash value through hash operation according to a locally corresponding original file in the standby synchronization device, and then compares the third hash value with the received first hash value to obtain a verification result.
For example, the standby synchronization device obtains the third hash value Hb0 of the original file, then compares the third hash value Hb0 with the received first hash value Ha0, determines whether Hb0 is the same as Ha0, and further obtains a verification result.
That is, if the first hash value is the same as the third hash value, it is determined that the data content of the original file to be synchronized in the primary synchronization device is the same as that of the original file to be synchronized in the backup synchronization device. And if the first hash value is different from the third hash value, determining that the data content of the corresponding original file to be synchronized in the main synchronization device is different from that of the original file to be synchronized in the standby synchronization device.
In the second case: and the verification result is obtained according to the comparison of the fourth hash value and the second hash value.
In the embodiment of the application, the standby synchronization device obtains a fourth hash value through hash operation according to an original file to be synchronized in the standby synchronization device and a preset special character, and then compares the fourth hash value with the received second hash value to obtain a verification result.
For example, the standby synchronization device obtains a fourth hash value Hb1 through a hash operation, and then compares the fourth hash value Hb1 with the received second hash value Ha1 to determine whether Ha1 is the same as Hb1, thereby obtaining a verification result.
That is, if the second hash value is the same as the fourth hash value, it can be determined that the data content of the original file to be synchronized in the primary synchronization device is the same as that of the original file to be synchronized in the backup synchronization device. If the second hash value is different from the fourth hash value, it can be determined that the data contents of the corresponding original file to be synchronized in the master synchronization device and the slave synchronization device are different.
In the third case: the verification result is obtained by comparing the third hash value with the first hash value and comparing the fourth hash value with the second hash value.
In the embodiment of the application, the standby synchronization device obtains a third hash value through hash operation according to an original file to be synchronized in the standby synchronization device, obtains a fourth hash value through hash operation on the original file and a preset special character, compares the third hash value with the received first hash value, and compares the fourth hash value with the received second hash value to further obtain a verification result.
For example, the standby synchronization device performs a hash operation on the original file to obtain a third hash value Hb0, performs a hash operation on the original file and a preset special character to obtain a fourth hash value Hb1, compares the fourth hash value Hb1 with the second hash value Ha1, and compares the third hash value Hb0 with the first hash value Ha0 to obtain a verification result.
Therefore, only when Ha0 is the same as Hb0, and Ha1 is the same as Hb1, that is, the first hash value is the same as the third hash value, and the second hash value is the same as the fourth hash value, the data content of the original file before synchronization in the primary synchronization device and the standby synchronization device is the same, the method for verifying both the two hash values can prevent hash collision, can further verify the data content of the original file, and further ensure the correctness of original file verification.
Step 110: if the primary synchronization equipment determines that the original file and the modified latest file are the same, file difference information is generated according to the original file and the modified latest file, format conversion is carried out on the file difference information, and the file difference information is converted into a target format which can be identified by the standby synchronization equipment, so that the standby synchronization equipment carries out file synchronization on the original file in the standby synchronization equipment according to the file difference information of the target format.
Executing step 110, specifically including:
s1: the main synchronization equipment divides the original file into a plurality of original data blocks according to a preset division mode and records the number of each original data block.
For example, the primary synchronization device may divide the original file into a plurality of original data blocks at an interval of 100 minimum units, and the preset dividing manner is not limited in the embodiment of the present application.
And after the main control device divides the original data blocks, numbering the original data blocks and recording the numbers.
S2: and comparing the original data blocks with the same number with the modified data blocks in sequence according to the minimum unit size.
The modified data block is obtained by modifying the original data block, and the modified latest file is generated by combining the modified data block and the unmodified original data block.
For example, if the number of an original data block is 1 and the number of a modified data block is also 1, the number 1 original data block and the number 1 modified data block are compared with each minimum unit in the data block according to the minimum unit size.
The minimum unit refers to a unit of storage of the file, and may be: one byte, one character, and the data block are composed of a plurality of minimum units, which are not limited in the embodiment of the present application.
S3: and generating a data block difference list and a file synchronization list according to the comparison result.
The file synchronization list at least comprises the number of the original data blocks with differences, the number of the data block difference list corresponding to the original data blocks with differences and the hash value of the corresponding modified data block.
That is, the file difference information in the embodiment of the present application at least includes a data block difference list and a file synchronization list.
S4: and converting the format of the file difference information into a target format which can be identified by the standby synchronization equipment, so that the standby synchronization equipment performs file synchronization on the original file in the standby synchronization equipment according to the file difference information of the target format.
In the embodiment of the present application, the execution of step S4 may be specifically divided into the following two cases:
in the first case: the target format is a standard format of an original file in the standby synchronization device, and specifically includes:
1) and converting the format of the file difference information into a public format.
2) And carrying out format conversion on the file difference information in the common format, and converting the file difference information into a standard format which can be identified by the synchronous equipment.
For example, the primary synchronization device first converts the file difference information in the html format to the html format, which is a common format that both the primary synchronization device and the standby synchronization device can recognize, and then the primary synchronization device converts the file difference information in the html format to the xls format, which is a format that the standby synchronization device can recognize.
In the second case: the target format is a public format, and specifically includes:
and converting the format of the file difference information into a common format so that the synchronous equipment can convert the file difference information in the common format into a standard format.
In the embodiment of the application, the primary synchronization device converts the file difference information into a common format, then sends the file difference information in the common format to the standby synchronization device, and the standby synchronization device converts the file difference information in the common format into the file difference information in the standard format.
For example, the primary synchronization device converts the file difference information in the html format to the html format, and the secondary synchronization device converts the file difference information in the html format to the xls format.
Step 120: if the files are different, format conversion is carried out on the modified latest file, and the latest file is converted into a target format which can be identified by the standby synchronization equipment, so that the standby synchronization equipment carries out file synchronization on the original file in the standby synchronization equipment according to the latest file in the target format.
When step 120 is executed, the method specifically includes:
s1: and dividing the modified latest file into a plurality of modified data blocks, and generating a data block numbering list according to the dividing sequence.
The data block head of each modified data block at least comprises a data block number, and the data block number list at least comprises the number of the modified data block and the corresponding number representing the splitting sequence. Wherein the data block number is included in the data block header of the modified data block.
Therefore, in the embodiment of the present application, each modified data block is composed of a data block header including the current number of the data block and a data block data content including the content actually stored in the data block.
For example, the header of the first modified data block stores a data block index of 1.
Before executing step S1, the primary synchronization device converts the format of the modified latest file into a target format that can be recognized by the standby synchronization device, which may specifically be in the following two ways:
the first mode is as follows: the target format is a standard format of an original file in the standby synchronization equipment; if the determination is different, performing format conversion on the modified latest file, and converting the format into a target format which can be identified by the synchronization device, specifically including:
1) and converting the format of the modified latest file into a public format.
2) And converting the format of the modified latest file in the common format into a standard format which can be identified by the synchronization equipment.
The second mode is as follows: if the target format is the common format, if the target format is different, performing format conversion on the modified latest file, and converting the modified latest file into a target format which can be identified by the synchronization equipment, wherein the format conversion specifically comprises the following steps: and converting the format of the modified latest file into a common format so that the synchronization equipment can convert the modified latest file in the common format into a standard format.
S2: and the main synchronization equipment sends the data block numbering list and the modified data blocks to the standby synchronization equipment so that the standby synchronization equipment carries out file synchronization on the original file in the standby synchronization equipment according to the data block numbering list in the target format and the plurality of modified data blocks.
In this way, in the embodiment of the present application, the standby synchronization device sends the verification result to the primary synchronization device according to the received original file verification request, if the verification results are the same, the standby synchronization device receives the file difference information of the target format sent by the primary synchronization device, synchronizes the original file according to the file difference information, and if the verification results are different, receives the latest file sent by the primary synchronization device, and further performs file synchronization.
Referring to fig. 2, a flowchart of another file synchronization method in the embodiment of the present application is mainly applied to a device for synchronization, and specifically includes:
step 200: and the standby synchronization equipment determines whether the data content of the original file to be synchronized in the main synchronization equipment is the same or not according to the original file verification request sent by the main synchronization equipment, and returns a verification result to the main synchronization equipment.
In the embodiment of the present application, the step 200 is executed, and specifically includes:
s1: and determining a third hash value of the locally corresponding original file and/or a fourth hash value of the locally corresponding original file and the preset special character according to the original file verification request, wherein the original file verification request at least comprises a first hash value of the original file in the main synchronization equipment and/or a second hash value generated by the original file and the preset special character.
S2: and comparing the third hash value with the first hash value and/or comparing the fourth hash value with the second hash value, if the comparison results are the same, determining that the data content of the original file to be synchronized in the main synchronization device is the same, and if any comparison result is different, determining that the data content of the original file to be synchronized in the main synchronization device is not the same.
In the embodiment of the application, the standby synchronization device receives a first hash value of an original file and/or a second hash value of the original file sent by the main synchronization device, then finds a corresponding original file according to the file storage list, obtains a third hash value of the original file and/or a fourth hash value of the original file, and compares the third hash value with the first hash value and/or compares the fourth hash value with the second hash value.
Step 210: and receiving the file difference information of the target format sent by the main synchronization equipment, and carrying out file synchronization on the original file according to the file difference information.
And the file difference information of the target format is obtained by format conversion after the master synchronization equipment determines that the verification results are the same and generates the file difference information according to the original file and the modified latest file.
In this embodiment of the present application, when the step 210 is executed, the method specifically includes:
s1: and the standby synchronization equipment determines the corresponding original data blocks with differences in the original files in the standby synchronization equipment according to the numbers of the original data blocks with differences in the file synchronization list.
The method comprises the steps that corresponding original files in a main synchronization device and a standby synchronization device are divided into a plurality of original data blocks according to a preset dividing mode respectively, a latest file in the main synchronization device is generated by combining a modified data block and an unmodified original data block, the modified data block is obtained by modifying the original data block, and a file synchronization list at least comprises the number of the original data block with difference, the number of a data block difference list corresponding to the original data block with difference and the hash value of the corresponding modified data block.
S2: and respectively modifying the corresponding original data blocks with differences in the original file in the standby synchronization equipment according to the serial numbers of the data block difference lists corresponding to the original data blocks with differences in the file synchronization list and the data block difference lists to generate modified data blocks.
The data block difference list at least comprises minimum unit positions and difference contents corresponding to original data blocks with differences, and each original data block with differences corresponds to one data block difference list.
S3: the original data blocks which are not modified in the original file in the synchronization equipment and the generated modified data blocks are combined, and the file generated by combination replaces the original file to realize file synchronization.
Step 220: and receiving the latest file in the target format sent by the main synchronization equipment, and synchronizing the original file in the standby synchronization equipment according to the latest file.
And when the master synchronization equipment determines that the verification results are different, the latest file in the target format is obtained by converting the format of the latest file after modification.
When step 220 is executed, the method specifically includes:
s1: and receiving a modified data block and a data block number list of the latest file in the target format sent by the master synchronization equipment.
The latest file is divided into a plurality of modified data blocks according to a preset dividing mode, and the data block numbering list at least comprises the numbers of the modified data blocks and the corresponding numbers representing the splitting sequence.
The data block numbering list is mainly used for explaining a list of data block splitting sequence under the condition that original files are different before synchronization of the main synchronization device and the standby synchronization device, so that the standby synchronization device can assemble and generate the synchronization files according to the data numbering list.
In the embodiment of the application, the file synchronization assembly process can be carried out by using the data block numbering list, the content of the data block in the data block numbering list is not considered, and the file synchronization can be carried out only according to the number which represents the splitting sequence in the data block numbering list, so that when a multi-device or multi-thread data block is used for splitting the data block, each device or thread can split the original file according to the number rule of the device or thread, then the splitting numbering result is added to the data block numbering list according to the sequence, and further after the split modified data block is received by the standby synchronization device, the temporary data block is generated by using the multi-device or multi-thread, the temporary data block is segmented and assembled, then the assembled temporary data block file is assembled according to the number in the head part of the modified data block and the number which represents the splitting sequence in the data block numbering list, and combining the files in a one-to-one correspondence manner to generate a new file after synchronization.
S2: and storing the modified data block of the latest file into the temporary storage area.
S3: and sequentially reading the modified data blocks in the temporary storage area according to the numbers which are corresponding to the modified data blocks and represent the splitting sequence, combining the read modified data blocks according to the reading sequence, and replacing the original file with the file generated by combination to realize file synchronization.
In the embodiment of the application, the standby synchronization device sequentially reads the data blocks in the temporary storage area according to the corresponding numbers which represent the splitting order in the data block number list, and generates the synchronization file.
For example, an example of a data block numbering list is shown in table 2.
Table 2.
Figure 699760DEST_PATH_IMAGE002
In the above table of the embodiment of the present application, the data blocks in the temporary storage area are sequentially read by the synchronization device according to the corresponding numbers indicating the splitting order, as shown in table 2, that is, the data blocks with the numbers 1, 3, 5, B, and 2 are sequentially read, and then the data blocks are combined to generate a synchronization file, that is, a latest file after file synchronization, to replace an original file, thereby implementing file synchronization.
In the embodiment of the application, the standby synchronization equipment receives the verification result sent by the main synchronization equipment, receives the file difference information of the target format sent by the main synchronization equipment and performs file synchronization if the verification result is that the original files are the same, and receives the latest file of the target format sent by the main synchronization equipment and further synchronizes the original files if the verification result is that the original files are different.
Based on the foregoing embodiment, a specific application scenario is used below to describe a case of performing file synchronization when data contents of original files are the same, where a primary synchronization device is a device a, and a secondary synchronization device is a device B, and at this time, an original file format configured by the device a is a.xml, and an original file format configured by the device B is b.xls, and specifically refer to fig. 3, which is a schematic diagram of another file synchronization method in this embodiment, and includes:
step 300: and the device A generates file difference information according to the original file a.xml and the modified latest file a 1.xml.
In the embodiment of the present application, the step 300 is executed, which specifically includes:
and S1, dividing the original file into a plurality of original data blocks by the device A according to a preset dividing mode, and recording the number of each original data block.
In the embodiment of the application, the original file a.xml is divided into 100 original data blocks according to a preset dividing mode, and the minimum unit position of the original data blocks is stored.
S2: and the equipment A compares the original data blocks with the same number with the modified data blocks in sequence according to the minimum unit size.
The modified data block is obtained by modifying the original data block, and the modified latest file is generated by combining the modified data block and the unmodified original data block.
S3: and generating a data block difference list and a file synchronization list according to the comparison result.
The file synchronization list at least comprises the number of the original data blocks with differences, the number of the data block difference list corresponding to the original data blocks with differences and the hash value of the corresponding modified data block.
In the embodiment of the present application, as shown in table 3, the table is a data block difference list No. 1.
Table 3.
Figure 10656DEST_PATH_IMAGE003
Wherein, the "+" sign represents addition, the "-" represents deletion, the minimum unit position corresponding to the original data block of the difference is the minimum unit position in table 3, and the difference content is the operation type and content in table 3.
Therefore, in the data block difference list of number 1 shown in the above table, it is indicated that when a data block is modified according to the data block difference list, abc needs to be added after the content of the data block with the minimum unit position of 20, that is, abc is added after the 20 th minimum unit in the data block of number 1, the content of the data block with the minimum unit position of 25 is emptied, the content of the data block with the minimum unit position of 26 is emptied, 56 is added after the content of the data block with the minimum unit position of 35, the content of the data block with the minimum unit position of 56 is emptied, 887po is added after the content of the data block with the minimum unit position of 72, and the content of the data block with the minimum unit position of 80 is emptied.
Since each original data block with difference corresponds to a data block difference list, when there is a difference in data block number 2, a data block difference list should also be generated, and thus, as shown in table 4, it is a data block difference list number 2.
Table 4.
Figure 937023DEST_PATH_IMAGE004
Therefore, in the data block difference list of number 2 shown in the above table, abc is added after the content of the data block with the minimum unit position of 21, that is, abc is added after the 20 th minimum unit in the data block of number 2, the content of the data block with the minimum unit position of 26 is emptied, 56 is added after the content of the data block with the minimum unit position of 35, the content of the data block with the minimum unit position of 53 is emptied, 8po is added after the content of the data block with the minimum unit position of 72, and the content of the data block with the minimum unit position of 89 is emptied.
And, the device a generates a file synchronization list, and the file synchronization list stores: 1) number 2) of the original data block having a difference, number 3) of the data block difference list corresponding to the original data block having a difference, as shown in table 5 below, is a file synchronization list.
Table 5.
Figure 548133DEST_PATH_IMAGE005
The number of the data block is the number of the original data block with difference, the number of the difference list corresponding to the data block is the number of the data block difference list corresponding to the original data block with difference, and the hash value of the data block is the hash value of the corresponding modified data block.
S4: and combining the file difference list and the file synchronization information to generate the file difference information in the xml format.
Step 310: the device A converts the xml file difference information into file difference information in a target format that can be recognized by the device B.
In the embodiment of the present application, the file difference information in the target format is the file difference information in the xls format.
Step 320: and the B equipment carries out file synchronization on the original file in the B equipment according to the file difference information of the target format.
In the embodiment of the application, the B device performs file synchronization on the original file in the B device according to the file difference information in the xls format.
In this embodiment of the application, the step 320 is executed, which specifically includes:
s1: and the B device determines the corresponding original data blocks with differences in the original file in the B device according to the numbers of the original data blocks with differences in the file synchronization list.
The file synchronization list at least comprises the number of the original data blocks with differences, the number of the data block difference list corresponding to the original data blocks with differences and the hash value of the corresponding modified data blocks.
S2: and the B device modifies the corresponding original data blocks with differences in the original file in the B device respectively according to the serial numbers of the data block difference lists corresponding to the original data blocks with differences in the file synchronization list and the data block difference lists to generate modified data blocks.
The data block difference list at least comprises minimum unit positions and difference contents corresponding to original data blocks with differences, and each original data block with differences corresponds to one data block difference list.
In the embodiment of the application, the device B marks the corresponding positions of the data blocks according to the numbers of the data blocks in the data block difference list, then sequentially outputs the corresponding values in the subscripts of the data blocks according to the reading sequence of the arrays, when the marked data block numbers are read, operates the contents of the marked positions according to the operation types and the contents in the data block difference list, and then sequentially outputs the contents in all the arrays to form a new data block No. 1. Data block No. 1 is modified according to the data block No. 1 difference list shown in table 6 below.
Table 6.
Figure 898825DEST_PATH_IMAGE006
Therefore, according to the data block difference list No. 1 as shown in the above table, the B device adds abc to the content of the data block with the minimum unit position of 20, that is, adds abc to the content of the 20 th minimum unit in the data block No. 1, clears the content of the data block with the minimum unit position of 25, clears the content of the data block with the minimum unit position of 26, adds 56 to the content of the data block with the minimum unit position of 35, clears the content of the data block with the minimum unit position of 56, adds 887po to the content of the data block with the minimum unit position of 72, clears the content of the data block with the minimum unit position of 80, and generates the modified data block No. 1.
Step 330: and the B device checks the correctness of the modification of the modified data block.
Step 340: and the B device combines the unmodified original data blocks in the original file in the B device with the generated modified data blocks, and replaces the original file with the combined generated file to realize file synchronization.
Step 350: and B, the equipment checks the integrity of the file generated by combination.
In the embodiment of the application, when the master synchronization device determines that the original files of the master synchronization device and the slave synchronization device are the same, the original files are generated into the file difference information, the file difference information in the original file format is converted into the file difference information in the target format which can be identified by the slave synchronization device, and then the synchronization process of the original files is realized.
Based on the above embodiment, referring to fig. 4, a file synchronization flowchart when original files are the same in the embodiment of the present application includes:
step 400: and the master synchronization equipment generates file difference information in the original file format according to the original file and the modified latest file.
In the embodiment of the present application, the step 400 is executed, which specifically includes:
s1: the main synchronization equipment divides the original file into a plurality of original data blocks according to a preset division mode and records the number of each original data block.
S2: and the master synchronization equipment generates a data block difference list and a file synchronization list according to the comparison result.
The file synchronization list at least comprises the number of the original data blocks with differences, the number of the data block difference list corresponding to the original data blocks with differences and the hash value of the corresponding modified data block.
Specifically, after an operator modifies an original file, the original file is divided into a plurality of original data blocks, the data block modified by the operator is judged according to the number of the modified data block, the modified data block is generated by the modified data block, and after the operator modifies the original file, the data block after modification is compared with the data block before modification by the standby synchronization equipment to generate a data block difference list and a file synchronization list.
Step 410: and the primary synchronization equipment converts the format of the file difference information into the file difference information of a target format which can be identified by the standby synchronization equipment.
Step 420: and the standby synchronization equipment carries out file synchronization on the original file in the standby synchronization equipment according to the file difference information of the target format.
Specifically, when step 420 is executed, the method specifically includes:
s1: and the standby synchronization equipment determines the corresponding original data blocks with differences in the original files in the standby synchronization equipment according to the numbers of the original data blocks with differences in the file synchronization list.
The method comprises the steps that corresponding original files in a main synchronization device and a standby synchronization device are divided into a plurality of original data blocks according to a preset dividing mode respectively, a latest file in the main synchronization device is generated by combining a modified data block and an unmodified original data block, the modified data block is obtained by modifying the original data block, and a file synchronization list at least comprises the number of the original data block with difference, the number of a data block difference list corresponding to the original data block with difference and the hash value of the corresponding modified data block.
S2: and the standby synchronization equipment modifies the corresponding original data blocks with differences in the original file in the standby synchronization equipment respectively according to the serial numbers of the data block difference lists corresponding to the original data blocks with differences in the file synchronization list and the data block difference lists to generate modified data blocks.
The data block difference list at least comprises minimum unit positions and difference contents corresponding to original data blocks with differences, and each original data block with differences corresponds to one data block difference list.
S3: and the standby synchronization equipment combines the unmodified original data blocks in the original file in the standby synchronization equipment with the generated modified data blocks, and replaces the original file with the file generated by combination to realize file synchronization.
According to the method in the embodiment of the application, an original file is divided into a plurality of original data blocks according to the size of the data blocks, then the original data blocks are compared with the modified data blocks to generate a data block difference list and a file synchronization list, the data block difference list and the file synchronization list are combined to generate file difference information, then the file difference information is converted into file difference information of a target format which can be identified by a standby synchronization device and is sent to the standby synchronization device, and the standby synchronization device carries out file synchronization on the original file stored by the standby synchronization device according to the file difference information of the target format.
Based on the above embodiment, referring to fig. 5, a file synchronization flowchart when original files are different in the embodiment of the present application is shown, including:
step 500: and the primary synchronization equipment converts the format of the modified latest file into the latest file in the target format which can be identified by the standby synchronization equipment.
Step 510: and dividing the modified latest file into a plurality of modified data blocks, and generating a data block numbering list according to the dividing sequence.
The data block head of each modified data block at least comprises a data block number, and the data block number list at least comprises the number of the modified data block and the corresponding number representing the splitting sequence.
Step 520: and the master synchronization equipment sends the data block numbering list and the modified data block to the standby synchronization equipment.
Step 530: and the standby synchronization equipment receives the modified data block and the data block number list of the latest file in the target format, which are sent by the main synchronization equipment.
The latest file is divided into a plurality of modified data blocks according to a preset dividing mode, and the data block numbering list at least comprises the numbers of the modified data blocks and the corresponding numbers representing the splitting sequence.
Step 540: and the standby synchronization equipment stores the modified data block of the latest file into the temporary storage area.
Step 550: and the standby synchronization equipment sequentially reads the modified data blocks in the temporary storage area according to the numbers which are corresponding to the modified data blocks and represent the splitting sequence, combines the read modified data blocks according to the reading sequence, and replaces the original file with the file generated by combination to realize file synchronization.
In the embodiment of the application, when the original files are different, the primary synchronization device converts the format of the modified latest file, converts the latest file in the original file format into the latest file in the target format which can be identified by the standby synchronization device, divides the latest file into a plurality of data blocks, generates a data block numbering list, sends the data block numbering list and the modified data blocks to the standby synchronization device, and the standby synchronization device sequentially reads and combines the modified data blocks according to the numbering list of the identification splitting sequence to realize file synchronization.
Based on the above embodiment, referring to fig. 6, a flowchart for checking correctness of a file in the embodiment of the present application is shown, and includes:
step 600: and the standby synchronization equipment receives the fifth hash value of the latest file and/or the sixth hash value of the latest file and the preset special character sent by the main synchronization equipment.
Step 610: and the standby synchronization equipment determines a seventh hash value of the file generated by combination and/or an eighth hash value of the file generated by combination and the preset special character.
Step 620: and the standby synchronization equipment compares the fifth hash value with the seventh hash value and/or compares the sixth hash value with the eighth hash value, if the comparison results are the same, the file generated by combination is determined to be correct, and if any comparison result is different, the file generated by combination is determined to be incorrect.
In the embodiment of the application, the hash value of the latest file sent by the master synchronization device is compared with the hash value of the file generated by the combination of the standby synchronization devices, and the file generated by the combination is verified, so that the correctness of the file generated by the combination of the standby synchronization devices can be improved.
Based on the foregoing embodiment, referring to fig. 7, a flowchart of checking correctness of a modified data block in the embodiment of the present application is shown, where the flowchart includes:
step 700: and the synchronous equipment respectively determines the ninth hash value of each generated modified data block.
In the embodiment of the present application, when it is determined that the original files of the primary synchronization device and the secondary synchronization device are the same, after the secondary synchronization device generates the modified data block, the correctness of the modification of the modified data block needs to be checked.
Step 710: and comparing the ninth hash value of each modified data block with the hash value of the corresponding modified data block in the file synchronization list by the standby synchronization equipment, if the comparison result is the same, determining that each generated modified data block is correctly modified, and if the comparison result is different, determining that the generated modified data block is incorrectly modified.
In the embodiment of the application, by using the method, the hash value of the modified data block determined by the standby synchronization device is compared with the hash value in the file synchronization list received by the standby synchronization device, so that whether the modified data block is modified correctly is verified, and the correctness of modifying the data block in the file synchronization process can be improved.
Based on the same inventive concept, the present application provides a file synchronization apparatus, which may be, for example, the master synchronization device in the foregoing embodiments, and the file synchronization apparatus may be a hardware structure, a software module, or a hardware structure plus a software module. Based on the foregoing embodiments, referring to fig. 8, a file synchronization apparatus in an embodiment of the present application is shown, which specifically includes:
a determining module 800, configured to determine whether data content of an original file to be synchronized in a standby synchronizing device is the same, where formats of the original file in the primary synchronizing device and the original file in the standby synchronizing device are different;
the first processing module 810 is configured to, if the two files are determined to be the same, generate file difference information according to the original file and the modified latest file, perform format conversion on the file difference information, and convert the file difference information into a target format that can be recognized by the standby synchronization device, so that the standby synchronization device performs file synchronization on the original file in the standby synchronization device according to the file difference information in the target format;
and a second processing module 820, configured to, if the determination is different, perform format conversion on the modified latest file, and convert the modified latest file into a target format that can be identified by the standby synchronization device, so that the standby synchronization device performs file synchronization on the original file in the standby synchronization device according to the latest file in the target format.
Optionally, the determining module 800 is specifically configured to:
sending an original file verification request to the standby synchronization equipment, wherein the original file verification request at least comprises a first hash value of an original file in the main synchronization equipment and/or a second hash value generated by the original file and a preset special character;
and receiving a verification result returned by the standby synchronization equipment, and determining whether the data content of the original file to be synchronized in the standby synchronization equipment is the same as that of the original file, wherein the verification result is obtained by determining a third hash value of a locally corresponding original file and/or a fourth hash value of the locally corresponding original file and a preset special character after the standby synchronization equipment receives an original file verification request, and comparing the third hash value with the first hash value and/or comparing the fourth hash value with the second hash value.
Optionally, the first processing module 810 is specifically configured to:
dividing the original file into a plurality of original data blocks according to a preset dividing mode, and recording the number of each original data block;
comparing original data blocks with the same number with modified data blocks in sequence according to the minimum unit size, wherein the modified data blocks are obtained by modifying the original data blocks, and the modified latest file is generated by combining the modified data blocks and the original data blocks which are not modified;
and generating a data block difference list and a file synchronization list according to the comparison result, wherein the data block difference list at least comprises the minimum unit position and the difference content corresponding to the original data blocks with differences, each original data block with differences corresponds to one data block difference list, and the file synchronization list at least comprises the number of the original data block with differences, the number of the data block difference list corresponding to the original data block with differences and the hash value of the corresponding modified data block.
Optionally, the target format is a standard format of an original file in the standby synchronization device; the first processing module 810 is specifically configured to:
carrying out format conversion on the file difference information to convert the file difference information into a public format;
carrying out format conversion on the file difference information in the public format, and converting the file difference information into a standard format which can be identified by the synchronous equipment;
or, if the target format is a public format, the first processing module 810 is specifically configured to:
and converting the format of the file difference information into a common format so that the synchronization equipment can convert the file difference information in the common format into a standard format.
Optionally, the target format is a standard format of an original file in the standby synchronization device; the second processing module 820 is specifically configured to:
carrying out format conversion on the modified latest file to convert the latest file into a public format;
carrying out format conversion on the modified latest file in the public format, and converting the format into a standard format which can be identified by the synchronous equipment;
or, if the target format is a public format, the second processing module 820 is specifically configured to:
and converting the format of the modified latest file into a common format so that the synchronization equipment can convert the modified latest file in the common format into a standard format.
Optionally, the second processing module 820 is specifically configured to:
dividing the modified latest file into a plurality of modified data blocks, and generating a data block numbering list according to the dividing sequence, wherein the data block head of each modified data block at least comprises a data block numbering, and the data block numbering list at least comprises the number of the modified data block and the corresponding number representing the splitting sequence;
and sending the data block numbering list and the modified data blocks to the standby synchronization equipment so that the standby synchronization equipment performs file synchronization on the original file in the standby synchronization equipment according to the data block numbering list in the target format and the plurality of modified data blocks.
Based on the same inventive concept, the present application provides another file synchronization apparatus, which may be, for example, the backup synchronization device in the foregoing embodiments, and the another file synchronization apparatus may be a hardware structure, a software module, or a hardware structure plus a software module. Based on the foregoing embodiment, referring to fig. 9, another file synchronization apparatus in the embodiment of the present application is shown, which specifically includes:
a first processing module 900, configured to determine, according to an original file verification request sent by a master synchronization device, whether data content of an original file to be synchronized is the same as that of a corresponding original file to be synchronized in the master synchronization device, and return a verification result to the master synchronization device;
a second processing module 910, configured to receive file difference information in a target format sent by the master synchronization device, and perform file synchronization on an original file according to the file difference information, where the file difference information in the target format is obtained by performing format conversion after file difference information is generated according to the original file and a modified latest file when the master synchronization device determines that the verification results are the same; or the like, or, alternatively,
a third processing module 920, configured to receive a latest file in a target format sent by the primary synchronization device, and synchronize an original file in the secondary synchronization device according to the latest file, where the latest file in the target format is obtained by performing format conversion on the latest file after modification when the primary synchronization device determines that the verification results are different.
Optionally, the first processing module 900 is specifically configured to:
determining a third hash value of the locally corresponding original file and/or a fourth hash value of the locally corresponding original file and a preset special character according to the original file verification request, wherein the original file verification request at least comprises a first hash value of the original file in the main synchronization equipment and/or a second hash value generated by the original file and the preset special character;
and comparing the third hash value with the first hash value and/or comparing the fourth hash value with the second hash value, if the comparison results are determined to be the same, determining that the data content of the original file to be synchronized in the main synchronization device is the same, and if any comparison result is determined to be different, determining that the data content of the original file to be synchronized in the main synchronization device is different.
Optionally, the file difference information at least includes a data block difference list and a file synchronization list, and the second processing module 910 is specifically configured to:
determining corresponding original data blocks with differences in original files in the standby synchronization equipment according to the numbers of the original data blocks with differences in the file synchronization list, wherein the corresponding original files in the primary synchronization equipment and the standby synchronization equipment are divided into a plurality of original data blocks according to a preset dividing mode respectively, the latest file in the primary synchronization equipment is generated by combining a modified data block and an unmodified original data block, the modified data block is obtained by modifying the original data block, and the file synchronization list at least comprises the numbers of the original data blocks with differences, the numbers of the data block difference lists corresponding to the original data blocks with differences and the hash values of the corresponding modified data blocks;
according to the serial number of a data block difference list corresponding to the original data blocks with differences in the file synchronization list and the data block difference list, modifying the corresponding original data blocks with differences in the original file in the standby synchronization equipment respectively to generate modified data blocks, wherein the data block difference list at least comprises the minimum unit position and difference content corresponding to the original data blocks with differences, and each original data block with differences corresponds to one data block difference list;
and combining the unmodified original data blocks in the original file in the standby synchronization equipment with the generated modified data blocks, and replacing the original file with the combined generated file to realize file synchronization.
Optionally, the third processing module 920 is specifically configured to:
receiving a modified data block and a data block number list of the latest file in a target format, which are sent by the master synchronization device, wherein the latest file is divided into a plurality of modified data blocks according to a preset dividing mode, and the data block number list at least comprises the numbers of the modified data blocks and the corresponding numbers representing the splitting sequence;
storing the modified data block of the latest file into a temporary storage area;
and sequentially reading the modified data blocks in the temporary storage area according to the numbers which are corresponding to the modified data blocks and represent the splitting sequence, combining the read modified data blocks according to the reading sequence, and replacing the original file with the file generated by combination to realize file synchronization.
Optionally, further comprising: a first verification module 930 to:
receiving a fifth hash value of the latest file sent by the master synchronization device, and/or a sixth hash value of the latest file and a preset special character;
determining a seventh hash value of the file generated by combination and/or an eighth hash value of the file generated by combination and a preset special character;
and comparing the fifth hash value with the seventh hash value and/or comparing the sixth hash value with the eighth hash value, if the comparison results are the same, determining that the file generated by the combination is correct, and if any comparison result is different, determining that the file generated by the combination is incorrect.
Optionally, after generating each modified data block, the method further includes: a second verification module 940 for:
respectively determining ninth hash values of the generated modified data blocks;
and comparing the ninth hash value of each modified data block with the hash value of the corresponding modified data block in the file synchronization list, if the comparison result is the same, determining that each generated modified data block is correctly modified, and if the comparison result is different, determining that the generated modified data block is incorrectly modified.
Based on the above embodiments, fig. 10 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Embodiments of the present disclosure provide an electronic device, which may include a processor 1010 (CPU), a memory 1020, an input device 1030, an output device 1040, and the like, wherein the input device 1030 may include a keyboard, a mouse, a touch screen, and the like, and the output device 1040 may include a Display device, such as a Liquid Crystal Display (LCD), a Cathode Ray Tube (CRT), and the like.
Memory 1020 may include Read Only Memory (ROM) and Random Access Memory (RAM), and provides processor 1010 with program instructions and data stored in memory 1020. In the embodiment of the present application, the memory 1020 may be used to store a program of any one of the file synchronization methods in the embodiment of the present application.
The processor 1010 is configured to execute any of the file synchronization methods according to the embodiments of the present application by calling the program instructions stored in the memory 1020.
Based on the above embodiments, in the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored, and the computer program, when executed by a processor, implements the file synchronization method in any of the above method embodiments.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (9)

1. A method for synchronizing files, comprising:
the method comprises the steps that a primary synchronization device determines whether the data content of an original file to be synchronized in a standby synchronization device is the same or not, wherein the primary synchronization device and the standby synchronization device are different in format;
if the two files are the same, generating file difference information according to the original file and the modified latest file, and performing format conversion on the file difference information to convert the file difference information into a target format which can be identified by the standby synchronization equipment, so that the standby synchronization equipment performs file synchronization on the original file in the standby synchronization equipment according to the file difference information of the target format, wherein the file difference information is generated according to the original file and the modified latest file, and the method specifically comprises the following steps: dividing the original file into a plurality of original data blocks according to a preset dividing mode, and recording the number of each original data block; comparing original data blocks with the same number with modified data blocks in sequence according to the minimum unit size, wherein the modified data blocks are obtained by modifying the original data blocks, and the modified latest file is generated by combining the modified data blocks and the original data blocks which are not modified; generating a data block difference list and a file synchronization list according to the comparison result, wherein the data block difference list at least comprises the minimum unit position and the difference content corresponding to the original data blocks with differences, each original data block with differences corresponds to one data block difference list, and the file synchronization list at least comprises the number of the original data blocks with differences, the number of the data block difference list corresponding to the original data blocks with differences, and the hash value of the corresponding modified data block;
if the files are different, format conversion is carried out on the modified latest file, and the file is converted into a target format which can be identified by the standby synchronization equipment, so that the standby synchronization equipment carries out file synchronization on the original file in the standby synchronization equipment according to the latest file in the target format.
2. The method of claim 1, wherein if the target format is a standard format of an original file in a device to be synchronized; performing format conversion on the file difference information to convert the file difference information into a target format which can be identified by the synchronization equipment, and specifically comprising the following steps:
carrying out format conversion on the file difference information to convert the file difference information into a public format;
carrying out format conversion on the file difference information in the public format, and converting the file difference information into a standard format which can be identified by the synchronous equipment;
or, if the target format is a public format, performing format conversion on the file difference information to convert the file difference information into a target format that can be identified by the synchronization device, and specifically including:
and converting the format of the file difference information into a common format so that the synchronization equipment can convert the file difference information in the common format into a standard format.
3. The method of claim 1, wherein if the target format is a standard format of an original file in a device to be synchronized; if the determination is different, performing format conversion on the modified latest file, and converting the format into a target format which can be identified by the synchronization device, specifically including:
carrying out format conversion on the modified latest file to convert the latest file into a public format;
carrying out format conversion on the modified latest file in the public format, and converting the format into a standard format which can be identified by the synchronous equipment;
or, if the target format is a common format, if the target format is determined to be different, performing format conversion on the modified latest file, and converting the modified latest file into a target format which can be identified by the synchronization device, specifically including:
and converting the format of the modified latest file into a common format so that the synchronization equipment can convert the modified latest file in the common format into a standard format.
4. A method for synchronizing files, comprising:
the standby synchronization equipment determines whether the data content of the original file to be synchronized in the main synchronization equipment is the same or not according to the original file verification request sent by the main synchronization equipment, and returns a verification result to the main synchronization equipment;
receiving file difference information of a target format sent by the main synchronization equipment, and performing file synchronization on an original file according to the file difference information, wherein the file difference information of the target format is obtained by performing format conversion after generating file difference information according to the original file and a modified latest file when the main synchronization equipment determines that the verification results are the same; the file difference information of the target format is obtained by dividing the original file into a plurality of original data blocks by the main synchronization equipment according to a preset dividing mode, recording the serial numbers of the original data blocks, sequentially comparing the original data blocks with the modified data blocks with the same serial numbers according to the minimum unit size, and generating a data block difference list and a file synchronization list according to the comparison result, wherein the modified data blocks are obtained by modifying the original data blocks by the main synchronization equipment, the modified latest file is generated by combining the modified data blocks and the original data blocks which are not modified by the main synchronization equipment, the data block difference list at least comprises the minimum unit positions and difference contents corresponding to the original data blocks with differences, and each original data block with differences corresponds to one data block difference list, the file synchronization list at least comprises the number of the original data block with difference, the number of the data block difference list corresponding to the original data block with difference and the hash value of the corresponding modified data block;
and receiving the latest file in the target format sent by the main synchronization equipment, and synchronizing the original file in the standby synchronization equipment according to the latest file, wherein the latest file in the target format is obtained by converting the format of the latest file after modification when the main synchronization equipment determines that the verification results are different.
5. The method of claim 4, wherein if the file difference information comprises at least a data block difference list and a file synchronization list; receiving file difference information of a target format sent by the master synchronization device, and performing file synchronization on an original file according to the file difference information, specifically comprising:
determining corresponding original data blocks with differences in original files in the standby synchronization equipment according to the numbers of the original data blocks with differences in the file synchronization list, wherein the corresponding original files in the primary synchronization equipment and the standby synchronization equipment are divided into a plurality of original data blocks according to a preset dividing mode respectively, the latest file in the primary synchronization equipment is generated by combining a modified data block and an unmodified original data block, the modified data block is obtained by modifying the original data block, and the file synchronization list at least comprises the numbers of the original data blocks with differences, the numbers of the data block difference lists corresponding to the original data blocks with differences and the hash values of the corresponding modified data blocks;
according to the serial number of a data block difference list corresponding to the original data blocks with differences in the file synchronization list and the data block difference list, modifying the corresponding original data blocks with differences in the original file in the standby synchronization equipment respectively to generate modified data blocks, wherein the data block difference list at least comprises the minimum unit position and difference content corresponding to the original data blocks with differences, and each original data block with differences corresponds to one data block difference list;
and combining the unmodified original data blocks in the original file in the standby synchronization equipment with the generated modified data blocks, and replacing the original file with the combined generated file to realize file synchronization.
6. A file synchronization apparatus, applied to a primary synchronization device, includes:
the device comprises a determining module, a synchronization module and a synchronization module, wherein the determining module is used for determining whether the data content of an original file to be synchronized in a standby synchronization device is the same or not, and the formats of the original file in the main synchronization device and the original file in the standby synchronization device are different;
the first processing module is configured to, if it is determined that the original file and the modified latest file are the same, generate file difference information according to the original file and the modified latest file, perform format conversion on the file difference information, and convert the file difference information into a target format that can be recognized by a standby synchronization device, so that the standby synchronization device performs file synchronization on the original file in the standby synchronization device according to the file difference information in the target format, where when generating the file difference information according to the original file and the modified latest file, the first processing module is specifically configured to: dividing the original file into a plurality of original data blocks according to a preset dividing mode, and recording the number of each original data block; comparing original data blocks with the same number with modified data blocks in sequence according to the minimum unit size, wherein the modified data blocks are obtained by modifying the original data blocks, and the modified latest file is generated by combining the modified data blocks and the original data blocks which are not modified; generating a data block difference list and a file synchronization list according to the comparison result, wherein the data block difference list at least comprises the minimum unit position and the difference content corresponding to the original data blocks with differences, each original data block with differences corresponds to one data block difference list, and the file synchronization list at least comprises the number of the original data blocks with differences, the number of the data block difference list corresponding to the original data blocks with differences, and the hash value of the corresponding modified data block;
and the second processing module is used for converting the format of the modified latest file into a target format which can be identified by the standby synchronization equipment if the determination result is different, so that the standby synchronization equipment can perform file synchronization on the original file in the standby synchronization equipment according to the latest file in the target format.
7. A file synchronization device is applied to a standby synchronization device and comprises:
the first processing module is used for determining whether the data content of an original file to be synchronized in the main synchronization equipment is the same as the data content of the original file to be synchronized before the original file is determined according to an original file verification request sent by the main synchronization equipment, and returning a verification result to the main synchronization equipment;
the second processing module is used for receiving the file difference information of the target format sent by the main synchronization equipment and carrying out file synchronization on the original file according to the file difference information, wherein the file difference information of the target format is obtained by carrying out format conversion after the original file and the modified latest file generate the file difference information when the main synchronization equipment determines that the verification results are the same; the file difference information of the target format is obtained by dividing the original file into a plurality of original data blocks by the main synchronization equipment according to a preset dividing mode, recording the serial numbers of the original data blocks, sequentially comparing the original data blocks with the modified data blocks with the same serial numbers according to the minimum unit size, and generating a data block difference list and a file synchronization list according to the comparison result, wherein the modified data blocks are obtained by modifying the original data blocks by the main synchronization equipment, the modified latest file is generated by combining the modified data blocks and the original data blocks which are not modified by the main synchronization equipment, the data block difference list at least comprises the minimum unit positions and difference contents corresponding to the original data blocks with differences, and each original data block with differences corresponds to one data block difference list, the file synchronization list at least comprises the number of the original data block with difference, the number of the data block difference list corresponding to the original data block with difference and the hash value of the corresponding modified data block;
and the third processing module is used for receiving the latest file in the target format sent by the main synchronization equipment and synchronizing the original file in the standby synchronization equipment according to the latest file, wherein the latest file in the target format is obtained by converting the format of the latest file after modification when the main synchronization equipment determines that the verification results are different.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the method of any of claims 1-3 or 4-5 are implemented when the program is executed by the processor.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program when executed by a processor implements the steps of the method of any one of claims 1-3 or 4-5.
CN202010337002.5A 2020-04-26 2020-04-26 File synchronization method and device Active CN111241047B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010337002.5A CN111241047B (en) 2020-04-26 2020-04-26 File synchronization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010337002.5A CN111241047B (en) 2020-04-26 2020-04-26 File synchronization method and device

Publications (2)

Publication Number Publication Date
CN111241047A CN111241047A (en) 2020-06-05
CN111241047B true CN111241047B (en) 2020-08-21

Family

ID=70875585

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010337002.5A Active CN111241047B (en) 2020-04-26 2020-04-26 File synchronization method and device

Country Status (1)

Country Link
CN (1) CN111241047B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111787074B (en) * 2020-06-18 2023-04-21 杭州美创科技股份有限公司 File synchronization method and terminal

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090248737A1 (en) * 2008-03-27 2009-10-01 Microsoft Corporation Computing environment representation
CN102111215A (en) * 2010-12-23 2011-06-29 中兴通讯股份有限公司 Method and device for synchronizing configuration data
CN110019502B (en) * 2017-08-29 2023-03-21 阿里巴巴集团控股有限公司 Synchronization method between primary database and backup database, database system and device
CN110069571A (en) * 2019-03-18 2019-07-30 平安普惠企业管理有限公司 A kind of automated data control methods and device, electronic equipment
CN110290005A (en) * 2019-06-27 2019-09-27 杭州迪普信息技术有限公司 A kind of configuration variance detection method and device

Also Published As

Publication number Publication date
CN111241047A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
CN108805570B (en) Data processing method, device and storage medium
CN109410045B (en) Parallel chain consensus method, equipment and storage medium
US20190146681A1 (en) Data writing and reading method and apparatus, and distributed object storage cluster
US11899689B2 (en) Blockchain-based data synchronization method, apparatus, and computer-readable storage medium
KR102044046B1 (en) Telemetry file hash and conflict detection
CN111163182A (en) Block chain-based device registration method and apparatus, electronic device, and storage medium
CN112364049B (en) Data synchronization script generation method, system, terminal and storage medium
CN114092252B (en) Block chain transaction execution method, device, equipment and readable storage medium
CN107102908B (en) Data verification method, data fault tolerance method and device
US20240097919A1 (en) Consensus trusted cluster changing method, computer device and computer-readable storage medium
CN111241047B (en) File synchronization method and device
CN109088914B (en) Block generation method, block chain ecosystem and computer readable storage medium
US7849355B2 (en) Distributed object sharing system and method thereof
CN112783482B (en) Visual form generation method, device, equipment and storage medium
CN112132574A (en) Block chain data checking method, data processing method, device and equipment
EP4080827A1 (en) Cloud system migration method and device, and hybrid cloud system
CN109462661A (en) Method of data synchronization, device, computer equipment and storage medium
CN116451683B (en) Document merging method, terminal and computer readable storage medium
CN117033309A (en) Data conversion method and device, electronic equipment and readable storage medium
CN111522881A (en) Service data processing method, device, server and storage medium
CN116303789A (en) Parallel synchronization method and device for multi-fragment multi-copy database and readable medium
WO2021103948A1 (en) Method and device for executing configuration instruction
CN114648330A (en) Transaction verification method and device based on block chain and block chain system
KR102211360B1 (en) Digital document authentication method using location information in digital documents
CN116739397B (en) Dynamic management method for new energy indexes

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant