usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdun...@apache.org
Subject usergrid git commit: During test startup, if dropping keyspace, don't check again for existence.
Date Wed, 09 Aug 2017 22:17:44 GMT
Repository: usergrid
Updated Branches:
  refs/heads/hotfix-20170728 e4c65126b -> 93cb4ad0f


During test startup, if dropping keyspace, don't check again for existence.


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

Branch: refs/heads/hotfix-20170728
Commit: 93cb4ad0fea1044e286fc3bb8d454c60daa3f22f
Parents: e4c6512
Author: Mike Dunker <mdunker@google.com>
Authored: Wed Aug 9 15:17:00 2017 -0700
Committer: Mike Dunker <mdunker@google.com>
Committed: Wed Aug 9 15:17:00 2017 -0700

----------------------------------------------------------------------
 .../core/migration/schema/MigrationManagerImpl.java | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/93cb4ad0/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/MigrationManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/MigrationManagerImpl.java
b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/MigrationManagerImpl.java
index 003565e..3f31a4c 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/MigrationManagerImpl.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/MigrationManagerImpl.java
@@ -80,10 +80,11 @@ public class MigrationManagerImpl implements MigrationManager {
 
             if (dropKeyspace) {
                 dropKeyspace();
+                createKeyspace();
+            } else {
+                testAndCreateKeyspace();
             }
 
-            testAndCreateKeyspace();
-
             for ( Migration migration : migrations ) {
 
                 final Collection<MultiTenantColumnFamilyDefinition> columnFamilies
= migration.getColumnFamilies();
@@ -172,13 +173,20 @@ public class MigrationManagerImpl implements MigrationManager {
             return;
         }
 
+        createKeyspace();
+
+    }
 
+    /**
+     * Create keyspace, it must not exist (either have checked for it or dropped it).
+     */
+    private void createKeyspace() throws ConnectionException {
         ImmutableMap.Builder<String, Object> strategyOptions = getKeySpaceProps();
 
 
         ImmutableMap<String, Object> options =
-                ImmutableMap.<String, Object>builder().put( "strategy_class", fig.getStrategyClass()
)
-                            .put( "strategy_options", strategyOptions.build() ).build();
+            ImmutableMap.<String, Object>builder().put( "strategy_class", fig.getStrategyClass()
)
+                .put( "strategy_options", strategyOptions.build() ).build();
 
 
         keyspace.createKeyspace( options );


Mime
View raw message