WO2018120810A1 - Method and system for solving data collision - Google Patents

Method and system for solving data collision Download PDF

Info

Publication number
WO2018120810A1
WO2018120810A1 PCT/CN2017/094317 CN2017094317W WO2018120810A1 WO 2018120810 A1 WO2018120810 A1 WO 2018120810A1 CN 2017094317 W CN2017094317 W CN 2017094317W WO 2018120810 A1 WO2018120810 A1 WO 2018120810A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
storage node
node
partial order
order relationship
Prior art date
Application number
PCT/CN2017/094317
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 WO2018120810A1 publication Critical patent/WO2018120810A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems

Definitions

  • the present application relates to the field of communications technologies, and in particular, to a method and system for resolving data conflicts.
  • the current active or active system allows data to be written from two or more nodes, and the written data needs to be copied to other nodes so that the data on multiple nodes is consistent.
  • the write sequence is inconsistent due to the write sequence and the network, disk, etc., and data conflict occurs, so that when multiple nodes are successfully written, the data is in multiple
  • the nodes are in an inconsistent state, resulting in different data being read from different nodes. For example, three nodes modify C separately, and the final data of the three nodes is different because the writing order is inconsistent.
  • the first solution is to use distributed locks to solve the problem of data conflicts between multiple nodes.
  • When writing data to the node first apply for a lock to the distributed lock server, and then release the lock after writing the data.
  • This method can ensure that the modification of the same data is performed serially at different nodes, thereby ensuring that multi-node data inconsistency does not occur.
  • Node1, Node2, and Node3 all store data C.
  • Node1 first applies a lock to data C to the distributed lock server, and then all three nodes are modified to C1, and then When Node2 applies for the lock of data C to the distributed lock server, all three nodes are modified to C2.
  • Node3 applies the lock to C to the distributed lock server, and all three nodes are modified to C3.
  • the data in the last three nodes is consistent and both are C3.
  • this method will generate an invalid lock request without a write conflict, resulting in a decline in overall system performance.
  • the second solution is to use priority locks to resolve data conflicts between multiple nodes.
  • When writing data to the node first try to apply for a lock to the distributed lock server. After the trial lock application is successful, each node is determined. Write data concurrently.
  • the lock of the node with the lower priority is forcibly released according to the priority of each node, and the data corresponding to the node with the lower priority is rewritten after the node with the higher priority writes the data.
  • the lock application becomes a distributed lock in the cluster, which leads to the performance degradation of the system and the versatility is not good.
  • the application provides a method system for solving data conflicts.
  • a method for resolving data conflicts in a multi-active system includes an access node and a storage node, and the method includes: the access node receives the first data update request sent by the client, and the first data is received.
  • the update request generates a globally unique version number; the access node sends a second data update request to the storage node, where the second data update request carries the version number; and the storage node updates the corresponding data according to the second data update request, and the update is updated.
  • Sorting the relationship and returning the partial order relationship to the access node wherein the partial order relationship is used to record the sequence of the version numbers of the data update requests received by the storage node; the access node obtains the partial order returned by the storage node
  • the relationship determines whether there is a conflict in the data in the storage node; when there is a conflict in the data in the storage node, the access node adjusts the conflict.
  • the receiving node adjusts the conflict of data only when there is a conflict in the data in the storage node.
  • the receiving node performs the data update operation normally, which greatly improves the data updating efficiency.
  • the access node determines whether there is a conflict in the data in the storage node, specifically: when the acquired partial storage relationship of the storage node is inconsistent, the access node determines that the data in the storage node exists conflict.
  • the access node can determine whether the data in the storage node is consistent according to the partial order relationship, and can quickly identify the data conflict existing in the storage node and improve the performance of the system.
  • the access node determines whether there is a conflict in the data in the storage node, specifically: when the received storage node's partial order relationship is inconsistent, the access node reacquires the storage within a predetermined time period.
  • the partial order relationship of the nodes when the re-acquisition of the storage node's partial order relationship is inconsistent, the access node determines that there is a conflict in the data in the storage node.
  • the partial order relationship acquired at different times may be different. And when the partial order relationship of different storage nodes is different, there may be a receiving node that adjusts the data conflict, so a time period can be set, and the receiving node can obtain the partial order relationship of the storage node multiple times in the set time period. Compare them, instead of making adjustments as soon as the partial order relationship is inconsistent, to improve the efficiency of resolving data conflicts.
  • the access node adjusts the conflict by: the access node sends a third data update request to the storage node according to the conflict adjustment policy, where the third data update request includes a partial order relationship that needs to be adjusted; After receiving the third data update request, the node updates the data in the storage node according to the partial order relationship that needs to be adjusted.
  • the conflict adjustment strategy includes a storage node priority policy and a partial order relationship priority policy.
  • the storage node priority policy is to adjust the data in the storage node with lower priority by the partial order relationship of the storage node with higher priority.
  • the partial order relationship priority policy is to adjust the data in the storage node in order of the size of the version number in the partial order relationship.
  • a multi-active system in a second aspect, includes multiple access nodes and multiple storage nodes, and the access node is connected to the client, and the access node is configured to receive the first data sent by the client. Updating the request, and generating a globally unique version number for the first data update request; sending a second data update request to the storage node, where the second data update request carries the version number; and the storage node is configured to update the request according to the second data Updating the corresponding data, updating the partial order relationship, and returning the partial order relationship to the access node; wherein the partial order relationship is used to record the sequence of the version number of the data update request received by the storage node; Obtaining a partial order relationship returned by the storage node, determining whether there is a conflict in the data in the storage node; and adjusting the conflict when there is a conflict in the data in the storage node.
  • the determining, by the access node, whether the data in the storage node is in conflict is: determining, when the acquired partial storage relationship of the storage node is inconsistent, determining the There is a conflict in the data.
  • the access node is configured to determine whether the data in the storage node has a conflict: when the received storage node has a misaligned relationship, the access node reacquires the storage within a predetermined time period. a partial order relationship of the nodes, when the re-acquisition of the storage node's partial order relationship is inconsistent, determining the number in the storage node There are conflicts.
  • the access node is used to adjust the conflict specifically:
  • the conflict adjustment policy includes a storage node priority policy and a partial order relationship priority policy; After receiving the third data update request, the data in the storage node is updated according to a partial order relationship that needs to be adjusted.
  • the access node and the storage node are located in the same physical device.
  • a third aspect provides an apparatus for resolving data conflicts, including a processor, a communication bus, a memory, and a communication interface.
  • the processor is configured to perform the foregoing method for resolving data conflicts, which is not described herein.
  • FIG. 1 is a schematic structural diagram of a multi-active system according to an embodiment of the present application.
  • FIG. 2 is a schematic flowchart of a method for resolving data conflicts according to an embodiment of the present application
  • FIG. 3 is a schematic structural diagram of an apparatus for resolving data conflicts according to an embodiment of the present disclosure.
  • Embodiments of the present invention provide a method and system for resolving data conflicts, which can quickly identify data conflicts and resolve data conflicts, and the write performance of the system is higher.
  • the embodiment of the present invention relates to a dual-active or multi-active system.
  • a multi-active system is taken as an example for description.
  • the multi-active system 10 is divided into three logical layers: a client layer 11, an access node layer 12, and a storage node layer 13.
  • Client layer 11 The user inputs data through the client, and the client sends the data to the receiving node.
  • the receiving node layer 12 receives the data sent by the client and writes the received data into the storage node.
  • Storage node layer 13 stores data.
  • the physical client, the access node, and the storage node may be on the same physical device (for example, a node device), or may be on different physical devices, which is not limited in the embodiment of the present invention.
  • the write performance of the update operation is low.
  • the present invention it is first considered that most of the nodes do not have conflicts when performing update operations on data, and the probability that multiple nodes perform update operations on the same data at the same time is small. Therefore, when the data is updated in the multi-live system, the data is first written to the storage node, and after the data is written, the conflict is found and the data conflict is resolved.
  • the receiving node layer in the multi-active system includes the receiving node 1 and the receiving section.
  • the storage node layer includes a storage node 1 and a storage node 2.
  • the receiving node 1 can update the data in the storage node 1 and the storage node 2; the receiving node 2 can update the data in the storage node 1 and the storage node 2.
  • the number of receiving nodes and storage nodes in the embodiment of the present invention is merely an exemplary description, and the number of receiving nodes and storage nodes may be set according to services or user requirements.
  • data is already stored on the storage node 1.
  • V1 the data already stored in the storage node
  • K1 the key of the data V1
  • Ver1 the version number
  • the data in the storage node 1 in order to distinguish from the data of the subsequent update, record the data in the storage node 1 as K1 (V1, [Ver1]).
  • the data V1 stored in the storage node 2 is the same as the data V1 in the storage node 1, and is also recorded as K1 (V1, [Ver1]).
  • K1 V1, [Ver1]
  • K1 the data V1 stored in the storage node 3
  • K1 V1, [Ver1]
  • the version number is a globally unique version number assigned to the data when the receiving node receives the data operation instruction, and is stored in the storage node together with the data.
  • the version number can be used for different data update operations in the zone.
  • the version number is recorded as Ver1 for easy identification, and in actual applications, the version number may be a combination of multiple letters and/or numbers.
  • the calculation of the version number can be implemented by using an existing algorithm, which is not described in the embodiment of the present invention.
  • client 1 updates the data K1 pair, and the updated data is V2.
  • client 2 updates the data corresponding to the data K1, and the updated data is V3.
  • the method for resolving data conflicts provided by the embodiments of the present invention is as follows, as shown in FIG. 2.
  • Step 201 The access node receives a data update request sent by the client, and generates a globally unique version number for the data update operation.
  • the data update request sent by the client to the access node is referred to as a first data update request to distinguish it from other data update requests below.
  • This version number is used to identify the data update request. Since the version number is a globally unique version number, each data update request can be distinguished from other data update requests.
  • the access node 1 receives the data update request put(k1, V2) of the client 1, that is, updates the data of the data K1, and the updated data content is V2, and the access node 1 generates a global unique for the data update request. Version number Ver2.
  • the access node 2 receives the data update request put(k1, V3) of the client 2, that is, updates the data K1, and the updated data content is V3, and the access node generates a globally unique version for the data update request access. No. Ver3.
  • Step 203 The access node sends a data update request to the storage node, where the version update number includes the version number.
  • the content included in the data update request sent by the access node to the storage node is different.
  • the data update request is referred to as a second data update request.
  • the second data update request includes a version number generated by the access node for the first data update request.
  • the access node After receiving the first data update request sent by the client, the access node generates a globally unique version number for the first data update request, and sends a second data update request including the version number to the storage node.
  • a multi-active system will include multiple access nodes and multiple storage nodes, so the access node will send a second data update request to all storage nodes in the multi-active system to ensure data retention in these storage nodes. Consistent.
  • the access node 1 transmits a data update request put (K1, V2, Ver2) including a version number to the storage node 1, the storage node 2, and the storage node 3, respectively.
  • the access node 2 transmits data and data version number data update requests put(K1, V3, Ver3) to the storage node 1, the storage node 2, and the storage node 3, respectively.
  • Step 205 The storage node updates the corresponding data according to the second data update request, records the partial order relationship, and returns the partial order relationship to the access node.
  • the partial order relationship is used to record the sequence of the version numbers of the data update requests received by the storage node.
  • the storage node After receiving the data update request sent by the access node and including the version number, the storage node finds the corresponding data according to the key value in the data update request, and updates the data in the order of receiving the data update request, and records the data update.
  • the order of the requested version numbers that is, the partial order relationship, returns the partial order relationship to the access node.
  • the partial order relationship is used to record the sequence of the version numbers of the data update requests received by the storage node. After the storage node receives the data update request and updates the data once, the corresponding update is a partial order relationship. Therefore, the partial order relationships obtained at different times may be different.
  • the version number information in the partial order relationship may be aged according to a certain rule. For example, when the version number information in the partial order relationship reaches a certain number, the oldest version number information is deleted from the partial order relationship; or when all the systems are in the system. When the order of some version number information in the partial order relationship of the same data in the storage node is completely the same, the version number information of the same order may be deleted from the partial order relationship. In the embodiment of the present application, the aging of the partial order relationship is not involved, and thus will not be described in detail.
  • the order of data update requests received by the respective storage nodes for the same data may be the same, or may be the same. are different. Therefore, the partial order relationship of storage nodes may or may not be the same.
  • the storage node 1 first receives the data update request put(K1, V2, Ver2) for the data K1 sent by the access node 1, that is, the update operation of the data K1 is required, and the updated data content is V2, and the data update request is The version number is Ver2.
  • the version number of the data K1 already exists in the storage node 1 is Ver1
  • the update partial order relationship is [Ver2 ⁇ -Ver1]
  • the partial order relationship is [Ver2, Ver1].
  • the storage node 1 receives the data update request put (K1, V3, Ver3) for the data K1 sent by the access node 2, that is, the storage node 1 updates the data K1 with the operation data content V3, and the version number of the data update request is Ver3. After the storage node 1 updates the data K1 according to V3, the update partial order relationship is [Ver3 ⁇ -Ver2 ⁇ -Ver1], and the partial order relationship returned to the access node 2 is [Ver3, Ver2, Ver1].
  • the storage node 2 first receives the data update request put (K1, V3, Ver3) for the data K1 sent by the access node 2, that is, the storage node 2 updates the data K1 with the data content V3, and the data update request version number is Ver3. After the storage node 2 updates the data K1 according to V3, the update partial order relationship is [Ver3 ⁇ -Ver1], and the partial order relationship returned to the access node 2 is [Ver3, Ver1].
  • the storage node 2 receives the data update request put (K1, V2, Ver2) for the data K1 sent by the access node 1, that is, the update operation of the data K1 is required, the updated data content is V2, and the version number of the data update request is Ver2. After the storage node 2 updates the data K1 according to V3, the update partial order relationship is [Ver2 ⁇ -Ver3 ⁇ -Ver1], and the partial order relationship returned to the access node 1 is [Ver2, Ver3, Ver1].
  • Step 207 The access node acquires a partial order relationship returned by the storage node, and determines whether there is a conflict in the data in the storage node.
  • the storage node updates the partial order relationship after the data is updated, so the partial order relationship may reflect the update order of the same data in the storage node. Therefore, the receiving node can determine whether the same data in the plurality of storage nodes in the system has a conflict according to whether the partial order relationship of the same data returned by the plurality of storage nodes in the system is consistent.
  • the method for determining whether the partial order relationship returned by the storage node is consistent is as follows:
  • the storage node returns the same partial order relationship in the system, that is to say, the order of updating the same data by these storage nodes is the same. At this time, the contents of the same data stored in these storage nodes are the same, and there is no conflict.
  • a time period may be set, and the access is performed within the set time period.
  • the node obtains the partial order relationship of the storage node multiple times, and uses the last obtained partial order relationship to determine whether there is a conflict in the same data stored in the storage node.
  • the partial order relationships returned by the multiple storage nodes are different, it is further determined whether the first version number in the partial order relationship is the same, and when the first version number in the partial order relationship is the same, You can select a storage node with a small version number in the partial order relationship to obtain the partial order relationship again for comparison.
  • the partial order relationship of the data K1 returned by the storage node 1 received by the access node 1 is [Ver2, Ver1]
  • the partial order relationship of the data K1 returned by the storage node 2 received by the access node 1 is [Ver3, Ver1].
  • the access node 1 judges that the partial order relationship returned by the storage node 1 and the storage node 2 is different. At this time, it can be determined that the data K1 stored in the storage node 1 and the storage node 2 are inconsistent and conflict.
  • the acquisition time of the partial order relationship is set, if the time range of the partial order relationship acquisition time is also within, the access node 1 may obtain the partial order relationship of the data K1 from the storage node 1 and the storage node 2 again.
  • the partial order relationship acquired by the access node 1 from the storage node 1 is [Ver3, Ver2, Ver1]. At this time, if the partial order relationship returned by the storage node 2 has not been updated, or [Ver3, Ver1] ].
  • the access node 1 confirms that the partial order relationship returned by the storage node 1 and the storage node 2 is different. At this time, it can be determined that the data K1 stored in the storage node 1 and the storage node 2 are inconsistent and conflict.
  • the access node 1 determines that the partial order relationship between the storage node 1 and the storage node 2 is different, but at this time, the first version numbers of the two partial order relationships are the same, both are Ver3; and the storage node 2 is ordered. The number of version numbers in the relationship is small, and the access node 1 obtains the partial order relationship from the storage node 2. At this time, the partial order relationship of the storage node 2 is [Ver2 ⁇ -Ver3 ⁇ -Ver1], and the access node 1 confirms the storage. The partial order relationship returned by the node 1 and the storage node 2 is different. At this time, it can be determined that the data K1 stored in the storage node 1 and the storage node 2 are inconsistent and conflict.
  • the access node 1 determines that the partial order relationship between the storage node 1 and the storage node 2 is different. If the acquisition time of the partial order relationship is set, and the access node is also in the time period of the partial order relationship acquisition time, the access node 1 The partial order relationship of the data K1 can be read from the storage node 1 and the storage node 2. When the partial order relationship of the data K1 acquired by the access node 1 from the storage node 1 is [Ver3, Ver2, Ver1], the partial order relationship of the data K1 acquired from the storage node 2 is [Ver2, Ver3, Ver1]. At this time, the access node 1 judges that the data K1 stored on the storage node 1 is inconsistent with the data K1 stored on the storage node 2, and there is a conflict.
  • the determination of the partial order relationship received by the access node 2 from the storage node 1 and the storage node 2 is the same as that of the access node 1 described above, and will not be further described herein.
  • Step 209 When there is a conflict in the data in the storage node, the access node adjusts the conflict of the data.
  • the access node determines that there is a conflict between the same data stored on the storage node of the system, the conflict needs to be adjusted.
  • the embodiment of the present application provides two strategies for adjusting data conflicts as an exemplary description. In practical applications, it can also Other strategies are adopted as long as the access nodes in the system comply with each other.
  • the first is based on the storage node priority policy.
  • the data conflict is adjusted based on the data of the storage node with the highest priority. For example, as described above, the partial order relationship of the data K1 acquired by the access node 1 from the storage node 1 is [Ver2, Ver1], and the partial order relationship of the data K1 acquired from the storage node 2 is [Ver2, Ver3, Ver1].
  • the partial order relationship of the data K1 acquired by the access node 1 from the storage node 1 is different from the partial order relationship of the data K1 acquired from the storage node 2, and the first version in the partial order relationship
  • the number is Ver2, the access node 1 obtains the partial order relationship of the storage node 1, and obtains a new partial order relationship [Ver3, Ver2, Ver1]; the access node determines that the data K1 in the storage node 1 and the storage node 2 conflicts.
  • the priority of the storage node 1 is higher than the priority of the storage node 2, and the access node 1 adjusts the data in the storage node 2 with the data in the storage node 1.
  • the access node 1 transmits a data update request put (K1, V3, Ver3 ⁇ -Ver2) to the storage node 2, and the request carries a partial order relationship that needs to be adjusted.
  • the storage node 2 adjusts the stored data and updates the partial order relationship.
  • the access node 2 also acquires the partial order relationship of the data K1 from the storage node 1 and the storage node 2, and the processing method is the same as that of the access node 1.
  • the partial order relationship obtained by the access node 2 from the storage node 2 may be the adjusted partial order relationship of the access node 1, and the partial order relationship between the storage node 1 and the storage node 2 acquired by the access node 2 is the same, that is, There is no conflict between the data K1 in the storage node 1 and the storage node 2.
  • the processing method of the access node 2 is the same as that of the access node 1, and will not be further described.
  • the second type is the partial order relationship priority strategy, which is to adjust the conflict of data in the storage node in the order of the size of the version number in the partial order relationship. Since the partial order relationship indicates the order of the version numbers of the data update requests, the version number written by the storage node may be larger than the version written later. Under this strategy, data conflicts are adjusted based on the partial order relationship of the version numbers in the partial order relationship from large to small. For example, as described above, the partial order relationship of the data K1 acquired by the access node 1 from the storage node 1 is [Ver3, Ver2, Ver1], and the partial order relationship of the data K1 acquired from the storage node 2 is [Ver2, Ver3, Ver1] ].
  • the version numbers of the partial order relationship of the data K1 returned by the access node 1 from the storage node 1 are arranged from large to small, so that the data in the storage node 1 is unchanged, and according to the partial order relationship of the data K1 in the storage node 1.
  • the data K1 in the storage node 2 is adjusted so that the data in the storage node 1 and the storage node 2 are identical.
  • the access node 1 sends a data update request to the storage node 2, and the request carries a partial order relationship that needs to be adjusted. After receiving the data update request, the storage node 2 adjusts the stored data according to the partial order relationship that needs to be adjusted.
  • the processing method of the access node 2 is the same as that of the access node 1, and will not be further described.
  • the access node does not process and continues to process the service normally.
  • the embodiment of the present invention further provides a multi-active system for solving data conflicts.
  • the architecture of the multi-live system is as shown in FIG. 1.
  • the multi-active system is divided into three logical layers: a client layer 11, an access node layer 12, and a storage node layer 13.
  • Client layer 11 includes multiple clients. Two clients, client 1 and client 2, are exemplarily shown in FIG. The client is configured to send a first data update request to the receiving node.
  • Receive Node Layer 12 includes a plurality of receiving nodes. Two receiving nodes, receiving node 1 and receiving node 2 are exemplarily shown in FIG.
  • Storage node layer 13 includes a plurality of storage nodes, and two storage nodes, storage node 1 and storage node 2 are exemplarily shown in FIG.
  • the receiving node is configured to receive a first data update request sent by the client, generate a globally unique version number for the first data update request, and send a second data update request to the storage node, where the second data update request carries The version number.
  • the storage node is configured to update the corresponding data according to the second data update request, and update the partial order relationship, and return the partial order relationship to the receiving node; wherein the partial order relationship is used to record the data update request received by the storage node.
  • the order of the version numbers are configured to update the corresponding data according to the second data update request, and update the partial order relationship, and return the partial order relationship to the receiving node; wherein the partial order relationship is used to record the data update request received by the storage node.
  • the receiving node is further configured to obtain a partial order relationship returned by the storage node, determine whether there is a conflict in the data in the storage node, and adjust a conflict in the data when there is a conflict in the data in the storage node.
  • the receiving node adjusts the conflict of data only when there is a conflict in the data in the storage node.
  • the receiving node performs the data update operation normally, which greatly improves the data updating efficiency.
  • the access node is configured to determine whether the data in the storage node is in conflict. The access node determines that the data in the storage node conflicts.
  • the access node can determine whether the data in the storage node is consistent according to the partial order relationship, and can quickly identify the data conflict existing in the storage node and improve the performance of the system.
  • the access node is configured to determine whether the data in the storage node is in conflict, and may be: when the received storage node has a misaligned relationship, the access node is re-established within a predetermined time period. Acquiring a partial order relationship of the storage node, when the re-acquisition of the storage node's partial order relationship is inconsistent, the access node determines that the data in the storage node has a conflict.
  • the partial order relationship acquired at different times may be different. And when the partial order relationship of different storage nodes is different, there may be a receiving node that adjusts the data conflict, so a time period can be set, and the receiving node can obtain the partial order relationship of the storage node multiple times in the set time period. Compare them, instead of making adjustments as soon as the partial order relationship is inconsistent, to improve the efficiency of resolving data conflicts.
  • the length of the specific time period can be set according to the type of service, the load of the system, or the needs of the user.
  • the receiving node determines whether there is a conflict in the same in the storage node.
  • the access node is configured to adjust the conflict, where the access node is configured to send a third data update request to the storage node according to the conflict adjustment policy, where the third data update request includes a partial order relationship that needs to be adjusted;
  • the storage node is further configured to: after receiving the third data update request, update the data in the storage node according to the partial order relationship adjusted.
  • the conflict adjustment policy includes a storage node priority policy and a partial order relationship priority policy.
  • the storage node priority policy is to adjust the data in the storage node with lower priority by the partial order relationship of the storage node with higher priority.
  • the partial order relationship priority policy is to adjust the data in the storage node in order of size of the version number in the partial order relationship.
  • the access node and the storage node can be on the same physical device (such as a node device) or in different objects.
  • the device is not limited in the embodiment of the present invention.
  • the present application can be implemented in hardware or a combination of hardware and computer software in combination with the elements and method steps of the various examples described in the embodiments disclosed herein. Whether a function is implemented in hardware or computer software to drive hardware depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods to implement the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present application.
  • FIG. 3 is a schematic diagram of a hardware structure of an apparatus for resolving data conflicts according to an embodiment of the present application.
  • the apparatus 300 for resolving data conflicts includes at least one processor 301, a communication bus 302, a memory 303, and at least one communication interface. 304.
  • the processor 301 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more programs for controlling the execution of the program of the present application. integrated circuit.
  • CPU central processing unit
  • ASIC application-specific integrated circuit
  • Communication bus 302 can include a path for communicating information between the components described above.
  • the communication interface 304 uses a device such as any transceiver for communicating with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc. .
  • a device such as any transceiver for communicating with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc. .
  • RAN Radio Access Network
  • WLAN Wireless Local Area Networks
  • the memory 303 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type that can store information and instructions.
  • the dynamic storage device can also be an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disc storage, and a disc storage device. (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be Any other media accessed, but not limited to this.
  • the memory can exist independently and be connected to the processor via a bus.
  • the memory can also be integrated with the processor.
  • the memory 303 is used to store application code for executing the solution of the present application, and is controlled by the processor 301 for execution.
  • the processor 301 is configured to execute the application code stored in the memory 33, thereby implementing the method of allocating resources in the multi-CPU system described in the above embodiments.
  • processor 301 may include one or more CPUs, such as CPU0 and CPU1 in FIG.
  • apparatus 300 for resolving data conflicts may include multiple processors, such as processor 301 and processor 308 in FIG. Each of these processors can be a single-CPU processor or a multi-core processor.
  • a processor herein may refer to one or more devices, circuits, and/or processing cores for processing data, such as computer program instructions.
  • the apparatus 300 for resolving data conflicts may further include an output device 305 and an input device 306.
  • Output device 305 is in communication with processor 301 and can display information in a variety of ways.
  • the output device 305 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector.
  • Input device 306 is in communication with processor 301 and can accept user input in a variety of ways.
  • input device 806 can be a mouse, keyboard, touch screen device, or sensing device, and the like.
  • the above device 300 for resolving data conflicts may be a general purpose server or a dedicated server.
  • the device 300 for resolving data conflicts may be a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet, a wireless terminal device, a communication device, an embedded device, or A device of similar construction in Figure 3.
  • PDA personal digital assistant
  • the embodiment of the present application does not limit the type of device 300 that resolves data conflicts.
  • the device for resolving data conflicts provided by the embodiment of the present application can be used to perform the foregoing method for allocating resources in a multi-CPU system. Therefore, the technical effects that can be obtained by reference to the foregoing method embodiments are not described herein. .
  • the embodiment of the present application further provides a computer storage medium for storing computer software instructions for the above-mentioned device for resolving data conflicts, which comprises a program designed to execute the foregoing method embodiments.
  • a method of resource allocation can be implemented in a multi-CPU system by executing a stored program.
  • the embodiment of the present application further provides a computer program, which includes instructions, when the computer program is executed by a computer, to enable the computer to execute the flow of the foregoing method embodiment.
  • embodiments of the present application can be provided as a method, apparatus (device), or computer program product.
  • the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment in combination of software and hardware.
  • the application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • the computer program is stored/distributed in a suitable medium, provided with other hardware or as part of the hardware, or in other distributed forms, such as over the Internet or other wired or wireless telecommunication systems.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions are provided for implementing one or more processes and/or block diagrams in the flowchart The steps of the function specified in the box or in multiple boxes.

Landscapes

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

Abstract

A method for solving data collision in a multi-activity system. The method comprises: an access node receiving a first data update request sent by a client, and generating a global unique version number for the first data update request; the access node sending a second data update request to a storage node, wherein the second data update request carries the version number; the storage node updating corresponding data and a partial order relation according to the second data update request, and returning the partial order relation back to the access node, wherein the partial order relation is used for recording the sequence of the version numbers of the data update requests received by the storage node; the access node acquiring the partial order relation returned by the storage node, and determining whether collision of data has occurred in the storage node; and when collision of data has occurred in the storage node, the access node adjusting the collision. When collision of data has occurred in a storage node, an access node adjusts the collision of data, so that the data update efficiency is greatly improved.

Description

一种解决数据冲突的方法和***Method and system for solving data conflict 技术领域Technical field
本申请涉及通信技术领域,尤其涉及一种解决数据冲突的方法和***。The present application relates to the field of communications technologies, and in particular, to a method and system for resolving data conflicts.
背景技术Background technique
当前双活或者多活***,允许数据从两个或者多个节点写入,同时需要将写入的数据复制到其它节点中,使得多个节点上的数据达到一致。The current active or active system allows data to be written from two or more nodes, and the written data needs to be copied to other nodes so that the data on multiple nodes is consistent.
当多个节点同时对一份数据进行修改时,由于写入时序和网络、磁盘等原因造成写入先后顺序的不一致,出现数据冲突,从而多节点都写入成功的情况下,数据在多个节点上处于不一致的状态,导致从不同节点读取出来的数据不一样。例如,三个节点分别对C进行修改,由于写入顺序不一致,导致三个节点最终的数据不相同。When multiple nodes modify a piece of data at the same time, the write sequence is inconsistent due to the write sequence and the network, disk, etc., and data conflict occurs, so that when multiple nodes are successfully written, the data is in multiple The nodes are in an inconsistent state, resulting in different data being read from different nodes. For example, three nodes modify C separately, and the final data of the three nodes is different because the writing order is inconsistent.
现有技术为了处理这种从多个节点同时写入数据导致数据冲突,造成多节点间数据不一致的场景,提出了两种比较通用的解决方法。In the prior art, in order to deal with such a situation that data is conflicted from simultaneous writing of data from multiple nodes, resulting in inconsistent data between multiple nodes, two common solutions are proposed.
第一种解决方法是利用分布式锁来解决多个节点之间数据冲突的问题。向节点写入数据时先向分布式锁服务器申请锁,写完数据后再释放锁。这种方式能够保证同一份数据的修改在不同节点操作串行进行,从而保证了不会出现多节点数据不一致的情况。例如Node1、Node2和Node3上都存储有数据C,现在三个节点需要分别对数据C进行修改时,Node1先向分布式锁服务器申请到数据C的锁,则三个节点都修改为C1,然后Node2向分布式锁服务器申请到数据C的锁,则三个节点都修改为C2,最后Node3向分布式锁服务器申请到C的锁,则三个节点都修改为C3。最后三个节点中的数据一致,都为C3。不过此方法在没有写冲突时会产生无效的锁申请,导致***整体性能下降。The first solution is to use distributed locks to solve the problem of data conflicts between multiple nodes. When writing data to the node, first apply for a lock to the distributed lock server, and then release the lock after writing the data. This method can ensure that the modification of the same data is performed serially at different nodes, thereby ensuring that multi-node data inconsistency does not occur. For example, Node1, Node2, and Node3 all store data C. Now, when three nodes need to modify data C separately, Node1 first applies a lock to data C to the distributed lock server, and then all three nodes are modified to C1, and then When Node2 applies for the lock of data C to the distributed lock server, all three nodes are modified to C2. Finally, Node3 applies the lock to C to the distributed lock server, and all three nodes are modified to C3. The data in the last three nodes is consistent and both are C3. However, this method will generate an invalid lock request without a write conflict, resulting in a decline in overall system performance.
第二种解决方法是采用优先级锁来解决多个节点之间数据冲突的问题。在配置***中各个节点的多活关系时,确定各个节点的优先级,当往节点中写入数据时首先向分布式锁服务器尝试去申请锁(try lock),试锁申请成功后,各个节点并发写入数据。当有写入冲突出现死锁时根据各个节点的优先级强制解除优先级低的节点的锁,待优先级高的节点写完数据之后优先级较低的节点对应的数据进行重写。当***中的节点数量较多形成集群时,锁申请成为一个集群内的分布式锁,导致***的性能下降,通用性不好。The second solution is to use priority locks to resolve data conflicts between multiple nodes. When configuring the multi-live relationship of each node in the system, determine the priority of each node. When writing data to the node, first try to apply for a lock to the distributed lock server. After the trial lock application is successful, each node is determined. Write data concurrently. When there is a deadlock in a write conflict, the lock of the node with the lower priority is forcibly released according to the priority of each node, and the data corresponding to the node with the lower priority is rewritten after the node with the higher priority writes the data. When the number of nodes in the system is large and the cluster is formed, the lock application becomes a distributed lock in the cluster, which leads to the performance degradation of the system and the versatility is not good.
发明内容Summary of the invention
本申请提供一种解决数据冲突的方法***,。The application provides a method system for solving data conflicts.
第一方面,提供一种多活***中解决数据冲突的方法,多活***包含接入节点和存储节点,方法包括:接入节点接收客户端发送的第一数据更新请求,并对第一数据更新请求生成一个全球唯一的版本号;接入节点向存储节点发送第二数据更新请求,第二数据更新请求中携带所述版本号;存储节点根据第二数据更新请求更新对应的数据,更新偏序关系,并向接入节点返回所述偏序关系;其中,偏序关系用于记录存储节点接收到的数据更新请求的版本号的先后顺序;接入节点获取所述存储节点返回的偏序关系,判断存储节点中的所述数据是否存在冲突;当存储节点中的所述数据存在冲突时,接入节点调整所述冲突。 In a first aspect, a method for resolving data conflicts in a multi-active system is provided. The multi-active system includes an access node and a storage node, and the method includes: the access node receives the first data update request sent by the client, and the first data is received. The update request generates a globally unique version number; the access node sends a second data update request to the storage node, where the second data update request carries the version number; and the storage node updates the corresponding data according to the second data update request, and the update is updated. Sorting the relationship and returning the partial order relationship to the access node; wherein the partial order relationship is used to record the sequence of the version numbers of the data update requests received by the storage node; the access node obtains the partial order returned by the storage node The relationship determines whether there is a conflict in the data in the storage node; when there is a conflict in the data in the storage node, the access node adjusts the conflict.
这样,只有当存储节点中的数据存在冲突时,接收节点才调整数据存在的冲突,当存储节点中的数据不存在冲突时,接收节点正常执行数据更新操作,大大提高了了数据的更新效率。In this way, the receiving node adjusts the conflict of data only when there is a conflict in the data in the storage node. When there is no conflict in the data in the storage node, the receiving node performs the data update operation normally, which greatly improves the data updating efficiency.
在一种可能的设计中,接入节点判断存储节点中的数据是否存在冲突具体为:当获取到的存储节点的偏序关系不一致时,接入节点判断所述存储节点中的所述数据存在冲突。In a possible design, the access node determines whether there is a conflict in the data in the storage node, specifically: when the acquired partial storage relationship of the storage node is inconsistent, the access node determines that the data in the storage node exists conflict.
通过增加数据操作请求的版本号的偏序关系,接入节点可以根据偏序关系来判断存储节点中的数据是否一致,能够快速的识别出存储节点中存在的数据冲突,提高***的性能。By increasing the partial order relationship of the version number of the data operation request, the access node can determine whether the data in the storage node is consistent according to the partial order relationship, and can quickly identify the data conflict existing in the storage node and improve the performance of the system.
在一种可能的设计中,接入节点判断存储节点中的数据是否存在冲突具体为:当接收到的存储节点的偏序关系不一致时,在预定的时间周期内接入节点重新获取所述存储节点的偏序关系,当重新获取的所述存储节点的偏序关系不一致时,接入节点判断存储节点中的数据存在冲突。In a possible design, the access node determines whether there is a conflict in the data in the storage node, specifically: when the received storage node's partial order relationship is inconsistent, the access node reacquires the storage within a predetermined time period. The partial order relationship of the nodes, when the re-acquisition of the storage node's partial order relationship is inconsistent, the access node determines that there is a conflict in the data in the storage node.
由于各个存储节点接收数据更新请求的顺序和时间不完全一致,因此不同时间获取的偏序关系可能会不同。并且当不同存储节点的偏序关系不相同时,可能有接收节点会调整数据冲突,因此可以设定一个时间周期,在设定的时间周期内,接收节点可以多次获取存储节点的偏序关系进行比较,而不是一发现偏序关系不一致就马上进行调整,以提高解决数据冲突的效率。Since the order and time of receiving the data update request by each storage node are not completely consistent, the partial order relationship acquired at different times may be different. And when the partial order relationship of different storage nodes is different, there may be a receiving node that adjusts the data conflict, so a time period can be set, and the receiving node can obtain the partial order relationship of the storage node multiple times in the set time period. Compare them, instead of making adjustments as soon as the partial order relationship is inconsistent, to improve the efficiency of resolving data conflicts.
在一种可能的设计中,接入节点调整所述冲突具体为:接入节点根据冲突调整策略向存储节点发送第三数据更新请求,第三数据更新请求中包含需要调整的偏序关系;存储节点接收到第三数据更新请求之后,根据需要调整的偏序关系更新存储节点中的数据。In a possible design, the access node adjusts the conflict by: the access node sends a third data update request to the storage node according to the conflict adjustment policy, where the third data update request includes a partial order relationship that needs to be adjusted; After receiving the third data update request, the node updates the data in the storage node according to the partial order relationship that needs to be adjusted.
在一可能的设计中,冲突调整策略包括存储节点优先级策略和偏序关系优先级策略。存储节点优先级策略为以优先级高的存储节点的偏序关系来调整优先级低的存储节点中的数据。偏序关系优先级策略为按所述偏序关系中的版本号的大小顺序调整所述存储节点中的所述数据。In a possible design, the conflict adjustment strategy includes a storage node priority policy and a partial order relationship priority policy. The storage node priority policy is to adjust the data in the storage node with lower priority by the partial order relationship of the storage node with higher priority. The partial order relationship priority policy is to adjust the data in the storage node in order of the size of the version number in the partial order relationship.
存储节点中数据冲突的解决需要有一致的策略,这样能够在确定存在冲突以后快速的解决。冲突调整策略的具体内容和实现在上文实施例中已有详细的说明和举例,在本实施例中不再另行说明。The resolution of data conflicts in storage nodes requires a consistent strategy so that they can be resolved quickly after determining that there is a conflict. The specific content and implementation of the conflict adjustment policy have been described and exemplified in the above embodiments, and will not be further described in this embodiment.
第二方面,提供一种多活***,所述多活***中包含多个接入节点和多个存储节点,接入节点与客户端连接,接入节点用于接收客户端发送的第一数据更新请求,并对第一数据更新请求生成一个全球唯一的版本号;向存储节点发送第二数据更新请求,第二数据更新请求中携带所述版本号;存储节点用于根据第二数据更新请求更新对应的数据,更新偏序关系,并向接入节点返回所述偏序关系;其中,偏序关系用于记录存储节点接收到的数据更新请求的版本号的先后顺序;接入节点还用于获取存储节点返回的偏序关系,判断存储节点中的数据是否存在冲突;当存储节点中的数据存在冲突时,调整所述冲突。In a second aspect, a multi-active system is provided. The multi-active system includes multiple access nodes and multiple storage nodes, and the access node is connected to the client, and the access node is configured to receive the first data sent by the client. Updating the request, and generating a globally unique version number for the first data update request; sending a second data update request to the storage node, where the second data update request carries the version number; and the storage node is configured to update the request according to the second data Updating the corresponding data, updating the partial order relationship, and returning the partial order relationship to the access node; wherein the partial order relationship is used to record the sequence of the version number of the data update request received by the storage node; Obtaining a partial order relationship returned by the storage node, determining whether there is a conflict in the data in the storage node; and adjusting the conflict when there is a conflict in the data in the storage node.
在一种可能的设计中,接入节点用于判断所述存储节点中的述数据是否存在冲突具体为:当获取到的存储节点的偏序关系不一致时,判断所述存储节点中的所述数据存在冲突。In a possible design, the determining, by the access node, whether the data in the storage node is in conflict is: determining, when the acquired partial storage relationship of the storage node is inconsistent, determining the There is a conflict in the data.
在一种可能的设计中,接入节点用于判断存储节点中的数据是否存在冲突具体为:当接收到的存储节点的偏序关系不一致时,在预定的时间周期内接入节点重新获取存储节点的偏序关系,当重新获取的所述存储节点的偏序关系不一致时,判断存储节点中的所述数 据存在冲突。In a possible design, the access node is configured to determine whether the data in the storage node has a conflict: when the received storage node has a misaligned relationship, the access node reacquires the storage within a predetermined time period. a partial order relationship of the nodes, when the re-acquisition of the storage node's partial order relationship is inconsistent, determining the number in the storage node There are conflicts.
在一种可能的设计中,接入节点用于调整所述冲突具体为:In a possible design, the access node is used to adjust the conflict specifically:
根据冲突调整策略向存储节点发送第三数据更新请求,第三数据更新请求中包含需要调整的偏序关系;其中,冲突调整策略包括存储节点优先级策略和偏序关系优先级策略;存储节点还用于接收到第三数据更新请求之后,根据需要调整的偏序关系更新存储节点中的所述数据。Sending a third data update request to the storage node according to the conflict adjustment policy, where the third data update request includes a partial order relationship that needs to be adjusted; wherein the conflict adjustment policy includes a storage node priority policy and a partial order relationship priority policy; After receiving the third data update request, the data in the storage node is updated according to a partial order relationship that needs to be adjusted.
在一种可能的设计中,接入节点和存储节点位于同一物理设备中。In one possible design, the access node and the storage node are located in the same physical device.
第三方面,提供一种解决数据冲突的装置,包括处理器,通信总线、存储器和通信接口,处理器用于执行上述的解决数据冲突的方法,在此不再另行说明。A third aspect provides an apparatus for resolving data conflicts, including a processor, a communication bus, a memory, and a communication interface. The processor is configured to perform the foregoing method for resolving data conflicts, which is not described herein.
另外,第二方面和第三方面中任一种设计方式所带来的技术效果可参见第一方面中不同设计方式所带来的技术效果,此处不再赘述。In addition, the technical effects brought by any one of the second aspect and the third aspect can be referred to the technical effects brought by different design modes in the first aspect, and details are not described herein again.
附图说明DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below.
图1为本申请实施例提供的多活***的结构示意图;1 is a schematic structural diagram of a multi-active system according to an embodiment of the present application;
图2为本申请实施例提供的解决数据冲突的方法流程示意图;2 is a schematic flowchart of a method for resolving data conflicts according to an embodiment of the present application;
图3为本申请实施例提供的的解决数据冲突的装置的结构示意图。FIG. 3 is a schematic structural diagram of an apparatus for resolving data conflicts according to an embodiment of the present disclosure.
具体实施方式detailed description
本发明实施例提供一种解决数据冲突的方法和***,可以快速识别数据冲突并解决数据冲突,***的写入性能更高。Embodiments of the present invention provide a method and system for resolving data conflicts, which can quickly identify data conflicts and resolve data conflicts, and the write performance of the system is higher.
本发明实施例涉及双活或者多活***,在本发明实施例中,以多活***为例来进行说明。如附图1所示,多活***10分为三个逻辑层:客户端层11,接入节点层12和存储节点层13。The embodiment of the present invention relates to a dual-active or multi-active system. In the embodiment of the present invention, a multi-active system is taken as an example for description. As shown in FIG. 1, the multi-active system 10 is divided into three logical layers: a client layer 11, an access node layer 12, and a storage node layer 13.
客户端层11:用户通过客户端输入数据,客户端把数据发送给接收节点。Client layer 11: The user inputs data through the client, and the client sends the data to the receiving node.
接收节点层12:接收客户端发送的数据,并把接收的数据写入存储节点中。The receiving node layer 12 receives the data sent by the client and writes the received data into the storage node.
存储节点层13:存储数据。Storage node layer 13: stores data.
在物理上客户端、接入节点和存储节点可以在同一个物理设备(例如节点设备)上,也可以在不同的物理设备上,在本发明实施例中不做限定。The physical client, the access node, and the storage node may be on the same physical device (for example, a node device), or may be on different physical devices, which is not limited in the embodiment of the present invention.
发明人在发明过程中发现:在双活和多活场景下虽然允许从多个节点同时写入数据,但是多个节点同时对同一份数据进行更新操作的概率不大。现有技术中为了防止多个节点同时对同一份数据进行更新的操作,对每一次的数据操作都假设有其他节点在对同一份数据进行更新操作,造成正常场景下多个节点不对同一份数据进行更新的操作的写性能低。The inventor found in the process of invention that although it is allowed to simultaneously write data from a plurality of nodes in a live-active and multi-live scenario, the probability that multiple nodes simultaneously update the same data is not significant. In the prior art, in order to prevent multiple nodes from simultaneously updating the same data, it is assumed that each node performs an update operation on the same data for each data operation, causing multiple nodes in the normal scenario to not have the same data. The write performance of the update operation is low.
因此,在本发明中,首先认为节点对数据进行更新操作时绝大多数是没有冲突的,多个节点对同一份数据同时进行更新操作的概率小。因此,多活***中对数据进行更新操作时先将数据写入存储节点,数据写入后发现有冲突再解决数据冲突。Therefore, in the present invention, it is first considered that most of the nodes do not have conflicts when performing update operations on data, and the probability that multiple nodes perform update operations on the same data at the same time is small. Therefore, when the data is updated in the multi-live system, the data is first written to the storage node, and after the data is written, the conflict is found and the data conflict is resolved.
以附图1所示的***架构示意图为例,多活***中接收节点层包括接收节点1和接收节 点2,存储节点层包括存储节点1和存储节点2。接收节点1可以更新存储节点1和存储节点2中的数据;接收节点2可以更新存储节点1和存储节点2中的数据。本发明实施例中的接收节点和存储节点的数量仅为示例性说明,接收节点和存储节点的数量可以根据业务或者用户的需求来设定。Taking the system architecture diagram shown in FIG. 1 as an example, the receiving node layer in the multi-active system includes the receiving node 1 and the receiving section. Point 2, the storage node layer includes a storage node 1 and a storage node 2. The receiving node 1 can update the data in the storage node 1 and the storage node 2; the receiving node 2 can update the data in the storage node 1 and the storage node 2. The number of receiving nodes and storage nodes in the embodiment of the present invention is merely an exemplary description, and the number of receiving nodes and storage nodes may be set according to services or user requirements.
下文将描述在附图1所示的多活***中本发明实施例提出的解决数据冲突的方法。A method for resolving data conflicts proposed by the embodiment of the present invention in the multi-active system shown in FIG. 1 will be described below.
为了便于说明,存储节点1上已经存储有数据,为了与存储节点1中其他的数据区分,将存储节点中已经存储的数据称为V1,数据V1的键值(key)为K1,版本号为Ver1,为了和后续更新的数据区别,将存储节点1中的该数据记录为K1(V1,[Ver1])。存储节点2中存储的数据V1与存储节点1中的数据V1相同,也记录为K1(V1,[Ver1])。存储节点3中存储的数据V1与存储节点1中的数据V1相同,也记录为K1(V1,[Ver1])。For convenience of explanation, data is already stored on the storage node 1. In order to distinguish from other data in the storage node 1, the data already stored in the storage node is referred to as V1, and the key of the data V1 is K1, and the version number is Ver1, in order to distinguish from the data of the subsequent update, record the data in the storage node 1 as K1 (V1, [Ver1]). The data V1 stored in the storage node 2 is the same as the data V1 in the storage node 1, and is also recorded as K1 (V1, [Ver1]). The data V1 stored in the storage node 3 is the same as the data V1 in the storage node 1, and is also recorded as K1 (V1, [Ver1]).
其中,版本号是接收节点接收到数据操作指令时为数据分配的全球唯一的版本号,并且和数据一起存储到存储节点中。版本号可以用于区不同的数据更新操作。在本发明实施例中,为了便于识别,将版本号记录为Ver1,实际应用中,版本号可以是多个字母和/或数字的组合。版本号的计算可以利用现有的算法实现,在本发明实施例中不再另行描述。The version number is a globally unique version number assigned to the data when the receiving node receives the data operation instruction, and is stored in the storage node together with the data. The version number can be used for different data update operations in the zone. In the embodiment of the present invention, the version number is recorded as Ver1 for easy identification, and in actual applications, the version number may be a combination of multiple letters and/or numbers. The calculation of the version number can be implemented by using an existing algorithm, which is not described in the embodiment of the present invention.
现在,有多个***对数据K1进行更新操作。例如客户端1对数据K1对更新,更新的数据为V2。客户端2对数据K1对应的数据进行更新,更新的数据为V3。本发明实施例提供的解决数据冲突的方法如下文所述,如附图2所示。Now, there are multiple systems that update data K1. For example, client 1 updates the data K1 pair, and the updated data is V2. The client 2 updates the data corresponding to the data K1, and the updated data is V3. The method for resolving data conflicts provided by the embodiments of the present invention is as follows, as shown in FIG. 2.
步骤201:接入节点接收客户端发送的数据更新请求,并对所述数据更新操作生成一个全球唯一的版本号。Step 201: The access node receives a data update request sent by the client, and generates a globally unique version number for the data update operation.
将客户端发送给接入节点的数据更新请求称为第一数据更新请求,以和下文的其他数据更新请求相区分The data update request sent by the client to the access node is referred to as a first data update request to distinguish it from other data update requests below.
该版本号用于识别数据更新请求,由于版本号是全球唯一的版本号,因此每一次数据更新请求都可以与其他的数据更新请求相区别。This version number is used to identify the data update request. Since the version number is a globally unique version number, each data update request can be distinguished from other data update requests.
例如,接入节点1接收到客户端1的数据更新请求put(k1,V2),即对数据K1数据进行更新,更新的数据内容为V2,接入节点1为此次数据更新请求生成全局唯一的版本号Ver2。接入节点2接收到客户端2的数据更新请求put(k1,V3),即对数据K1进行更新,更新的数据内容为V3,接入节点为此次数据更新请求接入生成全局唯一的版本号Ver3。For example, the access node 1 receives the data update request put(k1, V2) of the client 1, that is, updates the data of the data K1, and the updated data content is V2, and the access node 1 generates a global unique for the data update request. Version number Ver2. The access node 2 receives the data update request put(k1, V3) of the client 2, that is, updates the data K1, and the updated data content is V3, and the access node generates a globally unique version for the data update request access. No. Ver3.
步骤203:接入节点向存储节点发送数据更新请求,数据更新请求中包含所述版本号。Step 203: The access node sends a data update request to the storage node, where the version update number includes the version number.
接入节点向存储节点发送的数据更新请求中包含的内容不相同,为了以示区别,将这里的数据更新请求称为第二数据更新请求。第二数据更新请求中包含了接入节点为第一数据更新请求生成的版本号。The content included in the data update request sent by the access node to the storage node is different. In order to distinguish, the data update request is referred to as a second data update request. The second data update request includes a version number generated by the access node for the first data update request.
接入节点接收到客户端发送的第一数据更新请求后,为第一数据更新请求生成一个全球唯一的版本号,向存储节点发送包含了该版本号的第二数据更新请求。多活***中会包含多个接入节点和多个存储节点,因此接入节点会把第二数据更新请求发送给多活***中的所有的存储节点,以此保证这些存储节点中的数据保持一致。After receiving the first data update request sent by the client, the access node generates a globally unique version number for the first data update request, and sends a second data update request including the version number to the storage node. A multi-active system will include multiple access nodes and multiple storage nodes, so the access node will send a second data update request to all storage nodes in the multi-active system to ensure data retention in these storage nodes. Consistent.
例如,接入节点1分别向存储节点1、存储节点2和存储节点3发送包含了版本号的数据更新请求put(K1,V2,Ver2)。接入节点2分别向存储节点1、存储节点2和存储节点3发送包含了数据和数据版本号数据更新请求put(K1,V3,Ver3)。 For example, the access node 1 transmits a data update request put (K1, V2, Ver2) including a version number to the storage node 1, the storage node 2, and the storage node 3, respectively. The access node 2 transmits data and data version number data update requests put(K1, V3, Ver3) to the storage node 1, the storage node 2, and the storage node 3, respectively.
步骤205:存储节点根据第二数据更新请求对对应的数据进行更新,记录偏序关系,并向接入节点返回该偏序关系。偏序关系用于记录该存储节点接收到的数据更新请求的版本号的先后顺序。Step 205: The storage node updates the corresponding data according to the second data update request, records the partial order relationship, and returns the partial order relationship to the access node. The partial order relationship is used to record the sequence of the version numbers of the data update requests received by the storage node.
存储节点接收到接入节点发送的包含了版本号的数据更新请求之后,根据数据更新请求中的key值找到对应的数据,并按接收到数据更新请求的顺序对数据进行更新操作,记录数据更新请求的版本号的先后顺序,即偏序关系,将偏序关系返回给接入节点。After receiving the data update request sent by the access node and including the version number, the storage node finds the corresponding data according to the key value in the data update request, and updates the data in the order of receiving the data update request, and records the data update. The order of the requested version numbers, that is, the partial order relationship, returns the partial order relationship to the access node.
偏序关系用于记录存储节点接收到的数据更新请求的版本号的先后顺序。存储节点接收到数据更新请求之后更新一次数据即相应的更新一次偏序关系。因此在不同的时间获取到的偏序关系有可能不同。The partial order relationship is used to record the sequence of the version numbers of the data update requests received by the storage node. After the storage node receives the data update request and updates the data once, the corresponding update is a partial order relationship. Therefore, the partial order relationships obtained at different times may be different.
另外,偏序关系中的版本号信息可以按一定的规则老化,比如当偏序关系中的版本号信息达到一定数量时,将最早的版本号信息从偏序关系中删除;或者当***中所有存储节点中同一数据的偏序关系中的某些版本号信息的顺序完全一致时,可以将这部份顺序完全相同的版本号信息从偏序关系中删除。在本申请实施例中,不涉及偏序关系的老化,因此不再详细描述。In addition, the version number information in the partial order relationship may be aged according to a certain rule. For example, when the version number information in the partial order relationship reaches a certain number, the oldest version number information is deleted from the partial order relationship; or when all the systems are in the system. When the order of some version number information in the partial order relationship of the same data in the storage node is completely the same, the version number information of the same order may be deleted from the partial order relationship. In the embodiment of the present application, the aging of the partial order relationship is not involved, and thus will not be described in detail.
在本申请实施例中,由于接入节点1和接入节点2是并发向存储节点写入数据的,因此各个存储节点接收到的对同一数据的数据更新请求的顺序可能是一样的,也可以是不一样的。因此存储节点的偏序关系可能相同也可能不相同。In the embodiment of the present application, since the access node 1 and the access node 2 concurrently write data to the storage node, the order of data update requests received by the respective storage nodes for the same data may be the same, or may be the same. are different. Therefore, the partial order relationship of storage nodes may or may not be the same.
例如:存储节点1先接收到接入节点1发送的对数据K1的数据更新请求put(K1,V2,Ver2),即需要对数据K1进行更新操作,更新的数据内容为V2,数据更新请求的版本号为Ver2。如上文所述,存储节点1中已经有数据K1的版本号为Ver1,存储节点1根据V2对数据K1进行更新之后,更新偏序关系为[Ver2<-Ver1],返回给接入节点1的偏序关系为[Ver2,Ver1]。存储节点1接收到接入节点2发送的对数据K1的数据更新请求put(K1,V3,Ver3),即存储节点1对数据K1进行更新操作数据内容为V3,数据更新请求的版本号为Ver3;存储节点1对数据K1根据V3更新之后,更新偏序关系为[Ver3<-Ver2<-Ver1],返回给接入节点2的偏序关系为[Ver3,Ver2,Ver1]。For example, the storage node 1 first receives the data update request put(K1, V2, Ver2) for the data K1 sent by the access node 1, that is, the update operation of the data K1 is required, and the updated data content is V2, and the data update request is The version number is Ver2. As described above, the version number of the data K1 already exists in the storage node 1 is Ver1, and after the storage node 1 updates the data K1 according to V2, the update partial order relationship is [Ver2<-Ver1], and is returned to the access node 1 The partial order relationship is [Ver2, Ver1]. The storage node 1 receives the data update request put (K1, V3, Ver3) for the data K1 sent by the access node 2, that is, the storage node 1 updates the data K1 with the operation data content V3, and the version number of the data update request is Ver3. After the storage node 1 updates the data K1 according to V3, the update partial order relationship is [Ver3<-Ver2<-Ver1], and the partial order relationship returned to the access node 2 is [Ver3, Ver2, Ver1].
存储节点2先接收到接入节点2发送的对数据K1的数据更新请求put(K1,V3,Ver3),即存储节点2对数据K1进行更新操作数据内容为V3,数据更新请求版本号为Ver3;存储节点2对数据K1根据V3更新之后,更新偏序关系为[Ver3<-Ver1],返回给接入节点2的偏序关系为[Ver3,Ver1]。存储节点2接收到接入节点1发送的对数据K1的数据更新请求put(K1,V2,Ver2),即需要对数据K1进行更新操作,更新的数据内容为V2,数据更新请求的版本号为Ver2。存储节点2对数据K1根据V3更新之后,更新偏序关系为[Ver2<-Ver3<-Ver1],返回给接入节点1的偏序关系为[Ver2,Ver3,Ver1]。The storage node 2 first receives the data update request put (K1, V3, Ver3) for the data K1 sent by the access node 2, that is, the storage node 2 updates the data K1 with the data content V3, and the data update request version number is Ver3. After the storage node 2 updates the data K1 according to V3, the update partial order relationship is [Ver3<-Ver1], and the partial order relationship returned to the access node 2 is [Ver3, Ver1]. The storage node 2 receives the data update request put (K1, V2, Ver2) for the data K1 sent by the access node 1, that is, the update operation of the data K1 is required, the updated data content is V2, and the version number of the data update request is Ver2. After the storage node 2 updates the data K1 according to V3, the update partial order relationship is [Ver2<-Ver3<-Ver1], and the partial order relationship returned to the access node 1 is [Ver2, Ver3, Ver1].
步骤207:接入节点获取存储节点返回的偏序关系,判断存储节点中的数据是否存在冲突。Step 207: The access node acquires a partial order relationship returned by the storage node, and determines whether there is a conflict in the data in the storage node.
在本申请实施例中,存储节点在对数据进行更新操作后更新了偏序关系,因此偏序关系可以体现存储节点中对同一数据的更新顺序。因此接收节点可以根据***中的多个存储节点返回的同一数据的偏序关系是否一致来判断***中的多个存储节点中的同一数据是否有冲突。 In the embodiment of the present application, the storage node updates the partial order relationship after the data is updated, so the partial order relationship may reflect the update order of the same data in the storage node. Therefore, the receiving node can determine whether the same data in the plurality of storage nodes in the system has a conflict according to whether the partial order relationship of the same data returned by the plurality of storage nodes in the system is consistent.
判断存储节点返回的偏序关系是否一致的方法如下:The method for determining whether the partial order relationship returned by the storage node is consistent is as follows:
1)***中存储节点返回的偏序关系相同,也就是说这些存储节点对同一数据的更新的顺序是相同的,此时这些存储节点中存储的同一数据的内容相同,没有冲突。1) The storage node returns the same partial order relationship in the system, that is to say, the order of updating the same data by these storage nodes is the same. At this time, the contents of the same data stored in these storage nodes are the same, and there is no conflict.
b)***中存储节点返回的偏序关系不相同,则说明各个存储节点对同一数据的更新的顺序不相同,此时这些存储节点中存储的同一数据的内容不相同,有冲突。b) The partial order relationship returned by the storage nodes in the system is different, indicating that the order of updating the same data by each storage node is different. At this time, the contents of the same data stored in the storage nodes are different and conflict.
可选的,当存储节点返回的偏序关系不相同时,考虑到各个存储节点接收到的数据更新请求的顺序不完全一样,因此可以设定一个时间周期,在设定的时间周期内接入节点多次获取存储节点的偏序关系,以最后获取的偏序关系来来确定存储节点中存储的同一数据是否存在冲突。Optionally, when the partial order relationship returned by the storage node is different, considering that the order of the data update requests received by the storage nodes is not completely the same, a time period may be set, and the access is performed within the set time period. The node obtains the partial order relationship of the storage node multiple times, and uses the last obtained partial order relationship to determine whether there is a conflict in the same data stored in the storage node.
可选的,当多个存储节点返回的偏序关系不相同时,还可以进一步判断偏序关系中的第一个版本号是否相同,当偏序关系中的第一个版本号相同时,还可以选择偏序关系中版本号少的存储节点再次获取偏序关系进行比较。Optionally, when the partial order relationships returned by the multiple storage nodes are different, it is further determined whether the first version number in the partial order relationship is the same, and when the first version number in the partial order relationship is the same, You can select a storage node with a small version number in the partial order relationship to obtain the partial order relationship again for comparison.
以上述例子中存储节点1和存储节点2的偏序关系为例进行说明。The partial order relationship between the storage node 1 and the storage node 2 in the above example will be described as an example.
接入节点1接收到的存储节点1返回的数据K1的偏序关系为[Ver2,Ver1],接入节点1接收到的存储节点2返回的数据K1的偏序关系为[Ver3,Ver1]。接入节点1判断存储节点1和存储节点2返回的偏序关系不相同。此时可以确定存储节点1和存储节点2中存储的数据K1不一致,有冲突。可选的,如果设定有偏序关系的获取时间,若还在偏序关系获取时间的时间范围内,接入节点1可以再次从存储节点1和存储节点2获取数据K1的偏序关系。在本申请实施例中,接入节点1再次从存储节点1获取的偏序关系为[Ver3,Ver2,Ver1],此时如存储节点2返回的偏序关系还没更新,还是[Ver3,Ver1]。接入节点1确认存储节点1和存储节点2返回的偏序关系不相同,此时可以确定存储节点1和存储节点2中存储的数据K1不一致,有冲突。The partial order relationship of the data K1 returned by the storage node 1 received by the access node 1 is [Ver2, Ver1], and the partial order relationship of the data K1 returned by the storage node 2 received by the access node 1 is [Ver3, Ver1]. The access node 1 judges that the partial order relationship returned by the storage node 1 and the storage node 2 is different. At this time, it can be determined that the data K1 stored in the storage node 1 and the storage node 2 are inconsistent and conflict. Optionally, if the acquisition time of the partial order relationship is set, if the time range of the partial order relationship acquisition time is also within, the access node 1 may obtain the partial order relationship of the data K1 from the storage node 1 and the storage node 2 again. In the embodiment of the present application, the partial order relationship acquired by the access node 1 from the storage node 1 is [Ver3, Ver2, Ver1]. At this time, if the partial order relationship returned by the storage node 2 has not been updated, or [Ver3, Ver1] ]. The access node 1 confirms that the partial order relationship returned by the storage node 1 and the storage node 2 is different. At this time, it can be determined that the data K1 stored in the storage node 1 and the storage node 2 are inconsistent and conflict.
可选的,接入节点1判断存储节点1和存储节点2的偏序关系不相同,但是此时两个偏序关系的第一个版本号相同,都是Ver3;而存储节点2的偏序关系中的版本号的数量较少,接入节点1再从存储节点2获取偏序关系,此时存储节点2的偏序关系为[Ver2<-Ver3<-Ver1],接入节点1确认存储节点1和存储节点2返回的偏序关系不相同,此时可以确定存储节点1和存储节点2中存储的数据K1不一致,有冲突。Optionally, the access node 1 determines that the partial order relationship between the storage node 1 and the storage node 2 is different, but at this time, the first version numbers of the two partial order relationships are the same, both are Ver3; and the storage node 2 is ordered. The number of version numbers in the relationship is small, and the access node 1 obtains the partial order relationship from the storage node 2. At this time, the partial order relationship of the storage node 2 is [Ver2<-Ver3<-Ver1], and the access node 1 confirms the storage. The partial order relationship returned by the node 1 and the storage node 2 is different. At this time, it can be determined that the data K1 stored in the storage node 1 and the storage node 2 are inconsistent and conflict.
可选的,接入节点1判断存储节点1和存储节点2的偏序关系不相同,若设定有偏序关系的获取时间,且还在偏序关系获取时间的时间段内,接入节点1可以再从存储节点1和存储节点2读取数据K1的偏序关系。当接入节点1从存储节点1获取的数据K1的偏序关系为[Ver3,Ver2,Ver1],从存储节点2获取的数据K1的偏序关系为[Ver2,Ver3,Ver1]。此时接入节点1判断存储节点1上存储的数据K1与存储节点2上存储的数据K1不一致,有冲突。Optionally, the access node 1 determines that the partial order relationship between the storage node 1 and the storage node 2 is different. If the acquisition time of the partial order relationship is set, and the access node is also in the time period of the partial order relationship acquisition time, the access node 1 The partial order relationship of the data K1 can be read from the storage node 1 and the storage node 2. When the partial order relationship of the data K1 acquired by the access node 1 from the storage node 1 is [Ver3, Ver2, Ver1], the partial order relationship of the data K1 acquired from the storage node 2 is [Ver2, Ver3, Ver1]. At this time, the access node 1 judges that the data K1 stored on the storage node 1 is inconsistent with the data K1 stored on the storage node 2, and there is a conflict.
类似的,接入节点2从存储节点1和存储节点2接收到的偏序关系的判断与上述接入节点1的判断方法相同,在此不再另行说明。Similarly, the determination of the partial order relationship received by the access node 2 from the storage node 1 and the storage node 2 is the same as that of the access node 1 described above, and will not be further described herein.
步骤209:当存储节点中的所述数据存在冲突时,接入节点调整所述数据存在的冲突。Step 209: When there is a conflict in the data in the storage node, the access node adjusts the conflict of the data.
当接入节点确定***的存储节点上存储的同一数据存在冲突时,需要调整冲突。When the access node determines that there is a conflict between the same data stored on the storage node of the system, the conflict needs to be adjusted.
本申请实施例提供两种调整数据冲突的策略作为示例性说明。在实际应用中,也可以 采用其他的策略,只要***中的接入节点共同遵守即可。The embodiment of the present application provides two strategies for adjusting data conflicts as an exemplary description. In practical applications, it can also Other strategies are adopted as long as the access nodes in the system comply with each other.
第一种按照存储节点优先级策略。设定***中的存储节点的优先级,当存储节点中的数据存在冲突时,以优先级高的存储节点的数据为准来调整数据冲突。例如上文所述,接入节点1从存储节点1获取的数据K1的偏序关系为[Ver2,Ver1],从存储节点2获取的数据K1的偏序关系为[Ver2,Ver3,Ver1]。根据上文所述的方法,接入节点1从存储节点1获取的数据K1的偏序关系与从存储节点2获取的数据K1的偏序关系不相同,并且偏序关系中的第一个版本号都是Ver2,接入节点1再获取存储节点1的偏序关系,得到新的偏序关系[Ver3,Ver2,Ver1];接入节点确定存储节点1和存储节点2中的数据K1有冲突。根据存储节点的优先级来调整的策略,存储节点1的优先级高于存储节点2的优先级,接入节点1以存储节点1中的数据来调整存储节点2中的数据。接入节点1向存储节点2发送数据更新请求put(K1,V3,Ver3<-Ver2),请求中携带需要调整的偏序关系。存储节点2接收到数据更新请求之后,对存储的数据进行调整,并更新偏序关系。接入节点2也会从存储节点1和存储节点2获取数据K1的偏序关系,处理方法与接入节点1的处理方法相同。接入节点2从存储节点2获取的偏序关系可能是接入节点1调整后的偏序关系,这时接入节点2获取的存储节点1和存储节点2的偏序关系就是相同的,即存储节点1和存储节点2中的数据K1不存在冲突。接入节点2的的处理方法与接入节点1的处理方法相同,不再另行说明。The first is based on the storage node priority policy. Set the priority of the storage node in the system. When there is a conflict between the data in the storage node, the data conflict is adjusted based on the data of the storage node with the highest priority. For example, as described above, the partial order relationship of the data K1 acquired by the access node 1 from the storage node 1 is [Ver2, Ver1], and the partial order relationship of the data K1 acquired from the storage node 2 is [Ver2, Ver3, Ver1]. According to the method described above, the partial order relationship of the data K1 acquired by the access node 1 from the storage node 1 is different from the partial order relationship of the data K1 acquired from the storage node 2, and the first version in the partial order relationship The number is Ver2, the access node 1 obtains the partial order relationship of the storage node 1, and obtains a new partial order relationship [Ver3, Ver2, Ver1]; the access node determines that the data K1 in the storage node 1 and the storage node 2 conflicts. . According to the policy adjusted by the priority of the storage node, the priority of the storage node 1 is higher than the priority of the storage node 2, and the access node 1 adjusts the data in the storage node 2 with the data in the storage node 1. The access node 1 transmits a data update request put (K1, V3, Ver3<-Ver2) to the storage node 2, and the request carries a partial order relationship that needs to be adjusted. After receiving the data update request, the storage node 2 adjusts the stored data and updates the partial order relationship. The access node 2 also acquires the partial order relationship of the data K1 from the storage node 1 and the storage node 2, and the processing method is the same as that of the access node 1. The partial order relationship obtained by the access node 2 from the storage node 2 may be the adjusted partial order relationship of the access node 1, and the partial order relationship between the storage node 1 and the storage node 2 acquired by the access node 2 is the same, that is, There is no conflict between the data K1 in the storage node 1 and the storage node 2. The processing method of the access node 2 is the same as that of the access node 1, and will not be further described.
第二种是偏序关系优先级策略,就是按偏序关系中版本号的大小顺序调整存储节点中的数据的冲突。由于偏序关系表示了数据更新请求的版本号的先后顺序,因此存储节点先写入的版本号可能会比后写入的版本大号。在此策略下,以偏序关系中版本号按从大到小排列的偏序关系为准来调整数据冲突。例如上文所述,接入节点1从存储节点1获取的数据K1的偏序关系为[Ver3,Ver2,Ver1],从存储节点2获取的数据K1的偏序关系为[Ver2,Ver3,Ver1]。接入节点1从存储节点1返回的数据K1的偏序关系中版本号是从大到小排列的,因此以存储节点1中的数据不变,并且根据存储节点1中数据K1的偏序关系来调整存储节点2中的数据K1,使得存储节点1和存储节点2中的数据一致。接入节点1向存储节点2发送数据更新请求,请求中携带需要调整的偏序关系。存储节点2接收到数据更新请求之后,并根据需要调整的偏序关系对存储的数据进行调整。接入节点2的处理方法与接入节点1的处理方法相同,不再另行说明。The second type is the partial order relationship priority strategy, which is to adjust the conflict of data in the storage node in the order of the size of the version number in the partial order relationship. Since the partial order relationship indicates the order of the version numbers of the data update requests, the version number written by the storage node may be larger than the version written later. Under this strategy, data conflicts are adjusted based on the partial order relationship of the version numbers in the partial order relationship from large to small. For example, as described above, the partial order relationship of the data K1 acquired by the access node 1 from the storage node 1 is [Ver3, Ver2, Ver1], and the partial order relationship of the data K1 acquired from the storage node 2 is [Ver2, Ver3, Ver1] ]. The version numbers of the partial order relationship of the data K1 returned by the access node 1 from the storage node 1 are arranged from large to small, so that the data in the storage node 1 is unchanged, and according to the partial order relationship of the data K1 in the storage node 1. The data K1 in the storage node 2 is adjusted so that the data in the storage node 1 and the storage node 2 are identical. The access node 1 sends a data update request to the storage node 2, and the request carries a partial order relationship that needs to be adjusted. After receiving the data update request, the storage node 2 adjusts the stored data according to the partial order relationship that needs to be adjusted. The processing method of the access node 2 is the same as that of the access node 1, and will not be further described.
当存储节点中的所述数据没有冲突,接入节点则不做处理,继续正常处理业务。When the data in the storage node does not conflict, the access node does not process and continues to process the service normally.
本发明实施例还提供一种解决数据冲突的多活***,多活***的架构如附图1所示。The embodiment of the present invention further provides a multi-active system for solving data conflicts. The architecture of the multi-live system is as shown in FIG. 1.
多活***分为三个逻辑层:客户端层11,接入节点层12和存储节点层13。The multi-active system is divided into three logical layers: a client layer 11, an access node layer 12, and a storage node layer 13.
客户端层11:包括多个客户端。附图1中示例性给出两个客户端,客户端1和客户端2。客户端用于向接收节点发送第一数据更新请求。Client layer 11: includes multiple clients. Two clients, client 1 and client 2, are exemplarily shown in FIG. The client is configured to send a first data update request to the receiving node.
接收节点层12:包括多个接收节点。附图1中示例性的给出两个接收节点,接收节点1和接收节点2。Receive Node Layer 12: includes a plurality of receiving nodes. Two receiving nodes, receiving node 1 and receiving node 2 are exemplarily shown in FIG.
存储节点层13:包括多个存储节点,附图1中示例性的给出两个存储节点,存储节点1和存储节点2。Storage node layer 13: includes a plurality of storage nodes, and two storage nodes, storage node 1 and storage node 2 are exemplarily shown in FIG.
接收节点用于接收客户端发送的第一数据更新请求,对所述第一数据更新请求生成一个全球唯一的版本号;并向存储节点发送第二数据更新请求,第二数据更新请求中携带有 该版本号。The receiving node is configured to receive a first data update request sent by the client, generate a globally unique version number for the first data update request, and send a second data update request to the storage node, where the second data update request carries The version number.
存储节点用于根据第二数据更新请求更新对应的数据,并更新偏序关系,并向接收节点返回该偏序关系;其中,偏序关系用于记录所述存储节点接收到的数据更新请求的版本号的先后顺序。The storage node is configured to update the corresponding data according to the second data update request, and update the partial order relationship, and return the partial order relationship to the receiving node; wherein the partial order relationship is used to record the data update request received by the storage node. The order of the version numbers.
接收节点还用于获取所述存储节点返回的偏序关系,判断存储节点中的数据是否存在冲突;当存储节点中的数据存在冲突时,调整数据存在的冲突。The receiving node is further configured to obtain a partial order relationship returned by the storage node, determine whether there is a conflict in the data in the storage node, and adjust a conflict in the data when there is a conflict in the data in the storage node.
接收节点和存储节点的具体实现过程以及偏序关系的产生和更新已在上文方法实施例中进行了详细的解释和说明,在此不再另行说明。The specific implementation process of the receiving node and the storage node and the generation and update of the partial order relationship have been explained and explained in detail in the above method embodiments, and will not be further described herein.
这样,只有当存储节点中的数据存在冲突时,接收节点才调整数据存在的冲突,当存储节点中的数据不存在冲突时,接收节点正常执行数据更新操作,大大提高了了数据的更新效率。In this way, the receiving node adjusts the conflict of data only when there is a conflict in the data in the storage node. When there is no conflict in the data in the storage node, the receiving node performs the data update operation normally, which greatly improves the data updating efficiency.
接入节点用于判断存储节点中的所述数据是否存在冲突具体可以为:当获取到的存储节点的偏序关系不一致时,接入节点判断所述存储节点中的所述数据存在冲突。The access node is configured to determine whether the data in the storage node is in conflict. The access node determines that the data in the storage node conflicts.
通过增加数据操作请求的版本号的偏序关系,接入节点可以根据偏序关系来判断存储节点中的数据是否一致,能够快速的识别出存储节点中存在的数据冲突,提高***的性能。By increasing the partial order relationship of the version number of the data operation request, the access node can determine whether the data in the storage node is consistent according to the partial order relationship, and can quickly identify the data conflict existing in the storage node and improve the performance of the system.
可选的,接入节点用于判断存储节点中的所述数据是否存在冲突具体还可以为:当接收到的存储节点的偏序关系不一致时,在预定的时间周期内所述接入节点重新获取存储节点的偏序关系,当所述重新获取的所述存储节点的偏序关系不一致时,所述接入节点判断所述存储节点中的所述数据存在冲突。Optionally, the access node is configured to determine whether the data in the storage node is in conflict, and may be: when the received storage node has a misaligned relationship, the access node is re-established within a predetermined time period. Acquiring a partial order relationship of the storage node, when the re-acquisition of the storage node's partial order relationship is inconsistent, the access node determines that the data in the storage node has a conflict.
由于各个存储节点接收数据更新请求的顺序和时间不完全一致,因此不同时间获取的偏序关系可能会不同。并且当不同存储节点的偏序关系不相同时,可能有接收节点会调整数据冲突,因此可以设定一个时间周期,在设定的时间周期内,接收节点可以多次获取存储节点的偏序关系进行比较,而不是一发现偏序关系不一致就马上进行调整,以提高解决数据冲突的效率。具体设定时间周期的长短,可以根据业务的类型、***的负载或者用户的需求来设定。Since the order and time of receiving the data update request by each storage node are not completely consistent, the partial order relationship acquired at different times may be different. And when the partial order relationship of different storage nodes is different, there may be a receiving node that adjusts the data conflict, so a time period can be set, and the receiving node can obtain the partial order relationship of the storage node multiple times in the set time period. Compare them, instead of making adjustments as soon as the partial order relationship is inconsistent, to improve the efficiency of resolving data conflicts. The length of the specific time period can be set according to the type of service, the load of the system, or the needs of the user.
接收节点判断存储节点中的同一是否存在冲突在上文方法实施例中已经进行了详细的举例和说明,在本发明实施例中不再另行说明。The receiving node determines whether there is a conflict in the same in the storage node. The detailed description and description have been made in the foregoing method embodiments, which are not described in the embodiment of the present invention.
接入节点用于调整所述冲突具体为:接入节点用于根据冲突调整策略向存储节点发送第三数据更新请求,第三数据更新请求中包含需要调整的偏序关系;The access node is configured to adjust the conflict, where the access node is configured to send a third data update request to the storage node according to the conflict adjustment policy, where the third data update request includes a partial order relationship that needs to be adjusted;
存储节点还用于接收到第三数据更新请求之后,根据需要调整的偏序关系更新存储节点中的数据。The storage node is further configured to: after receiving the third data update request, update the data in the storage node according to the partial order relationship adjusted.
冲突调整策略包括存储节点优先级策略和偏序关系优先级策略。存储节点优先级策略为以优先级高的存储节点的偏序关系来调整优先级低的存储节点中的数据。所述偏序关系优先级策略为按所述偏序关系中的版本号的大小顺序调整所述存储节点中的所述数据。The conflict adjustment policy includes a storage node priority policy and a partial order relationship priority policy. The storage node priority policy is to adjust the data in the storage node with lower priority by the partial order relationship of the storage node with higher priority. The partial order relationship priority policy is to adjust the data in the storage node in order of size of the version number in the partial order relationship.
存储节点中数据冲突的解决需要有一致的策略,这样能够在确定存在冲突以后快速的解决。冲突调整策略的具体内容和实现在上文实施例中已有详细的说明和举例,在本实施例中不再另行说明。The resolution of data conflicts in storage nodes requires a consistent strategy so that they can be resolved quickly after determining that there is a conflict. The specific content and implementation of the conflict adjustment policy have been described and exemplified in the above embodiments, and will not be further described in this embodiment.
接入节点和存储节点可以在同一个物理设备(例如节点设备)上,也可以在不同的物 理设备上,在本发明实施例中不做限定。The access node and the storage node can be on the same physical device (such as a node device) or in different objects. The device is not limited in the embodiment of the present invention.
结合本文中所公开的实施例描述的各示例的单元及方法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。The present application can be implemented in hardware or a combination of hardware and computer software in combination with the elements and method steps of the various examples described in the embodiments disclosed herein. Whether a function is implemented in hardware or computer software to drive hardware depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods to implement the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present application.
如图3所示,为本申请实施例提供的一种解决数据冲突的装置的硬件结构示意图,该解决数据冲突的装置300包括至少一个处理器301,通信总线302,存储器303以及至少一个通信接口304。FIG. 3 is a schematic diagram of a hardware structure of an apparatus for resolving data conflicts according to an embodiment of the present application. The apparatus 300 for resolving data conflicts includes at least one processor 301, a communication bus 302, a memory 303, and at least one communication interface. 304.
处理器301可以是一个通用中央处理器(Central Processing Unit,CPU),微处理器,特定应用集成电路(Application-Specific Integrated Circuit,ASIC),或一个或多个用于控制本申请方案程序执行的集成电路。The processor 301 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more programs for controlling the execution of the program of the present application. integrated circuit.
通信总线302可包括一通路,在上述组件之间传送信息。Communication bus 302 can include a path for communicating information between the components described above.
通信接口304,使用任何收发器一类的装置,用于与其他设备或通信网络通信,如以太网,无线接入网(Radio Access Network,RAN),无线局域网(Wireless Local Area Networks,WLAN)等。The communication interface 304 uses a device such as any transceiver for communicating with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc. .
存储器303可以是只读存储器(Read-Only Memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(Random Access Memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器可以是独立存在,通过总线与处理器相连接。存储器也可以和处理器集成在一起。The memory 303 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type that can store information and instructions. The dynamic storage device can also be an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disc storage, and a disc storage device. (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be Any other media accessed, but not limited to this. The memory can exist independently and be connected to the processor via a bus. The memory can also be integrated with the processor.
其中,存储器303用于存储执行本申请方案的应用程序代码,并由处理器301来控制执行。处理器301用于执行存储器33中存储的应用程序代码,从而实现上述实施例中所述的在多CPU***中分配资源的方法。The memory 303 is used to store application code for executing the solution of the present application, and is controlled by the processor 301 for execution. The processor 301 is configured to execute the application code stored in the memory 33, thereby implementing the method of allocating resources in the multi-CPU system described in the above embodiments.
在具体实现中,作为一种实施例,处理器301可以包括一个或多个CPU,例如图3中的CPU0和CPU1。In a particular implementation, as an embodiment, processor 301 may include one or more CPUs, such as CPU0 and CPU1 in FIG.
在具体实现中,作为一种实施例,解决数据冲突的装置300可以包括多个处理器,例如图3中的处理器301和处理器308。这些处理器中的每一个可以是一个单核(single-CPU)处理器,也可以是一个多核(multi-CPU)处理器。这里的处理器可以指一个或多个设备、电路、和/或用于处理数据(例如计算机程序指令)的处理核。In a particular implementation, as an embodiment, apparatus 300 for resolving data conflicts may include multiple processors, such as processor 301 and processor 308 in FIG. Each of these processors can be a single-CPU processor or a multi-core processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data, such as computer program instructions.
在具体实现中,作为一种实施例,解决数据冲突的装置300还可以包括输出设备305和输入设备306。输出设备305和处理器301通信,可以以多种方式来显示信息。例如,输出设备305可以是液晶显示器(Liquid Crystal Display,LCD),发光二级管(Light Emitting Diode,LED)显示设备,阴极射线管(Cathode Ray Tube,CRT)显示设备,或投影仪(projector)等。输入设备306和处理器301通信,可以以多种方式接受用户的输入。例如,输入设备806可以是鼠标、键盘、触摸屏设备或传感设备等。 In a specific implementation, as an embodiment, the apparatus 300 for resolving data conflicts may further include an output device 305 and an input device 306. Output device 305 is in communication with processor 301 and can display information in a variety of ways. For example, the output device 305 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. Wait. Input device 306 is in communication with processor 301 and can accept user input in a variety of ways. For example, input device 806 can be a mouse, keyboard, touch screen device, or sensing device, and the like.
上述的解决数据冲突的装置300可以是一个通用服务器或者是一个专用服务器。在具体实现中,解决数据冲突的装置300可以是台式机、便携式电脑、网络服务器、掌上电脑(Personal Digital Assistant,PDA)、移动手机、平板电脑、无线终端设备、通信设备、嵌入式设备或有图3中类似结构的设备。本申请实施例不限定解决数据冲突的装置300的类型。The above device 300 for resolving data conflicts may be a general purpose server or a dedicated server. In a specific implementation, the device 300 for resolving data conflicts may be a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet, a wireless terminal device, a communication device, an embedded device, or A device of similar construction in Figure 3. The embodiment of the present application does not limit the type of device 300 that resolves data conflicts.
由于本申请实施例提供的解决数据冲突的装置可用于执行上述在多CPU***中分配资源的方法,因此其所能获得的技术效果可参考上述方法实施例,本申请实施例在此不再赘述。The device for resolving data conflicts provided by the embodiment of the present application can be used to perform the foregoing method for allocating resources in a multi-CPU system. Therefore, the technical effects that can be obtained by reference to the foregoing method embodiments are not described herein. .
本申请实施例还提供了一种计算机存储介质,用于储存为上述解决数据冲突的装置所用的计算机软件指令,其包含用于执行上述方法实施例所设计的程序。通过执行存储的程序,可以在多CPU***中实现资源分配的方法。The embodiment of the present application further provides a computer storage medium for storing computer software instructions for the above-mentioned device for resolving data conflicts, which comprises a program designed to execute the foregoing method embodiments. A method of resource allocation can be implemented in a multi-CPU system by executing a stored program.
本申请实施例还提供了一种计算机程序,该计算机程序包括指令,当该计算机程序被计算机执行时,使得计算机可以执行上述方法实施例的流程。The embodiment of the present application further provides a computer program, which includes instructions, when the computer program is executed by a computer, to enable the computer to execute the flow of the foregoing method embodiment.
尽管在此结合各实施例对本申请进行了描述,然而,在实施所要求保护的本申请过程中,本领域技术人员通过查看所述附图、公开内容、以及所附权利要求书,可理解并实现所述公开实施例的其他变化。在权利要求中,“包括”(comprising)一词不排除其他组成部分或步骤,“一”或“一个”不排除多个的情况。单个处理器或其他单元可以实现权利要求中列举的若干项功能。相互不同的从属权利要求中记载了某些措施,但这并不表示这些措施不能组合起来产生良好的效果。Although the present application has been described herein in connection with the various embodiments, those skilled in the art can Other variations of the disclosed embodiments are achieved. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude a plurality. A single processor or other unit may fulfill several of the functions recited in the claims. Certain measures are recited in mutually different dependent claims, but this does not mean that the measures are not combined to produce a good effect.
本领域技术人员应明白,本申请的实施例可提供为方法、装置(设备)、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。计算机程序存储/分布在合适的介质中,与其它硬件一起提供或作为硬件的一部分,也可以采用其他分布形式,如通过Internet或其它有线或无线电信***。Those skilled in the art will appreciate that embodiments of the present application can be provided as a method, apparatus (device), or computer program product. Thus, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment in combination of software and hardware. Moreover, the application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code. The computer program is stored/distributed in a suitable medium, provided with other hardware or as part of the hardware, or in other distributed forms, such as over the Internet or other wired or wireless telecommunication systems.
本申请是参照本申请实施例的方法、装置(设备)和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of the methods, apparatus, and computer program products of the embodiments of the present application. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方 框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions are provided for implementing one or more processes and/or block diagrams in the flowchart The steps of the function specified in the box or in multiple boxes.
尽管结合具体特征及其实施例对本申请进行了描述,显而易见的,在不脱离本申请的精神和范围的情况下,可对其进行各种修改和组合。相应地,本说明书和附图仅仅是所附权利要求所界定的本申请的示例性说明,且视为已覆盖本申请范围内的任意和所有修改、变化、组合或等同物。显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。 While the present invention has been described in connection with the specific embodiments and embodiments thereof, various modifications and combinations can be made without departing from the spirit and scope of the application. Accordingly, the description and drawings are to be regarded as It will be apparent to those skilled in the art that various modifications and changes can be made in the present application without departing from the spirit and scope of the application. Thus, it is intended that the present invention cover the modifications and variations of the present invention.

Claims (10)

  1. 一种多活***中解决数据冲突的方法,其特征在于,所述多活***包含接入节点和存储节点,所述方法包括:A method for resolving data conflicts in a multi-active system, characterized in that the multi-active system comprises an access node and a storage node, the method comprising:
    所述接入节点接收客户端发送的第一数据更新请求,并对所述第一数据更新请求生成一个全球唯一的版本号;Receiving, by the access node, a first data update request sent by the client, and generating a globally unique version number for the first data update request;
    所述接入节点向所述存储节点发送第二数据更新请求,所述第二数据更新请求中携带所述版本号;The access node sends a second data update request to the storage node, where the second data update request carries the version number;
    所述存储节点根据所述第二数据更新请求更新对应的数据,更新偏序关系,并向所述接入节点返回所述偏序关系;其中,所述偏序关系用于记录所述存储节点接收到的数据更新请求的版本号的先后顺序;And the storage node updates the corresponding data according to the second data update request, updates the partial order relationship, and returns the partial order relationship to the access node; wherein the partial order relationship is used to record the storage node The order of the version numbers of the received data update requests;
    所述接入节点获取所述存储节点返回的偏序关系,判断存储节点中的所述数据是否存在冲突;Obtaining, by the access node, a partial order relationship returned by the storage node, and determining whether the data in the storage node has a conflict;
    当存储节点中的所述数据存在冲突时,所述接入节点调整所述冲突。The access node adjusts the conflict when there is a conflict in the data in the storage node.
  2. 根据权利要求1所述的方法,其特征在于,所述接入节点判断所述存储节点中的所述数据是否存在冲突具体为:The method according to claim 1, wherein the access node determines whether the data in the storage node has a conflict:
    当获取到的存储节点的偏序关系不一致时,所述接入节点判断所述存储节点中的所述数据存在冲突。When the obtained partial order relationship of the storage nodes is inconsistent, the access node determines that the data in the storage node has a conflict.
  3. 根据权利要求1所述的方法,其特征在于,所述接入节点判断所述存储节点中的所述数据是否存在冲突具体为:The method according to claim 1, wherein the access node determines whether the data in the storage node has a conflict:
    当接收到的存储节点的偏序关系不一致时,在预定的时间周期内所述接入节点重新获取所述存储节点的偏序关系,当所述重新获取的所述存储节点的偏序关系不一致时,所述接入节点判断所述存储节点中的所述数据存在冲突。When the partial storage relationship of the storage node is inconsistent, the access node reacquires the partial order relationship of the storage node in a predetermined time period, and the partial order relationship of the re-acquired storage node is inconsistent The access node determines that there is a conflict in the data in the storage node.
  4. 根据权利要求1-3任一所述的方法,其特征在于,所述接入节点调整所述冲突具体为:The method according to any one of claims 1-3, wherein the adjusting, by the access node, the conflict is:
    所述接入节点根据冲突调整策略向所述存储节点发送第三数据更新请求,所述第三数据更新请求中包含需要调整的偏序关系;The access node sends a third data update request to the storage node according to the conflict adjustment policy, where the third data update request includes a partial order relationship that needs to be adjusted;
    所述存储节点接收到所述第三数据更新请求之后,根据所述需要调整的偏序关系更新所述存储节点中的所述数据。After receiving the third data update request, the storage node updates the data in the storage node according to the partial order relationship that needs to be adjusted.
  5. 根据权利要求4所述的方法,其特征在于,所述冲突调整策略包括存储节点优先级策略和偏序关系优先级策略;所述存储节点优先级策略为以优先级高的存储节点的偏序关系来调整优先级低的存储节点中的数据;所述偏序关系优先级策略为按所述偏序关系中的版本号的大小顺序调整所述存储节点中的所述数据。The method according to claim 4, wherein the conflict adjustment policy comprises a storage node priority policy and a partial order relationship priority policy; and the storage node priority policy is a partial order of the storage node with a higher priority The relationship is used to adjust data in the storage node with a lower priority; the partial order relationship priority policy is to adjust the data in the storage node in order of the size of the version number in the partial order relationship.
  6. 一种多活***,所述多活***中包含多个接入节点和多个存储节点,所述接入节点与客户端连接,其特征在于,A multi-active system, the multi-active system includes a plurality of access nodes and a plurality of storage nodes, and the access nodes are connected to a client, wherein
    所述接入节点用于接收客户端发送的第一数据更新请求,并对所述第一数据更新请求生成一个全球唯一的版本号;向所述存储节点发送第二数据更新请求,所述第二数据更新请求中携带所述版本号;The access node is configured to receive a first data update request sent by the client, generate a globally unique version number for the first data update request, and send a second data update request to the storage node, where the Carrying the version number in the second data update request;
    所述存储节点用于根据所述第二数据更新请求更新对应的数据,更新偏序关系,并向所述接入节点返回所述偏序关系;其中,所述偏序关系用于记录所述存储节点接收到的数 据更新请求的版本号的先后顺序;The storage node is configured to update corresponding data according to the second data update request, update a partial order relationship, and return the partial order relationship to the access node; wherein the partial order relationship is used to record the Number received by the storage node According to the order of the version numbers of the update request;
    所述接入节点还用于获取所述存储节点返回的偏序关系,判断所述存储节点中的所述数据是否存在冲突;当存储节点中的所述数据存在冲突时,调整所述冲突。The access node is further configured to acquire a partial order relationship returned by the storage node, determine whether the data in the storage node has a conflict, and adjust the conflict when the data in the storage node conflicts.
  7. 根据权利要求6所述的***,其特征在于,所述接入节点用于判断所述存储节点中的所述数据是否存在冲突具体为:The system according to claim 6, wherein the access node is configured to determine whether the data in the storage node has a conflict:
    当获取到的存储节点的偏序关系不一致时,判断所述存储节点中的所述数据存在冲突。When the acquired partial storage relationships of the storage nodes are inconsistent, it is determined that the data in the storage node has a conflict.
  8. 根据权利要求6所述的***,其特征在于,所述接入节点用于判断所述存储节点中的所述数据是否存在冲突具体为:The system according to claim 6, wherein the access node is configured to determine whether the data in the storage node has a conflict:
    当接收到的存储节点的偏序关系不一致时,在预定的时间周期内所述接入节点重新获取所述存储节点的偏序关系,当所述重新获取的所述存储节点的偏序关系不一致时,判断所述存储节点中的所述数据存在冲突。When the partial storage relationship of the storage node is inconsistent, the access node reacquires the partial order relationship of the storage node in a predetermined time period, and the partial order relationship of the re-acquired storage node is inconsistent At the same time, it is determined that there is a conflict in the data in the storage node.
  9. 根据权利要求6-8任一所述的***,其特征在于,A system according to any of claims 6-8, wherein
    所述接入节点用于调整所述冲突具体为:The access node is configured to adjust the conflict specifically:
    根据冲突调整策略向所述存储节点发送第三数据更新请求,所述第三数据更新请求中包含需要调整的偏序关系;其中,所述冲突调整策略包括存储节点优先级策略和偏序关系优先级策略;Sending a third data update request to the storage node according to the conflict adjustment policy, where the third data update request includes a partial order relationship that needs to be adjusted; wherein the conflict adjustment policy includes a storage node priority policy and a partial order relationship priority Level strategy
    所述存储节点还用于接收到所述第三数据更新请求之后,根据所述需要调整的偏序关系更新所述存储节点中的所述数据。The storage node is further configured to: after receiving the third data update request, update the data in the storage node according to the partial order relationship that needs to be adjusted.
  10. 根据权利要求6-9任一所述的***,其特征在于,所述接入节点和所述存储节点位于同一物理设备中。 The system of any of claims 6-9, wherein the access node and the storage node are located in the same physical device.
PCT/CN2017/094317 2016-12-30 2017-07-25 Method and system for solving data collision WO2018120810A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611257463.1 2016-12-30
CN201611257463.1A CN106802939B (en) 2016-12-30 2016-12-30 Method and system for solving data conflict

Publications (1)

Publication Number Publication Date
WO2018120810A1 true WO2018120810A1 (en) 2018-07-05

Family

ID=58985182

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/094317 WO2018120810A1 (en) 2016-12-30 2017-07-25 Method and system for solving data collision

Country Status (2)

Country Link
CN (1) CN106802939B (en)
WO (1) WO2018120810A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106802939B (en) * 2016-12-30 2020-04-03 华为技术有限公司 Method and system for solving data conflict
CN109213769B (en) * 2017-06-30 2022-04-29 华为技术有限公司 Data conflict identification method for data object
KR102406666B1 (en) 2017-09-20 2022-06-08 삼성전자주식회사 Key-value storage device supporting snapshot function and method of operating the key-value storage device
CN112115304A (en) * 2019-06-20 2020-12-22 百度(中国)有限公司 Partial order data processing method, device and system and storage medium
CN110851243B (en) * 2019-11-05 2022-04-12 东软集团股份有限公司 Flow access control method and device, storage medium and electronic equipment
CN111078659B (en) * 2019-12-20 2023-04-21 腾讯科技(深圳)有限公司 Model updating method, device, computer readable storage medium and computer equipment
CN115794853B (en) * 2023-02-03 2023-06-23 天翼云科技有限公司 Updating method and device of government affair data resource catalog, electronic equipment and medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7467265B1 (en) * 2005-06-30 2008-12-16 Symantec Operating Corporation System and method for block conflict resolution within consistency interval marker based replication
CN103036717A (en) * 2012-12-12 2013-04-10 北京邮电大学 Consistency maintenance system and methods for distributed-type data
CN104394195A (en) * 2014-10-31 2015-03-04 杭州华为企业通信技术有限公司 Data updating method and device
CN104750738A (en) * 2013-12-30 2015-07-01 ***通信集团公司 Data information updating method, data node, management node and system
US9208167B1 (en) * 2014-09-04 2015-12-08 Edifire LLC Distributed data synchronization and conflict resolution
CN106250322A (en) * 2016-08-12 2016-12-21 华为技术有限公司 A kind of method and apparatus writing data
CN106802939A (en) * 2016-12-30 2017-06-06 华为技术有限公司 A kind of method and system of resolving data conflicts

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7467265B1 (en) * 2005-06-30 2008-12-16 Symantec Operating Corporation System and method for block conflict resolution within consistency interval marker based replication
CN103036717A (en) * 2012-12-12 2013-04-10 北京邮电大学 Consistency maintenance system and methods for distributed-type data
CN104750738A (en) * 2013-12-30 2015-07-01 ***通信集团公司 Data information updating method, data node, management node and system
US9208167B1 (en) * 2014-09-04 2015-12-08 Edifire LLC Distributed data synchronization and conflict resolution
CN104394195A (en) * 2014-10-31 2015-03-04 杭州华为企业通信技术有限公司 Data updating method and device
CN106250322A (en) * 2016-08-12 2016-12-21 华为技术有限公司 A kind of method and apparatus writing data
CN106802939A (en) * 2016-12-30 2017-06-06 华为技术有限公司 A kind of method and system of resolving data conflicts

Also Published As

Publication number Publication date
CN106802939A (en) 2017-06-06
CN106802939B (en) 2020-04-03

Similar Documents

Publication Publication Date Title
WO2018120810A1 (en) Method and system for solving data collision
US10394847B2 (en) Processing data in a distributed database across a plurality of clusters
US10540119B2 (en) Distributed shared log storage system having an adapter for heterogenous big data workloads
AU2012304549B2 (en) Clustered client failover
TW409215B (en) Parallel file system and method for multiple node file access
US11882011B2 (en) Distributed workload reassignment following communication failure
US8352658B2 (en) Fabric based lock manager service
US20170149890A1 (en) Low latency rdma-based distributed storage
JP2019212336A (en) Distributed caching cluster management
US8977703B2 (en) Clustering without shared storage
US8671151B2 (en) Maintaining item-to-node mapping information in a distributed system
US20120278392A1 (en) Distributed shared memory
WO2014169649A1 (en) Data processing method and device, and computer system
US10970311B2 (en) Scalable snapshot isolation on non-transactional NoSQL
US20130332435A1 (en) Partitioning optimistic concurrency control and logging
US11018860B2 (en) Highly available and reliable secret distribution infrastructure
US9747323B1 (en) Method for reconstruction of a distributed lock state after a node addition or removal using a consistent hash
JP2023541298A (en) Transaction processing methods, systems, devices, equipment, and programs
WO2016101759A1 (en) Data routing method, data management device and distributed storage system
US9742692B2 (en) Acquiring resource lease using multiple lease servers
US8732346B2 (en) Coordination of direct I/O with a filter
US9311379B2 (en) Utilization of data structures to synchronize copies of a resource
US8341368B2 (en) Automatic reallocation of structured external storage structures
US10127270B1 (en) Transaction processing using a key-value store
CN111475279B (en) System and method for intelligent data load balancing for backup

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: 17885461

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17885461

Country of ref document: EP

Kind code of ref document: A1