-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HDFS-14925. Rename operation should check nest snapshot #1670
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
Conversation
@manojpec, please help to review this patch :) |
@bshashikant could you help review this PR? |
💔 -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.
Overall looks good. Requested a small change inline.
...-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java
Outdated
Show resolved
Hide resolved
This patch misses considering dir to dir overwrite scenario, will modify and push later, thx. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
TestRenameWithSnapshots is unrelated, due to HDFS-14910, but please check TestRandomOpsWithSnapshots |
@jojochuang can you pls tell me how can I run the unittest locally, I see the jenkins job runs
but I couldn't run this on my centos server |
If you have editors like IntelliJ, you can run any of the tests. Double check for the failed tests. Sometimes they are flaky tests and we are okay to +1 if they don't reproduce all the time. |
If the src directory or any of its descendant is snapshottable and the dst directory or any of its ancestors is snapshottable, we consider this as nested snapshot, which should be denied. V2: 1. reduce duplicate code 2. take `directory rename overwrite` into consideration V3: 1. fix unit test fail Signed-off-by: Zhao Junwang <zhjwpku@gmail.com>
💔 -1 overall
This message was automatically generated. |
@jojochuang I didn't get TestRollingUpgrade failed when I run it locally. Can you pls help to check is it a flaky test? Following it error message:
|
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.
Add test please?
...-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java
Outdated
Show resolved
Hide resolved
...doop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/SnapshotManager.java
Show resolved
Hide resolved
...-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Zhao Junwang <zhjwpku@gmail.com>
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Signed-off-by: Zhao Junwang <zhjwpku@gmail.com>
🎊 +1 overall
This message was automatically generated. |
@jojochuang @dineshchitlangia finally hadoop-yetus report |
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 for the patch. I think it's almost good with a nit.
Our tests are flaky all the time so don't expect it to +1 for you. As long as the flaky tests don't reproduce consistently I am okay.
...s/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestRenameWithSnapshots.java
Show resolved
Hide resolved
* src) which do not have snapshots yet. If this list is not empty, that | ||
* means rename src has snapshottable descendant directories. | ||
*/ | ||
if (snapshottableDirs != null && snapshottableDirs.size() > 0) { |
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 was concerned about the case where the source already has a snapshot.
But turns out that case is already handled before this patch with the following exception
The directory /dir1/foo cannot be deleted since /dir1/foo is snapshottable and already has snapshots at org.apache.hadoop.hdfs.server.namenode.FSDirSnapshotOp.checkSnapshot(FSDirSnapshotOp.java:297)
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.
Yes, that's it ;)
Signed-off-by: Zhao Junwang <zhjwpku@gmail.com>
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 pending Jenkins
💔 -1 overall
This message was automatically generated. |
The changes look good to me as well. +1 |
Thanks @bshashikant for review and @zhjwpku for the patch! |
If the src directory or any of its descendant is snapshottable and the dst directory or any of its ancestors is snapshottable, we consider this as nested snapshot, which should be denied. Reviewed-by: Shashikant Banerjee <shashikant@apache.org> (cherry picked from commit de6b8b0) (cherry picked from commit c9fc118)
If the src directory or any of its descendant is snapshottable and the dst directory or any of its ancestors is snapshottable, we consider this as nested snapshot, which should be denied. Reviewed-by: Shashikant Banerjee <shashikant@apache.org> (cherry picked from commit de6b8b0)
If the src directory or any of its descendant is snapshottable and the dst directory or any of its ancestors is snapshottable, we consider this as nested snapshot, which should be denied. Reviewed-by: Shashikant Banerjee <shashikant@apache.org>
If the src directory or any of its descendant is snapshottable and the dst directory or any of its ancestors is snapshottable, we consider this as nested snapshot, which should be denied. Reviewed-by: Shashikant Banerjee <shashikant@apache.org> (cherry picked from commit de6b8b0) (cherry picked from commit c9fc118)
If the src directory or any of its descendant is snapshottable and the dst directory or any of its ancestors is snapshottable, we consider this as nested snapshot, which should be denied. Reviewed-by: Shashikant Banerjee <shashikant@apache.org> (cherry picked from commit de6b8b0) (cherry picked from commit c9fc118)
If the src directory or any of its descendant is snapshottable and the dst directory or any of its ancestors is snapshottable, we consider this as nested snapshot, which should be denied. Reviewed-by: Shashikant Banerjee <shashikant@apache.org> (cherry picked from commit de6b8b0) (cherry picked from commit c9fc118) (cherry picked from commit cda8b2a) Change-Id: I5f3b2ee646e5ac29836b589fa317f72f2c023a11
When we do rename operation for directory,
if the src directory or any of its descendant is snapshottable
and the dst directory or its any of its ancestors is snapshottable,
we consider this as nested snapshot, which should be denied.
V2:
1. reduce duplicate code
2. take
directory rename overwrite
into considerationSigned-off-by: Zhao Junwang zhjwpku@gmail.com