无法删除 Cassandra 中的墓碑单元

无法删除 Cassandra 中的墓碑单元

我们正在使用 Cassandra 单节点集群进行实验,现在遇到的一个问题是墓碑单元。每行包含 2 个墓碑单元,我们无法删除它们。它们导致我们的查询中止,因为墓碑阈值很快就达到了。

这是读取一行时的跟踪输出: Read 1 live rows and 2 tombstone cells [ReadStage-2]

我尝试使用nodetool garbagecollector,并附带适当的-g选项(CELL 或 ROW),但从未改变。为什么运行此命令后墓碑单元格不会被删除?我也尝试过该flush命令...

版本:

Cassandra version: 3.11.2 Thrift API version: 20.1.0 CQL supported versions: 3.4.4 (default: 3.4.4)

错误如下:

WARN [ReadStage-2] 2018-08-06 12:26:29,269 ReadCommand.java:555 - Read 50000 live rows and 100001 tombstone cells for query SELECT * FROM mykeyspace.mytable WHERE myid > 1025493673608400896 AND token(collectionid, ttype) >= token(10, collected) AND token(collectionid, ttype) <= token(10, collected) LIMIT 1000 (see tombstone_warn_threshold) ERROR [ReadStage-2] 2018-08-06 12:26:29,272 StorageProxy.java:1906 - Scanned over 100001 tombstones during query 'SELECT * FROM mykeyspace.mytable WHERE myid > 1025493673608400896 AND token(collectionid, ttype) >= token(10, collected) AND token(collectionid, ttype) <= token(10, collected) LIMIT 1000' (last scanned row partion key was ((10, collected), 1025494834679873536)); query aborted

我在 C* 垃圾收集方面遗漏了什么?任何有助于澄清此行为的帮助都将非常有用!谢谢。

答案1

Tombstone 被正确地垃圾收集,但 gc 遵守为列族设置的 gc_grace_seconds 值(默认为 10 天)。之后使用以下 cqlsh 命令更改了表:

alter table mykeyspace.mytable with gc_grace_seconds = 0; 墓碑被彻底拆除。

只是为了确保,但可能不需要,我再次为该表运行 nodetool trashcollector 和 nodetool compact。

相关内容