Repository navigation
Conversation
Config Diff Tool Output+ added: mds_log_hard_limit_segments (mds.yaml.in)
The above configuration changes are found in the PR. Please update the relevant release documentation if necessary. |
|
/config check ok |
| be strictly greater than ``mds_log_max_segments * mds_log_warn_factor``. If configured | ||
| lower than this calculated safety threshold, the MDS will automatically clamp the limit | ||
| to the safe minimum. Set to 0 to disable. | ||
| default: 512 |
There was a problem hiding this comment.
Isn't this too low? At 256 untrimmed segments (mds_log_max_segments * mds_log_warn_factor), the MDS emits MDS_TRIM warning which for the most part should be transient and auto-resovle soon. We are talking about a huge backlog of untrimmed segments., so, this number should be pretty large.
Also, I think we should base this number as a multiplier of mds_log_max_segments. Additionally, consider adding a MDS warning message when we hit the hard limit.
There was a problem hiding this comment.
I agree, the hard limit should be in at least tens of thousands of log segments.
Additionally, I am not sure whether -ENOSPC is the correct result here, as opposed to simply blocking and not returning until the condition is resolved. (I don't know if this is an option).
There was a problem hiding this comment.
Yeh, we need to block updated. Returning ENOSPC is going to trip up applications and all at the same time which isn't going to be a good user-experience.
gregsfortytwo
left a comment
There was a problem hiding this comment.
Philosophically, is the journal really where we really want this logic to live?
We need to get more back pressure slowing down client ops in general when the MDS can't keep up, but I'm not sure this is the way to go about it. If it is, it really needs to be a big fat hammer you never reach, with other slowdown mechanisms precluding it.
There are a LOT of operations which don't expect to get ENOSPC, so this might be better than the cluster going down on MDS restart, but...not a lot?
Agreed. But we don't have such an explicit back-pressure mechanism in the client <-> MDS protocol right now. Theoretically, an IOPS control mechanism could be built around cap grants/revocations, distinct from general QoS. Returning -ENOSPC is definitely the wrong semantic here -- POSIX applications assume the pool or quota is full and will fail or panic, whereas CephFS clients are already designed to tolerate operations blocking under cluster pressure or cap revocations. A tiered approach makes far more sense: Soft Limit: Aggressively recall caps from clients holding back the trim boundary and throttle/delay new cap grants. We can also progressively delay dispatching mutating client requests to slow down incoming mutations and give MDLog::trim() breathing room. Hard Limit: Instead of failing with -ENOSPC, block further mutating client operations. However, this gate must be selective: cap releases, flushes, session closures, and evictions must still be processed, otherwise we risk a deadlock where the trim boundary will never progress. Suggestions? |
MDLog::trim() decides whether to keep expiring segments by subtracting the expired segments from the segment count. An expired segment only leaves the journal once the removal walk in _trim_expired_segments() reaches a major segment past it. Expired segments stuck behind an unexpired segment were therefore counted as gone while still occupying the journal. Trim stopped at max_segments and never expired the unexpired segment that blocked the walk, so the journal stayed above max_segments indefinitely. Subtract only the expired segments that the next removal pass will drop, computed by count_removable_expired_segments(). The subtraction from commit 7de3738 (tracker 21975) is kept for those segments. Reproduced with a backlog of 20 segments and max_segments of 8: trim expired 12 segments, reported 8 remaining, and stopped with segment 122 unexpired and the journal's expire position unchanged. Behavior change: when expired segments are waiting for the next major segment, trim may expire up to that many additional segments in one pass, so steady-state trimming can differ slightly from before. Signed-off-by: Jos Collin <[email protected]>
When client sessions stall and prevent journal trimming, the MDS journal can grow without bound. Replaying an oversized journal uses unbounded memory and can crash the MDS. Add mds_log_hard_limit_factor. The hard limit is the journal segment count at which new client mutating requests are parked, computed as the factor times mds_log_max_segments. With the default factor of 250 and mds_log_max_segments at 128, the limit is 32000 segments. Parked requests resume once trimming brings the journal back under the limit. The limit is kept strictly above the warn threshold (mds_log_max_segments times mds_log_warn_factor), so MDS_TRIM is reported before clients are blocked. Between the warn threshold and the hard limit, new mutations are delayed in proportion to the backlog. The delay is controlled by mds_log_admission_min_delay and mds_log_admission_max_delay. If the max is configured below the min, it is raised to the min. Also: - Report MDS_JOURNAL_HARD_LIMIT as a health error while the limit is reached. - Refuse "mds fail" and "fs fail" in that state unless --yes-i-really-mean-it is given, since failover would replay the oversized journal. - Make mds_log_trim_upkeep_interval a runtime option, and wake the trim thread when it changes so the new interval applies immediately. - Resume parked requests on MDS shutdown. They are answered with -EAGAIN instead of stalling shutdown. - Register the new options with the MDS config observer, so changes to them reach handle_conf_change. Fixes: https://tracker.ceph.com/issues/73868 Signed-off-by: Jos Collin <[email protected]>
Add test_journal_limits to the fs/functional suite, and ignorelist the new cluster log and health messages in its yaml. The test stops trimming by setting mds_log_trim_upkeep_interval to 10 minutes, then runs a burst of concurrent file creates until the journal reaches the hard limit. It checks that: * A new create does not complete while the limit is held. * MDS_JOURNAL_HARD_LIMIT appears in "ceph health detail". * "ceph mds fail" is refused, and the refusal names MDS_JOURNAL_HARD_LIMIT. It then restores the trim interval. It waits for the health check to clear, failing with a reason if trimming does not resume, and checks that all parked creates complete. Clean up any creates still running in the client on exit, so teardown does not wait on them. Fixes: https://tracker.ceph.com/issues/73868 Signed-off-by: Jos Collin <[email protected]>
5047972 to
46883a9
Compare
|
I'm posting an email notification, which doesn't show up in this PR: @patrakov asks:
Reply: The point is that the fix doesn’t make replay faster. It makes the worst case bounded. Before, an oversized journal could grow until replay exhausted memory or never finished. With the hard limit, the journal stops growing at a configured size and thus the replay time and memory have an upper bound. |
Agreed. So we can do it when we have data, which is not now. |
Describe the new journal back-pressure behavior and its configuration: - mds-journaling.rst: add a "Journal back-pressure" section covering the delay band, the hard limit, and the trim interval, with confval entries for mds_log_admission_min_delay, mds_log_admission_max_delay, mds_log_hard_limit_factor, and mds_log_trim_upkeep_interval. - health-messages.rst: add an MDS_JOURNAL_HARD_LIMIT entry, and point the MDS_TRIM entry to it. - administration.rst, add-remove-mds.rst: list MDS_JOURNAL_HARD_LIMIT with MDS_TRIM and MDS_CACHE_OVERSIZED as warnings that require --yes-i-really-mean-it for "ceph fs fail" and "ceph mds fail". - troubleshooting.rst: correct the health code name from MDS_HEALTH_TRIM to MDS_TRIM, which is the name operators see. - PendingReleaseNotes: add a CephFS entry for the new back-pressure behavior, the health error, the refusal of mds fail and fs fail, and the -EAGAIN response during shutdown. Fixes: https://tracker.ceph.com/issues/73868 Signed-off-by: Jos Collin <[email protected]>
46883a9 to
f22ec13
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
| // Journal back-pressure. Only live, new client mutations are throttled or parked. | ||
| // Replayed and reconnecting requests must run so the journal can make progress, | ||
| // and nothing is gated while the MDS is not active. | ||
| if (req->may_write() && mds->is_active() && |
There was a problem hiding this comment.
This runs again for every C_MDS_RetryRequest, so an in-progress op is parked or delayed while it still holds locks, pins, or uncommitted_leaders. try_to_expire waits on that state, and the waiter is resumed only after the journal drops below the limit. Skip admission once the request has locks, pins, or peer state. The delay at line 2835 has the same hole for one timer interval.
|
Blocking client mutations instead of returning ENOSPC, keeping the limit above MDS_TRIM, and raising MDS_JOURNAL_HARD_LIMIT make sense. However, there are two issues that need to be addressed before merging this PR. dispatch_client_request blocks all write retries, including requests that already hold locks, auth pins, or have an uncommitted leader. Trim may be waiting for these requests to complete, while the requests themselves are waiting for trim to complete. For example, a rename waiting for a peer response can prevent the oldest segment from being trimmed indefinitely. The same mechanism can also block shutdown_pass before it gets to terminate_sessions. removable_expired is calculated once before entering the trim loop. When a segment expires during try_expire, it is removed from expiring_segments but is not accounted for in removable_expired. As a result, num_remaining_segments remains high and we continue expiring segments up to mds_log_trim_threshold (128 by default). This means that even on a healthy rank with just one segment above mds_log_max_segments, we may unnecessarily revoke caps for up to 128 segments in a single trim pass. Regarding the functional test, it does not actually verify MDS_JOURNAL_HARD_LIMIT independently. The refusal message always contains that name, and MDS_TRIM is already set at this point. The comment also refers to a monitor unit test which is not part of this PR. |
When client sessions stall and prevent journal trimming, the MDS journal
can grow without bound. Replaying an oversized journal uses unbounded
memory and can crash the MDS.
This adds mds_log_hard_limit_factor. When the journal reaches the hard
limit, which is the factor times mds_log_max_segments, new client
mutating requests are parked until trimming brings the journal back
under the limit. The hard limit is kept above the warn threshold, so
MDS_TRIM is raised before clients are blocked. Between the warn threshold
and the hard limit, new mutations are delayed in proportion to the backlog.
While the limit is reached, the MDS raises MDS_JOURNAL_HARD_LIMIT as a
health error, and the monitor refuses "mds fail" and "fs fail" unless
--yes-i-really-mean-it is given.
This also fixes a trim stall. Expired segments waiting for a major segment
were counted as already gone, so trim stopped at the ceiling and the
journal stayed above max_segments.
QA: adds tasks.cephfs.test_journal_limits. It checks that a create blocks
while the limit is held, that MDS_JOURNAL_HARD_LIMIT is raised, that mds
fail is refused and the refusal names the new code, and that parked creates
complete once trimming resumes.
Known limitations: MDS_TRIM is always raised with the hard limit, so the
integration test cannot isolate the monitor's refusal logic. Steady-state
trimming can differ slightly from before when expired segments are waiting
for the next major segment.
Fixes: https://tracker.ceph.com/issues/73868
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.