Skip to content
Merged
Show file tree
Hide file tree
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 @@ -177,7 +177,7 @@ private void verifyAllContainerReports(Map<ContainerID, ContainerReplicaProto> r

for (Map.Entry<ContainerID, ContainerReplicaProto> entry: reportsSent.entrySet()) {
ContainerID id = entry.getKey();
assertNotNull(containerSet.getContainer(id.getId()));
assertNotNull(containerSet.getContainer(id.getIdForTesting()));

long sentDataChecksum = entry.getValue().getDataChecksum();
// Current implementation is incomplete, and uses a mocked checksum.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ public static ContainerReplicaProto createContainerReplica(
int replicaIndex) {

return ContainerReplicaProto.newBuilder()
.setContainerID(containerId.getId())
.setContainerID(containerId.getIdForTesting())
.setState(state)
.setOriginNodeId(originNodeId)
.setFinalhash("e16cc9d6024365750ed8dbd194ea46d2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ protected static ContainerReportsProto getContainerReportsProto(
ContainerReportsProto.newBuilder();
final ContainerReplicaProto replicaProto =
ContainerReplicaProto.newBuilder()
.setContainerID(containerId.getId())
.setContainerID(containerId.getIdForTesting())
.setState(state)
.setOriginNodeId(originNodeId)
.setSize(5368709120L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ private DeleteContainerCommand sendReportAndCaptureDeleteCommand(
private void verifyForceDeleteCommand(DeleteContainerCommand deleteCmd,
ContainerID expectedContainerId, boolean expectedForce, String message) {
assertEquals(expectedForce, deleteCmd.isForce(), message);
assertEquals(expectedContainerId.getId(), deleteCmd.getContainerID());
assertEquals(expectedContainerId.getIdForTesting(), deleteCmd.getContainerID());
}

/**
Expand Down Expand Up @@ -413,7 +413,7 @@ public void testReinitializeWithOpenContainerWithoutPipelineID()
throws Exception {
ContainerID containerID = ContainerID.valueOf(3L);
ContainerInfo openContainerInfo = new ContainerInfo.Builder()
.setContainerID(containerID.getId())
.setContainerID(containerID.getIdForTesting())
.setState(HddsProtos.LifeCycleState.OPEN)
.setSequenceId(100L)
.setOwner("scm")
Expand All @@ -439,7 +439,7 @@ public void testSequenceIdOnStateUpdate() throws Exception {
long sequenceId = 100L;

ContainerInfo containerInfo = new ContainerInfo.Builder()
.setContainerID(containerID.getId())
.setContainerID(containerID.getIdForTesting())
.setState(HddsProtos.LifeCycleState.OPEN)
.setSequenceId(sequenceId)
.setOwner("scm")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ public void testWithContainerDataChecksum() throws Exception {
final long bcsId) {
final ContainerReplicaProto.Builder replicaProto =
ContainerReplicaProto.newBuilder()
.setContainerID(containerId.getId())
.setContainerID(containerId.getIdForTesting())
.setState(state)
.setOriginNodeId(originNodeId)
.setSize(5368709120L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private static ContainerReportsProto getContainerReportsProto(
ContainerReportsProto.newBuilder();
final ContainerReplicaProto replicaProto =
ContainerReplicaProto.newBuilder()
.setContainerID(containerId.getId())
.setContainerID(containerId.getIdForTesting())
.setState(state)
.setOriginNodeId(originNodeId)
.setFinalhash("e16cc9d6024365750ed8dbd194ea46d2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public void testReconcileFailsWithIneligibleReplicas(State replicaState) throws

private ContainerInfo addContainer(ReplicationConfig repConfig, LifeCycleState state) throws Exception {
ContainerInfo container = new ContainerInfo.Builder()
.setContainerID(CONTAINER_ID.getId())
.setContainerID(CONTAINER_ID.getIdForTesting())
.setReplicationConfig(repConfig)
.setState(state)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static ContainerReplicaCount generateReplicaCount(
MockDatanodeDetails.randomDatanodeDetails()));
}
ContainerInfo container = new ContainerInfo.Builder()
.setContainerID(containerID.getId())
.setContainerID(containerID.getIdForTesting())
.setState(containerState)
.build();

Expand Down Expand Up @@ -132,7 +132,7 @@ public static ContainerReplicaCount generateECReplicaCount(
t.getRight(), t.getMiddle()));
}
ContainerInfo container = new ContainerInfo.Builder()
.setContainerID(containerID.getId())
.setContainerID(containerID.getIdForTesting())
.setState(containerState)
.setReplicationConfig(repConfig)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public void testDecommissionWaitsForUnhealthyReplicaToReplicateNewRM()
// the container's sequence id is greater than the healthy replicas'
ContainerInfo container = ReplicationTestUtil.createContainerInfo(
RatisReplicationConfig.getInstance(
HddsProtos.ReplicationFactor.THREE), containerID.getId(),
HddsProtos.ReplicationFactor.THREE), containerID.getIdForTesting(),
HddsProtos.LifeCycleState.QUASI_CLOSED,
replicas.iterator().next().getSequenceId() + 1);
// UNHEALTHY replica is on a unique origin and has same sequence id as
Expand Down Expand Up @@ -311,7 +311,7 @@ public void testDecommissionWaitsForUnhealthyReplicaWithUniqueOriginToReplicateN
// create a container and 3 QUASI_CLOSED replicas with containerID 1 and same origin ID
ContainerID containerID = ContainerID.valueOf(1);
ContainerInfo container = ReplicationTestUtil.createContainerInfo(RatisReplicationConfig.getInstance(
HddsProtos.ReplicationFactor.THREE), containerID.getId(), HddsProtos.LifeCycleState.QUASI_CLOSED);
HddsProtos.ReplicationFactor.THREE), containerID.getIdForTesting(), HddsProtos.LifeCycleState.QUASI_CLOSED);
Set<ContainerReplica> replicas =
ReplicationTestUtil.createReplicasWithSameOrigin(containerID, State.QUASI_CLOSED, 0, 0, 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private ContainerInfo createMockContainer(ReplicationConfig rep, String owner) {
private ContainerInfo getMockContainer(ReplicationConfig rep, ContainerID conId) {
ContainerInfo.Builder builder = new ContainerInfo.Builder()
.setReplicationConfig(rep)
.setContainerID(conId.getId())
.setContainerID(conId.getIdForTesting())
.setPipelineID(PipelineID.randomId())
.setState(OPEN)
.setOwner("admin");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ private static boolean assertReportsMatch(UnHealthyContainerStates state) {
List<ContainerID> rmContainerIDs = rmReport.getSample(rmState);
List<Long> rmIDsToLong = new ArrayList<>();
for (ContainerID id : rmContainerIDs) {
rmIDsToLong.add(id.getId());
rmIDsToLong.add(id.getIdForTesting());
}
List<Long> reconContainerIDs =
reconResponse.getContainers()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ public static void prepareData(int[][] ranges) throws Exception {
.map(ContainerInfo::containerID)
.collect(Collectors.toList());
assertEquals(1, containerIDs.size());
containerID = containerIDs.get(0).getId();
containerID = containerIDs.get(0).getIdForTesting();
List<Pipeline> pipelines = scm.getPipelineManager().getPipelines(repConfig);
assertEquals(1, pipelines.size());
pipeline = pipelines.get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void testDeletingOrDeletedContainerWhenNonEmptyReplicaIsReported() throws Except
assertThat(keyLocations).isNotEmpty();
OmKeyLocationInfo keyLocation = keyLocations.get(0);
ContainerID containerID = ContainerID.valueOf(keyLocation.getContainerID());
waitForContainerClose(cluster, containerID.getId());
waitForContainerClose(cluster, containerID.getIdForTesting());

// also wait till the container is closed in SCM
waitForContainerClosedInSCM(containerID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,14 @@ public void testContainerStateAfterDNRestart() throws Exception {
containerInfos.get(0).getContainerID());
// Before restart container state is non-empty
assertFalse(getContainerFromDN(
cluster.getHddsDatanodes().get(0), containerId.getId())
cluster.getHddsDatanodes().get(0), containerId.getIdForTesting())
.getContainerData().isEmpty());
// Restart DataNode
cluster.restartHddsDatanode(0, true);

// After restart also container state remains non-empty.
assertFalse(getContainerFromDN(
cluster.getHddsDatanodes().get(0), containerId.getId())
cluster.getHddsDatanodes().get(0), containerId.getIdForTesting())
.getContainerData().isEmpty());

// Delete key
Expand All @@ -535,14 +535,14 @@ public void testContainerStateAfterDNRestart() throws Exception {

// Container state should be empty now as key got deleted
assertTrue(getContainerFromDN(
cluster.getHddsDatanodes().get(0), containerId.getId())
cluster.getHddsDatanodes().get(0), containerId.getIdForTesting())
.getContainerData().isEmpty());

// Restart DataNode
cluster.restartHddsDatanode(0, true);
// Container state should be empty even after restart
assertTrue(getContainerFromDN(
cluster.getHddsDatanodes().get(0), containerId.getId())
cluster.getHddsDatanodes().get(0), containerId.getIdForTesting())
.getContainerData().isEmpty());

GenericTestUtils.waitFor(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,25 @@ public void test() throws Exception {
Pipeline pipeline = cluster.getStorageContainerManager()
.getPipelineManager().getPipeline(container.getPipelineID());

assertFalse(isContainerClosed(cluster, containerId.getId()));
assertFalse(isContainerClosed(cluster, containerId.getIdForTesting()));

DatanodeDetails datanodeDetails =
cluster.getHddsDatanodes().get(0).getDatanodeDetails();
//send the order to close the container
SCMCommand<?> command = new CloseContainerCommand(
containerId.getId(), pipeline.getId());
containerId.getIdForTesting(), pipeline.getId());
command.setTerm(
cluster.getStorageContainerManager().getScmContext().getTermOfLeader());
cluster.getStorageContainerManager().getScmNodeManager()
.addDatanodeCommand(datanodeDetails.getID(), command);

GenericTestUtils.waitFor(() ->
isContainerClosed(cluster, containerId.getId()),
isContainerClosed(cluster, containerId.getIdForTesting()),
500,
5 * 1000);

//double check if it's really closed (waitFor also throws an exception)
assertTrue(isContainerClosed(cluster, containerId.getId()));
assertTrue(isContainerClosed(cluster, containerId.getIdForTesting()));
}

private static Boolean isContainerClosed(MiniOzoneCluster cluster,
Expand Down
Loading