adoroszlai commented on code in PR #5535:
URL: https://github.com/apache/ozone/pull/5535#discussion_r1389046120


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServlet.java:
##########
@@ -285,6 +286,57 @@ public void testEndpoint(String httpMethod) throws 
Exception {
         any(), any(), eq(toExcludeList), any(), any());
   }
 
+  @ParameterizedTest
+  @MethodSource("getHttpMethods")
+  public void testEndpointNotRatis(String httpMethod) throws Exception {
+    this.method = httpMethod;
+
+    conf.setBoolean(OZONE_ACL_ENABLED, false);
+    conf.set(OZONE_ADMINISTRATORS, OZONE_ADMINISTRATORS_WILDCARD);
+    conf.setBoolean(OZONE_OM_RATIS_ENABLE_KEY, false);
+
+    setupCluster();
+
+    final OzoneManager om = cluster.getOzoneManager();
+    doCallRealMethod().when(omDbCheckpointServletMock).initialize(
+        om.getMetadataManager().getStore(),
+        om.getMetrics().getDBCheckpointMetrics(),
+        om.getAclsEnabled(),
+        om.getOmAdminUsernames(),
+        om.getOmAdminGroups(),
+        om.isSpnegoEnabled());
+
+    doNothing().when(responseMock).setContentType("application/x-tar");
+    doNothing().when(responseMock).setHeader(anyString(), anyString());
+
+    List<String> toExcludeList = new ArrayList<>();
+    toExcludeList.add("sstFile1.sst");
+    toExcludeList.add("sstFile2.sst");
+
+    setupHttpMethod(toExcludeList);
+
+    when(responseMock.getOutputStream()).thenReturn(servletOutputStream);
+
+    omDbCheckpointServletMock.init();
+    long initialCheckpointCount =
+        omMetrics.getDBCheckpointMetrics().getNumCheckpoints();
+
+    doEndpoint();
+
+    Assertions.assertTrue(tempFile.length() > 0);
+    Assertions.assertTrue(
+        omMetrics.getDBCheckpointMetrics().
+            getLastCheckpointCreationTimeTaken() > 0);
+    Assertions.assertTrue(
+        omMetrics.getDBCheckpointMetrics().
+            getLastCheckpointStreamingTimeTaken() > 0);
+    Assertions.assertTrue(omMetrics.getDBCheckpointMetrics().
+        getNumCheckpoints() > initialCheckpointCount);
+
+    Mockito.verify(omDbCheckpointServletMock).writeDbDataToStream(any(),
+        any(), any(), eq(toExcludeList), any(), any());
+  }
+

Review Comment:
   Please do not duplicate the code from `testEndpoint()`.
   
   ```suggestion
     @ParameterizedTest
     @MethodSource("getHttpMethods")
     public void testEndpointNotRatis(String httpMethod) throws Exception {
       conf.setBoolean(OZONE_OM_RATIS_ENABLE_KEY, false);
       testEndpoint(httpMethod);
     }
   
   ```



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServlet.java:
##########
@@ -669,7 +669,9 @@ public BootstrapStateHandler.Lock lock()
       snapshotDeletingService.getBootstrapStateLock().lock();
 
       // Then wait for the double buffer to be flushed.
-      om.getOmRatisServer().getOmStateMachine().awaitDoubleBufferFlush();
+      if (om.isRatisEnabled()) {
+        om.getOmRatisServer().getOmStateMachine().awaitDoubleBufferFlush();
+      }

Review Comment:
   `OzoneManager.awaitDoubleBufferFlush()` handles both cases (Ratis 
enabled/disabled).
   
   ```suggestion
         om.awaitDoubleBufferFlush();
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to