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


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerLayoutVersion.java:
##########
@@ -50,8 +52,10 @@ public File getChunkFile(File chunkDir, BlockID blockID, 
String chunkName) {
   private static final ContainerLayoutVersion
       DEFAULT_LAYOUT = ContainerLayoutVersion.FILE_PER_BLOCK;
 
+  // make an immutable copy of values but remove FILE_PER_CHUNK.
   private static final List<ContainerLayoutVersion> CONTAINER_LAYOUT_VERSIONS =
-      ImmutableList.copyOf(values());
+      ImmutableList.copyOf(Arrays.stream(values()).filter(
+          v -> v != FILE_PER_CHUNK).toArray(ContainerLayoutVersion[]::new));

Review Comment:
   Enum can be filtered more easily:
   
   ```java
         EnumSet.complementOf(EnumSet.of(FILE_PER_CHUNK))
   ```



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -383,6 +383,14 @@ ContainerCommandResponseProto handleCreateContainer(
 
     ContainerLayoutVersion layoutVersion =
         ContainerLayoutVersion.getConfiguredVersion(conf);
+    if (layoutVersion == ContainerLayoutVersion.FILE_PER_CHUNK) {
+      try {
+        throw new StorageContainerException("FILE_PER_CHUNK layout is 
deprecated.",
+            UNSUPPORTED_REQUEST);
+      } catch (StorageContainerException ex) {
+        return ContainerUtils.logAndReturnError(LOG, ex, request);
+      }
+    }

Review Comment:
   I think we should check the config at datanode startup instead of container 
creation.



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