Set the default leveldb mmap limit to 4096 files from dbwrapper, before creating the first leveldb context.
The motivation here is to remove the need for a custom leveldb patch, see google/leveldb#1265.
After looking into this i’m not as sure whether this is what we want to do:
- The interface here is really ludicrous.
- Why is 4096 a good number, specifically? As the files are closed after mmap, the mmapped files don’t take up a file descriptor slot.
- After #30039, the number of ldb files created is 16 times smaller. 1000 files with the new default of 32MB is 32GB of database. Maybe there’s nothing left to do here and we can better drop the patch.