-
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
Change objstore Delete() contract to make it idempotent #3662
Comments
I am almost certain that we did this ONLY to match with "some" obj storage APIs we were inspired by (GCS) . We are definitely ok to make it idempotent long term (:
Maybe, but I kind of like explicitness. If you delete something that does not exists, I want to know that as a caller. This might mean some eventual consistency or race, so then caller can just ignore it. OR I really want to delete something and I want to know about deletion happening. The simple case will be instrumentation. If we delete I want to make that we deleted something. If 20 writes deletes I just have info "they tried to delete and maybe they deleted and maybe it was already deleted". Such instrumentation/metric will NOT tell us how many deletes were in DB (e.g objstore), but rather how many attempts were there. Apart of instrumentation, I don't see other use cases for non-idempotent Delete, but the instrumentation one might be important, not sure. Ideally, allowing caller to decide makes sense? I think I would be happy to make it idempotent, our goal with objstore is indeed to reduce API calls. |
I thought the rest of the comment was leading towards not making it idempotent. If it's idempotent, from the consumer perspective, then the |
Yea, because I am torn. Just curious, the only benefit here is really API calls? Because in a PR for meta json, we could just try to delete and filter out NotFound error, no? To achieve this (: |
Yes, definitely. That's another valid approach, but I think the current implementation doesn't guarantee it. What I mean is: we should check this is true for all object store clients and, if so, document it in the The only downside I see (but not a big deal, if correctly documented) is that it's not possible to implement on S3 (where "delete object" API is idempotent) unless we issue an "head object" before deleting, which I would prefer to avoid (to reduce API calls). |
Hello 👋 Looks like there was no activity on this issue for the last two months. |
Hello 👋 Looks like there was no activity on this issue for the last two months. |
Closing for now as promised, let us know if you need this to be reopened! 🤗 |
Is your proposal related to a problem?
The objstore
Delete()
is expected to return error if the object doesn't exist in the bucket:thanos/pkg/objstore/objstore.go
Lines 44 to 46 in e9260e3
This design decision has some drawbacks:
block.Delete()
), while if it would be idempotent we could skip the check for existence at all.However, I may be missing the reason behind this design decision, so I've opened an issue to discuss it.
Describe the solution you'd like
I would propose to change objstore clients
Delete()
contract to make it idempotent. Object stores where delete is idempotent (eg. S3) would require no changes, while others would require handling the "not found" error status code (typically a 404, like on GCS).The text was updated successfully, but these errors were encountered: