[go: up one dir, main page]

CN111782619A - A method, synchronization device and storage medium for incremental synchronization of documents between servers - Google Patents

A method, synchronization device and storage medium for incremental synchronization of documents between servers Download PDF

Info

Publication number
CN111782619A
CN111782619A CN202010737977.7A CN202010737977A CN111782619A CN 111782619 A CN111782619 A CN 111782619A CN 202010737977 A CN202010737977 A CN 202010737977A CN 111782619 A CN111782619 A CN 111782619A
Authority
CN
China
Prior art keywords
synchronization
document
synchronous
record table
server
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.)
Pending
Application number
CN202010737977.7A
Other languages
Chinese (zh)
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.)
Shanghai Eisoo Information Technology Co Ltd
Original Assignee
Shanghai Eisoo Information Technology 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 Shanghai Eisoo Information Technology Co Ltd filed Critical Shanghai Eisoo Information Technology Co Ltd
Priority to CN202010737977.7A priority Critical patent/CN111782619A/en
Publication of CN111782619A publication Critical patent/CN111782619A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/658Incremental updates; Differential updates
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

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

Abstract

本发明涉及一种服务端间文档增量同步方法、同步装置及存储介质,应用于源端服务器到目标端服务器的增量同步,所述源端服务器中维护一记录每个同步过的对象的同步记录表,所述同步方法具体为:以源端服务器上某一个目录为根节点,递归子节点,比对每个节点与同步记录表中的信息,获得差异信息,生成同步任务表,将所述同步任务表拆解成并发进行的多个子任务,并发传输至目标端服务器中,在每个子任务完成后,在所述同步记录表中更新各子任务的执行结果。与现有技术相比,本发明无需向对端服务器请求文档结构,在本地就能计算出差异,计算效率大大提高、对网络环境的依赖大大降低。

Figure 202010737977

The invention relates to a method, a synchronization device and a storage medium for incremental synchronization of documents between servers, which are applied to the incremental synchronization of a source server to a target server, wherein the source server maintains a record of each synchronized object. Synchronizing the record table, the synchronization method is specifically: taking a certain directory on the source server as the root node, recursively sub-nodes, comparing the information in each node and the synchronization record table, obtaining difference information, generating a synchronization task table, The synchronization task table is disassembled into multiple subtasks that are performed concurrently, and are concurrently transmitted to the target server. After each subtask is completed, the execution result of each subtask is updated in the synchronization record table. Compared with the prior art, the present invention can calculate the difference locally without requesting the document structure from the peer server, greatly improving the calculation efficiency and greatly reducing the dependence on the network environment.

Figure 202010737977

Description

一种服务端间文档增量同步方法、同步装置及存储介质A method, synchronization device and storage medium for incremental synchronization of documents between servers

技术领域technical field

本发明涉及数据库技术领域,尤其是涉及一种服务端间文档增量同步方法、同步装置及存储介质。The invention relates to the technical field of databases, and in particular, to a method, a synchronization device and a storage medium for incremental synchronization of documents between servers.

背景技术Background technique

文档同步作为网盘的一项基础功能,在各个网盘产品中都有比较成熟的算法,来保证文件在客户端本地与服务器保持一致。通常地,文件同步为C/S架构:服务端保存每个终端的文件列表,客户端通过服务端提供的接口,来获取文件列表信息并在本地缓存。当客户端需要进行同步时,需要通过网络请求从服务器端获取目录的结构及文档对象的属性,结合客户端本地的文件缓存信息,来进行增量计算,做出同步决策。As a basic function of the network disk, document synchronization has a relatively mature algorithm in each network disk product to ensure that the file is consistent with the server locally on the client side. Generally, file synchronization is a C/S architecture: the server saves the file list of each terminal, and the client obtains the file list information through the interface provided by the server and caches it locally. When the client needs to synchronize, it needs to obtain the directory structure and document object attributes from the server through a network request, and combine with the client's local file cache information to perform incremental calculations and make synchronization decisions.

但是出于合规性要求,服务器与服务器之间的网络一般是物理隔离的,服务器-服务器之间只能通过交换设备进行文件的传输。在此种环境下,客户端-服务器的同步模式不适用于服务器-服务器的文档同步。因此,需要研发一种新方法来应用于服务器-服务器之间的文档同步。However, due to compliance requirements, the network between servers is generally physically isolated, and files can only be transferred between servers through switching devices. In this environment, the client-server synchronization mode is not suitable for server-server document synchronization. Therefore, there is a need to develop a new method to be applied to server-to-server document synchronization.

发明内容SUMMARY OF THE INVENTION

本发明的目的就是为了克服上述现有技术存在的缺陷而提供一种服务端间文档增量同步方法、同步装置及存储介质,无需向对端服务器请求文档结构,使用方便,同步时间短。The purpose of the present invention is to provide a method, a synchronization device and a storage medium for incremental synchronization of documents between servers in order to overcome the above-mentioned defects in the prior art, without requesting the document structure from the opposite server, easy to use, and short synchronization time.

本发明的目的可以通过以下技术方案来实现:The object of the present invention can be realized through the following technical solutions:

一种服务端间文档增量同步方法,应用于源端服务器到目标端服务器的增量同步,所述源端服务器中维护一记录每个同步过的对象的同步记录表,所述同步方法具体为:A method for incremental synchronization of documents between servers, which is applied to incremental synchronization from a source server to a target server. The source server maintains a synchronization record table that records each synchronized object. The synchronization method is specifically for:

以源端服务器上某一个目录为根节点,递归子节点,比对每个节点与同步记录表中的信息,获得差异信息,生成同步任务表,将所述同步任务表拆解成并发进行的多个子任务,并发传输至目标端服务器中,在每个子任务完成后,在所述同步记录表中更新各子任务的执行结果。Taking a directory on the source server as the root node, recursively sub-nodes, compare each node with the information in the synchronization record table, obtain the difference information, generate a synchronization task table, and disassemble the synchronization task table into concurrent Multiple subtasks are concurrently transmitted to the target server, and after each subtask is completed, the execution result of each subtask is updated in the synchronization record table.

进一步地,所述差异信息通过增量计算获得,进行所述增量计算时比较的文档对象属性包括文档id和版本标识。Further, the difference information is obtained by incremental calculation, and the document object attributes compared during the incremental calculation include document id and version identifier.

进一步地,所述增量计算的具体过程包括:Further, the specific process of the incremental calculation includes:

1)读取源端服务器中各文档对象的版本标识,判断该版本标识是否在同步记录表中,若是,则执行步骤4),若否,则执行步骤2);1) Read the version identification of each document object in the source server, and judge whether the version identification is in the synchronization record table, if so, execute step 4), if not, execute step 2);

2)判断与该版本标识关联的文档id是否在同步记录表中,若是,则执行步骤3),若否,则将对应的文档对象写入同步任务表中,并标记为上传;2) Determine whether the document id associated with the version identifier is in the synchronization record table, if so, execute step 3), if not, write the corresponding document object into the synchronization task table, and mark it as uploading;

3)若该文档对象为目录,则对目录的子对象进行递归,当与该文档对象同一级的所有对象都遍历完成后,从同步记录表中取出所有记录,根据文件名查找源端服务器中不存在的对象,将这些对象写到同步任务表中,并标记为删除;3) If the document object is a directory, recurse the sub-objects of the directory. When all objects at the same level as the document object are traversed, all records are taken from the synchronization record table, and the source server is searched according to the file name. For objects that do not exist, write these objects to the synchronization task table and mark them for deletion;

若该文档对象为文件,直接将该文档对象写入同步任务表中,并标记为上传;If the document object is a file, directly write the document object into the synchronization task table and mark it as upload;

4)不进行同步;4) No synchronization;

5)从根节点开始向下递归,直到所有文件和目录都完成。5) Recurse downwards from the root node until all files and directories are complete.

进一步地,将所述同步任务表拆解成多个子任务具体为:对所述同步任务表中的每一条记录进行小粒度拆解。Further, disassembling the synchronization task table into a plurality of subtasks is specifically: disassembling each record in the synchronization task table in a small granularity.

进一步地,所述小粒度拆解具体为:根据各同步任务的标记,调用与目标端服务器通信的对应的处理接口实现对文件的相应处理。Further, the small-granularity disassembly is specifically: according to the tags of each synchronization task, calling a corresponding processing interface that communicates with the target server to implement corresponding processing of the file.

将标记为“上传”的同步任务,调用向目标端服务器上传文件的接口,传递文件信息进行上传;The synchronization task marked as "upload" will call the interface for uploading files to the target server, and pass the file information for uploading;

将标记为“删除”的同步任务,调用向目标端服务器删除文件的接口,传递文件信息进行删除。Call the synchronization task marked "delete" to delete the file to the target server, and pass the file information to delete.

进一步地,在所述同步记录表中更新各子任务的执行结果具体为:Further, the execution result of updating each subtask in the synchronization record table is specifically:

若待操作对象为文件,则在对象标记为上传时,在同步记录表中同时记录文档id及版本标识,在对象标记为删除时,从同步记录表中删除对应文档id的记录;If the object to be operated is a file, when the object is marked for upload, the document id and version identifier are recorded in the synchronization record table at the same time, and when the object is marked for deletion, the record corresponding to the document id is deleted from the synchronization record table;

若待操作对象为目录,则在对象标记为上传时,在同步记录表中记录上传目录中每个文件的文档id及版本标识,在对象标记为删除时,从同步记录表中删除对应文档id的记录,并且删除同步记录表中子对象的文档id的记录。If the object to be operated is a directory, when the object is marked for upload, record the document id and version ID of each file in the upload directory in the synchronization record table, and delete the corresponding document id from the synchronization record table when the object is marked for deletion record, and delete the record of the document id of the child object in the synchronization record table.

进一步地,在同步记录表中记录文档id及版本标识时,若同步记录表中存在该文档id,则覆盖对应版本标识;否则,新增一条包含文档id及版本标识的同步记录。Further, when the document id and version identifier are recorded in the synchronization record table, if the document id exists in the synchronization record table, the corresponding version identifier is overwritten; otherwise, a synchronization record containing the document id and version identifier is added.

进一步地,所述源端服务器通过交换设备将信息传输至源端服务器。Further, the source server transmits the information to the source server through the switching device.

本发明还提供一种服务端间文档增量同步装置,设置于源端服务器,包括:The present invention also provides a document incremental synchronization device between servers, which is set on the source server, including:

增量计算模块,用于维护一记录每个同步过的对象的同步记录表,在执行同步任务时,以源端服务器上某一个目录为根节点,递归子节点,比对每个节点与同步记录表中的信息,获得差异信息,生成同步任务表;The incremental calculation module is used to maintain a synchronization record table that records each synchronized object. When a synchronization task is performed, a certain directory on the source server is used as the root node, recursive child nodes, and each node is compared and synchronized. Record the information in the table, obtain the difference information, and generate the synchronization task table;

同步模块,用于将所述同步任务表拆解成并发进行的多个子任务,并发传输至目标端服务器中,在每个子任务完成后,在所述同步记录表中更新各子任务的执行结果。The synchronization module is used to disassemble the synchronization task table into multiple subtasks that are performed concurrently, and transmit them to the target server concurrently. After each subtask is completed, update the execution result of each subtask in the synchronization record table. .

本发明还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行以实现所述的方法。The present invention also provides a computer-readable storage medium on which a computer program is stored, the computer program being executed by a processor to implement the method.

与现有技术相比,本发明具有如下有益效果:Compared with the prior art, the present invention has the following beneficial effects:

1、本发明在源端服务器对文档同步结果进行记录,可以在不需要与目标端进行通信的情况下,即可实现文档的增量同步,无需向对端服务器请求文档结构,在本地就能计算出差异,计算效率大大提高、对网络环境的依赖大大降低。1. The present invention records the document synchronization result on the source server, and can realize the incremental synchronization of the document without the need to communicate with the target end. The difference is calculated, the calculation efficiency is greatly improved, and the dependence on the network environment is greatly reduced.

2、本发明在网络物理隔离的环境下,方便通过交换设备进行文件传输。2. In the environment of network physical isolation, the present invention facilitates file transmission through switching devices.

3、本发明通过计算源端服务器和目标端服务器的文件差异,可以实现仅对变化部分进行同步,减少同步的时间,节省同步的带宽使用。3. By calculating the file difference between the source server and the target server, the present invention can realize only the synchronization of the changed part, reduce the synchronization time, and save the synchronization bandwidth usage.

4、通过将同步任务拆解成子任务,可以将一次同步任务分解并发进行,在发生异常导致单个子任务失败的时候,可以针对单个子任务进行重试,也可以在下一次进行增量同步时包含失败的子任务。4. By disassembling the synchronization task into subtasks, a synchronization task can be decomposed and performed concurrently. When an exception occurs and a single subtask fails, it can be retried for a single subtask, or it can be included in the next incremental synchronization. Failed subtasks.

5、本发明在增量计算和同步处理时对文件和目录进行分类处理,同步精度高,可靠性高。5. The present invention classifies files and directories during incremental calculation and synchronization processing, and has high synchronization precision and reliability.

附图说明Description of drawings

图1为本发明的同步过程原理图;1 is a schematic diagram of a synchronization process of the present invention;

图2为本发明增量计算过程示意图;Fig. 2 is the schematic diagram of incremental calculation process of the present invention;

图3为本发明同步记录表更新示意图;Fig. 3 is the update schematic diagram of the synchronization record table of the present invention;

图4为实施例中通过交换设备进行传输的示意图。FIG. 4 is a schematic diagram of transmission through a switching device in an embodiment.

具体实施方式Detailed ways

下面结合附图和具体实施例对本发明进行详细说明。本实施例以本发明技术方案为前提进行实施,给出了详细的实施方式和具体的操作过程,但本发明的保护范围不限于下述的实施例。The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. This embodiment is implemented on the premise of the technical solution of the present invention, and provides a detailed implementation manner and a specific operation process, but the protection scope of the present invention is not limited to the following embodiments.

术语与定义Terms and Definitions

增量计算:指通过比较同步对象在源端与目标端的差异,计算一次同步任务要包含的同步对象的计算过程。Incremental calculation: refers to the calculation process of calculating the synchronization objects to be included in a synchronization task by comparing the differences between the synchronization objects at the source end and the destination end.

同步:指将文档通过网络从源端系统传输到目标端系统的过程。Synchronization: Refers to the process of transferring documents from a source system to a target system over a network.

同步记录表:指源端系统对每个文档的同步结果进行记录的表。文档同步完成后会将文档信息更新或新增到该表,以用于下一次同步时进行增量计算。Synchronization record table: refers to the table in which the source system records the synchronization result of each document. After the document synchronization is completed, the document information will be updated or added to the table for incremental calculation in the next synchronization.

实施例1Example 1

本实施例提供一种服务端间文档增量同步方法,应用于源端服务器(源端系统)到目标端服务器(对端服务器,目标端系统)的增量同步,所述源端服务器中维护一记录每个同步过的对象的同步记录表,所述同步方法具体为:以源端服务器上某一个目录为根节点,递归子节点,比对每个节点与同步记录表中的信息,获得差异信息,生成同步任务表,将所述同步任务表拆解成并发进行的多个子任务,调用对端文件系统API,并发传输至目标端服务器中,在每个子任务完成后,在所述同步记录表中更新各子任务的执行结果。通过上述过程的循环,实现两个系统间的文档增量同步。该同步方法适用于在两套系统间进行文档同步,在不需要向目标端发送网络请求获取文档结构和文档属性的情况下,通过在源端系统对同步内容进行计算和更新,实现文档的增量同步。This embodiment provides a method for incremental synchronization of documents between servers, which is applied to incremental synchronization from a source server (source system) to a target server (peer server, target system). The source server maintains A synchronization record table for recording each synchronized object, the synchronization method is specifically: taking a certain directory on the source server as the root node, recursively sub-nodes, comparing each node with the information in the synchronization record table, and obtaining Difference information, generate a synchronization task table, disassemble the synchronization task table into multiple subtasks that are performed concurrently, call the peer file system API, and transmit to the target server concurrently, after each subtask is completed, in the synchronization Update the execution result of each subtask in the record table. Through the cycle of the above process, the incremental synchronization of documents between the two systems is realized. This synchronization method is suitable for document synchronization between two systems. Without the need to send a network request to the target to obtain the document structure and document attributes, the source system calculates and updates the synchronized content to realize the increase of the document. volume synchronization.

1、增量计算1. Incremental calculation

所述差异信息通过增量计算获得,进行所述增量计算时比较的文档对象属性包括文档id和版本标识。The difference information is obtained through incremental calculation, and the document object attributes compared during the incremental calculation include document id and version identifier.

一次同步任务,是将一个源端目录完全映射到目标端的过程。同步任务完成后,源端和目标端的目录结构、文件内容应当保持完全一致。为了减少网络请求、提高同步效率,同步前首先要进行同步的增量计算,得到需要同步的内容和相应的执行操作。A synchronization task is the process of completely mapping a source directory to the target. After the synchronization task is completed, the directory structure and file content of the source and target should be exactly the same. In order to reduce network requests and improve synchronization efficiency, the incremental calculation of synchronization must be performed before synchronization to obtain the content that needs to be synchronized and the corresponding execution operations.

增量计算,主要通过比较源端文档对象及该对象在同步记录中的信息得到,增量计算比较以下三种基本变化类型:Incremental calculation is mainly obtained by comparing the source document object and the information in the synchronization record of the object. Incremental calculation compares the following three basic changes:

·源端新增·Added at the source

·源端编辑·Source editing

·源端删除·Delete at source

其他的文件变化,均可以用以上三种基本变化的等价或组合来表示:Other file changes can be represented by the equivalence or combination of the above three basic changes:

·源端重命名:等于源端删除+源端新增。Rename the source: equal to delete the source + add the source.

·移动(移出源端目录):等于源端删除。·Move (move out of the source directory): equal to the source delete.

·移动(移入源端目录):等于源端新增。·Move (move into the source directory): equal to adding at the source.

·复制:等于源端新增。·Copy: equal to adding at the source.

进行增量计算时,需要使用对文档id和版本标识等文档对象属性进行比较。When performing incremental calculations, you need to compare document object properties such as document id and version ID.

文档id是文档对象的唯一标识。文档id在文档创建的时候生成。如果文档是一个文件,在该文件创建后对其进行编辑、重命名、覆盖操作都不会修改其文档id;如果文档是一个目录,对目录进行重命名、修改目录内容都不会修改其文档id。文档id需要体现其包含关系,如:某目录的文档id为“id1”,则目录下的子对象期文档id为“id1/id2”。可以根据文档id查找出所有子对象及更深层级的对象,也可以根据文档id查找出其父级或更上级的对象。The document id is the unique identification of the document object. The document id is generated when the document is created. If the document is a file, editing, renaming, and overwriting the file after it is created will not modify its document id; if the document is a directory, renaming the directory and modifying the contents of the directory will not modify its document. id. The document id needs to reflect its inclusion relationship. For example, if the document id of a directory is "id1", the document id of the sub-object period under the directory is "id1/id2". All child objects and deeper objects can be found according to the document id, or its parent or higher-level objects can be found according to the document id.

版本标识是文档内容的唯一标识。如果文档是一个文件,对文件进行编辑、覆盖操作,虽不会修改其文档id,但每次操作都会创建一个新的版本标识。如果文档是一个目录,修改目录下的子文档,会在目录对象上创建一个新的版本标识。The version identifier is a unique identifier for the content of the document. If the document is a file, editing and overwriting the file will not modify its document id, but each operation will create a new version ID. If the document is a directory, modifying subdocuments in the directory creates a new version ID on the directory object.

同步记录表中记录了所有已经同步过的文件,同样地,每条记录需要包含以下信息:The synchronization record table records all the files that have been synchronized. Similarly, each record needs to contain the following information:

(1)文档id。文档同步服务对文档进行传输后,将源端文档id记录到同步记录中。(1) Document id. After the document synchronization service transmits the document, it records the source document id in the synchronization record.

(2)版本标识。文档同步服务对文档进行传输后,将源端版本标识记录到同步记录中。(2) Version identification. After the document synchronization service transmits the document, it records the source version identifier in the synchronization record.

如图2所示,增量计算的具体过程包括:As shown in Figure 2, the specific process of incremental calculation includes:

1)读取源端服务器中各文档对象的版本标识,判断该版本标识是否在同步记录表中,若是,则执行步骤4),若否,则认为此文档对象未进行过同步,执行步骤2);1) Read the version ID of each document object in the source server, and judge whether the version ID is in the synchronization record table. If so, go to step 4), if not, consider that the document object has not been synchronized, go to step 2 );

2)判断与该版本标识关联的文档id是否在同步记录表中,若是,则执行步骤3),若否,则将对应的文档对象写入同步任务表中,并标记为上传;2) Determine whether the document id associated with the version identifier is in the synchronization record table, if so, execute step 3), if not, write the corresponding document object into the synchronization task table, and mark it as uploading;

3)若该文档对象为目录,则认为此目录下的内容发生了变更,对源端目录的子对象进行递归,当与该文档对象同一级的所有对象都遍历完成后,从同步记录表中取出所有记录,根据文件名查找源端服务器中不存在的对象,将这些对象写到同步任务表中,并标记为删除;3) If the document object is a directory, it is considered that the content in this directory has changed, and the sub-objects of the source directory are recursively. When all objects at the same level as the document object are traversed, the synchronization record table Take out all records, find objects that do not exist in the source server according to the file name, write these objects into the synchronization task table, and mark them for deletion;

若该文档对象为文件,则认为此文件内容发生了变化,直接将该文档对象写入同步任务表中,并标记为上传;If the document object is a file, it is considered that the content of the file has changed, and the document object is directly written into the synchronization task table and marked as upload;

4)如果同步记录中找到版本标识,则认为此对象在源端未发生任何修改,不需要进行同步;4) If the version identifier is found in the synchronization record, it is considered that this object has not been modified at the source end and does not need to be synchronized;

5)更新计算从根目录开始向下递归,直到所有文件和目录都完成。5) The update calculation starts from the root directory and recurses downwards until all files and directories are completed.

2、同步2. Synchronization

计算出要同步的变化后,根据同步任务表,将每一条记录拆解成较小粒度的子任务。After calculating the changes to be synchronized, each record is disassembled into subtasks with smaller granularity according to the synchronization task table.

对子任务而言,以下两种基本操作就可以满足所有情况:For subtasks, the following two basic operations suffice in all cases:

1.上传1. Upload

2.删除2. Delete

任务拆解完成后,按个子任务的操作类型,向目标端进行同步。每当一个子任务同步完成时,同步模块需要将子任务的执行结果,写入到同步记录表中。具体地:After the task is dismantled, synchronize to the target according to the operation type of each subtask. Whenever a subtask is completed synchronously, the synchronization module needs to write the execution result of the subtask into the synchronization record table. specifically:

将标记为“上传”的同步任务,调用向对端服务器上传文件的接口,传递文件信息进行上传。For the synchronization task marked "Upload", call the interface for uploading files to the peer server, and pass the file information for uploading.

将标记为“删除”的同步任务,调用向对端服务器删除文件的接口,传递文件信息进行删除。Call the synchronization task marked "delete" to delete the file to the peer server, and pass the file information to delete.

“上传”和“删除”的具体接口设计,本文档不做阐述。The specific interface design of "upload" and "delete" is not described in this document.

如图3所示,在所述同步记录表中更新各子任务的执行结果,分为文件和目录两种情况:As shown in Figure 3, the execution result of updating each subtask in the synchronization record table is divided into two situations: file and directory:

若待操作对象为文件,则在对象标记为上传时,在同步记录表中同时记录文档id及版本标识,在对象标记为删除时,从同步记录表中删除对应文档id的记录;If the object to be operated is a file, when the object is marked for upload, the document id and version identifier are recorded in the synchronization record table at the same time, and when the object is marked for deletion, the record corresponding to the document id is deleted from the synchronization record table;

若待操作对象为目录,则在对象标记为上传时,在同步记录表中记录上传目录中每个文件的文档id及版本标识,在对象标记为删除时,从同步记录表中删除对应文档id的记录,并且删除同步记录表中子对象的文档id的记录。If the object to be operated is a directory, when the object is marked for upload, record the document id and version ID of each file in the upload directory in the synchronization record table, and delete the corresponding document id from the synchronization record table when the object is marked for deletion record, and delete the record of the document id of the child object in the synchronization record table.

在同步记录表中记录文档id及版本标识时,若同步记录表中存在该文档id,则覆盖对应版本标识;否则,新增一条包含文档id及版本标识的同步记录。When recording the document id and version identifier in the synchronization record table, if the document id exists in the synchronization record table, the corresponding version identifier is overwritten; otherwise, a synchronization record containing the document id and version identifier is added.

如图4所示,在一实施例中,源端服务器通过交换设备将信息传输至源端服务器,通过交换设备进行文件传输。As shown in FIG. 4 , in an embodiment, the source server transmits information to the source server through the switching device, and the file transmission is performed through the switching device.

实施例2Example 2

本实施例提供一种服务端间文档增量同步装置,设置于源端服务器,包括:This embodiment provides a device for synchronizing document increments between servers, which is set on the source server and includes:

增量计算模块,用于维护一记录每个同步过的对象的同步记录表,在执行同步任务时,以源端服务器上某一个目录为根节点,递归子节点,比对每个节点与同步记录表中的信息,获得差异信息,生成同步任务表;The incremental calculation module is used to maintain a synchronization record table that records each synchronized object. When a synchronization task is performed, a certain directory on the source server is used as the root node, recursive child nodes, and each node is compared and synchronized. Record the information in the table, obtain the difference information, and generate the synchronization task table;

同步模块,用于将所述同步任务表拆解成并发进行的多个子任务,并发传输至目标端服务器中,在每个子任务完成后,在所述同步记录表中更新各子任务的执行结果。The synchronization module is used to disassemble the synchronization task table into multiple subtasks that are performed concurrently, and transmit them to the target server concurrently. After each subtask is completed, update the execution result of each subtask in the synchronization record table. .

增量计算模块用于计算一次同步任务需要对哪些对象进行上传和删除,并将对象标记上对应的上传或删除操作;同步模块用于将同步对象在目标端服务器上进行上传或删除,并在操作完成后更新同步记录。增量计算模块和同步模块的交互如图1表示。The incremental calculation module is used to calculate which objects need to be uploaded and deleted for a synchronization task, and the corresponding upload or delete operations are marked on the objects; the synchronization module is used to upload or delete the synchronization objects on the target server, and then Update the sync record after the operation is complete. The interaction between the incremental computing module and the synchronization module is shown in Figure 1.

实施例3Example 3

本实施例提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行以实现如实施例1所述的方法。This embodiment provides a computer-readable storage medium on which a computer program is stored, and the computer program is executed by a processor to implement the method described in Embodiment 1.

以上详细描述了本发明的较佳具体实施例。应当理解,本领域的普通技术人员无需创造性劳动就可以根据本发明的构思作出诸多修改和变化。因此,凡本技术领域中技术人员依本发明的构思在现有技术的基础上通过逻辑分析、推理或者有限的实验可以得到的技术方案,皆应在由权利要求书所确定的保护范围内。The preferred embodiments of the present invention have been described above in detail. It should be understood that those skilled in the art can make many modifications and changes according to the concept of the present invention without creative efforts. Therefore, any technical solutions that can be obtained by those skilled in the art through logical analysis, reasoning or limited experiments on the basis of the prior art according to the concept of the present invention shall fall within the protection scope determined by the claims.

Claims (10)

1. A method for incremental synchronization of documents between service terminals is applied to incremental synchronization from a source terminal server to a target terminal server, and is characterized in that the source terminal server maintains a synchronous record table for recording each synchronized object, and the synchronization method specifically comprises the following steps:
and taking a certain directory on the source server as a root node, recursion sub-nodes, comparing information in each node and a synchronous record table to obtain difference information, generating a synchronous task table, disassembling the synchronous task table into a plurality of sub-tasks which are performed concurrently, transmitting the plurality of sub-tasks to the target server concurrently, and updating the execution result of each sub-task in the synchronous record table after each sub-task is completed.
2. The method for document incremental synchronization between servers according to claim 1, wherein the difference information is obtained by incremental computation, and the document object attributes compared in the incremental computation include a document id and a version id.
3. The method for document incremental synchronization between servers according to claim 2, wherein the specific process of incremental computation includes:
1) reading the version identification of each document object in the source server, judging whether the version identification is in the synchronous record table, if so, executing the step 4), and if not, executing the step 2);
2) judging whether the document id associated with the version identification is in a synchronous record table, if so, executing the step 3), otherwise, writing the corresponding document object into a synchronous task table and marking the document object as uploading;
3) if the document object is a directory, recursion is carried out on the sub-objects of the directory, when all the objects at the same level as the document object are traversed, all the records are taken out from the synchronous record table, the objects which do not exist in the source server are searched according to the file name, the objects are written into the synchronous task table and marked as deleted;
if the document object is a file, directly writing the document object into a synchronous task table, and marking the document object as uploading;
4) synchronization is not performed;
5) recursion down from the root node until all files and directories are complete.
4. The method for incrementally synchronizing documents between servers according to claim 1, wherein the splitting of the synchronization task table into a plurality of subtasks specifically comprises: and performing small-granularity disassembly on each record in the synchronous task table.
5. The method for incremental synchronization of documents between servers according to claim 4, wherein the small-granularity parsing specifically comprises:
and calling a corresponding processing interface communicated with the target end server according to the mark of each synchronous task to realize corresponding processing of the file.
6. The method for incremental synchronization of documents between servers according to claim 2, wherein updating the execution result of each subtask in the synchronization record table specifically comprises:
if the object to be operated is a file, simultaneously recording a document id and a version identifier in the synchronous record table when the object is marked to be uploaded, and deleting a record corresponding to the document id from the synchronous record table when the object is marked to be deleted;
if the object to be operated is a directory, when the object is marked as uploading, the document id and the version identification of each file in the uploading directory are recorded in the synchronous record table, when the object is marked as deleting, the record corresponding to the document id is deleted from the synchronous record table, and the record corresponding to the document id of the sub-object in the synchronous record table is deleted.
7. The method for incremental synchronization of documents between servers according to claim 6, wherein when a document id and a version identifier are recorded in the synchronization record table, if the document id exists in the synchronization record table, the corresponding version identifier is overwritten; otherwise, adding a new synchronous record containing the document id and the version identification.
8. The method of claim 1, wherein the source server transmits information to the source server through a switching device.
9. An inter-server document increment synchronization device, which is arranged in a source server, includes:
the incremental computation module is used for maintaining a synchronous record table for recording each synchronized object, and when a synchronous task is executed, a certain directory on the source server is taken as a root node, a recursion child node is used for comparing information in each node and the synchronous record table to obtain difference information and generate a synchronous task table;
and the synchronization module is used for disassembling the synchronization task table into a plurality of subtasks which are performed concurrently, transmitting the subtasks to the target end server concurrently, and updating the execution result of each subtask in the synchronization record table after each subtask is completed.
10. A computer-readable storage medium, having stored thereon a computer program for execution by a processor to perform the method of any one of claims 1 to 8.
CN202010737977.7A 2020-07-28 2020-07-28 A method, synchronization device and storage medium for incremental synchronization of documents between servers Pending CN111782619A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010737977.7A CN111782619A (en) 2020-07-28 2020-07-28 A method, synchronization device and storage medium for incremental synchronization of documents between servers

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010737977.7A CN111782619A (en) 2020-07-28 2020-07-28 A method, synchronization device and storage medium for incremental synchronization of documents between servers

Publications (1)

Publication Number Publication Date
CN111782619A true CN111782619A (en) 2020-10-16

Family

ID=72766991

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010737977.7A Pending CN111782619A (en) 2020-07-28 2020-07-28 A method, synchronization device and storage medium for incremental synchronization of documents between servers

Country Status (1)

Country Link
CN (1) CN111782619A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113641756A (en) * 2021-07-26 2021-11-12 浪潮卓数大数据产业发展有限公司 A Distributed High Concurrency Data Storage Method
CN115328880A (en) * 2022-10-13 2022-11-11 浙江智臾科技有限公司 Distributed file online recovery method, system, computer equipment and storage medium

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5754782A (en) * 1995-12-04 1998-05-19 International Business Machines Corporation System and method for backing up and restoring groupware documents
US20040049558A1 (en) * 2002-09-09 2004-03-11 Chung-I Lee System and method for synchronizing unstructured documents
CN101426026A (en) * 2008-09-17 2009-05-06 北京六维世纪网络技术有限公司 Method and system for data synchronization between multiple servers
CN104407941A (en) * 2014-11-26 2015-03-11 上海爱数软件有限公司 Windows file backup method base on file archive attribute
CN104714859A (en) * 2013-12-17 2015-06-17 南京壹进制信息技术有限公司 Rapid backup and recovery method of mass files
US20160105503A1 (en) * 2014-10-11 2016-04-14 Papaya Mobile, Inc. Data Synchronization Methods and Systems
US20160147614A1 (en) * 2014-11-25 2016-05-26 Kaushal MITTAL Synchronized Backup and Recovery of Database Systems
CN106372179A (en) * 2016-08-31 2017-02-01 上海爱数信息技术股份有限公司 Method and system for detecting document change and synchronization
CN108089946A (en) * 2017-12-15 2018-05-29 安徽长泰信息安全服务有限公司 A kind of multinode Fast incremental backup method
CN108885644A (en) * 2016-03-25 2018-11-23 本特利系统有限公司 The method and computer-readable medium of incremental data conversion for using synchronizing information to record
CN109710584A (en) * 2018-12-20 2019-05-03 浪潮软件集团有限公司 A method and device for realizing two-way synchronization of files by using a cloud message service platform
CN116866363A (en) * 2023-05-26 2023-10-10 中国银行股份有限公司 Distributed file synchronization method, device, equipment and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5754782A (en) * 1995-12-04 1998-05-19 International Business Machines Corporation System and method for backing up and restoring groupware documents
US20040049558A1 (en) * 2002-09-09 2004-03-11 Chung-I Lee System and method for synchronizing unstructured documents
CN101426026A (en) * 2008-09-17 2009-05-06 北京六维世纪网络技术有限公司 Method and system for data synchronization between multiple servers
CN104714859A (en) * 2013-12-17 2015-06-17 南京壹进制信息技术有限公司 Rapid backup and recovery method of mass files
US20160105503A1 (en) * 2014-10-11 2016-04-14 Papaya Mobile, Inc. Data Synchronization Methods and Systems
US20160147614A1 (en) * 2014-11-25 2016-05-26 Kaushal MITTAL Synchronized Backup and Recovery of Database Systems
CN104407941A (en) * 2014-11-26 2015-03-11 上海爱数软件有限公司 Windows file backup method base on file archive attribute
CN108885644A (en) * 2016-03-25 2018-11-23 本特利系统有限公司 The method and computer-readable medium of incremental data conversion for using synchronizing information to record
CN106372179A (en) * 2016-08-31 2017-02-01 上海爱数信息技术股份有限公司 Method and system for detecting document change and synchronization
CN108089946A (en) * 2017-12-15 2018-05-29 安徽长泰信息安全服务有限公司 A kind of multinode Fast incremental backup method
CN109710584A (en) * 2018-12-20 2019-05-03 浪潮软件集团有限公司 A method and device for realizing two-way synchronization of files by using a cloud message service platform
CN116866363A (en) * 2023-05-26 2023-10-10 中国银行股份有限公司 Distributed file synchronization method, device, equipment and storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
伊恩•文斯•麦克洛克林: "《计算机系统》", 30 June 2020, 机械工业出版社, pages: 295 *
席振元: "《数据通信与计算机网络》", 31 December 2010, 煤炭工业出版社, pages: 36 *
殷广鸿: "《VSS版本翻案理及其应用》", 31 January 2005, 国防工业出版社, pages: 107 *
郭虹: "基于SharePoint的企业内部管理系统的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》, pages 36 - 37 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113641756A (en) * 2021-07-26 2021-11-12 浪潮卓数大数据产业发展有限公司 A Distributed High Concurrency Data Storage Method
CN115328880A (en) * 2022-10-13 2022-11-11 浙江智臾科技有限公司 Distributed file online recovery method, system, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
US12135733B2 (en) File journal interface for synchronizing content
CA2758518C (en) Asynchronous distributed object uploading for replicated content addressable storage clusters
CN111386522A (en) Multi-region multi-master replication of database tables
GB2399663A (en) Synchronising content between two sources using profiles
CN115185966A (en) Method and device for processing data consistency in distributed cluster
CN116467275A (en) Shared remote storage method, device, system, electronic equipment and storage medium
CN111782619A (en) A method, synchronization device and storage medium for incremental synchronization of documents between servers
US11481367B2 (en) Redo mining during rolling upgrade
CN120492421A (en) Information processing method, device, equipment, computer storage medium and computer program product
CN118519825A (en) Method, apparatus, device and storage medium for recovering database

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20201016