add finally block for removing HH attempt from queuedDeliveries, in case we don't reach schema agreement and give up

patch by jbellis

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1068433 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2011-02-08 15:03:26 +00:00
parent 22ce1dd1ac
commit 1f7b42e35f
1 changed files with 20 additions and 14 deletions

View File

@ -261,23 +261,29 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
private void deliverHintsToEndpoint(InetAddress endpoint) throws IOException, DigestMismatchException, InvalidRequestException, TimeoutException, InterruptedException
{
logger_.info("Checking remote schema before delivering hints");
int waited = waitForSchemaAgreement(endpoint);
// sleep a random amount to stagger handoff delivery from different replicas.
// (if we had to wait, then gossiper randomness took care of that for us already.)
if (waited == 0) {
int sleep = new Random().nextInt(60000);
logger_.info("Sleeping {}ms to stagger hint delivery", sleep);
Thread.sleep(sleep);
}
if (!Gossiper.instance.getEndpointStateForEndpoint(endpoint).isAlive())
try
{
logger_.info("Endpoint {} died before hint delivery, aborting", endpoint);
return;
logger_.info("Checking remote schema before delivering hints");
int waited = waitForSchemaAgreement(endpoint);
// sleep a random amount to stagger handoff delivery from different replicas.
// (if we had to wait, then gossiper randomness took care of that for us already.)
if (waited == 0) {
int sleep = new Random().nextInt(60000);
logger_.info("Sleeping {}ms to stagger hint delivery", sleep);
Thread.sleep(sleep);
}
if (!Gossiper.instance.getEndpointStateForEndpoint(endpoint).isAlive())
{
logger_.info("Endpoint {} died before hint delivery, aborting", endpoint);
return;
}
}
finally
{
queuedDeliveries.remove(endpoint);
}
logger_.info("Started hinted handoff for endpoint " + endpoint);
queuedDeliveries.remove(endpoint);
logger_.info("Started hinted handoff for endpoint " + endpoint);
// 1. Get the key of the endpoint we need to handoff
// 2. For each column read the list of rows: subcolumns are KS + SEPARATOR + CF