Repository navigation
tools/cephfs: allow scanning and flushing journal in batches - #68813
Conversation
b5ae824 to
111f6ea
Compare
|
This PR has been added to main integration testing by pdonnell started 2026-05-08-16:17. |
|
@dparmar18 please don't forget to make a tracker ticket for backport. Please document here what local testing you've done. If I don't get around to it, please schedule recovery tests (any test runnning cephfs-journal-tool) using the branch I created above. |
The above tracker additionally demands explaining why the messenger layer holds the anonymous memory after the journal tool has decoded the buffers, I would consider this change to partially fix the problem (use
|
vshankar
left a comment
There was a problem hiding this comment.
You should remove Co-authored-by for yourself since you already have a signed-off-by tag.
Also as discussed in slack, a test case simulating the journal tool processing a large-ish journal would be beneficial.
I let a comment above. Please explain in the commit message as to how the RSS bloat is taken care by processing the journal entries as they are scanned. |
its there -> "flush the journal entry object as soon as it is scanned" |
I read that, but that's not enough, especially if we are not 100% sure that the messenger buffers would be freed or not. EDIT: fixed typo. |
7fee9b2 to
dcd86e1
Compare
once you validate the corretness of https://tracker.ceph.com/issues/76422#note-6, i'll add it to the commit description |
|
apart from this, the PR is ready @vshankar |
vshankar
left a comment
There was a problem hiding this comment.
Minor nits. Otherwise LGTM.
| self.fs.set_joinable(False) | ||
|
|
||
| # Set the MDS cache limit to 32GiB | ||
| self.config_set('mds', 'mds_cache_memory_limit', '34359738368') |
There was a problem hiding this comment.
nit: why would this be required? Does the test depend on this?
There was a problem hiding this comment.
num of segments and the trim interval are both drastically skewed, it should stress out the mds cache, no?
There was a problem hiding this comment.
It does, but I doubt it to this extent. Have you done preliminary tests to see how much cache memory the MDS actually uses?
There was a problem hiding this comment.
nope. its an assumption based on the data shared in private forum.
There was a problem hiding this comment.
Or maybe it actually does. Let's do a sample test to see how much is consumed.
|
This PR is under test in https://tracker.ceph.com/issues/76560. |
dcd86e1 to
fbe44e7
Compare
| ( | ||
| d="w${w}" | ||
| mkdir -p "$d/a" "$d/b" "$d/c" | ||
| for ((i = 0; i < 100000; i++)); do |
There was a problem hiding this comment.
I suggest reducing this. See this test: https://pulpito.ceph.com/vshankar-2026-05-14_04:36:53-fs:functional-wip-vshankar-testing-20260513.092143-distro-default-trial/211324/
The MDS is pretty busy with splitting the directories.
There was a problem hiding this comment.
reduce to 1/10th?
There was a problem hiding this comment.
the test case now generates 1.2M metadata ops. this looks to be not too less, not too more
|
a detailed RCA on why the memory bloat takes place while replaying the journal and while recovering dentries is added as a tracker comment https://tracker.ceph.com/issues/76422#note-10. Thanks to @vshankar for helping me point in the right direction. |
|
This PR has been added to main integration testing by vshankar started 2026-06-23-12:41. |
|
@dparmar18 - It is possible that this change is causing a test failure. See: https://pulpito.ceph.com/vshankar-2026-06-25_12:37:46-fs-wip-vshankar-testing-20260624.105849-distro-default-trial/316056/ The test fails due to Now, I haven't debugged more as to why this fails, but just FYI in case you get to it first. |
i think ive found the issue. will update in some time |
|
The above issue looks to be something this PR patch discovered. I checked out commit prior to mines and ran the test with some custom debug logs and as I had expected the journal tool didnt run scan_header() and scan_events() meaning the tool exited without recovering any dentry: Every loop was a no-op. |
|
And it's because the entire metadata pool is purged ceph/qa/tasks/cephfs/test_recovery_pool.py Lines 50 to 57 in 0820b31 This makes sense on why is the Journal Pointer absent. The only thing that the tool did was silently exit without reporting the error. And this is an error worth notifying since without journal pointer there is no |
5747e88 to
f42aeea
Compare
Makes sense. So, this change was actually ignoring and not throwing the error causing the test to go ahead with scan_events() and thereby failing, yes? |
|
jenkins retest this please |
since the errors are ignored the tc passes. I'm actually looking to tighten up the errno reporting a bit, rn if jp or header is absent then |
|
@vshankar PTAL at the last two commits:
This PR now passes the TC which failed earlier (at least locally) |
|
client log now looks like this: |
| JournalScanner::EventError(scav_r, cpp_strerror(scav_r)))); | ||
| } | ||
| } | ||
| it = js.events.erase(it); |
There was a problem hiding this comment.
Let's fold this commit onto the change that introduces batch processing.
There was a problem hiding this comment.
done, also rebased.
5b5220f to
49e7f04
Compare
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 <[email protected]> Signed-off-by: Dhairya Parmar <[email protected]>
with capping the maximum RSS to 500 MiB Partially-Fixes: https://tracker.ceph.com/issues/76422 Signed-off-by: Dhairya Parmar <[email protected]>
Partially-Fixes: https://tracker.ceph.com/issues/76422 Signed-off-by: Dhairya Parmar <[email protected]>
Partially-Fixes: https://tracker.ceph.com/issues/76422 Signed-off-by: Dhairya Parmar <[email protected]>
iIf the journal pointer and/or header is missing or corrupt, the tool silently returns with no-op. There is no dentry recovery happening if any of the objects are missing but it should be explicit to the user. This still doesn't change returning errnos on failures to maintain status quo until https://tracker.ceph.com/issues/77913 is addressed One important change: The condition to scan events is now changed from header_present to header_valid. The reason for this can be understood by reading JournalScanner::scan_header -- if the header could not be decoded, it is set to null, using this in JournalTool::recover_dentries would segfault and other corruptions include bad magic or inconsistent offsets. A recovery should not proceed with distorted magic/offset. Fixes: https://tracker.ceph.com/issues/76422 Signed-off-by: Dhairya Parmar <[email protected]>
49e7f04 to
0e9af4b
Compare
|
jenkins test api |
1 similar comment
|
jenkins test api |
NOTE: exclusive to only
event recover_dentriesJournalScanner::scan() runs a loop and loads the entire decoded journal in an
EventMapcalledevents. This can severely shoot up the RSS if the journalis 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 journaltool 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.
Co-authored-by: Patrick Donnelly [email protected]
Signed-off-by: Dhairya Parmar [email protected]
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.