-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
HADOOP-18801. Delete path directly when it can not be parsed in trash. #5744
Conversation
befcfea
to
aec9e59
Compare
aec9e59
to
078150c
Compare
@Hexiaoqiao @ayushtkn Hi, Sir, could you please help me to review this PR if you have bandwidth? Thanks a lot. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
fix checkstyle warning. |
🎊 +1 overall
This message was automatically generated. |
@hfutatzhanghb Thanks to involve me here. I am not sure if you could solve the issue as HDFS-17046 mentioned. I think we should choose one of the following ways, |
@Hexiaoqiao , Sir, thanks a lot for your suggestions. Agree with the second approach and I will fix it soonly. Thanks again. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
87479ab
to
54c9366
Compare
🎊 +1 overall
This message was automatically generated. |
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.
Thanks @hfutatzhanghb for your works. leave some comments inline. JFYI. Please let me know if something I missed.
LOG.warn("Unexpected item in trash: "+dir+". Ignoring."); | ||
continue; | ||
if (cleanNonCheckpointUnderTrashRoot) { | ||
this.moveToTrash(path, true); |
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 move to trash again since it has been already under Trash home AND has configed to clean? IMO, it is safe to delete them directly.
*/ | ||
public abstract boolean moveToTrash(Path path) throws IOException; | ||
*/ | ||
public abstract boolean moveToTrash(Path path, boolean force) throws IOException; |
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.
Sorry I don't get meaning of the new parameter boolean force
.
* @throws Exception | ||
*/ | ||
@Test | ||
public void testTrashEmptierWithNonCheckpointDir() throws Exception { |
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.
This new unit test seems not cover the case you try to fix, right? It could pass with/without this improvement.
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.
For this unit test, IMO, we should enable this config and then mkdir one path under Trash home directly, then wait to clean by Emptier. JFYI.
🎊 +1 overall
This message was automatically generated. |
@Hexiaoqiao Sir, could you please take a look at this PR when you have free time? Thanks a lot. |
💔 -1 overall
This message was automatically generated. |
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.
Leave some comments inline. FYI.
continue; | ||
if (cleanNonCheckpointUnderTrashRoot) { | ||
fs.delete(path, true); | ||
LOG.warn("Unexpected item in trash: " + dir + ". Force moving to trash."); |
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.
Force moving to trash. -> Force to delete it.
@@ -579,6 +579,7 @@ public void testExistingFileTrash() throws IOException { | |||
conf.setClass("fs.file.impl", TestLFS.class, FileSystem.class); | |||
FileSystem fs = FileSystem.getLocal(conf); | |||
conf.set("fs.defaultFS", fs.getUri().toString()); | |||
conf.setBoolean(FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY, true); |
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 do not think we need to update this configuration item here. (L582,L639,L649, etc)
* @throws Exception | ||
*/ | ||
@Test | ||
public void testTrashEmptierWithNonCheckpointDir() throws Exception { |
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.
For this unit test, IMO, we should enable this config and then mkdir one path under Trash home directly, then wait to clean by Emptier. JFYI.
} | ||
assertTrue(val == 0); | ||
} | ||
Thread.sleep(18000); |
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.
Please try to use GenericTestUtils.waitFor
rather than Thread.sleep
.
e6a59b1
to
1bf64b2
Compare
1bf64b2
to
dcf58a7
Compare
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
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.
LGTM. +1. Let's wait if @ayushtkn will give furthermore comments before checkin.
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.
Minor nits. rest LGTM
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java
Outdated
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicyDefault.java
Outdated
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/main/resources/core-default.xml
Outdated
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
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.
LGTM.
Thanx @Hexiaoqiao for holding, nothing more from my side, can be pushed :-)
Committed to trunk. Thanks @hfutatzhanghb for your contribution and @ayushtkn for your reviews! |
@Hexiaoqiao @ayushtkn Thanks sir for reviewing and merging. |
apache#5744). Contributed by farmmamba. Signed-off-by: Ayush Saxena <ayushsaxena@apache.org> Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
Description of PR
Please see HADOOP-18801.
How was this patch tested?
Add an UT.