Cassandra 如何获取cql查询的墓碑计数?

Cassandra 如何获取cql查询的墓碑计数?,cassandra,cql,datastax-java-driver,nosql,Cassandra,Cql,Datastax Java Driver,Nosql,我试图评估在应用程序的一个表中创建的墓碑数量。为此,我尝试使用nodetoolcfstats。我是这样做的: create table demo.test(a int, b int, c int, primary key (a)); insert into demo.test(a, b, c) values(1,2,3); 现在,我正在做与上面相同的插入。因此,我预计将创建3个墓碑。但是在为这个columnfamily运行cfstats时,我仍然看到没有创建墓碑 nodetool cfstat

我试图评估在应用程序的一个表中创建的墓碑数量。为此,我尝试使用nodetoolcfstats。我是这样做的:

create table demo.test(a int, b int, c int, primary key (a));
insert into demo.test(a, b, c) values(1,2,3);
现在,我正在做与上面相同的插入。因此,我预计将创建3个墓碑。但是在为这个columnfamily运行cfstats时,我仍然看到没有创建墓碑

nodetool cfstats demo.test
Average live cells per slice (last five minutes): 0.0
Average tombstones per slice (last five minutes): 0.0
现在我尝试删除记录,但仍然没有看到创建任何墓碑。这里有我遗漏的东西吗?请建议

顺便说一句,还有其他一些细节, *我们使用的是Java驱动程序的2.1.1版
*我们正在与Cassandra 2.1.0竞争查询的墓碑计数,您最好的选择是启用跟踪。这将为您提供查询的详细历史记录,包括完成查询需要阅读多少墓碑。这不会给出总墓碑计数,但很可能与性能调优更相关

在cqlsh中,您可以使用

cqlsh> tracing on;
Now tracing requests.
cqlsh> SELECT * FROM ascii_ks.ascii_cs  where pkey = 'One';

 pkey | ckey1 | data1
------+-------+-------
  One |   One |   One

(1 rows)


Tracing session: 2569d580-719b-11e4-9dd6-557d7f833b69

 activity                                                                 | timestamp    | source    | source_elapsed
--------------------------------------------------------------------------+--------------+-----------+----------------
                                                       execute_cql3_query | 08:26:28,953 | 127.0.0.1 |              0
 Parsing SELECT * FROM ascii_ks.ascii_cs  where pkey = 'One' LIMIT 10000; | 08:26:28,956 | 127.0.0.1 |           2635
                                                      Preparing statement | 08:26:28,960 | 127.0.0.1 |           6951
                             Executing single-partition query on ascii_cs | 08:26:28,962 | 127.0.0.1 |           9097
                                             Acquiring sstable references | 08:26:28,963 | 127.0.0.1 |          10576
                                                Merging memtable contents | 08:26:28,963 | 127.0.0.1 |          10618
                                              Merging data from sstable 1 | 08:26:28,965 | 127.0.0.1 |          12146
                                              Key cache hit for sstable 1 | 08:26:28,965 | 127.0.0.1 |          12257
                                                    Collating all results | 08:26:28,965 | 127.0.0.1 |          12402
                                                         Request complete | 08:26:28,965 | 127.0.0.1 |          12638

感谢RussS的回复。但我真的不明白追踪的哪一部分实际上说明了墓碑的数量。你能提供更多的细节吗?你也可以从nodetool cfstatsyeah获得每片(过去五分钟)的平均墓碑。。但这是行不通的。。这就是RussS建议打开查询跟踪的原因。@PrasanthNath:答案的示例没有显示它,但跟踪输出将包含墓碑信息,例如:
read101 live和85个墓碑单元格[SharedPool-Worker-4]| 2015-07-29 14:57:36.895000 | 192.168.12.93 | 25264
那么为什么跟踪输出中没有显示墓碑?正如@PrasanthNath在其原始问题中所建议的那样,我希望在跟踪输出中看到3个墓碑。仅供参考,Cassandra 2.x和1.x在不断清除墓碑时遇到问题(即,它在启动时可以做得很好,但过一段时间就会完全停止)我的看法是,
cfstats
命令使用的数据没有更新得那么快,以至于在删除之后您会看到更改。也许给它一分钟,或者使用RUSS解决方案。