Cassandra 中频繁截断的问题和 24 小时 ttl 创建大型墓碑
issue with frequent truncates in Cassandra and 24 hour ttl create large tombstones
我们有以下 table ttl
24 小时或 1 天。我们有 4 个 cassandra 3.0 node cluster
,并且将在这个 table 上进行 spark
处理。处理后,它将 t运行 分类 table 中的所有数据,并插入新的一批数据。这将是一个持续的过程。
我看到的问题是,我们得到更多 tombstones
因为数据在 spark
完成处理后每天都被频繁地 运行 分类。
如果我将 gc_grace_seconds
设置为默认值,将会有更多 tombstones
。如果我将 gc_grace_seconds
减少到 1 天,会有问题吗?即使我 运行 每天修复那个 table 也足够了。
我应该如何解决这个问题,我知道频繁删除是 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';
谢谢
table 的截断不应调用墓碑。所以当你说 "truncating" 我假设你的意思是删除。您可以像您已经提到的那样删除 gc_grace_seconds
值,但这意味着您有一个较小的 window 用于修复 运行 协调任何数据,确保每个节点都有正确的墓碑给定的密钥等或旧数据可能会重新出现。这是一个权衡。
但是公平地说,如果您每次都清除 table,为什么不使用 TRUNCATE 命令,这样您将刷新 table 而没有墓碑。
我们有以下 table ttl
24 小时或 1 天。我们有 4 个 cassandra 3.0 node cluster
,并且将在这个 table 上进行 spark
处理。处理后,它将 t运行 分类 table 中的所有数据,并插入新的一批数据。这将是一个持续的过程。
我看到的问题是,我们得到更多 tombstones
因为数据在 spark
完成处理后每天都被频繁地 运行 分类。
如果我将 gc_grace_seconds
设置为默认值,将会有更多 tombstones
。如果我将 gc_grace_seconds
减少到 1 天,会有问题吗?即使我 运行 每天修复那个 table 也足够了。
我应该如何解决这个问题,我知道频繁删除是 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';
谢谢
table 的截断不应调用墓碑。所以当你说 "truncating" 我假设你的意思是删除。您可以像您已经提到的那样删除 gc_grace_seconds
值,但这意味着您有一个较小的 window 用于修复 运行 协调任何数据,确保每个节点都有正确的墓碑给定的密钥等或旧数据可能会重新出现。这是一个权衡。
但是公平地说,如果您每次都清除 table,为什么不使用 TRUNCATE 命令,这样您将刷新 table 而没有墓碑。