cassandra - 为什么 Cassandra 主要压缩无法清除过期的墓碑?

标签 cassandra tombstone

我们在生产环境中部署了一个全局 Apache Cassandra 集群(节点:12,RF:3,版本:3.11.2)。我们遇到了一个问题,即在列族上运行主要压缩无法从一个节点(3 个副本中)清除逻辑删除,即使元数据信息显示表上设置的通过 gc_grace_seconds 的最小时间戳。

这是 sstable 元数据输出

SSTable: mc-4302-big
Partitioner: org.apache.cassandra.dht.Murmur3Partitioner
Bloom Filter FP chance: 0.010000
Minimum timestamp: 1
Maximum timestamp: 1560326019515476
SSTable min local deletion time: 1560233203
SSTable max local deletion time: 2147483647
Compressor: org.apache.cassandra.io.compress.LZ4Compressor
Compression ratio: 0.8808303792058351
TTL min: 0
TTL max: 0
First token: -9201661616334346390 (key=bca773eb-ecbb-49ec-9330-cc16da310b58:::)
Last token: 9117719078924671254 (key=7c23b975-5354-4c82-82e5-1762bac75a8d:::)
minClustringValues: [00000f8f-74a9-4ce3-9d87-0a4dabef30c1]
maxClustringValues: [ffffc966-a02c-4e1f-bdd1-256556624288]
Estimated droppable tombstones: 46.31761624099541
SSTable Level: 0
Repaired at: 0
Replay positions covered: {}
totalColumnsSet: 0
totalRows: 618382
Estimated tombstone drop times:
1560233680:       353
1560234658:       237
1560235604:       176
1560236803:       471
1560237652:       402
1560238342:       195
1560239166:       373
1560239969:       356
1560240586:       262
1560241207:       247
1560242037:       387
1560242847:       357
1560243742:       280
1560244469:       283
1560245095:       353
1560245957:       357
1560246773:       362
1560247956:       449
1560249034:       217
1560249849:       310
1560251080:       296
1560251984:       304
1560252993:       239
1560253907:       407
1560254839:       977
1560255761:       671
1560256486:       317
1560257199:       679
1560258020:       703
1560258795:       507
1560259378:       298
1560260093:      2302
1560260869:      2488
1560261535:      2818
1560262176:      2842
1560262981:      1685
1560263708:      1830
1560264308:       808
1560264941:      1990
1560265753:      1340
1560266708:      2174
1560267629:      2253
1560268400:      1627
1560269174:      2347
1560270019:      2579
1560270888:      3947
1560271690:      1727
1560272446:      2573
1560273249:      1523
1560274086:      3438
1560275149:      2737
1560275966:      3487
1560276814:      4101
1560277660:      2012
1560278617:      1198
1560279680:       769
1560280441:      1337
1560281033:       608
1560281876:      2065
1560282546:      2926
1560283128:      6305
1560283836:       824
1560284574:        71
1560285166:       140
1560285828:       118
1560286404:        83
1560295835:        72
1560296951:       456
1560297814:       670
1560298496:       271
1560299333:       473
1560300159:       284
1560300831:       127
1560301551:       536
1560302309:       425
1560303302:       860
1560304064:       465
1560304782:       319
1560305657:       323
1560306552:       236
1560307454:       368
1560308409:       320
1560309178:       210
1560310091:       177
1560310881:        85
1560311970:       147
1560312706:        76
1560313495:        88
1560314847:       687
1560315817:      1618
1560316544:      1245
1560317423:      5361
1560318491:      2060
1560319595:      5853
1560320587:      5390
1560321473:      3868
1560322644:      5784
1560323703:      6861
1560324838:      7200
1560325744:      5642
Count               Row Size        Cell Count
1                          0              3054
2                          0                 0
3                          0                 0
4                          0                 0
5                          0                 0
6                          0                 0
7                          0                 0
8                          0                 0
10                         0                 0
12                         0                 0
14                         0                 0
17                         0                 0
20                         0                 0
24                         0                 0
29                         0                 0
35                         0                 0
42                         0                 0
50                         0                 0
60                        98                 0
72                        49                 0
86                        46                 0
103                     2374                 0
124                       39                 0
149                       36                 0
179                       43                 0
215                       18                 0
258                       26                 0
310                       24                 0
372                       18                 0
446                       16                 0
535                       19                 0
642                       27                 0
770                       17                 0
924                       12                 0
1109                      14                 0
1331                      23                 0
1597                      20                 0
1916                      12                 0
2299                      11                 0
2759                      11                 0
3311                      11                 0
3973                      12                 0
4768                       5                 0
5722                       8                 0
6866                       5                 0
8239                       5                 0
9887                       6                 0
11864                      5                 0
14237                     10                 0
17084                      1                 0
20501                      8                 0
24601                      2                 0
29521                      2                 0
35425                      3                 0
42510                      2                 0
51012                      2                 0
61214                      1                 0
73457                      2                 0
88148                      3                 0
105778                     0                 0
126934                     3                 0
152321                     2                 0
182785                     1                 0
219342                     0                 0
263210                     0                 0
315852                     0                 0
379022                     0                 0
454826                     0                 0
545791                     0                 0
654949                     0                 0
785939                     0                 0
943127                     0                 0
1131752                    0                 0
1358102                    0                 0
1629722                    0                 0
1955666                    0                 0
2346799                    0                 0
2816159                    0                 0
3379391                    1                 0
4055269                    0                 0
4866323                    0                 0
5839588                    0                 0
7007506                    0                 0
8409007                    0                 0
10090808                   1                 0
12108970                   0                 0
14530764                   0                 0
17436917                   0                 0
20924300                   0                 0
25109160                   0                 0
30130992                   0                 0
36157190                   0                 0
43388628                   0                 0
52066354                   0                 0
62479625                   0                 0
74975550                   0                 0
89970660                   0                 0
107964792                  0                 0
129557750                  0                 0
155469300                  0                 0
186563160                  0                 0
223875792                  0                 0
268650950                  0                 0
322381140                  0                 0
386857368                  0                 0
464228842                  0                 0
557074610                  0                 0
668489532                  0                 0
802187438                  0                 0
962624926                  0                 0
1155149911                 0                 0
1386179893                 0                 0
1663415872                 0                 0
1996099046                 0                 0
2395318855                 0                 0
2874382626                 0                  
3449259151                 0                  
4139110981                 0                  
4966933177                 0                  
5960319812                 0                  
7152383774                 0                  
8582860529                 0                  
10299432635                 0                  
12359319162                 0                  
14831182994                 0                  
17797419593                 0                  
21356903512                 0                  
25628284214                 0                  
30753941057                 0                  
36904729268                 0                  
44285675122                 0                  
53142810146                 0                  
63771372175                 0                  
76525646610                 0                  
91830775932                 0                  
110196931118                 0                  
132236317342                 0                  
158683580810                 0                  
190420296972                 0                  
228504356366                 0                  
274205227639                 0                  
329046273167                 0                  
394855527800                 0                  
473826633360                 0                  
568591960032                 0                  
682310352038                 0                  
818772422446                 0                  
982526906935                 0                  
1179032288322                 0                  
1414838745986                 0                  
Estimated cardinality: 3054
EncodingStats minTTL: 0
EncodingStats minLocalDeletionTime: 1560233203
EncodingStats minTimestamp: 1
KeyType: org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)
ClusteringTypes: [org.apache.cassandra.db.marshal.UUIDType]
StaticColumns: {}
RegularColumns: {}

到目前为止,这是我们尝试过的, 1) 具有较低 gc_grace_seconds 的主要压缩 2)节点工具垃圾收集 3)nodetool擦洗

以上方法都没有帮助。同样,这种情况仅发生在一个节点(总共 3 个副本中)

最佳答案

在主要压实过程中生成的墓碑标记就是标记。数据已被删除,但删除标记仍保留在原处,以便其他副本也可以有 gc_grace_seconds 来处理它们。下次压缩 SSTable 时,墓碑标记将完全删除。不幸的是,因为您已经运行了一次主要压缩(很少推荐),所以可能需要很长时间才能有合适的 SSTable 进行压缩来清理墓碑。请记住,逻辑删除也只会在表中定义的 local_delete_time + gc_grace_seconds 之后发生。

如果您有兴趣了解有关删除操作上下文中逻辑删除和压缩如何协同工作的更多信息,我建议您阅读以下文章:

https://docs.datastax.com/en/archived/cassandra/3.0/cassandra/dml/dmlAboutDeletes.html https://thelastpickle.com/blog/2016/07/27/about-deletes-and-tombstones.html

关于cassandra - 为什么 Cassandra 主要压缩无法清除过期的墓碑?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56558191/

相关文章:

java - 为什么 Cassandra 客户端在生产中没有 epoll 会失败?

cassandra - 列的注释 @ClusteringColumn 的排序值无效?

azure - 如何通过动态资源分配来运行spark + cassandra + mesos (dcos)?

Cassandra 表的常量墓碑压缩

visual-studio-2010 - 错误 'Newtonsoft.Json.Linq.JToken' 无法使用 TombstoneHelper 序列化

scala - Cassandra 连接器 Apache Spark : local class incompatible

java - Spark cassandra 连接器 Java API 与 Spark 2.0

cassandra - 如何在 cassandra 1.2.6 中生成 'tombstone compaction'

exception - Cassandra 中的 TombstoneOverwhelmingException

cassandra - 仅簇键不同的 Cassandra 插入是否会生成墓碑