GEODE-2137 client membership IDs contain 17 bytes of useless information

Reverting the removal of UUIDs from fully serialized member IDs.  There is
administration code that caches serialized events containing these IDs.
The cached form is transmitted between nodes without regard to versioning
so it is impossible to track the chain of custody and know how to properly
deserialize a 1.1.0 ID with this change.  Version support needs to be
extended to CachedDeserializable classes if we're going to make this sort
of change, so that they know how to properly deserialize an object of
a versioned class.

Removal of UUIDs is still in effect for the compact form of membership ID
used in version tags and elsewhere since this information is not held in
serialized form in cache regions.


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

Branch: refs/heads/develop
Commit: 59702a6e099abe2400b69e0aec7fe322c87d9fec
Parents: b31c684
Author: Bruce Schuchardt <bschucha...@pivotal.io>
Authored: Mon Jan 23 11:32:38 2017 -0800
Committer: Bruce Schuchardt <bschucha...@pivotal.io>
Committed: Tue Jan 24 10:48:20 2017 -0800

----------------------------------------------------------------------
 .../membership/InternalDistributedMember.java   | 48 ++++++++++----------
 .../internal/tcpserver/TcpClient.java           |  4 +-
 2 files changed, 27 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/59702a6e/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java
 
b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java
index 7955d34..41c85d6 100755
--- 
a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java
+++ 
b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java
@@ -82,9 +82,6 @@ public class InternalDistributedMember implements 
DistributedMember, Externaliza
   /** product version bit flag */
   private static final int VERSION_BIT = 0x8;
 
-  /** additional membership data */
-  private static final int NETMBR_DATA_BIT = 0x10;
-
   /**
    * Representing the host name of this member.
    */
@@ -93,7 +90,7 @@ public class InternalDistributedMember implements 
DistributedMember, Externaliza
   private transient Version versionObj = Version.CURRENT;
 
   /** The versions in which this message was modified */
-  private static final Version[] dsfidVersions = new Version[] 
{Version.GFE_71};
+  private static final Version[] dsfidVersions = new Version[] 
{Version.GFE_71, Version.GFE_90};
 
   private void defaultToCurrentHost() {
     netMbr.setProcessId(OSProcess.getId());
@@ -849,6 +846,14 @@ public class InternalDistributedMember implements 
DistributedMember, Externaliza
   }
 
   public void toData(DataOutput out) throws IOException {
+    toDataPre_GFE_9_0_0_0(out);
+    if (netMbr.getVersionOrdinal() >= Version.GFE_90.ordinal()) {
+      getNetMember().writeAdditionalData(out);
+    }
+  }
+
+
+  public void toDataPre_GFE_9_0_0_0(DataOutput out) throws IOException {
     // Assert.assertTrue(vmKind > 0);
     // NOTE: If you change the serialized format of this class
     // then bump Connection.HANDSHAKE_VERSION since an
@@ -868,10 +873,7 @@ public class InternalDistributedMember implements 
DistributedMember, Externaliza
     // always write product version but enable reading from older versions
     // that do not have it
     flags |= VERSION_BIT;
-    boolean writeNetMbrData = netMbr.hasAdditionalData();
-    if (writeNetMbrData) {
-      flags |= NETMBR_DATA_BIT;
-    }
+
     out.writeByte((byte) (flags & 0xff));
 
     out.writeInt(netMbr.getDirectPort());
@@ -891,15 +893,9 @@ public class InternalDistributedMember implements 
DistributedMember, Externaliza
         .writeString(durableClientAttributes == null ? "" : 
durableClientAttributes.getId(), out);
     DataSerializer.writeInteger(Integer.valueOf(
         durableClientAttributes == null ? 300 : 
durableClientAttributes.getTimeout()), out);
+
     short version = netMbr.getVersionOrdinal();
     Version.writeOrdinal(out, version, true);
-
-    Version streamVersion = 
InternalDataSerializer.getVersionForDataStream(out);
-
-    if (streamVersion.ordinal() >= Version.GFE_90.ordinal() && version >= 
Version.GFE_90.ordinal()
-        && writeNetMbrData) {
-      getNetMember().writeAdditionalData(out);
-    }
   }
 
   public void toDataPre_GFE_7_1_0_0(DataOutput out) throws IOException {
@@ -949,6 +945,19 @@ public class InternalDistributedMember implements 
DistributedMember, Externaliza
 
 
   public void fromData(DataInput in) throws IOException, 
ClassNotFoundException {
+    fromDataPre_GFE_9_0_0_0(in);
+    // just in case this is just a non-versioned read
+    // from a file we ought to check the version
+    if (getNetMember().getVersionOrdinal() >= Version.GFE_90.ordinal()) {
+      try {
+        netMbr.readAdditionalData(in);
+      } catch (EOFException e) {
+        // nope - it's from a pre-GEODE client or WAN site
+      }
+    }
+  }
+
+  public void fromDataPre_GFE_9_0_0_0(DataInput in) throws IOException, 
ClassNotFoundException {
     InetAddress inetAddr = DataSerializer.readInetAddress(in);
     int port = in.readInt();
 
@@ -991,15 +1000,6 @@ public class InternalDistributedMember implements 
DistributedMember, Externaliza
 
     Assert.assertTrue(netMbr.getVmKind() > 0);
     // Assert.assertTrue(getPort() > 0);
-
-    // just in case this is just a non-versioned read
-    // from a file we ought to check the version
-    Version streamVersion = InternalDataSerializer.getVersionForDataStream(in);
-
-    if (streamVersion.ordinal() >= Version.GFE_90.ordinal() && version >= 
Version.GFE_90.ordinal()
-        && (flags & NETMBR_DATA_BIT) == NETMBR_DATA_BIT) {
-      netMbr.readAdditionalData(in);
-    }
   }
 
   public void fromDataPre_GFE_7_1_0_0(DataInput in) throws IOException, 
ClassNotFoundException {

http://git-wip-us.apache.org/repos/asf/geode/blob/59702a6e/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpClient.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpClient.java
 
b/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpClient.java
index 7b5d501..a558598 100644
--- 
a/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpClient.java
+++ 
b/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpClient.java
@@ -208,8 +208,10 @@ public class TcpClient {
           logger.debug("received response: {}", response);
           return response;
         } catch (EOFException ex) {
-          throw new EOFException("Locator at " + ipAddr
+          EOFException eof = new EOFException("Locator at " + ipAddr
               + " did not respond. This is normal if the locator was shutdown. 
If it wasn't check its log for exceptions.");
+          eof.initCause(ex);
+          throw eof;
         }
       } else {
         return null;

Reply via email to