cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stone Fang <>
Subject cassandra unit test
Date Tue, 06 Sep 2016 03:02:17 GMT
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

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 calls
             TokenMetadata tmd = StorageService.instance.getTokenMetadata();
and tokenMetadata.sortedTokens()  is empty.and there is the cause of

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

 java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(
at java.util.ArrayList.get(
at org.apache.cassandra.locator.TokenMetadata.firstToken(
at org.apache.cassandra.locator.AbstractReplicationStrategy.
at org.apache.cassandra.service.StorageService.getNaturalEndpoints(
at org.apache.cassandra.service.StorageProxy.performWrite(
at org.apache.cassandra.service.StorageProxy.mutate(
at org.apache.cassandra.service.StorageProxy.mutateWithTriggers(
at org.apache.cassandra.cql3.statements.ModificationStatement.
at org.apache.cassandra.cql3.statements.ModificationStatement.execute(
at org.apache.cassandra.cql3.QueryProcessor.execute(
at org.apache.cassandra.cql3.QueryProcessor.execute(

View raw message