You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Maifi Khan <ma...@gmail.com> on 2010/08/19 19:00:47 UTC

questions regarding read and write in cassandra

Hi
I have a question in the following scenario.
Say we have 10 nodes, Replication factor is 5.
Now, say, for Row X, Column Y, data is replicated to node 1,2,3,4,5
and current value is 10
Say, I issue a write command with value “20” to Row X, column Y with
quorum(n/2+1=3 nodes).  Say it updated 1 and 2 and failed to update
any other node. So it failed to write to 3 nodes. What happens in such
scenario?

Q: Will the user returned failed?

Now, assuming that the write failed.
What value will I see if I want to read the same cell with Quorum?
Now, say I read the data with quorum. It read from 1, 4, 5 and see
that node 1 has the most recent data (“20” which is still there as
cassandra does not roll back).
Will it will return the data “20” to the user or will it return the
earlier value 10 as it is returned by the node 4 and 5?

Also, does read repair tries to propagate 20 to all the replicas
although cassandra returned failed to the user?


thanks

Re: questions regarding read and write in cassandra

Posted by Benjamin Black <b...@b3k.us>.
More recent.  Newest timestamp always wins.  And I am moving this to
the user list (again) so it can be with all its friendly threads on
the exact same topic.

On Thu, Aug 19, 2010 at 10:22 AM, Maifi Khan <ma...@gmail.com> wrote:
> Hi David
> Thanks for your reply.
> But what happens if I read and get 2 nodes has value 10 with older
> time stamp and the third node has 20 with more recent time stamp?
> Will cassandra return 10(majority) or 20(more recent)?
>
> thanks
> Maifi
>
> On Thu, Aug 19, 2010 at 1:20 PM, David Timothy Strauss
> <da...@fourkitchens.com> wrote:
>> The quorum write would fail, but the data would not be rolled back. Assuming the offline nodes recover, the data would eventually replicate.
>>
>> This question belongs on the user list, though.
>>
>> -----Original Message-----
>> From: Maifi Khan <ma...@gmail.com>
>> Date: Thu, 19 Aug 2010 13:00:47
>> To: <de...@cassandra.apache.org>
>> Reply-To: dev@cassandra.apache.org
>> Subject: questions regarding read and write in cassandra
>>
>> Hi
>> I have a question in the following scenario.
>> Say we have 10 nodes, Replication factor is 5.
>> Now, say, for Row X, Column Y, data is replicated to node 1,2,3,4,5
>> and current value is 10
>> Say, I issue a write command with value “20” to Row X, column Y with
>> quorum(n/2+1=3 nodes).  Say it updated 1 and 2 and failed to update
>> any other node. So it failed to write to 3 nodes. What happens in such
>> scenario?
>>
>> Q: Will the user returned failed?
>>
>> Now, assuming that the write failed.
>> What value will I see if I want to read the same cell with Quorum?
>> Now, say I read the data with quorum. It read from 1, 4, 5 and see
>> that node 1 has the most recent data (“20” which is still there as
>> cassandra does not roll back).
>> Will it will return the data “20” to the user or will it return the
>> earlier value 10 as it is returned by the node 4 and 5?
>>
>> Also, does read repair tries to propagate 20 to all the replicas
>> although cassandra returned failed to the user?
>>
>>
>> thanks
>>
>

Re: questions regarding read and write in cassandra

Posted by Maifi Khan <ma...@gmail.com>.
Hi David
Thanks for your reply.
But what happens if I read and get 2 nodes has value 10 with older
time stamp and the third node has 20 with more recent time stamp?
Will cassandra return 10(majority) or 20(more recent)?

thanks
Maifi

On Thu, Aug 19, 2010 at 1:20 PM, David Timothy Strauss
<da...@fourkitchens.com> wrote:
> The quorum write would fail, but the data would not be rolled back. Assuming the offline nodes recover, the data would eventually replicate.
>
> This question belongs on the user list, though.
>
> -----Original Message-----
> From: Maifi Khan <ma...@gmail.com>
> Date: Thu, 19 Aug 2010 13:00:47
> To: <de...@cassandra.apache.org>
> Reply-To: dev@cassandra.apache.org
> Subject: questions regarding read and write in cassandra
>
> Hi
> I have a question in the following scenario.
> Say we have 10 nodes, Replication factor is 5.
> Now, say, for Row X, Column Y, data is replicated to node 1,2,3,4,5
> and current value is 10
> Say, I issue a write command with value “20” to Row X, column Y with
> quorum(n/2+1=3 nodes).  Say it updated 1 and 2 and failed to update
> any other node. So it failed to write to 3 nodes. What happens in such
> scenario?
>
> Q: Will the user returned failed?
>
> Now, assuming that the write failed.
> What value will I see if I want to read the same cell with Quorum?
> Now, say I read the data with quorum. It read from 1, 4, 5 and see
> that node 1 has the most recent data (“20” which is still there as
> cassandra does not roll back).
> Will it will return the data “20” to the user or will it return the
> earlier value 10 as it is returned by the node 4 and 5?
>
> Also, does read repair tries to propagate 20 to all the replicas
> although cassandra returned failed to the user?
>
>
> thanks
>

Re: questions regarding read and write in cassandra

Posted by David Timothy Strauss <da...@fourkitchens.com>.
The quorum write would fail, but the data would not be rolled back. Assuming the offline nodes recover, the data would eventually replicate.

This question belongs on the user list, though.

-----Original Message-----
From: Maifi Khan <ma...@gmail.com>
Date: Thu, 19 Aug 2010 13:00:47 
To: <de...@cassandra.apache.org>
Reply-To: dev@cassandra.apache.org
Subject: questions regarding read and write in cassandra

Hi
I have a question in the following scenario.
Say we have 10 nodes, Replication factor is 5.
Now, say, for Row X, Column Y, data is replicated to node 1,2,3,4,5
and current value is 10
Say, I issue a write command with value “20” to Row X, column Y with
quorum(n/2+1=3 nodes).  Say it updated 1 and 2 and failed to update
any other node. So it failed to write to 3 nodes. What happens in such
scenario?

Q: Will the user returned failed?

Now, assuming that the write failed.
What value will I see if I want to read the same cell with Quorum?
Now, say I read the data with quorum. It read from 1, 4, 5 and see
that node 1 has the most recent data (“20” which is still there as
cassandra does not roll back).
Will it will return the data “20” to the user or will it return the
earlier value 10 as it is returned by the node 4 and 5?

Also, does read repair tries to propagate 20 to all the replicas
although cassandra returned failed to the user?


thanks