You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/09/07 22:17:10 UTC

[GitHub] [hadoop-ozone] avijayanhwx commented on a change in pull request #1393: HDDS-4143. Implement a factory for OM Requests that returns an instance based on layout version.

avijayanhwx commented on a change in pull request #1393:
URL: https://github.com/apache/hadoop-ozone/pull/1393#discussion_r484576560



##########
File path: hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/upgrade/TestOMVersionManager.java
##########
@@ -54,11 +61,39 @@ public void testOMLayoutVersionManager() throws IOException {
     assertEquals(2, omVersionManager.getMetadataLayoutVersion());
   }
 
+  @Test
+  public void testOMLayoutVersionManagerInitError() {
+    OMStorage omStorage = mock(OMStorage.class);
+    when(omStorage.getLayoutVersion()).thenReturn(
+        OMLayoutFeature.values()[OMLayoutFeature.values().length - 1]
+            .layoutVersion() + 1);
+    try {
+      OMLayoutVersionManager.initialize(omStorage);
+      Assert.fail();
+    } catch (OMException ex) {
+      assertEquals(NOT_SUPPORTED_OPERATION, ex.getResult());
+    }
+  }
+
+  @Test
+  public void testOMLayoutVersionManagerReset() throws IOException {

Review comment:
       @linyiqun That was done just for testing purposes. In the future, we may move away from "static" Version Manager class, and that time we can remove this. 

##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerRequestHandler.java
##########
@@ -290,6 +292,11 @@ public void validateRequest(OMRequest omRequest) throws OMException {
       throw new OMException("ClientId is null",
           OMException.ResultCodes.INVALID_REQUEST);
     }
+
+    if (omRequest.getLayoutVersion() == null) {

Review comment:
       Sure, will add.




----------------------------------------------------------------
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.

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



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