This is an automated email from the ASF dual-hosted git repository.
errose28 pushed a commit to branch HDDS-14496-zdu
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/HDDS-14496-zdu by this push:
new 25495e1a9f5 HDDS-16190. Do not use unified version framework in OM
until ZDU is finalized. (#11025)
25495e1a9f5 is described below
commit 25495e1a9f5669736c27445242732145e80a7971
Author: Ethan Rose <[email protected]>
AuthorDate: Tue Aug 25 12:52:14 2026 -0400
HDDS-16190. Do not use unified version framework in OM until ZDU is
finalized. (#11025)
---
.../hadoop/ozone/om/TestOMUpgradeFinalization.java | 63 ++++++++++++++++++++++
.../org/apache/hadoop/ozone/om/OzoneManager.java | 8 ++-
2 files changed, 66 insertions(+), 5 deletions(-)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMUpgradeFinalization.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMUpgradeFinalization.java
index e4765dd65f4..086416f85d5 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMUpgradeFinalization.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMUpgradeFinalization.java
@@ -28,8 +28,10 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.IOException;
+import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.conf.StorageUnit;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
@@ -41,6 +43,7 @@
import org.apache.hadoop.ozone.client.OzoneBucket;
import org.apache.hadoop.ozone.client.OzoneClient;
import org.apache.hadoop.ozone.conf.OMClientConfig;
+import org.apache.hadoop.ozone.om.helpers.ServiceInfo;
import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol;
import org.apache.hadoop.ozone.om.ratis.OzoneManagerRatisServer;
import org.apache.hadoop.ozone.upgrade.RatisBasedVersionManager;
@@ -204,6 +207,66 @@ void testOmFinalizationStatusTransitions() throws
Exception {
}
}
+ /**
+ * The OM version advertised in its {@link ServiceInfo} should track
+ * {@code getVersionForClient()} across finalization: the last pre-ZDU client
+ * version before ZDU is finalized, and the software version after.
+ *
+ * On an HA cluster every OM should report the same client-facing version,
both
+ * for itself and for its peers, in every OM's {@code getServiceList()}.
+ */
+ @Test
+ void testServiceInfoOmVersionTracksClientVersion() throws Exception {
+ OzoneConfiguration conf = new OzoneConfiguration();
+ conf.set(OMConfigKeys.OZONE_OM_UPGRADE_FINALIZATION_CHECK_INTERVAL,
"10ms");
+ conf.setInt(OMStorage.TESTING_INIT_APPARENT_VERSION_KEY,
INITIAL_VERSION.serialize());
+
+ MiniOzoneHAClusterImpl.Builder builder =
MiniOzoneCluster.newHABuilder(conf);
+ builder.setOMServiceId(UUID.randomUUID().toString())
+ .setNumOfOzoneManagers(3)
+ .setNumOfActiveOMs(3)
+ .withoutDatanodes();
+ try (MiniOzoneHAClusterImpl cluster = builder.build()) {
+ cluster.waitForClusterToBeReady();
+
+ try (OzoneClient client = cluster.newClient()) {
+ OzoneManagerProtocol omClient =
client.getObjectStore().getClientProxy().getOzoneManagerClient();
+
+ // Every OM is pre-finalized for ZDU. The version returned to clients
should reflect the last software
+ // version before ZDU to remain compatible with the old version
framework.
+ assertAllOmServiceInfoVersions(cluster,
OzoneManagerVersion.S3_BUCKET_TAGGING_API);
+
+ omClient.finalizeUpgrade();
+ OMUpgradeTestUtils.waitForFinalization(omClient);
+ for (OzoneManager om : cluster.getOzoneManagersList()) {
+ waitFor(() -> !om.getVersionManager().needsFinalization(), 100,
30000);
+ }
+
+ // After finalization: every OM advertises the software version for
all three OMs.
+ assertAllOmServiceInfoVersions(cluster,
OzoneManagerVersion.SOFTWARE_VERSION);
+ }
+ }
+ }
+
+ /**
+ * Assert that, from every OM's {@code getServiceList()}, all three OM
entries report {@code expected}.
+ */
+ private static void assertAllOmServiceInfoVersions(MiniOzoneHAClusterImpl
cluster, OzoneManagerVersion expected)
+ throws IOException {
+ for (OzoneManager om : cluster.getOzoneManagersList()) {
+ assertEquals(expected, om.getVersionManager().getVersionForClient());
+
+ List<OzoneManagerVersion> omVersions = om.getServiceList().stream()
+ .filter(info -> info.getNodeType() == HddsProtos.NodeType.OM)
+ .map(info ->
OzoneManagerVersion.deserialize(info.getProtobuf().getOMVersion()))
+ .collect(Collectors.toList());
+ assertEquals(3, omVersions.size());
+ for (OzoneManagerVersion version : omVersions) {
+ assertEquals(expected, version);
+ }
+ }
+ }
+
private static MiniOzoneHAClusterImpl newCluster(OzoneConfiguration conf)
throws IOException {
conf.setInt(OMStorage.TESTING_INIT_APPARENT_VERSION_KEY,
INITIAL_VERSION.serialize());
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
index 1ce57e7c0df..a8ce1e53508 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
@@ -3305,7 +3305,7 @@ public List<ServiceInfo> getServiceList() throws
IOException {
ServiceInfo.Builder omServiceInfoBuilder = ServiceInfo.newBuilder()
.setNodeType(HddsProtos.NodeType.OM)
.setHostname(omRpcAddress.getHostName())
- .setOmVersion(OzoneManagerVersion.SOFTWARE_VERSION)
+ .setOmVersion(versionManager.getVersionForClient())
.addServicePort(ServicePort.newBuilder()
.setType(ServicePort.Type.RPC)
.setValue(omRpcAddress.getPort())
@@ -3366,10 +3366,8 @@ public List<ServiceInfo> getServiceList() throws
IOException {
ServiceInfo.Builder peerOmServiceInfoBuilder = ServiceInfo.newBuilder()
.setNodeType(HddsProtos.NodeType.OM)
.setHostname(peerNode.getHostName())
- // For now assume peer is at the same version.
- // This field needs to be fetched from peer when rolling upgrades
- // are implemented.
- .setOmVersion(OzoneManagerVersion.SOFTWARE_VERSION)
+ // OM version is set through Ratis on finalization, so we can assume
peers have the same version.
+ .setOmVersion(versionManager.getVersionForClient())
.addServicePort(ServicePort.newBuilder()
.setType(ServicePort.Type.RPC)
.setValue(peerNode.getRpcPort())
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]