geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zho...@apache.org
Subject [08/50] [abbrv] geode git commit: GEODE-3175 backward-compatibility tests fail with bad classpath
Date Sat, 29 Jul 2017 00:52:19 GMT
GEODE-3175 backward-compatibility tests fail with bad classpath

Checking in changes on a feature branch that remove current-version
product classes from the classpaths of JVMs running old versions
of Geode.


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/0e6dce76
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/0e6dce76
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/0e6dce76

Branch: refs/heads/feature/GEM-1483
Commit: 0e6dce76cb97cf3ac5f20eaaeeb130a4babd4212
Parents: b7db727
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
Authored: Thu Jul 13 10:49:02 2017 -0700
Committer: Bruce Schuchardt <bschuchardt@pivotal.io>
Committed: Tue Jul 25 08:19:47 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/geode/internal/Version.java | 13 +----
 .../tier/sockets/ServerHandShakeProcessor.java  |  3 +-
 .../geode/test/dunit/standalone/ChildVM.java    |  8 ++-
 .../test/dunit/standalone/ProcessManager.java   | 60 +++++++++++---------
 4 files changed, 43 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/0e6dce76/geode-core/src/main/java/org/apache/geode/internal/Version.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/Version.java b/geode-core/src/main/java/org/apache/geode/internal/Version.java
index 3064c4c..39e3a3f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/Version.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/Version.java
@@ -180,11 +180,14 @@ public class Version implements Comparable<Version> {
   public static final Version GFE_90 =
       new Version("GFE", "9.0", (byte) 9, (byte) 0, (byte) 0, (byte) 0, GFE_90_ORDINAL);
 
+  // prior to v1.2.0 GEODE_110 was named GFE_91. This was used for both the rel/v1.1.0
+  // and rel/v1.1.1 releases
   private static final byte GEODE_110_ORDINAL = 50;
 
   public static final Version GEODE_110 =
       new Version("GEODE", "1.1.0", (byte) 1, (byte) 1, (byte) 0, (byte) 0, GEODE_110_ORDINAL);
 
+  // This ordinal was never used
   private static final byte GEODE_111_ORDINAL = 55;
 
   public static final Version GEODE_111 =
@@ -206,8 +209,6 @@ public class Version implements Comparable<Version> {
    */
   public static final short CURRENT_ORDINAL = CURRENT.ordinal();
 
-  public static final short NOT_SUPPORTED_ORDINAL = 59;
-
   /**
    * version ordinal for test Backward compatibility.
    */
@@ -246,14 +247,6 @@ public class Version implements Comparable<Version> {
   /** Return the <code>Version</code> represented by specified ordinal */
   public static Version fromOrdinal(short ordinal, boolean forGFEClients)
       throws UnsupportedVersionException {
-    // Un-version client(client's prior to release 5.7) doesn't send version
-    // byte in the handshake. So the next byte in the handshake has value 59 and
-    // is interpreted as version byte. We are not supporting version 59 to
-    // distinguish version client from unversion. Please use version ordinal 60
-    // after 58 if required.
-    if (ordinal == NOT_SUPPORTED_ORDINAL) {
-      throw new UnsupportedVersionException("Un-versioned clients are not supported. ");
-    }
     if (ordinal == TOKEN_ORDINAL) {
       return TOKEN;
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/0e6dce76/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerHandShakeProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerHandShakeProcessor.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerHandShakeProcessor.java
index 8b89694..47e6f3d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerHandShakeProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerHandShakeProcessor.java
@@ -374,8 +374,7 @@ public class ServerHandShakeProcessor {
         clientVersion = Version.fromOrdinal(clientVersionOrdinal, true);
       } catch (UnsupportedVersionException uve) {
         // Allows higher version of wan site to connect to server
-        if (connection.getCommunicationMode() == Acceptor.GATEWAY_TO_GATEWAY
-            && !(clientVersionOrdinal == Version.NOT_SUPPORTED_ORDINAL)) {
+        if (connection.getCommunicationMode() == Acceptor.GATEWAY_TO_GATEWAY) {
           return Acceptor.VERSION;
         } else {
           SocketAddress sa = socket.getRemoteSocketAddress();

http://git-wip-us.apache.org/repos/asf/geode/blob/0e6dce76/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ChildVM.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ChildVM.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ChildVM.java
index d54f3d0..b14ff1d 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ChildVM.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ChildVM.java
@@ -49,8 +49,8 @@ public class ChildVM {
       int pid = OSProcess.getId();
       logger.info("VM" + vmNum + " is launching" + (pid > 0 ? " with PID " + pid : ""));
       if (!VersionManager.isCurrentVersion(geodeVersion)) {
-        logger.info("This VM is using Geode version {}. Version.CURRENT is {}", geodeVersion,
-            Version.CURRENT);
+        logger.info("This VM is using Geode version {}. Version.CURRENT is {} (ordinal={})",
+            geodeVersion, Version.CURRENT, Version.CURRENT_ORDINAL);
       }
       MasterRemote holder = (MasterRemote) Naming
           .lookup("//localhost:" + namingPort + "/" + DUnitLauncher.MASTER_PARAM);
@@ -67,8 +67,10 @@ public class ChildVM {
         Thread.sleep(1000);
       }
     } catch (Throwable t) {
-      t.printStackTrace();
+      logger.info("VM is exiting with error", t);
       System.exit(1);
+    } finally {
+      logger.info("VM is exiting");
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/0e6dce76/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
index 98b27a6..9a0ce86 100755
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
@@ -20,6 +20,7 @@ import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
 import org.apache.commons.io.FileUtils;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.InternalLocator;
+import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 
 import java.io.BufferedReader;
@@ -30,6 +31,7 @@ import java.io.InputStreamReader;
 import java.io.PrintStream;
 import java.lang.management.ManagementFactory;
 import java.lang.management.RuntimeMXBean;
+import java.net.InetAddress;
 import java.nio.file.Files;
 import java.rmi.AccessException;
 import java.rmi.NotBoundException;
@@ -90,12 +92,17 @@ public class ProcessManager {
     }
 
     // TODO - delete directory contents, preferably with commons io FileUtils
-    Process process = Runtime.getRuntime().exec(cmd, null, workingDir);
-    pendingVMs++;
-    ProcessHolder holder = new ProcessHolder(process);
-    processes.put(vmNum, holder);
-    linkStreams(version, vmNum, holder, process.getErrorStream(), System.err);
-    linkStreams(version, vmNum, holder, process.getInputStream(), System.out);
+    try {
+      Process process = Runtime.getRuntime().exec(cmd, null, workingDir);
+      pendingVMs++;
+      ProcessHolder holder = new ProcessHolder(process);
+      processes.put(vmNum, holder);
+      linkStreams(version, vmNum, holder, process.getErrorStream(), System.err);
+      linkStreams(version, vmNum, holder, process.getInputStream(), System.out);
+    } catch (RuntimeException | Error t) {
+      t.printStackTrace();
+      throw t;
+    }
   }
 
   public void validateVersion(String version) {
@@ -133,6 +140,7 @@ public class ProcessManager {
       ProcessHolder holder = processes.remove(vmNum);
       holder.kill();
       holder.getProcess().waitFor();
+      System.out.println("Old process for vm_" + vmNum + " has exited");
       launchVM(version, vmNum, true);
     } catch (InterruptedException | IOException e) {
       throw new RuntimeException("Unable to restart VM " + vmNum, e);
@@ -141,10 +149,11 @@ public class ProcessManager {
 
   private void linkStreams(final String version, final int vmNum, final ProcessHolder holder,
       final InputStream in, final PrintStream out) {
+    final String vmName = "[" + VM.getVMName(version, vmNum) + "] ";
+    System.out.println("linking IO streams for " + vmName);
     Thread ioTransport = new Thread() {
       public void run() {
         BufferedReader reader = new BufferedReader(new InputStreamReader(in));
-        String vmName = "[" + VM.getVMName(version, vmNum) + "] ";
         try {
           String line = reader.readLine();
           while (line != null) {
@@ -178,25 +187,24 @@ public class ProcessManager {
       classPath = dunitClasspath;
     } else {
       // remove current-version product classes and resources from the classpath
-      // String buildDir = separator + "geode-core" + separator + "build" + separator;
-      //
-      // String mainClasses = buildDir + "classes" + separator + "main";
-      // dunitClasspath = removeFromPath(dunitClasspath, mainClasses);
-      //
-      // String mainResources = buildDir + "resources" + separator + "main";
-      // dunitClasspath = removeFromPath(dunitClasspath, mainResources);
-      //
-      // String generatedResources = buildDir + "generated-resources" + separator + "main";
-      // dunitClasspath = removeFromPath(dunitClasspath, generatedResources);
-      //
-      // buildDir = separator + "geode-common" + separator + "build" + separator + "classes"
-      // + separator + "main";
-      // dunitClasspath = removeFromPath(dunitClasspath, buildDir);
-      //
-      // buildDir = separator + "geode-json" + separator + "build" + separator + "classes"
+
-      // separator
-      // + "main";
-      // dunitClasspath = removeFromPath(dunitClasspath, buildDir);
+      String buildDir = separator + "geode-core" + separator + "build" + separator;
+
+      String mainClasses = buildDir + "classes" + separator + "main";
+      dunitClasspath = removeFromPath(dunitClasspath, mainClasses);
+
+      String mainResources = buildDir + "resources" + separator + "main";
+      dunitClasspath = removeFromPath(dunitClasspath, mainResources);
+
+      String generatedResources = buildDir + "generated-resources" + separator + "main";
+      dunitClasspath = removeFromPath(dunitClasspath, generatedResources);
+
+      buildDir = separator + "geode-common" + separator + "build" + separator + "classes"
+          + separator + "main";
+      dunitClasspath = removeFromPath(dunitClasspath, buildDir);
+
+      buildDir = separator + "geode-json" + separator + "build" + separator + "classes" +
separator
+          + "main";
+      dunitClasspath = removeFromPath(dunitClasspath, buildDir);
 
       classPath = versionManager.getClasspath(version) + File.pathSeparator + dunitClasspath;
     }


Mime
View raw message