receive: ignore lost+found directory when scanning tenant dirs#8801
Open
ogulcanaydogan wants to merge 2 commits intothanos-io:mainfrom
Open
receive: ignore lost+found directory when scanning tenant dirs#8801ogulcanaydogan wants to merge 2 commits intothanos-io:mainfrom
ogulcanaydogan wants to merge 2 commits intothanos-io:mainfrom
Conversation
The ext4 filesystem places a lost+found directory at the root of every partition. If a Thanos receiver's data directory is the mount point, Open() and RemoveLockFilesIfAny() would attempt to open or clean a TSDB for a tenant named "lost+found", producing spurious errors. Skip any directory entry named "lost+found" in both code paths. Fixes thanos-io#8798 Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
GiedriusS
reviewed
May 4, 2026
| if !f.IsDir() { | ||
| continue | ||
| } | ||
| if f.Name() == "lost+found" { |
Member
There was a problem hiding this comment.
Could you convert this into a constant and write a comment describing why it is ignored and why this was chosen instead of the other options? Basically, copy/paste what you wrote in the description.
Per reviewer feedback, replace the "lost+found" string literal with a named constant and document why the directory is skipped and why a name-based check was chosen over inode or filesystem-type inspection. Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
Author
|
Extracted the string into a |
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.
What
Skip any directory named
lost+foundwhenMultiTSDB.Open()andMultiTSDB.RemoveLockFilesIfAny()scan the data directory for tenants.Why
The ext4 filesystem creates a
lost+founddirectory at the root ofevery partition. When a receiver's
--tsdb.pathis the filesystemmount point, both scan loops treat
lost+foundas a tenant name andattempt to open or clean a TSDB for it, producing spurious errors on
startup.
A name-based skip is the simplest cross-platform fix. Checking the
inode or filesystem type would require platform-specific syscalls and
adds complexity without meaningful safety benefit, since a tenant
legitimately named
lost+foundis not a realistic concern.Test
TestMultiTSDB/open_ignores_lost+found_directorycreates alost+founddirectory in the data dir, calls
Open(), and asserts no tenant wasregistered for that name.
Fixes #8798