Skip to content

S3 Metadata dynamics of records

0

Hello,

I've used Management Console, S3 Metadata - Preview -> Create a metadata configuration option to create a metadata table in a table bucket. The table was successfully created.

I used Spark, on localhost, to query Amazon S3 Tables Catalog for Apache Iceberg, using the following commands

spark-shell 
--packages org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.6.1,software.amazon.s3tables:s3-tables-catalog-for-iceberg-runtime:0.1.3,software.amazon.awssdk:bundle:2.29.43 
--conf spark.sql.catalog.s3tablesbucket=org.apache.iceberg.spark.SparkCatalog 
--conf spark.sql.catalog.s3tablesbucket.catalog-impl=software.amazon.s3tables.iceberg.S3TablesCatalog 
--conf spark.sql.catalog.s3tablesbucket.warehouse=<arn:aws:s3tables:us-east-1:111122223333:bucket/amzn-s3-demo-bucket1>
--conf spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions

scala> spark.sql(" SELECT count(*) FROM s3tablesbucket.my_namespace.`my_table` WHERE key = '<key>' ").show()

I've noticed that for a recently updated object, I have 2 records with different record_type in Metadata table: one record for update metadata of the object, one record for copy-in-place of the object. Doesn't Metadata table contains only 1 record for each object ? Could you please specify a document about when are records created in Metadata table ?

Thank you

asked 2 years ago256 views

1 Answer
0
Accepted Answer

Amazon S3 Metadata tables can indeed contain multiple records for a single object, reflecting different events or changes to that object over time. This behavior is by design and allows for tracking the history of changes to objects in your S3 bucket.

When you update an object in S3, it can trigger multiple events that are captured in the metadata table. In your case, you observed two records:

  1. An update metadata record: This reflects changes to the object's metadata.
  2. A copy-in-place record: This is generated when an object is overwritten in its current location.

These multiple records allow you to understand the object's history and the types of operations performed on it. The metadata table doesn't just contain the current state of each object, but rather a log of events related to the objects in your bucket.

It's important to note that S3 Metadata only captures metadata for change events (such as uploads, updates, and deletes) that occur after you have created your metadata table configuration. Each change to an object creates a new snapshot in the metadata table, allowing you to query both the current state and historical changes of objects in your bucket.

This approach enables various use cases, such as auditing changes, understanding object lifecycle, and tracking the evolution of your data over time. When querying the metadata table, you may need to consider how to handle these multiple records depending on your specific use case - for example, you might want to filter for the most recent record for each object, or you might want to analyze the full history of changes.

Remember that S3 Metadata is designed to update the metadata table within minutes to reflect the latest changes in your bucket, providing near real-time insights into your S3 data.

Sources
Configuring metadata tables - Amazon Simple Storage Service
Announcing Amazon S3 Metadata (Preview) – Easiest and fastest way to manage your metadata - AWS
Accelerating data discovery with S3 Metadata - Amazon Simple Storage Service

answered 2 years ago

EXPERT

reviewed 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.