dombizita commented on code in PR #10777:
URL: https://github.com/apache/ozone/pull/10777#discussion_r3686808817
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/upgrade/OMStartFinalizeUpgradeRequest.java:
##########
@@ -94,8 +118,42 @@ public OMClientResponse validateAndUpdateCache(OzoneManager
ozoneManager, Execut
response = new
OMStartFinalizeUpgradeResponse(createErrorOMResponse(responseBuilder, e));
}
- markForAudit(auditLogger, buildAuditMessage(OMAction.UPGRADE_FINALIZE, new
HashMap<>(), exception, userInfo));
+ Map<String, String> auditMap = new HashMap<>();
+ auditMap.put("force",
String.valueOf(getOmRequest().getStartFinalizeUpgradeRequest().getForce()));
+ markForAudit(auditLogger, buildAuditMessage(OMAction.UPGRADE_FINALIZE,
auditMap, exception, userInfo));
return response;
}
+ private static void validatePeerOmVersionsBeforeFinalize(List<OMNodeDetails>
peerNodes,
+ OzoneConfiguration configuration) throws OMException {
+ if (peerNodes.isEmpty()) {
+ return;
+ }
+ OzoneManagerVersion leaderVersion = OzoneManagerVersion.SOFTWARE_VERSION;
+ List<String> failedPeers = new ArrayList<>();
+ for (OMNodeDetails peerDetails : peerNodes) {
+ String peerId = peerDetails.getNodeId();
+ OMAdminProtocolClientSideImpl client = null;
+ try {
+ client =
OMAdminProtocolClientSideImpl.createProxyForSingleOM(configuration,
getRemoteUser(), peerDetails);
+ OzoneManagerVersion peerVersion = client.getPeerUpgradeStatus();
+ if (!peerVersion.equals(leaderVersion)) {
+ LOG.warn("OM peer {} is running software version {} but leader is
running version {}. "
+ + "Rejecting finalize command.", peerId, peerVersion,
leaderVersion);
+ failedPeers.add(peerId + " (version: " + peerVersion + ")");
+ }
+ } catch (IOException e) {
+ LOG.warn("Failed to contact OM peer {} to check software version
before finalize.", peerId, e);
+ failedPeers.add(peerId + " (unreachable: " + e.getMessage() + ")");
+ } finally {
+ IOUtils.cleanupWithLogger(LOG, client);
+ }
+ }
+ if (!failedPeers.isEmpty()) {
+ throw new OMException("Finalize rejected: the following OM peers did not
confirm matching software version "
+ + "(expected version=" + leaderVersion + "): " + String.join(", ",
failedPeers),
+ OMException.ResultCodes.NOT_SUPPORTED_OPERATION);
Review Comment:
Reading it through again, it makes sense to leave it this way.
--
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]