I turned on validation for my AWS Database Migration Service (AWS DMS) task, but the validation failed or isn't progressing.
Short description
When you use the validation feature for an AWS DMS task, you can review statistics at the table level and configure data validation settings.
Resolution
Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.
View the data validation information
You can use the AWS DMS console, the AWS CLI, or the AWS DMS API.
Use the AWS DMS console
Complete the following steps:
- Open the AWS DMS console.
- In the navigation pane, choose Database migration tasks.
- Choose the name of your task.
- From the Table statistics section, review the validation state.
Use the AWS CLI
Run the describe-table-statistics command to view the data validation report in JSON format:
aws dms describe-table-statistics --replication-task-arn arn:aws:dms:us-east-1:111122223333:task:XXXXXXXXXXXXXXXXXX
Note: Replace 111122223333 with your AWS account ID.
Use the AWS DMS API
Initiate the DescribeTableStatistics operation.
Check whether validation progresses
Complete the following steps:
- Open the AWS DMS console.
- In the navigation pane, choose Database migration tasks.
- Select the name of your replication task.
- Choose the CloudWatch metrics tab
- Choose Validation.
- Compare the ValidationPendingOverallCount metric with ValidationSucceededRecordCount.
- If the pending count decreases over time and the succeeded count is above zero, then validation progresses normally.
- If the pending count stays flat and the succeeded count remains at zero, then validation is stuck.
Then, take the following actions based on the per-table validation state:
- For Pending records, increase ThreadCount or PartitionSize.
- For no primary key or table error, add a primary key or resolve the table error before validation can progress.
- For persistent pending records, check for high change data capture (CDC) latency.
Note: Note: Validation waits for latency to settle before the task compares source and target.
Resolve validation failures
Complete the following steps:
- Open the AWS DMS console.
- In the navigation pane, choose Database migration tasks.
- Select the name of your replication task.
- Choose the Table statistics tab.
- Check the Validation state column for each table.
Based on the validation state, take the following actions.
The validation state is mismatched records
Connect to the target database. If you turned on the data resync feature for the task, then query the awsdms_validation_failures_v2 table. Or, query the awsdms_validation_failures_v1 table:
select * from awsdms_control.awsdms_validation_failures_v1 where TASK_NAME = 'YOUR-TASK-EXTERNAL-RESOURCE-ID';
Note: Replace YOUR_TASK_EXTERNAL-RESOURCE-ID with the last value in the task's ARN. AWS DMS creates this table on the target database. The control schema varies by target engine. MySQL and MariaDB use awsdms_control, PostgreSQL uses public, Oracle uses the target schema, and SQL Server uses dbo.
Use the primary key of the failed record to query the source and target endpoints. Compare the records to identify what doesn't match.
Determine whether the mismatch is a false positive. The following conditions can cause false mismatches.
High CDC latency at validation time can cause false mismatches for records that haven't yet applied to the target. To resolve this, increase RecordFailureDelayLimitInMinutes to allow more time for CDC changes to apply before validation compares records. Or, increase ValidationQueryCdcDelaySeconds to add a delay between source and target queries.
Collation differences between source and target can cause string comparisons to fail. To resolve this, set HandleCollationDiff to true to normalize collation during comparison.
Large binary object (LOB) truncation can cause partial data mismatches. To resolve this, confirm that the LOB settings for the task match the maximum LOB size on the source.
Data type and character-set differences can cause value mismatches. To resolve this, add an override-validation-function transformation rule to define a custom comparison for the affected column.
If the mismatch is genuine, then turn on the data resync to re-sync the affected rows from the source, or reload the affected table.
If the validation state is Pending records
Increase the ThreadCount parameter above its default of 5 to speed up validation. You can also increase PartitionSize from its default of 10,000.
Note: Both settings add load on the source and target endpoints. Test in a non-production environment first. For more information, see Data validation task settings.
Other validation states
See Replication task statistics.
Related information
Monitoring AWS DMS tasks
Troubleshooting migration tasks in AWS Database Migration Service
Limitations