HDFS-15438. Setting dfs.disk.balancer.max.disk.errors = 0 will fail the block copy. Contributed by AMC-team.
(cherry picked from commit 2377df38ad
)
This commit is contained in:
parent
8354ce680b
commit
30a1b17b22
|
@ -902,7 +902,7 @@ public class DiskBalancer {
|
|||
*/
|
||||
private ExtendedBlock getBlockToCopy(FsVolumeSpi.BlockIterator iter,
|
||||
DiskBalancerWorkItem item) {
|
||||
while (!iter.atEnd() && item.getErrorCount() < getMaxError(item)) {
|
||||
while (!iter.atEnd() && item.getErrorCount() <= getMaxError(item)) {
|
||||
try {
|
||||
ExtendedBlock block = iter.nextBlock();
|
||||
if(null == block){
|
||||
|
@ -923,7 +923,7 @@ public class DiskBalancer {
|
|||
item.incErrorCount();
|
||||
}
|
||||
}
|
||||
if (item.getErrorCount() >= getMaxError(item)) {
|
||||
if (item.getErrorCount() > getMaxError(item)) {
|
||||
item.setErrMsg("Error count exceeded.");
|
||||
LOG.info("Maximum error count exceeded. Error count: {} Max error:{} ",
|
||||
item.getErrorCount(), item.getMaxDiskErrors());
|
||||
|
|
|
@ -758,7 +758,7 @@ public class TestDiskBalancer {
|
|||
}
|
||||
}, 1000, 100000);
|
||||
|
||||
assertTrue("Disk balancer operation hit max errors!", errorCount.get() <
|
||||
assertTrue("Disk balancer operation hit max errors!", errorCount.get() <=
|
||||
DFSConfigKeys.DFS_DISK_BALANCER_MAX_DISK_ERRORS_DEFAULT);
|
||||
createWorkPlanLatch.await();
|
||||
removeDiskLatch.await();
|
||||
|
|
Loading…
Reference in New Issue