Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 805CD18F53 for ; Mon, 24 Aug 2015 20:44:45 +0000 (UTC) Received: (qmail 50155 invoked by uid 500); 24 Aug 2015 20:44:45 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 50119 invoked by uid 500); 24 Aug 2015 20:44:45 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 50106 invoked by uid 99); 24 Aug 2015 20:44:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2015 20:44:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0125BE0616; Mon, 24 Aug 2015 20:44:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aleksey@apache.org To: commits@cassandra.apache.org Date: Mon, 24 Aug 2015 20:44:44 -0000 Message-Id: <66e4b906d8614f1089d1914bea909b0b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] cassandra git commit: Fix an issue with transient dispatch failures 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 Authored: Mon Aug 24 23:10:12 2015 +0300 Committer: Aleksey Yeschenko 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; } } }