WO2022001750A1 - Data synchronization processing method, electronic device, and storage medium - Google Patents

Data synchronization processing method, electronic device, and storage medium Download PDF

Info

Publication number
WO2022001750A1
WO2022001750A1 PCT/CN2021/101542 CN2021101542W WO2022001750A1 WO 2022001750 A1 WO2022001750 A1 WO 2022001750A1 CN 2021101542 W CN2021101542 W CN 2021101542W WO 2022001750 A1 WO2022001750 A1 WO 2022001750A1
Authority
WO
WIPO (PCT)
Prior art keywords
execution plan
sql
master node
sql execution
node
Prior art date
Application number
PCT/CN2021/101542
Other languages
French (fr)
Chinese (zh)
Inventor
李磊
朱业
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2022001750A1 publication Critical patent/WO2022001750A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication

Definitions

  • the present application relates to the technical field of distributed databases, and in particular, to a data synchronization processing method, an electronic device and a storage medium.
  • the existing data synchronization schemes of distributed databases mainly include asynchronous replication, full synchronous replication and semi-synchronous replication.
  • the asynchronous replication scheme has the least impact on the execution efficiency of the database, but it is prone to data inconsistency between the master node and the slave node; although the full synchronous replication scheme can ensure the consistency of data synchronization between the master node and the slave node, it has a
  • the performance of the distributed database system has a great impact and the efficiency is low, and it is not suitable for high-concurrency application scenarios.
  • the semi-synchronous replication scheme takes into account the efficiency and data consistency, there is still at least one incremental log synchronization disk placement cycle. Data delay .
  • Embodiments of the present application provide a data synchronization processing method, an electronic device, and a storage medium.
  • an embodiment of the present application provides a data synchronization processing method, which is applied to a master node.
  • the method includes: receiving a structured query language SQL statement sent by a client; parsing the SQL statement and generating an SQL execution plan , and send the SQL execution plan to at least one slave node; execute the SQL execution plan; obtain the first incremental log generated when the master node executes the SQL execution plan; Perform hash calculation on the data to obtain a first hash value; receive a second hash value sent by each of the slave nodes, wherein the second hash value is the execution plan for the slave node to execute the SQL The data of the second incremental log generated during the hash calculation is obtained; the synchronization result is determined according to the first hash value and the second hash value; the operation result information is sent to the client according to the synchronization result .
  • an embodiment of the present application provides a data synchronization processing method, which is applied to a master node.
  • the method includes: receiving a structured query language SQL statement sent by a client; sending the SQL statement to at least one slave node ;
  • the data of the second incremental log generated by the execution plan is obtained by hash calculation; the synchronization result is determined according to the first hash value and the second hash value; the operation result information is sent to the client according to the synchronization result end.
  • an embodiment of the present application provides a data synchronization processing method, which is applied to a slave node.
  • the method includes: receiving an SQL execution plan sent by a master node; executing the SQL execution plan; The second incremental log generated by the SQL execution plan, perform hash calculation on the data of the second incremental log to obtain a second hash value; send the second hash value to the master node, so that The master node determines the synchronization result according to the first hash value and the second hash value, wherein the first hash value performs data on the incremental log generated by the master node executing the SQL execution plan.
  • Hash is calculated.
  • an embodiment of the present application provides a data synchronization processing method, which is applied to a slave node.
  • the method includes: receiving an SQL statement sent by a master node; parsing the SQL statement and generating an SQL execution plan; the SQL execution plan; obtain the second incremental log generated by the execution of the SQL execution plan by the slave node, perform hash calculation on the data of the second incremental log, and obtain a second hash value; send the second incremental log Two hash values are sent to the master node, so that the master node determines the synchronization result according to the first hash value and the second hash value, wherein the first hash value performs all the operations on the master node.
  • the data of the incremental log generated by the SQL execution plan is obtained by hash calculation.
  • an embodiment of the present application provides an electronic device, including: a memory for storing a program; a processor for executing the program stored in the memory, when the processor executes the program stored in the memory , the processor is configured to execute any one of the data synchronization processing methods described above.
  • an embodiment of the present application provides a storage medium storing computer-executable instructions, where the computer-executable instructions are used to execute any of the data synchronization processing methods described above.
  • FIG. 1 is a flowchart of a data synchronization processing method applied to a master node provided by an embodiment of the present application
  • 2a is a flowchart of another data synchronization processing method applied to a master node provided by an embodiment of the present application
  • 2b is a flowchart of another data synchronization processing method applied to a master node provided by an embodiment of the present application
  • FIG. 3 is a flowchart of another data synchronization processing method applied to a master node provided by an embodiment of the present application
  • FIG. 4 is a flowchart of another data synchronization processing method applied to a master node provided by an embodiment of the present application
  • FIG. 5 is a flowchart of a data synchronization processing method applied to a slave node provided by an embodiment of the present application
  • FIG. 6 is a flowchart of another data synchronization processing method applied to a slave node provided by an embodiment of the present application
  • FIG. 7 is a flowchart of another data synchronization processing method applied to a slave node provided by an embodiment of the present application.
  • FIG. 8 is a flowchart of another data synchronization processing method applied to a slave node provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of an application scenario of a data synchronization processing method provided by an embodiment of the present application.
  • FIG. 10 is an exemplary flowchart of a data synchronization processing method provided by an embodiment of the present application applied to the scenario shown in FIG. 9;
  • FIG. 11 is an exemplary flowchart of another data synchronization processing method provided by an embodiment of the present application applied to the scenario shown in FIG. 9;
  • FIG. 12 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • multiple means more than two, greater than, less than, exceeding, etc. are understood as not including this number, above, below, within, etc. are understood as including this number. If there is a description of "first”, “second”, etc., it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance, or implicitly indicating the number of indicated technical features or implicitly indicating the indicated The sequence of technical characteristics.
  • the existing data synchronization schemes of distributed databases mainly include asynchronous replication, full synchronous replication and semi-synchronous replication.
  • the asynchronous replication scheme is that the master node returns the execution result to the client immediately after executing the transaction submitted by the client, and does not care about the data gap between the slave node and the master node and the degree of data playback, so that the master node and the slave node are prone to appear. Data inconsistency between nodes. If the master node crashes, the transactions submitted by the master node may not be transmitted to the slave node. If the slave node is forcibly promoted to the master node at this time, the data on the new master node may be incomplete.
  • the full synchronous replication scheme means that after the master node completes the execution of the transaction submitted by the client, it sends the incremental log generated by executing the transaction to each slave node, and the slave node parses and replays the received incremental operation log and then submits the transaction. Wait until all slave nodes have executed the transaction commit before returning the execution result to the client. Because it is necessary to wait for all slave nodes to complete the execution of the transaction before returning the execution result to the client, the system performance of full synchronous replication will inevitably be seriously affected.
  • the semi-synchronous replication scheme is between asynchronous replication and full synchronous replication. After the master node completes the execution of the transaction submitted by the client, it sends the incremental log generated by the execution of the transaction to each node, and waits for at least one node to receive the incremental log and copy it. After the incremental log is successfully written to the relay log, the result is returned to the client.
  • the semi-synchronous replication scheme takes into account both efficiency and data consistency, there is still a data delay of at least one incremental log synchronization disk placement cycle.
  • the embodiments of the present application provide a data synchronization processing method, an electronic device, and a storage medium, which can ensure the consistency of data synchronization and improve the efficiency of data synchronization.
  • FIG. 1 shows a flowchart of a data synchronization processing method provided by an embodiment of the present application.
  • the data synchronization processing method is applied to the master node of the distributed database system, and the method includes but is not limited to the following steps S100 to S150 at least.
  • Step S100 the master node receives a structured query language (Structured Query Language, SQL for short) statement sent by the client.
  • a structured query language Structured Query Language, SQL for short
  • the SQL statement sent by the client in the embodiment of the present application is a statement used to describe the transaction submitted by the client.
  • Step S110a the master node parses the SQL statement and generates an SQL execution plan.
  • Step S110b sending the SQL execution plan to at least one slave node.
  • the master node after receiving the SQL statement sent by the client, the master node parses the SQL statement and generates an SQL execution plan. Then, the SQL execution plan sent by the client is synchronized to one or more slave nodes, so that each slave node executes the SQL execution plan.
  • Step S120 the master node executes the SQL execution plan.
  • each slave node is also executing the SQL execution plan forwarded by the master node, so as to achieve the purpose of executing the SQL execution plan in parallel by the master node and the slave nodes.
  • Step S130 the master node acquires the first incremental log generated by the master node executing the SQL execution plan, and performs hash calculation on the data of the first incremental log to obtain a first hash value.
  • corresponding transaction log information is generated to record relevant operation information when the master node executes the SQL execution plan.
  • the above transaction log information is usually written into the operation log of the master node, which is usually stored in the database storage engine of the master node.
  • the newly added log content in the operation log of the master node is the above-mentioned first incremental log.
  • a hash algorithm is used to calculate and process the data of the first incremental log to obtain a first hash value.
  • Step S140 the master node receives the second hash value sent by each slave node, where the second hash value is obtained by hashing the data of the second incremental log generated by the slave node executing the SQL execution plan.
  • the slave node executes the SQL execution plan.
  • the corresponding transaction log information is also generated and written into the operation log of the slave node.
  • the slave node obtains the second incremental log from its own operation log, and uses a hash algorithm to calculate and process the data of the second incremental log to obtain a second hash value.
  • each slave node sends the second hash value calculated by the slave node to the master node, so that the master node performs subsequent processing on the first hash value and the second hash value.
  • Step S150 the master node determines the synchronization result according to the first hash value and the second hash value.
  • the master node performs a hash comparison between the first hash value and the second hash value received from each slave node, and if the comparison result is that the first hash value is equal to each second hash value, it indicates that The data after the master node and each slave node execute the SQL execution plan are consistent, that is, the data of the master node and each slave node are successfully synchronized; if the comparison result is that there are one or more second hash values that are inconsistent with the first hash value If they are equal, it indicates that the data after one or more slave nodes execute the SQL execution plan is inconsistent with the data after the master node executes the SQL execution plan, that is, the data synchronization of the one or more slave nodes fails.
  • Step S160 sending operation result information to the client according to the synchronization result.
  • the operation result may be determined according to the number of slave nodes whose data synchronization is successful. For example, in one example, as long as the number of successfully synchronized slave nodes meets a preset threshold, it is considered that the transaction submitted by the client is executed successfully, and operation success information is returned to the client. For example, in another example, when the data synchronization of any node fails, it is considered that execution of the transaction submitted by the client fails, and operation failure information is returned to the client. It should be understood that those skilled in the art can customize specific conditions for determining a successful operation according to a synchronization result according to requirements, which are not specifically limited in this embodiment of the present application.
  • steps S111a and S112a are further included after step S110b.
  • Step S111a the master node starts a timer, and when the timer does not expire, receives the first reply information sent by the slave node, wherein the first reply information indicates that the slave node successfully or failed to receive the SQL execution plan;
  • Step S112a the master node determines whether the number of slave nodes that successfully receive the SQL execution plan meets the first preset threshold according to the received first reply information.
  • the timer is started to start the timing.
  • the timer expires and there are slave nodes that have not sent the first reply information, it can be determined that the slave node that has not sent the first reply information
  • the slave node fails to receive the SQL execution plan, so it can be determined that the slave node that has not sent the first reply information fails to perform data synchronization.
  • the timer is used for timing, so as to avoid the increase of data delay caused by waiting for the reply information for too long.
  • the master node performs the subsequent step S120 only when the number of slave nodes that successfully receive the SQL execution plan meets the first preset threshold.
  • the number of slave nodes that successfully receive the SQL execution plan can be determined according to the first reply information sent by each slave node and the number of slave nodes that have not sent the first reply information when the timer expires.
  • the master node sends the SQL execution plan to the 4 slave nodes respectively, and then starts the timer.
  • the timer expires, only 3 first reply messages are received from the slave nodes, and all the received first reply messages indicate that the corresponding slave node successfully received the SQL execution plan, indicating that one node failed to receive the SQL execution plan.
  • the first preset threshold is 2 and the number of slave nodes that currently successfully receive the SQL execution plan is required to be greater than or equal to the first preset threshold, that is, the number of slave nodes that currently successfully receive the SQL execution plan meets the first preset threshold, and the master node continues Step S120 is performed.
  • the first preset threshold may also be set to be equal to the number of slave nodes, that is, all current slave nodes are required to successfully receive the SQL execution plan before the subsequent step S120 is allowed to be executed.
  • step S120 it further includes:
  • Step S121 the master node receives the second reply information sent by the slave node, and determines the number of slave nodes that successfully execute the SQL execution plan according to the received second reply information, wherein the second reply information indicates that the slave node successfully executed the SQL execution plan or Fail;
  • Step S122 the master node determines whether the master node successfully executes the SQL execution plan and the number of nodes that successfully execute the SQL execution plan meets the second preset threshold.
  • the one or more nodes that fail to execute the SQL execution plan send second reply information to the master node.
  • the master node determines the number of nodes that successfully execute the SQL execution plan according to the number of received second reply information.
  • the subsequent step S130 is allowed to be executed. If the master node fails to execute the SQL execution plan or the number of slave nodes that successfully execute the SQL execution plan does not meet the second preset threshold, the execution of the subsequent steps is terminated, and the operation failure information is directly sent to the client.
  • the master node sends SQL execution plans to 4 nodes respectively, and the 4 slave nodes all receive the SQL execution plans successfully.
  • the master node and each slave node execute the SQL execution plan in parallel, there is one slave node that fails to execute the SQL execution plan and feeds back the second reply information indicating the failure to execute the SQL execution plan to the master node.
  • the second preset threshold is 2 and the number of slave nodes that currently successfully execute the SQL execution plan is required to be greater than or equal to the second preset threshold, that is, the number of slave nodes that currently successfully execute the SQL execution plan meets the second preset threshold, so the master node allows The subsequent step S130 is performed.
  • the second preset threshold may also be set to be equal to the number of slave nodes, that is, the subsequent step S130 is allowed to be executed only after all current slave nodes are required to successfully execute the SQL execution plan.
  • step S110a can be replaced with step S110c, the master node sends the SQL statement to at least one slave node;
  • step S110b can be replaced with step S110d, the master node parses the SQL statement and Generate SQL execution plan.
  • the master node directly sends the received SQL statement from the client to the slave node.
  • the slave node After receiving the SQL statement sent by the master node, the slave node parses the SQL statement and generates an SQL execution plan; then the slave node executes the SQL execution plan.
  • step S110c and step S110d may be interchanged.
  • step S110c it may further include: step S111b, the master node starts a timer, and if the timer does not time out, receives the first reply information sent by the slave node, wherein the first reply information indicates the slave node.
  • the node receives the SQL statement successfully or failed.
  • Step S111b includes step S112b, in which the master node determines, according to the received first reply information, whether the number of slave nodes that successfully receive the SQL statement meets a first preset threshold.
  • the timer is started to start the timing, and when the timer expires and there are slave nodes that have not sent the first reply information, it can be determined that the slave nodes that have not sent the first reply information If the node fails to receive the SQL statement, it may be determined that the slave node that has not sent the first reply information fails to perform data synchronization.
  • the timer is used for timing, so as to avoid the increase of data delay caused by waiting for the reply information for too long.
  • the master node performs the subsequent steps only when the number of slave nodes that successfully receive the SQL statement meets the first preset threshold.
  • the number of slave nodes that successfully receive the SQL statement can be determined according to the first reply information sent by each slave node and the number of slave nodes that have not sent the first reply information when the timer expires.
  • FIG. 5 shows a flowchart of a data synchronization processing method provided by an embodiment of the present application.
  • the data synchronization processing method is applied to a node of a distributed database system, and the method at least includes but is not limited to the following steps S200a to S230.
  • Step S200a the slave node receives the SQL execution plan sent by the master node.
  • the master node synchronizes the SQL execution plan sent by the client to the slave node.
  • Step S210 the slave node executes the SQL execution plan.
  • the slave node can parse and execute the SQL execution plan, implement the SQL execution plan in parallel with the master node, and replicate the data of the master node to the slave node synchronously.
  • Step S220 Obtain the second incremental log generated by the node executing the SQL execution plan from the node, perform hash calculation on the data of the second incremental log, and obtain a second hash value.
  • corresponding transaction log information is generated to record relevant operation information when the slave node executes the SQL execution plan.
  • the above transaction log information is usually written into the operation log of the slave node, and usually, the operation log is stored in the database storage engine of the slave node. After the transaction log information is written into the operation log of the slave node, the newly added log content in the operation log of the slave node is the above-mentioned second incremental log.
  • a hash algorithm is used to calculate and process the data of the second incremental log of the slave node to obtain a second hash value.
  • Step S230 the slave node sends the second hash value to the master node, so that the master node determines the synchronization result according to the first hash value and the second hash value.
  • the first hash value is obtained by performing hash calculation on the data of the first incremental log generated by the master node executing the SQL execution plan by itself in step S130.
  • the slave node sends the second hash value to the master node, and after receiving the second hash value from the slave node, the master node compares the first hash value with the second hash value. Perform a hash comparison. If the comparison result is that the first hash value is equal to the second hash value, it indicates that the data after the master node and the slave node execute the SQL execution plan are consistent, that is, the data of the master node and the slave node are synchronized.
  • step S200a it further includes: step S201a, sending first reply information to the master node, wherein the first reply information indicates that the slave node succeeds or fails to receive the SQL execution plan.
  • the slave node After the slave node finishes receiving the SQL execution plan sent by the master node, it sends the first reply message to the master node, so that the master node determines whether the slave node accepts the SQL execution plan successfully, and then judges whether to execute the subsequent steps.
  • step S210 the method further includes: step S211 , sending second reply information to the master node, wherein the second reply information indicates that the slave node succeeds or fails to execute the SQL execution plan.
  • the slave node After the slave node finishes executing the SQL execution plan, it sends the second reply information to the master node, so that the master node determines whether the slave node successfully executes the SQL execution plan, and then determines whether to execute the subsequent steps.
  • step S200a can be replaced with the following steps S200b and S200c:
  • the slave node receives the SQL statement sent by the master node
  • the master node directly forwards the SQL statement sent by the client to the slave node. After the slave node receives the SQL statement sent by the master node, the SQL statement needs to be parsed to generate an SQL execution plan, and then the subsequent step S210 is performed.
  • step S201b may be included between steps S200b and S200c, sending first reply information to the master node, wherein the first reply information indicates that the slave node succeeds or fails in receiving the SQL statement.
  • the distributed database system includes a client 10 , a master node 20 and a slave node 30 .
  • the data synchronization processing method provided by the embodiment of the present application may specifically include the exemplary steps S300 to S309 shown in FIG. 10 .
  • Step S300 the master node 20 receives the SQL statement sent by the client 10.
  • Step S301 the master node 20 parses the SQL statement and generates an SQL execution plan. It should be understood that the master node 20 executes the subsequent step S302 only when the parsing of the SQL statement is successful; otherwise, the operation failure information is sent to the client 10 .
  • Step S302 the master node 20 sends the SQ execution plan to the slave node 30.
  • Step S303 after the slave node 30 successfully receives the SQL execution plan sent by the master node 20 , it sends first reply information to the master node 20 to indicate that it has successfully received the SQL execution plan.
  • Step S304a the master node 20 executes the SQL execution plan
  • Step S304b execute the SQL execution plan from the node 30;
  • Step S305 the slave node 30 sends the second reply information to the master node 20 to indicate that it has successfully executed the SQL execution plan.
  • Step S306a the master node 20 obtains the first incremental log generated by its own execution of the SQL execution plan, performs hash calculation on the data of the first incremental log, and obtains the first hash value;
  • Step S306b obtaining the second incremental log generated by executing the SQL execution plan by itself from the node 30, and performing hash calculation on the data of the second incremental log to obtain a second hash value;
  • Step S307 the slave node 30 sends the second hash value to the master node 20 .
  • Step S308 the master node 20 compares the first hash value with the second hash value, and determines a synchronization result according to the comparison result.
  • Step S309 the master node 20 sends the operation result information to the client 10 according to the synchronization result. Specifically, if the synchronization result is that the synchronization is successful, the operation success information is sent to the client 10 , otherwise, the operation failure information is sent to the client 10 .
  • steps S304a and S304b are steps that can be executed in parallel; steps S306a and S306b are steps that can be executed in parallel.
  • the data synchronization processing method provided by the embodiment of the present application may further include the exemplary steps S400 to S410 shown in FIG. 11 .
  • Step S400 the master node 20 receives the SQL statement sent by the client 10.
  • Step S401 the master node 20 forwards the SQL statement to the slave node 30 .
  • Step S402 after the slave node 30 successfully receives the SQL statement sent by the master node 20 , it sends the first reply message to the master node 20 to indicate that it has successfully received the SQL statement.
  • Step S403a the master node 20 parses the SQL statement and generates an SQL execution plan.
  • Step S403b the slave node 30 parses the SQL statement and generates an SQL execution plan.
  • Step S404a the master node 20 executes the SQL execution plan
  • Step S404b execute the SQL execution plan from the node 30;
  • Step S405 the slave node 30 sends the second reply message to the master node 20 to indicate that it has successfully executed the SQL execution plan.
  • Step S406a the master node 20 obtains the first incremental log generated by its own execution of the SQL execution plan, performs hash calculation on the data of the first incremental log, and obtains the first hash value;
  • Step S406b obtaining the second incremental log generated by executing the SQL execution plan by itself from the node 30, and performing hash calculation on the data of the second incremental log to obtain a second hash value;
  • Step S407 the slave node 30 sends the second hash value to the master node 20 .
  • Step S408 the master node 20 compares the first hash value with the second hash value, and determines a synchronization result according to the comparison result.
  • Step S409 the master node 20 sends the operation result information to the client 10 according to the synchronization result. Specifically, if the synchronization result is that the synchronization is successful, the operation success information is sent to the client 10 , otherwise, the operation failure information is sent to the client 10 .
  • the master node In the traditional data synchronization scheme, after the master node completes the execution of the SQL execution plan, the corresponding incremental log is sent to the node for analysis and playback, which is equivalent to a serial data replication method.
  • the master node and the node execute the SQL execution plan synchronously, which is equivalent to parallel data replication between the master node and the node.
  • the solution of the embodiment of the present application can greatly improve the database performance.
  • the efficiency of synchronous processing reduces the delay of data, improves the performance of the distributed database system, reduces the processing time for the client to submit transactions, and further improves the user experience.
  • the embodiment of the present application compares the incremental logs of the master node and the node through the Habi algorithm, and determines the synchronization result according to the comparison result, which can ensure the consistency of data synchronization.
  • FIG. 12 shows an electronic device 40 provided by an embodiment of the present application. As shown in Figure 12, the electronic device 40 includes but is not limited to:
  • memory 42 for storing programs
  • the processor 41 is configured to execute the program stored in the memory 42.
  • the processor 41 executes the program stored in the memory 42, the processor 41 is configured to execute the data synchronization processing method of any of the foregoing embodiments.
  • the processor 41 and the memory 42 may be connected by a bus or other means.
  • the memory 42 can be used to store non-transitory software programs and non-transitory computer-executable programs, such as any data synchronization processing method described in the embodiments of this application.
  • the processor 41 implements the data synchronization processing method in any of the foregoing embodiments by running the non-transitory software programs and instructions stored in the memory 42 .
  • the memory 42 may include a storage program area and a storage data area, wherein the storage program area may store an operating system and an application program required by at least one function; the storage data area may store and execute the above-mentioned data synchronization processing method. Additionally, memory 42 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 42 may include memory located remotely from processor 41, which may be connected to processor 41 via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
  • the non-transitory software programs and instructions required to implement the above-mentioned data synchronization processing method are stored in the memory 42 , and when executed by one or more processors 41 , execute the data synchronization processing method of any of the above-mentioned embodiments.
  • Embodiments of the present application further provide a storage medium storing computer-executable instructions, where the computer-executable instructions are used to execute the data synchronization processing method of any of the foregoing embodiments.
  • the storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more control processors 41.
  • One or more processors 41 execute the data synchronization processing method of any of the above embodiments.
  • the embodiments of the present application include: the master node receives the structured query language SQL statement sent by the client; the master node parses the SQL statement and generates an SQL execution plan, and then sends the SQL execution plan to at least one slave node, or directly Send the SQL statement to at least one slave node; the master node executes the SQL execution plan; the master node obtains the first incremental log generated by the master node executing the SQL execution plan, and the first incremental log is Hash the data to obtain the first hash value; the master node receives the second hash value sent by each of the slave nodes, wherein the second hash value is the execution of the SQL on the slave node.
  • the data of the second incremental log generated by the execution plan is obtained by hash calculation; the master node determines the synchronization result according to the first hash value and the second hash value.
  • the master node and the slave node execute the SQL execution plan at the same time, which realizes the parallel synchronous replication of the master node and the slave node, greatly improves the efficiency of database synchronization processing, and reduces the delay of data;
  • the incremental log of the master node and the node is compared through the Habi algorithm, and the synchronization result is determined according to the comparison result, which can ensure the consistency of data synchronization.
  • Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices, or may Any other medium used to store desired information and which can be accessed by a computer.
  • communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and can include any information delivery media, as is well known to those of ordinary skill in the art .

Landscapes

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

Abstract

Provided are a data synchronization processing method, an electronic device, and a storage medium. The method comprises: receiving, by a master node, an SQL statement sent by a client (S100); generating an SQL execution plan (S110a); sending the SQL execution plan to slave nodes (S110b); executing the SQL execution plan (S120); obtaining a first incremental log of the master node, and performing Hash calculation on data of the first incremental log to obtain a first Hash value (S130); receiving a second Hash value sent by each slave node (S140); and determining a synchronization result according to the first Hash value and the second Hash value (S150).

Description

数据同步处理方法、电子设备以及存储介质Data synchronization processing method, electronic device and storage medium
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请基于申请号为202010609672.8、申请日为2020年06月29日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。This application is based on the Chinese patent application with the application number of 202010609672.8 and the filing date of June 29, 2020, and claims the priority of the Chinese patent application. The entire content of the Chinese patent application is incorporated herein by reference.
技术领域technical field
本申请涉及分布式数据库技术领域,特别是涉及一种数据同步处理方法、电子设备以及存储介质。The present application relates to the technical field of distributed databases, and in particular, to a data synchronization processing method, an electronic device and a storage medium.
背景技术Background technique
现有的分布式数据库的数据同步方案主要有异步复制、全同步复制和半同步复制三种。其中,异步复制方案对数据库的执行效率影响最小,但容易出现主节点和从节点之间数据不一致的情况;全同步复制方案虽然能保证主节点和从节点之间数据同步的一致性,但是对分布式数据库系统的性能影响很大,效率较低,不适用于高并发应用场景;半同步复制方案虽然兼顾了效率和数据一致性,但仍然存在至少一个增量日志同步落盘周期的数据延迟。The existing data synchronization schemes of distributed databases mainly include asynchronous replication, full synchronous replication and semi-synchronous replication. Among them, the asynchronous replication scheme has the least impact on the execution efficiency of the database, but it is prone to data inconsistency between the master node and the slave node; although the full synchronous replication scheme can ensure the consistency of data synchronization between the master node and the slave node, it has a The performance of the distributed database system has a great impact and the efficiency is low, and it is not suitable for high-concurrency application scenarios. Although the semi-synchronous replication scheme takes into account the efficiency and data consistency, there is still at least one incremental log synchronization disk placement cycle. Data delay .
发明内容SUMMARY OF THE INVENTION
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this article. This summary is not intended to limit the scope of protection of the claims.
本申请实施例提供了一种数据同步处理方法、电子设备以及存储介质。Embodiments of the present application provide a data synchronization processing method, an electronic device, and a storage medium.
一方面,本申请实施例提供了一种数据同步处理方法,应用于主节点,所述方法包括:接收客户端发送的结构化查询语言SQL语句;对所述SQL语句进行解析并生成SQL执行计划,并将所述SQL执行计划发送给至少一个从节点;执行所述SQL执行计划;获取所述主节点执行所述SQL执行计划时产生的第一增量日志,对所述第一增量日志的数据进行哈希计算,得到第一哈希值;接收每个所述从节点发送的第二哈希值,其中,所述第二哈希值是对所述从节点执行所述SQL执行计划时产生的第二增量日志的数据进行哈希计算得到;根据所述第一哈希值和所述第二哈希值确定同步结果;根据所述同步结果发送操作结果信息给所述客户端。On the one hand, an embodiment of the present application provides a data synchronization processing method, which is applied to a master node. The method includes: receiving a structured query language SQL statement sent by a client; parsing the SQL statement and generating an SQL execution plan , and send the SQL execution plan to at least one slave node; execute the SQL execution plan; obtain the first incremental log generated when the master node executes the SQL execution plan; Perform hash calculation on the data to obtain a first hash value; receive a second hash value sent by each of the slave nodes, wherein the second hash value is the execution plan for the slave node to execute the SQL The data of the second incremental log generated during the hash calculation is obtained; the synchronization result is determined according to the first hash value and the second hash value; the operation result information is sent to the client according to the synchronization result .
另一方面,本申请实施例提供了一种数据同步处理方法,应用于主节点,所述方法包括:接收客户端发送的结构化查询语言SQL语句;将所述SQL语句发送给至少一个从节点;On the other hand, an embodiment of the present application provides a data synchronization processing method, which is applied to a master node. The method includes: receiving a structured query language SQL statement sent by a client; sending the SQL statement to at least one slave node ;
对所述SQL语句进行解析并生成SQL执行计划;执行所述SQL执行计划;获取所述主节点执行所述SQL执行计划产生的第一增量日志,对所述第一增量日志的数据进行哈希计算,得到第一哈希值;接收每个所述从节点发送的第二哈希值,其中,所述第二哈希值是对所述从节点执行根据所述SQL语句生成的SQL执行计划产生的第二增量日志的数据进行哈希计算得到;根据所述第一哈希值和所述第二哈希值确定同步结果;根据所述同步结果发送操作结果信息给所述客户端。Parse the SQL statement and generate a SQL execution plan; execute the SQL execution plan; obtain the first incremental log generated by the master node executing the SQL execution plan, and perform the data analysis on the first incremental log. Hash calculation to obtain a first hash value; receiving a second hash value sent by each of the slave nodes, wherein the second hash value is to execute the SQL generated according to the SQL statement on the slave node The data of the second incremental log generated by the execution plan is obtained by hash calculation; the synchronization result is determined according to the first hash value and the second hash value; the operation result information is sent to the client according to the synchronization result end.
另一方面,本申请实施例提供了一种数据同步处理方法,应用于从节点,所述方法包括:接收主节点发送的SQL执行计划;执行所述SQL执行计划;获取所述从节点执行所述SQL执行计划产生的第二增量日志,对所述第二增量日志的数据进行哈希计算,得到第二哈希值;发送所述第二哈希值至所述主节点,以使所述主节点根据第一哈希值和所述第二哈希值确定同步结果,其中,所述第一哈希值对所述主节点执行所述SQL执行计划产生的 增量日志的数据进行哈希计算得到。On the other hand, an embodiment of the present application provides a data synchronization processing method, which is applied to a slave node. The method includes: receiving an SQL execution plan sent by a master node; executing the SQL execution plan; The second incremental log generated by the SQL execution plan, perform hash calculation on the data of the second incremental log to obtain a second hash value; send the second hash value to the master node, so that The master node determines the synchronization result according to the first hash value and the second hash value, wherein the first hash value performs data on the incremental log generated by the master node executing the SQL execution plan. Hash is calculated.
另一方面,本申请实施例提供了一种数据同步处理方法,应用于从节点,所述方法包括:接收主节点发送的SQL语句;对所述SQL语句进行解析并生成SQL执行计划;执行所述SQL执行计划;获取所述从节点执行所述SQL执行计划产生的第二增量日志,对所述第二增量日志的数据进行哈希计算,得到第二哈希值;发送所述第二哈希值至所述主节点,以使所述主节点根据第一哈希值和所述第二哈希值确定同步结果,其中,所述第一哈希值对所述主节点执行所述SQL执行计划产生的增量日志的数据进行哈希计算得到。On the other hand, an embodiment of the present application provides a data synchronization processing method, which is applied to a slave node. The method includes: receiving an SQL statement sent by a master node; parsing the SQL statement and generating an SQL execution plan; the SQL execution plan; obtain the second incremental log generated by the execution of the SQL execution plan by the slave node, perform hash calculation on the data of the second incremental log, and obtain a second hash value; send the second incremental log Two hash values are sent to the master node, so that the master node determines the synchronization result according to the first hash value and the second hash value, wherein the first hash value performs all the operations on the master node. The data of the incremental log generated by the SQL execution plan is obtained by hash calculation.
另一方面,本申请实施例提供了一种电子设备,包括:存储器,用于存储程序;处理器,用于执行所述存储器存储的程序,当所述处理器执行所述存储器存储的程序时,所述处理器用于执行如上所述的任一项数据同步处理方法。On the other hand, an embodiment of the present application provides an electronic device, including: a memory for storing a program; a processor for executing the program stored in the memory, when the processor executes the program stored in the memory , the processor is configured to execute any one of the data synchronization processing methods described above.
再一方面,本申请实施例提供了一种存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行如上所述的任一项数据同步处理方法。In another aspect, an embodiment of the present application provides a storage medium storing computer-executable instructions, where the computer-executable instructions are used to execute any of the data synchronization processing methods described above.
本申请的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本申请而了解。本申请的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。Other features and advantages of the present application will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the description, claims and drawings.
附图说明Description of drawings
附图用来提供对本申请技术方案的进一步理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本申请的技术方案,并不构成对本申请技术方案的限制。The accompanying drawings are used to provide a further understanding of the technical solutions of the present application, and constitute a part of the specification. They are used to explain the technical solutions of the present application together with the embodiments of the present application, and do not constitute a limitation on the technical solutions of the present application.
图1是本申请实施例提供的一种应用于主节点的数据同步处理方法的流程图;1 is a flowchart of a data synchronization processing method applied to a master node provided by an embodiment of the present application;
图2a是本申请实施例提供的另一种应用于主节点的数据同步处理方法的流程图;2a is a flowchart of another data synchronization processing method applied to a master node provided by an embodiment of the present application;
图2b是本申请实施例提供的另一种应用于主节点的数据同步处理方法的流程图;2b is a flowchart of another data synchronization processing method applied to a master node provided by an embodiment of the present application;
图3是本申请实施例提供的另一种应用于主节点的数据同步处理方法的流程图;3 is a flowchart of another data synchronization processing method applied to a master node provided by an embodiment of the present application;
图4是本申请实施例提供的另一种应用于主节点的数据同步处理方法的流程图;4 is a flowchart of another data synchronization processing method applied to a master node provided by an embodiment of the present application;
图5是本申请实施例提供的一种应用于从节点的数据同步处理方法的流程图;5 is a flowchart of a data synchronization processing method applied to a slave node provided by an embodiment of the present application;
图6是本申请实施例提供的另一种应用于从节点的数据同步处理方法的流程图;6 is a flowchart of another data synchronization processing method applied to a slave node provided by an embodiment of the present application;
图7是本申请实施例提供的另一种应用于从节点的数据同步处理方法的流程图;7 is a flowchart of another data synchronization processing method applied to a slave node provided by an embodiment of the present application;
图8是本申请实施例提供的另一种应用于从节点的数据同步处理方法的流程图;8 is a flowchart of another data synchronization processing method applied to a slave node provided by an embodiment of the present application;
图9是本申请实施例提供的一种数据同步处理方法的应用场景示意图;9 is a schematic diagram of an application scenario of a data synchronization processing method provided by an embodiment of the present application;
图10是本申请实施例提供的一种数据同步处理方法应用于图9所示场景的示例性流程图;FIG. 10 is an exemplary flowchart of a data synchronization processing method provided by an embodiment of the present application applied to the scenario shown in FIG. 9;
图11是本申请实施例提供的另一种数据同步处理方法应用于图9所示场景的示例性流程图;FIG. 11 is an exemplary flowchart of another data synchronization processing method provided by an embodiment of the present application applied to the scenario shown in FIG. 9;
图12是本申请实施例提供的一种电子设备的结构示意图。FIG. 12 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式detailed description
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.
应了解,在本申请实施例的描述中,多个(或多项)的含义是两个以上,大于、小于、超过等理解为不包括本数,以上、以下、以内等理解为包括本数。如果有描述到“第一”、“第二”等只是用于区分技术特征为目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量或者隐含指明所指示的技术特征的先后关系。It should be understood that in the description of the embodiments of the present application, multiple (or multiple) means more than two, greater than, less than, exceeding, etc. are understood as not including this number, above, below, within, etc. are understood as including this number. If there is a description of "first", "second", etc., it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance, or implicitly indicating the number of indicated technical features or implicitly indicating the indicated The sequence of technical characteristics.
在本申请实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请实施例中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,在本申请的描述中,除非另有说明,“/”表示前后关联的对象是一种“或”的关系,例如,A/B可以表示A或B;本申请中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,其中A,B可以是单数或者复数。The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. As used in the embodiments of this application, the singular forms "a," "the," and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise. It should also be understood that, in the description of this application, unless otherwise specified, "/" indicates that the associated objects are in an "or" relationship, for example, A/B can indicate A or B; in this application, "and" "/or" is just an association relationship that describes an associated object, which means that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, A and B exist at the same time, and B exists alone. where A and B can be singular or plural.
现有的分布式数据库的数据同步方案主要有异步复制、全同步复制和半同步复制三种。The existing data synchronization schemes of distributed databases mainly include asynchronous replication, full synchronous replication and semi-synchronous replication.
异步复制方案是主节点在完成执行客户端提交的事务后立刻返回执行结果给客户端,并不关心从节点与主节点之间的数据差距以及数据回放的程度,这样就容易出现主节点和从节点之间数据不一致的情况。若主节点发生崩溃,此时主节点已经提交的事务可能并没有传到从节点上,如果此时,强行将从节点提升为主节点,可能导致新主节点上的数据不完整。The asynchronous replication scheme is that the master node returns the execution result to the client immediately after executing the transaction submitted by the client, and does not care about the data gap between the slave node and the master node and the degree of data playback, so that the master node and the slave node are prone to appear. Data inconsistency between nodes. If the master node crashes, the transactions submitted by the master node may not be transmitted to the slave node. If the slave node is forcibly promoted to the master node at this time, the data on the new master node may be incomplete.
全同步复制方案指主节点在完成执行客户端提交的事务后,向各个从节点发送执行事务产生的增量日志,从节点对接收到的增量操作日志进行解析回放后提交该事务,主节点等待所有的从节点都执行了该事务提交后才返回执行结果给客户端。因为需要等待所有从节点执行完该事务才能返回执行结果给客户端,所以全同步复制的系统性能必然会收到严重的影响。The full synchronous replication scheme means that after the master node completes the execution of the transaction submitted by the client, it sends the incremental log generated by executing the transaction to each slave node, and the slave node parses and replays the received incremental operation log and then submits the transaction. Wait until all slave nodes have executed the transaction commit before returning the execution result to the client. Because it is necessary to wait for all slave nodes to complete the execution of the transaction before returning the execution result to the client, the system performance of full synchronous replication will inevitably be seriously affected.
半同步复制方案介于异步复制和全同步复制之间,主节点在完成执行客户端提交的事务后,向各个节点发送执行事务产生的增量日志,等待至少一个节点接收到增量日志并且将增量日志成功写入中继日志后,即返回结果给客户端。半同步复制方案虽然兼顾了效率和数据一致性,但仍然存在至少一个增量日志同步落盘周期的数据延迟。The semi-synchronous replication scheme is between asynchronous replication and full synchronous replication. After the master node completes the execution of the transaction submitted by the client, it sends the incremental log generated by the execution of the transaction to each node, and waits for at least one node to receive the incremental log and copy it. After the incremental log is successfully written to the relay log, the result is returned to the client. Although the semi-synchronous replication scheme takes into account both efficiency and data consistency, there is still a data delay of at least one incremental log synchronization disk placement cycle.
为此,本申请实施例提供了一种数据同步处理方法、电子设备以及存储介质,能够确保数据同步的一致性和提升数据同步效率。To this end, the embodiments of the present application provide a data synchronization processing method, an electronic device, and a storage medium, which can ensure the consistency of data synchronization and improve the efficiency of data synchronization.
图1示出了本申请实施例提供的一种数据同步处理方法的流程图。如图1所示,该数据同步处理方法应用于分布式数据库系统的主节点,该方法至少包括但不限于如下的步骤S100至S150。FIG. 1 shows a flowchart of a data synchronization processing method provided by an embodiment of the present application. As shown in FIG. 1 , the data synchronization processing method is applied to the master node of the distributed database system, and the method includes but is not limited to the following steps S100 to S150 at least.
步骤S100,主节点接收客户端发送的结构化查询语言(Structured Query Language,简称SQL)语句。Step S100, the master node receives a structured query language (Structured Query Language, SQL for short) statement sent by the client.
应理解,本申请实施例中客户端发送的SQL语句为用于描述客户端提交的事务的语句。It should be understood that the SQL statement sent by the client in the embodiment of the present application is a statement used to describe the transaction submitted by the client.
步骤S110a,主节点对SQL语句进行解析并生成SQL执行计划。Step S110a, the master node parses the SQL statement and generates an SQL execution plan.
步骤S110b,将SQL执行计划发送给至少一个从节点。Step S110b, sending the SQL execution plan to at least one slave node.
本申请实施例中,主节点在接收到客户端发送的SQL语句后,对SQL语句进行语句解析,并生成SQL执行计划。然后将将客户端发送的SQL执行计划同步至一个或者多个从节点,以使各个从节点执行该SQL执行计划。In this embodiment of the present application, after receiving the SQL statement sent by the client, the master node parses the SQL statement and generates an SQL execution plan. Then, the SQL execution plan sent by the client is synchronized to one or more slave nodes, so that each slave node executes the SQL execution plan.
步骤S120,主节点执行SQL执行计划。Step S120, the master node executes the SQL execution plan.
应理解,在具体实现时,主节点在执行SQL执行计划的同时,各个从节点也在执行主节点转发的SQL执行计划,以达到主节点和从节点并行执行SQL执行计划的目的。It should be understood that, in specific implementation, while the master node executes the SQL execution plan, each slave node is also executing the SQL execution plan forwarded by the master node, so as to achieve the purpose of executing the SQL execution plan in parallel by the master node and the slave nodes.
步骤S130,主节点获取主节点执行SQL执行计划产生的第一增量日志,对第一增量日志的数据进行哈希计算,得到第一哈希值。Step S130, the master node acquires the first incremental log generated by the master node executing the SQL execution plan, and performs hash calculation on the data of the first incremental log to obtain a first hash value.
示例性的,主节点在执行SQL执行计划时,会产生相应的事务日志信息,用以记录主节点执行SQL执行计划时的相关操作信息。上述的事务日志信息通常会写入主节点的操作 日志中,通常情况下,该操作日志存储在主节点的数据库存储引擎中。事务日志信息写入主节点的操作日志后,主节点操作日志中新增加的日志内容即为上述的第一增量日志。本申请实施例采用哈希算法对该第一增量日志的数据进行计算处理,得到第一哈希值。Exemplarily, when the master node executes the SQL execution plan, corresponding transaction log information is generated to record relevant operation information when the master node executes the SQL execution plan. The above transaction log information is usually written into the operation log of the master node, which is usually stored in the database storage engine of the master node. After the transaction log information is written into the operation log of the master node, the newly added log content in the operation log of the master node is the above-mentioned first incremental log. In this embodiment of the present application, a hash algorithm is used to calculate and process the data of the first incremental log to obtain a first hash value.
步骤S140,主节点接收每个从节点发送的第二哈希值,其中,第二哈希值是对从节点执行SQL执行计划产生的第二增量日志的数据进行哈希计算得到。Step S140, the master node receives the second hash value sent by each slave node, where the second hash value is obtained by hashing the data of the second incremental log generated by the slave node executing the SQL execution plan.
示例性的,从节点接收到主节点同步发送的SQL执行计划后,执行该SQL执行计划。从节点在执行SQL执行计划时,也会产生相应的事务日志信息,并写入从节点的操作日志中。从节点从自身的操作日志中获取第二增量日志,并采用哈希算法对第二增量日志的数据进行计算处理,得到第二哈希值。本申请实施例中,各个从节点分别将各自计算得到的第二哈希值发给主节点,以使主节点对第一哈希值和第二哈希值进行后续的处理。Exemplarily, after receiving the SQL execution plan synchronously sent by the master node, the slave node executes the SQL execution plan. When the slave node executes the SQL execution plan, the corresponding transaction log information is also generated and written into the operation log of the slave node. The slave node obtains the second incremental log from its own operation log, and uses a hash algorithm to calculate and process the data of the second incremental log to obtain a second hash value. In this embodiment of the present application, each slave node sends the second hash value calculated by the slave node to the master node, so that the master node performs subsequent processing on the first hash value and the second hash value.
步骤S150,主节点根据第一哈希值和第二哈希值确定同步结果。Step S150, the master node determines the synchronization result according to the first hash value and the second hash value.
示例性的,主节点将第一哈希值与接收到的来自各个从节点的第二哈希值进行哈希对比,若对比结果为第一哈希值与各个第二哈希值相等,表明主节点与各个从节点执行SQL执行计划后的数据是一致的,即主节点与各个从节点的数据同步成功;若对比结果为存在一个或多个第二哈希值与第一哈希值不相等,表明存在一个或多个从节点执行SQL执行计划后的数据与主节点执行SQL执行计划后的数据不一致,也就是说这一个或多个从节点的数据同步失败。Exemplarily, the master node performs a hash comparison between the first hash value and the second hash value received from each slave node, and if the comparison result is that the first hash value is equal to each second hash value, it indicates that The data after the master node and each slave node execute the SQL execution plan are consistent, that is, the data of the master node and each slave node are successfully synchronized; if the comparison result is that there are one or more second hash values that are inconsistent with the first hash value If they are equal, it indicates that the data after one or more slave nodes execute the SQL execution plan is inconsistent with the data after the master node executes the SQL execution plan, that is, the data synchronization of the one or more slave nodes fails.
步骤S160,根据同步结果发送操作结果信息给客户端。Step S160, sending operation result information to the client according to the synchronization result.
在具体实现时,可以根据数据同步成功的从节点数量确定操作结果。例如在一个示例中,只要同步成功的从节点的数量满足预设的阈值,则认为执行客户端提交的事务成功,返回操作成功信息给客户端。例如在另一个示例中,当有任一个节点的数据同步失败,即认为执行客户端提交的事务失败,返回操作失败信息给客户端。应理解,本领域的技术人员可以根据需求定制具体的根据同步结果确定操作成功的条件,本申请实施例对此不作具体限定。During specific implementation, the operation result may be determined according to the number of slave nodes whose data synchronization is successful. For example, in one example, as long as the number of successfully synchronized slave nodes meets a preset threshold, it is considered that the transaction submitted by the client is executed successfully, and operation success information is returned to the client. For example, in another example, when the data synchronization of any node fails, it is considered that execution of the transaction submitted by the client fails, and operation failure information is returned to the client. It should be understood that those skilled in the art can customize specific conditions for determining a successful operation according to a synchronization result according to requirements, which are not specifically limited in this embodiment of the present application.
如图2a所示,在一些实施例中,在步骤S110b之后还包括如下的步骤S111a和S112a。As shown in FIG. 2a, in some embodiments, the following steps S111a and S112a are further included after step S110b.
步骤S111a,主节点启动计时器,并在计时器未超时的情况下,接收从节点发送的第一回复信息,其中,第一回复信息指示从节点接收SQL执行计划成功或者失败;Step S111a, the master node starts a timer, and when the timer does not expire, receives the first reply information sent by the slave node, wherein the first reply information indicates that the slave node successfully or failed to receive the SQL execution plan;
步骤S112a,主节点根据接收到的第一回复信息判断接收SQL执行计划成功的从节点数量是否满足第一预设阈值。Step S112a, the master node determines whether the number of slave nodes that successfully receive the SQL execution plan meets the first preset threshold according to the received first reply information.
示例性的,当主节点向各个从节点发送SQL执行计划之后启动计时器以使计时开始,当计时器已超时且存在未发送第一回复信息的从节点,则可确定未发送第一回复信息的从节点接收SQL执行计划失败,进而可确定未发送第一回复信息的从节点进行数据同步失败。本申请实施例通过计时器进行计时,避免等待回复信息的时间过长而造成数据时延增大。Exemplarily, after the master node sends the SQL execution plan to each slave node, the timer is started to start the timing. When the timer expires and there are slave nodes that have not sent the first reply information, it can be determined that the slave node that has not sent the first reply information The slave node fails to receive the SQL execution plan, so it can be determined that the slave node that has not sent the first reply information fails to perform data synchronization. In the embodiment of the present application, the timer is used for timing, so as to avoid the increase of data delay caused by waiting for the reply information for too long.
本申请实施例中,主节点在接收SQL执行计划成功的从节点数量满足第一预设阈值的情况下,才执行后续的步骤S120。具体的,可以根据各从节点发送的第一回复信息以及当计时器已超时仍未发送第一回复信息的从节点数量,确定接收SQL执行计划成功的从节点数量。In this embodiment of the present application, the master node performs the subsequent step S120 only when the number of slave nodes that successfully receive the SQL execution plan meets the first preset threshold. Specifically, the number of slave nodes that successfully receive the SQL execution plan can be determined according to the first reply information sent by each slave node and the number of slave nodes that have not sent the first reply information when the timer expires.
作为示例,主节点向4个从节点分别发送了SQL执行计划,接着启动计时器。当计时器超时后,仅接收到3个从节点反馈的第一回复信息且接收到的第一回复消息均指示相应的从节点接收SQL执行计划成功,则表明有1个节点接收SQL执行计划失败。假设第一预设阈值为2并要求当前接收SQL执行计划成功的从节点数量要大于等于第一预设阈值,即当前接收SQL执行计划成功的从节点数量满足第一预设阈值,主节点继续执行步骤S120。 当然,第一预设阈值也可以设置为与从节点数量相等,即要求当前所有从节点均接收SQL执行计划成功,才允许执行后续的步骤S120。As an example, the master node sends the SQL execution plan to the 4 slave nodes respectively, and then starts the timer. When the timer expires, only 3 first reply messages are received from the slave nodes, and all the received first reply messages indicate that the corresponding slave node successfully received the SQL execution plan, indicating that one node failed to receive the SQL execution plan. . Assume that the first preset threshold is 2 and the number of slave nodes that currently successfully receive the SQL execution plan is required to be greater than or equal to the first preset threshold, that is, the number of slave nodes that currently successfully receive the SQL execution plan meets the first preset threshold, and the master node continues Step S120 is performed. Of course, the first preset threshold may also be set to be equal to the number of slave nodes, that is, all current slave nodes are required to successfully receive the SQL execution plan before the subsequent step S120 is allowed to be executed.
如图2b所示,在一些实施例中,在步骤S120之后,还包括:As shown in FIG. 2b, in some embodiments, after step S120, it further includes:
步骤S121,主节点接收从节点发送的第二回复信息,并根据接收到的第二回复信息确定执行SQL执行计划成功的从节点数量,其中,第二回复信息指示从节点执行SQL执行计划成功或者失败;Step S121, the master node receives the second reply information sent by the slave node, and determines the number of slave nodes that successfully execute the SQL execution plan according to the received second reply information, wherein the second reply information indicates that the slave node successfully executed the SQL execution plan or Fail;
步骤S122,主节点判断是否主节点执行SQL执行计划成功且执行SQL执行计划成功的节点数量满足第二预设阈值。Step S122, the master node determines whether the master node successfully executes the SQL execution plan and the number of nodes that successfully execute the SQL execution plan meets the second preset threshold.
在具体实现时,如果存在一个或者多个节点若执行SQL执行计划失败,该执行SQL执行计划失败的一个或者多个节点发送第二回复信息给主节点。主节点根据接收到的第二回复信息的数量确定成功执行SQL执行计划的节点数量。During specific implementation, if one or more nodes fail to execute the SQL execution plan, the one or more nodes that fail to execute the SQL execution plan send second reply information to the master node. The master node determines the number of nodes that successfully execute the SQL execution plan according to the number of received second reply information.
本申请实施例,在主节点执行SQL执行计划成功且执行SQL执行计划成功的节点数量满足第二预设阈值的情况下,才允许执行后续的步骤S130。如果主节点执行SQL执行计划失败或者执行SQL执行计划成功的从节点数量不满足第二预设阈值,则终止执行后续的步骤,并直接向客户端发送操作失败信息。In this embodiment of the present application, only when the master node successfully executes the SQL execution plan and the number of nodes that successfully execute the SQL execution plan meets the second preset threshold, the subsequent step S130 is allowed to be executed. If the master node fails to execute the SQL execution plan or the number of slave nodes that successfully execute the SQL execution plan does not meet the second preset threshold, the execution of the subsequent steps is terminated, and the operation failure information is directly sent to the client.
作为示例,主节点向4个节点分别发送了SQL执行计划,且4个从节点均接收SQL执行计划成功。当主节点和各从节点并行执行SQL执行计划时,存在1个从节点执行SQL执行计划失败并向主节点反馈了指示执行SQL执行计划失败的第二回复信息。假设第二预设阈值为2并要求当前成功执行SQL执行计划的从节点数量大于等于第二预设阈值,即当前成功执行SQL执行计划的从节点数量满足第二预设阈值,所以主节点允许执行后续的步骤S130。当然,第二预设阈值也可以设置为与从节点数量相等,即要求当前所有从节点均执行SQL执行计划成功后,才允许执行后续的步骤S130。As an example, the master node sends SQL execution plans to 4 nodes respectively, and the 4 slave nodes all receive the SQL execution plans successfully. When the master node and each slave node execute the SQL execution plan in parallel, there is one slave node that fails to execute the SQL execution plan and feeds back the second reply information indicating the failure to execute the SQL execution plan to the master node. Assuming that the second preset threshold is 2 and the number of slave nodes that currently successfully execute the SQL execution plan is required to be greater than or equal to the second preset threshold, that is, the number of slave nodes that currently successfully execute the SQL execution plan meets the second preset threshold, so the master node allows The subsequent step S130 is performed. Of course, the second preset threshold may also be set to be equal to the number of slave nodes, that is, the subsequent step S130 is allowed to be executed only after all current slave nodes are required to successfully execute the SQL execution plan.
如图3所示,在另一种实施例中,步骤S110a可以替换成步骤S110c,主节点将SQL语句发送给至少一个从节点;步骤S110b可以替换成步骤S110d,主节点对SQL语句进行解析并生成SQL执行计划。As shown in FIG. 3, in another embodiment, step S110a can be replaced with step S110c, the master node sends the SQL statement to at least one slave node; step S110b can be replaced with step S110d, the master node parses the SQL statement and Generate SQL execution plan.
本实施例中,主节点直接将接收到的来自客户端的SQL语句发送给从节点。从节点接收到主节点发送的SQL语句后,对该SQL语句进行解析并生成SQL执行计划;然后从节点执行该SQL执行计划。In this embodiment, the master node directly sends the received SQL statement from the client to the slave node. After receiving the SQL statement sent by the master node, the slave node parses the SQL statement and generates an SQL execution plan; then the slave node executes the SQL execution plan.
应理解,步骤S110c和步骤S110d的顺序可互换。It should be understood that the order of step S110c and step S110d may be interchanged.
如图4所示,步骤S110c之后还可以包括:步骤S111b,主节点启动计时器,并在计时器未超时的情况下,接收从节点发送的第一回复信息,其中,第一回复信息指示从节点接收SQL语句成功或者失败。As shown in FIG. 4 , after step S110c, it may further include: step S111b, the master node starts a timer, and if the timer does not time out, receives the first reply information sent by the slave node, wherein the first reply information indicates the slave node. The node receives the SQL statement successfully or failed.
步骤S111b之后包括步骤S112b,主节点根据接收到的第一回复信息判断接收SQL语句成功的从节点数量是否满足第一预设阈值。Step S111b includes step S112b, in which the master node determines, according to the received first reply information, whether the number of slave nodes that successfully receive the SQL statement meets a first preset threshold.
示例性的,当主节点向各个从节点发送SQL语句之后启动计时器以使计时开始,当计时器已超时且存在未发送第一回复信息的从节点,则可确定未发送第一回复信息的从节点接收SQL语句失败,进而可确定未发送第一回复信息的从节点进行数据同步失败。本申请实施例通过计时器进行计时,避免等待回复信息的时间过长而造成数据时延增大。Exemplarily, after the master node sends the SQL statement to each slave node, the timer is started to start the timing, and when the timer expires and there are slave nodes that have not sent the first reply information, it can be determined that the slave nodes that have not sent the first reply information If the node fails to receive the SQL statement, it may be determined that the slave node that has not sent the first reply information fails to perform data synchronization. In the embodiment of the present application, the timer is used for timing, so as to avoid the increase of data delay caused by waiting for the reply information for too long.
本申请实施例中,主节点在接收SQL语句成功的从节点数量满足第一预设阈值的情况下,才执行后续的步骤。具体的,可以根据各从节点发送的第一回复信息以及当计时器已超时仍未发送第一回复信息的从节点数量,确定接收SQL语句成功的从节点数量。In this embodiment of the present application, the master node performs the subsequent steps only when the number of slave nodes that successfully receive the SQL statement meets the first preset threshold. Specifically, the number of slave nodes that successfully receive the SQL statement can be determined according to the first reply information sent by each slave node and the number of slave nodes that have not sent the first reply information when the timer expires.
图5示出了本申请实施例提供的一种数据同步处理方法的流程图。如图5所示,该数 据同步处理方法应用于分布式数据库系统的节点,该方法至少包括但不限于如下的步骤S200a至S230。FIG. 5 shows a flowchart of a data synchronization processing method provided by an embodiment of the present application. As shown in Fig. 5, the data synchronization processing method is applied to a node of a distributed database system, and the method at least includes but is not limited to the following steps S200a to S230.
步骤S200a,从节点接收主节点发送的SQL执行计划。Step S200a, the slave node receives the SQL execution plan sent by the master node.
示例性的,主节点在接收到客户端发送的SQL执行计划后,将客户端发送的SQL执行计划同步至从节点。Exemplarily, after receiving the SQL execution plan sent by the client, the master node synchronizes the SQL execution plan sent by the client to the slave node.
步骤S210,从节点执行SQL执行计划。Step S210, the slave node executes the SQL execution plan.
示例性的,从节点接收来自主节点的SQL执行计划后,可以对SQL执行计划进行解析并执行,实现与主节点并行执行SQL执行计划,将主节点的数据同步复制至从节点中。Exemplarily, after receiving the SQL execution plan from the master node, the slave node can parse and execute the SQL execution plan, implement the SQL execution plan in parallel with the master node, and replicate the data of the master node to the slave node synchronously.
步骤S220,从节点获取从节点执行SQL执行计划产生的第二增量日志,对第二增量日志的数据进行哈希计算,得到第二哈希值。Step S220: Obtain the second incremental log generated by the node executing the SQL execution plan from the node, perform hash calculation on the data of the second incremental log, and obtain a second hash value.
示例性的,从节点执行SQL执行计划时,会产生相应的事务日志信息,用以记录从节点执行SQL执行计划时的相关操作信息。上述的事务日志信息通常会写入从节点的操作日志中,通常情况下,该操作日志存储在从节点的数据库存储引擎中。事务日志信息写入从节点的操作日志后,从节点操作日志中新增加的日志内容即为上述的第二增量日志。本申请实施例采用哈希算法对从节点的第二增量日志的数据进行计算处理,得到第二哈希值。Exemplarily, when the slave node executes the SQL execution plan, corresponding transaction log information is generated to record relevant operation information when the slave node executes the SQL execution plan. The above transaction log information is usually written into the operation log of the slave node, and usually, the operation log is stored in the database storage engine of the slave node. After the transaction log information is written into the operation log of the slave node, the newly added log content in the operation log of the slave node is the above-mentioned second incremental log. In this embodiment of the present application, a hash algorithm is used to calculate and process the data of the second incremental log of the slave node to obtain a second hash value.
步骤S230,从节点发送第二哈希值至主节点,以使主节点根据第一哈希值和第二哈希值确定同步结果。Step S230, the slave node sends the second hash value to the master node, so that the master node determines the synchronization result according to the first hash value and the second hash value.
其中,第一哈希值为上述步骤S130中主节点对自身执行SQL执行计划产生的第一增量日志的数据进行哈希计算得到。The first hash value is obtained by performing hash calculation on the data of the first incremental log generated by the master node executing the SQL execution plan by itself in step S130.
示例性的,本申请实施例中从节点将第二哈希值发送给主节点,主节点接收到来自本从节点的第二哈希值后,将第一哈希值与第二哈希值进行哈希对比,若对比结果为第一哈希值与第二哈希值相等,表明主节点与本从节点执行SQL执行计划后的数据是一致的,即主节点与本从节点的数据同步成功;若对比结果为第一哈希值与第二哈希值不相等,表明本从节点执行SQL执行计划后的数据与主节点执行SQL执行计划后的数据不一致,也就是说本从节点同步主节点的数据失败。Exemplarily, in this embodiment of the present application, the slave node sends the second hash value to the master node, and after receiving the second hash value from the slave node, the master node compares the first hash value with the second hash value. Perform a hash comparison. If the comparison result is that the first hash value is equal to the second hash value, it indicates that the data after the master node and the slave node execute the SQL execution plan are consistent, that is, the data of the master node and the slave node are synchronized. Success; if the comparison result is that the first hash value is not equal to the second hash value, it indicates that the data after the SQL execution plan is executed by the slave node is inconsistent with the data after the master node executes the SQL execution plan, that is to say, the slave node is synchronized The data for the primary node failed.
如图6所示,在一些实例中,在步骤S200a之后还包括:步骤S201a,发送第一回复信息给主节点,其中,第一回复信息指示从节点接收SQL执行计划成功或者失败。As shown in FIG. 6 , in some instances, after step S200a, it further includes: step S201a, sending first reply information to the master node, wherein the first reply information indicates that the slave node succeeds or fails to receive the SQL execution plan.
当从节点完成接收到主节点发送的SQL执行计划后,发送第一回复信息给主节点,以使主节点确定从节点是否接受SQL执行计划成功,进而判断是否要执行后续的步骤。After the slave node finishes receiving the SQL execution plan sent by the master node, it sends the first reply message to the master node, so that the master node determines whether the slave node accepts the SQL execution plan successfully, and then judges whether to execute the subsequent steps.
如图6所示,在一些实例中,在步骤S210之后还包括:步骤S211,发送第二回复信息给主节点,其中,第二回复信息指示从节点执行SQL执行计划成功或者失败。As shown in FIG. 6 , in some instances, after step S210 , the method further includes: step S211 , sending second reply information to the master node, wherein the second reply information indicates that the slave node succeeds or fails to execute the SQL execution plan.
当从节点完成执行SQL执行计划后,发送第二回复信息给主节点,以使主节点确定从节点是否执行SQL执行计划成功,进而判断是否要执行后续的步骤。After the slave node finishes executing the SQL execution plan, it sends the second reply information to the master node, so that the master node determines whether the slave node successfully executes the SQL execution plan, and then determines whether to execute the subsequent steps.
如图7所示,步骤S200a可替换成如下的步骤S200b和S200c:As shown in FIG. 7, step S200a can be replaced with the following steps S200b and S200c:
S200b,从节点接收主节点发送的SQL语句;S200b, the slave node receives the SQL statement sent by the master node;
S200c,对所述SQL语句进行解析并生成SQL执行计划。S200c, parse the SQL statement and generate an SQL execution plan.
在一些可能的实施例中,主节点直接将客户端发送的SQL语句转发给从节点。从节点接收到主节点发送的SQL语句后,需要对所述SQL语句进行解析并生成SQL执行计划,再执行后续的步骤S210。In some possible embodiments, the master node directly forwards the SQL statement sent by the client to the slave node. After the slave node receives the SQL statement sent by the master node, the SQL statement needs to be parsed to generate an SQL execution plan, and then the subsequent step S210 is performed.
如图8所示,步骤S200b和S200c之间可以包括步骤S201b,发送第一回复信息给主节点,其中,第一回复信息指示从节点接收SQL语句成功或者失败。As shown in FIG. 8 , step S201b may be included between steps S200b and S200c, sending first reply information to the master node, wherein the first reply information indicates that the slave node succeeds or fails in receiving the SQL statement.
以下结合具体的实例对本申请实施例提供的数据同步处理方法作进一步说明。如图9 所示,在一种应用场景中,分布式数据库系统包括客户端10、主节点20和从节点30。当本申请实施例提供的数据同步处理方法应用于图10所示场景时,具体可以包括如图10所示的示例性步骤S300至S309。The data synchronization processing method provided by the embodiments of the present application will be further described below with reference to specific examples. As shown in FIG. 9 , in an application scenario, the distributed database system includes a client 10 , a master node 20 and a slave node 30 . When the data synchronization processing method provided by the embodiment of the present application is applied to the scenario shown in FIG. 10 , it may specifically include the exemplary steps S300 to S309 shown in FIG. 10 .
步骤S300,主节点20接收客户端10发送的SQL语句。Step S300, the master node 20 receives the SQL statement sent by the client 10.
步骤S301,主节点20对SQL语句进行解析并生成SQL执行计划。应理解,在对SQL语句进行解析成功的情况下,主节点20才执行后续的步骤S302,否则发送操作失败信息给客户端10。Step S301, the master node 20 parses the SQL statement and generates an SQL execution plan. It should be understood that the master node 20 executes the subsequent step S302 only when the parsing of the SQL statement is successful; otherwise, the operation failure information is sent to the client 10 .
步骤S302,主节点20将SQ执行计划发送给从节点30。Step S302, the master node 20 sends the SQ execution plan to the slave node 30.
步骤S303,当从节点30成功接收主节点20发送的SQL执行计划后,发送用以指示自身接收SQL执行计划成功的第一回复信息给主节点20。Step S303 , after the slave node 30 successfully receives the SQL execution plan sent by the master node 20 , it sends first reply information to the master node 20 to indicate that it has successfully received the SQL execution plan.
步骤S304a,主节点20执行SQL执行计划;Step S304a, the master node 20 executes the SQL execution plan;
步骤S304b,从节点30执行SQL执行计划;Step S304b, execute the SQL execution plan from the node 30;
步骤S305,从节点30发送用以指示自身执行SQL执行计划成功的第二回复信息给主节点20。Step S305 , the slave node 30 sends the second reply information to the master node 20 to indicate that it has successfully executed the SQL execution plan.
步骤S306a,主节点20获取自身执行SQL执行计划产生的第一增量日志,对第一增量日志的数据进行哈希计算,得到第一哈希值;Step S306a, the master node 20 obtains the first incremental log generated by its own execution of the SQL execution plan, performs hash calculation on the data of the first incremental log, and obtains the first hash value;
步骤S306b,从节点30获取自身执行SQL执行计划产生的第二增量日志,对第二增量日志的数据进行哈希计算,得到第二哈希值;Step S306b, obtaining the second incremental log generated by executing the SQL execution plan by itself from the node 30, and performing hash calculation on the data of the second incremental log to obtain a second hash value;
步骤S307,从节点30将第二哈希值发送给主节点20。Step S307 , the slave node 30 sends the second hash value to the master node 20 .
步骤S308,主节点20将第一哈希值和第二哈希值进行对比,根据对比结果确定同步结果。Step S308, the master node 20 compares the first hash value with the second hash value, and determines a synchronization result according to the comparison result.
步骤S309,主节点20根据同步结果发送操作结果信息给客户端10。具体的,如果同步结果为同步成功则发送操作成功信息给客户端10,否则发送操作失败信息给客户端10。Step S309, the master node 20 sends the operation result information to the client 10 according to the synchronization result. Specifically, if the synchronization result is that the synchronization is successful, the operation success information is sent to the client 10 , otherwise, the operation failure information is sent to the client 10 .
应理解,上述的步骤S304a和S304b为能够并行执行的步骤;步骤S306a和S306b为能够并行执行的步骤。It should be understood that the above-mentioned steps S304a and S304b are steps that can be executed in parallel; steps S306a and S306b are steps that can be executed in parallel.
当本申请实施例提供的数据同步处理方法应用于图9所示场景时,具体还可以包括如图11所示的示例性步骤S400至S410。When the data synchronization processing method provided by the embodiment of the present application is applied to the scenario shown in FIG. 9 , it may further include the exemplary steps S400 to S410 shown in FIG. 11 .
步骤S400,主节点20接收客户端10发送的SQL语句。Step S400, the master node 20 receives the SQL statement sent by the client 10.
步骤S401,主节点20将SQL语句转发给从节点30。Step S401 , the master node 20 forwards the SQL statement to the slave node 30 .
步骤S402,当从节点30成功接收主节点20发送的SQL语句后,发送用以指示自身接收SQL语句成功的第一回复信息给主节点20。Step S402 , after the slave node 30 successfully receives the SQL statement sent by the master node 20 , it sends the first reply message to the master node 20 to indicate that it has successfully received the SQL statement.
步骤S403a,主节点20对SQL语句进行解析并生成SQL执行计划。Step S403a, the master node 20 parses the SQL statement and generates an SQL execution plan.
步骤S403b,从节点30对SQL语句进行解析并生成SQL执行计划。Step S403b, the slave node 30 parses the SQL statement and generates an SQL execution plan.
步骤S404a,主节点20执行SQL执行计划;Step S404a, the master node 20 executes the SQL execution plan;
步骤S404b,从节点30执行SQL执行计划;Step S404b, execute the SQL execution plan from the node 30;
步骤S405,从节点30发送用以指示自身执行SQL执行计划成功的第二回复信息给主节点20。Step S405 , the slave node 30 sends the second reply message to the master node 20 to indicate that it has successfully executed the SQL execution plan.
步骤S406a,主节点20获取自身执行SQL执行计划产生的第一增量日志,对第一增量日志的数据进行哈希计算,得到第一哈希值;Step S406a, the master node 20 obtains the first incremental log generated by its own execution of the SQL execution plan, performs hash calculation on the data of the first incremental log, and obtains the first hash value;
步骤S406b,从节点30获取自身执行SQL执行计划产生的第二增量日志,对第二增量日志的数据进行哈希计算,得到第二哈希值;Step S406b, obtaining the second incremental log generated by executing the SQL execution plan by itself from the node 30, and performing hash calculation on the data of the second incremental log to obtain a second hash value;
步骤S407,从节点30将第二哈希值发送给主节点20。Step S407 , the slave node 30 sends the second hash value to the master node 20 .
步骤S408,主节点20将第一哈希值和第二哈希值进行对比,根据对比结果确定同步结果。Step S408, the master node 20 compares the first hash value with the second hash value, and determines a synchronization result according to the comparison result.
步骤S409,主节点20根据同步结果发送操作结果信息给客户端10。具体的,如果同步结果为同步成功则发送操作成功信息给客户端10,否则发送操作失败信息给客户端10。Step S409, the master node 20 sends the operation result information to the client 10 according to the synchronization result. Specifically, if the synchronization result is that the synchronization is successful, the operation success information is sent to the client 10 , otherwise, the operation failure information is sent to the client 10 .
传统的数据同步方案中,待主节点完成执行SQL执行计划后,再将相应的增量日志发送给节点进行解析回放,相当于串行的数据复制方式。而根据本申请实施例的方案,主节点和节点同步执行SQL执行计划,相当于主节点和节点进行并行的数据复制,相比传统的数据同步方案,本申请实施例的方案能够大大提高了数据库同步处理的效率,减少数据的延迟,提升了分布式数据库系统的性能,减少了对客户端提交事务的处理时间,进而提升用户的体验。In the traditional data synchronization scheme, after the master node completes the execution of the SQL execution plan, the corresponding incremental log is sent to the node for analysis and playback, which is equivalent to a serial data replication method. According to the solution of the embodiment of the present application, the master node and the node execute the SQL execution plan synchronously, which is equivalent to parallel data replication between the master node and the node. Compared with the traditional data synchronization solution, the solution of the embodiment of the present application can greatly improve the database performance. The efficiency of synchronous processing reduces the delay of data, improves the performance of the distributed database system, reduces the processing time for the client to submit transactions, and further improves the user experience.
此外,本申请实施例通过哈比算法对主节点和节点的增量日志进行对比,并根据对比结果确定同步结果,能够保证数据同步的一致性。In addition, the embodiment of the present application compares the incremental logs of the master node and the node through the Habi algorithm, and determines the synchronization result according to the comparison result, which can ensure the consistency of data synchronization.
图12示出了本申请实施例提供的电子设备40。如图12所示,该电子设备40包括但不限于:FIG. 12 shows an electronic device 40 provided by an embodiment of the present application. As shown in Figure 12, the electronic device 40 includes but is not limited to:
存储器42,用于存储程序; memory 42 for storing programs;
处理器41,用于执行存储器42存储的程序,当处理器41执行存储器42存储的程序时,处理器41用于执行上述任一实施例的数据同步处理方法。The processor 41 is configured to execute the program stored in the memory 42. When the processor 41 executes the program stored in the memory 42, the processor 41 is configured to execute the data synchronization processing method of any of the foregoing embodiments.
处理器41和存储器42可以通过总线或者其他方式连接。The processor 41 and the memory 42 may be connected by a bus or other means.
存储器42作为一种非暂态计算机可读存储介质,可用于存储非暂态软件程序以及非暂态性计算机可执行程序,如本申请实施例描述的任一种数据同步处理方法。处理器41通过运行存储在存储器42中的非暂态软件程序以及指令,从而实现上述任一实施例的数据同步处理方法。As a non-transitory computer-readable storage medium, the memory 42 can be used to store non-transitory software programs and non-transitory computer-executable programs, such as any data synchronization processing method described in the embodiments of this application. The processor 41 implements the data synchronization processing method in any of the foregoing embodiments by running the non-transitory software programs and instructions stored in the memory 42 .
存储器42可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储执行上述的数据同步处理方法。此外,存储器42可以包括高速随机存取存储器,还可以包括非暂态存储器,比如至少一个磁盘存储器件、闪存器件、或其他非暂态固态存储器件。在一些实施方式中,存储器42可包括相对于处理器41远程设置的存储器,这些远程存储器可以通过网络连接至该处理器41。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 42 may include a storage program area and a storage data area, wherein the storage program area may store an operating system and an application program required by at least one function; the storage data area may store and execute the above-mentioned data synchronization processing method. Additionally, memory 42 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 42 may include memory located remotely from processor 41, which may be connected to processor 41 via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
实现上述的数据同步处理方法所需的非暂态软件程序以及指令存储在存储器42中,当被一个或者多个处理器41执行时,执行上述任一实施例的数据同步处理方法。The non-transitory software programs and instructions required to implement the above-mentioned data synchronization processing method are stored in the memory 42 , and when executed by one or more processors 41 , execute the data synchronization processing method of any of the above-mentioned embodiments.
本申请实施例还提供了一种存储介质,存储有计算机可执行指令,计算机可执行指令用于执行上述任一实施例的数据同步处理方法。Embodiments of the present application further provide a storage medium storing computer-executable instructions, where the computer-executable instructions are used to execute the data synchronization processing method of any of the foregoing embodiments.
在一实施例中,该存储介质存储有计算机可执行指令,该计算机可执行指令被一个或多个控制处理器41执行,比如,被上述电子设备40中的一个处理器41执行,可使得上述一个或多个处理器41执行上述任一实施例的数据同步处理方法。In one embodiment, the storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more control processors 41. One or more processors 41 execute the data synchronization processing method of any of the above embodiments.
本申请实施例包括:主节点接收客户端发送的结构化查询语言SQL语句;主节点对所述SQL语句进行解析并生成SQL执行计划后将所述SQL执行计划发送给至少一个从节点,或者直接将所述SQL语句发送给至少一个从节点;主节点执行所述SQL执行计划;主节点获取所述主节点执行所述SQL执行计划产生的第一增量日志,对所述第一增量日志的数据进行哈希计算,得到第一哈希值;主节点接收每个所述从节点发送的第二哈希值,其中,所述第二哈希值是对所述从节点执行所述SQL执行计划产生的第二增量日志的数据进行哈希计算得到;主节点根据所述第一哈希值和所述第二哈希值确定同步结果。本申请实施例 的方案,一方面,主节点和从节点同时执行SQL执行计划,实现了对主节点和从节点进行并行式的同步复制,大大提高了数据库同步处理的效率,减少数据的延迟;另一方面,通过哈比算法对主节点和节点的增量日志进行对比,根据对比结果确定同步结果,能够保证数据同步的一致性。The embodiments of the present application include: the master node receives the structured query language SQL statement sent by the client; the master node parses the SQL statement and generates an SQL execution plan, and then sends the SQL execution plan to at least one slave node, or directly Send the SQL statement to at least one slave node; the master node executes the SQL execution plan; the master node obtains the first incremental log generated by the master node executing the SQL execution plan, and the first incremental log is Hash the data to obtain the first hash value; the master node receives the second hash value sent by each of the slave nodes, wherein the second hash value is the execution of the SQL on the slave node. The data of the second incremental log generated by the execution plan is obtained by hash calculation; the master node determines the synchronization result according to the first hash value and the second hash value. In the solution of the embodiment of the present application, on the one hand, the master node and the slave node execute the SQL execution plan at the same time, which realizes the parallel synchronous replication of the master node and the slave node, greatly improves the efficiency of database synchronization processing, and reduces the delay of data; On the other hand, the incremental log of the master node and the node is compared through the Habi algorithm, and the synchronization result is determined according to the comparison result, which can ensure the consistency of data synchronization.
以上所描述的实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The above-described embodiments are only illustrative, and the units described as separate components may or may not be physically separated, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统可以被实施为软件、固件、硬件及其适当的组合。某些物理组件或所有物理组件可以被实施为由处理器,如中央处理器、数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包括计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。Those of ordinary skill in the art can understand that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and appropriate combinations thereof. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit . Such software may be distributed on computer-readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). As known to those of ordinary skill in the art, the term computer storage media includes both volatile and nonvolatile implemented in any method or technology for storage of information, such as computer readable instructions, data structures, program modules or other data flexible, removable and non-removable media. Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices, or may Any other medium used to store desired information and which can be accessed by a computer. In addition, communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and can include any information delivery media, as is well known to those of ordinary skill in the art .
以上是对本申请的一些实施进行了具体说明,但本申请并不局限于上述实施方式,熟悉本领域的技术人员在不违背本申请范围的共享条件下还可作出种种等同的变形或替换,这些等同的变形或替换均包括在本申请权利要求所限定的范围内。The above is a specific description of some implementations of the application, but the application is not limited to the above-mentioned embodiments, and those skilled in the art can make various equivalent deformations or replacements under the shared conditions that do not violate the scope of the application. Equivalent modifications or substitutions are included within the scope defined by the claims of the present application.

Claims (18)

  1. 一种数据同步处理方法,应用于主节点,所述方法包括:A data synchronization processing method, applied to a master node, the method comprising:
    接收客户端发送的结构化查询语言SQL语句;Receive the structured query language SQL statement sent by the client;
    对所述SQL语句进行解析并生成SQL执行计划;Parse the SQL statement and generate an SQL execution plan;
    将所述SQL执行计划发送给至少一个从节点;sending the SQL execution plan to at least one slave node;
    执行所述SQL执行计划;Execute the SQL execution plan;
    获取所述主节点执行所述SQL执行计划时产生的第一增量日志,对所述第一增量日志的数据进行哈希计算,得到第一哈希值;Obtain the first incremental log generated when the master node executes the SQL execution plan, perform hash calculation on the data of the first incremental log, and obtain a first hash value;
    接收每个所述从节点发送的第二哈希值,其中,所述第二哈希值是对所述从节点执行所述SQL执行计划时产生的第二增量日志的数据进行哈希计算得到;Receive a second hash value sent by each of the slave nodes, where the second hash value is a hash calculation performed on the data of the second incremental log generated when the slave node executes the SQL execution plan get;
    根据所述第一哈希值和所述第二哈希值确定同步结果;determining a synchronization result according to the first hash value and the second hash value;
    根据所述同步结果发送操作结果信息给所述客户端。Send operation result information to the client according to the synchronization result.
  2. 根据权利要求1所述的数据同步处理方法,其中,当将所述SQL执行计划发送给至少一个从节点,还执行:The data synchronization processing method according to claim 1, wherein when the SQL execution plan is sent to at least one slave node, the method further executes:
    启动计时器;start the timer;
    在所述计时器未超时的情况下,接收所述从节点发送的第一回复信息,其中,所述第一回复信息指示所述从节点接收所述SQL执行计划成功或者失败。If the timer does not expire, the first reply information sent by the slave node is received, wherein the first reply information indicates that the slave node succeeds or fails in receiving the SQL execution plan.
  3. 根据权利要求2所述的数据同步处理方法,其中,所述执行所述SQL执行计划,包括:The data synchronization processing method according to claim 2, wherein the executing the SQL execution plan comprises:
    在接收所述SQL执行计划成功的所述从节点数量满足第一预设阈值的情况下,执行所述SQL执行计划。In the case that the number of the slave nodes that successfully receive the SQL execution plan meets a first preset threshold, execute the SQL execution plan.
  4. 根据权利要求1所述的数据同步处理方法,其中,当执行所述SQL执行计划,还接收所述从节点发送的第二回复信息,并根据接收到的第二回复信息确定执行SQL执行计划成功的从节点数量,其中,第二回复信息指示从节点执行SQL执行计划成功或者失败。The data synchronization processing method according to claim 1, wherein when executing the SQL execution plan, the second reply information sent by the slave node is also received, and it is determined according to the received second reply information that the execution of the SQL execution plan is successful. The number of slave nodes, wherein the second reply information indicates that the slave node succeeds or fails to execute the SQL execution plan.
  5. 根据权利要求4所述的数据同步处理方法,其中,所述获取所述主节点执行所述SQL执行计划产生的第一增量日志,包括:The data synchronization processing method according to claim 4, wherein the acquiring the first incremental log generated by the master node executing the SQL execution plan comprises:
    在所述主节点执行所述SQL执行计划成功且执行所述SQL执行计划成功的所述节点数量满足第二预设阈值的情况下,获取所述主节点执行所述SQL执行计划产生的第一增量日志。In the case that the master node successfully executes the SQL execution plan and the number of the nodes that successfully execute the SQL execution plan meets a second preset threshold, acquire the first result generated by the master node executing the SQL execution plan Incremental log.
  6. 一种数据同步处理方法,应用于主节点,所述方法包括:A data synchronization processing method, applied to a master node, the method comprising:
    接收客户端发送的结构化查询语言SQL语句;Receive the structured query language SQL statement sent by the client;
    将所述SQL语句发送给至少一个从节点;sending the SQL statement to at least one slave node;
    对所述SQL语句进行解析并生成SQL执行计划;Parse the SQL statement and generate an SQL execution plan;
    执行所述SQL执行计划;Execute the SQL execution plan;
    获取所述主节点执行所述SQL执行计划产生的第一增量日志,对所述第一增量日志的数据进行哈希计算,得到第一哈希值;obtaining the first incremental log generated by the master node executing the SQL execution plan, and performing hash calculation on the data of the first incremental log to obtain a first hash value;
    接收每个所述从节点发送的第二哈希值,其中,所述第二哈希值是对所述从节点执行根据所述SQL语句生成的SQL执行计划产生的第二增量日志的数据进行哈希计算得到;Receive a second hash value sent by each of the slave nodes, where the second hash value is data of the second incremental log generated by the slave node executing the SQL execution plan generated according to the SQL statement Hash calculation is performed;
    根据所述第一哈希值和所述第二哈希值确定同步结果;determining a synchronization result according to the first hash value and the second hash value;
    根据所述同步结果发送操作结果信息给所述客户端。Send operation result information to the client according to the synchronization result.
  7. 根据权利要求6所述的数据同步处理方法,其中,当将所述SQL语句发送给至少一 个从节点,还执行:The data synchronization processing method according to claim 6, wherein, when the SQL statement is sent to at least one slave node, it also executes:
    启动计时器;start the timer;
    在所述计时器未超时的情况下,接收所述从节点发送的第一回复信息,其中,所述第一回复信息指示所述从节点接收所述SQL语句成功或者失败。If the timer does not expire, the first reply information sent by the slave node is received, wherein the first reply information indicates that the slave node succeeds or fails in receiving the SQL statement.
  8. 根据权利要求7所述的数据同步处理方法,其中,所述执行所述SQL执行计划,包括:The data synchronization processing method according to claim 7, wherein the executing the SQL execution plan comprises:
    在接收所述SQL语句成功的所述从节点数量满足第一预设阈值的情况下,执行所述SQL执行计划。In the case that the number of the slave nodes that successfully receive the SQL statement meets a first preset threshold, the SQL execution plan is executed.
  9. 根据权利要求6所述的数据同步处理方法,其中,当执行所述SQL执行计划,还接收所述从节点发送的第二回复信息,并根据接收到的第二回复信息确定执行所述SQL执行计划成功的从节点数量,其中,第二回复信息指示从节点执行所述SQL执行计划成功或者失败。The data synchronization processing method according to claim 6, wherein when executing the SQL execution plan, the second reply information sent by the slave node is also received, and it is determined to execute the SQL execution according to the received second reply information The number of slave nodes whose plan is successful, wherein the second reply information indicates that the slave node succeeds or fails to execute the SQL execution plan.
  10. 根据权利要求9所述的数据同步处理方法,其中,所述获取所述主节点执行所述SQL执行计划产生的第一增量日志,包括:The data synchronization processing method according to claim 9, wherein the acquiring the first incremental log generated by the master node executing the SQL execution plan comprises:
    在所述主节点执行所述SQL执行计划成功且执行所述SQL执行计划成功的所述节点数量满足第二预设阈值的情况下,获取所述主节点执行所述SQL执行计划产生的第一增量日志。In the case that the master node successfully executes the SQL execution plan and the number of the nodes that successfully execute the SQL execution plan meets a second preset threshold, acquire the first result generated by the master node executing the SQL execution plan Incremental log.
  11. 一种数据同步处理方法,应用于从节点,所述方法包括:A data synchronization processing method, applied to a slave node, the method comprising:
    接收主节点发送的SQL执行计划;Receive the SQL execution plan sent by the master node;
    执行所述SQL执行计划;Execute the SQL execution plan;
    获取所述从节点执行所述SQL执行计划产生的第二增量日志,对所述第二增量日志的数据进行哈希计算,得到第二哈希值;Obtaining the second incremental log generated by the execution of the SQL execution plan by the slave node, and performing hash calculation on the data of the second incremental log to obtain a second hash value;
    发送所述第二哈希值至所述主节点,以使所述主节点根据第一哈希值和所述第二哈希值确定同步结果,其中,所述第一哈希值对所述主节点执行所述SQL执行计划产生的增量日志的数据进行哈希计算得到。Sending the second hash value to the master node, so that the master node determines a synchronization result according to the first hash value and the second hash value, wherein the first hash value is associated with the The data of the incremental log generated by the master node executing the SQL execution plan is obtained by hash calculation.
  12. 根据权利要求11所述的数据同步处理方法,其中,当接收主节点发送的SQL语句,还发送第一回复信息给所述主节点,其中,所述第一回复信息指示所述从节点接收所述SQL执行计划成功或者失败。The data synchronization processing method according to claim 11, wherein when receiving the SQL statement sent by the master node, first reply information is also sent to the master node, wherein the first reply information instructs the slave node to receive all the data. Specifies whether the SQL execution plan succeeds or fails.
  13. 根据权利要求11所述的数据同步处理方法,其中,当执行所述SQL语句,还发送第二回复信息给所述主节点,其中,所述第二回复信息指示所述从节点执行所述SQL执行计划成功或者失败。The data synchronization processing method according to claim 11, wherein when executing the SQL statement, second reply information is also sent to the master node, wherein the second reply information instructs the slave node to execute the SQL The execution plan succeeds or fails.
  14. 一种数据同步处理方法,应用于从节点,所述方法包括:A data synchronization processing method, applied to a slave node, the method comprising:
    接收主节点发送的SQL语句;Receive the SQL statement sent by the master node;
    对所述SQL语句进行解析并生成SQL执行计划;Parse the SQL statement and generate an SQL execution plan;
    执行所述SQL执行计划;Execute the SQL execution plan;
    获取所述从节点执行所述SQL执行计划产生的第二增量日志,对所述第二增量日志的数据进行哈希计算,得到第二哈希值;Obtaining the second incremental log generated by the execution of the SQL execution plan by the slave node, and performing hash calculation on the data of the second incremental log to obtain a second hash value;
    发送所述第二哈希值至所述主节点,以使所述主节点根据第一哈希值和所述第二哈希值确定同步结果,其中,所述第一哈希值对所述主节点执行所述SQL执行计划产生的增量日志的数据进行哈希计算得到。Sending the second hash value to the master node, so that the master node determines a synchronization result according to the first hash value and the second hash value, wherein the first hash value is associated with the The data of the incremental log generated by the master node executing the SQL execution plan is obtained by hash calculation.
  15. 根据权利要求14所述的数据同步处理方法,其中,当接收主节点发送的SQL语句,还发送第一回复信息给所述主节点,其中,所述第一回复信息指示所述从节点接收所 述SQL语句成功或者失败。The data synchronization processing method according to claim 14, wherein when receiving the SQL statement sent by the master node, first reply information is also sent to the master node, wherein the first reply information instructs the slave node to receive all the data. success or failure of the SQL statement.
  16. 根据权利要求14所述的数据同步处理方法,其中,当执行所述SQL执行计划,还发送第二回复信息给所述主节点,其中,所述第二回复信息指示所述从节点执行所述SQL执行计划成功或者失败。The data synchronization processing method according to claim 14, wherein when executing the SQL execution plan, second reply information is also sent to the master node, wherein the second reply information instructs the slave node to execute the The SQL execution plan succeeds or fails.
  17. 一种电子设备,包括:An electronic device comprising:
    存储器,用于存储程序;memory for storing programs;
    处理器,用于执行所述存储器存储的程序,其中,当所述处理器执行所述存储器存储的程序时,所述处理器用于执行:a processor, configured to execute the program stored in the memory, wherein when the processor executes the program stored in the memory, the processor is configured to execute:
    如权利要求1至16中任一项所述的方法。A method as claimed in any one of claims 1 to 16.
  18. 一种存储介质,存储有计算机可执行指令,其中,所述计算机可执行指令用于执行:A storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute:
    如权利要求1至16中任一项所述的方法。A method as claimed in any one of claims 1 to 16.
PCT/CN2021/101542 2020-06-29 2021-06-22 Data synchronization processing method, electronic device, and storage medium WO2022001750A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010609672.8 2020-06-29
CN202010609672.8A CN113934745A (en) 2020-06-29 2020-06-29 Data synchronization processing method, electronic device and storage medium

Publications (1)

Publication Number Publication Date
WO2022001750A1 true WO2022001750A1 (en) 2022-01-06

Family

ID=79272705

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/101542 WO2022001750A1 (en) 2020-06-29 2021-06-22 Data synchronization processing method, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN113934745A (en)
WO (1) WO2022001750A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115391457A (en) * 2022-08-23 2022-11-25 昆仑数智科技有限责任公司 Cross-database data synchronization method and device and storage medium
CN116991635A (en) * 2023-09-26 2023-11-03 武汉吧哒科技股份有限公司 Data synchronization method and data synchronization device
WO2024178935A1 (en) * 2023-02-28 2024-09-06 华为技术有限公司 Log synchronization method and apparatus, electronic device, and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115794941A (en) * 2022-10-10 2023-03-14 上海商米科技集团股份有限公司 Cross-region data synchronization method, system and computer readable medium
CN116303791A (en) * 2023-03-22 2023-06-23 合肥申威睿思信息科技有限公司 Data synchronization method and device based on acceleration system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105339939A (en) * 2013-06-25 2016-02-17 国际商业机器公司 Replication for on-line hot-standby database
CN105608143A (en) * 2015-12-17 2016-05-25 北京奇虎科技有限公司 Detection method and device of consistency of multi-copy data
CN106776775A (en) * 2016-11-11 2017-05-31 北京奇虎科技有限公司 Concurrent master-slave synchronisation method and device
US20180150540A1 (en) * 2016-11-29 2018-05-31 Sap Se Synchronization Mechanism for Serialized Data Log Replay in Database Systems
CN110851534A (en) * 2019-11-15 2020-02-28 上海达梦数据库有限公司 Data processing method, system and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103268318B (en) * 2013-04-16 2016-04-13 华中科技大学 A kind of distributed key value database system of strong consistency and reading/writing method thereof
CN105447156A (en) * 2015-11-30 2016-03-30 北京航空航天大学 Resource description framework distributed engine and incremental updating method
CN111177255A (en) * 2019-12-05 2020-05-19 中国铁道科学研究院集团有限公司电子计算技术研究所 Data consistency detection method and device, storage medium and server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105339939A (en) * 2013-06-25 2016-02-17 国际商业机器公司 Replication for on-line hot-standby database
CN105608143A (en) * 2015-12-17 2016-05-25 北京奇虎科技有限公司 Detection method and device of consistency of multi-copy data
CN106776775A (en) * 2016-11-11 2017-05-31 北京奇虎科技有限公司 Concurrent master-slave synchronisation method and device
US20180150540A1 (en) * 2016-11-29 2018-05-31 Sap Se Synchronization Mechanism for Serialized Data Log Replay in Database Systems
CN110851534A (en) * 2019-11-15 2020-02-28 上海达梦数据库有限公司 Data processing method, system and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115391457A (en) * 2022-08-23 2022-11-25 昆仑数智科技有限责任公司 Cross-database data synchronization method and device and storage medium
CN115391457B (en) * 2022-08-23 2023-09-12 昆仑数智科技有限责任公司 Cross-database data synchronization method, device and storage medium
WO2024178935A1 (en) * 2023-02-28 2024-09-06 华为技术有限公司 Log synchronization method and apparatus, electronic device, and storage medium
CN116991635A (en) * 2023-09-26 2023-11-03 武汉吧哒科技股份有限公司 Data synchronization method and data synchronization device
CN116991635B (en) * 2023-09-26 2024-01-19 武汉吧哒科技股份有限公司 Data synchronization method and data synchronization device

Also Published As

Publication number Publication date
CN113934745A (en) 2022-01-14

Similar Documents

Publication Publication Date Title
WO2022001750A1 (en) Data synchronization processing method, electronic device, and storage medium
US5396613A (en) Method and system for error recovery for cascaded servers
WO2019141186A1 (en) Data processing method and device
US8538923B2 (en) Method, node and system for controlling version in distributed system
JP2019516171A (en) Service processing method, device and system
WO2021120995A1 (en) Data synchronization method and device for databases, and storage medium
WO2020025049A1 (en) Data synchronization method and apparatus, database host, and storage medium
CN109388481B (en) Transaction information transmission method, system, device, computing equipment and medium
WO2011120452A2 (en) Method for updating data and control apparatus thereof
CN113094430B (en) Data processing method, device, equipment and storage medium
CN112995262B (en) Distributed transaction submission method, system and computing equipment
EP3713195B1 (en) Log processing method, related device, and system
CN110413687B (en) Distributed transaction fault processing method and related equipment based on node interaction verification
CN110633168A (en) Data backup method and system for distributed storage system
US7197519B2 (en) Database system including center server and local servers
CN106815094B (en) Method and equipment for realizing transaction submission in master-slave synchronization mode
WO2022135471A1 (en) Multi-version concurrency control and log clearing method, node, device and medium
US9043283B2 (en) Opportunistic database duplex operations
CN108090056B (en) Data query method, device and system
US10579604B2 (en) Database system, information processing device, method and medium
CN111259074A (en) Block synchronization method, device and storage medium
CN111130896A (en) NFS fault switching method and system and dual-control storage system
CN115658245A (en) Transaction submitting system, method and device based on distributed database system
US20090106781A1 (en) Remote call handling methods and systems
Liang et al. Online recovery in cluster databases

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21834031

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 16/05/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21834031

Country of ref document: EP

Kind code of ref document: A1