Is it possible to connect from Hot Rod client to RHDG server with using different versions?

Solution Verified - Updated

Environment

  • Red Hat JBoss Data Grid (JDG)
  • Hot Rod client

Issue

  • Is it possible to use HotRod clients with different versions then the JDG server?
  • Is it possible to migrate the JDG server without updating the clients at the same time?
  • Is it possible to connect to a JDG server which is a different version than the HotRod client?
  • Are old HotRod clients compatible with newer server versions?
  • Are new HodRod clients able to connect to older JDG server versions?
  • Client shows an error if cache is accessed
Exception in thread "main" org.infinispan.client.hotrod.exceptions.HotRodClientException:Request for message id[2] returned server error (status=0x85): scala.MatchError: 20 (of class java.lang.Byte)
	at org.infinispan.client.hotrod.impl.protocol.Codec20.checkForErrorsInResponseStatus(Codec20.java:298)
	at org.infinispan.client.hotrod.impl.protocol.Codec20.readPartialHeader(Codec20.java:88)
	at org.infinispan.client.hotrod.impl.protocol.Codec20.readHeader(Codec20.java:74)
  • Server logfile show an error if a client is accessing the cache
ERROR [org.infinispan.server.hotrod.HotRodDecoder] (HotRodServerWorker-16) ISPN005003: Exception reported: org.infinispan.server.hotrod.RequestParsingException: Unable to parse header
	at org.infinispan.server.hotrod.HotRodDecoder.readHeader(HotRodDecoder.scala:94) [infinispan-server-hotrod-5.2.4.Final-redhat-1.jar:5.2.4.Final-redhat-1]
	at org.infinispan.server.hotrod.HotRodDecoder.readHeader(HotRodDecoder.scala:45) [infinispan-server-hotrod-5.2.4.Final-redhat-1.jar:5.2.4.Final-redhat-1]
	at org.infinispan.server.core.AbstractProtocolDecoder.decodeHeader(AbstractProtocolDecoder.scala:94) [infinispan-server-core-5.2.4.Final-redhat-1.jar:5.2.4.Final-redhat-1]
	...
Caused by: org.infinispan.server.hotrod.UnknownVersionException: Unknown version:20
	at org.infinispan.server.hotrod.HotRodDecoder.readHeader(HotRodDecoder.scala:80) [infinispan-server-hotrod-5.2.4.Final-redhat-1.jar:5.2.4.Final-redhat-1]
	... 22 more
ERROR [org.infinispan.server.hotrod.HotRodDecoder] (HotRodServerWorker-16) ISPN005009: Unexpected error before any request parameters read: scala.MatchError: 20 (of class java.lang.Byte)

Resolution

The HotRod protocol is able to handle different versions.
It is possible to use clients which run a different version of the HotRod library than the server-side as long as the server version is newer than the client version.
This applies to all different types of HotRod client libraries (Java, C++, C#).

Notes:

  • In any case, we recommend using the same version for both sides, except for the time of migration or upgrade. Because using the same version can prevent any confusion and known problems.
  • If the HotRod protocol version is the same it is still possible that the client library contains bugfixes and other changes.

Server runs a newer version than the HotRod client

This is the simple case as the current server supports all versions and the client should work correctly in any case.

  • the client does not have the advantage of the latest protocol improvements
  • the client might run into known bugs which are fixed for the server-side version
  • the client can only use the functionality of its version

Client run a newer version than the server

Client and server are RHDG 8 or better

In this case both sides will have the protocol version 3 which automatically choose the highest possible version. There is no longer a need to set the protocol version explicit.
Note Only the Java client has the protocol version 3 implemented, C++/C#/node.js will not have the capability at the moment.

Client connects a server RHDG 7 or older

If a client connects to a server and sends an unknown protocol version, which is the case if the client is newer than the server, the connection will be rejected with an exception. It is possible to downgrade the client to a known protocol version by setting the client-side property infinispan.client.hotrod.protocol_version to a version as String e.g "1.3". In this case, the client is able to connect to the server but will be restricted to the functionality of that version. The programmatic approach for Java API is like the following:

      ConfigurationBuilder remoteBuilder = new ConfigurationBuilder();
      remoteBuilder.addServer().host(host).port(port);
      remoteBuilder.protocolVersion("2.5");
      remoteCacheManager = new RemoteCacheManager(remoteBuilder.build());
      remoteCache = remoteCacheManager.getCache();

An example for C++ can be found Content from github.com is not included.here.

Any command which is not supported by this protocol version will not work and throw an exception. Also, the topology information might be inefficient in this case. Though this approach is supportable and you can use this for the migration, as we mentioned above, it is recommended to use the same version of client and server and use the latest protocol version for production.

The following table shows which JDG version matches which HotRod protocol version:

JDGHotRod JavaHotRod C++/C#
8.4.#4.02.4 (2.8)
8.3.#3.12.4 (2.8)
8.2.#3.12.4 (2.8)
8.13.02.4 (2.8)
8.03.02.4 (2.8)
7.3.#2.92.4 (2.8)
7.2.#2.62.4 (2.6)
7.1.#2.62.4
7.0.02.52.4
6.6.12.41.3
6.6.02.31.2
6.5.02.21.2
6.4.12.01.2
6.4.02.01.2
6.3.22.01.2
6.3.12.01.2
6.3.02.01.2
6.2.11.31.2
6.2.01.31.2
6.1.01.2--
6.0.11.1--
6.0.01.1--

More information about the HotRod protocol can be found in the Infinispan's Content from infinispan.org is not included.Hot Rod Protocol Reference Guide.

Note that 8.3 was the last release to run with Java8, 8.4 require Java11, 8.5 require Java17.
For information about supporting clients which need to run on legacy Kava versions see this article

Product(s)
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.