Skip to content

fix: retry advancement of PreparedCommit into PostCommit in case version 0 already exists (created by another writer) #3513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danielgafni
Copy link

@danielgafni danielgafni commented Jun 2, 2025

Description

This PR fixes the PreparedCommit to fallback to the retry mechanism in case version 0 has been created by another writer.

Related Issue(s)

Resolve #3505

@github-actions github-actions bot added the binding/rust Issues for the Rust crate label Jun 2, 2025
Copy link

github-actions bot commented Jun 2, 2025

ACTION NEEDED

delta-rs follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

@danielgafni danielgafni changed the title 🐛 retry advancement of PreparedCommit into PostCommit in case version 0 has been created (by another writer) fix: retry advancement of PreparedCommit into PostCommit in case version 0 has been created (by another writer) Jun 2, 2025
@danielgafni
Copy link
Author

What is the DCO check complaining about? My commit has been signed (even confirmed by GitHub). Does it expect a specific format?

image

@ion-elgreco
Copy link
Collaborator

@danielgafni do git commit -m "msg" -s

Copy link

codecov bot commented Jun 2, 2025

Codecov Report

Attention: Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 74.09%. Comparing base (f8dcef3) to head (b4dc03a).

Files with missing lines Patch % Lines
crates/core/src/kernel/transaction/mod.rs 81.25% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3513      +/-   ##
==========================================
- Coverage   74.14%   74.09%   -0.05%     
==========================================
  Files         150      150              
  Lines       44550    44552       +2     
  Branches    44550    44552       +2     
==========================================
- Hits        33031    33013      -18     
- Misses       9382     9384       +2     
- Partials     2137     2155      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}
Err(TransactionError::VersionAlreadyExists(0)) => Ok(()), // this can happen if the table has been created by another writer since the `this.table_data.is_none()` check above
Err(e) => Err(e),
}?;
}

// unwrap() is safe here due to the above check
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to also load the snapshot now when VersionAlreadyExists was thrown the first time in it's current state this will panic.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhh right. Done.
Can we test this? Seems tricky since we'd have to perfectly time writing the 0 version from another writer.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also initialize attempt_number to 2 in this case?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be easier to test in Rust

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for this please? There are some concurrency tests, somewhere in the rust codebase which you can use as template

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into that. A more direct pointer would be appreciated

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delta-rs/crates/test/src/concurrent.rs here you can find some related stuff

@danielgafni
Copy link
Author

danielgafni commented Jun 2, 2025

@ion-elgreco I do have commit signing enabled by default, and GitHub recognizes them as well (see the green Verified label next to my commit). This makes me think there is something specific about this DCO check configuration that my signing doesn't do.

Edit: actually this is the case --- the -s option introduces the commit authorship text which was not present previously. Looks like it has to be configured in the commit message template for automatic signing.

@danielgafni danielgafni force-pushed the retry-inial-table-creation branch from b4dc03a to cf61e65 Compare June 2, 2025 09:50
@danielgafni danielgafni force-pushed the retry-inial-table-creation branch from cf61e65 to 98605fc Compare June 2, 2025 09:51
@danielgafni danielgafni changed the title fix: retry advancement of PreparedCommit into PostCommit in case version 0 has been created (by another writer) fix: retry advancement of PreparedCommit into PostCommit in case version 0 already exists (created by another writer) Jun 2, 2025
@danielgafni danielgafni requested a review from ion-elgreco June 2, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding/rust Issues for the Rust crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initial table creation may fail with multiple writers
2 participants