You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "amaliujia (via GitHub)" <gi...@apache.org> on 2026/06/09 13:07:17 UTC

[PR] HDDS-15498. Followup. Improve test case to make sure containers has a DELETED container that could be removed [ozone]

amaliujia opened a new pull request, #10471:
URL: https://github.com/apache/ozone/pull/10471

   ## What changes were proposed in this pull request?
   Provide a one-liner summary of the changes in the PR **Title** field above.
   It should be in the form of `HDDS-1234. Short summary of the change`.
   
   Please describe your PR in detail:
   * What changes are proposed in the PR? and Why? It would be better if it is written from third person's
   perspective not just for the reviewer.
   * Provide as much context and rationale for the pull request as possible. It could be copy-paste from
   the Jira's description if the jira is well defined.
   * If it is complex code, describe the approach used to solve the issue. If possible attach design doc,
   issue investigation, github discussion, etc.
   
   Examples of well-written pull requests:
   * [#3980](https://github.com/apache/ozone/pull/3980)
   * [#5265](https://github.com/apache/ozone/pull/5265)
   * [#4701](https://github.com/apache/ozone/pull/4701)
   * [#5283](https://github.com/apache/ozone/pull/5283)
   * [#5300](https://github.com/apache/ozone/pull/5300)
   
   ## What is the link to the Apache JIRA
   
   Please create an issue in ASF JIRA before opening a pull request, and you need to set the title of the pull
   request which starts with the corresponding JIRA issue number. (e.g. HDDS-XXXX. Fix a typo in YYY.)
   
   If you do not have an ASF Jira account yet, please follow the first-time contributor
   instructions in the [Jira guideline](../CONTRIBUTING.md#jira-guideline).
   
   (Please replace this section with the link to the Apache JIRA)
   
   ## How was this patch tested?
   
   (Please explain how this patch was tested. Ex: unit tests, manual tests, workflow run on the fork git repo.)
   (If this patch involves UI changes, please attach a screenshot; otherwise, remove this.)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15498. Followup. Improve test case to remove unnecessary MockContainers [ozone]

Posted by "amaliujia (via GitHub)" <gi...@apache.org>.
amaliujia commented on code in PR #10471:
URL: https://github.com/apache/ozone/pull/10471#discussion_r3381046355


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/AbstractContainerSafeModeRuleTest.java:
##########
@@ -96,10 +96,6 @@ public void testRefreshInitializeContainers() {
     AbstractContainerSafeModeRule rule = createRule(eventQueue, conf, containerManager, safeModeManager);
     rule.setValidateBasedOnReportProcessing(false);
     assertEquals(2, rule.getTotalNumberOfContainers(), "Total number of containers should be 2");
-    containers.add(mockContainer(LifeCycleState.CLOSED, 2L));
-    containers.add(mockContainer(LifeCycleState.OPEN, 3L));
-    containers.add(mockContainer(LifeCycleState.CLOSED, 4L));
-    containers.removeIf(c -> c.containerID().equals(ContainerID.valueOf(8L)));

Review Comment:
   @sumitagrawl 
   
   This is the place that I felt off. The root cause is in https://github.com/apache/ozone/pull/10462, we no longer access `containerManager.getContainers(getContainerType())`, so the mocks here are not accessed at all



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15498. Followup. Improve test case to remove unnecessary MockContainers [ozone]

Posted by "amaliujia (via GitHub)" <gi...@apache.org>.
amaliujia commented on code in PR #10471:
URL: https://github.com/apache/ozone/pull/10471#discussion_r3381046355


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/AbstractContainerSafeModeRuleTest.java:
##########
@@ -96,10 +96,6 @@ public void testRefreshInitializeContainers() {
     AbstractContainerSafeModeRule rule = createRule(eventQueue, conf, containerManager, safeModeManager);
     rule.setValidateBasedOnReportProcessing(false);
     assertEquals(2, rule.getTotalNumberOfContainers(), "Total number of containers should be 2");
-    containers.add(mockContainer(LifeCycleState.CLOSED, 2L));
-    containers.add(mockContainer(LifeCycleState.OPEN, 3L));
-    containers.add(mockContainer(LifeCycleState.CLOSED, 4L));
-    containers.removeIf(c -> c.containerID().equals(ContainerID.valueOf(8L)));

Review Comment:
   @sumitagrawl 
   
   This is the place that I felt off. The root cause is in https://github.com/apache/ozone/pull/10462, we no longer access `containerManager.getContainers(getContainerType())`, so the mocks here to`containers` are not accessed at all



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15498. Followup. Improve test case to remove unnecessary MockContainers [ozone]

Posted by "amaliujia (via GitHub)" <gi...@apache.org>.
amaliujia commented on code in PR #10471:
URL: https://github.com/apache/ozone/pull/10471#discussion_r3381074022


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/AbstractContainerSafeModeRuleTest.java:
##########
@@ -96,10 +96,6 @@ public void testRefreshInitializeContainers() {
     AbstractContainerSafeModeRule rule = createRule(eventQueue, conf, containerManager, safeModeManager);
     rule.setValidateBasedOnReportProcessing(false);
     assertEquals(2, rule.getTotalNumberOfContainers(), "Total number of containers should be 2");
-    containers.add(mockContainer(LifeCycleState.CLOSED, 2L));
-    containers.add(mockContainer(LifeCycleState.OPEN, 3L));
-    containers.add(mockContainer(LifeCycleState.CLOSED, 4L));
-    containers.removeIf(c -> c.containerID().equals(ContainerID.valueOf(8L)));

Review Comment:
   This reminds me a different thing: 
   
   In the previous implementation before #10462, does the `reinitializeRule` actually want to pull the newest container state from `containerManager`? At least this is what the test used to verify: after the `initializeRule` and before `reinitializeRule`, there are container state changes. 
   
    #10462 actually changes the behavior to let `reinitializeRule` work on a snapshot built from `initializeRule`.
   
   If the intention of this test case used to test container state change, I think we need to revert #10462. If we do not revert, otherwise at least we do not need these unnecessary Mock containers any more.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15498. Followup. Improve test case to remove unnecessary MockContainers [ozone]

Posted by "amaliujia (via GitHub)" <gi...@apache.org>.
amaliujia commented on code in PR #10471:
URL: https://github.com/apache/ozone/pull/10471#discussion_r3381074022


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/AbstractContainerSafeModeRuleTest.java:
##########
@@ -96,10 +96,6 @@ public void testRefreshInitializeContainers() {
     AbstractContainerSafeModeRule rule = createRule(eventQueue, conf, containerManager, safeModeManager);
     rule.setValidateBasedOnReportProcessing(false);
     assertEquals(2, rule.getTotalNumberOfContainers(), "Total number of containers should be 2");
-    containers.add(mockContainer(LifeCycleState.CLOSED, 2L));
-    containers.add(mockContainer(LifeCycleState.OPEN, 3L));
-    containers.add(mockContainer(LifeCycleState.CLOSED, 4L));
-    containers.removeIf(c -> c.containerID().equals(ContainerID.valueOf(8L)));

Review Comment:
   This reminds me a different thing: 
   
   In the previous implementation before #10462, does the `reinitializeRule` actually wants to pull the newest container state from `containerManager`? At least this is what the test used to verify: after the `initializeRule` and before `reinitializeRule`, there are container changes. 
   
    #10462 actually changes the behavior to let `reinitializeRule` work on a snapshot built from `initializeRule`
   
   If the intention of this test case used to be testing container state change, I think we need to revert #10462, otherwise at least we do not need these unnecessary Mock containers any more.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15498. Followup. Improve test case to remove unnecessary MockContainers [ozone]

Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl merged PR #10471:
URL: https://github.com/apache/ozone/pull/10471


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15498. Followup. Improve test case that containers should have a DELETED container that could be removed based on deletedContainers [ozone]

Posted by "amaliujia (via GitHub)" <gi...@apache.org>.
amaliujia closed pull request #10471: HDDS-15498. Followup. Improve test case that containers should have a DELETED container that could be removed based on deletedContainers
URL: https://github.com/apache/ozone/pull/10471


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15498. Followup. Improve test case to remove unnecessary MockContainers [ozone]

Posted by "amaliujia (via GitHub)" <gi...@apache.org>.
amaliujia commented on code in PR #10471:
URL: https://github.com/apache/ozone/pull/10471#discussion_r3381074022


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/AbstractContainerSafeModeRuleTest.java:
##########
@@ -96,10 +96,6 @@ public void testRefreshInitializeContainers() {
     AbstractContainerSafeModeRule rule = createRule(eventQueue, conf, containerManager, safeModeManager);
     rule.setValidateBasedOnReportProcessing(false);
     assertEquals(2, rule.getTotalNumberOfContainers(), "Total number of containers should be 2");
-    containers.add(mockContainer(LifeCycleState.CLOSED, 2L));
-    containers.add(mockContainer(LifeCycleState.OPEN, 3L));
-    containers.add(mockContainer(LifeCycleState.CLOSED, 4L));
-    containers.removeIf(c -> c.containerID().equals(ContainerID.valueOf(8L)));

Review Comment:
   This reminds me a different thing: 
   
   In the previous implementation before #10462, does the `reinitializeRule` actually want to pull the newest container state from `containerManager`? At least this is what the test used to verify: after the `initializeRule` and before `reinitializeRule`, there are container state changes. 
   
    #10462 actually changes the behavior to let `reinitializeRule` work on a snapshot built from `initializeRule`.
   
   If the intention of this test case used to test container state change, I think we need to revert #10462, otherwise at least we do not need these unnecessary Mock containers any more.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15498. Followup. Improve test case to remove unnecessary MockContainers [ozone]

Posted by "amaliujia (via GitHub)" <gi...@apache.org>.
amaliujia commented on code in PR #10471:
URL: https://github.com/apache/ozone/pull/10471#discussion_r3381046355


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/AbstractContainerSafeModeRuleTest.java:
##########
@@ -96,10 +96,6 @@ public void testRefreshInitializeContainers() {
     AbstractContainerSafeModeRule rule = createRule(eventQueue, conf, containerManager, safeModeManager);
     rule.setValidateBasedOnReportProcessing(false);
     assertEquals(2, rule.getTotalNumberOfContainers(), "Total number of containers should be 2");
-    containers.add(mockContainer(LifeCycleState.CLOSED, 2L));
-    containers.add(mockContainer(LifeCycleState.OPEN, 3L));
-    containers.add(mockContainer(LifeCycleState.CLOSED, 4L));
-    containers.removeIf(c -> c.containerID().equals(ContainerID.valueOf(8L)));

Review Comment:
   @sumitagrawl 
   
   This is the place that I felt off. The root cause is in https://github.com/apache/ozone/pull/10462, we no longer access `containerManager.getContainers(getContainerType())`, so the mocks here to`containers` are not accessed at all now.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org