tolbertam commented on code in PR #4558:
URL: https://github.com/apache/cassandra/pull/4558#discussion_r2836594895


##########
src/java/org/apache/cassandra/repair/autorepair/AutoRepairUtils.java:
##########
@@ -451,6 +451,42 @@ public static boolean hasMultipleLiveMajorVersions()
         return majorVersions.size() > 1;
     }
 
+    /**
+     * Last version that does not support auto-repair.
+     * All nodes in the cluster must be running a version above this to enable 
auto-repair.
+     * Versions at or below this version (5.0.6) do not support auto-repair.
+     */
+    @VisibleForTesting
+    static final CassandraVersion LAST_UNSUPPORTED_VERSION_FOR_AUTO_REPAIR = 
new CassandraVersion("5.0.6");
+
+    /**
+     * Checks whether any node in the cluster is running an unsupported 
version for auto-repair.
+     *
+     * @return true if any live node has a version at or below 5.0.6 
(unsupported) or has an unknown version,
+     *         false if all nodes are running versions above 5.0.6 (supported)
+     */
+    public static boolean hasNodesBelowMinimumVersion()
+    {
+        Set<InetAddressAndPort> liveEndpoints = 
Gossiper.instance.getLiveMembers();
+        for (InetAddressAndPort endpoint : liveEndpoints)
+        {
+            CassandraVersion releaseVersion = 
Gossiper.instance.getReleaseVersion(endpoint);
+            if (releaseVersion == null)
+            {
+                logger.warn("Cannot determine version for endpoint {}, 
blocking auto-repair", endpoint);
+                return true;
+            }

Review Comment:
   Was bouncing this around in my mind for a little bit, but I know it's very 
easy for entries in gossip to be missing fields like `RELEASE_VERSION`.
   
   This had me worried that maybe if there is a record in gossip with 
incomplete data that was missing `RELEASE_VERSION` that `AutoRepair` could be 
disabled on nodes suddenly if gossip data was incomplete.
   
   However, I think `getLiveMembers()` should ultimately act as a good filter 
for such entries in gossip.



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