Fail repair if insufficient responses received

Patch by Simon Zhou; Reviewed by Paulo Motta for CASSANDRA-13397
This commit is contained in:
Simon Zhou 2017-03-31 20:53:39 -07:00 committed by Paulo Motta
parent 175e4f8ce8
commit f5b36f12df
2 changed files with 15 additions and 8 deletions

View File

@ -1,4 +1,5 @@
3.0.14
* Fail repair if insufficient responses received (CASSANDRA-13397)
* Fix SSTableLoader fail when the loaded table contains dropped columns (CASSANDRA-13276)
* Avoid name clashes in CassandraIndexTest (CASSANDRA-13427)
* Handling partially written hint files (CASSANDRA-12728)

View File

@ -321,30 +321,36 @@ public class ActiveRepairService implements IEndpointStateChangeSubscriber, IFai
}
else
{
status.set(false);
failedNodes.add(neighbour.getHostAddress());
prepareLatch.countDown();
// bailout early to avoid potentially waiting for a long time.
failRepair(parentRepairSession, "Endpoint not alive: " + neighbour);
}
}
try
{
prepareLatch.await(1, TimeUnit.HOURS);
// Failed repair is expensive so we wait for longer time.
if (!prepareLatch.await(1, TimeUnit.HOURS)) {
failRepair(parentRepairSession, "Did not get replies from all endpoints.");
}
}
catch (InterruptedException e)
{
removeParentRepairSession(parentRepairSession);
throw new RuntimeException("Did not get replies from all endpoints. List of failed endpoint(s): " + failedNodes.toString(), e);
failRepair(parentRepairSession, "Interrupted while waiting for prepare repair response.");
}
if (!status.get())
{
removeParentRepairSession(parentRepairSession);
throw new RuntimeException("Did not get positive replies from all endpoints. List of failed endpoint(s): " + failedNodes.toString());
failRepair(parentRepairSession, "Got negative replies from endpoints " + failedNodes);
}
return parentRepairSession;
}
private void failRepair(UUID parentRepairSession, String errorMsg) {
removeParentRepairSession(parentRepairSession);
throw new RuntimeException(errorMsg);
}
public void registerParentRepairSession(UUID parentRepairSession, InetAddress coordinator, List<ColumnFamilyStore> columnFamilyStores, Collection<Range<Token>> ranges, boolean isIncremental, long timestamp, boolean isGlobal)
{
if (!registeredForEndpointChanges)