如何获取cql查询的逻辑删除计数?

Pra*_*nth 11 cql cassandra nosql datastax-java-driver

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

create table demo.test(a int, b int, c int, primary key (a));
insert into demo.test(a, b, c) values(1,2,3);
Run Code Online (Sandbox Code Playgroud)

现在我正在制作与上面相同的插页.所以我希望创建3个墓碑.但是在为这个列家族运行cfstats时,我仍然看到没有创建墓碑.

nodetool cfstats demo.test
Average live cells per slice (last five minutes): 0.0
Average tombstones per slice (last five minutes): 0.0
Run Code Online (Sandbox Code Playgroud)

现在我尝试删除记录,但我仍然没有看到任何墓碑被创建.我在这里缺少什么东西?请建议.

BTW其他一些细节,*我们正在使用Java驱动程序的2.1.1版本*我们正在运行Cassandra 2.1.0

Rus*_*ssS 26

对于查询中的墓碑计数,最好的办法是启用跟踪.这将为您提供查询的深入历史记录,包括必须读取多少个逻辑删除才能完成它.这不会为您提供总墓碑数,但很可能与性能调整更相关.

在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
Run Code Online (Sandbox Code Playgroud)

http://www.datastax.com/dev/blog/tracing-in-cassandra-1-2

  • 谢谢RussS的回复.但是我真的不明白跟踪的哪一部分实际上是关于读取的墓碑的数量.能否请您详细说明一下? (8认同)
  • @PrasanthNath:答案的例子没有显示它,但是跟踪输出将有墓碑信息,例如:`读取101个实时和85个墓碑单元格[SharedPool-Worker-4] | 2015-07-29 14:57:36.895000 | 192.168.12.93 | 25264` (4认同)