-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
storage: NewReader()
returns outdated objects
#9763
Comments
ReaderObjectAttrs.Generation
rerurns an incorrect generation numberReaderObjectAttrs.Generation
returns an incorrect generation number
ReaderObjectAttrs.Generation
returns an incorrect generation numberReaderObjectAttrs.Generation
has an incorrect generation number
I have identified the cause of the issue. My test bucket was public, so its Is there a way to completely disable caching for the Go client library? Alternatively, could we at least add a note to |
ReaderObjectAttrs.Generation
has an incorrect generation numberNewReader()
returns outdated objects
Thanks for the issue @wjkoh . The Go library does use HTTP requests (using the XML API by default for downloads) so it is equivalent to a GET request via the browser. We also offer support for the JSON API (also HTTP based) as well as gRPC (this is new and still under an allowlist). We can add a note about this to the docs to clarify potentially, but I don't think it is possible to disable cache-control for HTTP requests on public objects (unless you disable cache-control on that object entirely). Can you confirm if doing the download with https://pkg.go.dev/cloud.google.com/go/storage#WithJSONReads set yields the same result? |
Thank you for your response, @tritone . I now understand the behavior, but could you please explain why |
@wjkoh there are a couple possible reasons:
Overall if you're concerned about consistency between those two methods I think it would be a good idea to switch to using JSON downloads. We are planning on switching that to be the library default in some future release. |
Thank you for your input, @tritone and @hkawa608 ! I have decided to abandon the idea of using Cloud Storage for real-time data sharing among our nodes after coming across this issue. Unfortunately, I did not follow up on it. At this point, I do not have a vested interest in this matter. What would be the most suitable solution until the "switch" occurs? I believe simply including a warning in the documentation would suffice. |
Update docs to recommend using the JSON API for downloads over XML, and note that we will switch the default to JSON at some point. Fixes googleapis#9763
Update docs to recommend using the JSON API for downloads over XML, and note that we will switch the default to JSON at some point. Fixes #9763
Client
Storage
Environment
Local
Go Environment
$ go version
$ go env
Code
e.g.
Expected behavior
I anticipated that the generation numbers from
NewReader().Attrs.Generation
andobject.Attrs().Generation
would match.Actual behavior
However, after overwriting the test object, the generation number obtained from
ReaderObjectAttrs
is outdated, while the number fromobject.Attrs()
is current. For instance, in the following output, the generation number from the second Reader is1712996651719769
, despite it being expected to be1712996653117313
.Additional context
cloud.google.com/go/storage v1.40.0
The text was updated successfully, but these errors were encountered: