Skip to content

Commit 7790c95

Browse files
Gandalf-the-Greydnotestein
authored andcommitted
Bound RocksDB info LOG size and rotation in external storage provider
The external-storage RocksDB stores (the comments store and account_history_rocksdb, which share rocksdb_storage_provider::openDb) were opened with RocksDB's default info-log settings: max_log_file_size=0 (never rotate), keep_log_file_num=1000, INFO level. The single LOG file therefore grows unbounded for the whole process lifetime, logging every per-block flush/compaction plus a stats dump every 10 minutes. On nodes that place shared_memory.bin (and thus the store) on a small tmpfs this can exhaust the filesystem even though chain state is small. Set info_log_level=WARN, max_log_file_size=8MiB, keep_log_file_num=1 so the LOG stays small and bounded. Does not affect chain state. (cherry picked from commit c7c13f8) (cherry picked from commit 2f7b76b)
1 parent 4f8e6c6 commit 7790c95

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

libraries/chain/external_storage/rocksdb_storage_provider.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ void rocksdb_storage_provider::openDb( uint32_t expected_lib )
4646
/// Optimize RocksDB. This is the easiest way to get RocksDB to perform well
4747
options.IncreaseParallelism();
4848
options.OptimizeLevelStyleCompaction();
49+
// Keep the RocksDB info LOG bounded: defaults never rotate it (max_log_file_size=0,
50+
// keep_log_file_num=1000, INFO level), so it grows unbounded and can fill a small tmpfs.
51+
options.info_log_level = ::rocksdb::WARN_LEVEL;
52+
options.max_log_file_size = 8 * 1024 * 1024; // 8 MiB per LOG file
53+
options.keep_log_file_num = 1; // retain only the active LOG
4954
raise_fd_limit();
5055

5156
auto status = DB::Open( DBOptions( options ), strPath, columnDefs, &_columnHandles, &_db );
@@ -124,6 +129,11 @@ std::tuple<bool, bool> rocksdb_storage_provider::createDbSchema( const bfs::path
124129
/// Optimize RocksDB. This is the easiest way to get RocksDB to perform well
125130
options.IncreaseParallelism();
126131
options.OptimizeLevelStyleCompaction();
132+
// Keep the RocksDB info LOG bounded: defaults never rotate it (max_log_file_size=0,
133+
// keep_log_file_num=1000, INFO level), so it grows unbounded and can fill a small tmpfs.
134+
options.info_log_level = ::rocksdb::WARN_LEVEL;
135+
options.max_log_file_size = 8 * 1024 * 1024; // 8 MiB per LOG file
136+
options.keep_log_file_num = 1; // retain only the active LOG
127137
raise_fd_limit();
128138

129139
std::tuple<bool, bool> _result{ false, false };

0 commit comments

Comments
 (0)