Skip to content

Conversation

CTTY
Copy link
Contributor

@CTTY CTTY commented Jun 18, 2025

Which issue does this PR close?

Related Issue

Closes:

What changes are included in this PR?

This PR wraps up the effort to make Transaction API + TransactionAction retryable!
With Transaction holds retryable actions, it no longer needs to hold staging variables like current_table, updates, or requirements. These can be generated within do_commit.

  • Remove current_table, updates, and requirements from Transaction

Are these changes tested?

Existing unit tests

Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

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

Thanks @CTTY for this pr, generally looks good to me!


self.current_table
.with_metadata(Arc::new(metadata_builder.build()?.metadata));
table.with_metadata(Arc::new(metadata_builder.build()?.metadata));
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to this pr, and it's not mandatory. But I think it's better to change the with_metadata(mut self) to consume table rather than modify it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a very good point. I did notice people are confused with the usage of tx.apply in other discussions, and making with_metadata consume tables would require tx.apply to return Result<Table> instead of Result<()> and make it clearer on its usage.

I've included the change in this PR, please let me know what you think!

liurenjie1024
liurenjie1024 previously approved these changes Jun 21, 2025
Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

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

Thanks @CTTY for this pr, LGTM! Just one minor suggest.


async fn do_commit(&mut self, catalog: &dyn Catalog) -> Result<Table> {
let base_table_identifier = self.base_table.identifier().to_owned();
let base_table_identifier = self.table.identifier().to_owned();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we need to call to_owned? The load_table accepts a reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because base_table_identifier will be passed to TableCommit::builder later around L153. I think this is probably a little bit overengineering 😄 fixed

Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

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

Thanks @CTTY for this pr!

@liurenjie1024 liurenjie1024 merged commit 772ae1a into apache:main Jun 21, 2025
17 checks passed
@CTTY CTTY deleted the ctty/tx-impl-4 branch June 23, 2025 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants