nodetool compact将所有内容移动到一个SSTable [英] Does nodetool compact move everything into one SSTable

查看:431
本文介绍了nodetool compact将所有内容移动到一个SSTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cassandra压缩过程减少了用于存储数据的SSTables(磁盘上的数据文件)的数量。 自动发生次要compaction 。您可以使用 nodetool compact 命令告诉Cassandra执行主要压缩。

The Cassandra compaction process reduces the number of SSTables (data files on disk) used to store data. Minor compactions occur automatically. Your can tell Cassandra to perform a major compaction using the nodetool compact command.

运行 nodetool compact 只执行一轮压缩,减少SSTables的数量,但可能仍然导致有几个SSTables?

Does running nodetool compact merely perform one round of compaction, reducing the number of SSTables, but perhaps still resulting in there being several SSTables? Or does it always compact all the SSTables (of a column family) into one SSTable?

推荐答案

这将取决于压缩策略你为表设置。

It would depend on the compaction strategy you set for the table.

对于DateTieredCompactionStrategy和LeveledCompactionStrategy,根据定义,我不认为即使一个主要的压缩将组合所有的SSTables,因为这将违背结构

For DateTieredCompactionStrategy and LeveledCompactionStrategy, by definition I don't think even a major compaction would combine all the SSTables since that would go against the structure of SSTables they aim to create.

对于默认的SizeTieredCompactionStrategy,无意中看起来主要的压缩会将SSTables合并到一个表中。我跑了 cassandra-stress -write ,看了一会儿SSTables。

For the default SizeTieredCompactionStrategy, anecdotally it appears a major compaction will combine the SSTables into a single table. I ran cassandra-stress -write and watched the SSTables for a while. I could see the minor compactions combining SSTables of similar sizes, but not collapsing dissimilar sizes into one.

然后,当我运行一个 nodetool compact时,可以看到, ,它会将不同大小的SSTables组合成一个表。我不确定这是否在所有情况下都是真的。

Then when I'd run a nodetool compact on the table, it would combine SSTables of dissimilar sizes into a single table. I'm not sure if that would be true in all cases.

快速查看源代码,在CompactionManager.java中,它调用cfStore.getCompactionStrategy()。getMaximalTask (gcBefore),它返回一个它执行的任务列表,所以这种意味着它将压缩一切,但我没有深入比这更深。

Taking a quick look at the source, in CompactionManager.java it calls cfStore.getCompactionStrategy().getMaximalTask(gcBefore), which returns a list of tasks that it executes, so that kind of implies it will compact everything, but I didn't drill down any deeper than that.

这篇关于nodetool compact将所有内容移动到一个SSTable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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