HDFS-15347. Replace the deprecated method shaHex. Contributed by bianqi.
This commit is contained in:
parent
c784ba370e
commit
cb64e993c2
@ -399,7 +399,7 @@ private NodePlan verifyPlanHash(String planID, String plan)
|
||||
|
||||
if ((planID == null) ||
|
||||
(planID.length() != sha1Length) ||
|
||||
!DigestUtils.shaHex(plan.getBytes(Charset.forName("UTF-8")))
|
||||
!DigestUtils.sha1Hex(plan.getBytes(Charset.forName("UTF-8")))
|
||||
.equalsIgnoreCase(planID)) {
|
||||
LOG.error("Disk Balancer - Invalid plan hash.");
|
||||
throw new DiskBalancerException("Invalid or mis-matched hash.",
|
||||
|
@ -94,7 +94,7 @@ private void cancelPlan(String planData) throws IOException {
|
||||
String dataNodeAddress = plan.getNodeName() + ":" + plan.getPort();
|
||||
Preconditions.checkNotNull(dataNodeAddress);
|
||||
ClientDatanodeProtocol dataNode = getDataNodeProxy(dataNodeAddress);
|
||||
String planHash = DigestUtils.shaHex(planData);
|
||||
String planHash = DigestUtils.sha1Hex(planData);
|
||||
try {
|
||||
dataNode.cancelDiskBalancePlan(planHash);
|
||||
} catch (DiskBalancerException ex) {
|
||||
|
@ -99,7 +99,7 @@ private void submitPlan(final String planFile, final String planData,
|
||||
String dataNodeAddress = plan.getNodeName() + ":" + plan.getPort();
|
||||
Preconditions.checkNotNull(dataNodeAddress);
|
||||
ClientDatanodeProtocol dataNode = getDataNodeProxy(dataNodeAddress);
|
||||
String planHash = DigestUtils.shaHex(planData);
|
||||
String planHash = DigestUtils.sha1Hex(planData);
|
||||
try {
|
||||
dataNode.submitDiskBalancerPlan(planHash, DiskBalancerCLI.PLAN_VERSION,
|
||||
planFile, planData, skipDateCheck);
|
||||
|
@ -642,7 +642,7 @@ public void executePlan(NodePlan plan) throws
|
||||
|
||||
node = cluster.getDataNodes().get(dataNodeIndex);
|
||||
String planJson = plan.toJson();
|
||||
String planID = DigestUtils.shaHex(planJson);
|
||||
String planID = DigestUtils.sha1Hex(planJson);
|
||||
|
||||
// Submit the plan and wait till the execution is done.
|
||||
node.submitDiskBalancerPlan(planID, 1, PLAN_FILE, planJson,
|
||||
@ -740,7 +740,7 @@ public void run() {
|
||||
reconfigThread.start();
|
||||
|
||||
String planJson = plan.toJson();
|
||||
String planID = DigestUtils.shaHex(planJson);
|
||||
String planID = DigestUtils.sha1Hex(planJson);
|
||||
diskBalancer.submitPlan(planID, 1, PLAN_FILE, planJson, false);
|
||||
|
||||
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
||||
|
@ -317,7 +317,7 @@ public RpcTestHelper invoke() throws Exception {
|
||||
plan = new NodePlan(node.getDataNodeName(), node.getDataNodePort());
|
||||
planner.balanceVolumeSet(node, node.getVolumeSets().get("DISK"), plan);
|
||||
planVersion = 1;
|
||||
planHash = DigestUtils.shaHex(plan.toJson());
|
||||
planHash = DigestUtils.sha1Hex(plan.toJson());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public void testDiskBalancerEnabled() throws DiskBalancerException {
|
||||
private void executeSubmitPlan(NodePlan plan, DiskBalancer balancer,
|
||||
int version) throws IOException {
|
||||
String planJson = plan.toJson();
|
||||
String planID = DigestUtils.shaHex(planJson);
|
||||
String planID = DigestUtils.sha1Hex(planJson);
|
||||
balancer.submitPlan(planID, version, PLAN_FILE, planJson, false);
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ public void testSubmitWithNullPlan() throws Exception {
|
||||
NodePlan plan = mockMoverHelper.getPlan();
|
||||
DiskBalancer balancer = mockMoverHelper.getBalancer();
|
||||
String planJson = plan.toJson();
|
||||
String planID = DigestUtils.shaHex(planJson);
|
||||
String planID = DigestUtils.sha1Hex(planJson);
|
||||
|
||||
thrown.expect(DiskBalancerException.class);
|
||||
thrown.expect(new DiskBalancerResultVerifier(DiskBalancerException
|
||||
@ -232,7 +232,7 @@ public void testSubmitWithInvalidHash() throws Exception {
|
||||
|
||||
|
||||
String planJson = plan.toJson();
|
||||
String planID = DigestUtils.shaHex(planJson);
|
||||
String planID = DigestUtils.sha1Hex(planJson);
|
||||
char repChar = planID.charAt(0);
|
||||
repChar++;
|
||||
|
||||
@ -262,7 +262,7 @@ public void testCancelDiskBalancerPlan() throws Exception {
|
||||
|
||||
|
||||
String planJson = plan.toJson();
|
||||
String planID = DigestUtils.shaHex(planJson);
|
||||
String planID = DigestUtils.sha1Hex(planJson);
|
||||
balancer.cancelPlan(planID);
|
||||
|
||||
DiskBalancerWorkStatus status = balancer.queryWorkStatus();
|
||||
|
Loading…
Reference in New Issue
Block a user