Skip to content

AWS DynamoDB Export to S3 creates empty files along with actual data file

0

Hi, I am working on incremental export from DDB to S3 and observed that while export happens successfully, it does create some empty files (20.0B) in S3 bucket along with actual export data file. Surprisingly, this only happens when there is incremental export involved. It do not create any empty files for full export option. Could you may be shed some light on this behavior? Any pointers to avoid creating empty files would be appreciated. Thanks.

asked 2 years ago437 views

2 Answers
1

Export and Incremental export, exports data on a partition or shard level respectively. It will create empty files should the partition or shard contain no data. Partitions or shards that contain data will export files complete with data.

The export creates at least 1 file per partition. For partitions that are empty, your export request will create an empty file. All of the items in each file are from that particular partition's hashed keyspace.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/S3DataExport.Output.html

AWS
EXPERT

answered 2 years ago

0

The behavior you're observing with empty files being created during incremental exports from DynamoDB to S3 is actually an expected outcome in certain scenarios. This occurs due to the way AWS handles incremental exports, especially when dealing with changes in data size between exports.

When you perform an incremental export that is smaller than the previous export and you're using the "overwrite" mode, AWS overwrites the unneeded partitions with empty data. This results in the creation of empty files (20.0B in size) in your S3 bucket. These empty files represent partitions that no longer contain data in the current incremental export.

It's important to note that the export manifest only lists the partitions that actually contain data. So, while you may see these empty files in your S3 bucket, they are not included in the manifest and do not affect the integrity of your exported data.

This behavior is specific to incremental exports and explains why you don't see it happening with full exports. Full exports always create a complete snapshot of the table at a specific point in time, so there's no need for overwriting or creating empty partitions.

As for avoiding the creation of these empty files, there isn't a direct way to prevent this behavior as it's part of AWS's export mechanism. However, you can consider the following approaches:

  1. Use the export manifest to identify and work with only the files that contain actual data.
  2. Implement a post-processing step to remove empty files after the export is complete.
  3. If feasible, consider using full exports instead of incremental exports for scenarios where this behavior is problematic.

Remember that while these empty files may seem unnecessary, they don't impact the functionality or correctness of your exported data. They're simply a byproduct of AWS's method for handling incremental exports efficiently.
Sources
General troubleshooting - AWS Data Exports
DynamoDB data export to Amazon S3: how it works - 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.