A deterministic transactional data warehouse archiving and synchronization system for internet database services
By establishing a mapping relationship between the target data version and the deterministic version of the source transaction in the Internet database synchronization system, and using the deletion constraint fidelity frontier and primary key final state reconstruction module to process the historical transaction chain, the problem of loss of deletion state after merging and compressing the target columnar data warehouse is solved, and secure historical transaction playback and synchronization are realized.
Patent Information
- Application Number
- CN202611157998.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-31
- Publication Date
- 2026-11-27
AI Technical Summary
Existing internet database synchronization systems may fail to retain deleted states after merging, compressing, rebuilding, or replacing partitions in a target columnar data warehouse, causing older historical transactions to be rewritten and resulting in deleted data reappearing.
Establish a mapping relationship between the target data version and the deterministic version of the source transaction. By deleting the constraint fidelity frontier management module, a replay access boundary is formed to ensure that transactions with versions higher than the frontier are directly replayed, while transactions with versions lower than the frontier are not directly entered into the target business table. The historical transaction chain is processed through the primary key final state reconstruction module to generate final state reconstruction records.
This avoids rewriting of lower version updates after the target deletion status becomes invalid, ensuring the safety of deletion transactions and legitimate re-insertion, and improving the determinism of archive synchronization and the safety of fault recovery.
Smart Images

Figure CN123178504A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of database synchronization technology, and in particular to a deterministic transactional data warehouse archiving synchronization system for Internet database services. Background Technology
[0002] As the scale and update frequency of business data in Internet database services continue to increase, it is often necessary to synchronize data from relational source databases to columnar data warehouses to meet the needs of historical data archiving, statistical analysis, and query acceleration. Existing synchronization systems generally first import the full amount of data based on a consistent snapshot, and then subscribe to the binary transaction log through a global transaction identifier to continuously obtain new, updated, and deleted transactions. They also use version fields, primary key write-on-write merging, and deletion markers to handle duplicate deliveries and out-of-order writes. When the online transaction log of the source database is cleaned up or the synchronization task is interrupted, archived transaction logs can also be obtained from object storage, or historical transactions can be retrieved from the failure retry queue, persistent pending application logs, and old checkpoints and replayed.
[0003] Existing solutions typically rely on deletion markers and their versions stored in the target data warehouse to prevent historical updates prior to deletion transactions from taking effect again. However, after performing merge compression, table reconstruction, partition replacement, or historical data cleanup, the target data warehouse may no longer retain deletion states that can be used for version comparison. Meanwhile, the synchronization system may still obtain historical updates prior to deletion transactions from archived transaction logs, failure retry queues, or old checkpoints. If historical updates are directly written to the target business table using the normal transaction replay method, the target side, lacking corresponding deletion version constraints, may reconfirm the historical updates as valid primary key data, causing data that has been deleted in the source database to reappear in the target data warehouse. Therefore, how to avoid the recovery of deleted data by low-version historical transactions while ensuring that legitimate re-insertion and subsequent updates after deletion can be synchronized normally, given that the comparable range of deletion states on the target side is shorter than the replayable range of historical transactions in the synchronization system, becomes a problem that existing deterministic transactional data warehouse archiving and synchronization technologies need to solve. Summary of the Invention
[0004] The technical problem this invention aims to solve is that in existing Internet database synchronization systems, the target columnar data warehouse may no longer retain the deletion status that can participate in version comparison after merging and compressing, table reconstruction, or partition replacement. However, the synchronization system may still obtain historical updates before the deletion transaction from the archived transaction log, the failure retry queue, or the old checkpoint, causing the low-version historical transactions to be rewritten into the target business table, making the deleted data reappear. To address this, we propose a deterministic transactional data warehouse archiving synchronization system for Internet database services.
[0005] To achieve the above objectives, this application adopts the following technical solution: a deterministic transactional data warehouse archiving and synchronization system for Internet database services, comprising: a synchronization data acquisition and version labeling module, used to acquire the full data of the source database, real-time transaction logs, and historical transactions to be replayed, configure a full version lower than the incremental transaction version range for the full data, generate a deterministic version for row-level incremental transactions, and record the mapping relationship between the write batch, the target data version, and the deterministic version range; a deletion constraint fidelity frontier management module, used to form a deletion constraint fidelity frontier to be effective based on the target data version range and mapping relationship to be processed by the data warehouse maintenance task, and convert it into a valid deletion constraint fidelity frontier after maintenance; a historical replay admission judgment module, used to compare the deterministic version of the row-level change to be replayed with the valid deletion constraint fidelity frontier, generate direct replay of the row-level change when it is higher than the frontier, and prohibit its direct writing to the target business table when it is not higher than the frontier, and when the final state reconstruction task is created, compare the current valid application checkpoint with the replay range termination checkpoint of the historical transaction to be replayed in order of the source transaction. The checkpoints are solidified as the reconstruction termination checkpoints and generate final-state reconstruction tasks. The affected primary key and transaction chain construction module is used to extract affected primary keys from the final-state reconstruction tasks, obtain the status of each affected primary key in the verifiable data baseline, and the complete transaction chain from the verifiable data baseline to the reconstruction termination checkpoint. The primary key final-state reconstruction module is used to load the baseline status in the isolation space, process the complete transaction chain according to the deterministic version, and generate a primary key final-state reconstruction record containing the final state type, final state version, and final state row data. The data warehouse writing and final-state repair module is used to write direct replay row-level changes according to the deterministic version. When the final state type is valid and the target business table does not have a corresponding primary key or the current primary key version is lower than the final state version, the final state row is written. When the final state type is deletion and the target business table has a corresponding primary key with the current primary key version lower than the final state version, the final state deletion is executed. The task status management module is used to freeze the direct replay tasks that overlap with the pending deletion constraint fidelity frontier before it takes effect, and record the processing status of the direct replay tasks, final-state reconstruction tasks, and final-state repair.
[0006] Preferably, the synchronization data acquisition and version labeling module obtains the global transaction identifier execution set of the source database as the snapshot boundary before initiating a consistent snapshot transaction. Under repeatable read snapshots, it divides the full data into shards according to the primary key range and configures the full version with the full application sequence number. It subscribes to the binary transaction log with the global transaction identifier, parses the add, update, delete, and commit events, and generates a deterministic version according to the field priority of decreasing order of source topology generation, GTID transaction sequence number, and intra-transaction event. The transaction time is used for transaction retrieval and anomaly verification. The source topology generation is incremented after a valid write node switch is detected and persisted together with the application checkpoint, so that the same transaction has the same version when obtained from the real-time transaction log, archived transaction log, or retry queue.
[0007] Preferably, the mapping relationship includes at least the business table identifier, partition identifier, write batch identifier, target data version, minimum deterministic version, maximum deterministic version, and maximum deletion deterministic version. The deletion constraint fidelity frontier management module determines the corresponding write batch based on the target data version range to be processed by the data warehouse maintenance task. When the deterministic version range corresponding to the write batch forms a continuous deterministic version interval after the existing effective deletion constraint fidelity frontier, and the deletion row-level changes within the continuous deterministic version interval can be identified, the maximum deletion deterministic version within this interval forms the pending deletion constraint fidelity frontier. When fine-grained retention information of the deletion transaction cannot be obtained, a conservative pending deletion constraint fidelity frontier is formed by the upper bound of the version of the continuous deterministic version interval.
[0008] Preferably, when a history replay task includes both a front-end row-level change with a version no higher than the valid deletion constraint fidelity frontier and a front-end row-level change with a version higher than that frontier, the history replay admission determination module extracts the initially affected primary key from the front-end row-level change, includes the row-level changes involving the initially affected primary key in the front-end row-level changes, includes the remaining front-end row-level changes as directly replaying row-level changes, and sets a processing path lock flag for the primary key entering the final state reconstruction task.
[0009] Preferably, the verifiable data baseline is a consistent full snapshot, business table snapshot, partition snapshot, or intermediate checkpoint that saves the complete row state, no later than the earliest transaction to be replayed in the final state reconstruction task; when archiving a transaction, persistence includes the business table identifier, primary key value or primary key summary and original primary key verification information, global transaction identifier, deterministic version, operation type, archive file location, commit location, and primary key transaction index of the table structure version; the transaction is only included in the scope of queryable transactions after the complete transaction and the corresponding primary key transaction index have been successfully persisted.
[0010] Preferably, a complete transaction chain is formed when the affected primary key and transaction chain construction module has continuous availability of the source transaction log range from the verifiable data baseline to the reconstruction termination checkpoint, the primary key transaction index can locate all committed transactions involving the affected primary key within this range, each transaction has complete transaction start events, row-level events and commit events, cross-file transactions are completed and spliced, row-level events can match the corresponding table structure version and some column updates can complete the complete row state; if any condition is not met, the missing logs are obtained from other archived copies, an earlier data baseline is selected, or the corresponding primary key, partition or business table is converted to a full reconstruction, and no final state reconstruction record for the corresponding primary key is generated.
[0011] Preferably, the primary key final state reconstruction module loads the state of the affected primary key in the verifiable data baseline, processes the addition, update, and deletion operations sequentially according to the deterministic version, and continues to process the re-insertion after deletion and its subsequent updates or deletions until the reconstruction termination checkpoint; when the final state is valid existence, a primary key final state reconstruction record is generated with the final state type of valid existence and containing complete final state row data, final state version, and final state global transaction identifier; when the final state is deletion, a primary key final state reconstruction record is generated with the final state type of deletion and containing the final state deletion version and final state global transaction identifier; the primary key final state reconstruction record also includes a transaction chain integrity summary and a reconstruction termination checkpoint.
[0012] Preferably, the data warehouse write and final state repair module writes a final state row when the final state type is valid and the target business table does not have a corresponding primary key or the current primary key version is lower than the final state version. If the current primary key version is equal to the final state version and the row content is consistent, it does not write again. When the final state type is deletion and the target business table has a corresponding primary key with a version lower than the final state version, it performs final state deletion. If the target business table no longer has a corresponding primary key, it is determined that no repair is needed and the deletion record is not retained again. When the current primary key version is higher than the final state version, or the versions are the same but the status or content is inconsistent, it does not perform automatic overwrite and generate a verification record.
[0013] Preferably, before the data warehouse maintenance task is executed, the task status management module sets the pending deletion constraint fidelity frontier to an admission freeze state, stops creating direct replay tasks containing versions no higher than that frontier, and allows the data warehouse maintenance task to execute after the relevant running direct replay tasks are completed or converted into final state reconstruction tasks. After receiving maintenance completion information and maintenance version and completing mapping verification, the pending deletion constraint fidelity frontier is converted into a valid deletion constraint fidelity frontier. For maintenance tasks that have not been notified in advance, a conservative pending deletion constraint fidelity frontier is formed after receiving maintenance completion information, and incomplete direct replay tasks that overlap with it are suspended. The affected primary keys are extracted from the incomplete direct replay tasks and the relevant row-level changes written after maintenance completion and before admission freeze completion, and the affected primary keys are included in the final state reconstruction verification.
[0014] Preferably, the task status management module records the processing path and completion status of each row-level change for each global transaction identifier; row-level changes that are directly replayed are marked as completed after successful writing, and row-level changes that enter the final state reconstruction task are marked as completed after the corresponding final state repair is completed or it is determined that no repair is needed; for sequential recovery tasks starting from unapplied transactions after the applied scope represented by the current effective application checkpoint, the global transaction identifier is merged into the set of applied global transaction identifiers and the current effective application checkpoint is advanced only when all row-level changes corresponding to the same global transaction identifier are completed and there are no incomplete preceding transactions; for historical replay tasks whose corresponding transactions are already included in the applied scope represented by the current effective application checkpoint, only the task completion status is updated and the current effective application checkpoint is not advanced, and the corresponding global transaction identifier and application checkpoint remain unchanged when any necessary processing fails.
[0015] The technical effects and advantages of this invention are as follows: By establishing a mapping relationship between the target data version and the deterministic version of the source transaction, this invention transforms the range of the target columnar data warehouse that loses its deletion comparison capability after performing merge compression, table reconstruction, or partition replacement into a deletion constraint fidelity frontier. This frontier is used as the replay admission boundary for historical transactions, allowing transactions with versions higher than the frontier to continue to be replayed directly according to the deterministic version, while transactions with versions lower than the frontier no longer directly enter the target business table. This avoids the situation where, after the deletion status of the target end fails, the low-version updates before the deletion transaction are rewritten and the deleted data reappears.
[0016] This invention extracts affected primary keys from historical transactions that cannot be directly replayed. It solidifies the later checkpoint in the replay range termination checkpoint of the historical transaction to be replayed, based on the valid application checkpoint at task creation, into a reconstruction termination checkpoint. The complete transaction chain from the verifiable data baseline to the reconstruction termination checkpoint is obtained through the primary key transaction index. Within an isolated space, additions, updates, deletions, re-insertions after deletion, and subsequent changes are processed sequentially. Only the final state reconstruction record of the formed primary key is used to perform final state row writing or final state deletion on the target business table. This allows for both the security of historical transaction replay and the normal synchronization of legitimate re-insertion after deletion without permanently retaining all deleted records. Furthermore, by freezing tasks before the front-end takes effect and confirming completion at the transaction level, it reduces state confusion caused by concurrent data warehouse maintenance and historical replay, improving the certainty of archive synchronization and fault recovery results. Attached Figure Description
[0017] The disclosure of this invention is illustrated with reference to the accompanying drawings. It should be understood that the drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. In the drawings, the same reference numerals are used to refer to the same parts: Figure 1 This is a schematic diagram of the overall architecture of the present invention; Figure 2 This is a timing diagram of the present invention. Detailed Implementation
[0018] It is readily understood that, based on the technical solution of this invention, those skilled in the art can propose various interchangeable structural methods and implementations without altering the essential spirit of the invention. Therefore, the following detailed embodiments and accompanying drawings are merely illustrative examples of the technical solution of this invention and should not be considered as the entirety of the invention or as limitations or restrictions on the technical solution of this invention.
[0019] Example 1: As Figures 1-2 As shown, this embodiment provides a deterministic transactional data warehouse archiving and synchronization system for Internet database services. This system is used to synchronize all business data and continuously generated incremental transactions in a relational source database to a target columnar data warehouse. When the online transaction log of the source database is cleaned up, the synchronization task is restored according to the old checkpoint, the data warehouse write fails and is retried, or the historical data is manually repaired, the system performs an admission judgment on the historical transactions to be replayed, so as to prevent the historical updates before the deletion transactions from being rewritten to the target business table after the target columnar data warehouse has lost the deletion version constraint.
[0020] In this embodiment, the relational source database is a database that supports global transaction identifiers and binary transaction logs, the target columnar data warehouse is an analytical database that can perform write-on-demand merging according to primary key and version information, and the archived transaction logs are stored in object storage; the synchronization system can be deployed on a server node, or the log collection, full read, final state reconstruction and data warehouse write tasks can be deployed on different working nodes, and the coordination node can uniformly maintain the task status and application checkpoints.
[0021] This system includes a synchronous data acquisition and version labeling module, a deletion constraint fidelity frontier management module, a historical replay admission judgment module, an affected primary key and transaction chain construction module, a primary key final state reconstruction module, a data warehouse writing and final state repair module, and a task status management module. Each module can be implemented by different program units in the same service process, or by independent services that communicate with each other. The modules pass processing results to each other through persistent task tables, message queues, or remote calls.
[0022] I. Synchronous Data Acquisition and Version Labeling Module: The synchronous data acquisition and version labeling module is used to acquire the full data, real-time transaction logs and historical transactions to be replayed from the relational source database, and to configure the corresponding versions for the full data and row-level incremental transactions respectively.
[0023] When synchronizing a business table for the first time, the synchronization data acquisition and version identification module reads the current global transaction identifier execution set of the source database before starting the consistent snapshot transaction, and saves the global transaction identifier execution set as the full snapshot boundary of the corresponding business table; then, under the repeatable read isolation level, the consistent snapshot transaction is started, and multiple full shards are divided according to the primary key of the business table or other integer cursors that can be stably incremented, and multiple full worker nodes read the full shards respectively.
[0024] After each full-processing node reads a batch of full data, it converts the batch of full data into the field format corresponding to the target business table and configures a full application sequence number for the batch of full data. The full application sequence number is generated by an incrementing counter maintained by the synchronization system. Its version range is lower than that of the incremental transaction, so that when the full data is written later than the incremental data, it will not overwrite the higher version incremental data that has already been written.
[0025] When writing all data to the target columnar data warehouse, the synchronous data acquisition and version labeling module generates a unique write batch identifier for each write batch and records the business table identifier, target partition identifier, full data shard range, write batch identifier, full data version range, and write time. After receiving the write batch, the target columnar data warehouse returns the corresponding target data version, transaction identifier, data fragment version, or an equivalent identifier that can identify the target data range formed by the batch. The returned result serves as a component of the subsequent version mapping.
[0026] During incremental synchronization, the synchronization data acquisition and version labeling module subscribes to the real-time transaction log of the source database with a global transaction identifier, and parses the transaction start event, table mapping event, row-level add event, row-level update event, row-level delete event and transaction commit event according to the transaction boundary; for each row-level change, it records the global transaction identifier, business table, primary key, operation type, transaction time, GTID transaction sequence number, intra-transaction row event sequence and table structure version.
[0027] For row-level update events that modify business primary keys, they are converted into deletion changes for the original primary key and addition changes for the new primary key, so that the original primary key and the new primary key can participate in subsequent direct replay or final state reconstruction processes respectively. For composite primary keys, each primary key field is serialized into a standardized primary key value according to a preset field order, and a primary key summary can be generated at the same time. The primary key summary is only used to improve index query efficiency, and the corresponding business primary key is still confirmed by the original primary key value or the original primary key verification information.
[0028] The synchronous data acquisition and version labeling module generates a deterministic version of the row-level incremental transaction based on the source topology generation, GTID transaction sequence number, and intra-transaction row event order, with the field priorities decreasing sequentially according to the source topology generation, GTID transaction sequence number, and intra-transaction row event order. Among them, the source topology generation is used to distinguish the tenure of different valid write nodes in the source database, the GTID transaction sequence number is used to determine the order of transactions within the same source topology generation, the intra-transaction row event order is used to distinguish multiple consecutive changes to the same primary key within the same transaction, and the transaction time is used for transaction retrieval and anomaly verification.
[0029] The source topology generation is initially set to a preset initial value and persisted together with the application checkpoint of the synchronization task. When the synchronization system confirms that the valid write node of the source database has been switched, it allocates an increasing source topology generation to the new valid write node term. Even if the original write node becomes a valid write node again later, it is reassigned a new source topology generation. The synchronization system also records the correspondence between the source topology generation, the source node identifier, the start global transaction identifier, and the end global transaction identifier.
[0030] When a real-time transaction is archived, the transaction metadata required for the source topology generation and deterministic version is persisted together with the archive file index. For historical archived transactions that do not directly carry the source topology generation, the source topology generation is restored based on the source node identifier, GTID transaction sequence number and the source topology generation correspondence, so that when the same transaction is repeatedly retrieved from the real-time transaction log, archived transaction log or failure retry queue, the same deterministic version can be generated.
[0031] If the original transaction commit time can be obtained from the source database, the original transaction commit time is recorded as transaction retrieval and exception verification information; if the corresponding commit time cannot be obtained or the obtained value is empty, the transaction log event header time is recorded as an auxiliary transaction time; if the transaction time is missing, has insufficient precision, or a rollback occurs, the transaction version order determined by the source topology generation and GTID transaction sequence number is not changed.
[0032] The target business table adopts a primary key write-on-merge model and sets a sequence field for storing deterministic versions and a deletion field for indicating deletion status. Add and update transactions write normal business rows, and delete transactions write deletion records with deterministic versions. When multiple versions exist for the same primary key, the state of the higher version is retained. Duplicate writes of the same version do not cause the target business state to roll back.
[0033] The synchronous data acquisition and version labeling module writes the minimum deterministic version, maximum deterministic version, and maximum deletion deterministic version corresponding to each incremental write batch into the version mapping table. If there is no deletion transaction in a write batch, the maximum deletion deterministic version is marked as empty or a no-deletion-transaction flag is set, and the deletion constraint fidelity frontier is not advanced separately for that write batch. The maximum deletion deterministic version is the maximum value of the deterministic versions corresponding to each deletion row-level change in the same write batch.
[0034] The version mapping table must include at least the business table identifier, target partition identifier, write batch identifier, target data version, minimum deterministic version, maximum deterministic version, maximum delete deterministic version, start and end global transaction identifiers, write result, and write completion time. Only after the data warehouse write is successful and the target data version is obtained will the corresponding mapping record be set to a valid state.
[0035] Historical transactions to be replayed can originate from archived transaction logs in object storage, retry queues formed by data warehouse write failures, locally persisted but not yet applied transactions, transactions re-acquired according to old checkpoints, or manually specified historical recovery intervals. The synchronous data acquisition and version labeling module generates a task identifier for each historical replay task and records its source type, business table, target partition, start and end global transaction identifiers, deterministic version range, archive file range, and creation reason.
[0036] II. Deletion Constraint Fidelity Front Management Module: The Deletion Constraint Fidelity Front Management module is used to convert the target data version in the target columnar data warehouse into a deletion state retention boundary that can be compared with the deterministic version of the source transaction.
[0037] In this embodiment, a deletion constraint fidelity front is maintained for each business table or each target partition. The deletion constraint fidelity front indicates that for deletion transactions with a deterministic version no higher than this front, the target columnar data warehouse no longer guarantees that the corresponding deletion status can continue to participate in subsequent version comparisons. Therefore, it is no longer possible to rely solely on the deletion records in the target business table to prevent earlier historical updates from being rewritten.
[0038] When the target columnar data warehouse is ready to perform merge compression, table reconstruction, or partition replacement, the data warehouse maintenance task first provides the deletion constraint fidelity frontier management module with the business table to be processed, the target partition, and the target data version range; the deletion constraint fidelity frontier management module queries the write batch and deterministic version range corresponding to the target data version range according to the version mapping table.
[0039] The deletion constraint fidelity frontier management module starts from the existing valid deletion constraint fidelity frontier and checks whether the relevant write batches constitute a continuous deterministic version interval according to the write completion order and the coverage of the global transaction identifier. The continuous deterministic version interval referred to in this embodiment does not require the values of adjacent deterministic versions to be continuous, but requires that there is no source transaction interval that has not been covered by the corresponding write batch and has not been processed between the existing valid deletion constraint fidelity frontier and the upper limit of the version of the intended processing range.
[0040] When the write batches covered by the data warehouse maintenance task constitute a continuous deterministic version interval and the deletion transactions within the interval can be identified, the maximum deletion deterministic version within the continuous deterministic version interval is used to form the fidelity front of the deletion constraint to be effective. By using the maximum deletion deterministic version, the front is not unnecessarily expanded by ordinary data write batches without deletion transactions.
[0041] When the target columnar data warehouse can only provide the target data version range and cannot indicate which deleted records will lose their comparability after maintenance, the deletion constraint fidelity front management module forms a conservative pending deletion constraint fidelity front based on the upper bound of the continuous deterministic version range. Adopting a conservative front may allow more historical transactions to enter the final state reconstruction path, but will not allow historical transactions with the risk of deletion status failure to be directly written into the target business table.
[0042] When the target data version to be processed by the data warehouse maintenance task corresponds to multiple discontinuous deterministic version ranges, instead of forming a single frontier with the largest version of the multiple ranges, the version ranges to be processed are recorded separately, or only the part continuously covered from the existing effective deletion constraint fidelity frontier is formed into the deletion constraint fidelity frontier to be effective, so as to avoid crossing the intermediate version range not covered by the maintenance task.
[0043] Once the Fidelity Frontier for Deletion Constraints is formed, the Fidelity Frontier for Deletion Constraints Management Module sets its status to "Pending Progress" and sends the business table, target partition, original effective frontier, frontier for Deletion Constraints, data warehouse maintenance task identifier, target data version range to be processed, and mapping record summary to the task status management module.
[0044] After the task status management module completes the historical replay task freeze, it sets the pending deletion constraint fidelity frontier to the access freeze state and allows the data warehouse maintenance task to be executed. After the data warehouse maintenance task is completed, it returns the maintenance completion information and the actual maintenance version. The deletion constraint fidelity frontier management module re-verifies whether the actual maintenance version is consistent with the version range to be processed. After the verification is passed, the pending deletion constraint fidelity frontier is converted into an effective deletion constraint fidelity frontier.
[0045] The effective deletion constraint fidelity frontier can only advance monotonically; when creating subsequent historical replay tasks, the effective deletion constraint fidelity frontier that has already taken effect at the time of task creation is used for admission determination, and the effective deletion constraint fidelity frontier cannot be rolled back because the scope requested by the historical task was earlier.
[0046] For automatic merging and compression tasks that cannot be notified to the synchronization system in advance, the target columnar data warehouse returns the processed target data version after maintenance is completed; the deletion constraint fidelity frontier management module forms a conservative deletion constraint fidelity frontier to be effective based on the target data version and version mapping table, and immediately notifies the task status management module to suspend the incomplete direct replay tasks that overlap with this frontier; after the suspension is completed, the relevant primary keys written during the period from the completion of automatic maintenance to the completion of admission freeze are reconstructed and verified in the final state, and the frontier is converted to the effective state after the verification is completed.
[0047] III. Historical Replay Admission Determination Module: The historical replay admission determination module is used to select the direct replay path or the final state reconstruction path based on the relationship between the deterministic version of the historical transaction to be replayed and the fidelity frontier of the effective deletion constraint.
[0048] The historical replay admission judgment module splits historical replay tasks according to business tables and target partitions, and reads the current valid deletion constraint fidelity frontier of the corresponding business table or target partition. For row-level changes with deterministic versions higher than the valid deletion constraint fidelity frontier, the target columnar data warehouse is still within the scope of being able to handle the corresponding changes according to normal version relationships, and it is determined to directly replay the row-level changes.
[0049] For row-level changes whose deterministic version is no higher than the fidelity frontier of the effective deletion constraint, the historical replay access judgment module sets a direct prohibition flag, disallowing them from entering the target business table row by row, and generating final state reconstruction tasks based on these row-level changes.
[0050] When generating a final state reconstruction task, the historical replay admission judgment module reads the current effective application checkpoint and the replay range termination checkpoint of the historical transaction to be replayed when the task was created, and fixes the later checkpoint in the source transaction order as the reconstruction termination checkpoint of this final state reconstruction task; after the final state reconstruction task is created, even if the current effective application checkpoint continues to advance in real time synchronization, the reconstruction termination checkpoint of this final state reconstruction task will not change accordingly.
[0051] The historical transaction to be replayed has a fixed replay range termination checkpoint. When the historical transaction to be replayed is already included in the applied range represented by the current valid application checkpoint, the current valid application checkpoint is used as the reconstruction termination checkpoint. When the historical transaction to be replayed belongs to a sequential recovery task starting after the current valid application checkpoint, the checkpoint that is later in the order of the source transaction between the current valid application checkpoint and the replay range termination checkpoint is used as the reconstruction termination checkpoint, thereby ensuring that the historical transaction to be replayed that triggers the final state reconstruction is included in the current complete transaction chain.
[0052] The refactoring termination checkpoint should include at least the source database identifier, a global transaction identifier set, or a log position that can represent the continuous application scope, the corresponding deterministic version upper bound, and the fixation time. By fixing the refactoring termination checkpoint, the final state refactoring task has a definite processing endpoint, and by comparing the current primary key version of the target business table during the final state repair, it is avoided that new transactions generated after the task is created will be overwritten by old final state refactoring records.
[0053] When all historical replay tasks are located after the effective deletion constraint fidelity frontier, the historical replay admission decision module determines them all as direct replay of row-level changes; when all historical replay tasks are located before or equal to the effective deletion constraint fidelity frontier, they are all converted into final state reconstruction tasks.
[0054] When a history replay task includes both front-end row-level changes and front-end row-level changes, the history replay admission determination module first extracts the initially affected primary key from the front-end row-level changes, and then checks the business primary key involved in the front-end row-level changes. All front-end row-level changes involving the initially affected primary key are included in the final state reconstruction task, and the remaining front-end row-level changes that are unrelated to the initially affected primary key are determined to be directly replay row-level changes.
[0055] Through the above processing, the same business primary key will not enter two processing paths at the same time because some historical changes are located before the frontier and some subsequent changes are located after the frontier. The historical replay admission judgment module sets a processing path locking flag for the primary key entering the final state reconstruction task. Before the completion of this historical replay task, all row-level changes involving the primary key are processed by the final state reconstruction path.
[0056] For transactions involving multiple business primary keys under the same global transaction identifier, row-level changes corresponding to different primary keys are allowed to enter the direct replay path and the final state reconstruction path respectively. However, the task status management module records the processing path and completion status of each row-level change according to the global transaction identifier. It cannot confirm the completion of the entire global transaction identifier in advance because one path is completed.
[0057] The final state refactoring task should at least record the task identifier, business table, target partition, triggering transaction scope, effective deletion constraint fidelity frontier, initial affected primary key set, processing path locking information, verifiable data baseline selection status, refactoring termination checkpoint, and task creation reason.
[0058] IV. Affected Primary Key and Transaction Chain Construction Module: The Affected Primary Key and Transaction Chain Construction Module is used to extract the affected primary keys from the final state reconstruction task and obtain all committed transactions for each affected primary key from the verifiable data baseline to the fixed reconstruction termination checkpoint.
[0059] The affected primary key and transaction chain construction module reads the business table identifier, target partition, primary key field, and primary key value from the new, update, and delete row-level changes corresponding to the final state reconstruction task. For index records that only save the primary key summary, the true primary key corresponding to the summary is verified through the original primary key verification information. The complete primary key transaction chain cannot be generated solely based on the unverified primary key summary.
[0060] For each affected primary key, the affected primary key and transaction chain building module selects a verifiable data baseline no later than the earliest transaction to be replayed for that primary key; the verifiable data baseline can be a consistent full snapshot formed during the first synchronization, a business table snapshot formed subsequently, a partition snapshot, or an intermediate checkpoint that saves the complete row status.
[0061] Verifiable data baselines must at least record the business table and target partition, baseline global transaction identifier boundary, baseline version, baseline table structure version, data integrity summary, and primary key row status; if a baseline only saves data for a certain partition, it is only used for the final state reconstruction of the primary key within that partition.
[0062] When archiving real-time transaction logs, the archiving service generates a primary key transaction index while saving the complete transaction. The primary key transaction index includes at least the business table identifier, target partition, primary key value or primary key summary and original primary key verification information, global transaction identifier, deterministic version, operation type, archive file identifier, file offset position, transaction commit position, table structure version and complete row mirroring flag.
[0063] Primary key transaction indexes can be partitioned and stored according to business tables and primary keys, and can be configured with Bloom filters or other fast exclusion structures to reduce the amount of archive file scanning. Fast exclusion structures are only used to exclude archive files that explicitly do not contain the corresponding primary key, and cannot replace precise primary key indexes and transaction integrity verification.
[0064] The archiving service sets the archiving completion status of a transaction to queryable only after the transaction start event, all row-level events, and transaction commit event have been fully written to the archive storage, and the corresponding primary key transaction index has been successfully persisted. If the write of a complete transaction or any item of the primary key transaction index fails, the transaction will not be included in the scope of queryable transactions.
[0065] The affected primary key and transaction chain construction module determines the range of global source transaction logs to be queried based on the verifiable data baseline and the reconstruction termination checkpoint, and checks whether the online transaction logs, archived transaction logs and other archived copies corresponding to this range are continuously available. The continuous log range here means that there is no unobtainable source transaction log interval between the baseline and the reconstruction termination checkpoint, and does not require that the GTID transaction sequence numbers involved in a certain business primary key are continuous.
[0066] After confirming that the global source transaction log range is continuous, the affected primary key and transaction chain construction module locates all committed transactions involving the affected primary key within the range based on the primary key transaction index, and reads the row-level events of the corresponding transactions; for transactions that span two or more archive files, the transaction fragments in each file are concatenated according to the transaction identifier and log order until a complete commit event is obtained before being included in the transaction chain.
[0067] Each row-level event is parsed according to the table structure version at the time of its occurrence; when the archiving service detects changes in data definition statements or table structure, it saves the new table structure version and the correspondence between the old and new fields; when the final state reconstruction requires outputting the current target business table format, it converts historical fields into current fields according to preset field mapping rules.
[0068] When a row-level update event in the source database only records the changed fields, the affected primary key and transaction chain building module uses the complete row state in the verifiable data baseline as the initial state and applies the transactions preceding the update event in sequence to fill in the fields not carried by the update event; if a data baseline or preceding transaction that can fill in the complete row state cannot be obtained, the transaction chain is not considered complete.
[0069] A complete transaction chain for a primary key is formed only when the source transaction log range is continuously available, the primary key transaction index can locate all committed transactions involving the corresponding primary key within the range, each transaction has a complete transaction start event, row-level event, and commit event, cross-file transactions are completed, the table structure version can be matched, and partial column updates can complete the full row status.
[0070] If local archived logs are missing, the affected primary key and transaction chain building module first obtains the missing logs from other archived copies or backup storage. If the missing logs cannot be filled in, an earlier data baseline that can provide complete row status can be selected to rebuild. If a complete transaction chain still cannot be formed, the corresponding primary key, target partition, or business table is marked as needing full reconstruction, and no primary key final state reconstruction record is generated.
[0071] The complete transaction chain is arranged in deterministic version order; when two row-level changes belong to the same transaction, they are arranged in the order of row events within the transaction; when the same deterministic version of a transaction is obtained repeatedly, it is identified as the same row-level change based on the global transaction identifier, business table, primary key, and the order of row events within the transaction, and the transaction chain is not extended repeatedly.
[0072] V. Primary Key Final State Reconstruction Module: The primary key final state reconstruction module is used to load the baseline state of the affected primary key in the reconstruction space isolated from the target business table, and process the corresponding complete transaction chain to form the final state of the primary key under the reconstruction termination checkpoint.
[0073] The isolated refactoring space can be a temporary data warehouse table, a local embedded database, a memory key-value state area, or an independent temporary partition. Each final refactoring task is assigned an independent task identifier. The primary key state in the isolated refactoring space is stored separately from the online target business table. The intermediate state during the refactoring process does not directly affect the target business query.
[0074] The primary key final state reconstruction module first loads the state of the affected primary key in the verifiable data baseline; if the primary key exists in the baseline, it loads the complete row data, the baseline version, and the existence status; if the primary key does not exist in the baseline, it sets its initial state to non-existent and starts processing from the first relevant transaction after the baseline.
[0075] The primary key final state reconstruction module processes the complete transaction chain sequentially according to the deterministic version. New transactions are used to establish the primary key row state, update transactions are used to modify the primary key row state, and delete transactions are used to set the primary key state to delete. When a higher deterministic version re-insertion transaction exists after a delete transaction, the primary key row state is re-established, and the update or delete transaction after the re-insertion is processed again.
[0076] When multiple updates, deletions, or re-insertions are performed on the same primary key within the same transaction, they are processed according to the order of row events within the transaction. Late events of a version lower than the current refactoring state do not change the already formed higher version state, and the refactoring state is not changed repeatedly when the same event occurs repeatedly.
[0077] The refactoring process only handles committed transactions whose source transaction position is no later than the transaction boundary represented by the refactoring termination checkpoint; transactions whose source transaction position is later than the transaction boundary represented by the refactoring termination checkpoint are not included in this refactoring task and are continued to be processed by the normal real-time synchronization path.
[0078] After the complete transaction chain is processed, if the affected primary key should exist under the reconstruction termination checkpoint, a primary key final state reconstruction record with a final state type of valid existence is generated. The record includes complete final state row data, final state version, final state global transaction identifier, reconstruction termination checkpoint, verifiable data baseline, transaction chain integrity summary, and table structure version.
[0079] If the affected primary key should be deleted at the reconstruction termination checkpoint, a primary key final state reconstruction record with the final state type of deletion is generated. The record includes the final state deletion version, the final state global transaction identifier, the reconstruction termination checkpoint, the verifiable data baseline, and the transaction chain integrity summary. The final state row data fields can be empty or only store non-business information required for verification.
[0080] The transaction chain integrity summary is generated based on the verifiable data baseline, query log range, archive file set, primary key transaction index set, and refactoring termination checkpoint. It is used to verify whether the final state record corresponds to the same refactoring input during subsequent repair and fault recovery.
[0081] After the primary key final state reconstruction record is generated, the original historical row-level changes that constitute the complete transaction chain are not sent to the target business table one by one; the data warehouse write and final state repair module only receives direct replay of row-level changes or primary key final state reconstruction records.
[0082] VI. Data Warehouse Write and Final State Repair Module: The data warehouse write and final state repair module is used to write directly replay row-level changes to the target columnar data warehouse according to their original deterministic versions, and to perform condition repair on the target business table based on the primary key final state reconstruction record.
[0083] For direct replay of row-level changes, the data warehouse write and final state repair module generates write batches according to the normal incremental transaction write method; new and updated rows are written with normal business data, and deleted rows are written with deleted records. The target columnar data warehouse performs write-time merging based on the primary key and deterministic version.
[0084] For primary key final state reconstruction records, the data warehouse write and final state repair module first queries the current existence status, current primary key version, and current row content of the corresponding primary key in the target business table. If the target business table cannot directly return the current primary key version, the current primary key version can be obtained based on the target write batch mapping, external version index, or version field stored in the target table.
[0085] When the final state type of the primary key final state reconstruction record is valid and the target business table does not have a corresponding primary key, the data warehouse writing and final state repair module writes the complete final state row according to the final state version; when the target business table has a corresponding primary key but the current primary key version is lower than the final state version, the final state row is used to overwrite it.
[0086] When the current primary key version of the target business table is equal to the final version and the current row content is consistent with the final row content, it is determined that the primary key does not need to be repaired repeatedly; when the current primary key version is equal to the final version but the status or row content is inconsistent, automatic repair is stopped and a verification record is generated to prevent direct overwriting when different content of the same version cannot be explained.
[0087] When the final state type of the primary key final state reconstruction record is deletion, and the target business table still has a corresponding primary key with a version lower than the final state deletion version, the final state deletion is performed according to the final state deletion version; when the target business table no longer has the corresponding primary key, it is determined that the primary key does not need to be repaired, and the deletion record for long-term retention is not rewritten.
[0088] When the current primary key version of the target business table is higher than the final version of the primary key final state reconstruction record, the final state record is not used to overwrite the target business table, and it is verified whether the higher version of the target business table corresponds to the normal real-time transaction generated after the reconstruction termination checkpoint; if so, the current state of the target is maintained; if not, an exception verification task is generated.
[0089] Final state repair uses the source final state version obtained from the reconstruction, and does not generate an artificial overwrite version that is higher than the normal source transaction version range, so that legitimate re-insertion, update or deletion that occurs after the reconstruction termination checkpoint can still continue to take effect according to the normal deterministic version.
[0090] The data warehouse write and final state repair module generates an idempotent batch identifier for each direct replay write batch and final state repair batch. After a network timeout or process failure occurs, the write results of the target columnar data warehouse can be queried based on the batch identifier to avoid duplicate confirmations or incorrect progress of task status due to lost responses.
[0091] VII. Task Status Management Module: The task status management module is used to record the current valid application checkpoints, the frontier of the deletion constraint fidelity, historical replay tasks, final state reconstruction tasks, row-level change processing paths, primary key final state repair results, and the completion status of global transaction identifiers.
[0092] The task status management module can use a local embedded database, a relational status database, or a highly available key-value database for persistence; any status change is written to the task identifier, status version, and update time, preventing multiple worker nodes from modifying the same task status at the same time.
[0093] After the pending deletion constraint fidelity front is formed, the task status management module sets the front to the admission freeze state, stops the creation of direct replay tasks containing versions no higher than that front, and queries the currently running direct replay tasks that overlap with the front.
[0094] For direct replay tasks that have completed the target write, wait for confirmation of their completion status; for tasks that have not yet been written or have only partially written, convert the parts involving front-end forward-level changes into final-state reconstruction tasks, and retain the processing path locking information of the corresponding business primary keys; only after all overlapping tasks are completed or converted can data warehouse maintenance tasks be executed.
[0095] After the data warehouse maintenance is completed, the task status management module receives the maintenance completion information, works with the deletion constraint fidelity frontier management module to complete the target data version mapping verification, and converts the pending deletion constraint fidelity frontier into an effective deletion constraint fidelity frontier.
[0096] For automatic maintenance tasks that are not notified in advance, the task status management module will immediately pause the incomplete direct replay tasks that overlap with the conservative frontier that is yet to take effect after receiving the maintenance completion information, and record the risk window between the automatic maintenance completion time and the access freeze completion time. The relevant primary keys that have been written or are being written within the risk window will be included in the final state reconstruction verification. After the verification is completed, the frontier will be confirmed to take effect.
[0097] The task status management module establishes a transaction processing list for each global transaction identifier, recording the business table, primary key, intra-transaction row event sequence, processing path, and completion status of the transaction. Row-level changes in the direct replay path are marked as completed after successful data warehouse write, while row-level changes in the final state reconstruction path are marked as completed after the corresponding primary key final state repair is completed or it is determined that no repair is needed.
[0098] When a global transaction identifier contains both direct replay row-level changes and final state reconstruction row-level changes, the global transaction identifier is marked as complete only after all necessary processing in both paths is completed; if any row-level change fails, the transaction chain is incomplete, or the final state repair requires manual verification, the completion of the entire global transaction identifier is not confirmed in advance.
[0099] For sequential recovery tasks starting from the unapplied transactions following the applied scope represented by the current effective application checkpoint, the global transaction identifier is merged into the set of applied global transaction identifiers only when all row-level changes corresponding to the same global transaction identifier have been completed and there are no incomplete preceding transactions, and the current effective application checkpoint is advanced to a new continuous completion boundary.
[0100] For historical replay or verification tasks that are already included in the scope of application represented by the current effective application checkpoint, after completing direct replay, final state repair, or no repair confirmation, only update the completion status of the corresponding historical task and row-level change, without changing the current effective application checkpoint again.
[0101] If any necessary processing fails, the task state management module keeps the corresponding global transaction identifier and the current valid application checkpoint unchanged; after the system recovers, it continues to execute from the last persisted task state, and the primary key that has entered the final state reconstruction path cannot return to the direct replay path.
[0102] The overall system operation process is as follows: When the system is running normally, it first establishes a full baseline of the business tables through a consistent full snapshot, configures full versions for all data and writes them to the target columnar data warehouse; then it subscribes to the real-time transaction logs of the source database, generates deterministic versions for row-level changes such as addition, update and deletion, and writes them to the target business tables in a write-on-demand merge manner.
[0103] For each successfully written data warehouse batch, a mapping relationship is established between the write batch, the target data version, and the deterministic version range. When the target columnar data warehouse is ready to perform merge compression, table reconstruction, or partition replacement, the mapping relationship is queried according to the target data version range to be processed, forming the fidelity frontier of the deletion constraints to be effective.
[0104] After the task status management module freezes direct replay tasks that overlap with the pending frontier, data warehouse maintenance tasks are allowed to execute; after maintenance is completed and verified by version mapping, the pending deletion constraint fidelity frontier is converted into an effective deletion constraint fidelity frontier.
[0105] When the system retrieves historical transactions to be replayed from archived transaction logs, failed retry queues, or old checkpoints, it compares the deterministic version of each row-level change with the fidelity frontier of the valid deletion constraint. Row-level changes with versions higher than the fidelity frontier enter the direct replay path, while row-level changes with versions lower than the fidelity frontier are not allowed to directly enter the target business table, but instead generate a final state reconstruction task.
[0106] When the final state reconstruction task is created, the later checkpoint in the replay range termination checkpoint of the currently valid application checkpoint and the replay range of the historical transactions to be replayed is fixed as the reconstruction termination checkpoint; the affected primary key and transaction chain construction module selects a verifiable data baseline and obtains all committed transactions involving the corresponding primary key from the baseline to the reconstruction termination checkpoint; after the transaction chain integrity verification is passed, the primary key final state reconstruction module generates the primary key final state reconstruction record in the isolation space.
[0107] The data warehouse write and final state repair module compares the primary key final state reconstruction record with the current primary key state of the target business table. It only writes the final state row or performs the final state deletion when the target business table does not have the corresponding primary key or the current primary key version is too low. When the final state is deletion and the target business table no longer has the corresponding primary key, the deletion record is not retained again.
[0108] The task status management module confirms the completion status according to the actual processing path of the row-level change, and decides whether to advance the current effective application checkpoint based on whether the corresponding transaction is within the applied scope represented by the current effective application checkpoint.
[0109] Example 2: This example illustrates the process when the historical updates prior to the deletion transaction are retrieved after the deletion status in the target business table has lost its version comparison capability.
[0110] The order table in the source database uses the order number as the primary key. A certain order undergoes a new transaction, an update transaction, and a delete transaction in sequence. The deterministic version of the new transaction is the first version, the deterministic version of the update transaction is the second version, which is higher than the first version, and the deterministic version of the delete transaction is the third version, which is higher than the second version.
[0111] The deletion transaction has been successfully written to the target columnar data warehouse, and the order has been deleted from the target business table. Subsequently, the target columnar data warehouse performs merge compression on the partition where the order table is located. The target data version covered by the maintenance task is mapped to form a frontier of deletion constraint fidelity to take effect. After the task is frozen and maintenance is completed, this frontier becomes a valid deletion constraint fidelity frontier. The second and third versions are not higher than the valid deletion constraint fidelity frontier.
[0112] The synchronization system subsequently reacquires the second version of the update transaction due to the restoration of the old checkpoint; the history replay admission judgment module determines that the version of the update transaction is not higher than the fidelity frontier of the valid deletion constraint, prohibits it from being directly written to the order table, and solidifies the current valid application checkpoint at the time of task creation as the refactoring termination checkpoint.
[0113] The affected primary key and transaction chain building module extracts the order number from the update transaction, obtains the baseline status of the order based on the consistent full snapshot of the order table, and obtains the new, update and delete transactions involving the order from the baseline to the refactoring termination checkpoint through the primary key transaction index.
[0114] The primary key final state reconstruction module processes transactions sequentially in the isolated space, obtains the final state of the order as deletion at the reconstruction termination checkpoint, and forms a deletion final state record containing the third version.
[0115] The data warehouse write and final state repair module queries the target order table and confirms that the order no longer exists. Therefore, the order is determined to be non-repairable and will not be rewritten as a deletion record. Historical updates in the second version have never been directly entered into the target order table, and deleted orders will not reappear due to the deletion status becoming invalid on the target side.
[0116] Example 3: This example illustrates the process of handling a valid re-insertion after deletion.
[0117] The product table in the source database uses the product number as the primary key. A product is first deleted in the first deterministic version, then re-inserted in the second deterministic version, which is higher than the first deterministic version, and then updated again in the third deterministic version, which is higher than the second deterministic version.
[0118] After the deletion transaction takes effect, the target columnar data warehouse performs table reconstruction, so that the deletion state corresponding to the first deterministic version is no longer guaranteed to participate in subsequent version comparisons; the synchronization system then obtains the old updates before the deletion transaction based on the historical recovery request and generates the final state reconstruction task.
[0119] The history replay admission determination module reads the currently valid application checkpoint and the replay range termination checkpoint of the history recovery task when the task is created, and solidifies the later checkpoint in the source transaction order as the reconstruction termination checkpoint; in this embodiment, the reconstruction termination checkpoint is located after the transaction corresponding to the third deterministic version; the affected primary key and transaction chain construction module obtains the complete transaction chain of the product from the verifiable data baseline to the reconstruction termination checkpoint, including the deletion of the first deterministic version, the re-insertion of the second deterministic version, and the update of the third deterministic version.
[0120] After processing the complete transaction chain, the primary key final state reconstruction module obtains that the final state of the product is valid, the final state version is the third deterministic version, and the final state row data is the complete product data corresponding to the third deterministic version.
[0121] If the product does not exist in the target product table, the data warehouse write and final state repair module writes the final state row according to the third deterministic version; if the current version in the target product table is lower than the third deterministic version, the final state row is overwritten; if the current version in the target product table is higher than the third deterministic version, the overwrite is not performed, and it is verified whether the higher version belongs to the normal real-time transaction after the refactoring termination checkpoint.
[0122] Therefore, this system will neither allow historical updates prior to the deletion transaction to directly restore the deleted product, nor will it prevent legitimate re-insertion and subsequent updates after deletion due to the retention of permanent deletion restrictions.
[0123] Example 4: This example illustrates the completion confirmation process when row-level changes in the same global transaction identifier enter the direct replay path and the final state reconstruction path respectively.
[0124] A source transaction simultaneously modifies the first order and the second order in the order table, wherein the row-level change version involving the first order is no higher than the frontier of the valid delete constraint fidelity, and the row-level change version involving the second order is higher than the frontier of the valid delete constraint fidelity.
[0125] The historical replay admission determination module includes the row-level changes of the first order in the final state reconstruction task and sets a processing path lock flag for the first order; the row-level changes of the second order are determined to be directly replay row-level changes.
[0126] The task status management module establishes a transaction processing list for this global transaction identifier, recording the final state reconstruction path of the first order row-level change and the direct replay path of the second order row-level change, respectively.
[0127] After the row-level change of the second order is successfully written to the target business table, only the corresponding row-level change is marked as complete, and the completion of the entire global transaction is not confirmed. After the first order forms a complete transaction chain and completes the final state repair or determines that no repair is needed, its corresponding row-level change is marked as complete.
[0128] The global transaction identifier is marked as complete only after all necessary processing for both orders has been completed; if the task is a sequential recovery task following the current effective application checkpoint and there are no incomplete preceding transactions, the global transaction identifier is merged into the set of applied global transaction identifiers and the current effective application checkpoint is advanced.
[0129] If the corresponding transaction in this task is already included in the scope of application represented by the current valid application checkpoint, then this task is a historical verification task, and only the task completion status is updated without changing the current valid application checkpoint.
[0130] The technical scope of this invention is not limited to the content described above. Those skilled in the art can make various modifications and variations to the above embodiments without departing from the technical concept of this invention, and all such modifications and variations should fall within the protection scope of this invention.
Claims
1. A deterministic transactional data warehouse archiving and synchronization system for Internet database services, characterized in that, include: The synchronous data acquisition and version labeling module is used to acquire the full data of the source database, real-time transaction logs, and historical transactions to be replayed. It configures a full version lower than the incremental transaction version range for the full data, generates deterministic versions for row-level incremental transactions, and records the mapping relationship between the write batch, target data version, and deterministic version range. The deletion constraint fidelity front management module is used to form a deletion constraint fidelity front to be effective based on the target data version range to be processed by the data warehouse maintenance task and the aforementioned mapping relationship. After maintenance, it is converted into a valid deletion constraint fidelity front. The historical replay admission judgment module is used to compare the row-level data to be replayed. The deterministic version of the change and the fidelity frontier of the effective deletion constraint are used to generate direct replay of row-level changes if the change is higher than the frontier, and to prohibit direct writing of the change to the target business table if the change is not higher than the frontier. The later checkpoint in the current effective application checkpoint and the replay range termination checkpoint of the historical transaction to be replayed is solidified as the reconstruction termination checkpoint, and a final state reconstruction task is generated. The affected primary key and transaction chain construction module is used to extract the affected primary keys from the final state reconstruction task, obtain the status of each affected primary key in the verifiable data baseline, and the complete transaction chain from the verifiable data baseline to the reconstruction termination checkpoint. The primary key final state reconstruction module is used to load the baseline state in the isolation space, process the complete transaction chain according to the deterministic version, and generate a primary key final state reconstruction record containing the final state type, final state version, and final state row data; the data warehouse writing and final state repair module is used to write the direct replay row-level changes according to the deterministic version, write the final state row when the final state type is valid and the target business table does not have a corresponding primary key or the current primary key version is lower than the final state version, and perform the final state deletion when the final state type is deletion and the target business table has a corresponding primary key with the current primary key version lower than the final state version; The task status management module is used to freeze direct replay tasks that overlap with the pending deletion constraint fidelity frontier before it takes effect, and to record the processing status of the direct replay tasks, final state reconstruction tasks, and final state repairs.
2. The deterministic transactional data warehouse archiving and synchronization system for Internet database services according to claim 1, characterized in that, Before initiating a consistent snapshot transaction, the synchronization data acquisition and version labeling module acquires the global transaction identifier execution set of the source database as the snapshot boundary, divides the full data into full shards according to the primary key range under repeatable read snapshots, and configures the full version with the full application sequence number. Subscribe to the binary transaction log with a global transaction identifier, parse the add, update, delete and commit events, generate a deterministic version according to the field priority of decreasing order of source topology generation, GTID transaction sequence number and intra-transaction event order, and use transaction time for transaction retrieval and anomaly verification. The source topology generation increments after a valid write node switch is detected and persisted together with the application checkpoint, ensuring that the same transaction has the same version when retrieved from the real-time transaction log, archived transaction log, or retry queue.
3. The deterministic transactional data warehouse archiving and synchronization system for Internet database services according to claim 1, characterized in that, The mapping relationship includes at least the business table identifier, partition identifier, write batch identifier, target data version, minimum deterministic version, maximum deterministic version, and maximum deletion deterministic version. The deletion constraint fidelity frontier management module determines the corresponding write batch based on the target data version range to be processed by the data warehouse maintenance task. When the deterministic version range corresponding to the write batch forms a continuous deterministic version interval after the existing effective deletion constraint fidelity frontier, and the deletion row-level changes within the continuous deterministic version interval can be identified, the maximum deletion deterministic version within the interval forms the pending deletion constraint fidelity frontier. When fine-grained retention information of the deletion transaction cannot be obtained, a conservative pending deletion constraint fidelity frontier is formed by the upper bound of the version of the continuous deterministic version interval.
4. The deterministic transactional data warehouse archiving and synchronization system for Internet database services according to claim 1, characterized in that, When a history replay task contains both a front-end row-level change with a version no higher than the valid deletion constraint fidelity front and a front-end row-level change with a version higher than that front, the history replay admission determination module extracts the initially affected primary key from the front-end row-level change, includes the row-level changes involving the initially affected primary key in the front-end row-level changes, includes the remaining front-end row-level changes as directly replaying row-level changes, and sets a processing path lock flag for the primary key entering the final state reconstruction task.
5. A deterministic transactional data warehouse archiving and synchronization system for Internet database services according to claim 1, characterized in that, The verifiable data baseline is a consistent full snapshot, business table snapshot, partition snapshot, or intermediate checkpoint that saves the complete row state, no later than the earliest transaction to be replayed in the final state reconstruction task; when archiving transactions, persistence includes the business table identifier, primary key value or primary key summary and original primary key verification information, global transaction identifier, deterministic version, operation type, archive file location, commit location, and primary key transaction index of the table structure version; A transaction is only included in the scope of queryable transactions after both the complete transaction and the corresponding primary key transaction index have been successfully persisted.
6. A deterministic transactional data warehouse archiving and synchronization system for Internet database services according to claim 5, characterized in that, The affected primary key and transaction chain construction module forms the complete transaction chain when the source transaction log range between the verifiable data baseline and the reconstruction termination checkpoint is continuously available, the primary key transaction index can locate all committed transactions involving the affected primary key within this range, each transaction has a complete transaction start event, row-level event and commit event, cross-file transaction is completed and spliced, the row-level event can match the corresponding table structure version and some column updates can complete the complete row status. If any condition is not met, retrieve the missing logs from other archived copies, select an earlier data baseline, or convert the corresponding primary key, partition, or business table to a full reconstruction, without generating a final state reconstruction record for the corresponding primary key.
7. A deterministic transactional data warehouse archiving and synchronization system for Internet database services according to claim 6, characterized in that, The primary key final state reconstruction module loads the state of the affected primary key in the verifiable data baseline, processes the add, update, and delete operations sequentially according to the deterministic version, and continues to process the re-insertion after deletion and its subsequent updates or deletions until the reconstruction termination checkpoint. When the final state is valid existence, a primary key final state reconstruction record is generated with the final state type of valid existence and containing complete final state row data, final state version, and final state global transaction identifier. When the final state is deletion, a primary key final state reconstruction record is generated with the final state type of deletion and containing the final state deletion version and final state global transaction identifier. The primary key final state reconstruction record also includes a transaction chain integrity summary and the reconstruction termination checkpoint.
8. A deterministic transactional data warehouse archiving and synchronization system for Internet database services according to claim 7, characterized in that, The data warehouse write and final state repair module writes a final state row when the final state type is valid and the target business table does not have a corresponding primary key or the current primary key version is lower than the final state version. It does not write again when the current primary key version is equal to the final state version and the row content is the same. When the final state type is deletion and the target business table has a corresponding primary key with a version lower than the final state version, it performs a final state deletion. When the target business table no longer has a corresponding primary key, it is determined that no repair is needed and the deletion record is not retained again. If the current primary key version is higher than the final version, or if the versions are the same but the status or content is inconsistent, automatic overwrite and verification record generation will not be performed.
9. A deterministic transactional data warehouse archiving and synchronization system for Internet database services according to claim 3, characterized in that, Before executing a data warehouse maintenance task, the task status management module sets the pending deletion constraint fidelity frontier to an admission freeze state, stops creating direct replay tasks containing versions no higher than that frontier, and waits for the relevant running direct replay tasks to complete or be converted into final state reconstruction tasks before allowing the data warehouse maintenance task to execute. After receiving maintenance completion information and maintenance version and completing mapping verification, the pending deletion constraint fidelity frontier is converted into a valid deletion constraint fidelity frontier. For maintenance tasks that have not been notified in advance, a conservative pending deletion constraint fidelity frontier is formed after receiving maintenance completion information, and incomplete direct replay tasks that overlap with it are suspended. The affected primary keys are extracted from the incomplete direct replay tasks and the relevant row-level changes written after maintenance completion and before admission freeze completion, and the affected primary keys are included in the final state reconstruction verification.
10. A deterministic transactional data warehouse archiving and synchronization system for Internet database services according to claim 1, characterized in that, The task status management module records the processing path and completion status of each row-level change for each global transaction identifier. Row-level changes that are directly replayed are marked as completed after successful writing. Row-level changes that enter the final state reconstruction task are marked as completed after the corresponding final state repair is completed or it is determined that no repair is needed. For sequential recovery tasks that start from unapplied transactions after the applied scope represented by the current effective application checkpoint, the global transaction identifier is merged into the set of applied global transaction identifiers and the current effective application checkpoint is advanced only when all row-level changes corresponding to the same global transaction identifier are completed and there are no incomplete preceding transactions. For historical replay tasks whose corresponding transactions are already included in the applied scope represented by the current effective application checkpoint, only the task completion status is updated and the current effective application checkpoint is not advanced. If any necessary processing fails, the corresponding global transaction identifier and application checkpoint remain unchanged.
