swamirishi commented on code in PR #8589:
URL: https://github.com/apache/ozone/pull/8589#discussion_r2145315033


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/WitnessedContainerMetadataStoreImpl.java:
##########
@@ -64,13 +71,53 @@ private 
WitnessedContainerMetadataStoreImpl(ConfigurationSource config, boolean
   @Override
   protected DBStore initDBStore(DBStoreBuilder dbStoreBuilder, 
ManagedDBOptions options, ConfigurationSource config)
       throws IOException {
+    previousVersionBasedTable = new PreviousVersionBasedTable();
+    previousVersionBasedTable.addTables(dbStoreBuilder);
     final DBStore dbStore = dbStoreBuilder.build();
+    previousVersionBasedTable.init(dbStore);
     this.containerIdsTable = 
this.getDbDef().getContainerIdsTable().getTable(dbStore);
     return dbStore;
   }
 
   @Override
-  public Table<ContainerID, String> getContainerIdsTable() {
+  public Table<ContainerID, ContainerCreateInfo> getContainerIdsTable() {
+    if 
(!VersionedDatanodeFeatures.isFinalized(HDDSLayoutFeature.WITNESSED_CONTAINER_DB_PROTO_VALUE))
 {
+      return previousVersionBasedTable.getContainerIdsTable();
+    }
     return containerIdsTable;
   }
+
+  public PreviousVersionBasedTable getPreviousVersionBasedTable() {

Review Comment:
   How about having a TreeMap loading different defnitions based on the current 
software layout version for initializing the store? 
   NavigableMap.floorEntry(currentSoftwareLayoutVersion) can give the right 
definition.
   I believe this can be present in WitnessedCOntainerDBDefinition that could 
just return the correct definition based on the version.
   This would be a much cleaner implementation. WitnessedContainerDBStore could 
be the same after this then.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/WitnessedContainerDBDefinition.java:
##########
@@ -62,7 +61,7 @@ public String getLocationConfigKey() {
     return ScmConfigKeys.OZONE_SCM_DATANODE_ID_DIR;
   }
 
-  DBColumnFamilyDefinition<ContainerID, String> getContainerIdsTable() {
+  DBColumnFamilyDefinition<ContainerID, ContainerCreateInfo> 
getContainerIdsTable() {

Review Comment:
   This constructor can initialize from the map of Definitions.
   ```suggestion
     DBColumnFamilyDefinition<ContainerID, ContainerCreateInfo> 
getContainerIdsTable() {
         super(COLUMN_FAMILIES);
     }
   ```



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerSet.java:
##########
@@ -247,6 +250,16 @@ private boolean removeContainer(long containerId, boolean 
markMissing, boolean r
     }
   }
 
+  private void deleteContainerTable(long containerId) throws 
StorageContainerException {

Review Comment:
   Can we rename this method. Maybe deleteFromContainerTable or 
removeContainerTableEntry()



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