KYLIN-2430 Get exitCode form FsShell.run in BulkLoadJob
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/7b860adb Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/7b860adb Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/7b860adb Branch: refs/heads/KYLIN-2428 Commit: 7b860adb0a23b53d6e2e40337f4317a3a2b067ba Parents: eee9ecb Author: kangkaisen <kangkai...@163.com> Authored: Tue Feb 7 17:35:48 2017 +0800 Committer: kangkaisen <kangkai...@163.com> Committed: Tue Feb 7 17:40:39 2017 +0800 ---------------------------------------------------------------------- .../kylin/storage/hbase/steps/BulkLoadJob.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/7b860adb/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/steps/BulkLoadJob.java ---------------------------------------------------------------------- diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/steps/BulkLoadJob.java b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/steps/BulkLoadJob.java index 1c05767..30616c5 100644 --- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/steps/BulkLoadJob.java +++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/steps/BulkLoadJob.java @@ -55,11 +55,18 @@ public class BulkLoadJob extends AbstractHadoopJob { Configuration conf = HBaseConnection.getCurrentHBaseConfiguration(); FsShell shell = new FsShell(conf); - try { - shell.run(new String[] { "-chmod", "-R", "777", input }); - } catch (Exception e) { - logger.error("Couldn't change the file permissions ", e); - throw new IOException(e); + + int exitCode = -1; + int retryCount = 10; + while (exitCode != 0 && retryCount >= 1) { + exitCode = shell.run(new String[] { "-chmod", "-R", "777", input }); + retryCount--; + Thread.sleep(5000); + } + + if (exitCode != 0) { + logger.error("Failed to change the file permissions: " + input); + throw new IOException("Failed to change the file permissions: " + input); } String[] newArgs = new String[2];