Fix sync uploads for new and missing chunked files - #28
Open
raphaeldelio wants to merge 1 commit into
Open
Conversation
This was referenced Sep 10, 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.
Problem
A large file created after mounting an AFS sync volume could remain only on the local filesystem. Its upload failed with
chunk meta <path>: redis: nil, so a new session could not restore it from Redis.Files larger than 1 MiB use chunked uploads by default. Before uploading, AFS reads the remote chunk metadata. For a new file, Redis returns
redis.Nilbecause that metadata does not exist yet. The uploader treated this as an error and stopped.Solution
Treat the missing metadata as a file that needs to be created, then upload every local chunk.
Use the same approach when a previously synced remote file disappears. Sending only locally modified chunks would leave the unchanged parts missing from the recreated file. Existing remote files continue to receive only the changed chunks.
Validation
Regression tests verify complete uploads for a new large file and for a missing remote file with only one locally changed chunk. Both failures were reproduced before the fixes.
The full CLI test suite,
make commands, andgo vet ./cmd/afspassed.This PR is independent of #29, which recovers missed watcher notifications. They can merge in either order.