diff options
author | k.kedron <k.kedron@partner.samsung.com> | 2020-03-13 17:15:14 +0100 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-03-16 12:41:32 +0000 |
commit | 4654da998f4cd9390e2e1a02f4aa2bdf198893c0 (patch) | |
tree | d3db0f41c25d8a8eaedb53dcdcf3d780034cc472 | |
parent | a2abf6ea18d512d367277bacaf7476754dc0eff5 (diff) |
Remove hardcoded timeout
Added configuration for wait seconds for Cassandra connector.
Also, increase the timeout value to prevent tests failed.
Issue-ID: SDC-2759
Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com>
Change-Id: I1008ecce98efdd8627ac3232b35fecd2a41a9c79
6 files changed, 23 insertions, 12 deletions
diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/configuration.yaml.erb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/configuration.yaml.erb index 5147881bde..90a02934b5 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/configuration.yaml.erb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/configuration.yaml.erb @@ -83,6 +83,7 @@ cassandraConfig: ssl: false truststorePath : /config/.truststore truststorePassword : Aa123456 + maxWaitSeconds: 120 keySpaces: - { name: dox, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['<%= @DC_NAME %>','<%= @rep_factor %>']} - { name: sdcaudit, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['<%= @DC_NAME %>','<%= @rep_factor %>']} diff --git a/asdctool/src/main/resources/config/configuration.yaml b/asdctool/src/main/resources/config/configuration.yaml index 69f82ac72f..5a88cf040a 100644 --- a/asdctool/src/main/resources/config/configuration.yaml +++ b/asdctool/src/main/resources/config/configuration.yaml @@ -99,6 +99,7 @@ cassandraConfig: ssl: true truststorePath : C:/Users/im453s/git/vagrant-sdc-all-in-one/tmp.trust truststorePassword : Aa123456 + maxWaitSeconds: 120 keySpaces: - { name: dox, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['DC-AIO-Ubuntu1', '1']} - { name: sdcaudit, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['DC-AIO-Ubuntu1', '1']} diff --git a/asdctool/src/main/resources/config/janusgraph.properties b/asdctool/src/main/resources/config/janusgraph.properties index e0b844f554..8462756129 100644 --- a/asdctool/src/main/resources/config/janusgraph.properties +++ b/asdctool/src/main/resources/config/janusgraph.properties @@ -16,7 +16,6 @@ storage.cql.replication-strategy-class=org.apache.cassandra.locator.NetworkTopol storage.cql.replication-strategy-options=DC-sdc-iltlv633,1 storage.cql.local-datacenter=DC-sdc-iltlv633 - cache.db-cache = false cache.db-cache-clean-wait = 20 cache.db-cache-time = 180000 diff --git a/catalog-be/src/main/resources/config/configuration.yaml b/catalog-be/src/main/resources/config/configuration.yaml index 8dfe646629..f6d12fcfa0 100644 --- a/catalog-be/src/main/resources/config/configuration.yaml +++ b/catalog-be/src/main/resources/config/configuration.yaml @@ -113,6 +113,7 @@ cassandraConfig: ssl: true truststorePath : /var/lib/jetty/opt/base/be/config/.truststore truststorePassword : Aa123456 + maxWaitSeconds: 120 keySpaces: - { name: dox, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['DC-sdc-iltlv650', '1']} - { name: sdcaudit, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['DC-sdc-iltlv650', '1']} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java index 3d68980d73..76532f6ed8 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Metadata; -import com.datastax.driver.core.ProtocolVersion; import com.datastax.driver.core.Session; import com.datastax.driver.core.SocketOptions; import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy; @@ -51,7 +50,7 @@ public class SdcSchemaUtils { cluster = createCluster(); isConnected = true; } catch (Exception e) { - log.info("** CassandraClient isn't connected. error is {}", e); + log.info("** CassandraClient isn't connected. error is", e); } log.info("** cluster created"); @@ -70,25 +69,26 @@ public class SdcSchemaUtils { List<String> nodes = config.getCassandraHosts(); Integer cassandraPort = config.getCassandraPort(); if (nodes == null || cassandraPort == null) { - log.info("no nodes or port were supplied in configuration."); + log.info("No nodes or port were supplied in configuration."); return null; } - log.info("connecting to node:{} port{}.", nodes, cassandraPort); + log.info("Connecting to node: {} port: {}.", nodes, cassandraPort); Cluster.Builder clusterBuilder = Cluster.builder(); nodes.forEach(node -> clusterBuilder.addContactPoint(node).withPort(cassandraPort)); - clusterBuilder.withMaxSchemaAgreementWaitSeconds(60); - - setSocketOptions(clusterBuilder, config); - if(!enableAuthentication(clusterBuilder, config)){ + log.info("Connection timeout in seconds : {}", config.getMaxWaitSeconds()); + clusterBuilder.withMaxSchemaAgreementWaitSeconds(config.getMaxWaitSeconds()); + + setSocketOptions(clusterBuilder, config); + if (!enableAuthentication(clusterBuilder, config)) { return null; } - - if(!enableSsl(clusterBuilder, config)){ + + if (!enableSsl(clusterBuilder, config)) { return null; } setLocalDc(clusterBuilder, config); - + return clusterBuilder.build(); } diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java index 368a27ed8b..0bc0707822 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java @@ -739,6 +739,7 @@ public class Configuration extends BasicConfiguration { boolean ssl; String truststorePath; String truststorePassword; + int maxWaitSeconds = 120; public Integer getCassandraPort() { return cassandraPort != null ? cassandraPort : Configuration.CassandrConfig.CASSANDRA_DEFAULT_PORT; } @@ -832,6 +833,14 @@ public class Configuration extends BasicConfiguration { this.keySpaces = cassandraConfig; } + public int getMaxWaitSeconds() { + return maxWaitSeconds; + } + + public void setMaxWaitSeconds(int maxWaitSeconds) { + this.maxWaitSeconds = maxWaitSeconds; + } + public static class KeyspaceConfig { String name; |