Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ public void setup() throws IOException {

Mockito.when(containerManager.getContainers()).thenAnswer(
invocation -> new ArrayList<>(containerInfoSet));

replicationManager = createReplicationManager();
containerReplicaMap = new HashMap<>();
containerInfoSet = new HashSet<>();
Expand Down Expand Up @@ -502,6 +501,34 @@ public void testUnderReplicatedAndUnrecoverable()
ReplicationManagerReport.HealthState.MISSING));
}

@Test
public void testUnrecoverableAndEmpty()
throws ContainerNotFoundException {
ContainerInfo container = createContainerInfo(repConfig, 1,
HddsProtos.LifeCycleState.CLOSED);

ContainerReplica replica = createContainerReplica(container.containerID(),
1, IN_SERVICE, ContainerReplicaProto.State.CLOSED,
0, 0, MockDatanodeDetails.randomDatanodeDetails(), UUID.randomUUID());

storeContainerAndReplicas(container, Collections.singleton(replica));

replicationManager.processContainer(container, repQueue, repReport);
// If it is unrecoverable, there is no point in putting it into the under
// replication list. It will be checked again on the next RM run.
Assert.assertEquals(0, repQueue.underReplicatedQueueSize());
Assert.assertEquals(0, repQueue.overReplicatedQueueSize());
Assert.assertEquals(0, repReport.getStat(
ReplicationManagerReport.HealthState.UNDER_REPLICATED));
Assert.assertEquals(0, repReport.getStat(
ReplicationManagerReport.HealthState.MISSING));
// As it is marked empty in the report, it must have gone through the
// empty container handler, indicating is was handled as empty.
Assert.assertEquals(1, repReport.getStat(
ReplicationManagerReport.HealthState.EMPTY));
}


/**
* A closed EC container with 3 closed and 2 unhealthy replicas is under
* replicated. RM should add it to under replicated queue.
Expand Down