aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2018-06-02 21:35:48 +0300
committerMichael Lando <ml636r@att.com>2018-06-02 21:35:48 +0300
commit76be68d39688617e46ab5dba1b5865ed4cb85b69 (patch)
tree17e3a109e6c9b5da7d2ff5222b51de60a5d69d0d
parent0a3c4290cc8d29ac42413994a05c438ff06edd6f (diff)
tine out configuration not usedv1.2.0
Change-Id: I55c81975cd40b81510b18865e32e2f5394718349 Issue-ID: SDC-1344 Signed-off-by: Michael Lando <ml636r@att.com>
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java17
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java13
-rwxr-xr-xsdc-os-chef/scripts/docker_run.sh4
3 files changed, 31 insertions, 3 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java
index 38606d00e9..c343765c5c 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java
@@ -24,6 +24,7 @@ import java.util.List;
import javax.annotation.PreDestroy;
+import com.datastax.driver.core.SocketOptions;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.slf4j.Logger;
@@ -65,6 +66,7 @@ public class CassandraClient {
.withRetryPolicy(DefaultRetryPolicy.INSTANCE);
cassandraHosts.forEach(host -> clusterBuilder.addContactPoint(host));
+ setSocketOptions(clusterBuilder);
enableAuthentication(clusterBuilder);
enableSsl(clusterBuilder);
setLocalDc(clusterBuilder);
@@ -78,6 +80,21 @@ public class CassandraClient {
logger.info("** CassandraClient created");
}
+ private void setSocketOptions(Cluster.Builder clusterBuilder) {
+ SocketOptions socketOptions =new SocketOptions();
+ Integer socketConnectTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getSocketConnectTimeout();
+ if( socketConnectTimeout!=null ){
+ logger.info("SocketConnectTimeout was provided, setting Cassandra client to use SocketConnectTimeout: {} .",socketConnectTimeout);
+ socketOptions.setConnectTimeoutMillis(socketConnectTimeout);
+ }
+ Integer socketReadTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getSocketReadTimeout();
+ if( socketReadTimeout != null ){
+ logger.info("SocketReadTimeout was provided, setting Cassandra client to use SocketReadTimeout: {} .",socketReadTimeout);
+ socketOptions.setReadTimeoutMillis(socketReadTimeout);
+ }
+ clusterBuilder.withSocketOptions(socketOptions);
+ }
+
private void setLocalDc(Cluster.Builder clusterBuilder) {
String localDataCenter = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig()
.getLocalDataCenter();
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 e1e33871b1..ca737b2a5d 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
@@ -22,6 +22,7 @@ package org.openecomp.sdc.be.dao.cassandra.schema;
import java.util.List;
+import com.datastax.driver.core.SocketOptions;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -73,6 +74,18 @@ public class SdcSchemaUtils {
System.setProperty("javax.net.ssl.trustStorePassword", truststorePassword);
clusterBuilder.withSSL();
}
+ SocketOptions socketOptions =new SocketOptions();
+ Integer socketConnectTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getSocketConnectTimeout();
+ if( socketConnectTimeout!=null ){
+ log.info("SocketConnectTimeout was provided, setting Cassandra client to use SocketConnectTimeout: {} .",socketConnectTimeout);
+ socketOptions.setConnectTimeoutMillis(socketConnectTimeout);
+ }
+ Integer socketReadTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getSocketReadTimeout();
+ if( socketReadTimeout != null ){
+ log.info("SocketReadTimeout was provided, setting Cassandra client to use SocketReadTimeout: {} .",socketReadTimeout);
+ socketOptions.setReadTimeoutMillis(socketReadTimeout);
+ }
+ clusterBuilder.withSocketOptions(socketOptions);
return clusterBuilder.build();
}
diff --git a/sdc-os-chef/scripts/docker_run.sh b/sdc-os-chef/scripts/docker_run.sh
index a34b332f69..db9a674a86 100755
--- a/sdc-os-chef/scripts/docker_run.sh
+++ b/sdc-os-chef/scripts/docker_run.sh
@@ -322,8 +322,6 @@ function sdc-cs {
#Cassandra-init
function sdc-cs-init {
- #fix for csit failuer
- sleep 30
echo "docker run sdc-cassandra-init..."
if [ ${LOCAL} = false ]; then
docker pull ${PREFIX}/sdc-cassandra-init:${RELEASE}
@@ -342,7 +340,7 @@ function sdc-cs-onboard-init {
fi
docker run --name sdc-cs-onboard-init --env RELEASE="${RELEASE}" --env CS_HOST_IP=${IP} --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 $LOCAL_TIME_MOUNT_CMD --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/root/chef-solo/cache ${PREFIX}/sdc-onboard-cassandra-init:${RELEASE}
rc=$?
- docker_logs sdc-onboard-cs-init
+ docker_logs sdc-cs-onboard-init
if [[ $rc != 0 ]]; then exit $rc; fi
}