Repository navigation
fix(posix): back off retries of files that failed to assimilate - #796
Merged
aduffeck merged 2 commits intoSep 18, 2026
Merged
Conversation
NickWalters
force-pushed
the
fix/posix-assimilation-backoff
branch
2 times, most recently
from
September 10, 2026 16:02
fcd3901 to
fc2f433
Compare
Author
|
Hi @aduffeck and @rhafer, sorry for the ping. This is my first PR here, so CI is sitting at "pending approval" until someone lets it run. Could one of you kick it off when you get a chance? I think it'll also need a #797 is the tree size fix I mentioned in the description. They don't depend on each other, so either can go in first. Thanks! |
A file that failed to assimilate after its checksums were computed, e.g. because the service user can't set extended attributes on it, was assimilated again on every directory listing and scan, reading the whole file each time. Remember such failures per path and don't read the file again while it is unchanged (same mtime, size, mode and inode) until a retry delay has passed. The delay starts at a minute and doubles with every failure up to a day. Failures before the checksum step are cheap and still retried right away. The skip returns the last error so logs still say why the file isn't assimilated. Fixes opencloud-eu/opencloud#3498
NickWalters
force-pushed
the
fix/posix-assimilation-backoff
branch
from
September 16, 2026 16:09
fc2f433 to
8b6886e
Compare
Author
|
Thanks for kicking off CI last time. The build failed at the |
aduffeck
requested changes
Sep 17, 2026
NickWalters
force-pushed
the
fix/posix-assimilation-backoff
branch
from
September 18, 2026 04:28
2e59ae4 to
2139177
Compare
NickWalters
force-pushed
the
fix/posix-assimilation-backoff
branch
2 times, most recently
from
September 18, 2026 04:45
79a3cdd to
e55e677
Compare
Changes from the review: - Move the failure tracking from tree to a new tree/assimilation package, as assimilation.Failures with Recent and Record. - Use unnamed returns in updateFile again. The deferred Record reads the err that updateFile declares. Every failure after the checksum step sets it before it returns. - Compare the uid and gid of the file instead of its inode. A retry now starts as soon as a chown makes the file assimilatable. - Keep at most 10000 failures, which is about 8 MB. When full, keep the stored ones and don't store new ones. With LRU eviction, a scan over more failing files evicted each entry before it got back to that file, so it skipped nothing.
NickWalters
force-pushed
the
fix/posix-assimilation-backoff
branch
from
September 18, 2026 05:00
e55e677 to
7cf03ea
Compare
Author
This was referenced Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes opencloud-eu/opencloud#3498
Some files can't be assimilated, and the cause doesn't go away by itself. In my case the opencloud user had no write permission on the files, so it couldn't set the
user.oc.*xattrs. Nothing remembers such a failure. The next directory listing or scan tries again. Each try reads the whole file for its checksums before it gets to the step that fails. On my setup that was about 117 MB/s of reads for 46 hours before I found the cause.With this change,
updateFileremembers files that failed after the checksum step. The newtree/assimilationpackage keeps them by path inassimilation.Failures, which wraps an expirable LRU from golang-lru (already a dependency). While the mtime, size, mode, owner and group of a file stay the same,updateFileskips it until a delay ends. The delay starts at 1 minute and doubles with each failure, up to 24h. If the file changes, for example after a chmod or chown, the next scan tries it right away.The cache keeps at most 10,000 failures, which is about 8 MB. When it is full, it keeps the failures it has and doesn't store new ones. An LRU would evict each file before a scan over more failing files comes back to it. So only the files beyond the limit get read on every scan, like before. Entries expire after 48h, so paths that no longer exist don't pile up.
Only failures after the checksum step go into the cache. The steps before it are cheap: locking, parent lookups and reading attributes. Failures there still retry on the next scan or listing, like before. So a file that failed because of its parent directory gets another try as soon as someone fixes the directory. A short ID cache outage mostly fails at the parent lookup, so it doesn't leave files waiting on a backoff either.
The skip returns the original error, so the logs still show the real cause:
One gap is left. An ACL or
chattrchange leaves the mtime, size, mode and owner alone. So that fix only takes effect at the next retry or after a restart. I thought about comparing ctime instead. But ctime also changes when some of the xattr writes succeed, so a file where only some of them fail would loop again.The backoff also applies when the cause isn't the file itself, for example a full disk. After such an outage ends, a file waits about as long as the outage lasted, up to 24h, or until the next restart.
For tests, a new spec in
tree_non_watching_test.golists a folder with a read-only file in it twice. It uses the access time of the file to check that only the first listing reads it. It fails on main and passes with this change. It skips when it runs as root, because root can set xattrs on read-only files. It also skips on file systems that don't update access times.The unit-test pipeline runs as root in the golang image. So
assimilation.Failureshas its own specs too, and those run as root. They cover the retry delay, the backoff and the chmod and chown checks.go test -race ./pkg/storage/fs/posix/...passes locally, and golangci-lint reports no issues on the package.Related:
updateFileused to propagate the size of a file to its parents before it wrote the attributes of the file. So every failed try inflated the tree sizes. #797 fixed that and is merged now.