Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.

Commit 93cb4ad

Browse files
committed
During test startup, if dropping keyspace, don't check again for existence.
1 parent e4c6512 commit 93cb4ad

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/MigrationManagerImpl.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ public void migrate(boolean dropKeyspace) throws MigrationException {
8080

8181
if (dropKeyspace) {
8282
dropKeyspace();
83+
createKeyspace();
84+
} else {
85+
testAndCreateKeyspace();
8386
}
8487

85-
testAndCreateKeyspace();
86-
8788
for ( Migration migration : migrations ) {
8889

8990
final Collection<MultiTenantColumnFamilyDefinition> columnFamilies = migration.getColumnFamilies();
@@ -172,13 +173,20 @@ private void testAndCreateKeyspace() throws ConnectionException {
172173
return;
173174
}
174175

176+
createKeyspace();
177+
178+
}
175179

180+
/**
181+
* Create keyspace, it must not exist (either have checked for it or dropped it).
182+
*/
183+
private void createKeyspace() throws ConnectionException {
176184
ImmutableMap.Builder<String, Object> strategyOptions = getKeySpaceProps();
177185

178186

179187
ImmutableMap<String, Object> options =
180-
ImmutableMap.<String, Object>builder().put( "strategy_class", fig.getStrategyClass() )
181-
.put( "strategy_options", strategyOptions.build() ).build();
188+
ImmutableMap.<String, Object>builder().put( "strategy_class", fig.getStrategyClass() )
189+
.put( "strategy_options", strategyOptions.build() ).build();
182190

183191

184192
keyspace.createKeyspace( options );

0 commit comments

Comments
 (0)