如何获取CQL查询的逻辑删除计数? [英] How to get tombstone count for a cql query?

查看:62
本文介绍了如何获取CQL查询的逻辑删除计数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to evaluate number of tombstones getting created in one of tables in our application. For that I am trying to use nodetool cfstats. Here is how I am doing it:

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个墓碑。但是在为该列族运行cfstats时,我仍然看到没有创建逻辑删除。

Now I am making the same insert as above. So I expect 3 tombstones to be created. But on running cfstats for this columnfamily, I still see that there are no tombstones created.

nodetool cfstats demo.test
Average live cells per slice (last five minutes): 0.0
Average tombstones per slice (last five minutes): 0.0

现在我尝试删除记录,但仍然看不到创建任何墓碑。我在这里想念什么吗?

Now I tried deleting the record, but still I don't see any tombstones getting created. Is there any thing that I am missing here? Please suggest.

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

BTW a few other details, * We are using version 2.1.1 of the Java driver * We are running against Cassandra 2.1.0

推荐答案

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

For tombstone counts on a query your best bet is to enable tracing. This will give you the in depth history of a query including how many tombstones had to be read to complete it. This won't give you the total tombstone count, but is most likely more relevant for performance tuning.

在cqlsh中,您可以使用

In cqlsh you can enable this with

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

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

这篇关于如何获取CQL查询的逻辑删除计数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆