dovecot-2.2: cassandra: Added "version" parameter to specify a p...

dovecot at dovecot.org dovecot at dovecot.org
Thu Sep 24 17:52:39 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/e92af8f36ed0
changeset: 19218:e92af8f36ed0
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 24 20:51:16 2015 +0300
description:
cassandra: Added "version" parameter to specify a protocol version.
Mainly to avoid warnings logged when connecting to an older Cassandra
server.

diffstat:

 src/lib-sql/driver-cassandra.c |  6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (30 lines):

diff -r bf64724225e9 -r e92af8f36ed0 src/lib-sql/driver-cassandra.c
--- a/src/lib-sql/driver-cassandra.c	Thu Sep 24 20:28:51 2015 +0300
+++ b/src/lib-sql/driver-cassandra.c	Thu Sep 24 20:51:16 2015 +0300
@@ -39,6 +39,7 @@
 	char *hosts, *keyspace;
 	CassConsistency read_consistency, write_consistency, delete_consistency;
 	CassLogLevel log_level;
+	unsigned int protocol_version;
 
 	CassCluster *cluster;
 	CassSession *session;
@@ -384,6 +385,9 @@
 		} else if (strcmp(key, "log_level") == 0) {
 			if (log_level_parse(value, &db->log_level) < 0)
 				i_fatal("cassandra: Unknown log_level: %s", value);
+		} else if (strcmp(key, "version") == 0) {
+			if (str_to_uint(value, &db->protocol_version) < 0)
+				i_fatal("cassandra: Invalid version: %s", value);
 		} else {
 			i_fatal("cassandra: Unknown connect string: %s", key);
 		}
@@ -415,6 +419,8 @@
 	cass_cluster_set_connect_timeout(db->cluster, SQL_CONNECT_TIMEOUT_SECS * 1000);
 	cass_cluster_set_request_timeout(db->cluster, SQL_QUERY_TIMEOUT_SECS * 1000);
 	cass_cluster_set_contact_points(db->cluster, db->hosts);
+	if (db->protocol_version != 0)
+		cass_cluster_set_protocol_version(db->cluster, db->protocol_version);
 	db->session = cass_session_new();
 	i_array_init(&db->results, 16);
 	i_array_init(&db->callbacks, 16);


More information about the dovecot-cvs mailing list