HDDS-1850. ReplicationManager should consider inflight replication and deletion while picking datanode for re-replication.

Signed-off-by: Anu Engineer <aengineer@apache.org>
This commit is contained in:
Nanda kumar 2019-07-25 15:07:07 +05:30 committed by Anu Engineer
parent b41ef61ebc
commit 2b1d8aedbb

View File

@ -483,8 +483,14 @@ private void handleUnderReplicatedContainer(final ContainerInfo container,
final int replicationFactor = container
.getReplicationFactor().getNumber();
final int delta = replicationFactor - getReplicaCount(id, replicas);
final List<DatanodeDetails> excludeList = replicas.stream()
.map(ContainerReplica::getDatanodeDetails)
.collect(Collectors.toList());
inflightReplication.get(id).stream().map(r -> r.datanode)
.forEach(excludeList::add);
final List<DatanodeDetails> selectedDatanodes = containerPlacement
.chooseDatanodes(source, null, delta, container.getUsedBytes());
.chooseDatanodes(excludeList, null, delta,
container.getUsedBytes());
LOG.info("Container {} is under replicated. Expected replica count" +
" is {}, but found {}.", id, replicationFactor,