You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2016/07/20 16:48:53 UTC
[1/2] ambari git commit: AMBARI-17816 Rebalance HDFS failed with
"float division by zero" (dlysnichenko)
Repository: ambari
Updated Branches:
refs/heads/branch-2.4 0b29e1f09 -> 3e636b5cf
refs/heads/trunk c65169a0b -> bb1b16910
AMBARI-17816 Rebalance HDFS failed with "float division by zero" (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bb1b1691
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bb1b1691
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bb1b1691
Branch: refs/heads/trunk
Commit: bb1b16910f77d65087f6b108355d159f857d255e
Parents: c65169a
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Wed Jul 20 19:47:53 2016 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Wed Jul 20 19:47:53 2016 +0300
----------------------------------------------------------------------
.../HDFS/2.1.0.2.0/package/scripts/namenode.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/bb1b1691/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
index df02311..f6a427c 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
@@ -303,7 +303,13 @@ class NameNodeDefault(NameNode):
Execute(kinit_cmd, user=params.hdfs_user)
def calculateCompletePercent(first, current):
- return 1.0 - current.bytesLeftToMove/first.bytesLeftToMove
+ # avoid division by zero
+ try:
+ division_result = current.bytesLeftToMove/first.bytesLeftToMove
+ except ZeroDivisionError:
+ Logger.warning("Division by zero. Bytes Left To Move = {0}. Return 1.0".format(first.bytesLeftToMove))
+ return 1.0
+ return 1.0 - division_result
def startRebalancingProcess(threshold, rebalance_env):
@@ -324,7 +330,7 @@ class NameNodeDefault(NameNode):
def handle_new_line(line, is_stderr):
if is_stderr:
return
-
+
_print('[balancer] %s' % (line))
pl = parser.parseLine(line)
if pl:
[2/2] ambari git commit: AMBARI-17816 Rebalance HDFS failed with
"float division by zero" (dlysnichenko)
Posted by dm...@apache.org.
AMBARI-17816 Rebalance HDFS failed with "float division by zero" (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3e636b5c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3e636b5c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3e636b5c
Branch: refs/heads/branch-2.4
Commit: 3e636b5cf081485ee9ea8b6a2a1767bfa030d177
Parents: 0b29e1f
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Wed Jul 20 19:47:53 2016 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Wed Jul 20 19:48:28 2016 +0300
----------------------------------------------------------------------
.../HDFS/2.1.0.2.0/package/scripts/namenode.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/3e636b5c/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
index b37f413..17d8107 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
@@ -303,7 +303,13 @@ class NameNodeDefault(NameNode):
Execute(kinit_cmd, user=params.hdfs_user)
def calculateCompletePercent(first, current):
- return 1.0 - current.bytesLeftToMove/first.bytesLeftToMove
+ # avoid division by zero
+ try:
+ division_result = current.bytesLeftToMove/first.bytesLeftToMove
+ except ZeroDivisionError:
+ Logger.warning("Division by zero. Bytes Left To Move = {0}. Return 1.0".format(first.bytesLeftToMove))
+ return 1.0
+ return 1.0 - division_result
def startRebalancingProcess(threshold, rebalance_env):
@@ -324,7 +330,7 @@ class NameNodeDefault(NameNode):
def handle_new_line(line, is_stderr):
if is_stderr:
return
-
+
_print('[balancer] %s' % (line))
pl = parser.parseLine(line)
if pl: