cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject git commit: Catch and log UAE in Auth#setup instead of propagating
Date Sat, 08 Dec 2012 17:45:32 GMT
Updated Branches:
  refs/heads/cassandra-1.2.0 62b9037d1 -> dbbca5e29


Catch and log UAE in Auth#setup instead of propagating


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/dbbca5e2
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/dbbca5e2
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/dbbca5e2

Branch: refs/heads/cassandra-1.2.0
Commit: dbbca5e296d969550caca3519125dfe9f3f9a657
Parents: 62b9037
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Sat Dec 8 20:44:20 2012 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Sat Dec 8 20:44:20 2012 +0300

----------------------------------------------------------------------
 src/java/org/apache/cassandra/auth/Auth.java |   22 +++++++++++++++-----
 1 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/dbbca5e2/src/java/org/apache/cassandra/auth/Auth.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/auth/Auth.java b/src/java/org/apache/cassandra/auth/Auth.java
index 123ffe6..6791455 100644
--- a/src/java/org/apache/cassandra/auth/Auth.java
+++ b/src/java/org/apache/cassandra/auth/Auth.java
@@ -20,6 +20,8 @@ package org.apache.cassandra.auth;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.cql3.UntypedResultSet;
@@ -27,10 +29,11 @@ import org.apache.cassandra.cql3.QueryProcessor;
 import org.apache.cassandra.exceptions.UnavailableException;
 import org.apache.cassandra.service.MigrationManager;
 import org.apache.cassandra.service.StorageService;
-import org.apache.cassandra.utils.WrappedRunnable;
 
 public class Auth
 {
+    private static final Logger logger = LoggerFactory.getLogger(Auth.class);
+
     public static final String DEFAULT_SUPERUSER_NAME = "cassandra";
 
     public static final String AUTH_KS = "system_auth";
@@ -115,13 +118,20 @@ public class Auth
         MigrationManager.instance.register(new MigrationListener());
 
         // schedule seeding a superuser in RING_DELAY milliseconds.
-        Runnable runnable = new WrappedRunnable()
+        Runnable runnable = new Runnable()
         {
-            public void runMayThrow() throws UnavailableException
+            public void run()
             {
-                // insert a default superuser if AUTH_KS.USERS_CF is empty.
-                if (QueryProcessor.process(String.format("SELECT * FROM %s.%s", AUTH_KS,
USERS_CF)).isEmpty())
-                    insertUser(DEFAULT_SUPERUSER_NAME, true);
+                try
+                {
+                    // insert a default superuser if AUTH_KS.USERS_CF is empty.
+                    if (QueryProcessor.process(String.format("SELECT * FROM %s.%s", AUTH_KS,
USERS_CF)).isEmpty())
+                        insertUser(DEFAULT_SUPERUSER_NAME, true);
+                }
+                catch (UnavailableException e)
+                {
+                    logger.warn("Skipping default superuser setup: some nodes are unavailable");
+                }
             }
         };
         StorageService.tasks.schedule(runnable, StorageService.RING_DELAY, TimeUnit.MILLISECONDS);


Mime
View raw message