【问题标题】:What does cassandra do during compaction?cassandra 在压缩过程中做了什么?
【发布时间】:2011-11-29 18:58:46
【问题描述】:

我知道 cassandra 合并了 sstables、行键、删除墓碑等等。

  1. 但我真的很想知道它是如何执行压缩的?

  2. 由于 sstables 是不可变的,它会将所有相关数据复制到新文件吗?并且在写入这个新文件时,它会丢弃墓碑标记的数据。

我知道压缩是做什么的,但想知道它是如何实现的(T)

【问题讨论】:

    标签: cassandra immutability tombstone stream-compaction


    【解决方案1】:

    有两种运行压缩的方法:

    A- 轻微压实。自动运行。 B-主要压实。手动运行。

    在这两种情况下都需要 x 个文件(每个 CF)并处理它们。在此过程中,将 ttl 过期的行标记为 tombstones,并删除现有的 tombstones。这样会生成一个新文件。本次compaction中生成的tombostones,将在下一次compaction中删除(如果过了grace period,gc_grace)。

    A 和 B 的区别在于所取文件的数量和最终的文件。 A 需要几个相似的文件(相似的大小)并生成一个新文件。 B 获取所有文件并仅生成一个大文件。

    【讨论】:

      【解决方案2】:

      如果您关注其中的所有帖子和 cmets,我希望此主题对您有所帮助

      http://comments.gmane.org/gmane.comp.db.cassandra.user/10577

      阿法伊克

      Whenever memtable is flushed from memory to disk they are just appended[Not updated] to new SSTable created, sorted via rowkey.
      SSTable merge[updation] will take place only during compaction. 
      Till then read path will read from all the SSTable having that key you look up and the result from them is merged to reply back,
      
      Two types : Minor and Major
      
      Minor compaction is triggered automatically whenever a new sstable is being created.
      May remove all tombstones
      Compacts sstables of equal size in to one [initially memtable flush size] when minor compaction threshold is reached [4 by default]. 
      
      Major Compaction is manually triggered using nodetool
      Can be applied over a column family over a time
      Compacts all the sstables of a CF in to 1
      
      Compacts the SSTables and marks delete over unneeded SSTables. GC takes care of freeing up that space
      

      问候, 泰米尔语

      【讨论】:

      • 有什么方法可以在压缩后获取 sstables 的数据?我的意思是在将压缩数据写入 cassandra 表之前是否有任何 Java API 来获取压缩数据?
      猜你喜欢
      • 2018-12-12
      • 2017-06-23
      • 2011-05-13
      • 2015-03-29
      • 2012-09-22
      • 2012-10-16
      • 1970-01-01
      • 2018-10-23
      • 2014-10-01
      相关资源
      最近更新 更多