CN-121997381-A - Consistency verification method, device and equipment
Abstract
The application provides a consistency verification method, a consistency verification device and consistency verification equipment, and relates to the technical field of computers or databases. The method comprises the steps of obtaining submitted transaction events and generating a standardized event tuple, wherein the standardized event tuple comprises a global commit sequence number, a time window identifier, a key space fragment identifier, a transaction intention abstract, a result set hash and a database instance identifier, constructing a merck directed acyclic graph based on the standardized event tuple, generating a window root and a global root through step-by-step aggregation by taking the time window identifier and the key space fragment identifier as dimensions, and exchanging the window root across the database instance and executing consistency verification. The method can improve the consistency verification efficiency.
Inventors
- LI CHAO
- RUAN QINGSONG
Assignees
- 中电科金仓(北京)科技股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20251222
Claims (10)
- 1. A method of consistency verification, comprising: Acquiring submitted transaction events and generating a standardized event tuple, wherein the standardized event tuple comprises a global commit sequence number, a time window identifier, a key space fragment identifier, a transaction intention abstract, a result set hash and a database instance identifier; constructing a merck directed acyclic graph based on the standardized event element group, wherein the merck directed acyclic graph uses the time window identifier and the key space fragment identifier as dimensions, and window roots and global roots are generated through gradual aggregation; The window root is exchanged across database instances and consistency verification is performed.
- 2. The method of claim 1, wherein constructing a merck directed acyclic graph based on the normalized set of event tuples comprises: Dividing the transaction event according to the time window identifier and the key space slicing identifier to form a transaction event set; Arranging the transaction events in each transaction event set according to the time sequence indicated by the global commit sequence number, and calculating leaf node hashes, wherein the leaf node hashes are generated by aggregating the transaction intention abstract, the result set hashes and the global commit sequence number; And gradually aggregating the leaf node hashes from bottom to top to generate an intermediate node hash until the window root and the global root are formed.
- 3. The method of claim 2, wherein the bottom-up progressive aggregation of the leaf node hashes to generate an intermediate node hash until the window root and the global root are formed comprises: And for any leaf node, splicing adjacent leaf nodes of the leaf node, the time window identifier, the key space fragmentation identifier, the database instance identifier and metadata of the transaction event to generate an intermediate node hash until the window root and the global root are generated.
- 4. A method according to any of claims 1-3, wherein after the exchanging the window root across database instances and performing consistency verification, the method further comprises: And if the window roots are inconsistent, recursively performing binary search along the time window mark and the key space slicing mark, and positioning a difference leaf node.
- 5. The method of claim 4, wherein after locating the differential leaf node, the method further comprises: Extracting a redo log segment and a data block snapshot corresponding to the difference leaf node; playback verification is performed in an isolated environment and a minimal counterexample is generated.
- 6. The method of claim 5, wherein the generating a minimum counterexample comprises: extracting relevant information of the difference leaf node, wherein the relevant information comprises a global commit sequence number, a key space fragmentation identifier, a time window identifier and a redo log offset corresponding to the difference leaf node; And generating a minimum counterexample based on the related information.
- 7. A method according to any of claims 1-3, characterized in that the global commit sequence number is a system change number or a mixed logic clock.
- 8. A method according to any one of claims 1-3, wherein prior to the generating of the normalized event tuple, the method further comprises: The key space slicing strategy is dynamically adjusted according to the real-time load and the transaction hot spot area, and specifically comprises the following steps of dividing the key space slicing according to the transaction hot spot area, dividing the key space slicing according to the transaction conflict rate and dividing the key space slicing according to the transaction frequency.
- 9. A consistency verification apparatus, comprising: the event tuple generation module is used for acquiring submitted transaction events and generating a standardized event tuple, wherein the standardized event tuple comprises a global submitting sequence number, a time window identifier, a key space fragment identifier, a transaction intention abstract, a result set hash and a database instance identifier; The directed acyclic graph construction module is used for constructing a merck directed acyclic graph based on the standardized event element group, wherein the merck directed acyclic graph uses the time window identifier and the key space fragment identifier as dimensions, and window roots and global roots are generated through gradual aggregation; And the verification module is used for exchanging the window root across database examples and executing consistency verification.
- 10. An electronic device comprising a processor and a memory communicatively coupled to the processor; The memory stores computer-executable instructions; The processor executes computer-executable instructions stored in the memory to implement the method of any one of claims 1 to 8.
Description
Consistency verification method, device and equipment Technical Field The present application relates to the field of computer technologies or database technologies, and in particular, to a method, an apparatus, and a device for verifying consistency. Background In high availability service systems such as finance, telecom, cloud computing and the like, a plurality of computing nodes need to process massive transactional data in real time, and ensuring global data consistency is a core requirement for ensuring service correctness and system reliability. For example, in a distributed database, multiple nodes may process transactions such as user transfer, order creation, inventory update, etc. at the same time, if data inconsistencies between nodes are not found in time, service logic errors, data loss or system crashes may result. In the related art, although partial problems can be solved by the methods of full data comparison, log replay verification, periodic checksum and the like, the method has the limitations of high verification cost, poor positioning precision, incapability of capturing relevant defects of a time line and the like. Disclosure of Invention The application provides a consistency verification method, a consistency verification device and consistency verification equipment, which are used for improving consistency verification efficiency. The application provides a consistency verification method, which comprises the steps of obtaining submitted transaction events and generating a standardized event tuple, wherein the standardized event tuple comprises a global commit sequence number, a time window identifier, a key space fragment identifier, a transaction intention abstract, a result set hash and a database instance identifier, constructing a merck directed acyclic graph based on the standardized event tuple, generating a window root and a global root through gradual aggregation by taking the time window identifier and the key space fragment identifier as dimensions, and exchanging the window root across the database instance and executing consistency verification. In one possible embodiment, the Merck directed acyclic graph is constructed based on a standardized event element group, and comprises the steps of dividing transaction events according to time window identifications and key space fragmentation identifications to form transaction event sets, arranging the transaction events in each transaction event set according to time sequences indicated by global commit numbers, calculating leaf node hashes, wherein the leaf node hashes are generated by aggregating transaction intention summaries, result set hashes and global commit numbers, and aggregating leaf node hashes step by step from bottom to top to generate intermediate node hashes until window roots and global roots are formed. In one possible embodiment, aggregating leaf node hashes step by step from bottom to top to generate an intermediate node hash until a window root and a global root are formed, including, for any one leaf node, stitching neighboring leaf nodes of the leaf node, a time window identifier of a transaction event, a key space sharding identifier, a database instance identifier, and metadata to generate an intermediate node hash until the window root and the global root are generated. In one possible embodiment, after exchanging the window roots across the database instances and performing the consistency verification, the consistency verification method further comprises recursively bipartite searching along the time window identification and the key space sharding identification if the window roots are not consistent, locating the differential leaf nodes. In one possible embodiment, after locating the difference leaf node, the consistency verification method further comprises the steps of extracting the redo log segment and the data block snapshot corresponding to the difference leaf node, and performing replay verification in an isolation environment and generating the minimum counterexample. In one possible embodiment, generating the minimum counterexample comprises extracting relevant information of the difference leaf node, wherein the relevant information comprises a global commit sequence number, a key space slice identifier, a time window identifier and a redo log offset corresponding to the difference leaf node, and generating the minimum counterexample based on the relevant information. In one possible embodiment, the global commit sequence number is a system change number or a mixed logic clock. In one possible embodiment, before generating the standardized event tuples, the consistency verification method further comprises dynamically adjusting a key space slicing strategy according to the real-time load and the transaction hot spot areas, wherein the key space slicing strategy specifically comprises one of dividing the key space slicing according to the transaction hot spot areas, dividing the k