Repository navigation
cmd: fix fast-path modtime parsing in cleanupStaleUploadsOnDisk - #236
Merged
Merged
Conversation
Upload ID directories on disk are named as '<UUID>x<UnixNano>'. Attempting to decode them as Base64 fails unconditionally, causing the cleanup routine to bypass the timestamp check and fall back to disk.ReadVersion on every active upload. Directly parse the timestamp suffix from the plaintext directory name to restore O(1) stale upload detection, while preserving Base64 decoding and ReadVersion fallback for legacy uploads. Signed-off-by: clown15 <[email protected]>
…r-completion Signed-off-by: Feng Ruohang <[email protected]>
Signed-off-by: Feng Ruohang <[email protected]>
This was referenced Oct 24, 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
Multipart upload directories on disk use plaintext
<UUID>x<UnixNano>. Cleanup previously tried to decode them as Base64 before extracting the timestamp, so it fell back to reading localxl.metaunnecessarily. Plaintext directory names are themselves valid Base64 in common cases, and decoded bytes can even containx; successful decoding is not a format discriminator.Change
Parse the native directory name first with the existing
multipartUploadTime()validator. Only then try the previous Base64 compatibility parser. Legacy or unrecognized names retain the metadata fallback, and failed metadata reads leave those uploads alone.The fix reduces local metadata reads and deserialization during stale-upload cleanup. Cleanup settings remain configurable, with a 24-hour default expiry and a 6-hour default scan interval. Storage layouts and S3 upload IDs are unchanged.
Validation
ReadVersioncounts, preservation of recent uploads, removal of expired uploads, legacy fallback and conservative handling of missing metadata.make verifiersandmake buildpass locally on Go 1.27.2.