You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Eldad Yamin <el...@gmail.com> on 2011/08/02 22:58:23 UTC
Question about eventually consistent in Cassandra
Hi,
Let’s say that I have 2 datacenters, a key is changed on both of my
datacenters in the exact same time (even in 1-2 seconds diff).
Datacenter #1 add column "abc" with value X Datacenter #2 add column "abc"
with value Y.
What is the result of that situation?
Is there any different if the changes will be made withing the same data
center?
Thanks!
Eldad Yamin
Re: Question about eventually consistent in Cassandra
Posted by Kent Narling <ke...@gmail.com>.
Have not used Cassandra much yet, but it seems pretty clear to me that the
entry with the latest timestamp (sent in by the client) will be the one that
will be the "winner" eventually.
Mark here that this is the timestamp the client send in which is not
necessarily the actual time.
So eg if the Datacenter #1 sets X with timestamp 1234 and Datacenter #1 sets
Y with timestamp 1233 then eventually the value X will be the value that all
client reads get since it has the highest timestamp.
On Tue, Aug 2, 2011 at 10:58 PM, Eldad Yamin <el...@gmail.com> wrote:
> Hi,
> Let’s say that I have 2 datacenters, a key is changed on both of my
> datacenters in the exact same time (even in 1-2 seconds diff).
> Datacenter #1 add column "abc" with value X Datacenter #2 add column "abc"
> with value Y.
>
> What is the result of that situation?
> Is there any different if the changes will be made withing the same data
> center?
>
> Thanks!
> Eldad Yamin
>
Re: Question about eventually consistent in Cassandra
Posted by Ryan King <ry...@twitter.com>.
On Wed, Aug 3, 2011 at 10:09 AM, mcasandra <mo...@gmail.com> wrote:
> What happens when DC is in different time zone so 9:00 pacific vs 11:00
> Central
Nothing. Timestamps have no knowledge of timezones, they're just
offsets from an arbitrary point in the past.
-ryan
Re: Question about eventually consistent in Cassandra
Posted by mcasandra <mo...@gmail.com>.
What happens when DC is in different time zone so 9:00 pacific vs 11:00
Central
--
View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Question-about-eventually-consistent-in-Cassandra-tp6646430p6649490.html
Sent from the cassandra-user@incubator.apache.org mailing list archive at Nabble.com.
Re: Question about eventually consistent in Cassandra
Posted by aaron morton <aa...@thelastpickle.com>.
yup, my bad.
A
-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelastpickle.com
On 3 Aug 2011, at 19:45, Sam Overton wrote:
> A slight correction/clarification:
>
> 1) DeletedColumns always win. If there are two deletes the highest timestamp wins
>
> DeletedColumns only take precedence over a normal value if they have a greater (or equal) timestamp. "DeletedColumns always win" is only true if you're talking about two columns with identical timestamps.
>
>
> --
> Sam Overton
> Acunu | http://www.acunu.com | @acunu
Re: Question about eventually consistent in Cassandra
Posted by Sam Overton <so...@acunu.com>.
A slight correction/clarification:
1) DeletedColumns always win. If there are two deletes the highest timestamp
> wins
DeletedColumns only take precedence over a normal value if they have a
greater *(or equal)* timestamp. *"DeletedColumns always win"* is only true
if you're talking about two columns with identical timestamps.
--
Sam Overton
Acunu | http://www.acunu.com | @acunu
Re: Question about eventually consistent in Cassandra
Posted by aaron morton <aa...@thelastpickle.com>.
Columns are reconciled using the following logic:
1) DeletedColumns always win. If there are two deletes the highest timestamp wins
2) For non deleted columns the one with the highest timestamp wins.
3) In the case of timestamp collision the column with the highest value (by comparing bytes) wins.
In practice you normally only see timestamp collisions when something is wrong in your code. As a side there is nothing that says the timestamp must be a time stamp, it's just a 64bit int sequence that the server uses to reconcile columns of the same name.
In general it's best to avoid situations where you rely on highly sync'd clocks.
Hope that helps.
-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelastpickle.com
On 3 Aug 2011, at 10:05, Konstantin Naryshkin wrote:
> I believe that what would happen is that whichever data center has the later clock will win. Every modification you make gets a time stamp (generally set by your client to the current time, if you are using one). I believe that whatever modification happened with the last time stamp is canonical. What would happen if you make conflicting changes with the exact same time stamp? No idea.
>
> ----- Original Message -----
> From: "Eldad Yamin" <el...@gmail.com>
> To: user@cassandra.apache.org
> Sent: Tuesday, August 2, 2011 8:58:23 PM
> Subject: Question about eventually consistent in Cassandra
>
> Hi,
> Let’s say that I have 2 datacenters, a key is changed on both of my
> datacenters in the exact same time (even in 1-2 seconds diff).
> Datacenter #1 add column "abc" with value X Datacenter #2 add column "abc"
> with value Y.
>
> What is the result of that situation?
> Is there any different if the changes will be made withing the same data
> center?
>
> Thanks!
> Eldad Yamin
Re: Question about eventually consistent in Cassandra
Posted by Konstantin Naryshkin <ko...@a-bb.net>.
I believe that what would happen is that whichever data center has the later clock will win. Every modification you make gets a time stamp (generally set by your client to the current time, if you are using one). I believe that whatever modification happened with the last time stamp is canonical. What would happen if you make conflicting changes with the exact same time stamp? No idea.
----- Original Message -----
From: "Eldad Yamin" <el...@gmail.com>
To: user@cassandra.apache.org
Sent: Tuesday, August 2, 2011 8:58:23 PM
Subject: Question about eventually consistent in Cassandra
Hi,
Let’s say that I have 2 datacenters, a key is changed on both of my
datacenters in the exact same time (even in 1-2 seconds diff).
Datacenter #1 add column "abc" with value X Datacenter #2 add column "abc"
with value Y.
What is the result of that situation?
Is there any different if the changes will be made withing the same data
center?
Thanks!
Eldad Yamin