diff --git a/CHANGES.txt b/CHANGES.txt index 316d14b4b2..a362f786d5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 4.1 + * repair prepare message would produce a wrong error message if network timeout happened rather than reply wait timeout (CASSANDRA-16992) * Log queries that fail on timeout or unavailable errors up to once per minute by default (CASSANDRA-17159) * Refactor normal/preview/IR repair to standardize repair cleanup and error handling of failed RepairJobs (CASSANDRA-17069) * Log missing peers in StartupClusterConnectivityChecker (CASSANDRA-17130) diff --git a/src/java/org/apache/cassandra/service/ActiveRepairService.java b/src/java/org/apache/cassandra/service/ActiveRepairService.java index fbcb745434..322fd1813b 100644 --- a/src/java/org/apache/cassandra/service/ActiveRepairService.java +++ b/src/java/org/apache/cassandra/service/ActiveRepairService.java @@ -26,6 +26,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import javax.management.openmbean.CompositeData; +import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Predicate; import com.google.common.annotations.VisibleForTesting; @@ -523,6 +524,7 @@ public class ActiveRepairService implements IEndpointStateChangeSubscriber, IFai final CountDownLatch prepareLatch = newCountDownLatch(endpoints.size()); final AtomicBoolean status = new AtomicBoolean(true); final Set failedNodes = synchronizedSet(new HashSet()); + final AtomicInteger timeouts = new AtomicInteger(0); RequestCallback callback = new RequestCallback() { @Override @@ -536,6 +538,8 @@ public class ActiveRepairService implements IEndpointStateChangeSubscriber, IFai { status.set(false); failedNodes.add(from.toString()); + if (failureReason == RequestFailureReason.TIMEOUT) + timeouts.incrementAndGet(); prepareLatch.decrement(); } @@ -576,7 +580,7 @@ public class ActiveRepairService implements IEndpointStateChangeSubscriber, IFai } try { - if (!prepareLatch.await(getRpcTimeout(MILLISECONDS), MILLISECONDS)) + if (!prepareLatch.await(getRpcTimeout(MILLISECONDS), MILLISECONDS) || timeouts.get() > 0) failRepair(parentRepairSession, "Did not get replies from all endpoints."); } catch (InterruptedException e)