This document explains how data synchronization works in Data Integration and helps you evaluate task outcomes, such as data volume and destination record counts. It also presents common data quality scenarios and provides solutions to troubleshoot them.
How it works
DataWorks Data Integration uses a parallel processing and plugin-based architecture to achieve efficient and stable data synchronization.
Parallel execution model (job and task)
To maximize data throughput, a synchronization task uses a two-level execution structure:
-
Job: A running instance of a synchronization task.
-
Task: The smallest execution unit of a job. A job is split into multiple tasks that can run concurrently on one or more machines.
Each task is responsible for processing an independent data shard. This parallel processing mechanism significantly improves overall data synchronization efficiency.
Plugin-based data flow (reader and writer)
Within each task, the data flow is orchestrated by a reader plugin and a writer plugin connected by an in-memory buffer:
-
reader plugin: Connects to the source data store, reads the data, and pushes it to the internal buffer.
-
writer plugin: Consumes data from the buffer and writes it to the destination data store.
The reader plugin and writer plugin strictly adhere to the native protocols and constraints, such as data types and primary key restrictions, of their respective data sources. Therefore, the final synchronization behavior and data consistency depend on the implementation of the source and target systems.
Troubleshoot writer-side data consistency
The Data Integration writer plugin writes data from the source to the destination. Each destination data source type has a corresponding writer plugin. The writer plugin submits data to the destination by using JDBC or the data source's SDK based on the configured write mode, including conflict resolution strategies.
The actual write results and data content at the destination depend on the write mode and the constraints of the destination table.
If you encounter issues with data quality, such as record counts or data content, after a data synchronization task completes, review the following common writer-side issues.
|
Cause |
Description |
Solution |
|
|
Improperly configured write mode |
The writer plugin writes source data to the destination using the selected write mode. If the source data conflicts with the destination table's constraints, it can result in failed inserts (dirty data), silent discards, or record replacements. |
Select the correct write mode for your use case. For more information, see Appendix: Write modes for relational databases. |
|
|
Dirty data threshold reached |
The amount of dirty data, caused by issues like data type mismatches or oversized content, exceeds the configured threshold, causing the task to fail and preventing some data from being written. |
Identify the cause of the dirty data and resolve the issue. Alternatively, determine if the dirty data can be tolerated and ignored. Note
If your task cannot tolerate dirty data, you can modify the dirty data threshold in . For more information about how to configure the dirty data threshold, see codeless UI configuration. For more information about what constitutes dirty data, see Data Integration. |
|
|
Querying data too early |
Data is queried before the synchronization task completes. For some data sources, such as Hive and MaxCompute (configurable), data may be partially or completely unavailable until the task finishes. |
Always verify the data in the target table after you confirm that the synchronization task instance has run successfully. |
|
|
Missing node dependency |
If no explicit Directed Acyclic Graph (DAG) dependency is configured between a downstream analysis task and an upstream synchronization task, the downstream task may start prematurely and read incomplete data. |
In DataStudio, configure an explicit parent-child node dependency between upstream and downstream tasks. Avoid using weak dependencies, such as |
|
|
Multiple synchronization tasks write to the same table or partition concurrently, causing interference. |
Unsafe concurrent execution of synchronization tasks.
|
|
|
|
Task not configured for idempotent execution |
The task is not idempotent, meaning multiple runs produce different results. Rerunning the task can cause duplicate data to be inserted or data to be overwritten incorrectly. |
1. Whenever possible, design the task to be idempotent. For example, use the |
|
|
Incorrect partition expression |
In MaxCompute, most data tables are partitioned, and the partition values are often DataWorks scheduling parameters like $bizdate. Common errors include:
|
Check the variable expressions in the data synchronization task. Verify that the scheduling parameter configuration is correct and that the runtime parameters in the task instance evaluate to the expected values. |
|
|
Data type or time zone mismatch |
Inconsistent data types or time zone settings between the source and destination can cause data to be truncated, converted incorrectly, or result in discrepancies during comparisons. |
|
|
|
Destination data changed by other processes |
If other applications modify the destination data source concurrently, its content may become inconsistent with the source data. |
Ensure that no other processes write to the destination table during the synchronization window. If concurrent writes are expected behavior, you must accept the resulting data discrepancies. |
|
Appendix: Write modes for relational databases
|
Protocol type |
Write mode |
Behavior on conflict |
Behavior without conflict |
When to use |
|
General/MySQL Protocol |
|
The insert fails and generates dirty data. |
Inserts new data. |
Append data for full or incremental synchronization without overwriting or modifying existing records. |
|
|
Replaces the old row by first deleting it and then inserting the new row. |
Inserts new data. |
Completely overwrite old records with the latest data. |
|
|
|
Updates the old row by updating only specified fields with new data. |
Inserts new data. |
Update specific fields in a record while preserving others, such as a creation timestamp. |
|
|
|
Ignores the new row without writing it or generating an error. |
Inserts new data. |
Insert only data that does not already exist and take no action on existing records. |
|
|
PostgreSQL |
|
Ignores the new row without writing it or generating an error. |
Inserts new data. |
Insert only data that does not already exist and take no action on existing records. |
|
|
Updates the old row by updating specified fields in the conflicting row with new data. |
Inserts new data. |
Update specific fields in a record while preserving others, such as a creation timestamp. |
|
|
|
Discards conflicting rows. Uses the high-performance |
Bulk inserts new data. |
Efficiently append large batches of data while allowing duplicate records to be skipped. |
|
|
|
Updates conflicting rows. Uses the |
Bulk inserts new data. |
Efficiently synchronize large batches of data, overwriting old records with the latest data. |
|
|
- |
|
Not supported. |
||
Troubleshoot reader-side data consistency
The Data Integration reader plugin connects to the source data store, extracts the data, and delivers it to the writer plugin. Each source data source type has a corresponding reader plugin. The plugin uses JDBC or the data source's SDK to extract data based on the configured extraction mode, which can include filters, tables, partitions, and columns.
The actual read results depend on the data synchronization mechanism, changes to the source data, and the task configuration.
If you encounter issues with data quality, such as record counts or data content, after a data synchronization task completes, review the following common reader-side issues.
|
Cause |
Description |
Solution |
|
Concurrent changes to source data |
|
Accept this behavior as an expected outcome of high-throughput data synchronization. Rerunning the task may yield different results due to real-time changes in the source data. |
|
Incorrect filter conditions |
|
Check the scheduling variable expressions in the data synchronization task. Verify that the scheduling parameter configuration is correct and that the parameter values are replaced as expected at runtime. |
|
Reader-side dirty data |
A parsing failure occurs when reading source data. This is rare in structured databases but can happen with semi-structured data sources, such as CSV or JSON files in OSS. Format errors may cause some records to be skipped. |
|
Troubleshoot environment issues
|
Cause |
Solution |
|
Querying the wrong data source, table, or partition |
|
|
Upstream dependencies not met |
If the data is generated periodically, such as by a recurring data synchronization task or merge task, ensure the upstream tasks that generate this data have run and completed successfully. |
As a general troubleshooting step, you can run the task multiple times to observe and compare the synchronization results. You can also try switching the source or destination data source for comparative testing. These tests can help you narrow down the problem.