incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sasha Dolgy <sdo...@gmail.com>
Subject simple implementation of counters
Date Fri, 20 May 2011 10:55:46 GMT
Hi,

I'm trying to play around with 0.8.0-rc1 and counters, and I'm a
little confused.

First question I have is about the definition.  A column within a
standard column family cannot be a counter column type?

I had tried the following, with no success.

create column family urlcounts
	with comparator = UTF8Type
                and default_validation_class = LongType
	and column_metadata=[
		{ column_name:count,
		  validation_class:CounterColumnType
		}
	];


The only successful way was for me to create a new column family with
a default validation class of "CounterColumnType":

create column family counters with default_validation_class = CounterColumnType;

Now I have a column family with counters:

Keyspace: sdo:
  Replication Strategy: org.apache.cassandra.locator.NetworkTopologyStrategy
    Options: [datacenter1:1]
  Column Families:
    ColumnFamily: counters
      Key Validation Class: org.apache.cassandra.db.marshal.BytesType
      Default column value validator:
org.apache.cassandra.db.marshal.CounterColumnType
      Columns sorted by: org.apache.cassandra.db.marshal.BytesType
      Row cache size / save period in seconds: 0.0/0
      Key cache size / save period in seconds: 200000.0/14400
      Memtable thresholds: 0.2953125/63/1440 (millions of ops/MB/minutes)
      GC grace seconds: 864000
      Compaction min/max thresholds: 4/32
      Read repair chance: 1.0
      Replicate on write: false
      Built indexes: []

>From the CLI, I insert / increment a [key][column] in this column family:

incr counters[ascii('foo')][ascii('c1')];

Second question:  If I want to implement counters, they have to exist
in a seperate column family from the rest of my data?

-- 
Sasha Dolgy
sasha.dolgy@gmail.com

Mime
View raw message