-
Notifications
You must be signed in to change notification settings - Fork 93
Blob.reload() does not work as intuitively expected #149
Copy link
Copy link
Closed
Labels
api: storageIssues related to the googleapis/java-storage API.Issues related to the googleapis/java-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the googleapis/java-storage API.Issues related to the googleapis/java-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Documentation for Blob.writer(BlobWriterOption...) recommends the following way to upload information:
But doc is silent on how to renew the blob object, which is a bit tricky because neither
blob.reload()norstorage.getBlob(blob.getBlobId())does not help. Behavior varies depending on versioning setting for the bucket.If versioning is enabled:
Attempt to reload as recommended:
blob.reload(Blob.BlobSourceOption.generationNotMatch())causesStorageException '304 Not Modified'blob.reload()returns the same blob.storage.get(blob.getBlobId())returns the same blob (that seems very confusing).And only
storage.get(blobId)returns the updated blob.If versioning is Suspended:
before upload:
blob.getContent()returns an empty arrayAfter upload:
blob.getContent()throwsStorageException: 404 Not Found , No such objectstorage.get(blob.getBlobId()),blob.reload()andblob.reload(Blob.BlobSourceOption.generationNotMatch())return null.And again only storage.get(blobId) returns the updated blob.