You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2015/05/03 21:13:52 UTC
cassandra git commit: Eliminate race during auth keyspace setup
Repository: cassandra
Updated Branches:
refs/heads/trunk 6f1e38cc2 -> 0db1431e3
Eliminate race during auth keyspace setup
patch by Sam Tunnicliffe; reviewed by Aleksey Yeschenko for
CASSANDRA-9201
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0db1431e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0db1431e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0db1431e
Branch: refs/heads/trunk
Commit: 0db1431e33659392b11060451c71d006941a0dda
Parents: 6f1e38c
Author: Sam Tunnicliffe <sa...@beobal.com>
Authored: Wed Apr 29 10:24:05 2015 +0100
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Sun May 3 22:11:41 2015 +0300
----------------------------------------------------------------------
.../cassandra/service/StorageService.java | 22 ++++++++------------
1 file changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0db1431e/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 095c621..d6ce46e 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -992,27 +992,23 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
{
try
{
- // if we don't have system_auth keyspace at this point, then create it manually
- // otherwise, create any necessary tables as we may be upgrading in which case
- // the ks exists with the only the legacy tables defined
+ // if we don't have system_auth keyspace at this point, then create it
if (Schema.instance.getKSMetaData(AuthKeyspace.NAME) == null)
- {
maybeAddKeyspace(AuthKeyspace.definition());
- }
- else
- {
- for (Map.Entry<String, CFMetaData> table : AuthKeyspace.definition().cfMetaData().entrySet())
- {
- if (Schema.instance.getCFMetaData(AuthKeyspace.NAME, table.getKey()) == null)
- maybeAddTable(table.getValue());
- }
- }
}
catch (Exception e)
{
throw new AssertionError(e); // shouldn't ever happen.
}
+ // create any necessary tables as we may be upgrading in which case
+ // the ks exists with the only the legacy tables defined.
+ // Also, the addKeyspace above can be racy if multiple nodes are started
+ // concurrently - see CASSANDRA-9201
+ for (Map.Entry<String, CFMetaData> table : AuthKeyspace.definition().cfMetaData().entrySet())
+ if (Schema.instance.getCFMetaData(AuthKeyspace.NAME, table.getKey()) == null)
+ maybeAddTable(table.getValue());
+
DatabaseDescriptor.getRoleManager().setup();
DatabaseDescriptor.getAuthenticator().setup();
DatabaseDescriptor.getAuthorizer().setup();