]> 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 <tss@dovecot.fi>
Wed, 13 Sep 2017 15:04:56 +0000 (18:04 +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 a87a981a51d466d44683e912acfacc4fae2128cb..d83afec091287f90fd29f484e799e3fab9a6adb3 100644 (file)
@@ -993,7 +993,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);
@@ -1366,6 +1367,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;