ptlrs commented on code in PR #12139:
URL: https://github.com/apache/ozone/pull/12139#discussion_r4764195410
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerSet.java:
##########
@@ -226,14 +259,30 @@ private boolean addContainer(Container<?> container,
boolean overwrite) throws
}
}
- private void updateContainerIdTable(long containerId, ContainerData
containerData) throws StorageContainerException {
+ /**
+ * Records the replica that is being added in the witnessed container DB.
The entry is written when:
+ * <ul>
+ * <li>there is none: this is the first replica of the container on this
datanode;</li>
+ * <li>it is DELETED: this datanode deleted its replica, and now loads one
from disk at startup or gets one through
+ * repair. An ordinary create does not get here for a DELETED entry,
KeyValueHandler refuses it;</li>
+ * <li>it has no replica index: it was written in the older table
format;</li>
+ * <li>{@code replaceReplicaIndex} is set and the replica has another
index than the entry: a repair replaces the
+ * replica that this datanode held.</li>
+ * </ul>
+ * In all other cases the entry is kept as it is.
+ */
+ private void updateContainerIdTable(long containerId, ContainerData
containerData, boolean replaceReplicaIndex)
+ throws StorageContainerException {
if (null != containerMetadataStore) {
try {
ContainerID containerIdObj = ContainerID.valueOf(containerId);
Table<ContainerID, ContainerCreateInfo> containerCreateInfoTable =
containerMetadataStore.getContainerCreateInfoTable();
ContainerCreateInfo containerCreateInfo =
containerCreateInfoTable.get(containerIdObj);
- if (containerCreateInfo == null ||
containerCreateInfo.getReplicaIndex() == INVALID_REPLICA_INDEX) {
+ if (containerCreateInfo == null
+ || containerCreateInfo.getState() == State.DELETED
Review Comment:
>But with this change, it will always update current EC replica comming
first time during startup. Next duplicate replica with different index can not
be determined
@sumitagrawl can you please explain the concern again here and under which
scenario the concern arises? Specifically, what is the state of the concerned
container in the witness db in your scenario and what are the replicas
available on-disk and their states? This will help me understand your concern
better.
With the new changes in this PR, we will update the replica index when we
start recovering a container.
Upon restart of a DN, this recovered container will be loaded, unless it
failed recovery. In case of recovery failure, no replica will be loaded even if
the previously valid replica is now available as we load only the replica that
has the same replica index in the witness db. This can be a downside as we
don't load a valid replica and can't load the partially recovered replica whose
entry is in the witness db. One future improvement can be to update the witness
db only after successfully recovering a container.
Are we saying this current behaviour is not valid or is there some other
scenario of concern here?
--
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]