ChenSammi commented on code in PR #11370:
URL: https://github.com/apache/ozone/pull/11370#discussion_r4216489195
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -2564,15 +2563,45 @@ private void setUpdatedContainerLocation(OmKeyInfo
keyInfo,
for (OmKeyLocationInfo omKeyLocationInfo : omKeyLocationInfoList) {
Pipeline pipeline = containerLocations.get(
omKeyLocationInfo.getContainerID());
- if (pipeline != null &&
- !pipeline.equals(omKeyLocationInfo.getPipeline())) {
+ if (pipeline != null && !pipelineMatchesLocation(pipeline,
omKeyLocationInfo)) {
omKeyLocationInfo.setPipeline(pipeline);
}
}
}
}
}
+ /**
+ * Returns true when {@code candidate} carries the same pipeline information
+ * as the pipeline currently stored in {@code info}, including the
+ * currentVersion of every member datanode.
+ *
+ * {@link Pipeline#equals} only compares node UUIDs, so it cannot detect
+ * a version-only upgrade where topology is unchanged but the datanodes now
+ * advertise a higher wire-protocol version. Without this check, OM would
+ * keep serving stale DN currentVersion values to clients even after SCM
+ * returns an updated pipeline.
+ */
+ private static boolean pipelineMatchesLocation(Pipeline candidate,
OmKeyLocationInfo info) {
Review Comment:
Good point.
--
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]