Repository navigation
Conversation
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
The backend dirfrag prefetch (mds_dir_prefetch_backend) sets STATE_BACKEND_FETCH and increments mdcache->num_backend_fetching when launching a background full fetch. The state and counter are only cleared on the success path in _omap_fetched(). If the fetch fails (missing dirfrag object, corrupt fnode header, trailing garbage), _omap_fetched() calls go_bad(), which clears only STATE_FETCHING and never clears STATE_BACKEND_FETCH nor decrements num_backend_fetching. The leaked counter saturates the mds_dir_prefetch_backend_max throttle over time, silently disabling all future backend prefetches, and the CDir's STATE_BACKEND_FETCH bit stays stuck set. Mirror the success-path cleanup in go_bad(), and do it only when the failed fetch was a full one. With the backend prefetch a keyed fetch can run while a background full fetch is still in flight; if the keyed fetch fails, clearing STATE_FETCHING and the throttle slot then would let a second full fetch start on the same dirfrag and release the slot before the first one finishes. Fixes: https://tracker.ceph.com/issues/80828 Signed-off-by: Xiubo Li <[email protected]>
The lazy backend prefetch counts keyed-fetch hits on a dirfrag in backend_hit_count and launches a background full fetch once the count reaches mds_dir_prefetch_backend_hit_threshold. The counter saturates at the threshold and is never reset. Once a dirfrag has been fetched complete, trimming any one of its dentries clears STATE_COMPLETE again. With the counter still at the threshold, the very next keyed miss relaunches a full background fetch of the whole dirfrag. Under cache pressure this turns into a loop: the fetch fills the cache, trimming drops the dirfrag back to incomplete, and the next miss reads the whole dirfrag again. Reset the counter in mark_complete(), so a dirfrag that has lost its complete state has to earn a background fetch again. Fixes: https://tracker.ceph.com/issues/80828 Signed-off-by: Xiubo Li <[email protected]>
The background full fetch launched by mds_dir_prefetch_backend loads every dentry and inode of the dirfrag into the cache. When the cache is already over its reservation (cache_toofull()), the loaded entries are trimmed straight back out, so the prefetch only costs a full omap read and adds to the pressure on the cache. Skip the background fetch while the cache is too full. The requesting operation is still served by the keyed fetch, which is issued first. Fixes: https://tracker.ceph.com/issues/80828 Signed-off-by: Xiubo Li <[email protected]>
Nothing in the suite runs with mds_dir_prefetch_backend enabled beyond the fs:thrash override, and nothing checks when a background fetch is launched or what happens when a fetch fails. Add a functional test: * test_hit_count_reset_after_trim: a dirfrag trimmed back to incomplete takes mds_dir_prefetch_backend_hit_threshold new keyed-fetch hits before another background fetch, rather than refetching on the next miss. * test_no_prefetch_when_cache_too_full: no background fetch is launched while the cache is over its reservation, and one is once it has room. * test_fetch_failure: with the dirfrag object removed, a lookup gets EIO instead of hanging, and the background fetch slot is released so that another dirfrag can still be prefetched with mds_dir_prefetch_backend_max=1. A second client holds a file open in each directory under test, which keeps the dirfrag in the cache while "cache drop" trims its other dentries, so the tests can observe a dirfrag going from complete to incomplete and back. Fixes: https://tracker.ceph.com/issues/80828 Signed-off-by: Xiubo Li <[email protected]>
6fbdb1a to
90becbb
Compare
|
@xiubli @vshankar If these are backported, #69832, #72036 and #72524 need to land in the same point release on each branch. #69832 alone would ship the problems tracked in https://tracker.ceph.com/issues/80828 to anyone running mds_dir_prefetch=false with mds_dir_prefetch_backend=true, and #72524 is the qa change that covers the backend mode. Backports are requested on trackers 77810, 80828 and 81584. |
|
@vshankar gentle ping for a review when you have a chance. The tentacle and umbrella backports of #69832 (https://tracker.ceph.com/issues/82048, https://tracker.ceph.com/issues/82049) are waiting on this one, since the three PRs need to land together. We are hoping the set can make 20.2.6. Thanks! |
Ummm.. I see you requested back porting of the original enhancement. Normally, we let an enhancement bake it main branch and have it as part of the next release. Apart from having features and enhancements generally not being a backport candidate, it is also a risk mitigation strategy for sizeable changes (enhancements and features) that get merged late in a releases development cycle. So, my question is: do we really need to backport the original enhancement? @anthonyeleven @xiubli ? |
Since this is a new feature and from my understanding we'd better not backport it, which is a bit risky ? |
Unless the enhancement fixes a nagging issue that is bothering our users, it is generally expected to be part of next release. @anthonyeleven - unless the backport is required to fix a perf related thing that you have come across with our users or at $company, I would generally not want to port it. I am happy to help out with any perf issue that prompted the port requirement. |
|
@vshankar @xiubli You're right, we don't need it. We asked for the #69832 backport after surveying MDS changes that might help cold-cache failovers, not because of a problem we measured, so I've withdrawn the umbrella and tentacle requests on 77810, 80828 and 81584. One part of this PR does affect released branches: the lookup hang in item 4. On reef, tentacle and umbrella, |
Am I correct in understanding that this is a bug that is present in release branches? If yes, then we should fix it separately. Have a tracker? |
|
@vshankar Yes, it's in the release branches, and it already has a tracker: https://tracker.ceph.com/issues/79454. Xiubo's #71022 fixed it on main on Oct 19 by finishing So item 4 doesn't need a separate fix or tracker. It reaches the release branches with the #71022 backports. |
Follow-up to #69832 (
mds_dir_prefetch_backend).Fixes: https://tracker.ceph.com/issues/80828
Problems
Throttle slot leak on fetch failure. A background full fetch sets
STATE_BACKEND_FETCHand takes amds_dir_prefetch_backend_maxslot, butonly the success path in
_omap_fetched()released them. A failed fetch(missing dirfrag object, corrupt fnode header) went through
go_bad(),which leaked the slot. With the default max of 1, a single failure
disabled backend prefetch for the whole rank until restart.
Refetch loop under cache pressure.
backend_hit_countstopped countingat the threshold and was never reset. Once trimming dropped a dirfrag back
to incomplete, the next keyed miss relaunched a full background fetch, so
the threshold no longer had any effect. Under cache pressure this became a
loop: the fetch fills the cache, trimming evicts some of it, and the next
miss reads the whole dirfrag again.
Prefetch ignores cache pressure. The background fetch ran even when
cache_toofull(), where everything it loads is trimmed straight back out.Lookup hang on a failed keyed fetch. With
mds_dir_prefetch=false, akeyed fetch parks the request on
waiting_on_dentry, butgo_bad()onlyfinished
WAIT_COMPLETE. If the dirfrag object is missing, the lookuphangs forever as a slow request. This is independent of the backend
prefetch and also affects
mainwithmds_dir_prefetch=falsealone.Changes
go_bad(): releaseSTATE_BACKEND_FETCHand the throttle slot. Do this,and clear
STATE_FETCHING, only when the failed fetch was a full one. Akeyed fetch can fail while a background full fetch is still in flight.
mark_complete(): resetbackend_hit_count.CDir::fetch(): skip the background fetch whilecache_toofull().go_bad(): also wake dentry waiters. The retried request stops at thedamaged dirfrag in
path_traverse()and gets-EIO.qa/tasks/cephfs/test_dir_prefetch.py, added tofs:functional. A second client holds a file open in each directory undertest, so the dirfrag stays cached while
cache droptrims its otherdentries.
test_hit_count_reset_after_trimtest_no_prefetch_when_cache_too_fulltest_fetch_failureTesting
Run with
vstart_runner.pyagainst a local vstart cluster:test_fetch_failuretest_hit_count_reset_after_trimtest_no_prefetch_when_cache_too_fullOnly
mds_dir_prefetch=falsewithmds_dir_prefetch_backend=trueisaffected, apart from (4). The default (
mds_dir_prefetch=true) is unaffected.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.