Skip to content

Commit 9ca81e1

Browse files
authored
1 parent 95db466 commit 9ca81e1

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeResourceChecker.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535

3636
import org.apache.hadoop.classification.VisibleForTesting;
3737

38-
import com.google.common.base.Preconditions;
39-
4038
/**
4139
*
4240
* NameNodeResourceChecker provides a method -
@@ -176,11 +174,12 @@ private void addDirToCheck(URI directoryToCheck, boolean required)
176174
* otherwise.
177175
*/
178176
public boolean hasAvailableDiskSpace() {
179-
Preconditions.checkArgument(minimumRedundantVolumes <= volumes.size(),
180-
"The setting for " + DFSConfigKeys.DFS_NAMENODE_CHECKED_VOLUMES_MINIMUM_KEY +
181-
" is " + minimumRedundantVolumes +
182-
" which is less than the total number of existing storage volumes " + volumes.size() +
183-
" and will result in adding resources and still not being able to turn off safe mode.");
177+
if (minimumRedundantVolumes > volumes.size()){
178+
throw new IllegalArgumentException(DFSConfigKeys.DFS_NAMENODE_CHECKED_VOLUMES_MINIMUM_KEY +
179+
" is " + minimumRedundantVolumes +
180+
" which is greater than the total number of existing storage volumes " + volumes.size() +
181+
" and will result in adding resources and still not being able to turn off safe mode.");
182+
}
184183
return NameNodeResourcePolicy.areResourcesAvailable(volumes.values(),
185184
minimumRedundantVolumes);
186185
}

0 commit comments

Comments
 (0)