2

我们有ttl24 小时或 1 天的下表。我们有 4 个cassandra 3.0 node cluster,将spark在此表上进行处理。一旦处理完毕,它将截断表中的所有数据,并插入新的一批数据。这将是一个持续的过程。

我看到的问题是,我们越来越多,因为数据在完成处理tombstones后每天都被频繁截断。spark

如果我设置gc_grace_seconds为默认,会有更多tombstones。如果我减少gc_grace_seconds到 1 天会有问题吗?即使我每天对那张桌子进行维修也足够了。

我应该如何解决这个问题,我知道频繁删除是一种反模式Cassandra,还有其他方法可以解决这个问题吗?

TABLE b.stag (
    xxxid bigint PRIMARY KEY,
    xxxx smallint,
    xx smallint,
    xxr int,
    xxx text,
    xxx smallint,
    exxxxx smallint,
   xxxxxx tinyint,
    xxxx text,
    xxxx int,
    xxxx text,
 xxxxx text,
    xxxxx timestamp
) WITH bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCom                                                                                        pactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandr                                                                                        a.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 86400
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99PERCENTILE';

谢谢你

4

1 回答 1

0

表的截断不应调用墓碑。因此,当您说“截断”时,我假设您的意思是删除。您可以像您已经提到的那样删除该gc_grace_seconds值,但这意味着您有一个较小的窗口来运行修复以协调任何数据,确保每个节点都有给定密钥的正确墓碑等,否则旧数据可能会重新出现。它是一种权衡。

但是,公平地说,如果您每次都清除表,为什么不使用TRUNCATE命令,这样您将在没有墓碑的情况下刷新表。

于 2017-05-30T13:13:36.440 回答