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 E75EC10195 for ; Tue, 7 Jan 2014 05:51:38 +0000 (UTC) Received: (qmail 68347 invoked by uid 500); 7 Jan 2014 05:51:34 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 68279 invoked by uid 500); 7 Jan 2014 05:51:33 -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 68268 invoked by uid 99); 7 Jan 2014 05:51:33 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jan 2014 05:51:33 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1738A388F0; Tue, 7 Jan 2014 05:51:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: marcuse@apache.org To: commits@cassandra.apache.org Date: Tue, 07 Jan 2014 05:51:33 -0000 Message-Id: <44d04072f6d74d9c811fedb3050dac57@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: Verify that the keyspace exists in describeRing and print nicer error message in BulkLoader. Updated Branches: refs/heads/trunk 694988015 -> 1dc43bdad Verify that the keyspace exists in describeRing and print nicer error message in BulkLoader. Patch by marcuse, reviewed by thobbs for CASSANDRA-6529 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ae0a1e0f Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ae0a1e0f Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ae0a1e0f Branch: refs/heads/trunk Commit: ae0a1e0f5a88d66974582f383a942f6bf42b6ac5 Parents: 95f1b5f Author: Marcus Eriksson Authored: Tue Jan 7 06:48:08 2014 +0100 Committer: Marcus Eriksson Committed: Tue Jan 7 06:48:08 2014 +0100 ---------------------------------------------------------------------- .../apache/cassandra/service/StorageService.java | 3 +++ .../org/apache/cassandra/tools/BulkLoader.java | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/ae0a1e0f/src/java/org/apache/cassandra/service/StorageService.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index cca7b00..102e0d8 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -1178,6 +1178,9 @@ public class StorageService extends NotificationBroadcasterSupport implements IE private List describeRing(String keyspace, boolean includeOnlyLocalDC) throws InvalidRequestException { + if (!Schema.instance.getKeyspaces().contains(keyspace)) + throw new InvalidRequestException("No such keyspace: " + keyspace); + if (keyspace == null || Keyspace.open(keyspace).getReplicationStrategy() instanceof LocalStrategy) throw new InvalidRequestException("There is no ring for the keyspace: " + keyspace); http://git-wip-us.apache.org/repos/asf/cassandra/blob/ae0a1e0f/src/java/org/apache/cassandra/tools/BulkLoader.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/tools/BulkLoader.java b/src/java/org/apache/cassandra/tools/BulkLoader.java index 15c8df8..4756bd3 100644 --- a/src/java/org/apache/cassandra/tools/BulkLoader.java +++ b/src/java/org/apache/cassandra/tools/BulkLoader.java @@ -76,7 +76,22 @@ public class BulkLoader OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug); SSTableLoader loader = new SSTableLoader(options.directory, new ExternalClient(options.hosts, options.rpcPort, options.user, options.passwd, options.transportFactory), handler); DatabaseDescriptor.setStreamThroughputOutboundMegabitsPerSec(options.throttle); - StreamResultFuture future = loader.stream(options.ignores); + StreamResultFuture future = null; + try + { + future = loader.stream(options.ignores); + } + catch (Exception e) + { + System.err.println(e.getMessage()); + if (e.getCause() != null) + System.err.println(e.getCause()); + if (options.debug) + e.printStackTrace(System.err); + else + System.err.println("Run with --debug to get full stack trace or --help to get help."); + System.exit(1); + } future.addEventListener(new ProgressIndicator()); try {