errose28 commented on a change in pull request #1298:
URL: https://github.com/apache/hadoop-ozone/pull/1298#discussion_r469425566



##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/helpers/KeyValueContainerUtil.java
##########
@@ -91,8 +83,16 @@ public static void createContainerMetaData(File 
containerMetaDataPath, File
           " Path: " + chunksPath);
     }
 
-    MetadataStore store = MetadataStoreBuilder.newBuilder().setConf(conf)
-        .setCreateIfMissing(true).setDbFile(dbFile).build();
+    DatanodeStore store;
+    if (schemaVersion.equals(OzoneConsts.SCHEMA_V1)) {
+      store = new DatanodeStoreSchemaOneImpl(conf, dbFile.getAbsolutePath());
+    } else if (schemaVersion.equals(OzoneConsts.SCHEMA_V2)) {
+      store = new DatanodeStoreSchemaTwoImpl(conf, dbFile.getAbsolutePath());
+    } else {
+      throw new IllegalArgumentException(
+              "Unrecognized schema version for container: " + schemaVersion);
+    }

Review comment:
       The latest version was always being passed in by 
KeyValueContainer#create (the only place this method is called), but it uses 
the OzoneConsts.SCHEMA_LATEST variable to make sure that the latest version is 
always used for new containers. If this parameter is omitted, we will need to 
hardcode the current latest DatanodeStore implementation here and remember to 
update it on change. Probably best to leave as is so that if a new version is 
added and this method is not updated, an IllegalArgumentException is thrown.




----------------------------------------------------------------
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:
us...@infra.apache.org



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

Reply via email to