JAMES-2470 Remove now uneeded check before keyspace creation
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/e149f40d Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/e149f40d Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/e149f40d Branch: refs/heads/master Commit: e149f40dcf1c78e25d3bd4642d7af271032fa3d6 Parents: 3ce7552 Author: benwa <[email protected]> Authored: Thu Jul 19 15:58:33 2018 +0700 Committer: benwa <[email protected]> Committed: Fri Jul 20 18:17:55 2018 +0700 ---------------------------------------------------------------------- .../cassandra/init/ClusterWithKeyspaceCreatedFactory.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/e149f40d/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/ClusterWithKeyspaceCreatedFactory.java ---------------------------------------------------------------------- diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/ClusterWithKeyspaceCreatedFactory.java b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/ClusterWithKeyspaceCreatedFactory.java index df03815..4ff38ba 100644 --- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/ClusterWithKeyspaceCreatedFactory.java +++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/ClusterWithKeyspaceCreatedFactory.java @@ -54,17 +54,11 @@ public class ClusterWithKeyspaceCreatedFactory { } public Cluster clusterWithInitializedKeyspace() { - if (isKeyspacePresent(cluster, keyspace)) { - createKeyspace(cluster, keyspace, replicationFactor, durableWrites); - } + createKeyspace(cluster, keyspace, replicationFactor, durableWrites); return cluster; } } - private static boolean isKeyspacePresent(Cluster cluster, String keyspace) { - return cluster.getMetadata().getKeyspace(keyspace) == null; - } - private static void createKeyspace(Cluster cluster, String keyspace, int replicationFactor, boolean durableWrites) { try (Session session = cluster.connect()) { session.execute("CREATE KEYSPACE IF NOT EXISTS " + keyspace --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
