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

Reply via email to