Do not create temp staging directory for CREATE TABLE without data#5802
Do not create temp staging directory for CREATE TABLE without data#5802laurachenyu wants to merge 1 commit intotrinodb:masterfrom
Conversation
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Yu Chen.
|
3c41d8f to
3625d4d
Compare
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveLocationService.java
Outdated
Show resolved
Hide resolved
findepi
left a comment
There was a problem hiding this comment.
i see that it works. It would be great to have a test for this though
Also, i think it should be solved at a higher level (earlier). See inline comment
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveLocationService.java
Outdated
Show resolved
Hide resolved
|
@laurachenyu is there a test covering CTAS WITH NO DATA ensuring
|
3625d4d to
98e783d
Compare
98e783d to
31edd88
Compare
|
There's some confusion about the problem due to the phrase "without data" in the commit message. This PR is for a regular @laurachenyu I suggest removing the "without data" part from the commit message to avoid confusion. Solving this in Another option is to add a new API to directly return the target path for a new table. The existing |
| String schemaName = temporaryCreateEmptyTable.getSchemaName(); | ||
| String tableName = temporaryCreateEmptyTable.getTableName(); | ||
| LocationService locationService = getLocationService(); | ||
| LocationHandle locationHandle = locationService.forNewTable(transaction.getMetastore(), |
|
|
||
| HdfsContext context = new HdfsContext(session, schemaName, tableName); | ||
| if (locationHandle.getWriteMode() == STAGE_AND_MOVE_TO_TARGET_DIRECTORY) { | ||
| assertFalse(pathExists(context, hdfsEnvironment, writePath), |
There was a problem hiding this comment.
io.prestosql.plugin.hive.util.HiveWriteUtils#createTemporaryPath uses randomUUID, so different temp directory will be used in transaction.getMetastore().createTable than writePath.
What you should do instead is to set some random staging directory (via temporary_staging_directory_path session property) and check that no dir was created there after createTable
|
👋 @laurachenyu - this PR has become inactive. If you're still interested in working on it, please let us know, and we can try to get reviewers to help with that. cc @electrum @sopel39 @findepi We're working on closing out old and inactive PRs, so if you're too busy or this has too many merge conflicts to be worth picking back up, we'll be making another pass to close it out in a few weeks. |
|
@mosabua Laura was a previous member on our team and we are working to merge some of our internal patches back to the OSS. We would like to resume working on this patch but I may open a separate PR for this. |
|
Superseded by #14830 |
In case of CREATE TABLE (managed), empty staging directory was not cleaned up at commit time, but relying on /tmp periodic delete.