From fef99bcae08372fd3267408fdf9a2686119b2b4e Mon Sep 17 00:00:00 2001 From: Arpit Agarwal Date: Mon, 22 Feb 2016 11:34:09 -0800 Subject: [PATCH] HDFS-9842. dfs.datanode.balance.bandwidthPerSec should accept friendly size units. (Contributed by Lin Yiqun) --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/hdfs/server/datanode/DataXceiverServer.java | 2 +- .../hadoop-hdfs/src/main/resources/hdfs-default.xml | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 237e0a444fa..486bccbfd1a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1880,6 +1880,9 @@ Release 2.8.0 - UNRELEASED HDFS-7452. skip StandbyException log for getCorruptFiles() (Bramha Reddy Battula via vinayakumarb) + HDFS-9842. dfs.datanode.balance.bandwidthPerSec should accept friendly + size units. (Lin Yiqun via Arpit Agarwal) + Release 2.7.3 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java index 36cf8a18077..8152e6ffb0e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java @@ -131,7 +131,7 @@ class DataXceiverServer implements Runnable { //set up parameter for cluster balancing this.balanceThrottler = new BlockBalanceThrottler( - conf.getLong(DFSConfigKeys.DFS_DATANODE_BALANCE_BANDWIDTHPERSEC_KEY, + conf.getLongBytes(DFSConfigKeys.DFS_DATANODE_BALANCE_BANDWIDTHPERSEC_KEY, DFSConfigKeys.DFS_DATANODE_BALANCE_BANDWIDTHPERSEC_DEFAULT), conf.getInt(DFSConfigKeys.DFS_DATANODE_BALANCE_MAX_NUM_CONCURRENT_MOVES_KEY, DFSConfigKeys.DFS_DATANODE_BALANCE_MAX_NUM_CONCURRENT_MOVES_DEFAULT)); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml index 32a771150d4..a250eb19410 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml @@ -815,7 +815,11 @@ Specifies the maximum amount of bandwidth that each datanode can utilize for the balancing purpose in term of - the number of bytes per second. + the number of bytes per second. You can use the following + suffix (case insensitive): + k(kilo), m(mega), g(giga), t(tera), p(peta), e(exa)to specify the size + (such as 128k, 512m, 1g, etc.). + Or provide complete size in bytes (such as 134217728 for 128 MB).