incubator-cassandra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maifi Khan <maifi.k...@gmail.com>
Subject Re: Locking in cassandra
Date Mon, 16 Aug 2010 13:23:37 GMT
Hi Gary
Thanks for your reply.
Say, I am keeping track of total expenditure . Say, at time t, the
value was 100. Now, at t+1,
say my 10 node network got partitioned and become two disjoint set S1
(node 1,2,3,4,5,)and S2 (node 6,7,8,9,10).

1) At time t+2:  For incoming value 20 , it uses set S1 and write 120
to node 1 to 5.
2) At time t+3:  For incoming value 40 , it uses set S2 and write 140
(as it can not read the value 120 ) to node 6 to 10.

Now, when the network gets connected again, it will only store the
value 140 instead of 160 which is the correct value.

Am I right?
Even in case where the network is not partitioned,
It is possible two incoming values both come at the same time and read
the same value (100) and then overwrite each other.
How does cassandra deal with such race condition?

thanks
Maifi


On Mon, Aug 16, 2010 at 9:13 AM, Gary Dusbabek <gdusbabek@gmail.com> wrote:
> From a cluster perspective there is no locking, atomicity or
> isolation.  In your example, 5 nodes may be written to and if a 6th
> write doesn't happen, the write is failed, but the 5 writes that
> happened stay.
>
> The code is in two places.  StorageProxy.mutate (and mutateBlocking)
> is where the local write happens (if a coordinator is reponsible for
> the mutation key).  RowMutationVerbHandler does the same work on the
> remote nodes and acknowledges the writes.
>
> Gary.
>
> On Mon, Aug 16, 2010 at 08:07, Maifi Khan <maifi.khan@gmail.com> wrote:
>> Hi
>> How is the locking implemented in cassandra? Say, I have 10 nodes and
>> I want to write to 6 nodes which is (n+1)/2.
>> Will it lock 6 nodes first and then start writing? Or will it write
>> one by one and see if it can write to 6 nodes.
>> How is this implemented? What package does this locking?
>> Thanks in advance.
>>
>> thanks
>>
>

Mime
View raw message