sodonnel commented on code in PR #4655:
URL: https://github.com/apache/ozone/pull/4655#discussion_r1199101781
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/AbstractContainerReportHandler.java:
##########
@@ -370,6 +384,26 @@ private void updateContainerReplica(final DatanodeDetails
datanodeDetails,
}
}
+ /**
+ * Determines whether container replica is empty or not.
+ *
+ * @param replicaProto container replica details.
+ * @return true if container replica is empty else false
+ */
+ private boolean fillEmpty(final ContainerReplicaProto replicaProto) {
+ if (replicaProto.hasIsEmpty()) {
+ return replicaProto.getIsEmpty();
+ } else {
+ // Handled when DN version is old then there will not be isEmpty field.
+ // In this case judge container empty based on keyCount
+ // and bytesUsed field.
+ if (replicaProto.getKeyCount() == 0 && replicaProto.getUsed() == 0) {
+ return true;
+ }
Review Comment:
What about when we do support rolling upgrades? Someone may be on a version
where the DNs don't have the new field and then jump to a future version that
does support rolling upgrades. IMO it is safer to try to be compatible, rather
than saying "we don't support that" as that support may change. There have been
quite a few places in the code where I have seen this sort of compatibility
code, and I think it starts a dangerous precedent if we are not saying we don't
need to do it.
--
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]