-
Notifications
You must be signed in to change notification settings - Fork 594
HDDS-10316. Speed up TestReconTasks #6223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
53e2c11
399b76a
23df399
e37e875
d3f021e
9b22c3c
64e35f9
e42e398
3ebe2a1
833e008
27d7902
c1fe332
c540681
9665426
8cc60b4
68a7697
c8a858a
cb9d7c2
317dcfa
dc25ff1
59c8920
50033f7
46f97dd
3c5305e
cd8ba26
7725dfa
14b4cd9
3b1b51c
f54cdbd
2844cec
922f92d
1f4a91e
e75f857
eada75b
608631b
285c084
dc519e1
c566ab6
1fd1b5b
8a8db39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,8 +41,12 @@ | |
| import org.apache.ozone.test.LambdaTestUtils; | ||
| import org.hadoop.ozone.recon.schema.ContainerSchemaDefinition; | ||
| import org.hadoop.ozone.recon.schema.tables.pojos.UnhealthyContainers; | ||
| import org.junit.jupiter.api.AfterEach; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.AfterAll; | ||
| import org.junit.jupiter.api.BeforeAll; | ||
| import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; | ||
| import org.junit.jupiter.api.Order; | ||
| import org.junit.jupiter.api.TestMethodOrder; | ||
| import org.junit.jupiter.api.TestInstance; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.Timeout; | ||
| import org.slf4j.event.Level; | ||
|
|
@@ -52,18 +56,21 @@ | |
| import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor.ONE; | ||
| import static org.apache.hadoop.ozone.container.ozoneimpl.TestOzoneContainer.runTestOzoneContainerViaDataNode; | ||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertArrayEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertNotEquals; | ||
|
|
||
| /** | ||
| * Integration Tests for Recon's tasks. | ||
| */ | ||
| @Timeout(300) | ||
| @TestInstance(TestInstance.Lifecycle.PER_CLASS) | ||
| @TestMethodOrder(OrderAnnotation.class) | ||
| public class TestReconTasks { | ||
| private MiniOzoneCluster cluster = null; | ||
| private OzoneConfiguration conf; | ||
|
|
||
| @BeforeEach | ||
| public void init() throws Exception { | ||
| @BeforeAll | ||
| void init() throws Exception { | ||
| conf = new OzoneConfiguration(); | ||
| conf.set(HDDS_CONTAINER_REPORT_INTERVAL, "5s"); | ||
| conf.set(HDDS_PIPELINE_REPORT_INTERVAL, "5s"); | ||
|
|
@@ -81,14 +88,15 @@ public void init() throws Exception { | |
| Level.DEBUG); | ||
| } | ||
|
|
||
| @AfterEach | ||
| public void shutdown() { | ||
| @AfterAll | ||
| void shutdown() { | ||
| if (cluster != null) { | ||
| cluster.shutdown(); | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| @Order(2) | ||
| public void testSyncSCMContainerInfo() throws Exception { | ||
| ReconStorageContainerManagerFacade reconScm = | ||
| (ReconStorageContainerManagerFacade) | ||
|
|
@@ -121,6 +129,7 @@ public void testSyncSCMContainerInfo() throws Exception { | |
| } | ||
|
|
||
| @Test | ||
| @Order(3) | ||
| public void testMissingContainerDownNode() throws Exception { | ||
| ReconStorageContainerManagerFacade reconScm = | ||
| (ReconStorageContainerManagerFacade) | ||
|
|
@@ -141,7 +150,7 @@ public void testMissingContainerDownNode() throws Exception { | |
| (ReconContainerManager) reconScm.getContainerManager(); | ||
| ContainerInfo containerInfo = | ||
| scmContainerManager | ||
| .allocateContainer(RatisReplicationConfig.getInstance(ONE), "test"); | ||
| .allocateContainer(RatisReplicationConfig.getInstance(ONE), "testMissingContainer"); | ||
| long containerID = containerInfo.getContainerID(); | ||
|
|
||
| try (RDBBatchOperation rdbBatchOperation = new RDBBatchOperation()) { | ||
|
|
@@ -156,8 +165,8 @@ public void testMissingContainerDownNode() throws Exception { | |
| runTestOzoneContainerViaDataNode(containerID, client); | ||
|
|
||
| // Make sure Recon got the container report with new container. | ||
| assertEquals(scmContainerManager.getContainers(), | ||
| reconContainerManager.getContainers()); | ||
| assertArrayEquals(scmContainerManager.getContainers().toArray(), | ||
| reconContainerManager.getContainers().toArray()); | ||
|
|
||
| // Bring down the Datanode that had the container replica. | ||
| cluster.shutdownHddsDatanode(pipeline.getFirstNode()); | ||
|
|
@@ -168,7 +177,7 @@ public void testMissingContainerDownNode() throws Exception { | |
| .getUnhealthyContainers( | ||
| ContainerSchemaDefinition.UnHealthyContainerStates.MISSING, | ||
| 0, 1000); | ||
| return (allMissingContainers.size() == 1); | ||
| return (allMissingContainers.size() >= 1); | ||
| }); | ||
|
|
||
| // Restart the Datanode to make sure we remove the missing container. | ||
|
|
@@ -202,6 +211,7 @@ public void testMissingContainerDownNode() throws Exception { | |
| * @throws Exception | ||
| */ | ||
| @Test | ||
| @Order(1) | ||
| public void testEmptyMissingContainerDownNode() throws Exception { | ||
| ReconStorageContainerManagerFacade reconScm = | ||
| (ReconStorageContainerManagerFacade) | ||
|
|
@@ -221,7 +231,7 @@ public void testEmptyMissingContainerDownNode() throws Exception { | |
| (ReconContainerManager) reconScm.getContainerManager(); | ||
| ContainerInfo containerInfo = | ||
| scmContainerManager | ||
| .allocateContainer(RatisReplicationConfig.getInstance(ONE), "test"); | ||
| .allocateContainer(RatisReplicationConfig.getInstance(ONE), "testEmptyMissingContainer"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you are increasing datanodes, then better to keep replication factor also as THREE
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried changing it to HddsProtos.ReplicationFactor.THREE but it seems having problem with number of pipelines..
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, this might be because of not meeting the criteria of sufficient healthy nodes because default |
||
| long containerID = containerInfo.getContainerID(); | ||
|
|
||
| Pipeline pipeline = | ||
|
|
@@ -230,8 +240,8 @@ public void testEmptyMissingContainerDownNode() throws Exception { | |
| runTestOzoneContainerViaDataNode(containerID, client); | ||
|
|
||
| // Make sure Recon got the container report with new container. | ||
| assertEquals(scmContainerManager.getContainers(), | ||
| reconContainerManager.getContainers()); | ||
| assertArrayEquals(scmContainerManager.getContainers().toArray(), | ||
| reconContainerManager.getContainers().toArray()); | ||
|
|
||
| // Bring down the Datanode that had the container replica. | ||
| cluster.shutdownHddsDatanode(pipeline.getFirstNode()); | ||
|
|
@@ -243,7 +253,7 @@ public void testEmptyMissingContainerDownNode() throws Exception { | |
| ContainerSchemaDefinition.UnHealthyContainerStates. | ||
| EMPTY_MISSING, | ||
| 0, 1000); | ||
| return (allEmptyMissingContainers.size() == 1); | ||
| return (allEmptyMissingContainers.size() >= 1); | ||
| }); | ||
|
|
||
| // Now add a container to key mapping count as 3. This data is used to | ||
|
|
@@ -261,7 +271,7 @@ public void testEmptyMissingContainerDownNode() throws Exception { | |
| .getUnhealthyContainers( | ||
| ContainerSchemaDefinition.UnHealthyContainerStates.MISSING, | ||
| 0, 1000); | ||
| return (allMissingContainers.size() == 1); | ||
| return (allMissingContainers.size() >= 1); | ||
| }); | ||
|
|
||
| LambdaTestUtils.await(25000, 1000, () -> { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are increasing datanodes, then better to keep replication factor also as THREE