HDFS-14125. Use parameterized log format in ECTopologyVerifier. Contributed by Kitti Nanasi.

Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org>
(cherry picked from commit 5f15a60e32)
This commit is contained in:
Kitti Nanasi 2019-02-04 14:51:17 -08:00 committed by Ayush Saxena
parent 0dbcb81a41
commit 3ba40d0ccf
1 changed files with 9 additions and 9 deletions

View File

@ -93,24 +93,24 @@ public final class ECTopologyVerifier {
final int numOfRacks, final int numOfDataNodes, String readablePolicies) { final int numOfRacks, final int numOfDataNodes, String readablePolicies) {
String resultMessage; String resultMessage;
if (numOfDataNodes < minDN) { if (numOfDataNodes < minDN) {
resultMessage = "The number of DataNodes (" + numOfDataNodes resultMessage = String.format("The number of DataNodes (%d) is less " +
+ ") is less than the minimum required number of DataNodes (" "than the minimum required number of DataNodes (%d) for the " +
+ minDN + ") for the erasure coding policies: " + readablePolicies; "erasure coding policies: %s", numOfDataNodes, minDN,
readablePolicies);
LOG.debug(resultMessage); LOG.debug(resultMessage);
return new ECTopologyVerifierResult(false, resultMessage); return new ECTopologyVerifierResult(false, resultMessage);
} }
if (numOfRacks < minRack) { if (numOfRacks < minRack) {
resultMessage = "The number of racks (" + numOfRacks resultMessage = String.format("The number of racks (%d) is less than " +
+ ") is less than the minimum required number of racks (" "the minimum required number of racks (%d) for the erasure " +
+ minRack + ") for the erasure coding policies: " "coding policies: %s", numOfRacks, minRack, readablePolicies);
+ readablePolicies;
LOG.debug(resultMessage); LOG.debug(resultMessage);
return new ECTopologyVerifierResult(false, resultMessage); return new ECTopologyVerifierResult(false, resultMessage);
} }
return new ECTopologyVerifierResult(true, return new ECTopologyVerifierResult(true,
"The cluster setup can support EC policies: " String.format("The cluster setup can support EC policies: %s",
+ readablePolicies); readablePolicies));
} }
private static int getNumberOfRacks(DatanodeInfo[] report) { private static int getNumberOfRacks(DatanodeInfo[] report) {