打开 cassandra sstables 进行行计数

open cassandra sstables for row count

我计划打开给定 cf 的所有 sstable 以获取行数和墓碑。它实际上是 ISSTableScanner 并且像往常一样它必须扫描 sstables 中的每一行。

如果给定 cf 的 sstables 数量有限,这会很好用。但是,如果你有 1000 个 sstables 怎么办,这种方法会导致性能问题,因为它必须打开每个 sstables 并扫描。

有什么最好的方法可以打开给定 cf 的所有 sstables 吗?我知道 Runnable Interface 用于 SSTableReader openAll() 方法。除此之外,还有什么最好的方法可以实现这一目标吗?

MapReduce 对此有帮助吗?提前致谢。

谢谢, -苏约达

如果您要查找墓碑的数量,可以通过对 sstable 统计信息的 estimatedTombstoneDropTime 中的垃圾箱计数求和来获得。

如果您正在寻找哪个 partition/row 具有最多的墓碑,您可以使用 https://github.com/tolbertam/sstable-tools (perhaps included in C* someday in sstablemetadata command as part of CASSANDRA-1148) and call the "describe" command, it will give you the tombstone leaders. You can see the implementation here ,它仅适用于单个 sstable,但调用 openall 只是一个薄包装,真正打开它们并行。

还有 spcassandra-tombstones 作为 https://github.com/spotify/cassandra-opstools that you can see implementation of here 的一部分。