Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

Moving files between Cloud Storage and Versioning

Folks,

I thought this is interesting. I have the below buckets and one file on the first bucket. None on the second one.

$ gsutil ls  
gs://storage-lsb-cli-wb09/  
gs://storage-lsb-cli-wb10/  
--  
$ gsutil ls -a gs://storage-lsb-cli-wb09/  
gs://storage-lsb-cli-wb09/README-cloudshell.txt#1563747621694693  
$ gsutil ls -a gs://storage-lsb-cli-wb10/  
$

As you can see, I have versioning enabled for the bucket storage-lsb-cli-wb09 and not enabled for the second bucket.

$ gsutil versioning get gs://storage-lsb-cli-wb09/  
gs://storage-lsb-cli-wb09: Enabled  
$ gsutil versioning get gs://storage-lsb-cli-wb10/  
gs://storage-lsb-cli-wb10: Suspended

And then, following the lab lecture, I copied the file from bucket one to two and then…


$ gsutil ls -a gs://storage-lsb-cli-wb09/

gs://storage-lsb-cli-wb09/README-cloudshell.txt#1563747621694693

$ gsutil ls -a gs://storage-lsb-cli-wb10/

gs://storage-lsb-cli-wb10/README-cloudshell.txt#1563747869402765

Why do we get a newly generated number for the file on the bucket where I don’t have versioning enabled? The number are different…any thoughts, comments, an explanation for that?

2 Answers

This is not my strong suit but maybe you could check this logic inthe doco to confirm or refute it.

If the storage ‘can’ use versioning them it must identify the object by something other than just the name, and this would probably be some sort of serialized value so that it increased with time or a hash of date/time.

So logically even if you are not using versionsing, it would attach the serialized ID to all new objects (a consistent treatment is always the easiest to manage)

Between the buckets, the name may be the same, and the object may have the same content, but it is a different object.  So although the name is the same in two buckets, each would have been created at different times and logically would have different serialized ID. 

This is based on a lot of assumptions, but you should be able to validate this in the Google documentation.

Rusty

I totally agree with Rusty’s assessment, here.  The extra stuff at the end of the filename is effectively that file’s identification.  And since the two objects are in different buckets, that makes them fundamentally different–they have different identities even though they have the same contents.

Also, even though you happen to control both of those two buckets, right now, the buckets are completely separate and you could potentially transfer ownership of one of them to someone else.  So when you use gsutil to copy a file, Google won’t share its identity between your own two buckets any more than between one of your buckets and one of mine.

I hope this helps!

Mattias

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?