Skip to content

Duplicated PK in ExportTableToPointInTime Output to S3

0

I am encountering an issue when using the ExportTableToPointInTime API to back up a DynamoDB table to S3. The table has no duplicates, the manifest generated by the export is correct (lists one location), and this issue does not occur with other tables exported in the same way.

However, in the exported file stored in S3, one particular PK entry is duplicated across all its SKs. No other PKs have this issue.

Steps I have taken:

  • Confirmed that no duplicates exist in the DynamoDB table using a PK query.
  • Verified that the manifest file lists only one location for the exported data.
  • Inspected the exported files in S3 and found duplicates for the PK.

Code Snippet (written in Java): ExportTableToPointInTimeRequest exportTableToPointInTimeRequest = ExportTableToPointInTimeRequest.builder() .tableArn("arn:aws:dynamodb:region:account-id:table/MyTableName") .s3Bucket("my-s3-bucket") .exportFormat(ExportFormat.DYNAMODB_JSON) .s3Prefix("MyTableBackup/01-08-25/") .build();

Is this a known issue or limitation with the ExportTableToPointInTime API? Are there any recommended steps to ensure the export does not produce duplicate data?

Any guidance or suggestions would be greatly appreciated!

  • What do you mean by duplicated across all its SKs? Each line in file should have a unique item (PK + SK). You can have many items related to the same PK, which is known as an item collection.

1 Answer
0

The issue you're experiencing with duplicated PK entries in the ExportTableToPointInTime output to S3 is not a known limitation or common problem with the API. However, there are a few points to consider and steps you can take to investigate and potentially resolve this issue:

  1. Consistency: While the ExportTableToPointInTime operation provides a consistent snapshot of the table at a specific point in time, it's important to note that the exported data is eventually consistent, not transactionally consistent. This means that there might be some discrepancies between the actual table state and the exported data.

  2. PITR window: Ensure that the export time you're specifying is within the valid Point-in-Time Recovery (PITR) window. If the specified time is outside this window, it could potentially lead to unexpected results.

  3. Export format: You're using the DYNAMODB_JSON format, which is correct. However, you might want to try exporting in ION format as an alternative to see if the issue persists.

  4. Incremental export: If this is a recurring issue, you might want to consider using incremental exports instead of full exports. This allows you to export only the data that has changed within a specific time period, which might help isolate the problem.

  5. Verify export completion: Make sure that the export operation has completed successfully. You can check the status of the export using the DescribeExport API or by monitoring the export task in the AWS Management Console.

  6. S3 integrity: Verify the integrity of the S3 objects after the export. Ensure that there were no issues during the data transfer to S3.

  7. AWS Support: If the issue persists after trying these steps, it would be advisable to contact AWS Support. They can provide more detailed investigation and potentially identify any underlying issues with the export process.

To ensure the export doesn't produce duplicate data, you can:

  1. Double-check the table's PITR settings and ensure they're correctly configured.
  2. Use a more recent point in time for the export, if possible.
  3. Consider using DynamoDB Streams or Kinesis Data Streams for DynamoDB in conjunction with the export to capture any changes that occur during the export process.

Remember, if you need to keep the source and target tables in sync after the export, you can use DynamoDB Streams with AWS Lambda to replay any writes that occurred in the source table since the export started.
Sources
ExportTableToPointInTime - Amazon DynamoDB
Migrate a table using export to S3 and import from S3 - Amazon DynamoDB
Requesting a table export in DynamoDB - Amazon DynamoDB

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.