Database migration difference intelligent identification and repair method and system, electronic equipment and readable storage medium
By constructing a six-dimensional difference feature vector and AI pattern classification, combined with multiple repair strategies, the problem of insufficient difference pattern recognition during database migration was solved, achieving efficient and stable difference repair and strategy optimization.
Patent Information
- Application Number
- CN202611616616.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-19
- Publication Date
- 2026-11-24
AI Technical Summary
Existing technologies lack intelligent identification of discrepancy patterns and targeted repair strategies during database migration, leading to repeated processing, increased repair time, or repeated discrepancies, and lack a continuous feedback and optimization mechanism for repair results.
By constructing a six-dimensional difference feature vector, an AI difference pattern classification engine is used to identify hot key values, batch deletion, table structure changes, data skew, and other patterns. The system then matches these patterns with strategies such as eventual consistency, range deletion, DDL priority, and partition re-migration. Combined with secondary verification and re-verification, the system optimizes the repair strategy to improve its targeting and stability.
It enables intelligent identification and efficient repair of database migration differences, improves the targeting and stability of repair, reduces repair time, and continuously optimizes repair strategies.
Smart Images

Figure CN123157693A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of database migration and data consistency processing technology, and in particular to a method and system for intelligent identification and repair of database migration differences, an electronic device, and a computer-readable storage medium. Background Technology
[0002] When migrating a database from an old system to a new system, a full migration is typically performed first, followed by continuous synchronization of incremental changes to the source database using Change Data Capture (CDC). Due to factors such as high-frequency updates, batch deletions, table structure changes, uneven partition load, and log collection or application latency, data differences may still exist between the source and target databases after a full migration.
[0003] Patent document CN201810122509.1, entitled "Big Data Migration Method, Apparatus, Equipment and Storage Medium," discloses a technical solution that distinguishes between changed and unchanged data and employs incremental migration for changed data. However, this solution primarily identifies changed data based on timestamps or log locations, without further classifying migration differences according to characteristics such as change frequency, operation type proportion, number of consecutive updates, and spatiotemporal aggregation, nor does it match different repair strategies for different difference patterns.
[0004] Patent document CN201710825934.2, entitled "An Incremental Data Synchronization Method and Terminal Device," discloses a technical solution for acquiring actual new user data within a preset time period from multiple business subsystems and performing incremental synchronization. This solution focuses on the incremental data acquisition and synchronization consistency between different business subsystems, but does not address the identification of differences after full migration, the construction of six-dimensional difference features, or the matching of difference repair strategies.
[0005] Patent document CN202211361207.2 discloses a technical solution that uses a Pareto optimization model to select a migration strategy, with the optimization objective focusing on reducing overall migration costs. However, this solution does not specifically establish difference modes for incremental difference repair scenarios, such as hotspot key-value pairs, batch deletion, normal incremental changes, table structure changes, data skew, and abnormal noise. Furthermore, it does not disclose a closed-loop mechanism for continuously optimizing classification thresholds and repair strategies based on repair success rate, repair time, and post-repair stability.
[0006] The aforementioned existing technologies can improve incremental migration, incremental synchronization, or migration strategy selection, but for migration differences caused by different reasons, they still mainly adopt relatively fixed processing methods such as resynchronization, row-by-row updates, whole table re-migration, or manual intervention. They lack technical solutions for intelligently identifying difference patterns and automatically matching targeted repair strategies.
[0007] Different discrepancy patterns require different handling methods: hot key-value pairs may only need to skip intermediate states and synchronize the latest values; batch deletion is suitable for range deletion; table structure changes should be synchronized with data definition language changes first; data skew may require re-migrating specific partitions; a small number of discrepancies with unknown sources should be delayed and re-verified. If the same repair method is used for all discrepancies, it is easy to cause duplicate processing, increased repair time, or repeated occurrences of discrepancies. Existing technology also lacks a closed-loop optimization mechanism that feeds back the repair success rate, repair time, and stability verification results to the classification threshold and repair strategy. Summary of the Invention
[0008] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and system for intelligent identification and repair of database migration differences, an electronic device, and a computer-readable storage medium to solve the problems of lack of patterned identification of database migration differences, insufficient targeting of fixed repair methods, and inability to continuously provide feedback and optimization of repair results in the prior art.
[0009] To achieve the above objectives, the present invention provides a method for intelligent identification and repair of database migration differences, comprising: After the full migration is complete, start the change data capture log collector to continuously capture change events in the source database; The data from the source database and the target database are sampled and compared to determine the differences. For the discrepancy data, extract the key value change frequency, operation type proportion distribution, number of consecutive updates, time difference between verification time and last change time, proportion of discrepancy rows, and degree of time clustering and primary key space clustering to construct a discrepancy feature vector; The AI difference pattern classification engine is used to classify the difference feature vectors and identify hot key-value patterns, batch deletion patterns, normal incremental patterns, table structure change patterns, data skew patterns, or abnormal noise patterns. The repair strategy matching engine matches the eventual consistency strategy, range deletion strategy, MERGE strategy, DDL priority strategy, partition re-migration strategy, or delayed retry strategy based on the identified difference pattern. The repair task is executed by the repair task executor corresponding to the matched repair strategy, the repair result is verified a second time, and then verified again after a preset time after the second verification is passed. Based on the repair success rate, repair time, and re-verification results, the classification threshold of the AI difference pattern classification engine and the repair strategy of the repair strategy matching engine are optimized.
[0010] Furthermore, the change data capture log collector collects the binary logs or write-ahead logs of the source database and standardizes the collection results into a change event stream; the change events in the change event stream include operation type, primary key, data before change, data after change, and change time; the change event stream is written to a buffer queue, and the full snapshot metadata records the data state when the full migration is completed.
[0011] Further, the difference feature vector is represented as V=(f1, f2, f3, f4, f5, f6), where: f1 is the number of changes to the same key value within a preset time window; f2 is the proportion distribution of INSERT, UPDATE, and DELETE operations within the preset time window; f3 is the maximum number of consecutive UPDATE operations for the same key value; f4 is the time difference between the verification time and the last change time; f5 is the ratio of the number of difference rows to the total number of rows in the corresponding data table; and f6 represents the degree of clustering of change events in the time dimension and the primary key space dimension.
[0012] Furthermore, the AI difference pattern classification engine identifies difference patterns according to at least one of the following conditions: When f1 is greater than 10 times / minute and f3 is greater than 20, or f4 is less than 5 seconds and f1 is greater than 5 times / minute, it is identified as a hotspot key value pattern; When the proportion of DELETE operations is greater than 80%, f5 is greater than 20%, and the degree of time clustering and the degree of primary key space clustering both reach the corresponding thresholds, it is identified as a batch deletion mode; When f1 is less than or equal to 1 time / minute, f4 is greater than 60 seconds, and the operation type is INSERT or a small number of UPDATE operations, it is identified as normal incremental mode. When the target database is missing a field, a recent ALTER TABLE operation is detected in the source database, and multiple difference objects have the same missing field, it is identified as a table structure change pattern. When f5 is greater than 30%, the differential data is concentrated in the target partition, and the change frequency of the target partition is higher than that of other partitions, it is identified as a data skew pattern. When the number of difference rows is less than 10, the source of the difference cannot be traced from the change event stream, and multiple verification results are inconsistent, it is identified as an abnormal noise pattern.
[0013] Furthermore, the eventual consistency strategy is used to skip the intermediate state of hot key values and read the latest value from the source database and write it to the target database; The range deletion strategy is used to perform batch deletion based on primary key range or time range; The MERGE strategy is used to perform inserts or updates in a merged write manner; The DDL priority strategy is used to first perform the corresponding data definition language change on the target database, and then synchronize the difference data. The partition re-migration strategy is used to perform conditional re-migration on target partitions that have experienced data skew. The delayed retry strategy is used to re-verify after a preset delay, and to perform repair only if the difference still exists.
[0014] Furthermore, the re-verification is performed 30 minutes after the second verification passes; the repair success rate, the repair time, and the re-verification result are recorded as feedback data; when the repair success rate is below 80%, the corresponding difference data is marked as difficult samples; for every 1000 processed records, the classification model is retrained or the classification threshold is adjusted based on the feedback data; when the repair time reaches a preset condition, the optimization of the corresponding repair strategy is triggered.
[0015] Furthermore, the AI difference pattern classification engine, the repair strategy matching engine, and the repair task executor are deployed in a private cloud operating environment; the change data capture log collector is deployed on an independent node and collects the change logs of the source database in a non-intrusive manner; anomaly records and model parameters are persistently stored in the database.
[0016] This invention also provides a database migration difference intelligent identification and repair system, comprising: The acquisition module is used to continuously capture change events in the source database after the full migration is completed; The feature construction module is used to sample and compare data from the source database and the target database to determine the difference data, and extract six-dimensional features from the difference data to construct a difference feature vector; The AI classification module is used to identify hot key-value patterns, batch deletion patterns, normal incremental patterns, table structure change patterns, data skew patterns, or abnormal noise patterns. The policy matching module is used to match an eventual consistency policy, range deletion policy, MERGE policy, DDL priority policy, partition re-migration policy, or delayed retry policy based on the identified difference pattern. The repair execution module is used to execute repair tasks through the repair task executor corresponding to the matched repair strategy, perform secondary verification on the repair results, and perform a second verification after a preset time after the secondary verification passes. The feedback optimization module is used to optimize the classification threshold and repair strategy based on the repair success rate, repair time, and re-verification results.
[0017] The present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the method described above.
[0018] The present invention also provides a computer-readable storage medium having a computer program stored thereon, the computer program implementing the above-described method when executed by a processor.
[0019] Compared with the prior art, the present invention has at least the following beneficial effects: This invention distinguishes the difference formation pattern through a six-dimensional difference feature vector, so that the repair task is matched with the cause of the difference; the repair stability is observed through secondary verification and a second verification after 30 minutes; the classification threshold and repair strategy are continuously optimized by the repair success rate, repair time and the results of the second verification, thereby improving the targeting, efficiency and stability of database migration difference repair. Attached Figure Description
[0020] Figure 1 This is a flowchart of the intelligent identification and repair method for database migration differences according to the present invention.
[0021] Figure 2 This is a schematic diagram of the layered architecture of the database migration difference intelligent identification and repair system of the present invention.
[0022] Figure 3 This is a schematic diagram of the AI difference pattern classification and repair strategy matching process of the present invention.
[0023] Figure 4 This is a schematic diagram of the incremental difference repair timing for five types of data representation examples of the present invention.
[0024] Figure 5 This is a schematic diagram of the structure of the electronic device of the present invention.
[0025] Figure labeling: 100—Intelligent identification and repair system for database migration differences; 110—Acquisition module; 120—Feature construction module; 130—AI classification module; 140—Strategy matching module; 150—Repair execution module; 160—Feedback optimization module; 200—Source database; 300—Target database; 400—Private cloud operating environment; 500—Electronic device; 510—Processor; 520—Memory. Detailed Implementation
[0026] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The described embodiments are for illustrative purposes only and are not intended to limit the scope of protection of the present invention. Unless otherwise specified, the following embodiments and their technical features can be combined with each other.
[0027] like Figure 1As shown, in step S101, after the full migration is completed, the CDC log collector is started to continuously capture change events of the source database 200. The CDC log collector can collect MySQL's binlog or PostgreSQL's WAL, or it can be implemented using Debezium, Canal, Maxwell, Flink CDC, or GoldenGate. The collection results are standardized into a change event stream, and each change event includes at least the operation type, primary key, data before the change, data after the change, and change time; the change event stream is written to a buffer queue, and the full snapshot metadata records the data state when the full migration is completed.
[0028] In step S102, data from the source database 200 and the target database 300 are sampled and compared to identify discrepancies. Samples can be extracted by data table, partition, or primary key range, and checksums can be calculated. For ranges with inconsistent checksums, a row-by-row comparison is further performed to obtain the discrepancy records and their corresponding data tables, partitions, primary keys, and field information.
[0029] In step S103, the feature construction module 120 associates the difference data with the change event stream to construct a six-dimensional difference feature vector V=(f1, f2, f3, f4, f5, f6). Here, f1 is the number of changes to the same key value within a preset time window; f2 is the proportion distribution of INSERT, UPDATE, and DELETE operations; f3 is the maximum number of consecutive UPDATE operations on the same key value; f4 is the time difference between the verification time and the last change time; f5 is the ratio of the number of difference rows to the total number of rows in the corresponding data table; and f6 characterizes the degree of clustering of change events in the time dimension and primary key space dimension.
[0030] In step S104, the AI difference pattern classification engine in the AI classification module 130 classifies the difference feature vectors. The AI difference pattern classification engine can consist of a rule classifier, a supervised learning classification model, or a combination of both; the rule classifier can be implemented using Drools, and the supervised learning classification model can be trained using scikit-learn and deployed using JPMML.
[0031] The example criteria for hotspot key-value pattern are: f1 greater than 10 times / minute and f3 greater than 20, or f4 less than 5 seconds and f1 greater than 5 times / minute. The example criteria for batch deletion pattern are: DELETE operations account for more than 80%, f5 greater than 20%, and both the time clustering degree and the primary key space clustering degree reach the corresponding thresholds.
[0032] The typical criteria for determining normal incremental mode are: f1 is less than or equal to 1 time / minute, f4 is greater than 60 seconds, and the operation type is INSERT or a small number of UPDATE operations. The typical criteria for determining table structure change mode are: the target database 300 is missing a field, a recent ALTER TABLE operation is detected in the source database 200, and multiple difference objects have the same missing field.
[0033] Example criteria for determining data skew mode: f5 greater than 30%, differential data concentrated in the target partition, and the change frequency of the target partition is higher than that of other partitions. Example criteria for determining abnormal noise mode: the number of differential rows is less than 10, the source of the difference cannot be traced from the change event stream, and multiple verification results are inconsistent. The above thresholds can be adjusted according to the actual database size and feedback data.
[0034] In step S105, the strategy matching module 140 selects a repair strategy based on the difference pattern output by the AI classification module 130. The hot key-value pattern corresponds to the eventual consistency strategy, which skips intermediate states and reads the latest value from the source database 200 and writes it to the target database 300; the batch deletion pattern corresponds to the range deletion strategy, which performs batch deletion according to the primary key range or time range; and the normal incremental pattern corresponds to the MERGE strategy, which performs insertion or update in a merged write manner.
[0035] The table structure change mode corresponds to the DDL priority strategy, which means that the corresponding data definition language change is performed on the target database 300 first, and then the difference data is synchronized; the data skew mode corresponds to the partition re-migration strategy, which means that conditional re-migration is performed on the target partition where data skew occurs; the abnormal noise mode corresponds to the delayed retry strategy, which means that the verification is performed again after a preset delay, and the repair is only performed if the difference still exists.
[0036] In step S106, the repair execution module 150 calls the repair task executor corresponding to the matched repair strategy to execute the repair task. A secondary verification is performed immediately after the repair is completed; after the secondary verification passes, a second verification is performed after 30 minutes to determine if the repair result is stable. The repair task and its verification result are recorded for subsequent statistical purposes.
[0037] In step S107, the feedback optimization module 160 statistically analyzes the repair success rate, repair time, and re-verification results. When the repair success rate is below 80%, the corresponding discrepancy data is marked as difficult samples; for every 1000 processed records, the classification model is retrained or the classification threshold is adjusted based on the feedback data; when the repair time of a certain repair strategy reaches a preset condition, the optimization of that repair strategy is triggered.
[0038] In another embodiment, the present invention also provides a database migration difference intelligent identification and repair system 100. For example... Figure 2As shown, system 100 is organized into a data acquisition layer, a feature layer, an AI classification layer, a strategy layer, an execution layer, and a feedback layer, including a data acquisition module 110, a feature construction module 120, an AI classification module 130, a strategy matching module 140, a repair execution module 150, and a feedback optimization module 160. Each module sequentially completes the acquisition of change events, the construction of differential features, the recognition of differential patterns, the matching of repair strategies, the execution of repair tasks, and the optimization of repair effect feedback.
[0039] System 100 takes change events from source database 200 and sampling comparison results between source database 200 and target database 300 as input. Acquisition module 110 transmits the standardized change event stream to feature construction module 120; feature construction module 120 transmits the constructed differential feature vectors to AI classification module 130; AI classification module 130 transmits the identified differential patterns to policy matching module 140; policy matching module 140 transmits the matched repair strategy to repair execution module 150; repair execution module 150 transmits the repair results and verification results to feedback optimization module 160; the optimization results generated by feedback optimization module 160 are used to adjust the classification threshold of AI classification module 130 and the repair strategy of policy matching module 140.
[0040] The acquisition module 110 continuously captures change events of the source database 200 after the full migration is completed. The acquisition module 110 may include a CDC log collector, which collects binary logs or write-ahead logs from the source database 200 and standardizes the collection results into a change event stream. Each change event includes at least the operation type, primary key, data before the change, data after the change, and change time. The change event stream is written to a buffer queue, and the full snapshot metadata is used to record the data state when the full migration is completed, so that the feature construction module 120 can determine the change process corresponding to the differing data.
[0041] The feature construction module 120 is used to sample and compare data from the source database 200 and the target database 300 to determine the difference data. The feature construction module 120 can extract samples and calculate check values according to data tables, partitions, or primary key ranges, and further compare the ranges of inconsistent check values row by row; then, it associates the difference data with the change event stream, extracts the key value change frequency, operation type proportion distribution, number of consecutive updates, time difference between check time and last change time, proportion of difference rows, and degree of time clustering and primary key space clustering, constructs a six-dimensional difference feature vector V=(f1, f2, f3, f4, f5, f6), and outputs the difference feature vector to the AI classification module 130.
[0042] The AI classification module 130 is used to classify the differential feature vectors output by the feature construction module 120. The AI classification module 130 may include an AI differential pattern classification engine, which consists of a rule-based classifier, a supervised learning classification model, or a combination of both. It includes six pattern classifiers for identifying hot key-value patterns, batch deletion patterns, normal incremental patterns, table structure change patterns, data skew patterns, and abnormal noise patterns. The six pattern classifiers can calculate the confidence score of each pattern in parallel, or they can judge each pattern sequentially according to rule priority, ultimately outputting a differential pattern.
[0043] The strategy matching module 140 is used to match repair strategies based on the difference patterns output by the AI classification module 130. Specifically, hotspot key-value patterns are matched with an eventual consistency strategy, batch deletion patterns with a range deletion strategy, normal incremental patterns with a MERGE strategy, table structure change patterns with a DDL priority strategy, data skew patterns with a partition re-migration strategy, and abnormal noise patterns with a delayed retry strategy. The strategy matching module 140 sends the matching results to the repair execution module 150, allowing the difference data from different causes to enter the corresponding repair task executors.
[0044] The repair execution module 150 is used to call the repair task executor corresponding to the matched repair strategy to execute the repair task. For hot key-value mode, the repair execution module 150 skips intermediate states and writes the latest value of the source database 200 to the target database 300; for batch deletion mode, batch deletion is performed according to the primary key range or time range; for normal incremental mode, insertion or update is performed in a merged write manner; for table structure change mode, the corresponding data definition language change is first performed on the target database 300, and then the difference data is synchronized; for data skew mode, conditional re-migration is performed on the target partition where data skew occurs; for abnormal noise mode, re-verification is performed after a preset delay, and repair is performed if the difference still exists.
[0045] After the repair task is completed, the repair execution module 150 performs a secondary verification on the repair results to confirm whether the corresponding data in the source database 200 and the target database 300 are consistent. A second verification is performed 30 minutes after the secondary verification passes to determine if the repair results are stable. The repair execution module 150 records the repair results, repair time, secondary verification results, and re-verification results for each repair task, and sends the recorded results to the feedback optimization module 160.
[0046] The feedback optimization module 160 is used to perform feedback optimization based on the repair success rate, repair time, and re-verification results. The feedback optimization module 160 determines the repair success rate based on the number of difference rows that passed the second verification and the number of repaired difference rows; when the repair success rate is below 80%, the corresponding difference data is marked as difficult samples; every 1000 processed records, the classification model is retrained or the classification threshold is adjusted based on the feedback data; when the repair time of a certain repair strategy reaches a preset condition, the optimization of that repair strategy is triggered. The optimized classification threshold is provided to the AI classification module 130, and the optimized repair strategy is provided to the strategy matching module 140, thus forming a closed loop of identification, repair, verification, and feedback.
[0047] The AI classification module 130, policy matching module 140, and repair execution module 150 in system 100 can be deployed in a private cloud runtime environment 400, with anomaly records and model parameters persistently stored in a database. The CDC log collector in the collection module 110 can be deployed on a separate node, accessing the source database 200 in a non-intrusive manner. System 100 can be implemented in Java, the CDC log collector can use Debezium or Canal, the classification model can be trained using scikit-learn and run via JPMML, and rule classification can be implemented using Drools; in other implementations, it can also be implemented in Python or Go, using Maxwell, Flink CDC, or GoldenGate to collect change logs.
[0048] like Figure 3 As shown, the differential feature vectors output by the feature construction module 120 are fed into the six pattern classifiers in the AI classification module 130. After obtaining the differential patterns, the policy matching module 140 selects the corresponding repair strategy and submits it to the repair execution module 150 for execution. After the repair is completed, the feedback optimization module 160 adjusts the classification threshold or repair strategy according to the verification results provided by the repair execution module 150, so that subsequent differential data are processed according to the updated classification threshold and repair strategy.
[0049] like Figure 5 As shown, the electronic device 500 includes a processor 510 and a memory 520. The memory 520 stores a computer program, which, when executed by the processor 510, implements the aforementioned intelligent identification and repair method for database migration differences. The computer program may also be stored in a computer-readable storage medium.
[0050] Specific function implementation process like Figure 4As shown, this embodiment takes five different types of data tables—user balance table, order log table, product information table, log table, and configuration table—as examples. Following the time sequence of T0 full migration completion, T1 (+2h) pattern recognition, T2 (+4h) repair execution, T3 (+6h) secondary verification, and T4 (+8h) migration completion, it demonstrates the specific implementation process of incremental difference identification, repair strategy matching, and repair result verification.
[0051] In phase T0, the user balance table, order log table, product information table, log table, and configuration table contained 1000, 500, 50, 200, and 5 discrepancies, respectively. In phase T1, the 800 discrepancies in the user balance table were identified as hot key-value patterns, the 480 discrepancies in the order log table were identified as batch deletion patterns, the 50 discrepancies in the product information table were identified as normal incremental patterns, the 200 discrepancies in the log table were identified as data skew patterns, and the 5 discrepancies in the configuration table were identified as abnormal noise patterns.
[0052] In phase T2, the user balance table adopts an eventual consistency strategy, skipping intermediate states and synchronizing the latest value from the source database; the order log table adopts a range deletion strategy; the product information table adopts a MERGE strategy; the log table uses a partition re-migration strategy for partition P2023; and the configuration table adopts a delayed retry strategy. In phase T3, a second verification is performed, and the repair results for the first four data tables are all verified successfully, with the abnormal noise in the configuration table disappearing. In phase T4, all five data tables pass verification and are repaired within 8 hours.
[0053] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for intelligent identification and repair of database migration differences, characterized in that, include: After the full migration is complete, start the change data capture log collector to continuously capture change events in the source database; The data from the source database and the target database are sampled and compared to determine the differences. For the discrepancy data, extract the key value change frequency, operation type proportion distribution, number of consecutive updates, time difference between verification time and last change time, proportion of discrepancy rows, and degree of time clustering and primary key space clustering to construct a discrepancy feature vector; The AI difference pattern classification engine is used to classify the difference feature vectors and identify hot key-value patterns, batch deletion patterns, normal incremental patterns, table structure change patterns, data skew patterns, or abnormal noise patterns. The repair strategy matching engine matches the eventual consistency strategy, range deletion strategy, MERGE strategy, DDL priority strategy, partition re-migration strategy, or delayed retry strategy based on the identified difference pattern. The repair task is executed by the repair task executor corresponding to the matched repair strategy, the repair result is verified a second time, and then verified again after a preset time after the second verification is passed. Based on the repair success rate, repair time, and re-verification results, the classification threshold of the AI difference pattern classification engine and the repair strategy of the repair strategy matching engine are optimized.
2. The method of claim 1, wherein, The change data capture log collector collects the binary logs or write-ahead logs of the source database and standardizes the collection results into a change event stream. The change events in the change event stream include operation type, primary key, data before change, data after change, and change time. The change event stream is written to a buffer queue, and the full snapshot metadata records the data status when the full migration is completed.
3. The method of claim 1, wherein, The difference feature vector is represented as V=(f1, f2, f3, f4, f5, f6), where: f1 is the number of times the same key value is changed within a preset time window; f2 is the proportion distribution of INSERT, UPDATE, and DELETE operations within the preset time window; f3 is the maximum number of consecutive UPDATE operations for the same key value; f4 is the time difference between the verification time and the last change time; f5 is the ratio of the number of difference rows to the total number of rows in the corresponding data table; and f6 represents the degree of clustering of change events in the time dimension and the primary key space dimension.
4. The method of claim 3, wherein, The AI difference pattern classification engine identifies difference patterns according to at least one of the following conditions: When f1 is greater than 10 times / minute and f3 is greater than 20, or f4 is less than 5 seconds and f1 is greater than 5 times / minute, it is identified as a hotspot key value pattern; When the proportion of DELETE operations is greater than 80%, f5 is greater than 20%, and the degree of time clustering and the degree of primary key space clustering both reach the corresponding thresholds, it is identified as a batch deletion mode; When f1 is less than or equal to 1 time / minute, f4 is greater than 60 seconds, and the operation type is INSERT or a small number of UPDATE operations, it is identified as normal incremental mode. When the target database is missing a field, a recent ALTER TABLE operation is detected in the source database, and multiple difference objects have the same missing field, it is identified as a table structure change pattern. When f5 is greater than 30%, the differential data is concentrated in the target partition, and the change frequency of the target partition is higher than that of other partitions, it is identified as a data skew pattern. When the number of difference rows is less than 10, the source of the difference cannot be traced from the change event stream, and multiple verification results are inconsistent, it is identified as an abnormal noise pattern.
5. The method according to claim 1, characterized in that: The eventual consistency strategy is used to skip the intermediate state of hot key values and read the latest value from the source database and write it to the target database. The range deletion strategy is used to perform batch deletion based on primary key range or time range; The MERGE strategy is used to perform inserts or updates in a merged write manner; The DDL priority strategy is used to first perform the corresponding data definition language change on the target database, and then synchronize the difference data. The partition re-migration strategy is used to perform conditional re-migration on target partitions that have experienced data skew. The delayed retry strategy is used to re-verify after a preset delay, and to perform repair only if the difference still exists.
6. The method of claim 1, wherein, The re-verification is performed 30 minutes after the second verification passes; the repair success rate, the repair time, and the re-verification result are recorded as feedback data; when the repair success rate is below 80%, the corresponding difference data is marked as difficult samples; for every 1000 processed records, the classification model is retrained or the classification threshold is adjusted based on the feedback data; when the repair time reaches a preset condition, the optimization of the corresponding repair strategy is triggered.
7. The method of claim 1, wherein, The AI difference pattern classification engine, the repair strategy matching engine, and the repair task executor are deployed in a private cloud environment; the change data capture log collector is deployed on an independent node and collects change logs from the source database in a non-intrusive manner; anomaly records and model parameters are persistently stored in the database.
8. A database migration difference intelligent identification and repair system, characterized in that, include: The acquisition module is used to continuously capture change events in the source database after the full migration is completed; The feature construction module is used to sample and compare data from the source database and the target database to determine the difference data, and extract six-dimensional features from the difference data to construct a difference feature vector; The AI classification module is used to identify hot key-value patterns, batch deletion patterns, normal incremental patterns, table structure change patterns, data skew patterns, or abnormal noise patterns. The policy matching module is used to match an eventual consistency policy, range deletion policy, MERGE policy, DDL priority policy, partition re-migration policy, or delayed retry policy based on the identified difference pattern. The repair execution module is used to execute repair tasks through the repair task executor corresponding to the matched repair strategy, perform secondary verification on the repair results, and perform a second verification after a preset time after the secondary verification passes. The feedback optimization module is used to optimize the classification threshold and repair strategy based on the repair success rate, repair time, and re-verification results.
9. An electronic device comprising a memory and a processor, characterized in that The memory stores a computer program that, when executed by the processor, causes the processor to perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program, when executed by a processor, implements the method of any one of claims 1 to 7.
Citation Information
Patent Citations
An incremental data synchronization method, a terminal device, and a computer-readable storage medium
CN107689998B
Big data migration method, apparatus and device, and storage medium
CN108446315A
A Big Data Migration Optimization Method Combining Distributed Clusters and Virtual Machine Rooms
CN115509461B
