You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by nj...@apache.org on 2016/07/20 02:54:41 UTC
kylin git commit: KYLIN-1889: Deal with the failure of renaming
folder in hdfs when running the tool CubeMigrationCLI
Repository: kylin
Updated Branches:
refs/heads/master 1cd4ad8c1 -> 819e660ee
KYLIN-1889: Deal with the failure of renaming folder in hdfs when running the tool CubeMigrationCLI
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/819e660e
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/819e660e
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/819e660e
Branch: refs/heads/master
Commit: 819e660ee17361db92c20bfd28068a308334c7a7
Parents: 1cd4ad8
Author: Zhong <ya...@lm-shc-16501214.corp.ebay.com>
Authored: Wed Jul 20 10:48:21 2016 +0800
Committer: Zhong <ya...@lm-shc-16501214.corp.ebay.com>
Committed: Wed Jul 20 10:48:21 2016 +0800
----------------------------------------------------------------------
.../kylin/storage/hbase/util/CubeMigrationCLI.java | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/819e660e/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/CubeMigrationCLI.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/CubeMigrationCLI.java b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/CubeMigrationCLI.java
index 2fffa52..c4cf579 100644
--- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/CubeMigrationCLI.java
+++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/CubeMigrationCLI.java
@@ -414,7 +414,7 @@ public class CubeMigrationCLI {
case RENAME_FOLDER_IN_HDFS: {
String srcPath = (String) opt.params[0];
String dstPath = (String) opt.params[1];
- hdfsFS.rename(new Path(srcPath), new Path(dstPath));
+ renameHDFSPath(srcPath, dstPath);
logger.info("HDFS Folder renamed from " + srcPath + " to " + dstPath);
break;
}
@@ -516,7 +516,7 @@ public class CubeMigrationCLI {
String dstPath = (String) opt.params[0];
if (hdfsFS.exists(new Path(srcPath)) && !hdfsFS.exists(new Path(dstPath))) {
- hdfsFS.rename(new Path(srcPath), new Path(dstPath));
+ renameHDFSPath(srcPath, dstPath);
logger.info("HDFS Folder renamed from " + srcPath + " to " + dstPath);
}
break;
@@ -563,4 +563,17 @@ public class CubeMigrationCLI {
}
}
}
+
+ private static void renameHDFSPath(String srcPath, String dstPath) throws IOException, InterruptedException {
+ int nRetry = 0;
+ int sleepTime = 5000;
+ while (!hdfsFS.rename(new Path(srcPath), new Path(dstPath))) {
+ ++nRetry;
+ if (nRetry > 3) {
+ throw new InterruptedException("Cannot rename folder " + srcPath + " to folder " + dstPath);
+ } else {
+ Thread.sleep(sleepTime * nRetry * nRetry);
+ }
+ }
+ }
}