HDFS-16326. Simplify the code for DiskBalancer (#3663)
Reviewed-by: Viraj Jasani <vjasani@apache.org>
(cherry picked from commit 965e3874e9
)
This commit is contained in:
parent
8166bcc668
commit
166c38bcbf
@ -808,7 +808,7 @@ private boolean isLessThanNeeded(long blockSize,
|
|||||||
long bytesToCopy = item.getBytesToCopy() - item.getBytesCopied();
|
long bytesToCopy = item.getBytesToCopy() - item.getBytesCopied();
|
||||||
bytesToCopy = bytesToCopy +
|
bytesToCopy = bytesToCopy +
|
||||||
((bytesToCopy * getBlockTolerancePercentage(item)) / 100);
|
((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) {
|
private boolean isCloseEnough(DiskBalancerWorkItem item) {
|
||||||
long temp = item.getBytesCopied() +
|
long temp = item.getBytesCopied() +
|
||||||
((item.getBytesCopied() * getBlockTolerancePercentage(item)) / 100);
|
((item.getBytesCopied() * getBlockTolerancePercentage(item)) / 100);
|
||||||
return (item.getBytesToCopy() >= temp) ? false : true;
|
return item.getBytesToCopy() < temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user