A message synchronization method, device, equipment and computer-readable storage medium
By generating message synchronization requests in a multi-controller system and forwarding message synchronization requests using extra-domain nodes, the problem of low message synchronization efficiency in a multi-controller system is solved, and the effect of improving communication efficiency and reducing complexity is achieved.
Patent Information
- Application Number
- CN202411149150.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2044-08-21
AI Technical Summary
In the prior art, a multi-controller system generates a large number of messages sent and times when message synchronization is synchronized, resulting in communication delay and low efficiency of message synchronization, and dealing with the problem of high message communication complexity.
By generating message synchronization requests, obtaining the preset message execution order, sending message synchronization requests to sub-nodes and extra-domain nodes, and forwarding message synchronization requests using extra-domain nodes to achieve indirect message synchronization, reducing the number of communications and resource consumption, and improving communication efficiency.
It reduces the number of communications and resource consumption, improves message synchronization efficiency, simplifies message processing complexity, increases system maintainability and reduces code maintenance costs, and ensures orderly processing of message synchronization.
Smart Images

Figure CN118677909B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer application technology, and in particular to a message synchronization method, device, equipment and computer-readable storage medium. Background Art
[0002] Complex multi-controller systems are increasingly used in various fields. In order to improve the performance and reliability of the system, message synchronization of multiple controllers is required.
[0003] The currently commonly used full synchronization mechanism performs message synchronization between controllers, that is, when a controller generates a message to be synchronized, it needs to synchronize the message to be synchronized to other controllers. When there are messages to be synchronized in multiple controllers, multiple message receiving and message sending tasks will be generated in each controller. A large number of messages will be generated on the communication channel, which greatly increases the number of messages sent, the number of times they are sent, and the communication delay, reducing the efficiency of message synchronization and increasing the complexity of processing message communication.
[0004] In summary, how to effectively solve the problems of large number and frequency of message sending, extended communication time, low message synchronization efficiency, and high complexity in processing message communication is an urgent problem that technicians in this field need to solve. Summary of the invention
[0005] The object of the present invention is to provide a message synchronization method, which improves and reduces the number of communications, reduces the consumption of communication resources, and improves the communication efficiency of message synchronization; another object of the present invention is to provide a message synchronization device, a computer-readable storage medium and a computer program product.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] A message synchronization method, comprising:
[0008] Generate a message synchronization request according to the message to be synchronized;
[0009] Get the preset message execution order for received and sent messages;
[0010] Sending a message synchronization request to the secondary node in the domain and the node outside the domain according to the message execution order;
[0011] Receive the first reply information returned by the in-domain secondary node and the second reply information returned by the out-domain node; wherein the second reply information is information generated after the out-domain node forwards the message synchronization request to the in-domain primary node and receives the third reply information returned by the in-domain primary node;
[0012] When both the first reply information and the second reply information have completed message updates, the message to be synchronized is updated locally.
[0013] In a specific implementation of the present invention, after sending the message synchronization request to the secondary node in the domain and the node outside the domain according to the message execution order, it also includes:
[0014] Generate a local sending waiting state flag corresponding to the message to be synchronized;
[0015] Obtain a status flag queue generated according to the message execution order and existing pending messages;
[0016] The local sending waiting state flag is inserted into the state flag queue according to the message execution order.
[0017] In a specific implementation of the present invention, after receiving the first reply information returned by the in-domain secondary node and the second reply information returned by the out-domain node, the method further includes:
[0018] Generate a local processing status flag corresponding to the message to be synchronized;
[0019] The local sending waiting state flag corresponding to the message to be synchronized is replaced by the local processing state flag.
[0020] In a specific implementation manner of the present invention, after the message to be synchronized is updated locally, the method further includes:
[0021] The local processing status flag corresponding to the message to be synchronized is replaced with a normal status flag.
[0022] In a specific implementation of the present invention, after inserting the local sending waiting state flag into the state flag queue according to the message execution order, and before receiving the first reply information returned by the in-domain secondary node and the second reply information returned by the out-domain node, it also includes:
[0023] When receiving a message sent by the out-of-domain node and / or the in-domain master node, generating a conflict status flag;
[0024] The conflict status flag is used to replace the local sending waiting state flag corresponding to the message to be synchronized.
[0025] In a specific implementation of the present invention, after replacing the local sending waiting state flag corresponding to the to-be-synchronized message with the conflict state flag, the method further includes:
[0026] Find out whether there is a remote message status flag in the status flag queue;
[0027] If yes, then generate a remote message waiting state flag corresponding to the message sent by the out-of-domain node and / or the in-domain master node;
[0028] Inserting the remote message waiting state flag into the tail of the remote message state flag in the state flag queue;
[0029] Replacing the conflict state flag corresponding to the message to be synchronized with the local sending waiting state flag;
[0030] If not, when it is determined that the local transmission is processed first according to the message execution order, a remote end waiting superposition state flag in the local processing is generated;
[0031] Replacing the conflict state flag corresponding to the message to be synchronized with the remote end waiting superposition state flag in the local processing;
[0032] When it is determined that the peer end message is processed first according to the message execution order, a local ready superposition state flag in remote processing is generated;
[0033] The conflict state flag corresponding to the message to be synchronized is replaced by the local ready superposition state flag in the remote processing.
[0034] In a specific embodiment of the present invention, it also includes:
[0035] Receiving a message to be forwarded sent by the out-of-domain node;
[0036] Generate a local forwarding waiting state flag according to the message to be forwarded;
[0037] The local forwarding waiting state flag is added to the state flag queue.
[0038] In a specific implementation of the present invention, adding the local forwarding waiting state flag to the state flag queue includes:
[0039] Find out whether there is a local message status flag in the status flag queue;
[0040] If so, the local forwarding waiting state flag is added to the tail of the local message state flag in the state flag queue.
[0041] In a specific implementation of the present invention, when it is determined that the status flag queue does not have a local message status flag, the method further includes:
[0042] Determine whether there is a remote message status flag in the status flag queue;
[0043] If not, the local forwarding waiting state flag is added to the head of the state flag queue.
[0044] In a specific implementation of the present invention, when it is determined that the status flag queue does not have a local message status flag but has a remote message status flag, the method further includes:
[0045] When it is determined that local transmission is given priority according to the message execution order, inserting the local forwarding waiting state flag into the head of the state flag queue;
[0046] When it is determined to process the peer message preferentially according to the message execution order, the local forwarding waiting state flag is inserted into the tail of the state flag queue.
[0047] In a specific embodiment of the present invention, it also includes:
[0048] After forwarding the message to be forwarded to the secondary node in the domain, replacing the local forwarding waiting state flag with the local sending waiting remote waiting superposition state flag;
[0049] When receiving a reply message returned by the secondary node in the domain, converting the local sending waiting remote waiting superposition state flag into a local processing remote waiting superposition state flag;
[0050] The message to be forwarded is updated locally, and the remote waiting superposition state flag in the local processing is converted into a remote message waiting state flag;
[0051] Return forwarding and updating completion reply information to the out-of-domain node, and convert the remote message waiting state flag into a remote message processing state flag;
[0052] When the message receiving completion reply information returned by the out-of-domain node is received, the remote message processing status flag is converted into a normal flag.
[0053] In a specific embodiment of the present invention, it also includes:
[0054] Each to-be-processed message in the status mark queue is processed in the order of remote message processing first and local message processing later.
[0055] A message synchronization device, comprising:
[0056] Memory for storing computer programs;
[0057] A processor is used to implement the steps of the message synchronization method as described above when executing the computer program.
[0058] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the message synchronization method described above are implemented.
[0059] A computer program product comprises a computer program, which implements the steps of the message synchronization method as described above when executed by a processor.
[0060] The message synchronization method provided by the present invention generates a message synchronization request according to the message to be synchronized; obtains a preset message execution order for received messages and sent messages; sends a message synchronization request to the sub-nodes in the domain and the nodes outside the domain according to the message execution order; receives a first reply message returned by the sub-node in the domain and a second reply message returned by the node outside the domain; wherein the second reply message is information generated after the node outside the domain forwards the message synchronization request to the main node in the domain and receives the third reply message returned by the main node in the domain; when both the first reply message and the second reply message are message updates completed, the message to be synchronized is updated locally.
[0061] It can be seen from the above technical solution that by sending the message to be synchronized to the sub-node in the domain and the node outside the domain respectively, and forwarding the message synchronization request to the main node in the domain by forwarding the node outside the domain, indirect message synchronization is achieved, and the current node does not need to send a message synchronization request to the main node in the domain, so that each node is only in a two-way communication relationship with its corresponding node outside the domain, and it has a one-way communication relationship with the main node in the domain and the sub-node in the domain. Message synchronization is achieved on the basis of not destroying the original synchronization mechanism of the circular mirror, and the number of communications is reduced. Compared with the full synchronization method of multiple cross-domain communications, the consumption of communication resources is reduced, the communication efficiency of message synchronization is improved, and the delay of single message communication caused by processing multiple messages is reduced. The complexity of multi-communication message processing is reduced, maintainability is increased, and the maintenance cost of the code is reduced. By synchronizing messages according to the order of message execution, the orderly processing of message synchronization is guaranteed.
[0062] Correspondingly, the present invention also provides a message synchronization device, a computer-readable storage medium and a computer program product corresponding to the above-mentioned message synchronization method, which have the above-mentioned technical effects and are not described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0064] FIG1 is a block diagram of a message synchronization structure of a four-controller cyclic backup in the related art;
[0065] FIG2 is a block diagram of a message synchronization structure of a full synchronization mechanism in the related art;
[0066] FIG3 is a flow chart of an implementation of a message synchronization method according to an embodiment of the present invention;
[0067] FIG4 is a structural block diagram of a message synchronization system according to an embodiment of the present invention;
[0068] FIG5 is another implementation flow chart of the message synchronization method in an embodiment of the present invention;
[0069] FIG6 is a state transition diagram of a multi-node communication receiving and sending conflict in an embodiment of the present invention;
[0070] FIG7 is a conversion diagram of a newly added state in a node to an original state and between the states according to an embodiment of the present invention;
[0071] FIG8 is a structural block diagram of a message synchronization device according to an embodiment of the present invention;
[0072] FIG9 is a structural block diagram of a message synchronization device according to an embodiment of the present invention;
[0073] Fig.10 A schematic diagram of the specific structure of a message synchronization device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0074] See Figure 1, which is a block diagram of a message synchronization structure of a four-controller cyclic backup in the related art. In the related art, data redundancy is achieved by cyclically synchronizing messages between nodes in the four controllers to the next node, which is based on the hardware and software configuration that can communicate based on the link interconnection between the four controllers. However, due to the software characteristics of cyclic unidirectional information synchronization between nodes, the software function does not support the realization of arbitrary communication between nodes, and the nodes need to send and receive messages unidirectionally in a fixed order within the cycle.
[0075] See Figure 2, which is a message synchronization structure block diagram of a full synchronization mechanism in the related art. The full synchronization mechanism currently used generally performs message synchronization between controllers, that is, when a controller generates a message to be synchronized, the controller needs to synchronize the message to be synchronized to other controllers respectively. When there are messages to be synchronized in multiple controllers, multiple message receiving and message sending tasks will be generated in each controller. A large number of messages will be generated on the communication channel, which greatly increases the number of messages sent, the number of times they are sent, and the communication delay, reduces the efficiency of message synchronization, and increases the complexity of processing message communication.
[0076] To this end, the message synchronization method provided in the present application improves and reduces the number of communications, reduces the consumption of communication resources, and improves the communication efficiency of message synchronization.
[0077] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0078] Referring to FIG. 3 , FIG. 3 is a flowchart of an implementation of a message synchronization method in an embodiment of the present invention. The method may include the following steps:
[0079] S301: Generate a message synchronization request according to the message to be synchronized.
[0080] When there are messages to be synchronized, a message synchronization request is generated according to the messages to be synchronized.
[0081] Referring to FIG. 4 , FIG. 4 is a structural block diagram of a message synchronization system in an embodiment of the present invention. When node 1 has messages to be synchronized, node 1 generates a message synchronization request according to the messages to be synchronized.
[0082] S302: Obtain a preset message execution order for received messages and sent messages.
[0083] Preset the order of execution of received and sent messages. For example, when there are both remote message receiving tasks and local message sending tasks, it can be set to execute the remote message receiving task first and then the local message sending task, or it can be set to execute the local message sending task first and then the remote message receiving task. After generating a message synchronization request, obtain the preset order of execution of received and sent messages.
[0084] S303: Send message synchronization requests to the secondary nodes in the domain and the nodes outside the domain according to the message execution order.
[0085] After obtaining the message execution order, message synchronization requests are sent to the secondary nodes in the domain and the nodes outside the domain according to the message execution order.
[0086] As shown in Figure 4, if node 1 currently has the task of receiving messages sent by remote nodes in addition to the message processing task of synchronizing the messages to be synchronized to the sub-nodes 2 within the domain and the nodes 3 outside the domain, it is necessary to determine whether to synchronize the messages to be synchronized to the sub-nodes 2 within the domain and the nodes 3 outside the domain first, or to receive the messages sent by the remote nodes first, based on the message execution order, and send message synchronization requests to the sub-nodes 2 within the domain and the nodes 3 outside the domain according to the message execution order, thereby realizing orderly processing of multiple messages.
[0087] S304: Receive the first reply information returned by the secondary node in the domain and the second reply information returned by the node outside the domain.
[0088] Among them, the second reply information is the information generated after the out-of-domain node forwards the message synchronization request to the in-domain master node and receives the third reply information returned by the in-domain master node.
[0089] After receiving the message synchronization request, the sub-node in the domain can parse the message synchronization request to obtain the message to be synchronized, and update the message in itself according to the message to be synchronized, and generate a first reply message according to the update result, and return the first reply message to the generation node of the message to be synchronized. After receiving the message synchronization request, the node outside the domain forwards the message synchronization request to the main node in the domain. The main node in the domain updates the message in itself according to the received message to be synchronized, and generates a third reply message according to the update result. After receiving the third reply message returned by the main node in the domain, the node outside the domain updates the message in itself, generates a second reply message according to the update result, and returns the second reply message to the generation node of the message to be synchronized. The generation node of the message to be synchronized receives the first reply message returned by the sub-node in the domain and the second reply message returned by the node outside the domain.
[0090] S305: When the first reply information and the second reply information are both updated, the message to be synchronized is updated locally.
[0091] After receiving the first reply information returned by the sub-node in the domain and the second reply information returned by the node outside the domain, the generation node of the message to be synchronized determines whether the first reply information and the second reply information are both message updates completed. When the first reply information and the second reply information are both message updates completed, the message to be synchronized is updated locally. After receiving the reply information from the sub-node in the domain and the node outside the domain, the generation node of the message to be synchronized updates the local message, thereby ensuring that the message to be synchronized is updated locally after the remote node is completed, ensuring that the remote end must have completed the update when the message to be synchronized is locally, and realizing the symmetry of local and remote data information.
[0092] It can be seen from the above technical solution that by sending the message to be synchronized to the sub-node in the domain and the node outside the domain respectively, and forwarding the message synchronization request to the main node in the domain by forwarding the node outside the domain, indirect message synchronization is achieved, and the current node does not need to send a message synchronization request to the main node in the domain, so that each node is only in a two-way communication relationship with its corresponding node outside the domain, and it has a one-way communication relationship with the main node in the domain and the sub-node in the domain. Message synchronization is achieved on the basis of not destroying the original synchronization mechanism of the circular mirror, and the number of communications is reduced. Compared with the full synchronization method of multiple cross-domain communications, the consumption of communication resources is reduced, the communication efficiency of message synchronization is improved, and the delay of single message communication caused by processing multiple messages is reduced. The complexity of multi-communication message processing is reduced, maintainability is increased, and the maintenance cost of the code is reduced. By synchronizing messages according to the order of message execution, the orderly processing of message synchronization is guaranteed.
[0093] It should be noted that, based on the above embodiment, the embodiment of the present invention also provides corresponding improved solutions. In the subsequent embodiments, the same steps or corresponding steps as those in the above embodiment can be referenced to each other, and the corresponding beneficial effects can also be referenced to each other, which will not be repeated one by one in the following improved embodiments.
[0094] Referring to FIG. 5 , FIG. 5 is another implementation flow chart of the message synchronization method in an embodiment of the present invention. The method may include the following steps:
[0095] S501: Generate a message synchronization request according to the message to be synchronized.
[0096] S502: Obtain a preset message execution order for received messages and sent messages.
[0097] S503: Send message synchronization requests to the secondary nodes in the domain and the nodes outside the domain according to the message execution order.
[0098] S504: Generate a local sending waiting state flag corresponding to the message to be synchronized.
[0099] After sending message synchronization requests to the secondary nodes in the domain and the nodes outside the domain according to the message execution order, a local sending waiting state flag (LOCAL_PENDING) corresponding to the message to be synchronized is generated.
[0100] S505: Acquire a status mark queue generated according to the message execution order and existing to-be-processed messages.
[0101] Get the status flag queue generated according to the message execution order and the existing pending messages. The status flag queue contains the status flags of each existing pending message, and the status flags of each existing pending message are arranged according to the message execution order.
[0102] S506: Insert the local sending waiting state flag into the state flag queue according to the message execution order.
[0103] After obtaining the status flag queue generated according to the message execution order and the existing pending messages, the local sending waiting status flag is inserted into the status flag queue according to the message execution order, thereby realizing the sorting of the execution order of the pending synchronization messages.
[0104] S507: Receive the first reply information returned by the secondary node in the domain and the second reply information returned by the node outside the domain.
[0105] Among them, the second reply information is the information generated after the out-of-domain node forwards the message synchronization request to the in-domain master node and receives the third reply information returned by the in-domain master node.
[0106] S508: Generate a local processing status flag corresponding to the message to be synchronized.
[0107] After receiving the first reply information returned by the secondary node in the domain and the second reply information returned by the node outside the domain, a local processing status flag (LOCAL_PHASE) corresponding to the message to be synchronized is generated. The local processing status flag is used to indicate that the message to be synchronized is being updated to the node that generates the message to be synchronized.
[0108] S509: Replace the local sending waiting state flag corresponding to the message to be synchronized with the local processing state flag.
[0109] After the local processing state flag corresponding to the message to be synchronized is generated, the local sending waiting state flag corresponding to the message to be synchronized is replaced with the local processing state flag, thereby realizing the conversion of the state corresponding to the message to be synchronized.
[0110] S510: When the first reply information and the second reply information are both updated, the message to be synchronized is updated locally.
[0111] S511: Replace the local processing status flag corresponding to the message to be synchronized with a normal flag.
[0112] After the message to be synchronized is updated locally, the local processing state flag corresponding to the message to be synchronized is replaced with a normal flag (IDLE), thereby indicating that the node generating the message to be synchronized has returned to the idle state.
[0113] The normal state flag indicates an idle state with no message sending or receiving. It is the starting state and the ending state of all states, and there is no other conversion relationship.
[0114] In a specific implementation of the present invention, after step S506 and before step S507, the method may further include the following steps:
[0115] Step 1: When receiving a message sent by an out-of-domain node and / or a master node in the domain, a conflict status flag is generated;
[0116] Step 2: Use the conflict status flag to replace the local sending waiting state flag corresponding to the message to be synchronized.
[0117] For the convenience of description, the above two steps can be combined for explanation.
[0118] After inserting the local send waiting state flag into the state flag queue according to the message execution order, before receiving the first reply information returned by the sub-node in the domain and the second reply information returned by the node outside the domain, when receiving messages sent by the node outside the domain and / or the main node in the domain, such as when only receiving messages sent by the node outside the domain, or only receiving messages sent by the main node in the domain, or receiving messages sent by both the node outside the domain and the main node in the domain, a conflict state flag (TIER_BREAK) is generated, and the conflict state flag is used to replace the local send waiting state flag corresponding to the message to be synchronized. The conflict state flag is used to identify that the node generating the message to be synchronized currently has both a message sending task and a message receiving task, so as to facilitate the arbitration of the message execution order after automatic triggering.
[0119] In a specific implementation of the present invention, after replacing the local sending waiting state flag corresponding to the to-be-synchronized message with the conflict state flag, the method may further include the following steps:
[0120] Step 1: Check whether there is a remote message status flag in the status flag queue. If yes, go to step 2; if not, go to step 5.
[0121] Step 2: Generate a remote message waiting state flag corresponding to the message sent by the out-of-domain node and / or the master node in the domain;
[0122] Step 3: inserting the remote message waiting status flag into the tail of the remote message status flag in the status flag queue;
[0123] Step 4: Use the local send wait state flag to replace the conflict state flag corresponding to the message to be synchronized;
[0124] Step 5: When the local transmission is determined to be processed first according to the message execution order, a remote waiting superposition state flag is generated in the local processing;
[0125] Step 6: Use the remote waiting superposition state flag in the local processing to replace the conflict state flag corresponding to the message to be synchronized;
[0126] Step 7: When it is determined that the peer message is to be processed first according to the message execution order, a local ready superposition state flag in remote processing is generated;
[0127] Step 8: Use the local ready overlay status flag in the remote processing to replace the conflict status flag corresponding to the message to be synchronized.
[0128] For the convenience of description, the above eight steps can be combined for explanation.
[0129] Refer to Figure 6, which is a state transition diagram of a multi-node communication receiving and sending conflict in an embodiment of the present invention. After replacing the local sending waiting state flag corresponding to the message to be synchronized with the conflict state flag, check whether there is a remote message status flag in the status flag queue. If so, it means that the node that generates the message to be synchronized already has a remote message to be processed before, and a remote message waiting state flag (REMOTE_PENDING) corresponding to the message sent by the out-of-domain node and / or the master node in the domain is generated. The remote message waiting state flag is inserted into the tail of the remote message status flag in the status flag queue, and the conflict state flag corresponding to the message to be synchronized is replaced with the local sending waiting state flag. Thus, by inserting the remote message waiting state flag into the tail of the remote message status flag in the status flag queue, the sequential processing of each remote message is realized. For example, for the state of receiving a node message (REMOTE_PHASE), while continuing to receive messages from other nodes, the remote message waiting state flag is inserted into the tail of the remote message status flag in the status flag queue. When sending a message, the state is converted to the newly added state of the remote waiting superposition state flag (REMOTE_PHASE_REMOTE_PENDING) in remote processing. If not, it means that the node generating the message to be synchronized does not have other remote messages to be processed. When the local sending is determined to be processed first according to the message execution order, the remote waiting superposition state flag (LOCAL_PHASE_REMOTE_PENDING) in local processing is generated, and the conflict state flag corresponding to the message to be synchronized is replaced by the remote waiting superposition state flag in local processing. When the peer message is determined to be processed first according to the message execution order, the local ready superposition state flag in remote processing is generated, and the conflict state flag corresponding to the message to be synchronized is replaced by the local ready superposition state flag (REMOTE_PHASE_LOCAL_READY) in remote processing. In this way, local and remote message processing is realized according to the preset priority order, ensuring the orderly processing of multiple messages to be processed.
[0130] In a specific embodiment of the present invention, the method may further include the following steps:
[0131] Step 1: Receive the message to be forwarded sent by the out-of-domain node;
[0132] Step 2: Generate a local forwarding waiting state flag according to the message to be forwarded;
[0133] Step 3: Add the local forwarding waiting status flag to the status flag queue.
[0134] For the convenience of description, the above three steps can be combined for explanation.
[0135] The node that generates the message to be synchronized may also receive the message to be forwarded sent by the node outside the domain. As shown in Figure 4, in addition to actively sending data to nodes 2 and 3, node 1 may also have node 3 as the master node to send the message to be forwarded to node 1, requiring node 1 to forward the message to be forwarded to node 2. After receiving the message to be forwarded sent by the node outside the domain, the node that generates the message to be synchronized generates a local forwarding waiting state flag (LOCAL_WAIT) according to the message to be forwarded, and adds the local forwarding waiting state flag to the state flag queue. By setting the local forwarding waiting state flag for the received message to be forwarded, it is easy to distinguish the state flag of the message to be forwarded from the state flag of the locally initiated message to be synchronized, simplifying the state transition mechanism under multi-message processing, making the communication process more concise and controllable, and easy to maintain.
[0136] In a specific implementation of the present invention, adding the local forwarding waiting state flag to the state flag queue may include the following steps:
[0137] Step 1: Check whether there is a local message status flag in the status flag queue. If yes, go to step 2; if not, go to step 3.
[0138] Step 2: Add the local forwarding waiting state flag to the tail of the local message state flag in the state flag queue;
[0139] Step 3: When it is determined that local transmission is given priority according to the message execution order, the local forwarding waiting state flag is inserted into the head of the state flag queue;
[0140] Step 4: When it is determined that the peer message is to be processed first according to the message execution order, the local forwarding waiting state flag is inserted into the tail of the state flag queue.
[0141] For the convenience of description, the above four steps can be combined for explanation.
[0142] When the local forwarding waiting status flag is added to the status flag queue, check whether there is a local message status flag in the status flag queue. If so, it means that there is a pending message sending task before receiving the message to be forwarded. The local forwarding waiting status flag is added to the tail of the local message status flag in the status flag queue. If not, it means that there is no pending message sending task before receiving the message to be forwarded. When the local sending is determined to be given priority according to the message execution order, the local forwarding waiting status flag is inserted into the head of the status flag queue. When the peer message is determined to be given priority according to the message execution order, the local forwarding waiting status flag is inserted into the tail of the status flag queue, thereby realizing local and remote message processing in accordance with the preset priority order, and ensuring the orderly processing of multiple pending messages.
[0143] For example, for a message sent by a node, and the local has previously been in the superposition state of sending and receiving messages as the sender, a new state transition is added: the local sending waiting remote waiting superposition state flag (LOCAL_PENDING_REMOTE_PENDING) is converted to the local sending waiting remote waiting remote waiting superposition state flag (LOCAL_PENDING_REMOTE_PENDING_REMOTE_PENDING), and the local sending processing remote waiting superposition state flag (LOCAL_PHASE_REMOTE_ PENDING) is converted to the local sending processing remote waiting remote waiting superposition state flag (LOCAL_PHASE _REMOTE_PENDING_REMOTE_PENDING). This state action gives priority to local processing, and after the processing is completed, the request messages of multiple nodes that have arrived are processed in sequence according to the receiving time.
[0144] For example, for the superposition state of receiving a message sent by a node and the local has previously sent a message as the sender, a new state transition is added: the local sending waiting superposition state flag (REMOTE_PHASE_LOCAL_PENDING) in remote processing is converted to the remote waiting local sending waiting superposition state flag (REMOTE_PHASE_REMOTE_PENDING_LOCAL_PENDING) in remote processing, and the local ready superposition state flag (REMOTE_PHASE_LOCAL_READY) in remote processing is converted to the remote waiting local ready superposition state flag (REMOTE_PHASE_REMOTE_PENDING_LOCAL_READY) in remote processing. This state action prioritizes processing the request messages of the remote nodes that arrive in sequence, and then processes the local.
[0145] In a specific embodiment of the present invention, the method may further include the following steps:
[0146] Step 1: After forwarding the message to be forwarded to the secondary node in the domain, the local forwarding waiting state flag is replaced by the local sending waiting remote waiting superposition state flag;
[0147] Step 2: when receiving a reply message returned by the secondary node in the domain, converting the local sending waiting remote waiting superposition state flag into the local processing remote waiting superposition state flag;
[0148] Step 3: Update the message to be forwarded to the local, and convert the remote waiting superposition state flag in the local processing into the remote message waiting state flag;
[0149] Step 4: forward and update the reply information to the out-of-domain node, and convert the remote message waiting state flag into the remote message processing state flag;
[0150] Step 5: When receiving the message reception completion reply message returned by the out-of-domain node, convert the remote message processing status flag to a normal flag.
[0151] For the convenience of description, the above five steps can be combined for explanation.
[0152] After forwarding the message to be forwarded to the sub-node in the domain, the local forwarding waiting state flag is replaced by the local sending waiting remote waiting superposition state flag (LOCAL_PENDING_REMOTE_PENDING). When receiving the reply message returned by the sub-node in the domain, the local sending waiting remote waiting superposition state flag is converted to the remote waiting superposition state flag in local processing (LOCAL_PHASE_REMOTE_PENDING), the message to be forwarded is updated locally, and the remote waiting superposition state flag in local processing is converted to the remote message waiting state flag (REMOTE_PENDING), and the forwarding and update completion reply information is returned to the node outside the domain, and the remote message waiting state flag is converted to the remote message processing state flag (REMOTE_PHASE). When receiving the message reception completion reply information returned by the node outside the domain, the remote message processing state flag is converted to the normal flag (IDLE). In this way, the processing of the message to be forwarded is realized, and the state identifier is guaranteed to be consistent with the processing stage of the message to be forwarded.
[0153] In a specific embodiment of the present invention, the method may further include the following steps:
[0154] Process each pending message in the status flag queue in the order of remote message processing first and local message processing later.
[0155] When processing each pending message in the status flag queue, each pending message in the status flag queue is processed in the order of remote message processing first and local message processing second, so as to avoid a deadlock scenario of circular waiting for messages in which all nodes are waiting for the reply from the other end after the node sends a message, while the processing of the message from the other end is in a waiting state.
[0156] The embodiment of the present invention processes message synchronization for a four-controller system and can also be applied to a multi-controller scenario with more than four controllers. By dividing the organizations of the multiple controllers and setting arbitration forwarding between the organizations, for example, four controllers are organized into a group and synchronized individually within the organization, forwarding communication of a multi-controller cluster can be realized. Thereby, when the number of controllers is relatively large, the consumption of communication resources is further reduced, the communication efficiency of message synchronization is improved, and the delay of single message communication caused by processing multiple messages is reduced. The complexity of multi-communication message processing is reduced, maintainability is increased, and the maintenance cost of the code is reduced.
[0157] See Figure 7, which is a transition diagram of a newly added state in a node to an original state and between the two states in an embodiment of the present invention. The state transition process in the following specific example applications can be seen in Figure 7.
[0158] In a specific example application, when the four controllers are synchronized, the node simultaneously sends two special messages to its corresponding in-domain secondary node and out-domain node (at this time, the node may be in a state of superposition or non-superposition of sending and receiving). After receiving the replies from these two nodes, the possible conversion states may include: from the remote waiting for local sending waiting superposition state flag (REMOTE_PHASE_REMOTE_PENDING_LOCAL_PENDING) in remote processing to the remote waiting for local ready superposition state flag (REMOTE_PHASE_REMOTE_PENDING_LOCAL_READY) in remote processing, from the local sending waiting state flag (LOCAL_ PENDING) is converted to the local processing status flag (LOCAL_PHASE), the local sending waiting remote waiting superposition status flag (LOCAL_PENDING_REMOTE_PENDING) is converted to the local processing remote waiting superposition status flag (LOCAL_PHASE_REMOTE_PENDING), and the local sending waiting remote waiting remote waiting superposition status (LOCAL_PENDING_REMOTE_PENDING_REMOTE_PENDING) state is converted to the local processing remote waiting remote waiting superposition state (LOCAL_PHASE_REMOTE_PENDING _REMOTE_PENDING) state.
[0159] In another specific example application, when the four controllers are synchronized, for the node that receives the special message sent by the node outside the domain, it is first determined whether to execute the forwarding process performed by node 3 in Figure 4. The judgment basis is: determine whether the source node of the message is the master node in the domain. If it is not the master node in the domain, it means that it is synchronized outside the domain, and the node is in the sending state or the sending and receiving superposition state. The possible conversion states may include: from the local sending waiting state flag (LOCAL_PENDING) to the local sending waiting local forwarding waiting superposition state flag (LOCAL_PENDING_LOCAL_WAIT), from the local processing state flag (LOCAL_PHASE) to the local processing local forwarding waiting superposition state flag (LOCAL_PHAS E_LOCAL_WAIT), converted from local send waiting remote waiting superposition status flag (LOCAL_PENDING_REMOTE_PENDING) to local send waiting local forwarding waiting remote waiting superposition status flag (LOCAL_PENDING_LOCAL_WAIT_REMOTE_PENDING), converted from local send waiting remote waiting superposition status flag (LOCAL_PENDING_REMOTE_PENDING) to local send waiting local forwarding waiting remote waiting superposition status flag (LOCAL_PENDING_LOCAL_WAIT_REMOTE_PENDING), at this time the status processing is waiting for the local message that has been sent to complete processing.
[0160] In another specific example application, when the four controllers are synchronized, for the node that receives the special message sent by the node outside the domain, it first determines whether to execute the forwarding process performed by node 3 in Figure 4. The judgment basis is: determine whether the source node of the message is the master node in the domain. If it is not the master node in the domain, it means that it is synchronized outside the domain, and the node is in the receiving state. Possible conversion states may include: conversion from the remote processing state flag (REMOTE_PHASE) to the local forwarding waiting superposition state flag (REMOTE_PHASE_LOCAL_WAIT) in the remote processing, and from the remote waiting superposition state flag (REMOTE_PHASE_REMOTE_PENDING) in the remote processing to the remote waiting local forwarding waiting superposition state flag (REMOTE_PHASE_REMOTE_ PENDING_LOCAL_WAIT) in the remote processing. In this state, the processing action is to wait for the remote message processing to be completed before performing the relevant forwarding processing.
[0161] In another specific example application, when the four controllers are synchronized, for the node that receives the special message sent by the node outside the domain, it is first determined whether to execute the forwarding process performed by node 3 in Figure 4. The judgment basis is: determine whether the source node of the message is the master node in the domain. If it is the master node in the domain, it means that it is synchronized within the domain. At this time, the node does not forward and resynchronize. The possible conversion states may include: conversion from the local sending waiting state flag (LOCAL_PENDING) to the local sending waiting remote waiting superposition state flag (LOCAL_PENDING_REMOTE_PENDING), from the local processing state flag (LOCAL_PHASE ) is converted to the remote waiting superposition state flag in local processing (LOCAL_PHASE_REMOTE_PENDING), from the local sending waiting remote waiting superposition state flag (LOCAL_PENDING_REMOTE_PENDING) to the local sending waiting remote waiting remote waiting superposition state flag (LOCAL_PENDING_REMOTE_PENDING_REMOTE_PENDING), from the remote processing state flag (REMOTE_PHASE) to the remote waiting state superposition flag in remote processing (REMOTE_PHASE_REMOTE_ PENDING).
[0162] For the state where the local sending waiting state flag (LOCAL_PENDING), the local processing state flag (LOCAL_PHASE), the local forwarding waiting state flag (LOCAL_WAIT), and the remote processing state flag (REMOTE_PHASE) are superimposed, there is the following conversion and processing logic: During the processing, the processing order is to process the remote end first, then process the local processing under the local sending waiting state flag (LOCAL_PENDING) and the local processing state flag (LOCAL_PHASE), and finally process the local processing under the local forwarding waiting state flag (LOCAL_WAIT). The state conversion relationship and the processing under the corresponding state are: for the local sending waiting local forwarding waiting remote waiting superimposed state flag (LOCAL_PENDING_LOCAL_WAIT_REMOTE_PENDING) / In the local processing, the local forwarding waits for the remote waiting superposition state flag (LOCAL_PHASE_LOCAL_WAIT_REMOTE_PENDING) state is used. The remote message is processed first and the state is converted to the local sending waits for the local forwarding waiting superposition state flag (REMOTE_PHASE_LOCAL_PENDING_LOCAL_WAIT) in the remote processing / the local ready local forwarding waiting superposition state flag (REMOTE_PHASE_LOCAL_READY_LOCAL_WAIT) in the remote processing. In this state, the remote message is processed. After the processing is completed and replied, it is converted to the local sending waits for the local forwarding waiting superposition state flag (LOCAL_PENDING_LOCAL_WAIT) / the local forwarding waiting superposition state flag (LOCAL_PHASE_LOCAL_WAIT) in the local processing. At this time, the sending of the local message and the related processing after receiving the reply are processed. After the processing is completed, it is converted to the local forwarding waiting state flag (LOCAL_WAIT).
[0163] When processing the local forwarding waiting state flag (LOCAL_WAIT), the state of the node is usually in the forwarding state where only the local forwarding waiting state flag (LOCAL_WAIT) needs to be processed. In this case, it will not be converted into a separate local forwarding waiting state flag (LOCAL_WAIT) state, but converted into a local sending waiting remote waiting superposition state flag (LOCAL_PENDING_REMOTE_ PENDING). Before converting to this state, the following will be executed during the conversion process: 1) Send a forwarding message and wait for a reply; 2) Add the forwarding message content to the queue of received messages at the same time, which is used to execute the processing of the reply to the main node after the node as the peer node forwards this special message. The above process corresponds to the state of the local sending waiting remote waiting superposition state flag (LOCAL_PENDING_REMOTE_ PENDING). In this state, the message sending process can be processed and then converted into the local processing remote waiting superposition state flag (LOCAL_PHASE_REMOTE_PENDING), and the local message processing is converted into the remote message waiting state flag (REMOTE_ PENDING), and then the remote message waiting state flag (REMOTE_ PENDING) is converted into a remote message processing status flag (REMOTE_PHASE), and then processed as a remote reply action to the master node that sent the special message and converted into a normal flag (IDLE).
[0164] Corresponding to the above method embodiment, the present invention further provides a message synchronization device. The message synchronization device described below and the message synchronization method described above can be referred to each other.
[0165] Referring to FIG. 8 , FIG. 8 is a structural block diagram of a message synchronization device according to an embodiment of the present invention, and the device may include:
[0166] A message synchronization request generating module 81, used to generate a message synchronization request according to the message to be synchronized;
[0167] A message execution order acquisition module 82, used to acquire a preset message execution order for received messages and sent messages;
[0168] A message synchronization request sending module 83, used to send message synchronization requests to the secondary nodes in the domain and the nodes outside the domain according to the message execution order;
[0169] The reply information receiving module 84 is used to receive the first reply information returned by the secondary node in the domain and the second reply information returned by the node outside the domain; wherein the second reply information is information generated after the node outside the domain forwards the message synchronization request to the primary node in the domain and receives the third reply information returned by the primary node in the domain;
[0170] The message updating module 85 is used to update the message to be synchronized to the local computer when both the first reply information and the second reply information have completed the message updating.
[0171] It can be seen from the above technical solution that by sending the message to be synchronized to the sub-node in the domain and the node outside the domain respectively, and forwarding the message synchronization request to the main node in the domain by forwarding the node outside the domain, indirect message synchronization is achieved, and the current node does not need to send a message synchronization request to the main node in the domain, so that each node is only in a two-way communication relationship with its corresponding node outside the domain, and it has a one-way communication relationship with the main node in the domain and the sub-node in the domain. Message synchronization is achieved on the basis of not destroying the original synchronization mechanism of the circular mirror, and the number of communications is reduced. Compared with the full synchronization method of multiple cross-domain communications, the consumption of communication resources is reduced, the communication efficiency of message synchronization is improved, and the delay of single message communication caused by processing multiple messages is reduced. The complexity of multi-communication message processing is reduced, maintainability is increased, and the maintenance cost of the code is reduced. By synchronizing messages according to the order of message execution, the orderly processing of message synchronization is guaranteed.
[0172] In a specific embodiment of the present invention, the device may further include:
[0173] A local sending waiting state flag generating module is used to generate a local sending waiting state flag corresponding to the message to be synchronized after sending a message synchronization request to the secondary node in the domain and the node outside the domain according to the message execution order;
[0174] A status flag queue acquisition module is used to acquire a status flag queue generated according to the message execution order and the existing pending messages;
[0175] The first flag insertion module is used to insert the local sending waiting state flag into the state flag queue according to the message execution order.
[0176] In a specific embodiment of the present invention, the device may further include:
[0177] A local processing status flag generating module is used to generate a local processing status flag corresponding to the message to be synchronized after receiving the first reply information returned by the secondary node in the domain and the second reply information returned by the node outside the domain;
[0178] The first flag replacement module is used to replace the local sending waiting state flag corresponding to the message to be synchronized with the local processing state flag.
[0179] In a specific embodiment of the present invention, the device may further include:
[0180] The second flag replacement module is used to replace the local processing state flag corresponding to the message to be synchronized with a normal flag after the message to be synchronized is updated locally.
[0181] In a specific embodiment of the present invention, the device may further include:
[0182] A conflict status flag generating module is used to generate a conflict status flag when receiving a message sent by an out-of-domain node and / or an in-domain main node after inserting a local send waiting status flag into a status flag queue according to a message execution order and before receiving a first reply message returned by an in-domain secondary node and a second reply message returned by an out-of-domain node;
[0183] The third flag replacement module is used to replace the local sending waiting state flag corresponding to the message to be synchronized with the conflict state flag.
[0184] In a specific embodiment of the present invention, the device may further include:
[0185] A remote message status flag search module is used to search whether there is a remote message status flag in the status flag queue after replacing the local send waiting status flag corresponding to the message to be synchronized with the conflict status flag;
[0186] A remote message waiting state flag generating module is used to generate a remote message waiting state flag corresponding to a message sent by an out-of-domain node and / or an in-domain master node when it is determined that a remote message state flag exists in the state flag queue;
[0187] A second flag insertion module, used for inserting the remote message waiting state flag into the tail of the remote message state flag in the state flag queue;
[0188] A fourth flag replacement module, used to replace the conflict state flag corresponding to the to-be-synchronized message with the local send wait state flag;
[0189] A remote waiting superposition status flag generating module in local processing is used to generate a remote waiting superposition status flag in local processing when it is determined that there is no remote message status flag in the status flag queue and local sending is prioritized according to the message execution order;
[0190] A fifth flag replacement module, used to replace the conflict state flag corresponding to the to-be-synchronized message with the remote waiting superposition state flag in the local processing;
[0191] A local ready superimposed state flag generating module in remote processing, used for generating a local ready superimposed state flag in remote processing when the message of the opposite end is determined to be processed preferentially according to the message execution order;
[0192] The sixth flag replacement module is used to replace the conflict state flag corresponding to the message to be synchronized with the local ready superposition state flag in the remote processing.
[0193] In a specific embodiment of the present invention, the device may further include:
[0194] A message receiving module to be forwarded, used for receiving messages to be forwarded sent by nodes outside the domain;
[0195] A local forwarding waiting state flag generating module, used for generating a local forwarding waiting state flag according to a message to be forwarded;
[0196] The local forwarding waiting state flag adding module is used to add the local forwarding waiting state flag to the state flag queue.
[0197] In a specific implementation of the present invention, the local forwarding waiting state flag adding module includes:
[0198] A local message status flag search submodule is used to search whether a local message status flag exists in the status flag queue;
[0199] The first local forwarding waiting state flag adding submodule is used to add the local forwarding waiting state flag to the tail of the local message state flag in the state flag queue when it is determined that the state flag queue has a local message state flag.
[0200] In a specific implementation of the present invention, the local forwarding waiting state flag adding module may further include:
[0201] A judgment submodule, used for judging whether there is a remote message status flag in the status flag queue when it is determined that there is no local message status flag in the status flag queue;
[0202] The second local forwarding waiting state flag adding submodule is used to add the local forwarding waiting state flag to the head of the state flag queue when it is determined that there is no remote message state flag in the state flag queue.
[0203] In a specific embodiment of the present invention, the device may further include:
[0204] A first local forwarding waiting state flag insertion module is used to insert the local forwarding waiting state flag into the head of the state flag queue when it is determined that there is no local message state flag in the state flag queue but there is a remote message state flag, and it is determined that the local transmission is processed first according to the message execution order;
[0205] The second local forwarding waiting state flag insertion module is used to insert the local forwarding waiting state flag into the tail of the state flag queue when it is determined that there is no local message state flag in the state flag queue but there is a remote message state flag, and the remote message is prioritized according to the message execution order.
[0206] In a specific embodiment of the present invention, the device may further include:
[0207] The seventh flag replacement module is used to replace the local forwarding waiting state flag with the local sending waiting remote waiting superposition state flag after forwarding the message to be forwarded to the secondary node in the domain;
[0208] The first flag conversion module is used to convert the local sending waiting remote waiting superposition state flag into the local processing remote waiting superposition state flag when receiving the reply message returned by the secondary node in the domain;
[0209] The second flag conversion module is used to update the message to be forwarded to the local, and convert the remote waiting superposition state flag in the local processing into the remote message waiting state flag;
[0210] The third flag conversion module is used to return the forwarding and update completion reply information to the out-of-domain node, and convert the remote message waiting state flag into the remote message processing state flag;
[0211] The fourth flag conversion module is used to convert the remote message processing status flag into a normal flag when receiving the message reception completion reply information returned by the out-of-domain node.
[0212] In a specific embodiment of the present invention, the device may further include:
[0213] The message processing module is used to process each to-be-processed message in the status mark queue in the order of remote message processing first and local message processing later.
[0214] Corresponding to the above method embodiment, referring to FIG. 9 , FIG. 9 is a schematic diagram of a message synchronization device provided by the present invention, and the device may include:
[0215] A memory 332, for storing computer programs;
[0216] The processor 322 is used to implement the steps of the message synchronization method of the above method embodiment when executing the computer program.
[0217] For details, please refer to Fig.10 , Fig.10A specific structural diagram of a message synchronization device provided for this embodiment, the message synchronization device may have relatively large differences due to different configurations or performances, and may include a processor (central processing units, CPU) 322 (for example, one or more processors) and a memory 332, and the memory 332 stores one or more computer programs 342 or data 344. Among them, the memory 332 can be a temporary storage or a permanent storage. The program stored in the memory 332 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the data processing device. Furthermore, the processor 322 can be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the message synchronization device 301.
[0218] The message synchronization device 301 may further include one or more power supplies 326 , one or more wired or wireless network interfaces 350 , one or more input and output interfaces 358 , and / or one or more operating systems 341 .
[0219] The steps in the message synchronization method described above can be implemented by the structure of the message synchronization device.
[0220] Corresponding to the above method embodiment, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps can be implemented:
[0221] Generate a message synchronization request based on the message to be synchronized; obtain a preset message execution order for received messages and sent messages; send a message synchronization request to the sub-nodes within the domain and the nodes outside the domain according to the message execution order; receive a first reply message returned by the sub-node within the domain and a second reply message returned by the node outside the domain; wherein the second reply message is information generated after the node outside the domain forwards the message synchronization request to the main node within the domain and receives the third reply message returned by the main node within the domain; when the first reply message and the second reply message are both message updates completed, update the message to be synchronized to the local.
[0222] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0223] For an introduction to the computer-readable storage medium provided by the present invention, please refer to the above method embodiment, and the present invention will not be elaborated here.
[0224] Corresponding to the above method embodiment, the present invention further provides a computer program product, including a computer program, which implements the steps of the above message synchronization method when executed by a processor.
[0225] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the devices, equipment, computer-readable storage media and computer program products disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0226] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the technical solution and core ideas of the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the present invention.
Claims
1. A message synchronization method, characterized in that: include: Generate a message synchronization request according to the message to be synchronized; Get the preset message execution order for received and sent messages; Sending a message synchronization request to the secondary node in the domain and the node outside the domain according to the message execution order; Receive the first reply information returned by the in-domain secondary node and the second reply information returned by the out-domain node; wherein, the second reply information is the information generated after the out-domain node forwards the message synchronization request to the in-domain primary node and receives the third reply information returned by the in-domain primary node for message synchronization; the process of the out-domain node forwarding the message synchronization request to the in-domain primary node includes: determining whether the source node of the message synchronization request is the in-domain primary node of the domain where the out-domain node is located; if not, the out-domain node forwards the message synchronization request to the in-domain primary node; if so, the out-domain node does not forward the message synchronization request to the in-domain primary node; When both the first reply information and the second reply information have completed message updates, the message to be synchronized is updated locally.
2. The message synchronization method according to claim 1, characterized in that: After sending the message synchronization request to the secondary node in the domain and the node outside the domain according to the message execution order, it also includes: Generate a local sending waiting state flag corresponding to the message to be synchronized; Obtain a status flag queue generated according to the message execution order and existing pending messages; The local sending waiting state flag is inserted into the state flag queue according to the message execution order.
3. The message synchronization method according to claim 2, characterized in that: After receiving the first reply information returned by the in-domain secondary node and the second reply information returned by the out-domain node, the method further includes: Generate a local processing status flag corresponding to the message to be synchronized; The local sending waiting state flag corresponding to the message to be synchronized is replaced by the local processing state flag.
4. The message synchronization method according to claim 3, characterized in that: After the message to be synchronized is updated locally, the method further includes: The local processing status flag corresponding to the message to be synchronized is replaced with a normal status flag.
5. The message synchronization method according to claim 3, characterized in that: After inserting the local sending waiting state flag into the state flag queue according to the message execution order, and before receiving the first reply information returned by the in-domain secondary node and the second reply information returned by the out-domain node, the method further includes: When receiving a message sent by the out-of-domain node and / or the in-domain master node, generating a conflict status flag; The conflict status flag is used to replace the local sending waiting state flag corresponding to the message to be synchronized.
6. The message synchronization method according to claim 5, characterized in that: After replacing the local sending waiting state flag corresponding to the message to be synchronized with the conflict state flag, the method further includes: Find out whether there is a remote message status flag in the status flag queue; If yes, then generate a remote message waiting state flag corresponding to the message sent by the out-of-domain node and / or the in-domain master node; Inserting the remote message waiting state flag into the tail of the remote message state flag in the state flag queue; Replacing the conflict state flag corresponding to the message to be synchronized with the local sending waiting state flag; If not, when it is determined that the local transmission is processed first according to the message execution order, a remote end waiting superposition state flag in the local processing is generated; Replacing the conflict state flag corresponding to the message to be synchronized with the remote end waiting superposition state flag in the local processing; When it is determined that the peer end message is processed first according to the message execution order, a local ready superposition state flag in remote processing is generated; The conflict state flag corresponding to the message to be synchronized is replaced by the local ready superposition state flag in the remote processing.
7. The message synchronization method according to claim 2, characterized in that: Also includes: Receiving a message to be forwarded sent by the out-of-domain node; Generate a local forwarding waiting state flag according to the message to be forwarded; The local forwarding waiting state flag is added to the state flag queue.
8. The message synchronization method according to claim 7, characterized in that: Adding the local forwarding waiting state flag to the state flag queue includes: Find out whether there is a local message status flag in the status flag queue; If so, the local forwarding waiting state flag is added to the tail of the local message state flag in the state flag queue.
9. The message synchronization method according to claim 8, characterized in that: When it is determined that the status flag queue does not have a local message status flag, the method further includes: Determine whether there is a remote message status flag in the status flag queue; If not, the local forwarding waiting state flag is added to the head of the state flag queue.
10. The message synchronization method according to claim 9, characterized in that: When it is determined that the status mark queue does not have a local message status mark but has a remote message status mark, the method further includes: When it is determined that local transmission is given priority according to the message execution order, inserting the local forwarding waiting state flag into the head of the state flag queue; When it is determined to process the peer message preferentially according to the message execution order, the local forwarding waiting state flag is inserted into the tail of the state flag queue.
11. The message synchronization method according to any one of claims 7 to 10, characterized in that: Also includes: After forwarding the message to be forwarded to the secondary node in the domain, replacing the local forwarding waiting state flag with the local sending waiting remote waiting superposition state flag; When receiving a reply message returned by the secondary node in the domain, converting the local sending waiting remote waiting superposition state flag into a local processing remote waiting superposition state flag; The message to be forwarded is updated locally, and the remote waiting superposition state flag in the local processing is converted into a remote message waiting state flag; Return forwarding and updating completion reply information to the out-of-domain node, and convert the remote message waiting state flag into a remote message processing state flag; When the message receiving completion reply information returned by the out-of-domain node is received, the remote message processing status flag is converted into a normal flag.
12. The message synchronization method according to claim 2, characterized in that: Also includes: Each to-be-processed message in the status mark queue is processed in the order of remote message processing first and local message processing later.
13. A message synchronization device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the message synchronization method according to any one of claims 1 to 12 when executing the computer program.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the message synchronization method according to any one of claims 1 to 12 are implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the message synchronization method according to any one of claims 1 to 12 are implemented.
