tikv / client-java

TiKV Java Client
https://tikv.github.io/client-java/
Apache License 2.0
111 stars 109 forks source link

Question about CAS API #622

Open kaixinbaba opened 2 years ago

kaixinbaba commented 2 years ago

Question

When I use CAS API

void compareAndSet(ByteString key, Optional<ByteString> prevValue, ByteString value);

void compareAndSet(ByteString key, Optional<ByteString> prevValue, ByteString value, long ttl);

How do I know the CAS's operation success?

Shouldn't these two APIs return boolean instead of void? Just like:

boolean compareAndSet(ByteString key, Optional<ByteString> prevValue, ByteString value);

boolean compareAndSet(ByteString key, Optional<ByteString> prevValue, ByteString value, long ttl);

Please explain my doubts~😭

iosmanthus commented 2 years ago

If the CAS operation encounters a conflict, a type of RawCASConflictException exception will raise.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity.