-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Make Bucket.delete() in storage more restricted / opinionated #564
Comments
So we're saying that we will not provide a way to delete a bucket... at all? That seems off to me. Couldn't we provide the method along with more specific errors ? Ie, say that this might raise a |
No, we'll still have This way, if people use |
So here's the argument I use for stuff like that.... If we don't have a If we're lucky, people will make this a utility method...def delete_bucket(bucket):
for key in bucket:
key.delete()
bucket.delete()
# ... lots of other code
util.delete_bucket(bucket) If we're unlucky, people will do things like...[key.delete() for key in bucket]
bucket.delete() Now let's say GCS does create an atomic way of deleting a bucket (or a more efficient way of deleting a bucket, or any other major improvement). I'm still using my utility method (if we're lucky it's a utility method...), I don't benefit from this improvement when I run If we have the method exposed, then we at least maintain control over it and can improve as the API improves. If we make the decision to toss it away now, people will still do it, and still not understand the consequences... but we lose the ability to control it, document the nuances and problems with it, and improve it as the API evolves. I'm very much in favor of keeping the method, putting a big red warning label on the API docs, and having descriptive errors when things (that we explain at the start) go wrong. /cc @GoogleCloudPlatform/cloud-storage |
RE: "scour my code for those snippets and replace all of them". Apps using GCS as a blob store (most) will not delete buckets in production code. I'd guess some meta-applications would create and destroy buckets as part of their running application, but I'd also guess they'd want their own custom cleanup code. (Again the main issue is that the I'd like to hear what the storage folks have to say. |
You'd be surprised the scary things people will do in their production apps.... Regardless, if they're going to do it, I'd rather us be the ones controlling it... |
Deleting a bucket and all the objects in it would blow up most production apps that use it as a blob store. I agree I'd be surprised by zany things, but removing all blobs associated with an application is a whole different level of scary. I agree with you that we should seek to be the ones doing implementation for them, but am coming from the side of maintainability. It takes a lot of code to actually get a bucket delete right (as @thobrla mentioned). The complexity bump is huge, but the actual feature added is miniscule (due to the fact that a full bucket delete is so rare for a production application). |
If you choose to implement recursive delete:
I don't have a strong opinion as to whether you should implement this or not; if you do, make sure you document the behavior clearly, as well as the errors you'll raise in the case of the above failures. |
Update description and issue title after chat with @jgeewax |
Working on this |
* chore: remove obsolete workarounds in owlbot.py * remove workarounds in owlbot.py * restore workaround in owlbot.py * remove test code
UPDATED 1/26/14 by @dhermes
After discussion with @jgeewax the approach will be
See @thobrla comment:
The text was updated successfully, but these errors were encountered: