From b1525ed85e36819ffa3f45698d19b7035302ffda Mon Sep 17 00:00:00 2001 From: chaiwentao Date: Fri, 5 Apr 2019 23:56:00 +0800 Subject: [PATCH] HBASE-22070 Checking restoreDir in RestoreSnapshotHelper Signed-off-by: Peter Somogyi --- .../org/apache/hadoop/hbase/snapshot/RestoreSnapshotHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotHelper.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotHelper.java index ec251b86966..f533af4a7e5 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotHelper.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotHelper.java @@ -829,7 +829,7 @@ public class RestoreSnapshotHelper { throw new IllegalArgumentException("Filesystems for restore directory and HBase root " + "directory should be the same"); } - if (restoreDir.toUri().getPath().startsWith(rootDir.toUri().getPath())) { + if (restoreDir.toUri().getPath().startsWith(rootDir.toUri().getPath() +"/")) { throw new IllegalArgumentException("Restore directory cannot be a sub directory of HBase " + "root directory. RootDir: " + rootDir + ", restoreDir: " + restoreDir); }