-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix DeleteAll() on non-existing directory #3974
Conversation
There was an identical attempt here: #3869 (comment). Under what circumstances and what directory might not exist when calling this? (: |
In Cortex the directory passed to Compactor is not pre-created so the first time you run it you would get the error. In other news, |
Playing devil's advocate: what stops from checking whether this directory exists before calling this function there? Tbf I don't mind this change at all, but let's see what @bwplotka thinks. |
We can check if the directory exists in the Thanos compactor before calling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
This is similar to object storage deletion and the idea to make it idempotent or not. I don't feel idempotency is good in those cases, as you want to know usually why you unnecessary spent cycles, especially if some code will change in the future.
However given we are a library for Cortex, we have to behave better on this.
I would be not opposed to merging this UNLESS #3869 (comment) is not solving your problem, we can port those changes to master anytime (happy to do this today evening).
We merged the leak causing the log line: Wonder if this helps #3978 If not, let's merge this for easy of use |
Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
24da258
to
8c2793a
Compare
I just tried. The issue we have is still there.
I see That being said, we need to move on in Cortex, so I would appreciate if we take a final decision here. I'm OK if this PR gets rejected (I will do a workaround in Cortex), but a decision is better than no decision 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You convinced me with std lib example (:
LGTM!
Changes
We're upgrading Thanos in Cortex and we noticed the compactor logs "failed deleting non-compaction group directories/files, some disk space usage might have leaked". The reason is that, under some conditions, the directory doesn't exist at all. I suggest to consider that case as a non-error.
Verification
N/A