]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
cassandra: Fix paged queries to work again
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 13 Sep 2017 12:16:59 +0000 (15:16 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 27 Sep 2017 10:39:38 +0000 (13:39 +0300)
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.

src/lib-sql/driver-cassandra.c

index 7d4513e1fd9b9d840e6392df0c876aa272742c3f..f3741a73decd4174ec6b095af9f43784ce065581 100644 (file)
@@ -988,7 +988,8 @@ static void driver_cassandra_result_send_query(struct cassandra_result *result)
        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 @@ driver_cassandra_result_more(struct sql_result **_result, bool async,
           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;