Synchronous anti-collision real-time optimization method and system for DDL (Double Data Language) of heterogeneous database

By obtaining and sorting the DDL operation records of heterogeneous databases in real time, calculating resource overlap and priority values, dynamically adjusting the execution order and directly transmitting it to the database node for execution, the system complexity and performance bottlenecks caused by the intermediate layer in the prior art are solved, and efficient and real-time DDL synchronization operations are achieved.

CN120067218AActive Publication Date: 2025-05-30HANGZHOU KAIYUN JIZHI TECHNOLOGY CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510513671.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-23
Publication Date
2025-05-30
Estimated Expiration
2045-04-23

AI Technical Summary

Technical Problem

The existing heterogeneous database DDL synchronization anti-collision real-time optimization method has increased system architecture complexity, performance bottlenecks and poor real-time performance. Especially in the case of asynchronous synchronization, there may be synchronization delays, which cannot achieve true real-time synchronization.

Method used

By obtaining the DDL operation records of each heterogeneous database in real time, extracting the operation timestamp, and sorting the global timing sequence according to the timestamp. Then, the target table structure of two adjacent DDL operation records is obtained in turn, the resource overlap is calculated, and whether it is greater than the preset overlap. If it is large, a conflict is determined, the preset weight coefficient is obtained, the priority value is calculated, the execution sequence is dynamically adjusted, and the DDL operation record is transmitted to the corresponding database node for execution, and the execution results are obtained and feedback in real time.

Benefits of technology

Eliminate the dependence of the intermediate layer, simplifies the system architecture, improves overall performance, improves real-time and synchronous operation accuracy, avoids potential errors or inconsistencies, ensures priority execution of key DDL operations, and reduces performance bottlenecks caused by the coordination mechanism being out of sync.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067218A_ABST
    Figure CN120067218A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to a heterogeneous database DDL synchronization anti-collision real-time optimization method and system. DDL operation conflict detection is carried out through the timestamps and the resource overlapping degree, dependency of an intermediate layer can be eliminated, DDL operations are sequentially processed by adopting a global time sequence, the performance of the whole system is improved, the sequence and conflict of each operation can be more accurately judged by sorting the DDL operation timestamps, and the efficiency of the whole system is improved. By dynamically adjusting the execution sequence and the priority, it is ensured that the operations are executed according to the priority sequence, quick response can be achieved, delay can be reduced, by obtaining the preset weight coefficient of each operation and calculating the priority value, the system can flexibly adjust the execution sequence according to the current environment, and by obtaining the execution result feedback and adjusting the execution sequence in real time, the execution efficiency is improved. The system can quickly adapt to the error occurrence condition, re-assess and adjust the execution strategy of each operation, and avoid the global influence caused by single-point failure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and particularly relates to a method and system for real-time optimization of heterogeneous database DDL synchronization to prevent conflicts. Background Art

[0002] The database schema definition language DDL (Data Definition Language) is a language used to describe the real-world entities to be stored in a database. The current methods for real-time optimization of heterogeneous database DDL synchronization to prevent conflicts mainly coordinate the DDL synchronization between different databases by introducing an intermediate layer and reduce the probability of conflicts generated when multiple databases modify the same table structure or data simultaneously through incremental synchronization. It can ensure the efficient synchronization of data to a certain extent. However, due to the increase in the complexity of the system architecture by the intermediate layer, it may lead to performance bottlenecks and poor real-time performance. Especially in the case of asynchronous synchronization, there may be synchronization delays and it is impossible to achieve true real-time synchronization, with relatively high complexity. Summary of the Invention

[0003] The main object of the present invention is to provide a method for real-time optimization of heterogeneous database DDL synchronization to prevent conflicts, aiming to solve the technical problems in the prior art.

[0004] The present invention proposes a method for real-time optimization of heterogeneous database DDL synchronization to prevent conflicts, including: Obtaining multiple DDL operation records of each heterogeneous database in real time, and extracting the operation timestamps of each of the DDL operation records; Sorting all the DDL operation records according to each of the operation timestamps to obtain a global time sequence; Obtaining the target table structures of every two adjacent DDL operation records in sequence according to the global time sequence, and obtaining the resource overlap degree of the corresponding two DDL operation records according to the two target table structures; Judging whether the resource overlap degree is greater than a preset overlap degree; If the resource overlap degree is greater than the preset overlap degree, it is determined that the corresponding two adjacent DDL operation records conflict, and the preset weight coefficients of the corresponding two DDL operation records are obtained; Obtaining the priority values of the corresponding DDL operation records according to each of the preset weight coefficients, and dynamically adjusting an execution order identification table according to the priority values to obtain an execution DDL operation sequence; Transmitting each DDL operation record to the nodes of the corresponding heterogeneous database for execution in sequence according to the execution DDL operation sequence, and obtaining real-time feedback of the execution results; If the execution result feedback fails, return to the step of obtaining the preset weight coefficients of the corresponding two DDL operation records until the execution result feedback is successful.

[0005] Preferably, the step of obtaining the resource overlap degree of the corresponding two DDL operation records according to every two of the target table structures includes: Obtain the key elements of each of the target table structures, where the key elements include column names, data types, constraints, and indexes; Obtain the first quantity of column names that are the same in two target table structures, and obtain the quantity of column names in the two target table structures; Obtain the total quantity of column names according to the quantity of column names in the two target table structures, and obtain the column name overlap degree according to the first quantity and the total quantity of column names; Obtain the second quantity of data types that are the same in two target table structures, and obtain the quantity of data types in the two target table structures; Obtain the total quantity of data types according to the quantity of data types in the two target table structures, and obtain the data type overlap degree according to the second quantity and the total quantity of data types; Obtain the third quantity of constraints that are the same in two target table structures, and obtain the quantity of constraints in the two target table structures; Obtain the total quantity of constraints according to the quantity of constraints in the two target table structures, and obtain the constraint overlap degree according to the third quantity and the total quantity of constraints; Obtain the fourth quantity of indexes that are the same in two target table structures, and obtain the quantity of indexes in the two target table structures; Obtain the total quantity of indexes according to the quantity of indexes in the two target table structures, and obtain the index overlap degree according to the fourth quantity and the total quantity of indexes; Obtain the resource overlap degree of the corresponding two DDL operation records according to the index overlap degree, constraint overlap degree, data type overlap degree, and column name overlap degree.

[0006] Preferably, the step of obtaining the priority value of the corresponding DDL operation record according to each of the preset weight coefficients includes: Obtain the resource utilization rate of the corresponding heterogeneous database according to the DDL operation record; Obtain the first minimum adjustment factor under high load and the first maximum adjustment factor under low load of the corresponding heterogeneous database according to the resource utilization rate; Calculate the system load adjustment factor according to the first maximum adjustment factor, the first minimum adjustment factor, and the resource utilization rate, where the calculation formula is: ; Wherein, represents the system load adjustment factor, represents the first minimum adjustment factor, represents the first maximum adjustment factor, represents the resource utilization rate; Obtain the resource overlap degree of two DDL operation records, and respectively obtain the low conflict frequency and the high conflict frequency according to the resource overlap degree; Obtain the second smallest adjustment factor according to the low conflict frequency, and obtain the second largest adjustment factor according to the high conflict frequency; Obtain the conflict frequency adjustment factor according to the second smallest adjustment factor, the second largest adjustment factor and the resource overlap degree; Obtain the corresponding operation timestamp and the current time according to the DDL operation record, and obtain the time difference according to the current time and the operation timestamp; Obtain the preset weight coefficient, and calculate the priority value of the corresponding DDL operation record according to the time difference, the conflict frequency adjustment factor, the system load adjustment factor, the preset weight coefficient and the resource overlap degree, where the calculation formula is: ; Wherein, represents the priority value, represents the system load adjustment factor, represents the time difference, represents the conflict frequency adjustment factor, represents the preset weight coefficient, represents the resource overlap degree.

[0007] Preferably, the step of dynamically adjusting the execution order identification table according to the priority value to obtain the DDL operation sequence to be executed includes: Obtain the first priority value and the second priority value of two adjacent DDL operation records with conflicts in the execution order identification table according to the priority value; Judge whether the first priority value is less than the second priority value; If the first priority value is less than the second priority value, adjust the DDL operation record corresponding to the first priority value to after the DDL operation record corresponding to the second priority value; If the first priority value is not less than the second priority value, obtain the third priority value of the DDL operation record before the DDL operation record corresponding to the first priority value from the execution order identification table, and judge whether the third priority value is less than the first priority value; If the third priority value is less than the first priority value, adjust the DDL operation record corresponding to the third priority value to after the DDL operation record corresponding to the first priority value; If the third priority value is not less than the first priority value, obtain a fourth priority value that is the DDL operation record one position after the DDL operation record corresponding to the second priority value from the execution order identification table, and determine whether the fourth priority value is greater than the second priority value; If the fourth priority value is greater than the second priority value, adjust the DDL operation record corresponding to the fourth priority value to before the DDL operation record corresponding to the second priority value until all conflicting DDL operation records in the execution order table are traversed to obtain an execution DDL operation sequence.

[0008] Preferably, the step of sequentially transmitting each DDL operation record to a corresponding heterogeneous database node for execution according to the execution DDL operation sequence includes: Obtain the real-time network load and initial transmission rate of the heterogeneous database corresponding to each DDL operation record according to the execution DDL operation sequence; Set a maximum load threshold, and calculate and adjust the transmission rate according to the maximum load threshold, real-time network load, and initial transmission rate. The calculation formula is: ; Wherein, represents the adjusted transmission rate, represents the initial transmission rate, represents the real-time network load, represents the maximum load threshold; Determine the primary node and sub-node of each DDL operation record according to the execution DDL operation sequence, and respectively obtain the receive window size of each primary node and sub-node; Divide each DDL operation record into multiple data packets according to the adjusted transmission rate and the corresponding receive window size; Transmit each data packet to the corresponding heterogeneous database node for execution through an adaptive transmission protocol.

[0009] Preferably, the step of determining the primary node and sub-node of each DDL operation record according to the execution DDL operation sequence includes: obtaining the operation type feature of each DDL operation record according to the execution DDL operation sequence, where the operation type feature includes at least one of a create operation, a modify operation, a delete operation, a clear operation, a rename operation, and an index operation; Determine whether the operation type feature belongs to a modify operation; If the operation type feature belongs to a modify operation, transmit the DDL operation record corresponding to the operation type feature to the primary node for execution; If the operation type feature does not belong to the modification operation, the DDL operation record corresponding to the operation type feature is transmitted to the sub-node for execution.

[0010] This application also provides a heterogeneous database DDL synchronization conflict prevention and real-time optimization system, including: An extraction module, configured to obtain multiple DDL operation records of each heterogeneous database in real time, and extract the operation timestamps of each of the DDL operation records; A sorting module, configured to sort all DDL operation records according to each of the operation timestamps to obtain a global time sequence; An acquisition module, configured to sequentially acquire the target table structures of every two adjacent DDL operation records according to the global time sequence, and obtain the resource overlap degree of the corresponding two DDL operation records according to the two target table structures; A judgment module, configured to judge whether the resource overlap degree is greater than a preset overlap degree; If the resource overlap degree is greater than the preset overlap degree, it is determined that a conflict occurs between the corresponding two adjacent DDL operation records, and the preset weight coefficients of the corresponding two DDL operation records are obtained; An adjustment module, configured to obtain the priority value of the corresponding DDL operation record according to each of the preset weight coefficients, and dynamically adjust the execution order identification table according to the priority value to obtain an execution DDL operation sequence; A transmission module, configured to sequentially transmit each DDL operation record to the node of the corresponding heterogeneous database for execution according to the execution DDL operation sequence, and obtain the execution result feedback in real time; If the execution result feedback fails, return to the step of obtaining the preset weight coefficients of the corresponding two DDL operation records until the execution result feedback is successful.

[0011] Preferably, the transmission module includes: An acquisition unit, configured to obtain the real-time network load and the initial transmission rate of the heterogeneous database corresponding to each DDL operation record according to the execution DDL operation sequence; A calculation unit, configured to set a maximum load threshold, and calculate and adjust the transmission rate according to the maximum load threshold, the real-time network load, and the initial transmission rate, where the calculation formula is: ; Wherein, represents the adjusted transmission rate, represents the initial transmission rate, represents the real-time network load, represents the maximum load threshold; A determination unit, configured to determine a primary node and a sub-node of each DDL operation record according to the executed DDL operation sequence, and respectively obtain the reception window sizes of each primary node and sub-node; A splitting unit, configured to split each DDL operation record into multiple data packets according to the adjusted transmission rate and the corresponding reception window size; A transmission unit, configured to transmit each data packet to a node of a corresponding heterogeneous database for execution through an adaptive transmission protocol.

[0012] The present invention further provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the above heterogeneous database DDL synchronization anti-collision real-time optimization method are implemented.

[0013] The present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above heterogeneous database DDL synchronization anti-collision real-time optimization method are implemented.

[0014] The beneficial effects of the present invention are as follows: The present invention detects DDL operation conflicts through timestamps and resource overlap degrees, which can eliminate the dependencies of the intermediate layer, thereby simplifying the system architecture. By adopting a global timing sequence to process DDL operations in sequence, the dependence on the intermediate layer is reduced, and the performance of the overall system is improved. By sorting the timestamps of DDL operations, the order and conflicts of each operation can be judged more precisely, the waiting time in the traditional synchronization process is reduced, and the real-time performance is improved. Whether there is a conflict is judged according to the resource overlap degree between two DDL operations, avoiding the coarse-grained judgment through a simple time window or trigger mechanism. This method can more accurately identify possible conflicting operations, thereby improving the accuracy of synchronization operations and avoiding potential errors or inconsistencies. By directly obtaining the preset weight coefficients of DDL operations and performing priority sorting, the system can avoid the intervention of the intermediate layer, thereby improving the overall performance of the system. By dynamically adjusting the execution order and priority, it is ensured that operations are executed in the order of priority, which can quickly respond and reduce latency. By dynamically adjusting the execution order of DDL operations according to the preset weight coefficients and priority values, conflicts can be processed in real time and operations with higher priorities can be ensured to be executed first. Through the priority dynamic adjustment mechanism based on preset weight coefficients, different priorities can be set according to different business requirements to ensure that critical DDL operations can be executed first and avoid unnecessary delays or errors caused by conflicts. By obtaining the preset weight coefficients of each operation and calculating the priority values, the system can flexibly adjust the execution order according to the current environment. By obtaining the execution result feedback in real time and adjusting the execution order, the system can quickly adapt to the occurrence of errors, re-evaluate and adjust the execution strategy of each operation, and avoid the global impact caused by single-point failures. In a heterogeneous database environment, directly transmitting the DDL operation records to the corresponding database nodes for execution can ensure that each database independently processes its own DDL operations without relying on a central coordination layer. This not only simplifies the cross-database coordination process but also reduces the performance bottleneck caused by the out-of-sync coordination mechanism. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 It is a schematic flowchart of the method according to an embodiment of the present invention.

[0016] Figure 2 It is a schematic structural diagram of the device according to an embodiment of the present invention.

[0017] Figure 3 It is a schematic internal structure diagram of a computer device according to an embodiment of the present application.

[0018] The realization, functional features and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0019] It should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.

[0020] As Figures 1 - 3 shown, the present application provides a real-time optimization method for preventing conflicts in heterogeneous database DDL synchronization, including: S1. Real-time obtain multiple DDL operation records of each heterogeneous database, and extract the operation timestamps of each of the DDL operation records; S2. Sort all the DDL operation records according to each of the operation timestamps to obtain a global time sequence; S3. Sequentially obtain the target table structures of every two adjacent DDL operation records according to the global time sequence, and obtain the resource overlap degree of the corresponding two DDL operation records according to the two target table structures; S4. Judge whether the resource overlap degree is greater than a preset overlap degree; If the resource overlap degree is greater than the preset overlap degree, it is determined that a conflict occurs between the corresponding two adjacent DDL operation records, and the preset weight coefficients of the corresponding two DDL operation records are obtained; S5. Obtain the priority value of the corresponding DDL operation record according to each of the preset weight coefficients, and dynamically adjust the execution order identification table according to the priority value to obtain an execution DDL operation sequence; S6. Transmit each DDL operation record to the nodes of the corresponding heterogeneous database for execution in sequence according to the execution DDL operation sequence, and real-time obtain the execution result feedback; If the execution result feedback fails, return to the step of obtaining the preset weight coefficients of the corresponding two DDL operation records until the execution result feedback is successful.

[0021] As described in the above steps S1 - S6, the current real - time optimization method for preventing conflicts in heterogeneous database DDL synchronization mainly coordinates DDL synchronization between different databases by introducing an intermediate layer and reduces the probability of conflicts generated when multiple databases modify the same table structure or data simultaneously through incremental synchronization. To a certain extent, it can ensure the efficient synchronization of data. However, due to the addition of the intermediate layer, the complexity of the system architecture increases, which may lead to performance bottlenecks and poor real - time performance. Especially in the case of asynchronous synchronization, there may be synchronization delays and true real - time synchronization cannot be achieved, and the complexity is relatively high. In the present invention, the operation timestamps of each DDL operation record are extracted, and all DDL operation records are sorted according to each operation timestamp to obtain a global time sequence. The target table structures of every two adjacent DDL operation records are sequentially obtained through the global time sequence, and the resource overlap degree of the corresponding two DDL operation records is obtained according to every two target table structures. It is judged whether the resource overlap degree is greater than a preset overlap degree. If the resource overlap degree is greater than the preset overlap degree, it is determined that the corresponding two adjacent DDL operation records conflict. The present invention directly relies on timestamps and resource overlap degrees to detect DDL operation conflicts, can eliminate the dependence on the intermediate layer, thereby simplifying the system architecture. By using the global time sequence to process DDL operations sequentially, the dependence on the intermediate layer is reduced, and the overall performance of the system is improved. By sorting the DDL operation timestamps, the order and conflicts of each operation can be judged more precisely, the waiting time in the traditional synchronization process is reduced, and the real - time performance is improved. Whether there is a conflict is judged according to the resource overlap degree between two DDL operations, avoiding the coarse - grained judgment through a simple time window or trigger mechanism. This method can more accurately identify possible conflicting operations, thereby improving the accuracy of synchronization operations and avoiding potential errors or inconsistencies. By adjusting the preset resource overlap degree threshold, different degrees of DDL operation conflicts can be flexibly managed. For example, if the cost of operation conflicts is small, a certain degree of overlap can be tolerated; if the cost is large, the system logic can be adjusted to adopt more strict conflict resolution measures, so as to better meet the requirements of different business scenarios. Through the conflict detection mechanism based on operation timestamps and resource overlap degrees, the system can more intelligently process DDL operations between different databases, reduce the synchronization mechanism that depends on the intermediate layer, and enhance the adaptability to the asynchronous environment. The system independently performs conflict detection and synchronization judgment through each database node, avoiding the bottleneck problems that may occur in the intermediate layer during large - scale expansion. In this way, as the system scale grows, good performance and scalability can be maintained, and the preset weight coefficients of the corresponding two DDL operation records are obtained. The priority value of the corresponding DDL operation record is obtained according to each preset weight coefficient, and the execution order identification table is dynamically adjusted according to the priority value to obtain an execution DDL operation sequence. Each DDL operation record is sequentially transmitted to the nodes of the corresponding heterogeneous database for execution through the execution DDL operation sequence, and the execution result feedback is obtained in real time.If the execution result feedback fails, return to the step of obtaining the preset weight coefficients of the corresponding two DDL operation records until the execution result feedback is successful. By directly obtaining the preset weight coefficients of DDL operations and performing priority sorting, the system can avoid the intervention of the middle layer, thereby improving the overall performance of the system. By dynamically adjusting the execution order and priority, it is ensured that operations are executed in the order of priority, which can quickly respond and reduce latency. Especially in an asynchronous synchronization environment, it can avoid unnecessary waiting to the greatest extent. By dynamically adjusting the execution order of DDL operations according to the preset weight coefficients and priority values, conflicts can be processed in real time and operations with higher priority can be ensured to be executed first. This real-time priority scheduling can make DDL operations executed on demand, avoiding the latency caused by middle layer processing in traditional synchronization mechanisms, thereby improving the real-time performance of the system. If a DDL operation fails to execute, the system will return to re-obtain the weight coefficients and adjust the execution order until it succeeds. This feedback mechanism ensures that the system can quickly respond and adjust when encountering execution problems, thereby achieving more efficient fault recovery and real-time execution. When it is found that two adjacent DDL operations conflict, through the priority dynamic adjustment mechanism based on the preset weight coefficients, different priorities can be set for different business requirements to ensure that critical DDL operations can be executed first, avoiding unnecessary latency or errors caused by conflicts. By obtaining the preset weight coefficients of each operation and calculating the priority values, the system can flexibly adjust the execution order according to the current environment. For example, when the load is light, low-priority operations can be executed quickly, while when the system load is high, important DDL operations can be executed first. By obtaining the execution result feedback in real time and adjusting the execution order, the system can quickly adapt to the occurrence of errors, re-evaluate and adjust the execution strategy of each operation, and avoid the global impact caused by single-point failure. In a heterogeneous database environment, directly transmitting the DDL operation records to the corresponding database nodes for execution can ensure that each database independently processes its own DDL operations without relying on a central coordination layer. This not only simplifies the cross-database coordination process but also reduces the performance bottleneck caused by the out-of-sync coordination mechanism.,

[0022] In one embodiment, the step S3 of obtaining the resource overlap degree of the corresponding two DDL operation records according to every two of the target table structures includes: S31. Obtain the key elements of each of the target table structures, where the key elements include column names, data types, constraints, and indexes; S32. Obtain the first quantity of the same column names in two target table structures, and obtain the quantity of column names of the two target table structures; S33. Obtain the total quantity of column names according to the quantity of column names of the two target table structures, and obtain the column name overlap degree according to the first quantity and the total quantity of column names; S34. Obtain the second quantity of the same data types in the two target table structures, and obtain the quantity of data types of the two target table structures; S35. Obtain the total quantity of data types according to the quantity of data types of the two target table structures, and obtain the data type overlap degree according to the second quantity and the total quantity of data types; S36. Obtain the third quantity of the same constraints in the two target table structures, and obtain the quantity of constraints of the two target table structures; S37. Obtain the total quantity of constraints according to the quantity of constraints of the two target table structures, and obtain the constraint overlap degree according to the third quantity and the total quantity of constraints; S38. Obtain the fourth quantity of the same indexes in the two target table structures, and obtain the quantity of indexes of the two target table structures; S39. Obtain the total quantity of indexes according to the quantity of indexes of the two target table structures, and obtain the index overlap degree according to the fourth quantity and the total quantity of indexes; S310. Obtain the resource overlap degree of the corresponding two DDL operation records according to the index overlap degree, the constraint overlap degree, the data type overlap degree, and the column name overlap degree.

[0023] As described in the above steps S31 - S310, the present invention obtains the column names, data types, constraints, and indexes of the key elements of each target table structure, obtains the total number of column names through the number of column names of the two target table structures, and obtains the column name overlap degree according to the first number of the same column names and the total number of column names in the two target table structures. Obtains the total number of data types according to the number of data types of the two target table structures, and obtains the data type overlap degree according to the second number of the same data types and the total number of data types in the two target table structures. Obtains the total number of constraints according to the number of constraints of the two target table structures, and obtains the constraint overlap degree according to the third number of the same constraints and the total number of constraints in the two target table structures. Obtains the total number of indexes according to the number of indexes of the two target table structures, and obtains the index overlap degree according to the fourth number of the same indexes and the total number of indexes in the two target table structures. Obtains the resource overlap degree of the corresponding two DDL operation records according to the index overlap degree, constraint overlap degree, data type overlap degree, and column name overlap degree. By obtaining the overlap degrees of column names, data types, constraints, and indexes, it can help identify the similarities and differences between target tables. These overlap degree indicators (such as column name overlap degree, data type overlap degree, etc.) can help developers or system designers formulate more effective synchronization strategies. For example, when the overlap degrees of column names and data types between two tables are relatively high, it may not be necessary to fully synchronize all their data or DDL operations. Incremental synchronization or only synchronizing the non - overlapping parts can be selected to reduce the burden on the system. By quantifying the overlap degrees between different target table structures, the system can automatically identify to a certain extent which tables have tight synchronization requirements and which have loose ones. In this way, the synchronization mechanism can be optimized, and the complexity of intermediate layer coordination can be reduced. Using these overlap degree indicators can reduce the differences in table structures processed by the system during synchronization and avoid introducing excessive complexity in the architecture design. For example, if there is a high overlap degree of column names or data types in the DDL operations between two databases, more efficient synchronization of these table structures can be selected, while avoiding unnecessary intermediate layer processing. By calculating and adjusting the overlap degree, it can help optimize the synchronization operation.For example, in the case of asynchronous synchronization, the system can intelligently select the synchronization frequency, synchronization strategy, and the table data to be synchronized, which can reduce the burden on the middle layer and avoid the need to process DDL operations for all tables during each synchronization, thereby alleviating the system's performance bottleneck. By calculating the overlap degree, the amount of calculation and data transmission during each synchronization can be reduced, significantly improving the overall performance and response speed of the system. As the database structure evolves, the overlap degree can be calculated and monitored in real time, and the synchronization strategy can be dynamically adjusted. For changes in the overlap degree of different tables, the synchronization frequency, method, and content can be flexibly adjusted to ensure that the system is always in an optimal state. Based on the overlap degree of column names, data types, constraints, and indexes, better resource coordination can be achieved, which helps manage cross-database DDL operations, avoid resource contention or duplicate operations, and improve the overall resource utilization rate of the system.

[0024] In one embodiment, step S5 of obtaining the priority value of the corresponding DDL operation record according to each preset weight coefficient includes: S51. Obtain the resource utilization rate of the corresponding heterogeneous database according to the DDL operation record; S52. Obtain the first minimum adjustment factor under high load and the first maximum adjustment factor under low load of the corresponding heterogeneous database according to the resource utilization rate; S53. Calculate the system load adjustment factor according to the first maximum adjustment factor, the first minimum adjustment factor, and the resource utilization rate, where the calculation formula is: ; Wherein, represents the system load adjustment factor, represents the first minimum adjustment factor, represents the first maximum adjustment factor, represents the resource utilization rate; S54. Obtain the resource overlap degree of two DDL operation records, and respectively obtain the low conflict frequency and the high conflict frequency according to the resource overlap degree; S55. Obtain the second minimum adjustment factor according to the low conflict frequency, and obtain the second maximum adjustment factor according to the high conflict frequency; S56. Obtain the conflict frequency adjustment factor according to the second minimum adjustment factor, the second maximum adjustment factor, and the resource overlap degree; S57. Obtain the corresponding operation timestamp and the current time according to the DDL operation record, and obtain the time difference according to the current time and the operation timestamp; S58. Obtain the preset weight coefficient, and calculate the priority value of the corresponding DDL operation record according to the time difference, the conflict frequency adjustment factor, the system load adjustment factor, the preset weight coefficient, and the resource overlap degree, where the calculation formula is: ; Among them, represents the priority value, represents the system load adjustment factor, represents the time difference, represents the conflict frequency adjustment factor, represents the preset weight coefficient, represents the resource overlap degree.

[0025] As described in the above steps S51 - S58, the present invention obtains the resource utilization rate of the corresponding heterogeneous database through DDL operation records, obtains the first minimum adjustment factor of the corresponding heterogeneous database under high load and the first maximum adjustment factor under low load according to the resource utilization rate, calculates the system load adjustment factor based on the first maximum adjustment factor, the first minimum adjustment factor and the resource utilization rate, obtains the low conflict frequency and the high conflict frequency respectively through the resource overlap degree of two DDL operation records, obtains the second minimum adjustment factor according to the low conflict frequency, obtains the second maximum adjustment factor according to the high conflict frequency, and obtains the conflict frequency adjustment factor through the second minimum adjustment factor, the second maximum adjustment factor and the resource overlap degree. Among them, the method of calculating the conflict frequency adjustment factor through the second minimum adjustment factor, the second maximum adjustment factor and the resource overlap degree is the same as the calculation method of the system load adjustment factor. By directly calculating based on the resource utilization rate, the load adjustment factor and the conflict frequency adjustment factor to coordinate heterogeneous databases, rather than relying on the middle layer to handle the synchronization logic, the complexity of the architecture can be effectively reduced. Although the introduction of the middle layer can play a coordinating role, it will increase additional maintenance and management costs and may lead to performance bottlenecks. By improving the calculation mechanism, the dependence on the middle layer is reduced, and the complexity of the system architecture is lowered. By obtaining the resource utilization rate of the database in real time and adjusting the corresponding load and conflict frequency adjustment factors, it can ensure that the resources of different databases are optimally utilized under high load and low load. The calculation of the load adjustment factor is based on the resource utilization rate, which helps to appropriately adjust the database in both high load and low load situations, ensuring the overall stability and performance of the system. The middle layer often causes delays in data synchronization, especially in the asynchronous synchronization mode, and such delays may lead to data consistency problems.Through the dynamic adjustment of the resource utilization rate and the conflict frequency adjustment factor, the latency in the synchronization process can be reduced, improving real-time performance. The dynamic calculation of the load and conflict adjustment factors enables the system to quickly respond to changing workloads and resource conditions, avoiding the inevitable latency problems in traditional middle-layer synchronization methods. Through the optimized calculation of the system load and conflict frequency adjustment factors, the bottleneck problems that may occur in the database under high load can be effectively reduced. Especially in the case of high resource overlap and high conflict frequency, the calculation method of the adjustment factor can help reduce the conflicts and latency of database operations, thereby improving the system's throughput and response speed. By calculating the conflict frequency adjustment factor, the data synchronization frequency can be precisely adjusted, especially optimized for low-conflict and high-conflict situations. Through the calculation of the resource overlap degree and conflict frequency, the synchronization timing can be predicted and controlled more accurately, thus avoiding latency and unnecessary synchronization conflicts. The system dynamically adjusts the synchronization operation timing according to the load and conflict situations, which helps to achieve faster data synchronization and lower latency. By adopting a dynamic calculation method based on the resource utilization rate, load adjustment factor, and conflict frequency, the system can adaptively adjust according to the real-time resource status and load conditions. This enables the system to better handle different types of load changes, enhancing the system's stability and flexibility. Especially in resource-constrained or high-concurrency scenarios, the system can automatically adjust to meet the challenges. There are often differences in resources, architectures, and loads between heterogeneous databases. This method takes these differences into account by dynamically calculating the adjustment factor, thereby improving the coordination and consistency between different databases and avoiding over-reliance on the middle layer for coordination work, helping to reduce problems caused by synchronization inconsistencies between heterogeneous systems. By obtaining the corresponding operation timestamp and the current time from the DDL operation record, and obtaining the time difference based on the current time and the operation timestamp. By obtaining the preset weight coefficient, and calculating the priority value of the corresponding DDL operation record according to the time difference, conflict frequency adjustment factor, system load adjustment factor, preset weight coefficient, and resource overlap degree. By calculating the priority value based on dynamic parameters such as the operation timestamp, time difference, conflict frequency, and system load, the system can adjust the priority of the synchronization operation according to the real-time situation. For example, some DDL operations may require more urgent processing (such as operations involving data consistency), while others may be able to be delayed.This delicate priority calculation helps optimize the operation execution order, avoiding unnecessary blocking and delays. By combining the conflict frequency adjustment factor and resource overlap degree to adjust the operation priorities, resource conflicts and competition between databases can be reduced, preventing data consistency issues due to synchronization operations among multiple databases. An effective resource scheduling mechanism can ensure the coordinated execution of DDL operations for each database, reducing performance degradation caused by conflicts. The introduction of the system load adjustment factor enables flexible adjustment of the DDL synchronization priority according to the current system state (such as CPU, memory, etc.) under different load conditions. This means the system can automatically adjust the synchronization operations according to the current running status, avoiding bottlenecks caused by excessive synchronization operations during high loads or quickly completing operations during low loads, improving the overall resource utilization rate. By calculating specific priorities, the system can achieve finer-grained control over the synchronization process. For example, when facing multiple database synchronizations, the system can precisely divide priorities among operations, avoiding the inefficiency of blind synchronization and improving the real-time synchronization ability and overall system coordination. Through priority adjustment based on the above methods, the system can dynamically manage the operation order and delays according to real-time conditions, minimizing the negative impacts of asynchronous synchronization. For example, if a high delay is detected for certain operations, the system may automatically adjust their priorities, processing other operations first or triggering other emergency measures.

[0026] In one embodiment, step S5 of dynamically adjusting the execution order identification table according to the priority value to obtain the DDL operation execution sequence includes: S59. Obtain the first priority value and the second priority value of two adjacent DDL operation records in conflict in the execution order identification table according to the priority value; S510. Determine whether the first priority value is less than the second priority value; If the first priority value is less than the second priority value, adjust the DDL operation record corresponding to the first priority value to after the DDL operation record corresponding to the second priority value; If the first priority value is not less than the second priority value, obtain the third priority value of the DDL operation record one position before the DDL operation record corresponding to the first priority value from the execution order identification table, and determine whether the third priority value is less than the first priority value; If the third priority value is less than the first priority value, adjust the DDL operation record corresponding to the third priority value to after the DDL operation record corresponding to the first priority value; If the third priority value is not less than the first priority value, obtain a fourth priority value of a DDL operation record that is one position after the DDL operation record corresponding to the second priority value from the execution order identification table, and determine whether the fourth priority value is greater than the second priority value; If the fourth priority value is greater than the second priority value, adjust the DDL operation record corresponding to the fourth priority value to before the DDL operation record corresponding to the second priority value until all conflicting DDL operation records in the execution order table are traversed to obtain a DDL operation execution sequence.

[0027] As described in the above steps S59 - S510, the present invention obtains the first priority value and the second priority value of two adjacent DDL operation records in conflict in the execution order identification table through the priority value, and determines whether the first priority value is less than the second priority value. If the first priority value is less than the second priority value, the DDL operation record corresponding to the first priority value is adjusted to after the DDL operation record corresponding to the second priority value. If the first priority value is not less than the second priority value, the third priority value of the DDL operation record before the DDL operation record corresponding to the first priority value is obtained from the execution order identification table, and it is determined whether the third priority value is less than the first priority value. If the third priority value is less than the first priority value, the DDL operation record corresponding to the third priority value is adjusted to after the DDL operation record corresponding to the first priority value. If the third priority value is not less than the first priority value, the fourth priority value of the DDL operation record after the DDL operation record corresponding to the second priority value is obtained from the execution order identification table, and it is determined whether the fourth priority value is greater than the second priority value. If the fourth priority value is greater than the second priority value, the DDL operation record corresponding to the fourth priority value is adjusted to before the DDL operation record corresponding to the second priority value, until all the conflicting DDL operation records in the execution order table are traversed to obtain the DDL operation execution sequence. By using the priority value to precisely control the order of DDL operations, it is ensured that adjacent DDL operations can be re - sorted according to the priority when a conflict occurs. By adjusting the priority and judging the priority relationship between adjacent operations, the occurrence of conflicts can be effectively avoided, thereby ensuring the consistency and integrity of data. By directly adjusting the operation order in the execution order identification table without the need to introduce a complex intermediate - layer coordination mechanism, traditional solutions may require multiple levels of coordination and synchronization, which will increase the complexity of the system and bring potential performance bottlenecks. By adjusting the priority value in the execution order identification table, conflicts can be directly handled at the database level, thereby reducing the complexity of the system architecture. By avoiding the introduction of an additional intermediate layer, the system can schedule and execute DDL operations more efficiently, reducing the synchronization delay caused by the intermediate layer. Through the priority mechanism, the execution order can be flexibly adjusted to ensure that the operation order is reasonable under specific conditions. This mechanism is not limited to the current conflict resolution, but also provides an extended space for new operations or requirements that may appear in the future. By dynamically adjusting the operation order, problems caused by synchronization delay can be reduced, especially in the case of asynchronous synchronization. Since there is no dependence on an external coordination layer, adjustments can be directly made in the execution sequence, thereby reducing the synchronization time and delay and improving real - time performance.This enables the system to synchronize more efficiently and precisely among multiple databases. By introducing a method of adjusting the execution order of DDL operations through priority values, the present invention solves the complexity and performance bottleneck problems brought about by traditional DDL synchronization between different databases through an intermediate layer, thereby effectively improving the real-time performance, performance, and flexibility of the system, reducing synchronization latency, and optimizing the architecture of the entire system.

[0028] In one embodiment, step S6 of sequentially transmitting each DDL operation record to a corresponding node of a heterogeneous database according to the DDL operation execution sequence includes: S61. Obtain the real-time network load and initial transmission rate of the heterogeneous database corresponding to each DDL operation record according to the DDL operation execution sequence; S62. Set a maximum load threshold, and calculate an adjusted transmission rate according to the maximum load threshold, real-time network load, and initial transmission rate, where the calculation formula is: ; Wherein, represents the adjusted transmission rate, represents the initial transmission rate, represents the real-time network load, represents the maximum load threshold; S63. Determine the primary node and sub-nodes of each DDL operation record according to the DDL operation execution sequence, and respectively obtain the receive window sizes of each primary node and sub-node; S64. Divide each DDL operation record into multiple data packets according to the adjusted transmission rate and the corresponding receive window size; S65. Transmit each data packet to the corresponding node of the heterogeneous database for execution through an adaptive transmission protocol.

[0029] As described in the above steps S61 - S65, the present invention obtains the real - time network load and the initial transmission rate of the heterogeneous database corresponding to each DDL operation record by executing the DDL operation sequence. By setting a maximum load threshold and calculating and adjusting the transmission rate based on the maximum load threshold, real - time network load, and initial transmission rate, the main node and sub - node of each DDL operation record are determined by executing the DDL operation sequence, and the receive window sizes of each main node and sub - node are obtained respectively. Each DDL operation record is divided into multiple data packets by adjusting the transmission rate and the corresponding receive window size, and each data packet is transmitted to the nodes of the corresponding heterogeneous database for execution through an adaptive transmission protocol. The present invention avoids the complexity of using an intermediate layer in the traditional method. By optimizing the network load and transmission rate, direct synchronization between heterogeneous databases is achieved, eliminating the need for an additional synchronization management layer or middleware, and directly operating on database nodes, reducing the architecture level and management costs. By setting a maximum load threshold and dynamically adjusting it according to the real - time network load and initial transmission rate, excessive load and network congestion are avoided, thereby improving the transmission efficiency and performance. By dividing each DDL operation record into multiple data packets and adjusting according to the receive window size and transmission rate, it helps to balance the data flow and avoid network congestion caused by an overly large single data packet, thus enhancing the efficiency and stability of the transmission. The present invention can dynamically adjust the network load and transmission rate and directly control the transmission path (main node and sub - node), avoiding the problems of delay accumulation and synchronization delay in the traditional method. Through the adaptive transmission protocol and the strategy of dividing data packets, it ensures that DDL operations can be synchronized to the target database nodes more quickly and accurately, solving the problem of poor real - time performance that may exist in asynchronous synchronization. By setting a load threshold and dynamically adjusting the transmission rate, the synchronization delay caused by overly heavy network load or resource limitations in the traditional method is effectively avoided. Each database node (main node and sub - node) has an independent receive window. By precisely controlling the window size, it ensures that data packets can be efficiently and quickly delivered to the target node, avoiding delays caused by untimely transmission. By establishing independent adjustment mechanisms (such as adjusting the transmission rate, receive window size, etc.) for different database nodes, it can flexibly adapt to the performance characteristics and requirements of different heterogeneous databases, further improving the overall efficiency and stability of the system. Through precise packet segmentation, transmission rate adjustment, and receive window control, this method has good scalability and can adapt to database clusters of different scales and the increasing demand for DDL operations.

[0030] In one embodiment, step S63 of determining the main node and sub - node of each DDL operation record according to the execution of the DDL operation sequence includes: S631. Obtain the operation type feature of each of the DDL operation records according to the executed DDL operation sequence, where the operation type feature includes at least one of a creation operation, a modification operation, a deletion operation, a clearing operation, a renaming operation, and an indexing operation; S632. Determine whether the operation type feature belongs to a modification operation; If the operation type feature belongs to a modification operation, transmit the DDL operation record corresponding to the operation type feature to the master node for execution; If the operation type feature does not belong to a modification operation, transmit the DDL operation record corresponding to the operation type feature to the slave node for execution.

[0031] As described in the above steps S631 - S632, the present invention obtains the operation type feature of each of the DDL operation records by executing the DDL operation sequence, where the operation type feature includes at least one of a creation operation, a modification operation, a deletion operation, a clearing operation, a renaming operation, and an indexing operation, determines whether the operation type feature belongs to a modification operation, if the operation type feature belongs to a modification operation, transmits the DDL operation record corresponding to the operation type feature to the master node for execution, if the operation type feature does not belong to a modification operation, transmits the DDL operation record corresponding to the operation type feature to the slave node for execution. The present invention directly transmits the DDL operation to the appropriate node (master node or slave node) for execution according to the operation type feature, avoiding the introduction of a complex intermediate layer for coordination. Through classification operations (such as modification operations, deletion operations, etc.), it is possible to clearly determine the execution location of each DDL operation, avoiding the cumbersome scheduling process and additional coordination mechanisms that may occur in traditional methods. Hand over the modification operation to the master node for execution, and hand over other operations (such as creation, deletion, etc.) to the slave node for execution, which can optimize the node load according to the characteristics of different operations. The master node is usually used to handle operations that require global consistency, and the slave node handling other operations can achieve load balancing, avoiding the performance bottleneck caused by centralized processing. By intelligently judging the operation type and distributing it to different nodes, it is avoided to execute all DDL operations on a single node, thereby reducing the operation latency. Quickly transmitting the DDL operation to the master node or slave node according to the operation type can effectively avoid the latency problem in the asynchronous synchronization process. The timely execution of the modification operation ensures data consistency, while the decentralized execution of other operations ensures that no additional synchronization latency is generated. By classifying operations and distributing them to different nodes (master node or slave node), it has high scalability. Compared with the traditional complex method of coordination through an intermediate layer, this intelligent scheduling-based scheme can synchronize data more efficiently, reduce latency, and improve execution efficiency when processing a large number of DDL operations, thereby achieving better performance and real-time synchronization in a heterogeneous database environment.

[0032] This application also provides a real-time optimization system for preventing conflicts in heterogeneous database DDL synchronization, including: An extraction module, configured to obtain multiple DDL operation records of each heterogeneous database in real time, and extract the operation timestamps of each of the DDL operation records; A sorting module, configured to sort all DDL operation records according to each of the operation timestamps to obtain a global time sequence; An acquisition module, configured to sequentially obtain the target table structures of every two adjacent DDL operation records according to the global time sequence, and obtain the resource overlap degree of the corresponding two DDL operation records according to every two of the target table structures; A judgment module, configured to judge whether the resource overlap degree is greater than a preset overlap degree; If the resource overlap degree is greater than the preset overlap degree, it is determined that a conflict occurs between the corresponding two adjacent DDL operation records, and the preset weight coefficients of the corresponding two DDL operation records are obtained; An adjustment module, configured to obtain the priority value of the corresponding DDL operation record according to each of the preset weight coefficients, and dynamically adjust the execution order identification table according to the priority value to obtain an execution DDL operation sequence; A transmission module, configured to sequentially transmit each DDL operation record to the nodes of the corresponding heterogeneous database for execution according to the execution DDL operation sequence, and obtain real-time execution result feedback; If the execution result feedback fails, return to the step of obtaining the preset weight coefficients of the corresponding two DDL operation records until the execution result feedback is successful.

[0033] In one embodiment, the transmission module includes: An acquisition unit, configured to obtain the real-time network load and the initial transmission rate of the heterogeneous database corresponding to each DDL operation record according to the execution DDL operation sequence; A calculation unit, configured to set a maximum load threshold, and calculate and adjust the transmission rate according to the maximum load threshold, the real-time network load, and the initial transmission rate, where the calculation formula is: ; Wherein, represents the adjusted transmission rate, represents the initial transmission rate, represents the real-time network load, represents the maximum load threshold; A determination unit, configured to determine the primary node and the secondary node of each DDL operation record according to the execution DDL operation sequence, and respectively obtain the reception window sizes of each primary node and secondary node; A splitting unit, configured to split each DDL operation record into multiple data packets according to the adjusted transmission rate and the corresponding receive window size; A transmission unit, configured to transmit each data packet to a node of a corresponding heterogeneous database for execution through an adaptive transmission protocol.

[0034] It should be noted that each module and unit in the heterogeneous database DDL synchronization anti-collision real-time optimization system corresponds one by one to the steps in the heterogeneous database DDL synchronization anti-collision real-time optimization method.

[0035] As Figure 3 shown, the present application also provides a computer device, which may be a server, and its internal structure may be as Figure 3 shown. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer design is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store all data required for the process of the heterogeneous database DDL synchronization anti-collision real-time optimization method. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements the heterogeneous database DDL synchronization anti-collision real-time optimization method.

[0036] Those skilled in the art can understand that Figure 3 the structure shown in

[0037] is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.

[0038] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium provided in this application and used in the embodiments can include non-volatile and / or volatile memories. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.

[0039] It should be noted that in this article, the term "including", "comprising", or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, apparatus, article, or method including that element.

[0040] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structure or equivalent process transformation made by using the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall equally be included in the patent protection scope of the present invention.

Claims

1. A real-time optimization method for heterogeneous database DDL synchronization and conflict prevention, characterized in that: include: Acquire multiple DDL operation records of each heterogeneous database in real time, and extract the operation timestamp of each DDL operation record; Sorting all DDL operation records according to each of the operation timestamps to obtain a global time series; sequentially acquiring the target table structure of each two adjacent DDL operation records according to the global time series, and acquiring the resource overlap of the corresponding two DDL operation records according to each two target table structures; Determining whether the resource overlap is greater than a preset overlap; If the resource overlap is greater than a preset overlap, it is determined that a conflict occurs between two adjacent DDL operation records, and preset weight coefficients of the two DDL operation records are obtained; Obtaining a priority value of a corresponding DDL operation record according to each of the preset weight coefficients, and dynamically adjusting the execution order identification table according to the priority value to obtain an execution DDL operation sequence; According to the DDL operation sequence, each DDL operation record is sequentially transmitted to the node of the corresponding heterogeneous database for execution, and execution result feedback is obtained in real time; If the execution result feedback fails, return to the step of obtaining the preset weight coefficients corresponding to the two DDL operation records until the execution result feedback is successful.

2. The heterogeneous database DDL synchronization anti-conflict real-time optimization method according to claim 1 is characterized in that: The step of obtaining the resource overlap of two DDL operation records corresponding to each two target table structures includes: Acquire key elements of each target table structure, wherein the key elements include column name, data type, constraint and index; Get the first number of columns with the same name in the two target table structures, and get the number of column names in the two target table structures; Obtaining the total number of column names according to the number of column names of the two target table structures, and obtaining the degree of column name overlap according to the first number and the total number of column names; Obtain the second quantity of the same data type in the two target table structures, and obtain the quantity of the data type of the two target table structures; Acquire the total number of data types according to the number of data types of the two target table structures, and acquire the degree of data type overlap according to the second number and the total number of data types; Get the third quantity of the same constraints in the two target table structures, and get the quantity of constraints in the two target table structures; Acquire the total number of constraints according to the number of constraints of the two target table structures, and acquire the constraint overlap degree according to the third number and the total number of constraints; Get the fourth number of the same indexes in the two target table structures, and get the number of indexes of the two target table structures; Acquire the total number of indexes according to the number of indexes of the two target table structures, and acquire the index overlap degree according to the fourth number and the total number of indexes; The resource overlap of the two DDL operation records is obtained according to the index overlap, the constraint overlap, the data type overlap and the column name overlap.

3. The heterogeneous database DDL synchronization anti-conflict real-time optimization method according to claim 1 is characterized in that: The step of obtaining the priority value of the corresponding DDL operation record according to each of the preset weight coefficients includes: Obtaining resource usage of corresponding heterogeneous databases according to the DDL operation records; According to the resource usage rate, obtain a first minimum adjustment factor under high load and a first maximum adjustment factor under low load of the corresponding heterogeneous database; The system load adjustment factor is calculated according to the first maximum adjustment factor, the first minimum adjustment factor and the resource usage rate, wherein the calculation formula is: ; in, represents the system load adjustment factor, represents the first minimum adjustment factor, represents the first maximum adjustment factor, Indicates resource utilization; Obtain resource overlap between two DDL operation records, and respectively obtain a low conflict frequency and a high conflict frequency according to the resource overlap; Acquire a second minimum adjustment factor according to the low conflict frequency, and acquire a second maximum adjustment factor according to the high conflict frequency; Acquire a conflict frequency adjustment factor according to the second minimum adjustment factor, the second maximum adjustment factor, and the resource overlap; Acquire a corresponding operation timestamp and current time according to the DDL operation record, and acquire a time difference according to the current time and the operation timestamp; Obtain a preset weight coefficient, and calculate the priority value of the corresponding DDL operation record according to the time difference, the conflict frequency adjustment factor, the system load adjustment factor, the preset weight coefficient and the resource overlap, wherein the calculation formula is: ; in, Indicates the priority value. represents the system load adjustment factor, Indicates the time difference, represents the conflict frequency adjustment factor, Represents the preset weight coefficient, Indicates the degree of resource overlap.

4. The heterogeneous database DDL synchronization anti-conflict real-time optimization method according to claim 1 is characterized in that: The step of dynamically adjusting the execution order identification table according to the priority value to obtain the execution DDL operation sequence includes: Obtaining, according to the priority value, a first priority value and a second priority value of two adjacent conflicting DDL operation records in the execution order identification table; Determining whether the first priority value is less than the second priority value; If the first priority value is less than the second priority value, adjusting the DDL operation record corresponding to the first priority value to after the DDL operation record corresponding to the second priority value; If the first priority value is not less than the second priority value, obtaining a third priority value of a DDL operation record that is one digit before the DDL operation record corresponding to the first priority value from the execution order identification table, and determining whether the third priority value is less than the first priority value; If the third priority value is less than the first priority value, the DDL operation record corresponding to the third priority value is adjusted to after the DDL operation record corresponding to the first priority value; If the third priority value is not less than the first priority value, obtaining a fourth priority value of a DDL operation record located one position after the DDL operation record corresponding to the second priority value from the execution order identification table, and determining whether the fourth priority value is greater than the second priority value; If the fourth priority value is greater than the second priority value, the DDL operation record corresponding to the fourth priority value is adjusted to before the DDL operation record corresponding to the second priority value until all conflicting DDL operation records in the execution order table are traversed to obtain the execution DDL operation sequence.

5. The heterogeneous database DDL synchronization anti-conflict real-time optimization method according to claim 1 is characterized in that: The step of transmitting each DDL operation record in sequence to a node of a corresponding heterogeneous database for execution according to the DDL operation sequence includes: Acquire the real-time network load and initial transmission rate of the heterogeneous database corresponding to each DDL operation record according to the execution of the DDL operation sequence; A maximum load threshold is established, and the transmission rate is calculated and adjusted according to the maximum load threshold, the real-time network load and the initial transmission rate, wherein the calculation formula is: ; in, Indicates adjusting the transmission rate. represents the initial transmission rate, Indicates the real-time network load, Indicates the maximum load threshold; Determine the master node and the sub-node of each DDL operation record according to the DDL operation sequence, and obtain the receiving window size of each master node and sub-node respectively; dividing each DDL operation record into a plurality of data packets according to the adjusted transmission rate and the corresponding receiving window size; Each data packet is transmitted to the node corresponding to the heterogeneous database for execution through an adaptive transmission protocol.

6. The heterogeneous database DDL synchronization anti-conflict real-time optimization method according to claim 5 is characterized in that: The step of determining the primary node and the secondary node of each DDL operation record according to the DDL operation sequence execution includes: Acquire an operation type feature of each of the DDL operation records according to the DDL operation sequence, wherein the operation type feature includes at least one of a create operation, a modify operation, a delete operation, a clear operation, a rename operation, and an index operation; Determining whether the operation type feature belongs to a modification operation; If the operation type characteristic belongs to a modification operation, the DDL operation record corresponding to the operation type characteristic is transmitted to the master node for execution; If the operation type feature does not belong to a modification operation, the DDL operation record corresponding to the operation type feature is transmitted to the sub-node for execution.

7. A heterogeneous database DDL synchronization anti-conflict real-time optimization system, characterized in that: include: An extraction module, used to obtain multiple DDL operation records of each heterogeneous database in real time, and extract the operation timestamp of each DDL operation record; A sorting module, used to sort all DDL operation records according to each operation timestamp to obtain a global time series sequence; An acquisition module, configured to sequentially acquire the target table structure of each two adjacent DDL operation records according to the global timing sequence, and acquire the resource overlap between the corresponding two DDL operation records according to each two target table structures; A determination module, used to determine whether the resource overlap is greater than a preset overlap; If the resource overlap is greater than a preset overlap, it is determined that a conflict occurs between two adjacent DDL operation records, and preset weight coefficients of the two DDL operation records are obtained; An adjustment module, configured to obtain a priority value of a corresponding DDL operation record according to each of the preset weight coefficients, and dynamically adjust the execution sequence identification table according to the priority value to obtain an execution DDL operation sequence; A transmission module, used to transmit each DDL operation record in sequence to the node of the corresponding heterogeneous database for execution according to the DDL operation execution sequence, and obtain execution result feedback in real time; If the execution result feedback fails, return to the step of obtaining the preset weight coefficients corresponding to the two DDL operation records until the execution result feedback is successful.

8. The heterogeneous database DDL synchronization anti-conflict real-time optimization system according to claim 7 is characterized in that: The transmission module comprises: An acquisition unit, configured to acquire the real-time network load and initial transmission rate of the heterogeneous database corresponding to each DDL operation record according to the execution DDL operation sequence; The calculation unit is used to set a maximum load threshold, and calculate and adjust the transmission rate according to the maximum load threshold, the real-time network load and the initial transmission rate, wherein the calculation formula is: ; in, Indicates adjusting the transmission rate. represents the initial transmission rate, Indicates the real-time network load, Indicates the maximum load threshold; A determination unit, configured to determine a master node and a sub-node of each DDL operation record according to the DDL operation sequence, and obtain a receiving window size of each master node and sub-node respectively; a segmentation unit, configured to segment each DDL operation record into a plurality of data packets according to the adjusted transmission rate and the corresponding receiving window size; The transmission unit is used to transmit each data packet to the node corresponding to the heterogeneous database for execution through an adaptive transmission protocol.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Data access method and device, server and storage medium

    CN109710629A

  • Parallel execution method based on log analysis synchronization and data synchronization system

    CN111858505A

  • DDL operation synchronization method and synchronization system based on log analysis

    CN112559626A

  • Database data definition language DDL operation increment analysis method and device

    CN118981472A

  • Optimization method, device and system for target end concurrency in database synchronization

    CN119066082A