changeset 22532:10d5c2886b60

cassandra: Fix paged queries to work again When continuing the result, consistency was reset to 0 (=ANY), which caused the queries to fail. There's no need to initialize the statement again when continuing it. Also set result->consistency to be correct mainly for debugging purposes.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 13 Sep 2017 15:16:59 +0300
parents 65df17ce8844
children 062f94c547ce
files src/lib-sql/driver-cassandra.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-sql/driver-cassandra.c	Tue Sep 12 13:23:51 2017 +0300
+++ b/src/lib-sql/driver-cassandra.c	Wed Sep 13 15:16:59 2017 +0300
@@ -988,7 +988,8 @@
 	i_assert(result->statement != NULL);
 
 	db->counters[CASSANDRA_COUNTER_TYPE_QUERY_SENT]++;
-	driver_cassandra_init_statement(result);
+	if (result->query_type != CASSANDRA_QUERY_TYPE_READ_MORE)
+		driver_cassandra_init_statement(result);
 
 	future = cass_session_execute(db->session, result->statement);
 	driver_cassandra_set_callback(future, db, query_callback, result);
@@ -1361,6 +1362,7 @@
 	   the caller" error text, so it won't be in the debug log output. */
 	i_free_and_null(old_result->error);
 
+	new_result->consistency = old_result->consistency;
 	new_result->page_num = old_result->page_num + 1;
 	new_result->page0_start_time = old_result->page0_start_time;
 	new_result->total_row_count = old_result->total_row_count;