repair prepare message would produce a wrong error message if network timeout happened rather than reply wait timeout

patch by David Capwell; reviewed by Berenguer Blasi for CASSANDRA-16992
This commit is contained in:
David Capwell 2021-11-19 12:44:44 -08:00
parent c15f530b63
commit dcd7b0d35f
2 changed files with 6 additions and 1 deletions

View File

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

View File

@ -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<String> failedNodes = synchronizedSet(new HashSet<String>());
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)