You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Narendra Sharma <na...@gmail.com> on 2011/02/01 20:23:06 UTC

Does HH work (or make sense) for counters?

Version: Cassandra 0.7.1 (build from trunk)

Setup:
- Cluster of 2 nodes (Say A and B)
- HH enabled
- Using the default Keyspace definition in cassandra.yaml
- Using SuperCounter1 CF

Client:
- Using CL of ONE

I started the two Cassandra nodes, created schema and then shutdown one of
the instances (say B). Executed counter update and read operations on A with
CL=ONE. Everything worked fine. All counters were returned with correct
values. Now started node B, waited for couple of mins. Executed only counter
read operation on B with CL=ONE. Initially got no counters for any of the
rows. On second (and subsequent tries) try got counters for only one (same
row always) out of ten rows.

After doing one read with CL=QUORUM, reads with CL=ONE started returning
correct data.

Thanks,
Naren

Re: Does HH work (or make sense) for counters?

Posted by Sylvain Lebresne <sy...@datastax.com>.
When you create a counter column family, there is an option called
replicate_on_write. When this option is off then during a write the
increment is written to only one node and not replicated at all. In
particular it is not hinted to any node.

While unsafe, if you can accept its potential consequences, this
option can make sense if you want to do sustain very fast increments,
because replication for counters (unlike for normal writes) implies a read.

Right now, replicate_on_write is off by default, but if you turn it on HH
should work as expected (or then, that would likely be a bug).

Sylvain

On Tue, Feb 1, 2011 at 8:23 PM, Narendra Sharma
<na...@gmail.com>wrote:

> Version: Cassandra 0.7.1 (build from trunk)
>
> Setup:
> - Cluster of 2 nodes (Say A and B)
> - HH enabled
> - Using the default Keyspace definition in cassandra.yaml
> - Using SuperCounter1 CF
>
> Client:
> - Using CL of ONE
>
> I started the two Cassandra nodes, created schema and then shutdown one of
> the instances (say B). Executed counter update and read operations on A with
> CL=ONE. Everything worked fine. All counters were returned with correct
> values. Now started node B, waited for couple of mins. Executed only counter
> read operation on B with CL=ONE. Initially got no counters for any of the
> rows. On second (and subsequent tries) try got counters for only one (same
> row always) out of ten rows.
>
> After doing one read with CL=QUORUM, reads with CL=ONE started returning
> correct data.
>
> Thanks,
> Naren
>
>
>
>