]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
tools/cephfs: flush every journal event as soon as it is scanned
authorDhairya Parmar <dparmar@redhat.com>
Fri, 8 May 2026 07:37:20 +0000 (13:07 +0530)
committerDhairya Parmar <dparmar@redhat.com>
Thu, 9 Jul 2026 09:05:20 +0000 (14:35 +0530)
commitaa2db56d089d10d4bbd566e3c9f8a5f2dcdee284
tree12a96854e96e01138eef3a7bbcbe1363691d9537
parentbb59fd9b18f88d3b2fd70d2c1fcb04b6976e1c79
tools/cephfs: flush every journal event as soon as it is scanned

NOTE: exclusive to only `event recover_dentries`

JournalScanner::scan() runs a loop and loads the entire decoded journal in an
`EventMap` called `events`. This can severely shoot up the RSS if the journal
is huge (unflushed journal) making the tool less efficient.

The way to curb the memory bomb is to scan and flush journal in batches. The
flush boundary is based on the batch size and at event EVENT_SUBTREEMAP or
EVENT_SUBTREEMAP_TEST(subtree event(s) mark a clear boundary). The knob to
control this setting is via providing `--max-rss <bytes>` with the journal
tool command. This patch divides the provided limit by three to create the
batch since it is observed that the decoded journal events weight on an avg
~3x the encoded stream.

Also: Currently, the events map retains all decoded events until all dentries
are recovered, causing unnecessary memory retention.

Fix this by erasing each event from the map right after it is processed.
While the primary RSS bloat is caused by dnbl holding the encoded stream
in memory, this incremental cleanup provides a minor optimization until
a permanent fix is implemented (https://tracker.ceph.com/issues/77909).

Partially-Fixes: https://tracker.ceph.com/issues/76422

Co-authored-by: Patrick Donnelly <pdonnell@ibm.com>
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
src/tools/cephfs/JournalScanner.cc
src/tools/cephfs/JournalScanner.h
src/tools/cephfs/JournalTool.cc