Bear in mind that LWT will, under certain circumstances fail too. See
amazing Chris Batey's talk about it on Cassandra Summit:
https://www.youtube.com/watch?v=wcxQM3ZN20c

Carlos Alonso | Software Engineer | @calonso <https://twitter.com/calonso>

On 7 November 2016 at 22:22, Justin Cameron <jus...@instaclustr.com> wrote:

> You can use lightweight transactions to achieve this.
>
> Example:
> UPDATE item SET customer = 'Joe' WHERE item_id = 2 IF customer = null;
>
> Keep in mind that lightweight transactions have performance tradeoffs (
> http://www.datastax.com/dev/blog/lightweight-transactions-in-cassandra-2-0
> )
>
>
> On Mon, 7 Nov 2016 at 11:52 S Ahmed <sahmed1...@gmail.com> wrote:
>
>> Say I have 100 products in inventory, instead of having a counter I want
>> to create 100 rows per inventory item.
>>
>> When someone purchases a product, how can I correctly assign that
>> customer a product from inventory without having any race conditions etc?
>>
>> Thanks.
>>
> --
>
> Justin Cameron
>
> Senior Software Engineer | Instaclustr
>
>
>
>
> This email has been sent on behalf of Instaclustr Pty Ltd (Australia) and
> Instaclustr Inc (USA).
>
> This email and any attachments may contain confidential and legally
> privileged information.  If you are not the intended recipient, do not copy
> or disclose its content, but please reply to this email immediately and
> highlight the error to the sender and then immediately delete the message.
>
>

Reply via email to