-
Notifications
You must be signed in to change notification settings - Fork 619
HDDS-9819. Recon - Potential memory overflow in Container Health Task. #5841
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 9 commits
6f411d1
c77e3d5
7a7e68f
88b671f
1a2c4ce
720d24b
81f271c
903805a
8612090
0abeec2
1fb54db
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 | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,9 +19,11 @@ | |||||||
| package org.apache.hadoop.ozone.recon.fsck; | ||||||||
|
|
||||||||
| import static org.hadoop.ozone.recon.schema.ContainerSchemaDefinition.UnHealthyContainerStates.ALL_REPLICAS_UNHEALTHY; | ||||||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||||||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||||||||
| import static org.junit.jupiter.api.Assertions.assertNotNull; | ||||||||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||||||||
| import static org.mockito.ArgumentMatchers.any; | ||||||||
| import static org.mockito.ArgumentMatchers.anyInt; | ||||||||
|
Comment on lines
-22
to
+26
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. Please keep |
||||||||
| import static org.mockito.Mockito.mock; | ||||||||
| import static org.mockito.Mockito.when; | ||||||||
|
|
||||||||
|
|
@@ -96,7 +98,8 @@ public void testRun() throws Exception { | |||||||
| List<ContainerInfo> mockContainers = getMockContainers(7); | ||||||||
| when(scmMock.getScmServiceProvider()).thenReturn(scmClientMock); | ||||||||
| when(scmMock.getContainerManager()).thenReturn(containerManagerMock); | ||||||||
| when(containerManagerMock.getContainers()).thenReturn(mockContainers); | ||||||||
| when(containerManagerMock.getContainers(any(ContainerID.class), | ||||||||
| anyInt())).thenReturn(mockContainers); | ||||||||
| for (ContainerInfo c : mockContainers) { | ||||||||
| when(containerManagerMock.getContainer(c.containerID())).thenReturn(c); | ||||||||
| when(scmClientMock.getContainerWithPipeline(c.getContainerID())) | ||||||||
|
|
@@ -137,7 +140,7 @@ public void testRun() throws Exception { | |||||||
| .thenReturn(Collections.emptySet()); | ||||||||
|
|
||||||||
| List<UnhealthyContainers> all = unHealthyContainersTableHandle.findAll(); | ||||||||
| assertThat(all).isEmpty(); | ||||||||
| assertTrue(all.isEmpty()); | ||||||||
|
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. Please keep
Suggested change
|
||||||||
|
|
||||||||
| long currentTime = System.currentTimeMillis(); | ||||||||
| ReconTaskStatusDao reconTaskStatusDao = getDao(ReconTaskStatusDao.class); | ||||||||
|
|
@@ -151,7 +154,7 @@ public void testRun() throws Exception { | |||||||
| reconTaskStatusDao, containerHealthSchemaManager, | ||||||||
| placementMock, reconTaskConfig, reconContainerMetadataManager); | ||||||||
| containerHealthTask.start(); | ||||||||
| LambdaTestUtils.await(6000, 1000, () -> | ||||||||
| LambdaTestUtils.await(60000, 1000, () -> | ||||||||
| (unHealthyContainersTableHandle.count() == 6)); | ||||||||
| UnhealthyContainers rec = | ||||||||
| unHealthyContainersTableHandle.fetchByContainerId(1L).get(0); | ||||||||
|
|
@@ -192,7 +195,8 @@ public void testRun() throws Exception { | |||||||
|
|
||||||||
| ReconTaskStatus taskStatus = | ||||||||
| reconTaskStatusDao.findById(containerHealthTask.getTaskName()); | ||||||||
| assertThat(taskStatus.getLastUpdatedTimestamp()).isGreaterThan(currentTime); | ||||||||
| assertTrue(taskStatus.getLastUpdatedTimestamp() > | ||||||||
| currentTime); | ||||||||
|
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. Please keep
Suggested change
|
||||||||
|
|
||||||||
| // Now run the job again, to check that relevant records are updated or | ||||||||
| // removed as appropriate. Need to adjust the return value for all the mocks | ||||||||
|
|
@@ -267,7 +271,8 @@ public void testDeletedContainer() throws Exception { | |||||||
| List<ContainerInfo> mockContainers = getMockContainers(3); | ||||||||
| when(scmMock.getScmServiceProvider()).thenReturn(scmClientMock); | ||||||||
| when(scmMock.getContainerManager()).thenReturn(containerManagerMock); | ||||||||
| when(containerManagerMock.getContainers()).thenReturn(mockContainers); | ||||||||
| when(containerManagerMock.getContainers(any(ContainerID.class), | ||||||||
| anyInt())).thenReturn(mockContainers); | ||||||||
| for (ContainerInfo c : mockContainers) { | ||||||||
| when(containerManagerMock.getContainer(c.containerID())).thenReturn(c); | ||||||||
| when(scmClientMock.getContainerWithPipeline(c.getContainerID())) | ||||||||
|
|
@@ -299,7 +304,7 @@ public void testDeletedContainer() throws Exception { | |||||||
| .thenReturn(new ContainerWithPipeline(mockContainers.get(0), null)); | ||||||||
|
|
||||||||
| List<UnhealthyContainers> all = unHealthyContainersTableHandle.findAll(); | ||||||||
| assertThat(all).isEmpty(); | ||||||||
| assertTrue(all.isEmpty()); | ||||||||
|
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. Please keep
Suggested change
|
||||||||
|
|
||||||||
| long currentTime = System.currentTimeMillis(); | ||||||||
| ReconTaskStatusDao reconTaskStatusDao = getDao(ReconTaskStatusDao.class); | ||||||||
|
|
@@ -327,7 +332,8 @@ public void testDeletedContainer() throws Exception { | |||||||
|
|
||||||||
| ReconTaskStatus taskStatus = | ||||||||
| reconTaskStatusDao.findById(containerHealthTask.getTaskName()); | ||||||||
| assertThat(taskStatus.getLastUpdatedTimestamp()).isGreaterThan(currentTime); | ||||||||
| assertTrue(taskStatus.getLastUpdatedTimestamp() > | ||||||||
| currentTime); | ||||||||
|
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. Please keep
Suggested change
|
||||||||
| } | ||||||||
|
|
||||||||
| private Set<ContainerReplica> getMockReplicas( | ||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.