datastax/cpp-driver — pull request #12 by cbracher (2014-02-04 23:25:44+00:00)
Title: Dev - with these changes we are getting stability in our application which is using the c++ version of libcql.

In particular, our testing showed issues in the case where our cassandra db was going through a rolling restart or in dev - with a single cassandra server - where that db went through repeated restarts.

We were seeing 2 threading issues:
src/cql/internal/cql_session_impl.cpp having callbacks on a connection which may have gone away. Pretty noisy under valgrind with the local cassandra db getting restarted. The solution here is a bit rigid, and just holds the connection indefinitely, but that works for our case since we restart the servers on a weekly basis. If a timeout that could be trusted were available, that could be used to purge the list.

cql::cql_session_impl_t::connect which is working on a cql_connections_collection_t* connections which is a raw pointer that could become invalidated since it is not under a lock.

Outside of this, we also saw issues where we called wait() on the returned futures. During a rolling restart, that would sometime lock up. We had to go with wait_for() in order to be robust in our production env. Wondering if that could be addressed in the lib with a timeout being detected.

With these changes, our service which makes hundreds of cassandra calls per second can now survive rolling restarts of our cassandra db. Or course, its up to you to decide if they have any value to datastax.

Thanks for the lib, using cassandra through the datastax c++ client is very helpful.