incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Riyad Kalla <rka...@gmail.com>
Subject Re: Counters and replication factor
Date Mon, 07 Nov 2011 15:52:01 GMT
Alain,

Try using a CL of 3 or "ALL" and see if that the problem goes away.

Your replication factor (as I just learned) dictates how many nodes each
piece of data is replicated to; by using a RF of 3 you are saying
"replicate all my data to all my nodes" (in this case counters).

This doesn't happen immediately, but you can *force* it to happen on write
by specifying a CL of "ALL". If you specify "1" then your counter value is
written to one member of the ring, then your command returns.

If you keep querying you will bounce around your ring, reading the values
from the different nodes until a future date at *which point* all the
values will likely agree.

If you keep all your code you have now exactly the same, just change the
code at the end where you read the counter value back, to keep reading the
counter value back every second for 60 seconds and see if all the values
eventually match up -- they should (as the counter value is replicated to
all the nodes and their old values discarded).

-R

On Mon, Nov 7, 2011 at 8:15 AM, Alain RODRIGUEZ <arodrime@gmail.com> wrote:

> Hi,
>
> I trying to switch from a RF = 1 to a RF = 3, but I get wrong values from
> counters when doing so...
>
> I got a CF that contains many counters of some events. When I'm at RF = 1
> and simulate 10 events, they are well counted.
> However, when I switch to a RF = 3, my counter show a wrong value that
> sometimes change when requested twice (it can return 7, then 5 instead of
> 10 all the time).
>
> I first thought that it was a problem of CL because I seem to remember
> that I read once that I had to use CL.One for reads and writes with
> counters. So I tried with CL.One, without success...
>
> What am I doing wrong ? Is that some precaution to take when replicating
> counters ?
>
> Alain
>

Mime
View raw message