cassandra archive data

2016-06-30 Thread Stone Fang
Hi All,

I want to archive cassandra data.have seen a ticket on this.
https://issues.apache.org/jira/browse/CASSANDRA-8460

but I think there are still some issues may be caused by this solution.

Q1.from application perspective,we rarely used these archived data,
but when scale up cluster,add node or decommission node,we will stream data
between node,
since these archived sstable still in token ring,it may take long time to
finish bootstrap when the archived data is too large.

S1:
we can add a flag on sstable:boolean archived
and when stream sstable,we will filter these archived sstable.

Q2.
why not separate "archive sstable" from compaction  strategy?
archive sstable is not a round,in-time task,we just need to execute the
task periodly.
I mean we should not mix "archive sstable" code with compaction code.

S2:
we can provide a sstable tool to archive data.split sstable by date is the
job of compaction strategy.
we dont care it is DTCS or TWCS.

stone

Thanks in advance!


Fwd: Hintedhandoff mutation

2016-08-17 Thread Stone Fang
Hi,
I want to differ hintedhandoff mutation and normal write mutation when i
receive a mutation.
and I agree with the opinion of Chris Lohfink.that no way to tell the
difference.but i cannot use created time as Chris suggested.
because I cannot choose a accurate time to differ them.

anyone have idea on this?
thanks

-- Forwarded message --
From: Chris Lohfink 
Date: Thu, Aug 18, 2016 at 5:04 AM
Subject: Re: Hintedhandoff mutation
To: u...@cassandra.apache.org


Probably question better suited for the dev@ list. But I afaik the answer
is there is no way to tell the difference, but probably safe to look at the
created time, HHs tend to be older.

Chris

On Wed, Aug 17, 2016 at 5:02 AM, Stone Fang  wrote:

> Hi All,
>
> I want to differ hintedhandoff mutation and normal write mutation when i
> receive a mutation.
>
> how to get this in cassandra source code.have not found any attribute
> about this in Mutation class.
>
> or there is no way to get this.
>
>
> thanks
> stone
>


cassandra unit test

2016-09-05 Thread Stone Fang
Call QueryProcessor.execute method to insert data into table in cassandra
unit test file.

  public static UntypedResultSet execute(String query, ConsistencyLevel cl,
Object... values)
throws RequestExecutionException
{
return execute(query, cl, internalQueryState(), values);
}

As it's consistency level is local_quorum.So I can't call CQLTest.execute
method.

But I got this exception when insert data with this method.
I understand this is an error related to token range.in
ReplicationParams.validate method
it call  TokenMetadata tmd = StorageService.instance.getTokenMetadata();.
and tokenMetadata.sortedTokens()  is empty.and there is the cause of
exception.

I want to know how to assign the token range in cassandra unit test to
solve this problem.
anyone have idea about this?

Stone ,thanks
---trace--

 java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at
org.apache.cassandra.locator.TokenMetadata.firstToken(TokenMetadata.java:960)
at
org.apache.cassandra.locator.AbstractReplicationStrategy.getNaturalEndpoints(AbstractReplicationStrategy.java:107)
at
org.apache.cassandra.service.StorageService.getNaturalEndpoints(StorageService.java:3006)
at
org.apache.cassandra.service.StorageProxy.performWrite(StorageProxy.java:887)
at org.apache.cassandra.service.StorageProxy.mutate(StorageProxy.java:537)
at
org.apache.cassandra.service.StorageProxy.mutateWithTriggers(StorageProxy.java:718)
at
org.apache.cassandra.cql3.statements.ModificationStatement.executeWithoutCondition(ModificationStatement.java:431)
at
org.apache.cassandra.cql3.statements.ModificationStatement.execute(ModificationStatement.java:417)
at org.apache.cassandra.cql3.QueryProcessor.execute(QueryProcessor.java:296)
at org.apache.cassandra.cql3.QueryProcessor.execute(QueryProcessor.java:287)
at