swamirishi commented on code in PR #8589:
URL: https://github.com/apache/ozone/pull/8589#discussion_r2221750254
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/WitnessedContainerMetadataStoreImpl.java:
##########
@@ -67,13 +74,53 @@ private
WitnessedContainerMetadataStoreImpl(ConfigurationSource config, boolean
@Override
protected DBStore initDBStore(DBStoreBuilder dbStoreBuilder,
ManagedDBOptions options, ConfigurationSource config)
throws RocksDatabaseException, CodecException {
+ previousVersionTables = new PreviousVersionTables();
+ previousVersionTables.addTables(dbStoreBuilder);
final DBStore dbStore = dbStoreBuilder.build();
- this.containerIdsTable =
this.getDbDef().getContainerIdsTable().getTable(dbStore);
+ previousVersionTables.init(dbStore);
+ this.containerCreateInfoTable =
this.getDbDef().getContainerCreateInfoTableDef().getTable(dbStore);
return dbStore;
}
@Override
- public Table<ContainerID, String> getContainerIdsTable() {
- return containerIdsTable;
+ public Table<ContainerID, ContainerCreateInfo> getContainerCreateInfoTable()
{
+ if
(!VersionedDatanodeFeatures.isFinalized(HDDSLayoutFeature.WITNESSED_CONTAINER_DB_PROTO_VALUE))
{
Review Comment:
Let us create a wrapper Table implementation which would automatically get
updated to the finalized table once the layout upgrade is finalized. We can
return the wrapped Table interface which would mean the caller of this method
can keep this value in memory and we wouldn't have to update anything on the
caller behaviour. Right now the caller is having to call
witnessedMetadataStore.getContainerCreateInfoTable().put or delete everytime we
can completely get this abstracted out.
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerSet.java:
##########
@@ -67,26 +69,28 @@ public class ContainerSet implements Iterable<Container<?>>
{
new ConcurrentSkipListMap<>();
private final Clock clock;
private long recoveringTimeout;
- private final Table<ContainerID, String> containerIdsTable;
+ @Nullable
+ private final WitnessedContainerMetadataStore metadataStore;
Review Comment:
nit:
```suggestion
private final WitnessedContainerMetadataStore containerMetadataStore;
```
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerSet.java:
##########
@@ -67,26 +69,28 @@ public class ContainerSet implements Iterable<Container<?>>
{
new ConcurrentSkipListMap<>();
private final Clock clock;
private long recoveringTimeout;
- private final Table<ContainerID, String> containerIdsTable;
+ @Nullable
+ private final WitnessedContainerMetadataStore metadataStore;
Review Comment:
Instead of passing WitnessedContainerMetadataStore we can pass an
implementation of a Table interface which would be writing to a particular
table WitnessedContainerMetadataStore based on what witnessedStore updates. We
can completely abstract this out so that the downstream users don't have to
understand the logic.
--
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]