[ 
https://issues.apache.org/jira/browse/GEODE-8963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17289391#comment-17289391
 ] 

ASF GitHub Bot commented on GEODE-8963:
---------------------------------------

bschuchardt commented on a change in pull request #6050:
URL: https://github.com/apache/geode/pull/6050#discussion_r581428395



##########
File path: 
geode-cq/src/upgradeTest/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscBCDUnitTest.java
##########
@@ -79,11 +84,49 @@ public ClientServerMiscBCDUnitTest(String version) {
   void createClientCacheAndVerifyPingIntervalIsSet(String host, int port) 
throws Exception {
     // this functionality was introduced in 1.5. If we let the test run in 
older
     // clients it will throw a NoSuchMethodError
-    if (VersionManager.getInstance().getCurrentVersionOrdinal() >= 80 /* 
GEODE_1_5_0 */) {
+    if (VersionManager.getInstance().getCurrentVersionOrdinal() >= 
KnownVersion.GEODE_1_5_0
+        .ordinal()) {
       super.createClientCacheAndVerifyPingIntervalIsSet(host, port);
     }
   }
 
+  /**
+   * A client should advertise its protocol version, which may not be the same
+   * as its product version.
+   */
+  @Test
+  public void testClientProtocolVersion() throws Exception {
+    int serverPort = initServerCache(true);
+    VM client1 = Host.getHost(0).getVM(testVersion, 1);
+    String hostname = NetworkUtils.getServerHostName(Host.getHost(0));
+    short ordinal = client1.invoke("create client1 cache", () -> {
+      createClientCache(hostname, serverPort);
+      populateCache();
+      registerInterest();
+      InternalDistributedMember distributedMember = 
(InternalDistributedMember) static_cache
+          .getDistributedSystem().getDistributedMember();
+      // older versions of Geode have a different Version class so we have to 
use reflection here
+      try {
+        Method getter = 
InternalDistributedMember.class.getMethod("getVersionObject");
+        Object versionObject = getter.invoke(distributedMember);
+        Method getOrdinal = versionObject.getClass().getMethod("ordinal");
+        return (Short) getOrdinal.invoke(versionObject);
+      } catch (NoSuchMethodException e) {

Review comment:
       @kirklund yes, older versions have a getVersionObject method. Newer 
versions have getVersion instead.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


> separate client/server compatibility from server/server version compatibility
> -----------------------------------------------------------------------------
>
>                 Key: GEODE-8963
>                 URL: https://issues.apache.org/jira/browse/GEODE-8963
>             Project: Geode
>          Issue Type: Improvement
>          Components: serialization
>            Reporter: Bruce J Schuchardt
>            Assignee: Bruce J Schuchardt
>            Priority: Minor
>              Labels: pull-request-available
>
> A client's version is used for deserializing data received from the client 
> and for serializing data sent to the client. It is also used to locate the 
> map of Commands used to process client requests. Every time we cut a new 
> release we bump this version in KnownVersions and create a new map of 
> Commands, even though client/server communications protocols rarely change.
>  We should have each KnownVersion hold a client/server compatibility number 
> that is used to identify clients rather than the KnownVersion's ordinal.
> For instance,
> {code:java}
>   public static final KnownVersion GEODE_1_15_0 =
>       new KnownVersion("GEODE", "1.15.0", (byte) 1, (byte) 15, (byte) 0, 
> (byte) 0,
>           /*server/server version*/GEODE_1_15_0_ORDINAL, 
>           /*client/server version*/GEODE_1_15_0_ORDINAL);
>   
> public static final KnownVersion GEODE_1_16_0 =
>       new KnownVersion("GEODE", "1.16.0", (byte) 1, (byte) 16, (byte) 0, 
> (byte) 0,
>           /*server/server version*/GEODE_1_16_0_ORDINAL, 
>           /*client/server version*/GEODE_1_15_0_ORDINAL);
> public static final KnownVersion GEODE_1_17_0 =
>       new KnownVersion("GEODE", "1.17.0", (byte) 1, (byte) 17, (byte) 0, 
> (byte) 0,
>           /*server/server version*/GEODE_1_17_0_ORDINAL, 
>           /*client/server version*/GEODE_1_15_0_ORDINAL);
> {code}
> In the above KnownVersions the client/server serialization is known to have 
> not changed since v1.15.0 and so there is no need to use a newer KnownVersion 
> for clients.
> Client handshake code will need to be changed to use the client/server 
> ordinal when identifying clients and servers.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to