Hi Rouble,

I usually have to read javadoc in java driver to get my ideas straight
regarding exception handling.

You can find informations reading :
http://docs.datastax.com/en/drivers/java/3.1/com/datastax/driver/core/policies/RetryPolicy.html
 and for instance
http://docs.datastax.com/en/drivers/java/3.1/com/datastax/driver/core/policies/DowngradingConsistencyRetryPolicy.html
 with the onWriteTimeout method which differentiate several case of error.

As Edward stated, you can know how many replica acknowleged the write in
Cassandra response.

Keep in mind that retrying usually mean your write query is idempotent or
you don't care having duplicate entries


On 14 February 2017 at 21:49, Edward Capriolo <edlinuxg...@gmail.com> wrote:

>
>
> On Tue, Feb 14, 2017 at 2:30 PM, rouble <r.ou...@gmail.com> wrote:
>
>> Cassandra Gurus,
>>
>> I have a question open on stackoverlow on how to determine if data is
>> actually created when a Write exception is thrown: http://stackoverflow.c
>> om/questions/42231140/determining-if-data-will-be-created-on
>> -cassandra-write-exceptions
>>
>> From my discussion on the question, it seems that on *any* Cassandra
>> write, *any* exception, means the data may or may not be written. With the
>> exception of InvalidQueryException.
>>
>> I find this unsettling. Maybe I need time to adjust from my RDBMS
>> background, but how is Cassandra supposed to be used for systems that need
>> user feedback? or is it?
>>
>> Let me use the simple example of account creation. User tries to create
>> an account, and we need to indicate one way or the other whether the
>> account was created. Lets say a WriteTimeoutException is thrown while
>> trying to add the user. User may or may not be written, what do we tell the
>> user? Should we just rollback the change and tell the user that it failed.
>> This seems like the only thing we can do deterministically (and I notice
>> someone doing just that here: http://stackoverflow.com/a/34860495/215120
>> ).
>>
>> How are people handling WriteTimeoutExceptions or UnavailableExceptions?
>> Rolling back in every case does not seem practical.
>>
>> tia,
>> Rouble
>>
>
> There is a difference between WriteTimeoutException and
> UnavailableException.
>
> UnavailableException indicates the write was never even attempted.
>
> WriteTimeoutException means the write was attempted. I believe you can
> interrogate the exception to determine if the operation was successful on
> any of the natural endpoints.
>
> The way to "cope" is idempotent writes and retries.  If that model does
> not fit it is a square peg round hole discussion.
>

Reply via email to