cassandra - Cassandra 何时从 SSTable 中删除数据

标签 cassandra cassandra-2.0

在 Cassandra 2.x 中,当我删除一列或多列时,它们会在 Memtable 中收到一个逻辑删除,但数据不会被删除。在某个时刻,Memtable 会刷新到 SSTable,其中包括已删除的数据和逻辑删除。当压缩运行时,它将保留具有指定宽限期的逻辑删除。数据会发生什么情况?我上周删除了一堆列 - 不到 gc_grace_seconds 前。我不确定压缩是否已经运行。我还没有看到所使用的磁盘大小有任何变化,所以我想知道数据在什么时候从磁盘中物理删除?

最佳答案

In Cassandra 2.x when I delete one or multiple columns, they receive a tombstone in the Memtable but the data is not removed. At some point, the Memtable is flushed to an SSTable including the deleted data and the tombstone. When compaction is running, it will retain the tombstone with the specified grace period.

正确。

What happens to the data?

数据将在磁盘上保留至少 gc_grace_seconds。 gc_grace_seconds 之后的下一次小压缩可能将其删除,但实际时间主要取决于您的数据集和工作负载类型。

I have deleted a bunch of columns last week - less than gc_grace_seconds ago. I am not sure compaction has run yet. I haven't seen any change on disk size used yet, so I was wondering at which point is the data physically removed from disk?

如果您想释放一些磁盘空间,您可以:

  • 等待 gc_grace_seconds 进行正常的次要压缩。
  • 运行nodetoolcompact,这将触发当前节点上的主要压缩,立即释放磁盘空间。

关于cassandra - Cassandra 何时从 SSTable 中删除数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25886188/

相关文章:

apache-spark - 使用 datastax 连接器连接到 cassandra

cassandra - 在 cassandra 上禁用压缩和 gc 宽限期

java - 如何使用合并更改分区数?

Cassandra 硬件参差不齐,如何配置?

cassandra - YCSB for Cassandra 3.0 基准测试

cassandra - 在哪里更改 Cassandra for Usergrid 使用的默认键空间?

nosql - Cassandra文件结构-文件如何使用?

java - Cassandra - SimpleStrategy 需要replication_factor 策略选项

Cassandra 、solr、卢坎德拉、索兰德拉

java - 是否可以禁用日志文件中的 TimingLogger 行?