Cleanup metadata file when commitNewTable fails for the Iceberg table#14869
Cleanup metadata file when commitNewTable fails for the Iceberg table#14869ebyhr merged 1 commit intotrinodb:masterfrom
commitNewTable fails for the Iceberg table#14869Conversation
|
TODO Add test cases. |
ce68802 to
8106393
Compare
4d110da to
d2e44a1
Compare
commitNewTable fails for the Iceberg table
d2e44a1 to
bb34560
Compare
There was a problem hiding this comment.
In a local File system, This operation does not delete the parent folder.
cabcba5 to
f1d331c
Compare
.../trino/plugin/iceberg/catalog/file/TestIcebergFileMetastoreTableOperationsCreateFailure.java
Outdated
Show resolved
Hide resolved
.../trino/plugin/iceberg/catalog/file/TestIcebergFileMetastoreTableOperationsCreateFailure.java
Outdated
Show resolved
Hide resolved
.../trino/plugin/iceberg/catalog/file/TestIcebergFileMetastoreTableOperationsCreateFailure.java
Outdated
Show resolved
Hide resolved
commitNewTable fails for the Iceberg tablecommitNewTable fails for the Iceberg table
0150fee to
95036ab
Compare
...no-iceberg/src/main/java/io/trino/plugin/iceberg/catalog/AbstractIcebergTableOperations.java
Outdated
Show resolved
Hide resolved
commitNewTable fails for the Iceberg tablecommitNewTable fails for the Iceberg table
e90cc3a to
c287c6a
Compare
There was a problem hiding this comment.
Why atomic when it runs in one thread?
There was a problem hiding this comment.
c287c6a to
4919a81
Compare
5e5a1ad to
2faf497
Compare
...o-iceberg/src/main/java/io/trino/plugin/iceberg/catalog/glue/GlueIcebergTableOperations.java
Outdated
Show resolved
Hide resolved
2faf497 to
1fcb7c2
Compare
There was a problem hiding this comment.
Why UnsupportedOperationException?
There was a problem hiding this comment.
I was looking for createTable implementation and the exceptions thrown by them. InMemoryThriftMetastore#createTable throw UnsupportedOperationException.
But now I realized that InMemoryThriftMetastore is implemented for test cases. So UnsupportedOperationException check is needed.
There was a problem hiding this comment.
My bad. It was not needed earlier. But now it's needed with the latest change (// testException is a shared mutable state).
...io/trino/plugin/iceberg/catalog/file/TestIcebergFileCreateTableFailureMetadataCleanedUp.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
It doesn't need to be a base class with two subclasses.
- one option is to just move QueryRunner setup to a test method (or helper of a test method) and have ordinary test class with two test methods
- clean
- the downside is that you pay query runner setup cost twice
- another option is to just have a query runner and a test instance field (eg AtomicReference) which determines what exception to throw
- this would be very similar to the code you have
- a bit less clean as you have a mutable field
- but you pay query runner setup cost once only
- this is the option i'd implement
There was a problem hiding this comment.
I followed the 2nd option.
There was a problem hiding this comment.
I am not entirely sure we need that test, since file metastore is just a testing utliity.
if we use file metastore as an approximation of HMS, that's also fine, but let's have a code comment explaining that
1fcb7c2 to
915e512
Compare
|
@krvikash please rebase & resolve the conflicts. |
915e512 to
bdf2fea
Compare
|
Rebased with master. |
|
Hi @ebyhr, when you get time could you please review this PR? |
...rc/test/java/io/trino/plugin/iceberg/catalog/file/TestIcebergFileCreateTableFailureTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/io/trino/plugin/iceberg/catalog/file/TestIcebergFileCreateTableFailureTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/io/trino/plugin/iceberg/catalog/file/TestIcebergFileCreateTableFailureTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/io/trino/plugin/iceberg/catalog/file/TestIcebergFileCreateTableFailureTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/io/trino/plugin/iceberg/catalog/file/TestIcebergFileCreateTableFailureTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/io/trino/plugin/iceberg/catalog/file/TestIcebergFileCreateTableFailureTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/io/trino/plugin/iceberg/catalog/file/TestIcebergFileCreateTableFailureTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/io/trino/plugin/iceberg/catalog/glue/TestIcebergGlueCreateTableFailureTest.java
Outdated
Show resolved
Hide resolved
bdf2fea to
311ae6e
Compare
|
Thanks, @ebyhr for the review. I have addressed the comments and updated the PR. |
|
/test-with-secrets sha=311ae6e98b205d8d9eea761fd75b0b4d1cd375d7 |
311ae6e to
d657166
Compare
|
I pushed a small fix to rename test classes:
|
d657166 to
b36e2aa
Compare
b36e2aa to
b8dd25d
Compare
Description
Fixes #14798
Iceberg connector creates a new metadata file when we do DDL/DML operation. In such case, if the operation gets fails then the metadata file does not get cleanup. Metastore Table Operation can fail in various cases like permission denied, and not having valid credentials. This fix will cleanup the metadata file if gets it is created.
The fix is inspired from https://github.com/apache/iceberg/blob/3cddc9f28c93b9231060ecb6b90e2d524bd5d160/aws/src/main/java/org/apache/iceberg/aws/glue/GlueTableOperations.java#L142
Non-technical explanation
NA
Release notes
(X) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: