CN106776790A - Concurrent master-slave synchronisation method and device based on token - Google Patents
Concurrent master-slave synchronisation method and device based on token Download PDFInfo
- Publication number
- CN106776790A CN106776790A CN201611046602.6A CN201611046602A CN106776790A CN 106776790 A CN106776790 A CN 106776790A CN 201611046602 A CN201611046602 A CN 201611046602A CN 106776790 A CN106776790 A CN 106776790A
- Authority
- CN
- China
- Prior art keywords
- data
- data synchronization
- token
- slave
- tasks
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 41
- 230000006870 function Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000004590 computer program Methods 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000000429 assembly Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5083—Techniques for rebalancing the load in a distributed system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5018—Thread allocation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明公开了一种基于令牌的并发主从同步方法及装置。所述方法包括:接收来自主数据库的数据同步任务;按照接收数据同步任务的顺序,为数据同步任务设置令牌;将设置有令牌的数据同步任务分发给多个线程中一个线程,由该线程根据令牌执行数据同步任务。利用本发明上述方案,从数据库有多个线程可以用于并行执行部分数据同步任务,提高了数据同步速度,克服了从数据库单线程执行数据同步任务造成的主数据库与从数据库中数据显著不同步问题,通过设置令牌来限定数据同步任务的执行顺序,并依据令牌串行执行数据同步任务,保证与主数据库的数据一致。
The invention discloses a token-based concurrent master-slave synchronization method and device. The method includes: receiving a data synchronization task from the main database; setting a token for the data synchronization task according to the order in which the data synchronization task is received; distributing the data synchronization task set with the token to one thread among multiple threads, and the Threads perform data synchronization tasks based on tokens. Utilizing the above scheme of the present invention, multiple threads in the slave database can be used to execute part of the data synchronization tasks in parallel, which improves the data synchronization speed and overcomes the significant out-of-sync data between the master database and the slave database caused by the single-threaded execution of data synchronization tasks in the slave database The problem is to limit the execution sequence of data synchronization tasks by setting tokens, and execute data synchronization tasks serially based on tokens to ensure data consistency with the master database.
Description
技术领域technical field
本发明涉及互联网技术领域,具体涉及一种基于令牌的并发主从同步方法及装置。The invention relates to the technical field of the Internet, in particular to a token-based concurrent master-slave synchronization method and device.
背景技术Background technique
分布式数据存储系统就是将数据分散存储在多台独立的设备上,也就是说,针对一份数据,存储至N个数据库上,一般是存储至一个主数据库和多个从数据库,其中,从数据库中的数据是与主数据库进行同步获得的。A distributed data storage system is to disperse and store data on multiple independent devices. That is to say, for a piece of data, it is stored on N databases, usually in one master database and multiple slave databases. Among them, the slave The data in the database is obtained by synchronizing with the main database.
现有技术中主数据库和从数据库之间的数据同步过程具体为,主数据库接收到客户端写数据的请求后,将数据写入主数据库中,并将写数据操作记录到主数据库的日志文件中。随后,主数据库向从数据库发送数据同步任务,从数据库根据数据同步任务执行将数据写入从数据库的写数据操作,以及将写数据操作记录到从数据库的日志文件中。在该数据同步过程中,从数据库只有一个线程用于处理主数据库发送的数据同步任务。该线程接收来自主数据库的数据同步任务,需要串行执行数据同步任务所涉及的写数据操作和写日志操作。在短时间内数据同步任务过多的情况下,线程无法及时地处理数据同步任务,造成从数据库同步效率低下的问题,导致出现主数据库和从数据库的数据不一致的情况。The data synchronization process between the master database and the slave database in the prior art is specifically, after the master database receives the client’s request to write data, writes the data into the master database, and records the write data operation to the log file of the master database middle. Subsequently, the master database sends a data synchronization task to the slave database, and the slave database executes a write data operation of writing data into the slave database according to the data synchronization task, and records the write data operation into a log file of the slave database. During the data synchronization process, only one thread of the slave database is used to process the data synchronization task sent by the master database. This thread receives the data synchronization task from the main database, and needs to serially execute the data writing operation and log writing operation involved in the data synchronization task. In the case of too many data synchronization tasks in a short period of time, the thread cannot process the data synchronization tasks in a timely manner, resulting in the problem of low synchronization efficiency of the slave database, resulting in data inconsistency between the master database and the slave database.
发明内容Contents of the invention
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的基于令牌的并发主从同步方法和相应的基于令牌的并发主从同步装置。In view of the above problems, the present invention is proposed to provide a token-based concurrent master-slave synchronization method and a corresponding token-based concurrent master-slave synchronization device that overcome the above problems or at least partially solve the above problems.
根据本发明的一个方面,提供了一种基于令牌的并发主从同步方法,其包括:According to one aspect of the present invention, a token-based concurrent master-slave synchronization method is provided, comprising:
接收来自主数据库的数据同步任务;Receive data synchronization tasks from the main database;
按照接收数据同步任务的顺序,为数据同步任务设置令牌;Set tokens for data synchronization tasks in the order in which they are received;
将设置有令牌的数据同步任务分发给多个线程中一个线程,由该线程根据令牌执行数据同步任务。The data synchronization task set with the token is distributed to one of the multiple threads, and the thread executes the data synchronization task according to the token.
根据本发明的另一方面,提供了一种基于令牌的并发主从同步装置,其包括:According to another aspect of the present invention, a token-based concurrent master-slave synchronization device is provided, which includes:
接收模块,适于接收来自主数据库的数据同步任务;A receiving module adapted to receive data synchronization tasks from the master database;
设置模块,适于按照接收数据同步任务的顺序,为数据同步任务设置令牌;The setting module is suitable for setting tokens for the data synchronization tasks according to the order in which the data synchronization tasks are received;
分发模块,适于将设置有令牌的数据同步任务分发给多个并行处理模块中一个并行处理模块;A distribution module, suitable for distributing the data synchronization task provided with the token to a parallel processing module in a plurality of parallel processing modules;
多个并行处理模块,适于根据令牌执行数据同步任务。Multiple parallel processing modules adapted to perform data synchronization tasks based on tokens.
根据本发明提供的方案,接收来自主数据库的数据同步任务,按照接收数据同步任务的顺序,为数据同步任务设置令牌,将设置有令牌的数据同步任务分发给多个线程中一个线程,由该线程根据令牌执行数据同步任务。利用本发明上述方案,从数据库有多个线程可以用于并行执行部分数据同步任务,提高了数据同步速度,克服了从数据库单线程执行数据同步任务造成的主数据库与从数据库中数据显著不同步问题,通过设置令牌来限定数据同步任务的执行顺序,并依据令牌串行执行数据同步任务,保证与主数据库的数据一致。According to the solution provided by the present invention, the data synchronization task from the master database is received, a token is set for the data synchronization task according to the order in which the data synchronization task is received, and the data synchronization task with the token is distributed to one of the multiple threads, The data synchronization task is performed by this thread according to the token. Utilizing the above scheme of the present invention, multiple threads in the slave database can be used to execute part of the data synchronization tasks in parallel, which improves the data synchronization speed and overcomes the significant out-of-sync between the data in the master database and the slave database caused by the single-threaded execution of the data synchronization tasks in the slave database The problem is to limit the execution sequence of data synchronization tasks by setting tokens, and execute data synchronization tasks serially based on tokens to ensure data consistency with the master database.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the specific embodiments of the present invention are enumerated below.
附图说明Description of drawings
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating a preferred embodiment and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same parts. In the attached picture:
图1示出了根据本发明一个实施例的基于令牌的并发主从同步方法的流程示意图;Fig. 1 shows a schematic flow diagram of a token-based concurrent master-slave synchronization method according to an embodiment of the present invention;
图2示出了根据本发明另一个实施例的基于令牌的并发主从同步方法的流程示意图;Fig. 2 shows a schematic flow diagram of a token-based concurrent master-slave synchronization method according to another embodiment of the present invention;
图3示出了根据本发明一个实施例的基于令牌的并发主从同步装置的结构示意图。Fig. 3 shows a schematic structural diagram of a token-based concurrent master-slave synchronization device according to an embodiment of the present invention.
具体实施方式detailed description
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
图1示出了根据本发明一个实施例的基于令牌的并发主从同步方法的流程示意图。如图1所示,该方法包括以下步骤:Fig. 1 shows a schematic flowchart of a token-based concurrent master-slave synchronization method according to an embodiment of the present invention. As shown in Figure 1, the method includes the following steps:
步骤S100,接收来自主数据库的数据同步任务。Step S100, receiving a data synchronization task from the master database.
分布式数据存储系统就是将数据分散存储在多台独立的设备上,也就是说,针对一份数据,存储至N个数据库,一般是存储至一个主数据库和多个从数据库,从数据库中的数据是与主数据库进行同步获得的,也就是说,数据写入主数据库后,主数据库需要将写入的数据同步给从数据库,因此,主数据库向从数据库发送数据同步任务,而从数据库接收来自主数据库的数据同步任务。A distributed data storage system is to disperse and store data on multiple independent devices. That is to say, for a piece of data, it is stored in N databases, usually in one master database and multiple slave databases. The data is obtained by synchronizing with the master database, that is to say, after the data is written into the master database, the master database needs to synchronize the written data to the slave database. Therefore, the master database sends a data synchronization task to the slave database, and the slave database receives Data synchronization tasks from the master database.
数据同步任务是根据写入主数据库的数据而生成的,也就是说针对写入主数据库的任一数据都将生成相应的数据同步任务。The data synchronization task is generated according to the data written into the master database, that is to say, a corresponding data synchronization task will be generated for any data written into the master database.
步骤S101,按照接收数据同步任务的顺序,为数据同步任务设置令牌。Step S101, according to the order in which the data synchronization tasks are received, tokens are set for the data synchronization tasks.
其中,令牌标示了数据同步任务的执行顺序,只有排序在前的令牌对应的数据同步任务被执行后,才可以执行排序在后的令牌对应的数据同步任务。举例说明,按照接收数据同步任务的顺序,设置了数据同步任务的令牌分别为1、2、3、4,这样,只有在令牌1对应的数据同步任务被执行完成后,才可以执行令牌2对应的数据同步任务,若令牌1对应的数据同步任务还未被执行,则不能执行令牌2对应的数据同步任务,同理,以此类推,执行令牌3和4对应的数据同步任务。在本发明实施例中,为数据同步任务设置令牌,保证了在数据同步过程中不会出现同步至从数据库的数据与写入到主数据库的数据不一致的缺陷。Wherein, the tokens mark the execution order of the data synchronization tasks, and only after the data synchronization tasks corresponding to the tokens in the earlier order are executed, can the data synchronization tasks corresponding to the tokens in the lower order be executed. For example, according to the order of receiving data synchronization tasks, the tokens of the data synchronization tasks are set to 1, 2, 3, and 4 respectively. In this way, the command can be executed only after the data synchronization task corresponding to token 1 is executed. For the data synchronization task corresponding to card 2, if the data synchronization task corresponding to token 1 has not been executed, the data synchronization task corresponding to token 2 cannot be executed. Similarly, the data corresponding to tokens 3 and 4 will be executed by analogy. Synchronize tasks. In the embodiment of the present invention, a token is set for the data synchronization task, which ensures that the data synchronized to the slave database and the data written to the master database will not be inconsistent during the data synchronization process.
步骤S102,将设置有令牌的数据同步任务分发给多个线程中一个线程,由该线程根据令牌执行数据同步任务。Step S102, distributing the data synchronization task set with the token to one thread among multiple threads, and the thread executes the data synchronization task according to the token.
具体地,在为数据同步任务设置令牌后,可以将设置有令牌的数据同步任务分发给多个线程中一个线程,由该线程根据令牌执行数据同步任务,对于不同数据的数据同步任务可以分发给不同的线程处理。Specifically, after the token is set for the data synchronization task, the data synchronization task with the token can be distributed to one thread among multiple threads, and the thread executes the data synchronization task according to the token. For data synchronization tasks of different data Can be distributed to different threads for processing.
根据本发明上述实施例提供的方法,接收来自主数据库的数据同步任务,按照接收数据同步任务的顺序,为数据同步任务设置令牌,将设置有令牌的数据同步任务分发给多个线程中一个线程,由该线程根据令牌执行数据同步任务。利用本发明上述方案,从数据库有多个线程可以用于并行执行部分数据同步任务,提高了数据同步速度,克服了从数据库单线程执行数据同步任务造成的主数据库与从数据库中数据显著不同步问题,通过设置令牌来限定数据同步任务的执行顺序,并依据令牌串行执行数据同步任务,保证与主数据库的数据一致。According to the method provided by the above-mentioned embodiments of the present invention, the data synchronization task from the main database is received, the token is set for the data synchronization task according to the order in which the data synchronization task is received, and the data synchronization task with the token is distributed to multiple threads A thread that performs data synchronization tasks based on the token. Utilizing the above scheme of the present invention, multiple threads in the slave database can be used to execute part of the data synchronization tasks in parallel, which improves the data synchronization speed and overcomes the significant out-of-sync between the data in the master database and the slave database caused by the single-threaded execution of the data synchronization tasks in the slave database The problem is to limit the execution sequence of data synchronization tasks by setting tokens, and execute data synchronization tasks serially based on tokens to ensure data consistency with the master database.
图2示出了根据本发明另一个实施例的基于令牌的并发主从同步方法的流程示意图。如图2所示,该方法包括以下步骤:Fig. 2 shows a schematic flowchart of a token-based concurrent master-slave synchronization method according to another embodiment of the present invention. As shown in Figure 2, the method includes the following steps:
步骤S200,接收来自主数据库的数据同步任务。Step S200, receiving a data synchronization task from the master database.
数据同步任务是根据写入主数据库的数据而生成的,也就是说针对写入主数据库的任一数据都将生成相应的数据同步任务。The data synchronization task is generated according to the data written into the master database, that is to say, a corresponding data synchronization task will be generated for any data written into the master database.
举例说明,用户通过客户端向主数据库写入数据Set a=1;Set b=2;Set c=1;Set a=4,主数据库将分别向从数据库发送4个数据同步任务Set a=1;Set b=2;Set c=1;Set a=4,即,从数据库接收到来自主数据库的数据同步任务为:Set a=1;Set b=2;Set c=1;Set a=4。For example, if the user writes data Set a=1; Set b=2; Set c=1; Set a=4 to the master database through the client, the master database will send 4 data synchronization tasks Set a=1 to the slave database respectively ; Set b=2; Set c=1; Set a=4, that is, the data synchronization task received from the master database from the database is: Set a=1; Set b=2; Set c=1; Set a=4.
步骤S201,按照接收数据同步任务的顺序,为数据同步任务设置令牌。Step S201, according to the order in which the data synchronization tasks are received, tokens are set for the data synchronization tasks.
其中,主数据库可以实时将数据同步任务发送给从数据库,也就是说,从数据库可以不断地接收到主数据库发送的数据同步任务,主数据库是按照数据写入主数据库的顺序向从数据库发送数据同步任务,因此,在为数据同步任务设置令牌时,也需要按照接收数据同步任务的顺序来设置令牌。举例说明,主数据库顺序向从数据库发送了4个数据同步任务,分别为:Set a=1;Set b=2;Set c=1;Set a=4,那么,从数据库接收到的数据同步任务顺序为:Set a=1;Set b=2;Set c=1;Set a=4,这样,从数据库可以按照接收数据同步任务的顺序,为数据同步任务设置令牌,例如,分别设置4个数据同步任务的令牌为1、2、3、4。Among them, the master database can send data synchronization tasks to the slave database in real time, that is to say, the slave database can continuously receive the data synchronization tasks sent by the master database, and the master database sends data to the slave database in the order in which the data is written to the master database Synchronization tasks, therefore, when setting tokens for data synchronization tasks, tokens also need to be set in the order in which data synchronization tasks are received. For example, the master database sequentially sends 4 data synchronization tasks to the slave database, namely: Set a=1; Set b=2; Set c=1; Set a=4, then, the data synchronization tasks received from the database The sequence is: Set a=1; Set b=2; Set c=1; Set a=4, so that the slave database can set tokens for data synchronization tasks in the order in which they are received, for example, set 4 The tokens for data synchronization tasks are 1, 2, 3, 4.
步骤S202,依据负载均衡策略,从多个线程选择一个线程。Step S202, selecting a thread from multiple threads according to the load balancing strategy.
其中,负载均衡策略指多个线程的业务负载压力均衡,而不会出现有些线程的业务负载压力很大,而有些线程的业务负载压力很小的情况,依据线程的业务负载情况分发数据同步任务。Among them, the load balancing strategy refers to the business load pressure balance of multiple threads, and the business load pressure of some threads is very high, while the business load pressure of some threads is small, and the data synchronization task is distributed according to the business load of the threads. .
在为数据同步任务设置令牌后,需要将数据同步任务分发给线程,由线程执行数据同步任务,从数据库中有多个线程可以执行数据同步任务,这里需要从多个线程中选择一个合适的线程来执行数据同步任务,选择线程的依据是负载均衡策略,目的是为了平衡各个线程之间的业务负载压力,使得各个线程的业务负载压力基本均衡。After setting the token for the data synchronization task, the data synchronization task needs to be distributed to the thread, and the thread performs the data synchronization task. There are multiple threads in the database that can perform the data synchronization task. Here, a suitable one needs to be selected from multiple threads. Threads are used to perform data synchronization tasks. The basis for selecting threads is the load balancing strategy. The purpose is to balance the business load pressure among each thread, so that the business load pressure of each thread is basically balanced.
步骤S203,将设置有令牌的数据同步任务分发给所选择的线程。Step S203, distributing the data synchronization task set with the token to the selected thread.
在依据负载均衡策略,从多个线程选择一个线程后,将设置于令牌的数据同步任务分发给所选择的线程,由该线程来执行数据同步任务。After selecting a thread from multiple threads according to the load balancing strategy, the data synchronization task set in the token is distributed to the selected thread, and the thread performs the data synchronization task.
其中,数据同步任务包括:将数据写入从数据库的写数据操作,以及将写数据操作记录到日志文件中的写日志操作。日志文件用于记录数据写操作记录,以在从数据库中数据出现丢失等问题时,能够方便地根据日志文件中的写数据操作记录恢复从数据库的数据。因此,要求记录到日志文件中的写数据操作记录是按照接收数据同步任务的顺序执行的。Wherein, the data synchronization task includes: a write data operation of writing data into the slave database, and a write log operation of recording the write data operation into a log file. The log file is used to record data write operation records, so that when data loss occurs in the slave database, the data in the slave database can be easily restored according to the write data operation records in the log file. Therefore, the write data operation records required to be recorded in the log file are executed in the order in which the data synchronization tasks are received.
从数据库接收的数据同步任务可以是多个,也就是说,可以依据负载均衡策略选择多个线程执行数据同步任务,其中,各个线程之间执行的写数据操作为并行操作;各个线程之间执行的写日志操作为串行操作。针对不同数据,各个线程可以并行执行将数据写入从数据库的写数据操作,而不会对写入从数据库的数据造成任何影响,然而,针对同一数据的数据同步任务分发给同一线程,也就是说,针对同一数据,将数据写入从数据库的写数据操作也应该是由线程串行执行的,目的是防止分发给不同的线程处理,导致从数据库的数据与主数据的数据不一致的情况出现。There can be multiple data synchronization tasks received from the database. That is to say, multiple threads can be selected to perform data synchronization tasks according to the load balancing strategy. Among them, the data writing operations performed between each thread are parallel operations; The write log operation is a serial operation. For different data, each thread can execute the write data operation of writing data to the slave database in parallel without any impact on the data written to the slave database. However, the data synchronization task for the same data is distributed to the same thread, that is, That is to say, for the same data, the write data operation of writing data to the slave database should also be executed serially by threads, the purpose is to prevent distribution to different threads for processing, resulting in inconsistency between the data of the slave database and the data of the master data .
此外,每个线程分别定义了可以执行并行操作和串行操作的函数,举例说明,执行并行操作的函数为function1,执行串行操作的函数为function2,也就是说,将数据写入从数据库的写数据操作可以由function1执行、将写数据操作记录到日志文件中的写日志操作可以由function2执行,线程在接收到数据同步任务后,将会由会function1、function2来执行数据同步任务。In addition, each thread defines functions that can perform parallel operations and serial operations. For example, the function that performs parallel operations is function1, and the function that performs serial operations is function2. That is to say, write data to the slave database. The write data operation can be performed by function1, and the write log operation that records the write data operation into the log file can be performed by function2. After the thread receives the data synchronization task, it will perform the data synchronization task by function1 and function2.
步骤S204,由该线程执行将数据写入从数据库的写数据操作。In step S204, the thread executes a data write operation for writing data into the slave database.
举例说明,针对于数据同步任务:Set a=1;Set b=2;Set c=1;Set a=4,可以依据负载均衡策略将数据同步任务Set a=1;Set a=4分发给线程1,数据同步任务Set b=2分发给线程2,数据同步任务Set c=1分发给线程3,其中,对于数据同步任务中的将数据写入从数据库的写数据操作,第一线程1、2、3可以并行执行,而将写数据操作记录到日志文件中的写日志操作则需要第一线程1、2、3串行执行。线程1、2、3在执行将写数据操作记录到日志文件中的写日志操作时,需要根据令牌来执行,具体地,可以采用如下方法步骤来执行将写数据操作记录到日志文件中的写日志操作。For example, for the data synchronization task: Set a=1; Set b=2; Set c=1; Set a=4, the data synchronization task Set a=1; Set a=4 can be distributed to threads according to the load balancing strategy 1, the data synchronization task Set b=2 is distributed to thread 2, and the data synchronization task Set c=1 is distributed to thread 3, wherein, for the write data operation of writing data from the database in the data synchronization task, the first thread 1, 2 and 3 can be executed in parallel, but the write log operation of recording the write data operation into the log file needs to be executed serially by the first threads 1, 2, and 3. When threads 1, 2, and 3 perform the write log operation of recording the write data operation into the log file, they need to execute according to the token. Specifically, the following method steps can be used to perform the write data operation recorded into the log file. Write log operations.
步骤S205,判断顺序排在令牌前一位的令牌对应的数据同步任务的写日志操作是否执行完成,若是,则执行步骤S206;若否,则执行步骤S207。Step S205, judging whether the log writing operation of the data synchronization task corresponding to the token ranked one place before the token is completed, if yes, execute step S206; if not, execute step S207.
其中,令牌的排列顺序与接收数据同步任务的顺序一致。Wherein, the arrangement order of the tokens is consistent with the order of receiving data synchronization tasks.
具体地,function2在执行将写数据操作记录到日志文件中的写日志操作之前,还需要判断顺序排在令牌前一位的令牌对应的数据同步任务的写日志操作是否执行完成,函数function2的代码能够实现判断功能,这里判断顺序排在令牌前一位的令牌对应的数据同步任务的写日志操作是否执行完成主要是为了保证写日志操作是按照接收数据同步任务的顺序执行的,保证在从数据库中数据出现丢失等问题时,能够方便地根据日志文件中的写数据操作记录恢复从数据库的数据。Specifically, before function2 executes the write log operation of recording the write data operation into the log file, it also needs to judge whether the write log operation of the data synchronization task corresponding to the token that is ranked one place before the token is completed. The function function2 The code can realize the judgment function. Here, it is judged whether the log writing operation of the data synchronization task corresponding to the token ranked in the first order of the token is completed. The main purpose is to ensure that the log writing operation is executed in the order of receiving the data synchronization task. It is ensured that when problems such as data loss in the slave database occur, the data in the slave database can be easily restored according to the write data operation records in the log file.
举例说明,从数据库为数据同步任务:Set a=1;Set b=2;Set c=1;Set a=4,分别设置令牌为1、2、3、4。线程2在执行将Set b=2记录到日志文件中时,需要判断令牌1对应的数据同步任务是否执行完成,同理,线程3在执行将Set c=1记录到日志文件中时,需要判断令牌1、2对应的数据同步任务是否执行完成,同样地,线程1在执行将Set a=4记录到日志文件中时,需要判断令牌1、2、3对应的数据同步任务是否执行完成。For example, for the data synchronization task from the database: Set a=1; Set b=2; Set c=1; Set a=4, set tokens to 1, 2, 3, 4 respectively. When thread 2 executes and records Set b=2 in the log file, it needs to judge whether the data synchronization task corresponding to token 1 is executed. Similarly, when thread 3 executes and records Set c=1 in the log file, it needs to Determine whether the data synchronization tasks corresponding to tokens 1 and 2 have been executed. Similarly, when thread 1 executes and records Set a=4 in the log file, it needs to determine whether the data synchronization tasks corresponding to tokens 1, 2, and 3 are executed. Finish.
步骤S206,执行用于将写数据操作记录到日志文件中的写日志操作。Step S206, executing a write log operation for recording the write data operation into a log file.
若判断出顺序排在令牌前一位的令牌对应的数据同步任务的写日志操作执行完成,则线程可以执行用于将写数据操作记录到日志文件中的写日志操作。If it is determined that the log write operation of the data synchronization task corresponding to the token ranked one bit before the token is completed, the thread may execute the log write operation for recording the write data operation into the log file.
步骤S207,继续等待。Step S207, continue to wait.
若判断出顺序排在令牌前一位的令牌对应的数据同步任务的写日志操作未执行完成,则需要继续等待,等待顺序排在令牌前一位的令牌对应的数据同步任务的写日志操作执行完成后,才执行该令牌对应的将写数据操作记录到日志文件中的写日志操作。If it is judged that the log writing operation of the data synchronization task corresponding to the token that ranks one place before the token has not been completed, you need to continue to wait for the data synchronization task corresponding to the token that ranks one place before the token. After the log write operation is completed, the log write operation corresponding to the token that records the write data operation into the log file is executed.
根据本发明上述实施例提供的方法,从数据库有多个线程可以用于并行执行部分数据同步任务,提高了数据同步速度,克服了从数据库单线程执行数据同步任务造成的主数据库与从数据库中数据显著不同步问题,按照接收数据同步任务的顺序,为数据同步任务设置令牌,并依据负载均衡策略,从多个线程选择一个线程,将设置有令牌的数据同步任务分发给所选择的线程,能够保证每个线程的负载业务压力均衡,而不会出现有些线程负载业务压力过大,有些线程负载压力过小的情况,判断顺序排在令牌前一位的令牌对应的数据同步任务的写日志操作是否执行完成,若是,则执行用于将写数据操作记录到日志文件中的写日志操作;若否,则继续等待,使得记录到日志文件的写日志操作是按照接收数据同步任务顺序严格串行执行的,保证了在从数据库中数据出现丢失等问题时,能够方便地根据日志文件中的写数据操作记录恢复从数据库的数据。According to the method provided by the above-mentioned embodiments of the present invention, there are multiple threads in the slave database that can be used to execute part of the data synchronization tasks in parallel, which improves the data synchronization speed and overcomes the gap between the master database and the slave database caused by the single-threaded execution of the data synchronization tasks in the slave database. If the data is significantly out of sync, set a token for the data synchronization task in the order in which the data synchronization task is received, and select a thread from multiple threads according to the load balancing strategy, and distribute the data synchronization task with the token to the selected Threads can ensure that the load and business pressure of each thread is balanced, and there will be no situation where some threads have too much load and business pressure, and some threads have too little load pressure, and the data synchronization corresponding to the token whose order is ranked before the token is judged Whether the log writing operation of the task is completed, if so, execute the log writing operation used to record the write data operation into the log file; if not, continue to wait, so that the log writing operation recorded to the log file is synchronized according to the received data The order of tasks is executed strictly serially, which ensures that in the event of data loss in the slave database, the data in the slave database can be easily restored according to the write data operation records in the log file.
图3示出了根据本发明一个实施例的基于令牌的并发主从同步装置的结构示意图。如图3所示,该装置包括:接收模块300、设置模块310、分发模块320、多个并行处理模块330。Fig. 3 shows a schematic structural diagram of a token-based concurrent master-slave synchronization device according to an embodiment of the present invention. As shown in FIG. 3 , the device includes: a receiving module 300 , a setting module 310 , a distribution module 320 , and multiple parallel processing modules 330 .
接收模块300,适于接收来自主数据库的数据同步任务。The receiving module 300 is adapted to receive data synchronization tasks from the master database.
设置模块310,适于按照接收数据同步任务的顺序,为数据同步任务设置令牌。The setting module 310 is adapted to set tokens for the data synchronization tasks according to the order in which the data synchronization tasks are received.
分发模块320,适于将设置有令牌的数据同步任务分发给多个并行处理模块中一个并行处理模块。The distribution module 320 is adapted to distribute the data synchronization task set with the token to one parallel processing module in the plurality of parallel processing modules.
多个并行处理模块330,适于根据令牌执行数据同步任务。Multiple parallel processing modules 330 are adapted to execute data synchronization tasks according to tokens.
可选地,分发模块320进一步适于:依据负载均衡策略,从多个并行处理模块选择一个并行处理模块;将设置有令牌的数据同步任务分发给所选择的并行处理模块。Optionally, the distribution module 320 is further adapted to: select a parallel processing module from multiple parallel processing modules according to a load balancing strategy; and distribute the data synchronization task with the token set to the selected parallel processing module.
可选地,数据同步任务包括:将数据写入从数据库的写数据操作,以及将写数据操作记录到日志文件中的写日志操作。Optionally, the data synchronization task includes: a write data operation of writing data into the slave database, and a write log operation of recording the write data operation into a log file.
可选地,各个并行处理模块之间执行的写数据操作为并行操作;各个并行处理模块之间执行的写日志操作为串行操作。Optionally, the data writing operation performed between the parallel processing modules is a parallel operation; the log writing operation performed between the parallel processing modules is a serial operation.
可选地,并行处理模块330进一步适于:判断顺序排在令牌前一位的令牌对应的数据同步任务的写日志操作是否执行完成;其中,令牌的排列顺序与接收数据同步任务的顺序一致;若是,则执行用于将写数据操作记录到日志文件中的写日志操作;若否,则继续等待。Optionally, the parallel processing module 330 is further adapted to: judging whether the log writing operation of the data synchronization task corresponding to the token preceding the token is completed; The sequence is consistent; if yes, execute the write log operation for recording the write data operation into the log file; if not, continue to wait.
可选地,分发模块进一步适于:针对同一数据的数据同步任务分发给同一线程。Optionally, the distribution module is further adapted to: distribute data synchronization tasks for the same data to the same thread.
根据本发明上述实施例提供的装置,从数据库有多个线程可以用于并行执行部分数据同步任务,提高了数据同步速度,克服了从数据库单线程执行数据同步任务造成的主数据库与从数据库中数据显著不同步问题,按照接收数据同步任务的顺序,为数据同步任务设置令牌,并依据负载均衡策略,从多个线程选择一个线程,将设置有令牌的数据同步任务分发给所选择的线程,判断顺序排在令牌前一位的令牌对应的数据同步任务的写日志操作是否执行完成,若是,则执行用于将写数据操作记录到日志文件中的写日志操作;若否,则继续等待,保证了记录到日志文件的写日志操作是按照接收数据同步任务顺序严格串行执行的,保证了在从数据库中数据出现丢失等问题时,能够方便地根据日志文件中的写数据操作记录恢复从数据库的数据。According to the device provided by the above-mentioned embodiments of the present invention, there are multiple threads in the slave database that can be used to execute part of the data synchronization tasks in parallel, which improves the data synchronization speed and overcomes the gap between the master database and the slave database caused by the single-threaded execution of the data synchronization tasks in the slave database. If the data is significantly out of sync, set a token for the data synchronization task in the order in which the data synchronization task is received, and select a thread from multiple threads according to the load balancing strategy, and distribute the data synchronization task with the token to the selected Thread, judging whether the write log operation of the data synchronization task corresponding to the token preceding the token in order is completed, if so, execute the write log operation for recording the write data operation into the log file; if not, Then continue to wait, ensuring that the write log operation recorded to the log file is strictly serially executed in accordance with the order of the received data synchronization tasks, ensuring that when data loss occurs from the database, etc., it can be conveniently based on the write data in the log file Operation records restore data from the database.
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other device. Various generic systems can also be used with the teachings based on this. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not specific to any particular programming language. It should be understood that various programming languages can be used to implement the content of the present invention described herein, and the above description of specific languages is for disclosing the best mode of the present invention.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, in order to streamline this disclosure and to facilitate an understanding of one or more of the various inventive aspects, various features of the invention are sometimes grouped together in a single embodiment, figure, or its description. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method or method so disclosed may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will understand that although some embodiments described herein include some features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention. and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的基于令牌的并发主从同步设备中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) can be used in practice to implement some or all of some or all of the components in the token-based concurrent master-slave synchronization device according to the embodiment of the present invention. Full functionality. The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.
本发明公开了:The present invention discloses:
A1、一种基于令牌的并发主从同步方法,其包括:A1, a token-based concurrent master-slave synchronization method, which includes:
接收来自主数据库的数据同步任务;Receive data synchronization tasks from the main database;
按照接收数据同步任务的顺序,为所述数据同步任务设置令牌;According to the order in which the data synchronization tasks are received, a token is set for the data synchronization tasks;
将设置有令牌的数据同步任务分发给多个线程中一个线程,由该线程根据令牌执行所述数据同步任务。Distributing the data synchronization task set with the token to one of the multiple threads, and the thread executes the data synchronization task according to the token.
A2、根据A1所述的基于令牌的并发主从同步方法,其中,所述将设置有令牌的数据同步任务分发给多个线程中一个线程进一步包括:A2, according to the token-based concurrent master-slave synchronization method described in A1, wherein the distribution of the data synchronization task provided with the token to a thread in a plurality of threads further includes:
依据负载均衡策略,从多个线程选择一个线程;Select a thread from multiple threads according to the load balancing strategy;
将设置有令牌的数据同步任务分发给所选择的线程。Distributes data synchronization tasks with tokens set to the selected threads.
A3、根据A1所述的基于令牌的并发主从同步方法,其中,所述数据同步任务包括:A3. The token-based concurrent master-slave synchronization method according to A1, wherein the data synchronization task includes:
将数据写入从数据库的写数据操作,以及将所述写数据操作记录到日志文件中的写日志操作。A write data operation of writing data into the slave database, and a write log operation of recording the write data operation into a log file.
A4、根据A3所述的基于令牌的并发主从同步方法,其中,各个线程之间执行的所述写数据操作为并行操作;各个线程之间执行的所述写日志操作为串行操作。A4. The token-based concurrent master-slave synchronization method according to A3, wherein the data writing operation executed between threads is a parallel operation; the log writing operation executed between threads is a serial operation.
A5、根据A1所述的基于令牌的并发主从同步方法,其中,所述由该线程根据令牌执行所述数据同步任务进一步包括:A5. According to the token-based concurrent master-slave synchronization method described in A1, wherein the execution of the data synchronization task by the thread according to the token further includes:
判断顺序排在所述令牌前一位的令牌对应的数据同步任务的写日志操作是否执行完成;其中,所述令牌的排列顺序与接收数据同步任务的顺序一致;Judging whether the write log operation of the data synchronization task corresponding to the token preceding the token is completed; wherein, the sequence of the tokens is consistent with the order in which the data synchronization task is received;
若是,则执行用于将所述写数据操作记录到日志文件中的写日志操作;If so, then perform a write log operation for recording the write data operation into a log file;
若否,则继续等待。If not, continue to wait.
A6、根据A1所述的基于令牌的并发主从同步方法,其中,针对同一数据的数据同步任务分发给同一线程。A6. The token-based concurrent master-slave synchronization method according to A1, wherein the data synchronization tasks for the same data are distributed to the same thread.
B7、一种基于令牌的并发主从同步装置,其包括:B7, a token-based concurrent master-slave synchronization device, which includes:
接收模块,适于接收来自主数据库的数据同步任务;A receiving module adapted to receive data synchronization tasks from the master database;
设置模块,适于按照接收数据同步任务的顺序,为所述数据同步任务设置令牌;The setting module is adapted to set tokens for the data synchronization tasks according to the order in which the data synchronization tasks are received;
分发模块,适于将设置有令牌的数据同步任务分发给多个并行处理模块中一个并行处理模块;A distribution module, suitable for distributing the data synchronization task provided with the token to a parallel processing module in a plurality of parallel processing modules;
多个并行处理模块,适于根据令牌执行所述数据同步任务。A plurality of parallel processing modules are adapted to execute the data synchronization task according to the token.
B8、根据B7所述的基于令牌的并发主从同步装置,其中,所述分发模块进一步适于:依据负载均衡策略,从多个并行处理模块选择一个并行处理模块;将设置有令牌的数据同步任务分发给所选择的并行处理模块。B8. The token-based concurrent master-slave synchronization device according to B7, wherein the distribution module is further adapted to: select a parallel processing module from multiple parallel processing modules according to a load balancing strategy; Data synchronization tasks are distributed to selected parallel processing modules.
B9、根据B7所述的基于令牌的并发主从同步装置,其中,所述数据同步任务包括:B9, according to the token-based concurrent master-slave synchronization device described in B7, wherein the data synchronization task includes:
将数据写入从数据库的写数据操作,以及将所述写数据操作记录到日志文件中的写日志操作。A write data operation of writing data into the slave database, and a write log operation of recording the write data operation into a log file.
B10、根据B9所述的基于令牌的并发主从同步装置,其中,各个并行处理模块之间执行的所述写数据操作为并行操作;各个并行处理模块之间执行的所述写日志操作为串行操作。B10, according to the token-based concurrent master-slave synchronization device described in B9, wherein, the described write data operation performed between each parallel processing module is a parallel operation; the described write log operation performed between each parallel processing module is Serial operation.
B11、根据B7所述的基于令牌的并发主从同步装置,其中,所述并行处理模块进一步适于:B11. The token-based concurrent master-slave synchronization device according to B7, wherein the parallel processing module is further adapted to:
判断顺序排在所述令牌前一位的令牌对应的数据同步任务的写日志操作是否执行完成;其中,所述令牌的排列顺序与接收数据同步任务的顺序一致;Judging whether the write log operation of the data synchronization task corresponding to the token preceding the token is completed; wherein, the sequence of the tokens is consistent with the order in which the data synchronization task is received;
若是,则执行用于将所述写数据操作记录到日志文件中的写日志操作;If so, then perform a write log operation for recording the write data operation into a log file;
若否,则继续等待。If not, continue to wait.
B12、根据B7所述的基于令牌的并发主从同步装置,其中,所述分发模块进一步适于:针对同一数据的数据同步任务分发给同一线程。B12. The token-based concurrent master-slave synchronization device according to B7, wherein the distribution module is further adapted to: distribute data synchronization tasks for the same data to the same thread.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611046602.6A CN106776790A (en) | 2016-11-11 | 2016-11-11 | Concurrent master-slave synchronisation method and device based on token |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611046602.6A CN106776790A (en) | 2016-11-11 | 2016-11-11 | Concurrent master-slave synchronisation method and device based on token |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106776790A true CN106776790A (en) | 2017-05-31 |
Family
ID=58974408
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611046602.6A Pending CN106776790A (en) | 2016-11-11 | 2016-11-11 | Concurrent master-slave synchronisation method and device based on token |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106776790A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109284193A (en) * | 2018-09-06 | 2019-01-29 | 平安科技(深圳)有限公司 | A kind of distributed data processing method and server based on multithreading |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050033947A1 (en) * | 2003-08-08 | 2005-02-10 | Morris Dale C. | Multiprocessor system with interactive synchronization of local clocks |
CN101625655A (en) * | 2009-08-20 | 2010-01-13 | 华中科技大学 | Parallel recovery method of memory database |
CN103729239A (en) * | 2013-11-18 | 2014-04-16 | 芜湖大学科技园发展有限公司 | Distributed type lock algorithm of mirror-image metadata |
CN103885986A (en) * | 2012-12-21 | 2014-06-25 | 阿里巴巴集团控股有限公司 | Main and auxiliary database synchronization method and device |
CN104731956A (en) * | 2015-04-02 | 2015-06-24 | 北京奇虎科技有限公司 | Method and system for synchronizing data and related database |
-
2016
- 2016-11-11 CN CN201611046602.6A patent/CN106776790A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050033947A1 (en) * | 2003-08-08 | 2005-02-10 | Morris Dale C. | Multiprocessor system with interactive synchronization of local clocks |
CN101625655A (en) * | 2009-08-20 | 2010-01-13 | 华中科技大学 | Parallel recovery method of memory database |
CN103885986A (en) * | 2012-12-21 | 2014-06-25 | 阿里巴巴集团控股有限公司 | Main and auxiliary database synchronization method and device |
CN103729239A (en) * | 2013-11-18 | 2014-04-16 | 芜湖大学科技园发展有限公司 | Distributed type lock algorithm of mirror-image metadata |
CN104731956A (en) * | 2015-04-02 | 2015-06-24 | 北京奇虎科技有限公司 | Method and system for synchronizing data and related database |
Non-Patent Citations (2)
Title |
---|
何耀钦,薛华成: "《数据组织与管理》", 31 May 1992, 机械工业出版社 * |
徐高潮等: "《分布计算系统》", 31 January 2004, 高等教育出版社 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109284193A (en) * | 2018-09-06 | 2019-01-29 | 平安科技(深圳)有限公司 | A kind of distributed data processing method and server based on multithreading |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104965757B (en) | Method, virtual machine (vm) migration managing device and the system of live migration of virtual machine | |
EP2840495B1 (en) | Container-based processing method and apparatus | |
US9251231B2 (en) | Merging an out of synchronization indicator and a change recording indicator in response to a failure in consistency group formation | |
CN102662775B (en) | A kind of Way of Process Communication and device | |
US8539175B2 (en) | Transferring learning metadata between storage servers having clusters via copy services operations on a shared virtual logical unit that stores the learning metadata | |
CN109447253B (en) | Video memory allocation method and device, computing equipment and computer storage medium | |
US20130179662A1 (en) | Method and System for Resolving Thread Divergences | |
JP2008033933A (en) | Concurrent physical processor reallocation method, system, and program | |
CN102334102A (en) | Processor device, multithreaded processor device | |
TW200905566A (en) | System comprising a plurality of processors and method of operating the same | |
WO2017101642A1 (en) | Method and apparatus for upgrading data node of distributed system | |
JP2014528610A (en) | System and method for persisting transaction records in a transactional middleware machine environment | |
CN105653635A (en) | Database management method and apparatus | |
US10095542B2 (en) | Cooperative thread array granularity context switch during trap handling | |
US20120191958A1 (en) | System and method for context migration across cpu threads | |
CN103207810A (en) | Compute task state encapsulation | |
JPH0950418A (en) | System and method for control of customer information with temporary storage queuing function in loosely-coupled parallel processing environment | |
CN104808953B (en) | Control the method, device and mobile terminal of data storage | |
JP2006216027A5 (en) | ||
CN106776775A (en) | Concurrent master-slave synchronisation method and device | |
CN106790378A (en) | The full synchronous method of data of equipment room, apparatus and system | |
JPH0962635A (en) | Customer information control system and method having transaction-serialization control function in loosely-coupled parallel processing environment | |
KR102116096B1 (en) | Multisystem, and method of booting the same | |
CN107180051B (en) | Log management method and server | |
CN106383755A (en) | Method, apparatus and system for recovering slave database from master-slave database system |
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 |
Application publication date: 20170531 |
|
RJ01 | Rejection of invention patent application after publication |