我尝试在我的键空间使用cqlsh -3版本,并在列族上使用select查询。 它在某些原因中返回数据并在其他一些原因中抛出RPC超时,我不知道确切的根本原因。 我使用select where where where where where
select * FROM date where date='2013-10-11 00:00:00+0000';
在此日期列中具有二级索引,其数据类型文本为UTF8格式
Request did not complete within rpc_timeout.
我用cassandra log.it检查了
ERROR [ReadStage:117] 2013-12-03 19:21:46,813 CassandraDaemon.java (line 192) Exception in thread Thread[ReadStage:117,5,main]
at org.apache.cassandra.db.columniterator.SSTableNamesIterator.read(SSTableNamesIterator.java:119)
at org.apache.cassandra.db.columniterator.SSTableNamesIterator.<init>(SSTableNamesIterator.java:60)
at org.apache.cassandra.db.filter.NamesQueryFilter.getSSTableColumnIterator(NamesQueryFilter.java:81)
at org.apache.cassandra.db.filter.QueryFilter.getSSTableColumnIterator(QueryFilter.java:68)
at org.apache.cassandra.db.CollationController.collectTimeOrderedData(CollationController.java:132)
at org.apache.cassandra.db.CollationController.getTopLevelColumns(CollationController.java:65)
at org.apache.cassandra.db.ColumnFamilyStore.getTopLevelColumns(ColumnFamilyStore.java:1390)
at org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1213)
at org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1125)
at org.apache.cassandra.db.index.keys.KeysSearcher$1.computeNext(KeysSearcher.java:191)
at org.apache.cassandra.db.index.keys.KeysSearcher$1.computeNext(KeysSearcher.java:109)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
at org.apache.cassandra.db.ColumnFamilyStore.filter(ColumnFamilyStore.java:1499)
at org.apache.cassandra.db.index.keys.KeysSearcher.search(KeysSearcher.java:82)
at org.apache.cassandra.db.index.SecondaryIndexManager.search(SecondaryIndexManager.java:548)
at org.apache.cassandra.db.ColumnFamilyStore.search(ColumnFamilyStore.java:1487)
at org.apache.cassandra.service.RangeSliceVerbHandler.executeLocally(RangeSliceVerbHandler.java:44)
at org.apache.cassandra.service.StorageProxy$LocalRangeSliceRunnable.runMayThrow(StorageProxy.java:1055)
at org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:1547)
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)
为什么会这样? 我在当地检查单粒种子?
更新1:
我的日期表格式
CREATE TABLE date (
key text PRIMARY KEY,
date text,
date_id text,
day bigint,
day_name text
) WITH COMPACT STORAGE AND
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
comment='' AND
dclocal_read_repair_chance=0.000000 AND
gc_grace_seconds=864000 AND
read_repair_chance=0.100000 AND
replicate_on_write='true' AND
populate_io_cache_on_flush='false' AND
compaction={'min_sstable_size': '52428800', 'class': 'SizeTieredCompactionStrategy'} AND
compression={'chunk_length_kb': '64', 'sstable_compression': 'SnappyCompressor'};
我用cassandra log查看了它的节目
ERROR [ReadStage:94] 2013-12-03 22:07:17,116 CassandraDaemon.java (line 192) Exception in thread Thread[ReadStage:94,5,main]
java.lang.AssertionError: DecoratedKey(-8665312888645846270,.......................<!--some bytes of numbers------->
/var/lib/cassandra/data/keyspace/columnfamily/keyspace-columnfamily-ic-1-Data.db
at org.apache.cassandra.db.columniterator.SSTableNamesIterator.read(SSTableNamesIterator.java:119)
at org.apache.cassandra.db.columniterator.SSTableNamesIterator.<init>(SSTableNamesIterator.java:60)
at org.apache.cassandra.db.filter.NamesQueryFilter.getSSTableColumnIterator(NamesQueryFilter.java:81)
at org.apache.cassandra.db.filter.QueryFilter.getSSTableColumnIterator(QueryFilter.java:68)
at org.apache.cassandra.db.CollationController.collectTimeOrderedData(CollationController.java:132)
at org.apache.cassandra.db.CollationController.getTopLevelColumns(CollationController.java:65)
at org.apache.cassandra.db.ColumnFamilyStore.getTopLevelColumns(ColumnFamilyStore.java:1390)
at org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1213)
at org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1125)
at org.apache.cassandra.db.Table.getRow(Table.java:347)
at org.apache.cassandra.db.SliceByNamesReadCommand.getRow(SliceByNamesReadCommand.java:64)
at org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:1033)
at org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:1547)
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)
目前我正在使用cassandra-1.2.6。 我查看这个链接,这是cassandra问题吗? https://issues.apache.org/jira/browse/CASSANDRA-4687
答案 0 :(得分:0)
如果您的查询很昂贵,可能会导致rpc超时。对于不同类型的查询,此行中存在大量SO问题,例如Fetching all the records for a partitionID in cassandra gives RPC timeout,RPC timeout in cqlsh - Cassandra(选择计数(*)查询)。但是,您的问题与二级指数有关。
应该避免查询二级索引如果唯一索引条目的数量很高,因为它们比按键查询要贵得多(我怀疑如果你使用日期就是这种情况) 。也许有更好的数据建模方法? (如果您将数据模型添加到您的问题中,我可以尝试详细说明此答案。)