Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
os/bluestore: Make BitmapFreelistManager kv itereator short lived. #16243
Various KV stores want to keep read iterators/cursors/etc as short lived as possible. This PR resets KeyValueDB iterator in BitmapFreelistManager when enumerate is reset. In addition to calling enumerate_reset before enumerate loops, it calls it afterward as well.
"An iterator keeps a reference count on all underlying files that correspond to that point-in-time-view of the database - these files are not deleted until the Iterator is released."
"While any reader exists, writers cannot reuse space in the database file that has become unused in later versions. Due to this, continual use of long-lived read transactions may cause the database to grow without bound."
Without this change an lmdb backed bluestore db will grow without bound (tested up to 93GB after several minutes of 4kb writes to an NVMe). With this change, the database grows to ~122MB.
Rocksdb may not suffer as badly, though still may keep some files open indefinitely without the change.
Signed-off-by: Mark Nelson firstname.lastname@example.org