Repository: cassandra Updated Branches: refs/heads/trunk 7453dbe02 -> 38946106a
Fix an issue with transient dispatch failures If a node goes down while hints are being dispatched to it, the dispatch loop will not break until the node goes up again, and dispatch is complete. This commit fixed the issue by propagating failure upwards so that we can break the loop in case of failure. patch by Aleksey Yeschenko; reviewed by Benedict Elliott Smith Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e6a9afbb Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e6a9afbb Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e6a9afbb Branch: refs/heads/trunk Commit: e6a9afbb8a759fefc83334e470f5b8965f12a467 Parents: 08bfe7f Author: Aleksey Yeschenko <[email protected]> Authored: Mon Aug 24 23:10:12 2015 +0300 Committer: Aleksey Yeschenko <[email protected]> Committed: Mon Aug 24 23:42:14 2015 +0300 ---------------------------------------------------------------------- .../org/apache/cassandra/hints/HintsDispatchExecutor.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6a9afbb/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java b/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java index d0fdd04..ab7bc7f 100644 --- a/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java +++ b/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java @@ -156,7 +156,8 @@ final class HintsDispatchExecutor try { - dispatch(descriptor); + if (!dispatch(descriptor)) + break; } catch (FSReadError e) { @@ -168,7 +169,10 @@ final class HintsDispatchExecutor } } - private void dispatch(HintsDescriptor descriptor) + /* + * Will return true if dispatch was successful, false if we hit a failure (destination node went down, for example). + */ + private boolean dispatch(HintsDescriptor descriptor) { logger.debug("Dispatching hints file {}", descriptor.fileName()); @@ -186,12 +190,14 @@ final class HintsDispatchExecutor logger.error("Failed to delete hints file {}", descriptor.fileName()); store.cleanUp(descriptor); logger.info("Finished hinted handoff of file {} to endpoint {}", descriptor.fileName(), hostId); + return true; } else { store.markDispatchOffset(descriptor, dispatcher.dispatchOffset()); store.offerFirst(descriptor); logger.info("Finished hinted handoff of file {} to endpoint {}, partially", descriptor.fileName(), hostId); + return false; } } }
