Is Bucket uuid in BucketSetting->raw->uuid valid for for all couchbase versions?


#1

In java-sdk 2.3.5 I see a raw option in BucketSettings which has Bucket uuid.
So this uuid will uniquely identify a bucket in all couch releases ?
Does uuid remain same during lifetime of bucket, across couchbase updates etc ?
Also is this field guaranteed to be present in all further java-sdk versions ?


#2

As far as I know, the Bucket UUID stays the same as long as the bucket is online, but I don’t know if it will change during upgrade or backup/restore.

Can you tell us a little more whats the reasoning behind working with the UUID in your setup is? Maybe there is a better/different way to handle it.


#3

If a script identifies a bucket with its name, it will give wrong results if bucket is recreated with same name.
Eg it will insert doc into recreated bucket, instead of complaining that original bucket did not exist.

So we wanted to use some unique identifier for this.

I dont know what bucket being online means, but what we want is an id which remains same in bucket create-delete timeline.
If restore creates a new bucket it will definitely have a new uuid, but the backedup bucket’s uuid remain same till it is explicitly deleted?


#4

@zxcvmnb the UUID might be suitable for that, but a better approach would be to store a document in the bucket where YOU store an identifier and use that one - it would also more accurately reflect if the data is gone (flush, bucket recreate) rather than relying on some internal state?


#5

I would still prefer UUID, since it should not change once bucket is created, any properties I set on bucket or any docs I add can be changed.
So “BucketSetting->raw->uuid” might change in lifetime of bucket, that is why storing identifier is better ?

A bucket is still same on flushing it, right ?
Flushing does not reset bucket password, and other properties customer might have set through CLI.