Failed CassFuture only if setting callback for the future

14 views
Skip to first unread message

f.ber...@gmail.com

unread,
Feb 22, 2018, 4:02:21 AM2/22/18
to DataStax C++ Driver for Apache Cassandra User Mailing List

Hello all,

I am using the c++ driver, tag 2.8.1, with libuv v1.18.0, both compiled with g++ on OpenIndiana and Debian (testing and 9).

I want to test a scylla db with repeated write operations only. A single write operation is a simple INSERT, in a single table, 4 columns, less than 50 byte per insert. The test is *not* run in batch mode.

Now the point: I get a `CassFuture` from the `cass_session_execute()` function; if I wait synchronously the future on `cass_future_error_code()`, everything is fine; but if I feed a callback in the `cass_future_set_callback()`, some of the INSERTs fail.

There is a nasty problem on the failure: calling `cass_future_error_code()` inside the callback *never* return any error, while `cass_future_get_result()` does (according to documentation, the result is `nullptr` if an error has occured: http://datastax.github.io/cpp-driver/api/struct.CassFuture/#function-cass_future_get_result); the number of errors (of `nullptr`s) returned by `cass_future_get_result()` exactly corresponds to the number of failed INSERTs.

Errors from metrics (`cass_session_get_metrics()`) do not count any failure.

Setting the `cass_statement_set_retry_policy()` to a "downgrading consistency" does not change this behavior (but I would say it is expected according to the doc: http://datastax.github.io/cpp-driver/api/struct.CassRetryPolicy/#function-cass_retry_policy_downgrading_consistency_new).

The request timeouts for each statement are set to "no timeout" passing a 0-value to `cass_statement_set_request_timeout()`.

So the questions are:
.1 to what extent do `cass_future_error_code()` and `cass_future_get_result()` differ and can they be trusted?
.2 is there any other mechanism to ensure retry? am I expected to retry inside the callback?

Needless to say, I would like to go multi-threaded, with limitless retry policy :-D

Please let me know if you need more information, or if questions are unclear.
Thank you very much in advance.

cheers,
Federico

Michael Penick

unread,
Feb 22, 2018, 3:06:29 PM2/22/18
to cpp-dri...@lists.datastax.com
Does `cass_future_get_error_result()` return anything? It's just a thought, however; `cass_future_error_code()` is usually properly set when there's an error result and has a `CASS_ERROR_SERVER_XXX` error.

Mike


--
You received this message because you are subscribed to the Google Groups "DataStax C++ Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cpp-driver-user+unsubscribe@lists.datastax.com.

federico bertolucci

unread,
Feb 23, 2018, 5:16:29 AM2/23/18
to cpp-dri...@lists.datastax.com

   Hello Michael,

`cass_future_get_error_result()` always returns `nullptr`.

this means that everything is fine (not true) *or* or the failure was not caused by a server error.

It is strange that only asynchronous mode gives such kind of problems, it sounds like the async mode with callbacks is buggy... Is there any limit to the number of futures that can be instantiated in async mode?

We want to understand if we are not using the driver in the proper way.

Thank you again.

best,
   Federico

Reply all
Reply to author
Forward
0 new messages