You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by nn...@apache.org on 2022/04/07 16:24:56 UTC
[geode] branch develop updated: GEODE-10203: SerialVersionUID added. (#7529)
This is an automated email from the ASF dual-hosted git repository.
nnag pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 5a698f55e0 GEODE-10203: SerialVersionUID added. (#7529)
5a698f55e0 is described below
commit 5a698f55e0755381ac3eb0ed06fc10e98826d89a
Author: Nabarun Nag <na...@users.noreply.github.com>
AuthorDate: Thu Apr 7 09:24:48 2022 -0700
GEODE-10203: SerialVersionUID added. (#7529)
* SerialVersionUID added to GetClusterConfigurationFunction.
* Changes to this class will prevent breaking backward compatibility.
---
.../functions/GetClusterConfigurationFunction.java | 1 +
.../sanctioned-geode-core-serializables.txt | 2 +-
...sterConfigurationFunctionCompatibilityTest.java | 93 ++++++++++++++++++++++
3 files changed, 95 insertions(+), 1 deletion(-)
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/functions/GetClusterConfigurationFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/functions/GetClusterConfigurationFunction.java
index 44d47b6dbd..3df189e59f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/functions/GetClusterConfigurationFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/functions/GetClusterConfigurationFunction.java
@@ -27,6 +27,7 @@ import org.apache.geode.management.internal.configuration.messages.Configuration
public class GetClusterConfigurationFunction implements InternalFunction {
private static final Logger logger = LogService.getLogger();
+ private static final long serialVersionUID = 6332908511113951823L;
@Override
public void execute(FunctionContext context) {
diff --git a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
index db221f6f86..876ee223a0 100644
--- a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
+++ b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
@@ -448,7 +448,7 @@ org/apache/geode/management/internal/cli/functions/CacheRealizationFunction,true
org/apache/geode/management/internal/cli/functions/RebalanceFunction,true,1
org/apache/geode/management/internal/configuration/domain/SharedConfigurationStatus,false
org/apache/geode/management/internal/configuration/functions/DownloadJarFunction,true,1
-org/apache/geode/management/internal/configuration/functions/GetClusterConfigurationFunction,false
+org/apache/geode/management/internal/configuration/functions/GetClusterConfigurationFunction,true,6332908511113951823
org/apache/geode/management/internal/configuration/functions/GetRegionNamesFunction,false
org/apache/geode/management/internal/configuration/functions/RecreateCacheFunction,false
org/apache/geode/management/internal/configuration/messages/ClusterManagementServiceInfo,false,hostName:java/lang/String,httpPort:int,isSSL:boolean,isSecured:boolean
diff --git a/geode-core/src/upgradeTest/java/org/apache/geode/internal/cache/GetClusterConfigurationFunctionCompatibilityTest.java b/geode-core/src/upgradeTest/java/org/apache/geode/internal/cache/GetClusterConfigurationFunctionCompatibilityTest.java
new file mode 100644
index 0000000000..62f2a55303
--- /dev/null
+++ b/geode-core/src/upgradeTest/java/org/apache/geode/internal/cache/GetClusterConfigurationFunctionCompatibilityTest.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.AvailablePortHelper;
+import org.apache.geode.management.internal.configuration.functions.GetClusterConfigurationFunction;
+import org.apache.geode.test.dunit.rules.ClusterStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.version.TestVersion;
+import org.apache.geode.test.version.VersionManager;
+
+@RunWith(Parameterized.class)
+public class GetClusterConfigurationFunctionCompatibilityTest {
+
+ private final String oldVersion;
+
+ @Parameterized.Parameters(name = "Version: {0}")
+ public static Collection<String> data() {
+ final TestVersion OLDEST_VERSION_SUPPORTING_GET_CLUSTER_CONFIGURATION_FUNCTION =
+ TestVersion.valueOf("1.12.0");
+ List<String> result = VersionManager.getInstance().getVersionsWithoutCurrent();
+ result.removeIf(s -> TestVersion.valueOf(s)
+ .lessThan(OLDEST_VERSION_SUPPORTING_GET_CLUSTER_CONFIGURATION_FUNCTION));
+ return result;
+ }
+
+ public GetClusterConfigurationFunctionCompatibilityTest(String oldVersion) {
+ this.oldVersion = oldVersion;
+ }
+
+ @Rule
+ public ClusterStartupRule clusterStartupRule = new ClusterStartupRule();
+
+ /*
+ * The goal of the test is that GetClusterConfigurationFunction can be
+ * deserialized in the old versions members
+ * Changes to the class can cause the serialVersionUUID to change which
+ * can cause the serialization to fail in old members.
+ */
+ @Test
+ public void newLocatorCanGetClusterConfigurationFromOldLocator() {
+ // Start locators in old version
+ MemberVM locator1 = clusterStartupRule.startLocatorVM(0, oldVersion);
+ int locator1Port = locator1.getPort();
+ MemberVM locator2 =
+ clusterStartupRule.startLocatorVM(1, AvailablePortHelper.getRandomAvailableTCPPort(),
+ oldVersion, l -> l.withConnectionToLocator(locator1Port));
+ // Roll one locator to the new version
+ locator2.stop(false);
+ locator2 = clusterStartupRule.startLocatorVM(1, l -> l.withConnectionToLocator(locator1Port));
+ // Execute the function from the new locator
+ locator2.invoke(() -> {
+ Set<InternalDistributedMember> locators =
+ ClusterStartupRule.getCache().getDistributionManager().getLocatorDistributionManagerIds();
+ locators.forEach(locator -> {
+ FunctionService.onMember(locator).setArguments(new HashSet<>())
+ .execute(new GetClusterConfigurationFunction());
+ });
+ });
+ /*
+ * LogCheckers will detect the deserialization error in the logs and fail the
+ * test if it occurs.
+ */
+
+ }
+
+
+
+}