c-thiel opened a new pull request, #3695:
URL: https://github.com/apache/iceberg-rust/pull/3695

   ## Which issue does this PR close?
   
   A writer whose clock runs ahead can make `TableMetadataBuilder` produce 
table metadata that neither this crate nor Iceberg Java can load again.
   
   ## What changes are included in this PR?
   
   `TableMetadataBuilder::build()` validated the new metadata before it added 
the metadata-log entry for the previous metadata file. A build whose 
`last-updated-ms` was more than one minute before that entry passed. The 
written file then failed to load with "Invalid update timestamp …: before last 
metadata log entry".
   
   One way to get there: a writer whose clock is ahead adds a snapshot on a 
branch, so `last-updated-ms` becomes that snapshot's time. The next change to 
the table that adds no snapshot takes the current time, which is before the 
previous file's entry.
   
   `build()` now adds the entry and expires the metadata log before it 
validates, so such a build fails instead of producing metadata that no reader 
can load. Iceberg Java (`TableMetadata.Builder.build()`, then the 
`TableMetadata` constructor) and iceberg-go (`MetadataBuilder.Build`) check in 
this order.
   
   ## Are these changes tested?
   
   Yes. `test_metadata_change_after_a_fast_branch_snapshot_is_refused_in_build` 
in `spec::table_metadata_builder` adds a branch snapshot dated two hours ahead, 
then sets a property, and checks that the build fails with the metadata-log 
error. It fails without the fix.
   
   ## AI Disclosure
   
   Supported by Claude Code. Reviewed and checked by me.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to