Cassandra crashes

2013-09-04 Thread Jan Algermissen
Hi,

I have set up C* in a very limited environment: 3 VMs at digitalocean with 2GB 
RAM and 40GB SSDs, so my expectations about overall performance are low.

Keyspace uses replication level of 2.

I am loading 1.5 Mio rows (each 60 columns of a mix of numbers and small texts, 
300.000 wide rows effektively) in a quite 'agressive' way, using java-driver 
and async update statements.

After a while of importing data, I start seeing timeouts reported by the driver:

com.datastax.driver.core.exceptions.WriteTimeoutException: Cassandra timeout 
during write query at consistency ONE (1 replica were required but only 0 
acknowledged the write

and then later, host-unavailability exceptions:

com.datastax.driver.core.exceptions.UnavailableException: Not enough replica 
available for query at consistency ONE (1 required but only 0 alive).

Looking at the 3 hosts, I see two C*s went down - which explains that I still 
see some writes succeeding (that must be the one host left, satisfying the 
consitency level ONE).


The logs tell me AFAIU that the servers shutdown due to reaching the heap size 
limit.

I am irritated by the fact that the instances (it seems) shut themselves down 
instead of limiting their amount of work. I understand that I need to tweak the 
configuration and likely get more RAM, but still, I would actually be satisfied 
with reduced service (and likely more timeouts in the client).  Right now it 
looks as if I would have to slow down the client 'artificially'  to prevent the 
loss of hosts - does that make sense?

Can anyone explain whether this is intended behavior, meaning I'll just have to 
accept the self-shutdown of the hosts? Or alternatively, what data I should 
collect to investigate the cause further?

Jan







Re: Cassandra shuts down; was:Cassandra crashes

2013-09-04 Thread Jan Algermissen
The subject line isn't appropriate - the servers do not crash but shut down. 
Since the log messages appear several lines before the end of the log file, I 
only saw afterwards. Excuse the confusion.

Jan


On 04.09.2013, at 10:44, Jan Algermissen  wrote:

> Hi,
> 
> I have set up C* in a very limited environment: 3 VMs at digitalocean with 
> 2GB RAM and 40GB SSDs, so my expectations about overall performance are low.
> 
> Keyspace uses replication level of 2.
> 
> I am loading 1.5 Mio rows (each 60 columns of a mix of numbers and small 
> texts, 300.000 wide rows effektively) in a quite 'agressive' way, using 
> java-driver and async update statements.
> 
> After a while of importing data, I start seeing timeouts reported by the 
> driver:
> 
> com.datastax.driver.core.exceptions.WriteTimeoutException: Cassandra timeout 
> during write query at consistency ONE (1 replica were required but only 0 
> acknowledged the write
> 
> and then later, host-unavailability exceptions:
> 
> com.datastax.driver.core.exceptions.UnavailableException: Not enough replica 
> available for query at consistency ONE (1 required but only 0 alive).
> 
> Looking at the 3 hosts, I see two C*s went down - which explains that I still 
> see some writes succeeding (that must be the one host left, satisfying the 
> consitency level ONE).
> 
> 
> The logs tell me AFAIU that the servers shutdown due to reaching the heap 
> size limit.
> 
> I am irritated by the fact that the instances (it seems) shut themselves down 
> instead of limiting their amount of work. I understand that I need to tweak 
> the configuration and likely get more RAM, but still, I would actually be 
> satisfied with reduced service (and likely more timeouts in the client).  
> Right now it looks as if I would have to slow down the client 'artificially'  
> to prevent the loss of hosts - does that make sense?
> 
> Can anyone explain whether this is intended behavior, meaning I'll just have 
> to accept the self-shutdown of the hosts? Or alternatively, what data I 
> should collect to investigate the cause further?
> 
> Jan
> 
> 
> 
> 
> 



Re: Cassandra shuts down; was:Cassandra crashes

2013-09-04 Thread Romain HARDOUIN
Maybe you should include the end of Cassandra logs.
What comes to my mind when I read your first post is OOM killer. 
But what you describe later is not the case.
Just to be sure, have you checked /var/log/messages?

Romain



De :Jan Algermissen 
A : user@cassandra.apache.org, 
Date :  04/09/2013 10:52
Objet : Re: Cassandra shuts down; was:Cassandra crashes



The subject line isn't appropriate - the servers do not crash but shut 
down. Since the log messages appear several lines before the end of the 
log file, I only saw afterwards. Excuse the confusion.

Jan


On 04.09.2013, at 10:44, Jan Algermissen  
wrote:

> Hi,
> 
> I have set up C* in a very limited environment: 3 VMs at digitalocean 
with 2GB RAM and 40GB SSDs, so my expectations about overall performance 
are low.
> 
> Keyspace uses replication level of 2.
> 
> I am loading 1.5 Mio rows (each 60 columns of a mix of numbers and small 
texts, 300.000 wide rows effektively) in a quite 'agressive' way, using 
java-driver and async update statements.
> 
> After a while of importing data, I start seeing timeouts reported by the 
driver:
> 
> com.datastax.driver.core.exceptions.WriteTimeoutException: Cassandra 
timeout during write query at consistency ONE (1 replica were required but 
only 0 acknowledged the write
> 
> and then later, host-unavailability exceptions:
> 
> com.datastax.driver.core.exceptions.UnavailableException: Not enough 
replica available for query at consistency ONE (1 required but only 0 
alive).
> 
> Looking at the 3 hosts, I see two C*s went down - which explains that I 
still see some writes succeeding (that must be the one host left, 
satisfying the consitency level ONE).
> 
> 
> The logs tell me AFAIU that the servers shutdown due to reaching the 
heap size limit.
> 
> I am irritated by the fact that the instances (it seems) shut themselves 
down instead of limiting their amount of work. I understand that I need to 
tweak the configuration and likely get more RAM, but still, I would 
actually be satisfied with reduced service (and likely more timeouts in 
the client).  Right now it looks as if I would have to slow down the 
client 'artificially'  to prevent the loss of hosts - does that make 
sense?
> 
> Can anyone explain whether this is intended behavior, meaning I'll just 
have to accept the self-shutdown of the hosts? Or alternatively, what data 
I should collect to investigate the cause further?
> 
> Jan
> 
> 
> 
> 
> 




Re: CqlStorage creates wrong schema for Pig

2013-09-04 Thread Miguel Angel Martin junquera
Oppps,   sorry by  my oversight

I was checking the code and  I was surprised it did not work with that pig
script ...

now , It works fine ..

Many thanks,Chad

Have a nice day


Miguel Angel Martín Junquera
Analyst Engineer.
miguelangel.mar...@brainsins.com



2013/9/3 Chad Johnston 

> You're trying to use FromCqlColumn on a tuple that has been flattened. The
> schema still thinks it's {title: chararray}, but the flattened tuple is now
> two values. I don't know how to retrieve the data values in this case.
>
> Your code will work correctly if you do this:
> *values3 = FOREACH rows GENERATE FromCqlColumn(title) AS title;*
> *dump values3;*
> *describe values3;*
>
> (Use FromCqlColumn on the original data, not the flattened data.)
>
> Chad
>
>
> On Mon, Sep 2, 2013 at 8:45 AM, Miguel Angel Martin junquera <
> mianmarjun.mailingl...@gmail.com> wrote:
>
>> Hi
>>
>>
>> 1.-
>>
>> May be?
>>
>> -- Register the UDF
>> REGISTER /path/to/cqlstorageudf-1.0-SNAPSHOT
>>
>> -- FromCqlColumn will convert chararray, int, long, float, double
>> DEFINE FromCqlColumn com.megatome.pig.piggybank.tuple.FromCqlColumn();
>>
>> -- Load data as normal
>> data_raw = LOAD 'cql://bookcrossing/books' USING CqlStorage();
>>
>> -- Use the UDF
>> data = FOREACH data_raw GENERATE
>> *FromCqlColumn*(isbn) AS ISBN,
>> *FromCqlColumn*(bookauthor) AS BookAuthor,
>>
>>
>> *FromCqlColumn*(booktitle) AS BookTitle,
>> *FromCqlColumn*(publisher) AS Publisher,
>>
>>
>> *FromCqlColumn*(yearofpublication) AS YearOfPublication;
>>
>>
>>
>>
>>
>> and  2.:
>>
>> with  the data in cql cassandra 1.2.8, pig 0.11.11 and cql3:
>>
>> *CREATE KEYSPACE keyspace1*
>>
>> *  WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor'
>> : 1 }*
>>
>> *  AND durable_writes = true;*
>>
>> *
>> *
>>
>> *use keyspace2;*
>>
>>  *
>> *
>>
>> *  CREATE TABLE test (*
>>
>> *id text PRIMARY KEY,*
>>
>> *title text,*
>>
>> *age int*
>>
>> *  )  WITH COMPACT STORAGE;*
>>
>> *
>> *
>>
>> *
>> *
>>
>> *  insert into test (id, title, age) values('1', 'child', 21);*
>>
>> *  insert into test (id, title, age) values('2', 'support', 21);*
>>
>> *  insert into test (id, title, age) values('3', 'manager', 31);*
>>
>> *  insert into test (id, title, age) values('4', 'QA', 41);*
>>
>> *  insert into test (id, title, age) values('5', 'QA', 30);*
>>
>> *  insert into test (id, title, age) values('6', 'QA', 30);*
>>
>>
>>
>>
>>
>> and script:
>>
>> *
>> *
>> *register './libs/cqlstorageudf-1.0-SNAPSHOT.jar';*
>> *DEFINE FromCqlColumn com.megatome.pig.piggybank.tuple.FromCqlColumn();*
>> *rows = LOAD
>> 'cql://keyspace1/test?page_size=1&split_size=4&where_clause=age%3D30' USING
>> CqlStorage();*
>> *dump rows;*
>> *ILLUSTRATE rows;*
>> *describe rows;*
>> *A = FOREACH rows GENERATE FLATTEN(title);*
>> *dump A;*
>> *values3 = FOREACH A GENERATE FromCqlColumn(title) AS title;*
>> *dump values3;*
>> *describe values3;*
>>
>>
>> --
>>
>>
>>
>> I have this error:
>>
>>
>>
>>
>> 
>>
>> -
>> | rows | id:chararray   | age:int   | title:chararray   |
>> -
>> |  | (id, 5)| (age, 30) | (title, QA)   |
>> -
>>
>> rows: {id: chararray,age: int,title: chararray}
>>
>>
>> ...
>>
>> (title,QA)
>> (title,QA)
>> ..
>> 2013-09-02 16:40:52,454 [Thread-11] WARN
>>  org.apache.hadoop.mapred.LocalJobRunner - job_local_0003
>> *java.lang.ClassCastException: java.lang.String cannot be cast to
>> org.apache.pig.data.Tuple*
>> at com.megatome.pig.piggybank.tuple.ColumnBase.exec(ColumnBase.java:32)
>>  at
>> org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POUserFunc.getNext(POUserFunc.java:337)
>>  at
>> org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POUserFunc.getNext(POUserFunc.java:434)
>>  at
>> org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator.getNext(PhysicalOperator.java:340)
>>  at
>> org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.processPlan(POForEach.java:372)
>>  at
>> org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.getNext(POForEach.java:297)
>> at
>> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.runPipeline(PigGenericMapBase.java:283)
>>  at
>> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.map(PigGenericMapBase.java:278)
>>  at
>> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.map(PigGenericMapBase.java:64)
>> at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
>>  at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764)
>> at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370)
>>  at
>> org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:212)
>> 2013

Re: Cassandra shuts down; was:Cassandra crashes

2013-09-04 Thread Jan Algermissen
Romain,


On 04.09.2013, at 11:11, Romain HARDOUIN  wrote:

> Maybe you should include the end of Cassandra logs. 

There is nothing that seems interesting in cassandra.log. Below you find 
system.log.

> What comes to my mind when I read your first post is OOM killer. 
> But what you describe later is not the case. 
> Just to be sure, have you checked /var/log/messages? 

Nothing there, just occasional Firewall TCP rejections. 

Somehow I think I am simply overloading the whole cluster (see the hinted 
handoff messages in the log). Could that be due to the limited memory of 2GB my 
nodes have? IOW, not enough space to buffer up the writes before dumping to 
disk?

Also, my overall write performance is actually pretty bad compared to what I 
read about C*. Before I thought it was the client doing to much work or the 
network. Turns out that's not the case.

I'd expect C* to sort of just suck in my rather small amount of data - must be 
me, not using the right configuration. Oh well, I'll get there :-) Thanks 
anyhow.

Jan

> 
> Romain 
> 




INFO [ScheduledTasks:1] 2013-09-04 07:17:09,057 StatusLogger.java (line 96) 
KeyCache216  936
  all 
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,057 StatusLogger.java (line 102) 
RowCache  00
  all  org.apache.cassandra.cache.SerializingCacheProvider
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,058 StatusLogger.java (line 109) 
ColumnFamilyMemtable ops,data
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,082 StatusLogger.java (line 112) 
system.local 4,52
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,083 StatusLogger.java (line 112) 
system.peers  0,0
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,083 StatusLogger.java (line 112) 
system.batchlog   0,0
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,083 StatusLogger.java (line 112) 
system.NodeIdInfo 0,0
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,083 StatusLogger.java (line 112) 
system.LocationInfo   0,0
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,084 StatusLogger.java (line 112) 
system.Schema 0,0
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,084 StatusLogger.java (line 112) 
system.Migrations 0,0
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,084 StatusLogger.java (line 112) 
system.schema_keyspaces   0,0
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,084 StatusLogger.java (line 112) 
system.schema_columns 0,0
ERROR [FlushWriter:6] 2013-09-04 07:17:09,210 CassandraDaemon.java (line 192) 
Exception in thread Thread[FlushWriter:6,5,main]
java.lang.OutOfMemoryError: Java heap space
at 
org.apache.cassandra.io.util.FastByteArrayOutputStream.expand(FastByteArrayOutputStream.java:104)
at 
org.apache.cassandra.io.util.FastByteArrayOutputStream.write(FastByteArrayOutputStream.java:220)
at java.io.DataOutputStream.write(DataOutputStream.java:107)
at 
org.apache.cassandra.io.util.DataOutputBuffer.write(DataOutputBuffer.java:60)
at 
org.apache.cassandra.utils.ByteBufferUtil.write(ByteBufferUtil.java:328)
at 
org.apache.cassandra.utils.ByteBufferUtil.writeWithLength(ByteBufferUtil.java:315)
at 
org.apache.cassandra.db.ColumnSerializer.serialize(ColumnSerializer.java:55)
at 
org.apache.cassandra.db.ColumnSerializer.serialize(ColumnSerializer.java:30)
at 
org.apache.cassandra.db.OnDiskAtom$Serializer.serializeForSSTable(OnDiskAtom.java:62)
at org.apache.cassandra.db.ColumnIndex$Builder.add(ColumnIndex.java:181)
at 
org.apache.cassandra.db.ColumnIndex$Builder.build(ColumnIndex.java:133)
at 
org.apache.cassandra.io.sstable.SSTableWriter.append(SSTableWriter.java:185)
at 
org.apache.cassandra.db.Memtable$FlushRunnable.writeSortedContents(Memtable.java:489)
at 
org.apache.cassandra.db.Memtable$FlushRunnable.runWith(Memtable.java:448)
at 
org.apache.cassandra.io.util.DiskAwareRunnable.runMayThrow(DiskAwareRunnable.java:48)
at 
org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,210 StatusLogger.java (line 112) 
system.schema_columnfamilies 0,0
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,218 StatusLogger.java (line 112) 
system.IndexInfo  0,0
 INFO [ScheduledTasks:1] 2013-09-04 07:17:09,218 StatusLogger.java (line 112) 
system.range_xfers 

Re: Versioning in cassandra

2013-09-04 Thread dawood abdullah
Michael,

Your approach solves the problem, thanks for the solution. I was thinking
of another approach as well where in I would create another column family
say file_archive, so whenever an update is made to the File table, I will
create a new version in the File and move the old version to the new
file_archive table. Please let me know if the second approach is fine.

Regards,
Dawood


On Wed, Sep 4, 2013 at 2:47 AM, Laing, Michael wrote:

> I use the technique described in my previous message to handle millions of
> messages and their versions.
>
> Actually, I use timeuuid's instead of timestamps, as they have more
> 'uniqueness'. Also I index my maps by a timeuuid that is the complement
> (based on a future date) of a current timeuuid. Since maps are kept sorted
> by key, this means I can just pop off the first one to get the most recent.
>
> The downside of this approach is that you get more stuff returned to you
> from Cassandra than you need. To mitigate that I queue a job to examine and
> correct the situation if, upon doing a read, the number of versions for a
> particular key is higher than some threshold, e.g. 50. There are many ways
> to approach this problem.
>
> Our actual implementation proceeds to another level, as we also have
> replicas of versions. This happens because we process important
> transactions in parallel and can expect up to 9 replicas of each version.
> We journal them all and use them for reporting latencies in our processing
> pipelines as well as for replay when we need to recover application state.
>
> Regards,
>
> Michael
>
>
> On Tue, Sep 3, 2013 at 3:15 PM, Laing, Michael 
> wrote:
>
>> try the following. -ml
>>
>> -- put this in  and run using 'cqlsh -f 
>>
>> DROP KEYSPACE latest;
>>
>> CREATE KEYSPACE latest WITH replication = {
>> 'class': 'SimpleStrategy',
>> 'replication_factor' : 1
>> };
>>
>> USE latest;
>>
>> CREATE TABLE file (
>> parentid text, -- row_key, same for each version
>> id text, -- column_key, same for each version
>> contenttype map, -- differs by version, version is
>> the key to the map
>> PRIMARY KEY (parentid, id)
>> );
>>
>> update file set contenttype = contenttype + {'2011-03-04':'pdf1'} where
>> parentid = 'd1' and id = 'f1';
>> update file set contenttype = contenttype + {'2011-03-05':'pdf2'} where
>> parentid = 'd1' and id = 'f1';
>> update file set contenttype = contenttype + {'2011-03-04':'pdf3'} where
>> parentid = 'd1' and id = 'f2';
>> update file set contenttype = contenttype + {'2011-03-05':'pdf4'} where
>> parentid = 'd1' and id = 'f2';
>>
>> select * from file where parentid = 'd1';
>>
>> -- returns:
>>
>> -- parentid | id | contenttype
>>
>> ++--
>> --   d1 | f1 | {'2011-03-04 00:00:00-0500': 'pdf1', '2011-03-05
>> 00:00:00-0500': 'pdf2'}
>> --   d1 | f2 | {'2011-03-04 00:00:00-0500': 'pdf3', '2011-03-05
>> 00:00:00-0500': 'pdf4'}
>>
>> -- use an app to pop off the latest version from the map
>>
>> -- map other varying fields using the same technique as used for
>> contenttype
>>
>>
>>
>> On Tue, Sep 3, 2013 at 2:31 PM, Vivek Mishra wrote:
>>
>>> create table file(id text , parentid text,contenttype text,version
>>> timestamp, descr text, name text, PRIMARY KEY(id,version) ) WITH CLUSTERING
>>> ORDER BY (version DESC);
>>>
>>> insert into file (id, parentid, version, contenttype, descr, name)
>>> values ('f2', 'd1', '2011-03-06', 'pdf', 'f2 file', 'file1');
>>> insert into file (id, parentid, version, contenttype, descr, name)
>>> values ('f2', 'd1', '2011-03-05', 'pdf', 'f2 file', 'file1');
>>> insert into file (id, parentid, version, contenttype, descr, name)
>>> values ('f1', 'd1', '2011-03-05', 'pdf', 'f1 file', 'file1');
>>> insert into file (id, parentid, version, contenttype, descr, name)
>>> values ('f1', 'd1', '2011-03-04', 'pdf', 'f1 file', 'file1');
>>> create index on file(parentid);
>>>
>>>
>>> select * from file where id='f1' and parentid='d1' limit 1;
>>>
>>> select * from file where parentid='d1' limit 1;
>>>
>>>
>>> Will it work for you?
>>>
>>> -Vivek
>>>
>>>
>>>
>>>
>>> On Tue, Sep 3, 2013 at 11:29 PM, Vivek Mishra wrote:
>>>
 My bad. I did miss out to read "latest version" part.

 -Vivek


 On Tue, Sep 3, 2013 at 11:20 PM, dawood abdullah <
 muhammed.daw...@gmail.com> wrote:

> I have tried with both the options creating secondary index and also
> tried adding parentid to primary key, but I am getting all the files with
> parentid 'yyy', what I want is the latest version of file with the
> combination of parentid, fileid. Say below are the records inserted in the
> file table:
>
> insert into file (id, parentid, version, contenttype, description,
> name) values ('f1', 'd1', '2011-03-04', 'pdf', 'f1 file', 'file1');
> insert into file (id, parentid, version, contenttype, description,
> name) values ('f1', 'd1', '2011-0

Custom data type is not work at C* 2.0

2013-09-04 Thread Katsutoshi
Hi.

I would like to use custom data type.
Although it was work at Cassandra 1.2.9, but it is not work at Cassandra
2.0.0.
Did anything change by Cassandra 2.0.0 ?

My test procedure is as follows:

### DummyType.class

```
package my.marshal;

import java.nio.ByteBuffer;

import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.db.marshal.MarshalException;
import org.apache.cassandra.utils.ByteBufferUtil;

public class DummyType extends AbstractType {

public static final DummyType instance = new DummyType();

private DummyType(){
}

public Void compose(ByteBuffer bytes){
return null;
}

public ByteBuffer decompose(Void value){
return ByteBufferUtil.EMPTY_BYTE_BUFFER;
}

public int compare(ByteBuffer o1, ByteBuffer o2){
return 0;
}

public String getString(ByteBuffer bytes){
return "";
}

public ByteBuffer fromString(String source) throws MarshalException{
if(!source.isEmpty()) throw new
MarshalException(String.format("'%s' is not empty", source));
return ByteBufferUtil.EMPTY_BYTE_BUFFER;
}

public void validate(ByteBuffer bytes) throws MarshalException{
}
}
```

### At Cassandra 1.2.9

1) Create DummyType class and compiled by JDK6.
2) Drop that jar (my-marshal-1.0.0.jar) in lib directory and start the
cluster.

```
$ tail -f /var/log/cassandra/cassandra.log
(snip)
 INFO 21:19:58,126 Classpath:
/opt/cassandra/bin/../conf:/opt/cassandra/bin/../build/classes/main:/opt/cassandra/bin/../build/classes/thrift:/opt/cassandra/bin/../lib/antlr-3.2.jar:/opt/cassandra/bin/../lib/apache-cassandra-1.2.9.jar:/opt/cassandra/bin/../lib/apache-cassandra-clientutil-1.2.9.jar:/opt/cassandra/bin/../lib/apache-cassandra-thrift-1.2.9.jar:/opt/cassandra/bin/../lib/avro-1.4.0-fixes.jar:/opt/cassandra/bin/../lib/avro-1.4.0-sources-fixes.jar:/opt/cassandra/bin/../lib/commons-cli-1.1.jar:/opt/cassandra/bin/../lib/commons-codec-1.2.jar:/opt/cassandra/bin/../lib/commons-lang-2.6.jar:/opt/cassandra/bin/../lib/compress-lzf-0.8.4.jar:/opt/cassandra/bin/../lib/concurrentlinkedhashmap-lru-1.3.jar:/opt/cassandra/bin/../lib/guava-13.0.1.jar:/opt/cassandra/bin/../lib/high-scale-lib-1.1.2.jar:/opt/cassandra/bin/../lib/jackson-core-asl-1.9.2.jar:/opt/cassandra/bin/../lib/jackson-mapper-asl-1.9.2.jar:/opt/cassandra/bin/../lib/jamm-0.2.5.jar:/opt/cassandra/bin/../lib/jbcrypt-0.3m.jar:/opt/cassandra/bin/../lib/jline-1.0.jar:/opt/cassandra/bin/../lib/json-simple-1.1.jar:/opt/cassandra/bin/../lib/libthrift-0.7.0.jar:/opt/cassandra/bin/../lib/log4j-1.2.16.jar:/opt/cassandra/bin/../lib/lz4-1.1.0.jar:/opt/cassandra/bin/../lib/metrics-core-2.0.3.jar:/opt/cassandra/bin/../lib/my-marshal-1.0.0.jar:/opt/cassandra/bin/../lib/netty-3.5.9.Final.jar:/opt/cassandra/bin/../lib/servlet-api-2.5-20081211.jar:/opt/cassandra/bin/../lib/slf4j-api-1.7.2.jar:/opt/cassandra/bin/../lib/slf4j-log4j12-1.7.2.jar:/opt/cassandra/bin/../lib/snakeyaml-1.6.jar:/opt/cassandra/bin/../lib/snappy-java-1.0.5.jar:/opt/cassandra/bin/../lib/snaptree-0.1.jar:/opt/cassandra/bin/../lib/jamm-0.2.5.jar
(snip)
```

3) Create column family that use DummyType.

```
cqlsh:test> CREATE TABLE test_cf ( key 'my.marshal.DummyType' PRIMARY KEY);
cqlsh:test> DESCRIBE TABLE test_cf;

CREATE TABLE test_cf (
  key 'my.marshal.DummyType' PRIMARY KEY
) WITH
  bloom_filter_fp_chance=0.01 AND
  caching='KEYS_ONLY' AND
  comment='' AND
  dclocal_read_repair_chance=0.00 AND
  gc_grace_seconds=864000 AND
  read_repair_chance=0.10 AND
  replicate_on_write='true' AND
  populate_io_cache_on_flush='false' AND
  compaction={'class': 'SizeTieredCompactionStrategy'} AND
  compression={'sstable_compression': 'SnappyCompressor'};
```

### At Cassandra 2.0.0

1) Create DummyType class and compiled by JDK7.
2) Drop that jar (my-marshal-1.0.0.jar) in lib directory and start the
cluster.

```
$ tail -f /var/log/cassandra/cassandra.log
(snip)
 INFO 21:10:33,789 Classpath:
/opt/cassandra/bin/../conf:/opt/cassandra/bin/../build/classes/main:/opt/cassandra/bin/../build/classes/thrift:/opt/cassandra/bin/../lib/antlr-3.2.jar:/opt/cassandra/bin/../lib/apache-cassandra-2.0.0.jar:/opt/cassandra/bin/../lib/apache-cassandra-clientutil-2.0.0.jar:/opt/cassandra/bin/../lib/apache-cassandra-thrift-2.0.0.jar:/opt/cassandra/bin/../lib/commons-cli-1.1.jar:/opt/cassandra/bin/../lib/commons-codec-1.2.jar:/opt/cassandra/bin/../lib/commons-lang-2.6.jar:/opt/cassandra/bin/../lib/compress-lzf-0.8.4.jar:/opt/cassandra/bin/../lib/concurrentlinkedhashmap-lru-1.3.jar:/opt/cassandra/bin/../lib/disruptor-3.0.1.jar:/opt/cassandra/bin/../lib/guava-13.0.1.jar:/opt/cassandra/bin/../lib/high-scale-lib-1.1.2.jar:/opt/cassandra/bin/../lib/jackson-core-asl-1.9.2.jar:/opt/cassandra/bin/../lib/jackson-mapper-asl-1.9.2.jar:/opt/cassandra/bin/../lib/jamm-0.2.5.jar:/opt/cassandra/bin/../lib/jbcrypt-0.3m.jar:/opt/cassandra/bin/../lib/jline-1.0.jar:/opt/cassandra/bin/../lib/json-simple-1.1.jar:/opt/cassandra/bin/../lib/libthr

Re: Versioning in cassandra

2013-09-04 Thread Laing, Michael
Dawood,

In general that will work. However it does mean that you 1) read the old
version 2) update the new version and 3) write the archive version.

Step 2 is a problem: what if someone else has updated the old version after
step 1? and there are 3 atomic operations required, at least.

However, these considerations may be mitigated using Cassandra 2 light
transactions; and it is not a problem if you have only one updater.

But another problem may be performance. You must test. The solution I
proposed does not require a read before write and does an atomic append,
even if multiple maps are being updated. It also defers deletions via ttl's
and a separate, manageable queue for 'cleanup' of large maps.

I think the most important word in my reply is: 'test'.

Cheers,

Michael


On Wed, Sep 4, 2013 at 9:05 AM, dawood abdullah
wrote:

> Michael,
>
> Your approach solves the problem, thanks for the solution. I was thinking
> of another approach as well where in I would create another column family
> say file_archive, so whenever an update is made to the File table, I will
> create a new version in the File and move the old version to the new
> file_archive table. Please let me know if the second approach is fine.
>
> Regards,
> Dawood
>
>
> On Wed, Sep 4, 2013 at 2:47 AM, Laing, Michael 
> wrote:
>
>> I use the technique described in my previous message to handle millions
>> of messages and their versions.
>>
>> Actually, I use timeuuid's instead of timestamps, as they have more
>> 'uniqueness'. Also I index my maps by a timeuuid that is the complement
>> (based on a future date) of a current timeuuid. Since maps are kept sorted
>> by key, this means I can just pop off the first one to get the most recent.
>>
>> The downside of this approach is that you get more stuff returned to you
>> from Cassandra than you need. To mitigate that I queue a job to examine and
>> correct the situation if, upon doing a read, the number of versions for a
>> particular key is higher than some threshold, e.g. 50. There are many ways
>> to approach this problem.
>>
>> Our actual implementation proceeds to another level, as we also have
>> replicas of versions. This happens because we process important
>> transactions in parallel and can expect up to 9 replicas of each version.
>> We journal them all and use them for reporting latencies in our processing
>> pipelines as well as for replay when we need to recover application state.
>>
>> Regards,
>>
>> Michael
>>
>>
>> On Tue, Sep 3, 2013 at 3:15 PM, Laing, Michael > > wrote:
>>
>>> try the following. -ml
>>>
>>> -- put this in  and run using 'cqlsh -f 
>>>
>>> DROP KEYSPACE latest;
>>>
>>> CREATE KEYSPACE latest WITH replication = {
>>> 'class': 'SimpleStrategy',
>>> 'replication_factor' : 1
>>> };
>>>
>>> USE latest;
>>>
>>> CREATE TABLE file (
>>> parentid text, -- row_key, same for each version
>>> id text, -- column_key, same for each version
>>> contenttype map, -- differs by version, version is
>>> the key to the map
>>> PRIMARY KEY (parentid, id)
>>> );
>>>
>>> update file set contenttype = contenttype + {'2011-03-04':'pdf1'} where
>>> parentid = 'd1' and id = 'f1';
>>> update file set contenttype = contenttype + {'2011-03-05':'pdf2'} where
>>> parentid = 'd1' and id = 'f1';
>>> update file set contenttype = contenttype + {'2011-03-04':'pdf3'} where
>>> parentid = 'd1' and id = 'f2';
>>> update file set contenttype = contenttype + {'2011-03-05':'pdf4'} where
>>> parentid = 'd1' and id = 'f2';
>>>
>>> select * from file where parentid = 'd1';
>>>
>>> -- returns:
>>>
>>> -- parentid | id | contenttype
>>>
>>> ++--
>>> --   d1 | f1 | {'2011-03-04 00:00:00-0500': 'pdf1', '2011-03-05
>>> 00:00:00-0500': 'pdf2'}
>>> --   d1 | f2 | {'2011-03-04 00:00:00-0500': 'pdf3', '2011-03-05
>>> 00:00:00-0500': 'pdf4'}
>>>
>>> -- use an app to pop off the latest version from the map
>>>
>>> -- map other varying fields using the same technique as used for
>>> contenttype
>>>
>>>
>>>
>>> On Tue, Sep 3, 2013 at 2:31 PM, Vivek Mishra wrote:
>>>
 create table file(id text , parentid text,contenttype text,version
 timestamp, descr text, name text, PRIMARY KEY(id,version) ) WITH CLUSTERING
 ORDER BY (version DESC);

 insert into file (id, parentid, version, contenttype, descr, name)
 values ('f2', 'd1', '2011-03-06', 'pdf', 'f2 file', 'file1');
 insert into file (id, parentid, version, contenttype, descr, name)
 values ('f2', 'd1', '2011-03-05', 'pdf', 'f2 file', 'file1');
 insert into file (id, parentid, version, contenttype, descr, name)
 values ('f1', 'd1', '2011-03-05', 'pdf', 'f1 file', 'file1');
 insert into file (id, parentid, version, contenttype, descr, name)
 values ('f1', 'd1', '2011-03-04', 'pdf', 'f1 file', 'file1');
 create index on file(parentid);


 select * from file where id='f1' and parentid='d1' limi

Re: Cassandra shuts down; was:Cassandra crashes

2013-09-04 Thread Romain HARDOUIN
Have you tried to tweak settings like memtable_total_space_in_mb and 
flush_largest_memtables_at?
Also, the compaction manager seems to be pretty busy, take a look at 
in_memory_compaction_limit_in_mb.
And with SSD hardware you should modifiy multithreaded_compaction, 
compaction_throughput_mb_per_sec, concurrent_reads and concurrent_writes.
Of course 2GB of RAM is low but tweak these settings might help you.
Maybe some guru could confirm/infirm that.




De :Jan Algermissen 
A : user@cassandra.apache.org, 
Date :  04/09/2013 12:29
Objet : Re: Cassandra shuts down; was:Cassandra crashes



Romain,


On 04.09.2013, at 11:11, Romain HARDOUIN  
wrote:

> Maybe you should include the end of Cassandra logs. 

There is nothing that seems interesting in cassandra.log. Below you find 
system.log.

> What comes to my mind when I read your first post is OOM killer. 
> But what you describe later is not the case. 
> Just to be sure, have you checked /var/log/messages? 

Nothing there, just occasional Firewall TCP rejections. 

Somehow I think I am simply overloading the whole cluster (see the hinted 
handoff messages in the log). Could that be due to the limited memory of 
2GB my nodes have? IOW, not enough space to buffer up the writes before 
dumping to disk?

Also, my overall write performance is actually pretty bad compared to what 
I read about C*. Before I thought it was the client doing to much work or 
the network. Turns out that's not the case.

I'd expect C* to sort of just suck in my rather small amount of data - 
must be me, not using the right configuration. Oh well, I'll get there :-) 
Thanks anyhow.

Jan






Re: Versioning in cassandra

2013-09-04 Thread dawood abdullah
Thanks for the quick response Michael, looks like I have to go with the
solution you have given of maps, as performance is pretty critical for our
application and we do not have enough time to test. Appreciate your help.

Regards,
Dawood


On Wed, Sep 4, 2013 at 7:33 PM, Laing, Michael wrote:

> Dawood,
>
> In general that will work. However it does mean that you 1) read the old
> version 2) update the new version and 3) write the archive version.
>
> Step 2 is a problem: what if someone else has updated the old version
> after step 1? and there are 3 atomic operations required, at least.
>
> However, these considerations may be mitigated using Cassandra 2 light
> transactions; and it is not a problem if you have only one updater.
>
> But another problem may be performance. You must test. The solution I
> proposed does not require a read before write and does an atomic append,
> even if multiple maps are being updated. It also defers deletions via ttl's
> and a separate, manageable queue for 'cleanup' of large maps.
>
> I think the most important word in my reply is: 'test'.
>
> Cheers,
>
> Michael
>
>
> On Wed, Sep 4, 2013 at 9:05 AM, dawood abdullah  > wrote:
>
>> Michael,
>>
>> Your approach solves the problem, thanks for the solution. I was thinking
>> of another approach as well where in I would create another column family
>> say file_archive, so whenever an update is made to the File table, I will
>> create a new version in the File and move the old version to the new
>> file_archive table. Please let me know if the second approach is fine.
>>
>> Regards,
>> Dawood
>>
>>
>> On Wed, Sep 4, 2013 at 2:47 AM, Laing, Michael > > wrote:
>>
>>> I use the technique described in my previous message to handle millions
>>> of messages and their versions.
>>>
>>> Actually, I use timeuuid's instead of timestamps, as they have more
>>> 'uniqueness'. Also I index my maps by a timeuuid that is the complement
>>> (based on a future date) of a current timeuuid. Since maps are kept sorted
>>> by key, this means I can just pop off the first one to get the most recent.
>>>
>>> The downside of this approach is that you get more stuff returned to you
>>> from Cassandra than you need. To mitigate that I queue a job to examine and
>>> correct the situation if, upon doing a read, the number of versions for a
>>> particular key is higher than some threshold, e.g. 50. There are many ways
>>> to approach this problem.
>>>
>>> Our actual implementation proceeds to another level, as we also have
>>> replicas of versions. This happens because we process important
>>> transactions in parallel and can expect up to 9 replicas of each version.
>>> We journal them all and use them for reporting latencies in our processing
>>> pipelines as well as for replay when we need to recover application state.
>>>
>>> Regards,
>>>
>>> Michael
>>>
>>>
>>> On Tue, Sep 3, 2013 at 3:15 PM, Laing, Michael <
>>> michael.la...@nytimes.com> wrote:
>>>
 try the following. -ml

 -- put this in  and run using 'cqlsh -f 

 DROP KEYSPACE latest;

 CREATE KEYSPACE latest WITH replication = {
 'class': 'SimpleStrategy',
 'replication_factor' : 1
 };

 USE latest;

 CREATE TABLE file (
 parentid text, -- row_key, same for each version
 id text, -- column_key, same for each version
 contenttype map, -- differs by version, version is
 the key to the map
 PRIMARY KEY (parentid, id)
 );

 update file set contenttype = contenttype + {'2011-03-04':'pdf1'} where
 parentid = 'd1' and id = 'f1';
 update file set contenttype = contenttype + {'2011-03-05':'pdf2'} where
 parentid = 'd1' and id = 'f1';
 update file set contenttype = contenttype + {'2011-03-04':'pdf3'} where
 parentid = 'd1' and id = 'f2';
 update file set contenttype = contenttype + {'2011-03-05':'pdf4'} where
 parentid = 'd1' and id = 'f2';

 select * from file where parentid = 'd1';

 -- returns:

 -- parentid | id | contenttype

 ++--
 --   d1 | f1 | {'2011-03-04 00:00:00-0500': 'pdf1', '2011-03-05
 00:00:00-0500': 'pdf2'}
 --   d1 | f2 | {'2011-03-04 00:00:00-0500': 'pdf3', '2011-03-05
 00:00:00-0500': 'pdf4'}

 -- use an app to pop off the latest version from the map

 -- map other varying fields using the same technique as used for
 contenttype



 On Tue, Sep 3, 2013 at 2:31 PM, Vivek Mishra wrote:

> create table file(id text , parentid text,contenttype text,version
> timestamp, descr text, name text, PRIMARY KEY(id,version) ) WITH 
> CLUSTERING
> ORDER BY (version DESC);
>
> insert into file (id, parentid, version, contenttype, descr, name)
> values ('f2', 'd1', '2011-03-06', 'pdf', 'f2 file', 'file1');
> insert into file (id, parentid, version, cont

Re: Cassandra shuts down; was:Cassandra crashes

2013-09-04 Thread Nate McCall
Ideally, you should get back pressure in the form of dropped messages
before you see crashes, but if turning down the heap allocation was the
only thing you did, there are other changes required (several mentioned by
Romain above are very good places to start).
A few other ideas:
- did you adjust ParNew along with heap?
- you may want to adjust SurvivorRatio and MaxTenuringThreshold (change
both to 4 as a starting point) in JVM
- definitely play with compaction throughput by turning it way up since you
have IO capacity

These will cause you to GC and compact continuously in this environment,
but it should at least keep going


On Wed, Sep 4, 2013 at 9:14 AM, Romain HARDOUIN
wrote:

> Have you tried to tweak settings like memtable_total_space_in_mb and
> flush_largest_memtables_at?
> Also, the compaction manager seems to be pretty busy, take a look at
> in_memory_compaction_limit_in_mb.
> And with SSD hardware you should modifiy multithreaded_compaction,
> compaction_throughput_mb_per_sec, concurrent_reads and concurrent_writes.
> Of course 2GB of RAM is low but tweak these settings might help you.
> Maybe some guru could confirm/infirm that.
>
>
>
>
> De :Jan Algermissen 
> A :user@cassandra.apache.org,
> Date :04/09/2013 12:29
> Objet :Re: Cassandra shuts down; was:Cassandra crashes
> --
>
>
>
> Romain,
>
>
> On 04.09.2013, at 11:11, Romain HARDOUIN 
> wrote:
>
> > Maybe you should include the end of Cassandra logs.
>
> There is nothing that seems interesting in cassandra.log. Below you find
> system.log.
>
> > What comes to my mind when I read your first post is OOM killer.
> > But what you describe later is not the case.
> > Just to be sure, have you checked /var/log/messages?
>
> Nothing there, just occasional Firewall TCP rejections.
>
> Somehow I think I am simply overloading the whole cluster (see the hinted
> handoff messages in the log). Could that be due to the limited memory of
> 2GB my nodes have? IOW, not enough space to buffer up the writes before
> dumping to disk?
>
> Also, my overall write performance is actually pretty bad compared to what
> I read about C*. Before I thought it was the client doing to much work or
> the network. Turns out that's not the case.
>
> I'd expect C* to sort of just suck in my rather small amount of data -
> must be me, not using the right configuration. Oh well, I'll get there :-)
> Thanks anyhow.
>
> Jan
>
>
>
>
>


Best way to track backups/delays for cross DC replication

2013-09-04 Thread Anand Somani
Hi,

Scenario is a cluster spanning across datacenters and we use Local_quorum
and want to know when things are not getting replicated across data
centers. What is the best way to track/alert on that?

I was planning on using the HintedHandOffManager (JMX)
=> org.apache.cassandra.db:type=HintedHandoffManager countPendingHints. Are
there other metrics (maybe exposed via nodetool) I should be looking at. At
this point we are on 1.1.6 cassandra.

Thanks
Anand


RE: row cache

2013-09-04 Thread S C
Thank you all for your valuable comments and information.

-SC


> Date: Tue, 3 Sep 2013 12:01:59 -0400
> From: chris.burrou...@gmail.com
> To: user@cassandra.apache.org
> CC: fsareshw...@quantcast.com
> Subject: Re: row cache
> 
> On 09/01/2013 03:06 PM, Faraaz Sareshwala wrote:
> > Yes, that is correct.
> >
> > The SerializingCacheProvider stores row cache contents off heap. I believe 
> > you
> > need JNA enabled for this though. Someone please correct me if I am wrong 
> > here.
> >
> > The ConcurrentLinkedHashCacheProvider stores row cache contents on the java 
> > heap
> > itself.
> >
> 
> Naming things is hard.  Both caches are in memory and are backed by a 
> ConcurrentLinkekHashMap.  In the case of the SerializingCacheProvider 
> the *values* are stored in off heap buffers.  Both must store a half 
> dozen or so objects (on heap) per entry 
> (org.apache.cassandra.cache.RowCacheKey, 
> com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap$WeightedValue, 
> java.util.concurrent.ConcurrentHashMap$HashEntry, etc).  It would 
> probably be better to call this a "mixed-heap" rather than off-heap 
> cache.  You may find the number of entires you can hold without gc 
> problems to be surprising low (relative to say memcached, or physical 
> memory on modern hardware).
> 
> Invalidating a column with SerializingCacheProvider invalidates the 
> entire row while with ConcurrentLinkedHashCacheProvider it does not. 
> SerializingCacheProvider does not require JNA.
> 
> Both also use memory estimation of the size (of the values only) to 
> determine the total number of entries retained.  Estimating the size of 
> the totally on-heap ConcurrentLinkedHashCacheProvider has historically 
> been dicey since we switched from sizing in entries, and it has been 
> removed in 2.0.0.
> 
> As said elsewhere in this thread the utility of the row cache varies 
> from "absolutely essential" to "source of numerous problems" depending 
> on the specifics of the data model and request distribution.
> 
> 
  

Re: system.peers and decommissioned nodes

2013-09-04 Thread Nate McCall
Did you get any exceptions on decommission? Does CASSANDRA-5857 sound
related at all? (1.2.4 is a few revs behind now and there have been a few
fixes there, so and upgrade might not hurt).


On Tue, Aug 27, 2013 at 5:53 PM, John Sanda  wrote:

> Forgot to mention before, the host_id column is null for one of the rows.
> Running nodetool removenode on the other one failed. StorageService threw
> an exception because it could not find the host id (of the decommissioned
> node with the non-null host_id in system.peers).
>
>
> On Tuesday, August 27, 2013, John Sanda wrote:
>
>> I had a 4 node cluster running C* 1.2.4. I am testing some client code
>> for adding/removing nodes to/from the cluster. I decommissioned 3 nodes. I
>> only have one node now; however, the system.peers table still has rows for
>> two of the nodes that were decommissioned. nodetool status only reports the
>> one remaining node.
>>
>> Will it be a problem still having those decommissioned nodes in
>> system.peers? And if so, what should be done to resolve it?
>>
>> - John
>>
>
>
> --
>
> - John
>


Re: Newbie: Question on JSON values

2013-09-04 Thread Robert Coli
On Wed, Sep 4, 2013 at 10:12 AM, Hartzman, Leslie <
leslie.d.hartz...@medtronic.com> wrote:

>  I’m just getting my feet wet with Cassandra and I wanted to know if it
> is possible to search a JSON value in a column and not just retrieve the
> whole JSON value?
>

If you indexed it with Datastax Edition's special Solr sauce, you could
search solr for its contents.

Otherwise, no.

=Rob


Newbie: Question on JSON values

2013-09-04 Thread Hartzman, Leslie
Hello,

I'm just getting my feet wet with Cassandra and I wanted to know if it is 
possible to search a JSON value in a column and not just retrieve the whole 
JSON value?

Thanks.

Les


[CONFIDENTIALITY AND PRIVACY NOTICE]

Information transmitted by this email is proprietary to Medtronic and is 
intended for use only by the individual or entity to which it is addressed, and 
may contain information that is private, privileged, confidential or exempt 
from disclosure under applicable law. If you are not the intended recipient or 
it appears that this mail has been forwarded to you without proper authority, 
you are notified that any use or dissemination of this information in any 
manner is strictly prohibited. In such cases, please delete this mail from your 
records.

To view this notice in other languages you can either select the following link 
or manually copy and paste the link into the address bar of a web browser: 
http://emaildisclaimer.medtronic.com


RE: Newbie: Question on JSON values

2013-09-04 Thread Hartzman, Leslie
Thanks. I'll check that out.

Les

From: Robert Coli [mailto:rc...@eventbrite.com]
Sent: Wednesday, September 04, 2013 10:14 AM
To: user@cassandra.apache.org
Subject: Re: Newbie: Question on JSON values

On Wed, Sep 4, 2013 at 10:12 AM, Hartzman, Leslie 
mailto:leslie.d.hartz...@medtronic.com>> wrote:
I'm just getting my feet wet with Cassandra and I wanted to know if it is 
possible to search a JSON value in a column and not just retrieve the whole 
JSON value?

If you indexed it with Datastax Edition's special Solr sauce, you could search 
solr for its contents.

Otherwise, no.

=Rob


[CONFIDENTIALITY AND PRIVACY NOTICE]

Information transmitted by this email is proprietary to Medtronic and is 
intended for use only by the individual or entity to which it is addressed, and 
may contain information that is private, privileged, confidential or exempt 
from disclosure under applicable law. If you are not the intended recipient or 
it appears that this mail has been forwarded to you without proper authority, 
you are notified that any use or dissemination of this information in any 
manner is strictly prohibited. In such cases, please delete this mail from your 
records.

To view this notice in other languages you can either select the following link 
or manually copy and paste the link into the address bar of a web browser: 
http://emaildisclaimer.medtronic.com


Re: Selecting multiple rows with composite partition keys using CQL3

2013-09-04 Thread Carl Lerche
I can't find a way to do this with the current implementation of CQL3. Are
there any plans to add an OR feature to CQL3 or some other way to select a
batch of disjoint composite keys?


On Fri, Aug 30, 2013 at 7:52 PM, Carl Lerche  wrote:

> Hello,
>
> I've been trying to figure out how to port my application to CQL3 based on
> http://cassandra.apache.org/doc/cql3/CQL.html.
>
> I have a table with a primary key: ( (app, name), timestamp ). So, the
> partition key would be composite (on app and name). I'm trying to figure
> out if there is a way to select multiple rows that span partition keys.
> Basically, I am trying to do:
>
> SELECT .. WHERE (app = 'foo' AND name = 'bar' AND timestamp = 123) OR (app
> = 'foo' AND name='hello' AND timestamp = 123)
>


How to drop a column

2013-09-04 Thread Alberto Carrascal
What is the alternative to the useful and well-known sentence: ALTER TABLE
 DROP 
in new versions of Cassandra?

I'm using Cassandra 1.2.8 and cql 3 spec.


Re: Selecting multiple rows with composite partition keys using CQL3

2013-09-04 Thread Laing, Michael
you could try this. -ml

-- put this in  and run using 'cqlsh -f 

DROP KEYSPACE carl_test;

CREATE KEYSPACE carl_test WITH replication = {
'class': 'SimpleStrategy',
'replication_factor' : 1
};

USE carl_test;

CREATE TABLE carl_table (
app text,
name text,
ts int,
data  text,
PRIMARY KEY ((app, name), ts)
);

update carl_table set data = 'whatever' where app='foo' and name='bar' and
ts=123;
update carl_table set data = 'whomever' where app='foo' and name='hello'
and ts=123;

SELECT * FROM carl_table WHERE app='foo' and name in ('bar', 'hello') and
ts=123;

-- returns:

-- app | name  | ts  | data
---+---+-+--
-- foo |   bar | 123 | whatever
-- foo | hello | 123 | whomever



On Wed, Sep 4, 2013 at 1:33 PM, Carl Lerche  wrote:

> I can't find a way to do this with the current implementation of CQL3. Are
> there any plans to add an OR feature to CQL3 or some other way to select a
> batch of disjoint composite keys?
>
>
> On Fri, Aug 30, 2013 at 7:52 PM, Carl Lerche  wrote:
>
>> Hello,
>>
>> I've been trying to figure out how to port my application to CQL3 based
>> on http://cassandra.apache.org/doc/cql3/CQL.html.
>>
>> I have a table with a primary key: ( (app, name), timestamp ). So, the
>> partition key would be composite (on app and name). I'm trying to figure
>> out if there is a way to select multiple rows that span partition keys.
>> Basically, I am trying to do:
>>
>> SELECT .. WHERE (app = 'foo' AND name = 'bar' AND timestamp = 123) OR
>> (app = 'foo' AND name='hello' AND timestamp = 123)
>>
>
>


Re: system.peers and decommissioned nodes

2013-09-04 Thread John Sanda
I did not see any errors during decommission. I have gone ahead though and
upgraded to 1.2.9.


On Wed, Sep 4, 2013 at 1:13 PM, Nate McCall  wrote:

> Did you get any exceptions on decommission? Does CASSANDRA-5857 sound
> related at all? (1.2.4 is a few revs behind now and there have been a few
> fixes there, so and upgrade might not hurt).
>
>
> On Tue, Aug 27, 2013 at 5:53 PM, John Sanda  wrote:
>
>> Forgot to mention before, the host_id column is null for one of the rows.
>> Running nodetool removenode on the other one failed. StorageService threw
>> an exception because it could not find the host id (of the decommissioned
>> node with the non-null host_id in system.peers).
>>
>>
>> On Tuesday, August 27, 2013, John Sanda wrote:
>>
>>> I had a 4 node cluster running C* 1.2.4. I am testing some client code
>>> for adding/removing nodes to/from the cluster. I decommissioned 3 nodes. I
>>> only have one node now; however, the system.peers table still has rows for
>>> two of the nodes that were decommissioned. nodetool status only reports the
>>> one remaining node.
>>>
>>> Will it be a problem still having those decommissioned nodes in
>>> system.peers? And if so, what should be done to resolve it?
>>>
>>> - John
>>>
>>
>>
>> --
>>
>> - John
>>
>
>


-- 

- John


moving all data to new cluster ?

2013-09-04 Thread Langston, Jim
Hi all,

I have built a new 4 node cluster and would like to move the data
from the current 2 node cluster to the new cluster. What would be
the best way to move the data and utilize it on the new cluster. I
have looked at snapshot and also just copying the entire tree from
the old cluster to the new cluster. Not sure what the best practice
would be. I'm testing that process now in preparation for moving the
current data (production) to the new larger ring (systems are bigger
and more memory) and decommission the older ring (smaller systems,
less memory).

Thanks,

Jim


Re: moving all data to new cluster ?

2013-09-04 Thread Langston, Jim
Thanks for the link Rob, but I did try earlier to
copy the SSTables over and then to refresh them,
but this is a brand new cluster and the error I got
back indicated that the keyspace didn't exist, and
then figured I needed to copy everything over in
the data directory.


Jim

From: Robert Coli mailto:rc...@eventbrite.com>>
Reply-To: mailto:user@cassandra.apache.org>>
Date: Wed, 4 Sep 2013 12:44:12 -0700
To: "user@cassandra.apache.org" 
mailto:user@cassandra.apache.org>>
Subject: Re: moving all data to new cluster ?

On Wed, Sep 4, 2013 at 12:38 PM, Langston, Jim 
mailto:jim.langs...@compuware.com>> wrote:
I have built a new 4 node cluster and would like to move the data
from the current 2 node cluster to the new cluster. What would be
the best way to move the data and utilize it on the new cluster. I
have looked at snapshot and also just copying the entire tree from
the old cluster to the new cluster. Not sure what the best practice
would be. I'm testing that process now in preparation for moving the
current data (production) to the new larger ring (systems are bigger
and more memory) and decommission the older ring (smaller systems,
less memory).

http://www.palominodb.com/blog/2012/09/25/bulk-loading-options-cassandra

In your case, I would just copy all sstables to all target nodes and run 
cleanup.

=Rob


Re: moving all data to new cluster ?

2013-09-04 Thread Robert Coli
On Wed, Sep 4, 2013 at 12:38 PM, Langston, Jim
wrote:

>  I have built a new 4 node cluster and would like to move the data
> from the current 2 node cluster to the new cluster. What would be
> the best way to move the data and utilize it on the new cluster. I
> have looked at snapshot and also just copying the entire tree from
> the old cluster to the new cluster. Not sure what the best practice
> would be. I'm testing that process now in preparation for moving the
> current data (production) to the new larger ring (systems are bigger
> and more memory) and decommission the older ring (smaller systems,
> less memory).
>

http://www.palominodb.com/blog/2012/09/25/bulk-loading-options-cassandra

In your case, I would just copy all sstables to all target nodes and run
cleanup.

=Rob


Re: moving all data to new cluster ?

2013-09-04 Thread Robert Coli
On Wed, Sep 4, 2013 at 1:01 PM, Langston, Jim wrote:

>  Thanks for the link Rob, but I did try earlier to
> copy the SSTables over and then to refresh them,
> but this is a brand new cluster and the error I got
> back indicated that the keyspace didn't exist, and
> then figured I needed to copy everything over in
> the data directory.
>

Just dump the schema from the old cluster and then load it on the new
cluster.

1) cassandra-cli "show schema"
2) create CFs one at a time (waiting in between for schema agreement)
3) nodetool refresh

=Rob


Key cache size

2013-09-04 Thread Daning Wang
We noticed that key cache could not be fully populated, we have set the key
cache size to 1024M.

key_cache_size_in_mb: 1024

But none of nodes showed the cache capacity is 1G, we have recently
upgraded to 1.2.5, could be an issue in that version?

Token: (invoke with -T/--tokens to see all 256 tokens)
ID   : 0fd912fb-3187-462b-8c8a-7d223751b649
Gossip active: true
Thrift active: true
Load : 73.16 GB
Generation No: 1372374984
Uptime (seconds) : 5953779
Heap Memory (MB) : 5440.59 / 10035.25
Data Center  : dc1
Rack : rac1
Exceptions   : 34601
Key Cache: size 540060752 (bytes), capacity 540060796 (bytes),
12860975403 hits, 15535054378 requests, 0.839 recent hit rate, 14400 save
period in seconds
Row Cache: size 0 (bytes), capacity 0 (bytes), 0 hits, 0 requests,
NaN recent hit rate, 0 save period in seconds

Thanks,

Daninng


Re: moving all data to new cluster ?

2013-09-04 Thread Robert Coli
Oh, I feel compelled to emphasize that you MUST avoid name collision when
doing this operation. Be CAREFUL to not overwrite files as a result of name
collision.

=Rob


How to contribute to C*?

2013-09-04 Thread cem
Hi All,

I have a implementation for range partitioning on the client side. Each
partition is a CF. It allows you to create and drop partitions.

It is very useful if you have time series or event data that you want to
store temporarily. You can use TTL for the same issue but it is not fast
enough to clean data if you have high write traffic. You can run out of
disk space. It is quite similar to range partitions in RDBMS. I used to use
it with mysql to clean disk.

I would prefer to have it on server side since it introduces too much
complexity on client side and  CF overheads.

I would like to know how to contribute to C* code base?
Am I going to open a ticket and assign to me?

Can someone provide me the path? Thank you very much!

Best Regards,
Cem


Re: How to contribute to C*?

2013-09-04 Thread Robert Coli
On Wed, Sep 4, 2013 at 2:48 PM, cem  wrote:

> I would prefer to have it on server side since it introduces too much
> complexity on client side and  CF overheads.
>
> I would like to know how to contribute to C* code base?
> Am I going to open a ticket and assign to me?
>

Open a JIRA, attach your patch and a description of why you want to
contribute it. If that doesn't get the response you're looking for, ask on
#cassandra-dev@.

=Rob


Re: How to contribute to C*?

2013-09-04 Thread cem
Thanks Rob!


On Thu, Sep 5, 2013 at 12:17 AM, Robert Coli  wrote:

> On Wed, Sep 4, 2013 at 2:48 PM, cem  wrote:
>
>> I would prefer to have it on server side since it introduces too much
>> complexity on client side and  CF overheads.
>>
>> I would like to know how to contribute to C* code base?
>> Am I going to open a ticket and assign to me?
>>
>
> Open a JIRA, attach your patch and a description of why you want to
> contribute it. If that doesn't get the response you're looking for, ask on
> #cassandra-dev@.
>
> =Rob
>