jaydeepkumar1984 commented on code in PR #4304:
URL: https://github.com/apache/cassandra/pull/4304#discussion_r2283814017


##########
src/java/org/apache/cassandra/repair/autorepair/AutoRepair.java:
##########
@@ -165,6 +166,11 @@ public void repair(AutoRepairConfig.RepairType repairType)
             logger.debug("Auto-repair is disabled for repair type {}", 
repairType);
             return;
         }
+        if (!DatabaseDescriptor.getMixedMajorVersionRepairEnabled() &&
+            Gossiper.instance.hasMultipleLiveMajorVersions()) {
+            logger.info("Auto-repair is disabled when nodes in the cluster 
have different major versions");

Review Comment:
   
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/metrics/AutoRepairMetrics.java



##########
test/unit/org/apache/cassandra/repair/autorepair/AutoRepairUtilsTest.java:
##########
@@ -232,6 +236,52 @@ public void testGetHostIdsInCurrentRing_multiple_nodes()
         assertTrue(hosts.contains(hostId));
     }
 
+    @Test
+    public void testHasMultipleLiveMajorVersionsWithSingleNode()
+    {
+        boolean result = AutoRepairUtils.hasMultipleLiveMajorVersions();
+        assertFalse(result);
+    }
+
+    @Test
+    public void 
testHasMultipleLiveMajorVersionsWithMultipleNodesOfSameVersion()
+    {
+        ClusterMetadataTestHelper.addEndpoint(2);
+        // Test the current behavior with the existing cluster setup
+        // In a single-node test environment, this should return false
+        boolean result = AutoRepairUtils.hasMultipleLiveMajorVersions();
+        assertFalse(result);
+    }
+
+    @Test
+    public void 
testHasMultipleLiveMajorVersionsWithMultipleNodesOfSameMajorVersionDifferentMinorVersions()
+    {
+        // add two nodes with the current cassandra major version, but 
different minor version
+        CassandraVersion differentCassandraVersion = new CassandraVersion(
+            String.format("%d.%d",
+                          NodeVersion.CURRENT.cassandraVersion.major,
+                          NodeVersion.CURRENT.cassandraVersion.minor+1));
+        ClusterMetadataTestHelper.addEndpoint(2, new NodeVersion(
+             differentCassandraVersion,
+             NodeVersion.CURRENT_METADATA_VERSION));
+        // With the same major versions, but different minor versions, we 
should still see this function return true
+        boolean result = AutoRepairUtils.hasMultipleLiveMajorVersions();
+        assertFalse(result);
+    }
+
+    @Test
+    public void 
testHasMultipleLiveMajorVersionsWithMultipleNodesOfDifferentMajorVersions()
+    {
+        // add two nodes with different cassandra major versions
+        CassandraVersion differentCassandraVersion = new CassandraVersion(
+            String.format("%d.%d", NodeVersion.CURRENT.cassandraVersion.major 
- 1, 0));
+        ClusterMetadataTestHelper.addEndpoint(2, new 
NodeVersion(differentCassandraVersion,
+                                                                 
NodeVersion.CURRENT_METADATA_VERSION));
+        // With the same major versions, but different minor versions, we 
should still see this function return true

Review Comment:
   nit typo: With the same minor versions, but different major versions



##########
src/java/org/apache/cassandra/repair/autorepair/AutoRepair.java:
##########
@@ -165,6 +166,11 @@ public void repair(AutoRepairConfig.RepairType repairType)
             logger.debug("Auto-repair is disabled for repair type {}", 
repairType);
             return;
         }
+        if (!DatabaseDescriptor.getMixedMajorVersionRepairEnabled() &&
+            Gossiper.instance.hasMultipleLiveMajorVersions()) {
+            logger.info("Auto-repair is disabled when nodes in the cluster 
have different major versions");

Review Comment:
   The metric is still missing?



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