geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasonhu...@apache.org
Subject [geode] branch develop updated: GEODE-4703: Prevent sending RemoveCacheServerProfileMessage to older members (#1468)
Date Fri, 23 Feb 2018 17:43:24 GMT
This is an automated email from the ASF dual-hosted git repository.

jasonhuynh 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 1d1bc3b  GEODE-4703: Prevent sending RemoveCacheServerProfileMessage to older members
(#1468)
1d1bc3b is described below

commit 1d1bc3b25dc82412edaf127e5f0e55cee924df6e
Author: Jason Huynh <huynhja@gmail.com>
AuthorDate: Fri Feb 23 09:43:20 2018 -0800

    GEODE-4703: Prevent sending RemoveCacheServerProfileMessage to older members (#1468)
---
 .../geode/internal/cache/GemFireCacheImpl.java     | 13 +++++++
 .../cache/wan/WANRollingUpgradeDUnitTest.java      | 42 ++++++++++++++++++++++
 2 files changed, 55 insertions(+)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index efb6f07..6efb94c 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -175,6 +175,7 @@ import org.apache.geode.i18n.LogWriterI18n;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.ClassPathLoader;
 import org.apache.geode.internal.SystemTimer;
+import org.apache.geode.internal.Version;
 import org.apache.geode.internal.cache.backup.BackupService;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
 import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceType;
@@ -4575,6 +4576,18 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache,
Has
     Set otherMembers = this.dm.getOtherDistributionManagerIds();
     RemoveCacheServerProfileMessage message = new RemoveCacheServerProfileMessage();
     message.operateOnLocalCache(this);
+
+    // Remove this while loop when we release GEODE 2.0
+    // This block prevents sending a message to old members that do not know about
+    // the RemoveCacheServerProfileMessage
+    Iterator memberIterator = otherMembers.iterator();
+    while (memberIterator.hasNext()) {
+      InternalDistributedMember member = (InternalDistributedMember) memberIterator.next();
+      if (Version.GEODE_150.compareTo(member.getVersionObject()) > 0) {
+        memberIterator.remove();
+      }
+    }
+
     if (!otherMembers.isEmpty()) {
       if (logger.isDebugEnabled()) {
         logger.debug("Sending add cache server profile message to other members.");
diff --git a/geode-wan/src/test/java/org/apache/geode/cache/wan/WANRollingUpgradeDUnitTest.java
b/geode-wan/src/test/java/org/apache/geode/cache/wan/WANRollingUpgradeDUnitTest.java
index 8b4a0d3..e2dc99c 100644
--- a/geode-wan/src/test/java/org/apache/geode/cache/wan/WANRollingUpgradeDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/cache/wan/WANRollingUpgradeDUnitTest.java
@@ -664,6 +664,48 @@ public class WANRollingUpgradeDUnitTest extends JUnit4CacheTestCase {
     assertEquals(0, remoteServer1EventsReceived + remoteServer2EventsReceived);
   }
 
+  @Test
+  public void testVerifyGatewayReceiverDoesNotSendRemoveCacheServerProfileToMembersOlderThan1dot5()
+      throws Exception {
+    final Host host = Host.getHost(0);
+    VM oldLocator = host.getVM(oldVersion, 0);
+    VM oldServer = host.getVM(oldVersion, 1);
+    VM currentServer = host.getVM(VersionManager.CURRENT_VERSION, 2);
+
+    // Start locator
+    final int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+    DistributedTestUtils.deleteLocatorStateFile(port);
+    final String locators = NetworkUtils.getServerHostName(host) + "[" + port + "]";
+    oldLocator.invoke(() -> startLocator(port, 0, locators, ""));
+
+    IgnoredException ie =
+        IgnoredException.addIgnoredException("could not get remote locator information");
+    try {
+      // Start old server
+      oldServer.invoke(() -> createCache(locators));
+
+      // Locators before 1.4 handled configuration asynchronously.
+      // We must wait for configuration configuration to be ready, or confirm that it is
disabled.
+      oldLocator.invoke(
+          () -> Awaitility.await().atMost(65, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS)
+              .until(() -> assertTrue(
+                  !InternalLocator.getLocator().getConfig().getEnableClusterConfiguration()
+                      || InternalLocator.getLocator().isSharedConfigurationRunning())));
+
+      oldServer.invoke(() -> createGatewayReceiver());
+
+      currentServer.invoke(() -> createCache(locators));
+
+      currentServer.invoke(() -> createGatewayReceiver());
+      currentServer.invoke(() -> getCache().getGatewayReceivers().forEach(r -> {
+        r.stop();
+        r.destroy();
+      }));
+    } finally {
+      ie.remove();
+    }
+  }
+
   private void createCache(String locators) {
     Properties props = new Properties();
     props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");

-- 
To stop receiving notification emails like this one, please contact
jasonhuynh@apache.org.

Mime
View raw message