-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Ignore non-existing table when dropping Iceberg schema with cascade #27361
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
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 |
|---|---|---|
|
|
@@ -1171,7 +1171,11 @@ public void dropSchema(ConnectorSession session, String schemaName, boolean casc | |
| dropView(session, viewName); | ||
| } | ||
| for (SchemaTableName tableName : listTables(session, Optional.of(schemaName))) { | ||
| dropTable(session, getTableHandle(session, tableName, Optional.empty(), Optional.empty())); | ||
| ConnectorTableHandle tableHandle = getTableHandle(session, tableName, Optional.empty(), Optional.empty()); | ||
| if (tableHandle != null) { | ||
| // getTableHandle method returns null if the table is dropped concurrently | ||
| dropTable(session, tableHandle); | ||
|
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. So to understand the motivation of the change correctly ... Looks like following method calls in github
Therefore tables we've listed from metadata can get dropped from beneath this thread as a I'm guessing the risk of dropping a table taking so long is mostly when there's externally managed files. The delta lake connector should be comparable. In your implementation of CASCADE there in the delta lake connector you use an additional
Member
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 didn't read this message carefully before merging the PR). Each Iceberg catalog maintains its own table metadata cache, so the first |
||
| } | ||
| } | ||
| } | ||
| catalog.dropNamespace(session, schemaName); | ||
|
|
||
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.
Worth code comment
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.
+1
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.
Why view not have such issue?
Uh oh!
There was an error while loading. Please reload this page.
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.
Reposting to main PR thread. I think views don't have that issue because it's a quick update to remove them from the metastore. Files connected to an iceberg table will take longer to delete and that increases risk of the table disappearing underneath.