Skip to content

Commit

Permalink
cassandra: Fix paged queries to work again
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sirainen authored and Timo Sirainen committed Sep 13, 2017
1 parent 2912eac commit 214aff7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib-sql/driver-cassandra.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 214aff7

Please sign in to comment.