cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject [1/2] git commit: Verify that the keyspace exists in describeRing and print nicer error message in BulkLoader.
Date Tue, 07 Jan 2014 05:51:33 GMT
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 <marcuse@apache.org>
Authored: Tue Jan 7 06:48:08 2014 +0100
Committer: Marcus Eriksson <marcuse@apache.org>
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<TokenRange> 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
         {


Mime
View raw message