This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new ee9b851ced1 HDDS-11247. Clean up TestContainerReportHandling (#10628)
ee9b851ced1 is described below
commit ee9b851ced12f3c7cfb6545955b850a8b07d5890
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Sun Jun 28 10:39:56 2026 +0200
HDDS-11247. Clean up TestContainerReportHandling (#10628)
---
.../container/TestContainerReportHandling.java | 167 ++++++++++-------
.../TestContainerReportHandlingWithHA.java | 199 ---------------------
.../org/apache/hadoop/ozone/MiniOzoneCluster.java | 3 +
.../apache/hadoop/ozone/MiniOzoneClusterImpl.java | 5 +
.../hadoop/ozone/MiniOzoneHAClusterImpl.java | 1 +
5 files changed, 113 insertions(+), 262 deletions(-)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/TestContainerReportHandling.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/TestContainerReportHandling.java
index 00f912d8ddd..baad632e423 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/TestContainerReportHandling.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/TestContainerReportHandling.java
@@ -22,7 +22,6 @@
import static
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_DEADNODE_INTERVAL;
import static
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTERVAL;
import static
org.apache.hadoop.ozone.container.TestHelper.waitForContainerClose;
-import static
org.apache.hadoop.ozone.container.TestHelper.waitForContainerStateInSCM;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -34,45 +33,96 @@
import java.nio.file.Paths;
import java.util.List;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.stream.Collectors;
import java.util.stream.Stream;
+import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.hadoop.fs.FileUtil;
-import org.apache.hadoop.hdds.client.ReplicationConfig;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleState;
import
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerReplicaProto;
import org.apache.hadoop.hdds.scm.container.ContainerID;
import org.apache.hadoop.hdds.scm.container.ContainerManager;
import org.apache.hadoop.hdds.scm.container.ContainerNotFoundException;
+import org.apache.hadoop.hdds.scm.server.StorageContainerManager;
+import org.apache.hadoop.hdds.utils.IOUtils;
import org.apache.hadoop.ozone.MiniOzoneCluster;
import org.apache.hadoop.ozone.TestDataUtil;
import org.apache.hadoop.ozone.client.ObjectStore;
import org.apache.hadoop.ozone.client.OzoneBucket;
import org.apache.hadoop.ozone.client.OzoneClient;
import org.apache.hadoop.ozone.client.OzoneVolume;
+import org.apache.hadoop.ozone.container.TestHelper.ReplicationInput;
import org.apache.hadoop.ozone.om.helpers.OmKeyArgs;
import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo;
import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfoGroup;
import org.apache.ozone.test.GenericTestUtils;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.AfterParameterizedClassInvocation;
+import org.junit.jupiter.params.BeforeParameterizedClassInvocation;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
import org.junit.jupiter.params.provider.MethodSource;
/**
* Tests for container report handling.
*/
+@ParameterizedClass
+@MethodSource("clusters")
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class TestContainerReportHandling {
+
private static final String VOLUME = "vol1";
private static final String BUCKET = "bucket1";
- private static final String KEY = "key1";
+ private static final int DATANODE_COUNT =
ReplicationInput.EC.getNumDatanodes();
+
+ private static OzoneConfiguration conf;
+
+ @Parameter
+ private MiniOzoneCluster.Builder builder;
+
+ private MiniOzoneCluster cluster;
- private static Stream<Arguments> delStatesAndReplication() {
+ private static List<TestCase> delStatesAndReplication() {
return Stream.of(
- HddsProtos.LifeCycleState.DELETING,
- HddsProtos.LifeCycleState.DELETED)
+ LifeCycleState.DELETING,
+ LifeCycleState.DELETED)
.flatMap(state -> Stream.of(
- Arguments.of(state, TestHelper.ReplicationInput.RATIS),
- Arguments.of(state, TestHelper.ReplicationInput.EC)));
+ new TestCase(state, ReplicationInput.RATIS),
+ new TestCase(state, ReplicationInput.EC)))
+ .collect(Collectors.toList());
+ }
+
+ @BeforeAll
+ static void createConf() {
+ conf = new OzoneConfiguration();
+ conf.setTimeDuration(OZONE_SCM_STALENODE_INTERVAL, 3, TimeUnit.SECONDS);
+ conf.setTimeDuration(OZONE_SCM_DEADNODE_INTERVAL, 6, TimeUnit.SECONDS);
+ conf.setTimeDuration(HDDS_CONTAINER_REPORT_INTERVAL, 1, TimeUnit.SECONDS);
+ }
+
+ static Stream<MiniOzoneCluster.Builder> clusters() {
+ return Stream.of(
+ MiniOzoneCluster.newBuilder(conf),
+ MiniOzoneCluster.newHABuilder(conf)
+ );
+ }
+
+ @BeforeParameterizedClassInvocation
+ void startCluster() throws Exception {
+ cluster = builder.setNumDatanodes(DATANODE_COUNT).build();
+ cluster.waitForClusterToBeReady();
+ }
+
+ @AfterParameterizedClassInvocation
+ void shutdown() {
+ Path clusterPath = Paths.get(cluster.getBaseDir());
+ IOUtils.closeQuietly(cluster);
+ assertTrue(FileUtil.fullyDelete(clusterPath.toFile()));
}
/**
@@ -83,33 +133,31 @@ private static Stream<Arguments> delStatesAndReplication()
{
* container report for the CLOSED replicas.
* Tests wait for a DELETING (or DELETED) container replica gets deleted
based on the bcsid comparison.
*/
- @ParameterizedTest
- @MethodSource("delStatesAndReplication")
- void testDeletingOrDeletedContainerWhenNonEmptyReplicaIsReported(
- HddsProtos.LifeCycleState desiredState,
- TestHelper.ReplicationInput replicationInput)
- throws Exception {
- OzoneConfiguration conf = new OzoneConfiguration();
- conf.setTimeDuration(OZONE_SCM_STALENODE_INTERVAL, 3, TimeUnit.SECONDS);
- conf.setTimeDuration(OZONE_SCM_DEADNODE_INTERVAL, 6, TimeUnit.SECONDS);
- conf.setTimeDuration(HDDS_CONTAINER_REPORT_INTERVAL, 1, TimeUnit.SECONDS);
-
- Path clusterPath = null;
- try (MiniOzoneCluster cluster = newCluster(conf,
replicationInput.getNumDatanodes())) {
- cluster.waitForClusterToBeReady();
- clusterPath = Paths.get(cluster.getBaseDir());
-
- try (OzoneClient client = cluster.newClient()) {
+ @Test
+ void testDeletingOrDeletedContainerWhenNonEmptyReplicaIsReported() throws
Exception {
+ try (OzoneClient client = cluster.newClient()) {
+ ObjectStore objectStore = client.getObjectStore();
+ objectStore.createVolume(VOLUME);
+ OzoneVolume volume = objectStore.getVolume(VOLUME);
+ volume.createBucket(BUCKET);
+ OzoneBucket bucket = volume.getBucket(BUCKET);
+
+ int keyCount = 0;
+
+ for (TestCase testCase : delStatesAndReplication()) {
+ LifeCycleState desiredState = testCase.getLeft();
+ ReplicationInput replicationInput = testCase.getRight();
// create a container and close it
- createTestData(client, replicationInput.getReplicationConfig());
- List<OmKeyLocationInfo> keyLocations = lookupKey(cluster);
+ String key = "key" + keyCount;
+ TestDataUtil.createKey(bucket, key,
replicationInput.getReplicationConfig(), "Hello".getBytes(UTF_8));
+ List<OmKeyLocationInfo> keyLocations = lookupKey(cluster, key);
assertThat(keyLocations).isNotEmpty();
OmKeyLocationInfo keyLocation = keyLocations.get(0);
ContainerID containerID =
ContainerID.valueOf(keyLocation.getContainerID());
waitForContainerClose(cluster, containerID.getId());
// also wait till the container is closed in SCM
- waitForContainerStateInSCM(cluster.getStorageContainerManager(),
containerID, HddsProtos.LifeCycleState.CLOSED);
+ waitForContainerClosedInSCM(containerID);
ContainerManager containerManager =
cluster.getStorageContainerManager().getContainerManager();
// Wait until SCM sees all replicas CLOSED before moving the container
to DELETING. The container state above
@@ -122,48 +170,47 @@ void
testDeletingOrDeletedContainerWhenNonEmptyReplicaIsReported(
// move the container to DELETING
assertFalse(containerManager.getContainerReplicas(containerID).isEmpty());
containerManager.updateContainerState(containerID,
HddsProtos.LifeCycleEvent.DELETE);
- assertEquals(HddsProtos.LifeCycleState.DELETING,
containerManager.getContainer(containerID).getState());
+ assertEquals(LifeCycleState.DELETING,
containerManager.getContainer(containerID).getState());
// move the container to DELETED in the second test case
- if (desiredState == HddsProtos.LifeCycleState.DELETED) {
+ if (desiredState == LifeCycleState.DELETED) {
containerManager.updateContainerState(containerID,
HddsProtos.LifeCycleEvent.CLEANUP);
- assertEquals(HddsProtos.LifeCycleState.DELETED,
containerManager.getContainer(containerID).getState());
+ assertEquals(LifeCycleState.DELETED,
containerManager.getContainer(containerID).getState());
}
// Since replica state is CLOSED and container is DELETED/DELETING in
SCM, and the bcsid of replica and
// container is same, SCM will trigger delete replica for RATIS (EC
ignores bcsid) when it processes a
// periodic container report for the CLOSED replicas.
// wait for all replica to be deleted
- GenericTestUtils.waitFor(() -> {
- try {
- return
containerManager.getContainerReplicas(containerID).isEmpty();
- } catch (ContainerNotFoundException e) {
- throw new RuntimeException(e);
- }
- }, 100, 180000);
- }
- } finally {
- if (clusterPath != null) {
- System.out.println("Deleting path " + clusterPath);
- boolean deleted = FileUtil.fullyDelete(clusterPath.toFile());
- assertTrue(deleted);
+ waitForAllReplicasDeleted(containerManager, containerID);
}
}
}
- private static MiniOzoneCluster newCluster(OzoneConfiguration conf, int
numDatanodes)
- throws IOException {
- return MiniOzoneCluster.newBuilder(conf)
- .setNumDatanodes(numDatanodes)
- .build();
+ private void waitForContainerClosedInSCM(ContainerID containerID)
+ throws TimeoutException, InterruptedException {
+ for (StorageContainerManager scm : cluster.getStorageContainerManagers()) {
+ TestHelper.waitForContainerStateInSCM(scm, containerID,
LifeCycleState.CLOSED);
+ }
+ }
+
+ private static void waitForAllReplicasDeleted(ContainerManager
containerManager, ContainerID containerID)
+ throws TimeoutException, InterruptedException {
+ GenericTestUtils.waitFor(() -> {
+ try {
+ return containerManager.getContainerReplicas(containerID).isEmpty();
+ } catch (ContainerNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }, 100, 180000);
}
- private static List<OmKeyLocationInfo> lookupKey(MiniOzoneCluster cluster)
+ private static List<OmKeyLocationInfo> lookupKey(MiniOzoneCluster cluster,
String key)
throws IOException {
OmKeyArgs keyArgs = new OmKeyArgs.Builder()
.setVolumeName(VOLUME)
.setBucketName(BUCKET)
- .setKeyName(KEY)
+ .setKeyName(key)
.build();
OmKeyInfo keyInfo = cluster.getOzoneManager().lookupKey(keyArgs);
OmKeyLocationInfoGroup locations = keyInfo.getLatestVersionLocations();
@@ -171,15 +218,9 @@ private static List<OmKeyLocationInfo>
lookupKey(MiniOzoneCluster cluster)
return locations.getLocationList();
}
- private void createTestData(OzoneClient client, ReplicationConfig
replicationConfig) throws IOException {
- ObjectStore objectStore = client.getObjectStore();
- objectStore.createVolume(VOLUME);
- OzoneVolume volume = objectStore.getVolume(VOLUME);
- volume.createBucket(BUCKET);
-
- OzoneBucket bucket = volume.getBucket(BUCKET);
-
- TestDataUtil.createKey(bucket, KEY, replicationConfig,
"Hello".getBytes(UTF_8));
+ private static class TestCase extends ImmutablePair<LifeCycleState,
ReplicationInput> {
+ TestCase(LifeCycleState state, ReplicationInput replication) {
+ super(state, replication);
+ }
}
-
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/TestContainerReportHandlingWithHA.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/TestContainerReportHandlingWithHA.java
deleted file mode 100644
index d68880ddd36..00000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/TestContainerReportHandlingWithHA.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.ozone.container;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static
org.apache.hadoop.hdds.HddsConfigKeys.HDDS_CONTAINER_REPORT_INTERVAL;
-import static
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_DEADNODE_INTERVAL;
-import static
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTERVAL;
-import static
org.apache.hadoop.ozone.container.TestHelper.waitForContainerClose;
-import static
org.apache.hadoop.ozone.container.TestHelper.waitForContainerStateInSCM;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.stream.Stream;
-import org.apache.hadoop.fs.FileUtil;
-import org.apache.hadoop.hdds.client.ReplicationConfig;
-import org.apache.hadoop.hdds.conf.OzoneConfiguration;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
-import
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerReplicaProto;
-import org.apache.hadoop.hdds.scm.container.ContainerID;
-import org.apache.hadoop.hdds.scm.container.ContainerManager;
-import org.apache.hadoop.hdds.scm.container.ContainerNotFoundException;
-import org.apache.hadoop.hdds.scm.server.StorageContainerManager;
-import org.apache.hadoop.ozone.MiniOzoneCluster;
-import org.apache.hadoop.ozone.MiniOzoneHAClusterImpl;
-import org.apache.hadoop.ozone.TestDataUtil;
-import org.apache.hadoop.ozone.client.ObjectStore;
-import org.apache.hadoop.ozone.client.OzoneBucket;
-import org.apache.hadoop.ozone.client.OzoneClient;
-import org.apache.hadoop.ozone.client.OzoneVolume;
-import org.apache.hadoop.ozone.om.helpers.OmKeyArgs;
-import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
-import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo;
-import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfoGroup;
-import org.apache.ozone.test.GenericTestUtils;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-
-/**
- * Tests for container report handling with SCM High Availability.
- */
-public class TestContainerReportHandlingWithHA {
- private static final String VOLUME = "vol1";
- private static final String BUCKET = "bucket1";
- private static final String KEY = "key1";
-
- private static Stream<Arguments> delStatesAndReplication() {
- return Stream.of(
- HddsProtos.LifeCycleState.DELETING,
- HddsProtos.LifeCycleState.DELETED)
- .flatMap(state -> Stream.of(
- Arguments.of(state, TestHelper.ReplicationInput.RATIS),
- Arguments.of(state, TestHelper.ReplicationInput.EC)));
- }
-
- /**
- * Tests that a DELETING (or DELETED) container replica gets deleted when
replica bcsid <= container bcsid
- * applicable to RATIS; EC ignores bcsid.
- * To do this, the test first creates a key and closes its corresponding
container. Then it moves that container to
- * DELETING (or DELETED) state using ContainerManager. SCM then deletes the
replicas when it processes a periodic
- * container report for the CLOSED replicas.
- * Tests wait for a DELETING (or DELETED) container replica gets deleted
based on the bcsid comparison.
- */
- @ParameterizedTest
- @MethodSource("delStatesAndReplication")
- void testDeletingOrDeletedContainerWhenNonEmptyReplicaIsReportedWithScmHA(
- HddsProtos.LifeCycleState desiredState,
- TestHelper.ReplicationInput replicationInput)
- throws Exception {
- OzoneConfiguration conf = new OzoneConfiguration();
- conf.setTimeDuration(OZONE_SCM_STALENODE_INTERVAL, 3, TimeUnit.SECONDS);
- conf.setTimeDuration(OZONE_SCM_DEADNODE_INTERVAL, 6, TimeUnit.SECONDS);
- conf.setTimeDuration(HDDS_CONTAINER_REPORT_INTERVAL, 1, TimeUnit.SECONDS);
-
- int numSCM = 3;
- Path clusterPath = null;
- try (MiniOzoneHAClusterImpl cluster = newHACluster(conf, numSCM,
replicationInput.getNumDatanodes())) {
- cluster.waitForClusterToBeReady();
- clusterPath = Paths.get(cluster.getBaseDir());
-
- try (OzoneClient client = cluster.newClient()) {
- // create a container and close it
- createTestData(client, replicationInput.getReplicationConfig());
- List<OmKeyLocationInfo> keyLocations = lookupKey(cluster);
- assertThat(keyLocations).isNotEmpty();
- OmKeyLocationInfo keyLocation = keyLocations.get(0);
- ContainerID containerID =
ContainerID.valueOf(keyLocation.getContainerID());
- waitForContainerClose(cluster, containerID.getId());
-
- waitForContainerStateInAllSCMs(cluster, containerID,
HddsProtos.LifeCycleState.CLOSED);
-
- ContainerManager containerManager =
cluster.getScmLeader().getContainerManager();
- // Wait until SCM sees all replicas CLOSED before moving the container
to DELETING. The container state above
- // flips to CLOSED as soon as the first replica is reported CLOSED, so
a lagging replica may still be CLOSING in
- // SCM. Deleting then races with that lagging CLOSING report, which
would resurrect the container out of
- // DELETING/DELETED and the replicas would never be deleted.
- TestHelper.waitForReplicaState(containerManager, containerID,
replicationInput.getNumDatanodes(),
- ContainerReplicaProto.State.CLOSED);
-
- // move the container to DELETING
-
assertFalse(containerManager.getContainerReplicas(containerID).isEmpty());
- containerManager.updateContainerState(containerID,
HddsProtos.LifeCycleEvent.DELETE);
- assertEquals(HddsProtos.LifeCycleState.DELETING,
containerManager.getContainer(containerID).getState());
-
- // move the container to DELETED in the second test case
- if (desiredState == HddsProtos.LifeCycleState.DELETED) {
- containerManager.updateContainerState(containerID,
HddsProtos.LifeCycleEvent.CLEANUP);
- assertEquals(HddsProtos.LifeCycleState.DELETED,
containerManager.getContainer(containerID).getState());
- }
-
- // Since replica state is CLOSED and container is DELETED/DELETING in
SCM, and the bcsid of replica and
- // container is same, SCM will trigger delete replica for RATIS (EC
ignores bcsid) when it processes a
- // periodic container report for the CLOSED replicas.
- // wait for all replica to be deleted
- GenericTestUtils.waitFor(() -> {
- try {
- return
containerManager.getContainerReplicas(containerID).isEmpty();
- } catch (ContainerNotFoundException e) {
- throw new RuntimeException(e);
- }
- }, 100, 180000);
- }
- } finally {
- if (clusterPath != null) {
- boolean deleted = FileUtil.fullyDelete(clusterPath.toFile());
- assertTrue(deleted);
- }
- }
- }
-
- private static MiniOzoneHAClusterImpl newHACluster(OzoneConfiguration conf,
int numSCM, int numDatanodes)
- throws IOException {
- MiniOzoneHAClusterImpl.Builder haBuilder =
MiniOzoneCluster.newHABuilder(conf)
- .setOMServiceId("om-service")
- .setSCMServiceId("scm-service")
- .setNumOfOzoneManagers(1)
- .setNumOfStorageContainerManagers(numSCM);
- haBuilder.setNumDatanodes(numDatanodes);
- return haBuilder.build();
- }
-
- private static List<OmKeyLocationInfo> lookupKey(MiniOzoneCluster cluster)
- throws IOException {
- OmKeyArgs keyArgs = new OmKeyArgs.Builder()
- .setVolumeName(VOLUME)
- .setBucketName(BUCKET)
- .setKeyName(KEY)
- .build();
- OmKeyInfo keyInfo = cluster.getOzoneManager().lookupKey(keyArgs);
- OmKeyLocationInfoGroup locations = keyInfo.getLatestVersionLocations();
- assertNotNull(locations);
- return locations.getLocationList();
- }
-
- private void createTestData(OzoneClient client, ReplicationConfig
replicationConfig) throws IOException {
- ObjectStore objectStore = client.getObjectStore();
- objectStore.createVolume(VOLUME);
- OzoneVolume volume = objectStore.getVolume(VOLUME);
- volume.createBucket(BUCKET);
-
- OzoneBucket bucket = volume.getBucket(BUCKET);
-
- TestDataUtil.createKey(bucket, KEY, replicationConfig,
"Hello".getBytes(UTF_8));
- }
-
- private static void waitForContainerStateInAllSCMs(MiniOzoneHAClusterImpl
cluster, ContainerID containerID,
- HddsProtos.LifeCycleState desiredState)
- throws TimeoutException, InterruptedException {
- for (StorageContainerManager scm :
cluster.getStorageContainerManagersList()) {
- waitForContainerStateInSCM(scm, containerID, desiredState);
- }
- }
-
-}
diff --git
a/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneCluster.java
b/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneCluster.java
index dbeeda5cdbf..d768e44756b 100644
---
a/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneCluster.java
+++
b/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneCluster.java
@@ -120,6 +120,9 @@ void waitForPipelineTobeReady(HddsProtos.ReplicationFactor
factor,
*/
StorageContainerManager getStorageContainerManager();
+ /** @return all SCMs */
+ List<StorageContainerManager> getStorageContainerManagers();
+
/**
* Returns {@link OzoneManager} associated with this
* {@link MiniOzoneCluster} instance.
diff --git
a/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
b/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
index 78c6be6630d..b0e2c1efbdb 100644
---
a/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
+++
b/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
@@ -226,6 +226,11 @@ public StorageContainerManager
getStorageContainerManager() {
return this.scm;
}
+ @Override
+ public List<StorageContainerManager> getStorageContainerManagers() {
+ return singletonList(scm);
+ }
+
@Override
public OzoneManager getOzoneManager() {
return this.ozoneManager;
diff --git
a/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneHAClusterImpl.java
b/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneHAClusterImpl.java
index 99b1272f82c..48fd95b075e 100644
---
a/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneHAClusterImpl.java
+++
b/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneHAClusterImpl.java
@@ -1308,6 +1308,7 @@ static class SCMHAService extends
}
}
+ @Override
public List<StorageContainerManager> getStorageContainerManagers() {
return new ArrayList<>(this.scmhaService.getServices());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]