HDFS-16326. Simplify the code for DiskBalancer (#3663)

Reviewed-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
litao 2021-11-19 10:37:10 +08:00 committed by GitHub
parent 0c1eb0125b
commit 965e3874e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -808,7 +808,7 @@ private boolean isLessThanNeeded(long blockSize,
long bytesToCopy = item.getBytesToCopy() - item.getBytesCopied();
bytesToCopy = bytesToCopy +
((bytesToCopy * getBlockTolerancePercentage(item)) / 100);
return (blockSize <= bytesToCopy) ? true : false;
return blockSize <= bytesToCopy;
}
/**
@ -833,7 +833,7 @@ private long getBlockTolerancePercentage(DiskBalancerWorkItem item) {
private boolean isCloseEnough(DiskBalancerWorkItem item) {
long temp = item.getBytesCopied() +
((item.getBytesCopied() * getBlockTolerancePercentage(item)) / 100);
return (item.getBytesToCopy() >= temp) ? false : true;
return item.getBytesToCopy() < temp;
}
/**