Issues in growing commit logs

不问归期 提交于 2019-12-24 04:01:30

问题


I have a machine the commit logs keeps increasing upto 7.8 GB and still growing, I checked a property commitlog_total_space_in_mb: 8192 which is commented in cassandra.yaml. I suspect it has to be the default.

1) What is the problem in growing commit log size?
2) Is it says my memtable treshold is not reached?

EDITED :

memtable_cleanup_threshold = 1/(memtable_flush_writers + 1) * (memtable_offheap_space_in_mb + memtable_heap_space_in_mb)

where recommended values are,

memtable_flush_writers -  Smaller of number of disks or number of cores with a minimum of 2 and a maximum of 8, so in our case it is '8'

memtable_offheap_space_in_mb - 1/4 of the heap size, so in our case it is 2GB
memtable_heap_space_in_mb - 1/4 of the heap size, so in our case it is 2GB

so calculation will be,

 memtable_cleanup_threshold = 1/(8 + 1) * 4096
 memtable_cleanup_threshold = 455MB

Why does it didn't flush reaching to 455 MB and remove the commit log?


回答1:


Yes, 8192MB (or 1/4 of log file disk space, whichever is smaller -- could apply if you have a smaller server) is the default. Source: Cassandra documentation on commitlog_total_space_in_mb.

To answer your questions:

(1) If the commitlog files continue to grow, you can run out of disk space.

(2) The configured threshold has not yet been met.

Edited after your additional questions to add:

Commitlogs aren't deleted when memtables are flushed.

Note the file size is preallocated based on your configuration size -- I think you already figured that out, but noting that here if anyone else tries to observe the file size via ls or similar.

If you nodetool drain or restart, they will be cleared. Otherwise, they will continue to grow to the max size and rotate around.

Here is a test to see what happens if you force a flush:

nodetool tablestats keyspace.table | grep "Memtable data size"
Memtable data size: 1292049

cat /var/lib/cassandra/commitlog/CommitLog-A.log | wc -l
10418

cat /var/lib/cassandra/commitlog/CommitLog-B.log | wc -l
0

nodetool flush

nodetool tablestats keyspace.table | grep "Memtable data size"
Memtable data size: 0

cat /var/lib/cassandra/commitlog/CommitLog-A.log | wc -l
10419

cat /var/lib/cassandra/commitlog/CommitLog-B.log | wc -l
0

nodetool drain

nodetool tablestats keyspace.table | grep "Memtable data size"
Memtable data size: 0

cat /var/lib/cassandra/commitlog/CommitLog-A.log | wc -l
no such file

cat /var/lib/cassandra/commitlog/CommitLog-B.log | wc -l
0

You see similar results if it flushes automatically based on memtable configuration. Throughout the following observed flushes, the commitlog was not purged either:



来源:https://stackoverflow.com/questions/50485680/issues-in-growing-commit-logs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!