java-driver icon indicating copy to clipboard operation
java-driver copied to clipboard

JAVA-3055 CqlPrepareAsyncProcessor must handle cancellations of the r…

Open tomas-bilka opened this issue 2 years ago • 3 comments

JAVA-3055 CqlPrepareAsyncProcessor must handle cancellations of the returned Future

tomas-bilka avatar Aug 31 '23 12:08 tomas-bilka

Hi @tomas-bilka thank you for the PR.

Have you signed the Contributor License Agreement for contributions to DataStax open source projects? If not you can find it at https://cla.datastax.com/. Thanks!

hhughes avatar Sep 07 '23 15:09 hhughes

I just signed the CLA.

tomas-bilka avatar Sep 07 '23 17:09 tomas-bilka

I made another PR for 3055 some time ago. Then had a review from a colleague for a better and simpler implementation which I believe is quite nice.

See https://github.com/apache/cassandra-java-driver/pull/1757

lucboutier avatar Dec 11 '23 14:12 lucboutier

Any progress?

mcoolive avatar Sep 27 '24 12:09 mcoolive

I think this approach doesn't seem to be able to prevent the underlying problem.

There is edge case When two duplicate prepare requests A and B are received (assuming A arrived slightly earlier), the cancellation of one request propagates to the other.

  1. Request A
  2. Cache loaded with request A. Asynchronous prepare call to Cassandra (referred to as 'a')
  3. Request B
  4. B waits for a response from the cache based on request A
  5. cancel() in request A
  6. B receives the cancel() from request A and propagates a CancellationException
  7. Response from 'a' completes. Upon receiving the cancellation of A, cache invalidation proceeds at this time

In my opinion, lucboutier's PR looks better to me.

aerain avatar Oct 02 '24 08:10 aerain