-
Notifications
You must be signed in to change notification settings - Fork 3k
Core: Add transaction catalog tests #4319
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
Changes from all commits
3c43fe7
1625c1c
6d4666a
649932a
8f2b1f2
d57cd11
8bc28b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |
| import java.util.function.Function; | ||
| import java.util.function.Predicate; | ||
| import org.apache.iceberg.encryption.EncryptionManager; | ||
| import org.apache.iceberg.exceptions.AlreadyExistsException; | ||
| import org.apache.iceberg.exceptions.CommitFailedException; | ||
| import org.apache.iceberg.exceptions.NoSuchTableException; | ||
| import org.apache.iceberg.io.FileIO; | ||
|
|
@@ -115,7 +116,12 @@ protected void doRefresh() { | |
| public void commit(TableMetadata base, TableMetadata metadata) { | ||
| // if the metadata is already out of date, reject it | ||
| if (base != current()) { | ||
| throw new CommitFailedException("Cannot commit: stale table metadata"); | ||
| if (base != null) { | ||
| throw new CommitFailedException("Cannot commit: stale table metadata"); | ||
| } else { | ||
| // when current is non-null, the table exists. but when base is null, the commit is trying to create the table | ||
| throw new AlreadyExistsException("Table already exists: %s", tableName()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This exception message reads a little funny to me, but I think in context it will make sense. For clarification, what's happening here is that we entered some sort of create table transaction, and then at the end of the transaction, the table was created by some other process. Is that correct? A comment might help make that more clear but I can see how the stack trace will make sense in context.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a comment to make this clear.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didnt look deeply, but wondering why if caller passes base=null and current is not null , we can tell the table already exists? It seems it would be a new assumption to all the calling code?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a comment to make this clear. |
||
| } | ||
| } | ||
| // if the metadata is not changed, return early | ||
| if (base == metadata) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@szehon-ho, I addressed your comment.