Why I can created an exsiting bucket
There is a bucket named abcdef in the ceph. It contains 5 objects.
Then I create a new bucket with the same name abcdef, and get a sucessful response! And it contains the same 5 objects.
How can this happened?
#2 Updated by Javier M. Mellid about 8 years ago
- Status changed from New to Resolved
- Assignee set to Javier M. Mellid
'create bucket' is designed to be idempotent. Clients can make the same call repeatedly while producing the same result. In other words, making multiple identical requests has the same effect on the server (no side effects) as making a single request although the response itself may not be the same (i.e. timestamps and so on)
Documentation is up to date and it is clear. You can have a look at:
"... If a bucket with the same name already exists and the user is the bucket owner, the operation will succeed ..."
While this behaviour could look weird, it is useful and "cheap". You can think about race conditions while creating your buckets, handling concurrency and so on. The current behaviour makes sense and it works as expected. If you want to create one bucket and that bucket exists and you are the owner, the server just returns Okay. It doesn't need to re-create it.
BTW, if you need to know if the bucket exists you can run a previous lookup (get bucket)