You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We don’t do any manual flushes, and instead we are relying on the max_total_wal_size formula to flush the Column families when the WAL exceeds its setting.
After loading about 10GB of data across about the column families into a clean database, and then leaving the system to idle for some hours, I am still seeing *.log files on disk totalling about ~20GB.
Unfortunately, I believe either one of two things is happening:
I am misunderstanding how the above dynamic calculation works, or
there is a bug whereby max_total_wal_size is not dynamically calculated correctly.
I was expecting the flush and WAL cleanup to happen at: (128MB * 6) * 4 = 3GB.
I am wondering how to interpret the text "sum of all write_buffer_size". Should it actually mean the total WAL size across all column families instead, i.e.: (15 CFs * (128MB * 6)) * 4 = 45GB ?
were set for me by RocksDB when I called OptimizeLevelStyleCompaction on each Column Family.
Doing so, it seems that I have ended up with a very large dynamic WAL max_total_wal_size.
Is there any way to have a smaller dynamic WAL max_total_wal_size?
@anand1976 I looked at the implementation of max_total_wal_size = 0 but I feel it is odd. It appears that DBImpl::max_total_in_memory_state_ should be the actual value to use, but in db_impl_compaction_flush.cc, the value is updated in a way that makes no sense to me. Maybe we should track back the history and see how this problematic line was added.
@siying I don't see anything wrong in how max_total_in_memory_state_ is being updated in db_impl_compaction_flush.cc. It seems to be adjusting the value in case there was any change to the write_buffer_size or max_write_buffer_number parameters. Am I missing something?
@adamretter You can always explicitly set max_total_wal_size. Interestingly, we have the db_write_buffer_size and write_buffer_manager options to limit the overall memory consumption by memtables, but they don't seem to influence the default max_total_wal_size calculation.
@anand1976 db_write_buffer_size and write_buffer_manager are for control memtable memory. max_total_wal_size is to control WAL size limit. These can mostly mean the same thing but not absolute. They also pick memtable to flush in different ways as far as I remember.
@adamretter Are you writing evenly to all the CFs? If so, then I think there may be a bug because every CF memtable should get flushed regularly, and none of them should hold a reference to very old log files. You can dump the manifest to see the log number for each CF (and min_log_number_to_keep if you've enabled 2pc).
Activity
[-]Clarification on `max_total_wal_size = 0`[/-][+]Clarification on max_total_wal_size[/+]anand1976 commentedon Sep 10, 2019
Yes, it is the total WAL size across all column families. The WAL is shared by all column families, so the max WAL size is the aggregate.
adamretter commentedon Sep 10, 2019
@ananclub Okay, so the settings I posted:
were set for me by RocksDB when I called
OptimizeLevelStyleCompactionon each Column Family.Doing so, it seems that I have ended up with a very large dynamic WAL
max_total_wal_size.Is there any way to have a smaller dynamic WAL
max_total_wal_size?siying commentedon Sep 10, 2019
@anand1976 I looked at the implementation of
max_total_wal_size = 0but I feel it is odd. It appears that DBImpl::max_total_in_memory_state_ should be the actual value to use, but in db_impl_compaction_flush.cc, the value is updated in a way that makes no sense to me. Maybe we should track back the history and see how this problematic line was added.anand1976 commentedon Sep 10, 2019
@siying I don't see anything wrong in how
max_total_in_memory_state_is being updated in db_impl_compaction_flush.cc. It seems to be adjusting the value in case there was any change to thewrite_buffer_sizeormax_write_buffer_numberparameters. Am I missing something?siying commentedon Sep 10, 2019
@anand1976 do you mean https://github.com/facebook/rocksdb/blob/1b4c104a678ce211fb919a701f9aa35843b6278f/db/db_impl/db_impl_compaction_flush.cc#L3036-L3038 ?
siying commentedon Sep 10, 2019
@anand1976 oh I got it. Hmm, Maybe there is not bug there.
siying commentedon Sep 10, 2019
I don't know what's the problem then.
anand1976 commentedon Sep 10, 2019
@adamretter You can always explicitly set
max_total_wal_size. Interestingly, we have thedb_write_buffer_sizeandwrite_buffer_manageroptions to limit the overall memory consumption by memtables, but they don't seem to influence the defaultmax_total_wal_sizecalculation.Cc @maysamyabandeh @riversand963 who may have more expertise in how the WAL works.
siying commentedon Sep 10, 2019
@anand1976 db_write_buffer_size and write_buffer_manager are for control memtable memory. max_total_wal_size is to control WAL size limit. These can mostly mean the same thing but not absolute. They also pick memtable to flush in different ways as far as I remember.
anand1976 commentedon Sep 11, 2019
@adamretter Are you writing evenly to all the CFs? If so, then I think there may be a bug because every CF memtable should get flushed regularly, and none of them should hold a reference to very old log files. You can dump the manifest to see the log number for each CF (and min_log_number_to_keep if you've enabled 2pc).
adamretter commentedon Sep 11, 2019
@anand1976 I am not quite sure what you mean by "evenly"?
If it is about the amount of data in each CF... then some of our CFs have much more data than others.
Could you point me to some documentation about how to dump the manifest?
anand1976 commentedon Sep 11, 2019
Its possible one or more CFs have not been flushed for a very long time.
To dump manifest -
ldb manifest_dump --path=<path_to_manifest_file>siying commentedon Sep 11, 2019
@adamretter I guess the only task left is to improve the comment to the option?
Fb 5789 max total WAL size clarification (meta#9108)
Fb 5789 max total WAL size clarification (meta#9108)