-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Don't delete Hive and Iceberg schema locations with nonempty subdirectories #10485
Conversation
6b62bca
to
15b8e81
Compare
@@ -82,19 +82,20 @@ public void testDropSchemaFilesWithLocationWithExternalFile() | |||
{ | |||
String schemaName = "schema_with_nonempty_location_" + randomTableSuffix(); | |||
String schemaDir = warehouseDirectory + "/schema-with-nonempty-location/"; | |||
// Use subdirectory to make sure file check is recursive | |||
String subDir = schemaDir + "subdir/"; |
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.
Is there case with EMPTY subdirectory also covered (that it does not prevent schema from being deleted)?
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.
I've changed that behavior so empty directories won't be deleted, and I added a test for that as well.
39e1966
to
11aea45
Compare
String schemaName = "schema_with_empty_location_" + randomTableSuffix(); | ||
String schemaDir = warehouseDirectory + "/schema-with-empty-location/"; | ||
String schemaName = "schema_without_location_" + randomTableSuffix(); | ||
String schemaDir = format("%s/%s.db/", warehouseDirectory, schemaName); | ||
|
||
onTrino().executeQuery(format("CREATE SCHEMA %s WITH (location = '%s')", schemaName, schemaDir)); | ||
onTrino().executeQuery(format("CREATE SCHEMA %s", 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.
These lines aren't actually changed; I just switched the order of this test and the next after renaming them, and they're so similar that git didn't realize.
11aea45
to
6cd0c32
Compare
hdfsClient.delete(schemaDir); | ||
} | ||
|
||
@Test // make sure empty directories are noticed as well |
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.
nit move the comment to method body.
@jirassimok |
Previously, files in subdirectories weren't considered when deciding whether to delete Hive and Iceberg schema locations when the schema was dropped.
6cd0c32
to
0b7fea6
Compare
This fixes an error in #10146 and #9767 that caused files in subdirectories to be ignored when determining whether to delete schema locations when dropping Hive and Iceberg schemas.
(Any empty subdirectories will still be deleted with the schema, though.)