geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jche...@apache.org
Subject incubator-geode git commit: [GEODE-77] Fixed some backward compatibility issues
Date Fri, 06 Nov 2015 19:34:11 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-77 1ff1ba672 -> 8a4af0fff


[GEODE-77] Fixed some backward compatibility issues


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

Branch: refs/heads/feature/GEODE-77
Commit: 8a4af0fff5f96b3cf2fffc46db81d10950c20bf4
Parents: 1ff1ba6
Author: Jianxia Chen <jchen@pivotal.io>
Authored: Fri Nov 6 11:16:36 2015 -0800
Committer: Jianxia Chen <jchen@pivotal.io>
Committed: Fri Nov 6 11:16:36 2015 -0800

----------------------------------------------------------------------
 .../tier/sockets/ClientProxyMembershipID.java     | 18 +++---------------
 .../internal/cache/tier/sockets/HandShake.java    | 14 ++++++++++++--
 2 files changed, 15 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8a4af0ff/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientProxyMembershipID.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientProxyMembershipID.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientProxyMembershipID.java
index d72a484..4e7a179 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientProxyMembershipID.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientProxyMembershipID.java
@@ -104,7 +104,9 @@ public final class ClientProxyMembershipID
 
   protected int uniqueId;
   
-  private transient Version clientVersion;
+  //Version information is not available during the handshake
+  //see comments in HandShake.write()
+  private transient static final Version clientVersion = Version.GFE_82;
 
   // private final String proxyIDStr;
   // private final String clientIdStr ;
@@ -348,27 +350,13 @@ public final class ClientProxyMembershipID
 //          "serializing a client ID with zero port: " + this.toString(),
 //          new Exception("Stack trace"));
 //    }
-    Version v = InternalDataSerializer.getVersionForDataStream(out);
-    if (v.compareTo(Version.GFE_90) >= 0) {
-      if (clientVersion == null) {
-        clientVersion = Version.CURRENT;
-      }
-      clientVersion.writeOrdinal(out, true);
-    }
     DataSerializer.writeByteArray(this.identity, out);
     out.writeInt(this.uniqueId);
   }
 
   public void fromData(DataInput in) throws IOException, ClassNotFoundException
   {
-    this.clientVersion = InternalDataSerializer.getVersionForDataStream(in);
     
-    // client IDs are not always carefully serialized/deserialized so they
-    // must know their own version.  If this ID was serialized with 9.0
-    // then it carries the version of the client
-    if (this.clientVersion.compareTo(Version.GFE_90) >= 0) {
-      this.clientVersion = Version.readVersion(in, false);
-    }
     this.identity = DataSerializer.readByteArray(in);
     this.uniqueId = in.readInt();
 //    {toString(); this.transientPort = ((InternalDistributedMember)this.memberId).getPort();}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8a4af0ff/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/HandShake.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/HandShake.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/HandShake.java
index 5f7a989..be3a7bf 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/HandShake.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/HandShake.java
@@ -18,6 +18,7 @@
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
 import java.io.ByteArrayInputStream;
+import java.io.DataOutput;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.EOFException;
@@ -489,7 +490,11 @@ public class HandShake implements ClientHandShake
       else {
         hdos.writeInt(readTimeout);
       }
-      DataSerializer.writeObject(this.id, hdos);
+      // we do not know the receiver's version at this point, but the on-wire
+      // form of InternalDistributedMember changed in 9.0, so we must serialize
+      // it using the previous version
+      DataOutput idOut = new VersionedDataOutputStream(hdos, Version.GFE_82);
+      DataSerializer.writeObject(this.id, idOut);
   
       if (currentClientVersion.compareTo(Version.GFE_603) >= 0) {
         for (int bytes = 0; bytes < this.overrides.length; bytes++) {
@@ -1310,7 +1315,12 @@ public class HandShake implements ClientHandShake
       if(communicationMode == Acceptor.GATEWAY_TO_GATEWAY  && !
           (acceptanceCode == REPLY_EXCEPTION_AUTHENTICATION_REQUIRED ||
               acceptanceCode ==  REPLY_EXCEPTION_AUTHENTICATION_FAILED)) {
-          conn.setWanSiteVersion(Version.readOrdinal(dis));
+         short wanSiteVersion = Version.readOrdinal(dis);
+         conn.setWanSiteVersion(wanSiteVersion);
+         // establish a versioned stream for the other site, if necessary         
+         if (wanSiteVersion < Version.CURRENT_ORDINAL) {
+           dis = new VersionedDataInputStream(dis, Version.fromOrdinalOrCurrent(wanSiteVersion));
+         }
         } 
 
       // No need to check for return value since DataInputStream already throws


Mime
View raw message