-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] Fix remove orphan files with data file path directory #4871
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,17 @@ | |
| @ThreadSafe | ||
| public class FileStorePathFactory { | ||
|
|
||
| public static final String MANIFEST_PATH = "manifest"; | ||
| public static final String MANIFEST_PREFIX = "manifest-"; | ||
| public static final String MANIFEST_LIST_PREFIX = "manifest-list-"; | ||
| public static final String INDEX_MANIFEST_PREFIX = "index-manifest-"; | ||
|
|
||
| public static final String INDEX_PATH = "index"; | ||
| public static final String INDEX_PREFIX = "index-"; | ||
|
|
||
| public static final String STATISTICS_PATH = "statistics"; | ||
| public static final String STATISTICS_PREFIX = "stat-"; | ||
|
|
||
|
Comment on lines
+40
to
+50
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. private
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 think both public and private are fine, and the BUCKET_PATH_PREFIX is also public. |
||
| public static final String BUCKET_PATH_PREFIX = "bucket-"; | ||
|
|
||
| // this is the table schema root path | ||
|
|
@@ -94,6 +105,25 @@ public Path root() { | |
| return root; | ||
| } | ||
|
|
||
| public Path manifestPath() { | ||
| return new Path(root, MANIFEST_PATH); | ||
| } | ||
|
|
||
| public Path indexPath() { | ||
| return new Path(root, INDEX_PATH); | ||
| } | ||
|
|
||
| public Path statisticsPath() { | ||
| return new Path(root, STATISTICS_PATH); | ||
| } | ||
|
|
||
| public Path dataFilePath() { | ||
| if (dataFilePathDirectory != null) { | ||
| return new Path(root, dataFilePathDirectory); | ||
| } | ||
| return root; | ||
| } | ||
|
|
||
| @VisibleForTesting | ||
| public static InternalRowPartitionComputer getPartitionComputer( | ||
| RowType partitionType, String defaultPartValue, boolean legacyPartitionName) { | ||
|
|
@@ -103,25 +133,21 @@ public static InternalRowPartitionComputer getPartitionComputer( | |
| } | ||
|
|
||
| public Path newManifestFile() { | ||
| return new Path( | ||
| root + "/manifest/manifest-" + uuid + "-" + manifestFileCount.getAndIncrement()); | ||
| return toManifestFilePath( | ||
| MANIFEST_PREFIX + uuid + "-" + manifestFileCount.getAndIncrement()); | ||
| } | ||
|
|
||
| public Path newManifestList() { | ||
| return new Path( | ||
| root | ||
| + "/manifest/manifest-list-" | ||
| + uuid | ||
| + "-" | ||
| + manifestListCount.getAndIncrement()); | ||
| return toManifestListPath( | ||
| MANIFEST_LIST_PREFIX + uuid + "-" + manifestListCount.getAndIncrement()); | ||
| } | ||
|
|
||
| public Path toManifestFilePath(String manifestFileName) { | ||
| return new Path(root + "/manifest/" + manifestFileName); | ||
| return new Path(manifestPath(), manifestFileName); | ||
| } | ||
|
|
||
| public Path toManifestListPath(String manifestListName) { | ||
| return new Path(root + "/manifest/" + manifestListName); | ||
| return new Path(manifestPath(), manifestListName); | ||
| } | ||
|
|
||
| public DataFilePathFactory createDataFilePathFactory(BinaryRow partition, int bucket) { | ||
|
|
@@ -217,17 +243,13 @@ public PathFactory indexManifestFileFactory() { | |
| return new PathFactory() { | ||
| @Override | ||
| public Path newPath() { | ||
| return new Path( | ||
| root | ||
| + "/manifest/index-manifest-" | ||
| + uuid | ||
| + "-" | ||
| + indexManifestCount.getAndIncrement()); | ||
| return toPath( | ||
| INDEX_MANIFEST_PREFIX + uuid + "-" + indexManifestCount.getAndIncrement()); | ||
| } | ||
|
|
||
| @Override | ||
| public Path toPath(String fileName) { | ||
| return new Path(root + "/manifest/" + fileName); | ||
| return new Path(manifestPath(), fileName); | ||
| } | ||
| }; | ||
| } | ||
|
|
@@ -236,13 +258,12 @@ public PathFactory indexFileFactory() { | |
| return new PathFactory() { | ||
| @Override | ||
| public Path newPath() { | ||
| return new Path( | ||
| root + "/index/index-" + uuid + "-" + indexFileCount.getAndIncrement()); | ||
| return toPath(INDEX_PREFIX + uuid + "-" + indexFileCount.getAndIncrement()); | ||
| } | ||
|
|
||
| @Override | ||
| public Path toPath(String fileName) { | ||
| return new Path(root + "/index/" + fileName); | ||
| return new Path(indexPath(), fileName); | ||
| } | ||
| }; | ||
| } | ||
|
|
@@ -251,17 +272,12 @@ public PathFactory statsFileFactory() { | |
| return new PathFactory() { | ||
| @Override | ||
| public Path newPath() { | ||
| return new Path( | ||
| root | ||
| + "/statistics/stats-" | ||
| + uuid | ||
| + "-" | ||
| + statsFileCount.getAndIncrement()); | ||
| return toPath(STATISTICS_PREFIX + uuid + "-" + statsFileCount.getAndIncrement()); | ||
| } | ||
|
|
||
| @Override | ||
| public Path toPath(String fileName) { | ||
| return new Path(root + "/statistics/" + fileName); | ||
| return new Path(statisticsPath(), fileName); | ||
| } | ||
| }; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Fix? Could you provide a detailed description of the bug?
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.
See line 263, pathFactory.dataFilePath()