blambov commented on code in PR #2975:
URL: https://github.com/apache/cassandra/pull/2975#discussion_r1431335434


##########
src/java/org/apache/cassandra/net/MessagingService.java:
##########
@@ -253,9 +245,13 @@ public static List<Version> supportedVersions()
     public static final int VERSION_40 = 12;
     public static final int VERSION_50 = 13; // c14227 TTL overflow, 'uint' 
timestamps
     public static final int minimum_version = VERSION_40;
-    public static final int current_version = Version.CURRENT.value;
+    public static final int maximum_version = VERSION_50;
+    // we want to use a modified behavior for the tools and clients - that is, 
since they are not running a server, they
+    // should not need to run in a compatibility mode. They should be able to 
connect to the server regardless whether
+    // it uses messaving version 4 or 5
+    public static final int current_version = 
!DatabaseDescriptor.isClientOrToolInitialized() && 
DatabaseDescriptor.getStorageCompatibilityMode().isBefore(5) ? VERSION_40 : 
maximum_version;
     static AcceptVersions accept_messaging = new 
AcceptVersions(minimum_version, current_version);
-    static AcceptVersions accept_streaming = new 
AcceptVersions(current_version, current_version);
+    static AcceptVersions accept_streaming = new 
AcceptVersions(DatabaseDescriptor.isClientOrToolInitialized() ? minimum_version 
: current_version, current_version);

Review Comment:
   Could we rewrite these as a static initialization to make it clearer, e.g. 
leaving `current_version` as it was and doing
   ```
       static AcceptVersions accept_messaging;
       static AcceptVersions accept_streaming;
       static
       {
           if (!DatabaseDescriptor.isClientOrToolInitialized())
           {
               accept_messaging = new AcceptVersions(minimum_version, 
current_version);
               accept_streaming = new AcceptVersions(current_version, 
current_version);
           }
           else
               accept_messaging = accept_streaming = new 
AcceptVersions(minimum_version, maximum_version);
       }
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to