HDFS-16496. Snapshot diff on snapshotable directory fails with not snapshottable error (#4051)
This commit is contained in:
parent
66b72406bd
commit
49e4e4d0a5
@ -391,8 +391,8 @@ public class SnapshotManager implements SnapshotStatsMXBean {
|
|||||||
final INodesInPath iip) throws IOException {
|
final INodesInPath iip) throws IOException {
|
||||||
final INodeDirectory dir = getSnapshottableAncestorDir(iip);
|
final INodeDirectory dir = getSnapshottableAncestorDir(iip);
|
||||||
if (dir == null) {
|
if (dir == null) {
|
||||||
throw new SnapshotException("Directory is neither snapshottable nor" +
|
throw new SnapshotException("The path " + iip.getPath()
|
||||||
" under a snap root!");
|
+ " is neither snapshottable nor under a snapshot root!");
|
||||||
}
|
}
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ public class SnapshotManager implements SnapshotStatsMXBean {
|
|||||||
final String path = iip.getPath();
|
final String path = iip.getPath();
|
||||||
final INode inode = iip.getLastINode();
|
final INode inode = iip.getLastINode();
|
||||||
final INodeDirectory dir;
|
final INodeDirectory dir;
|
||||||
if (inode instanceof INodeDirectory) {
|
if (inode != null && inode.isDirectory()) {
|
||||||
dir = INodeDirectory.valueOf(inode, path);
|
dir = INodeDirectory.valueOf(inode, path);
|
||||||
} else {
|
} else {
|
||||||
dir = INodeDirectory.valueOf(iip.getINode(-2), iip.getParentPath());
|
dir = INodeDirectory.valueOf(iip.getINode(-2), iip.getParentPath());
|
||||||
|
@ -345,7 +345,8 @@ public class TestSnapshotDiffReport {
|
|||||||
+ nonSnapDir.getName() + "'should fail!");
|
+ nonSnapDir.getName() + "'should fail!");
|
||||||
} catch (SnapshotException e) {
|
} catch (SnapshotException e) {
|
||||||
GenericTestUtils.assertExceptionContains(
|
GenericTestUtils.assertExceptionContains(
|
||||||
"Directory is neither snapshottable nor under a snap root!", e);
|
"The path " + nonSnapDir +
|
||||||
|
" is neither snapshottable nor under a snapshot root!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String invalidName = "invalid";
|
final String invalidName = "invalid";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user