/vsigs/: add GS_GENERATION option to read a specific object version#14947
Draft
alexberndt wants to merge 1 commit into
Draft
/vsigs/: add GS_GENERATION option to read a specific object version#14947alexberndt wants to merge 1 commit into
alexberndt wants to merge 1 commit into
Conversation
GCS assigns a generation number to every object write; with Object Versioning enabled, non-current generations are retained and individually addressable. Until now /vsigs/ always read the live object, and neither a "#generation" fragment nor a "?generation=" query string worked: the object key is URL-encoded as a whole, so an appended query string was folded into the object name rather than sent as a real query parameter. Add an opt-in, path-specific GS_GENERATION config option, forwarded as a real "generation=<n>" query parameter on requests so a specific (possibly non-current) version is read. The OAuth2 bearer-token auth path needs only the forwarding; for HMAC signing the generation is also added to the canonical resource (flagged in-code as not yet verified against a real signed request). A non-numeric value is rejected at handle construction. Includes autotests asserting the query parameter reaches the request and that an invalid value is rejected, plus documentation of the new option. Refs OSGeo#14946
f7faaed to
5307f4e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds an opt-in
GS_GENERATIONconfiguration option to the/vsigs/virtual file system, letting callers read a specific (possibly non-current) object generation from a GCS bucket with Object Versioning enabled, instead of always reading the live object.When set, the generation is forwarded as a real
generation=<n>query parameter on requests, which the GCS XML API honours. It is typically set as a path-specific option, since a generation is per-object:Motivation
Reproducible reads / data lineage: reading the exact bytes a job consumed even after the live object has been overwritten. Useful for ML and data pipelines where an input path is mutable but historical versions are retained via Object Versioning. Closes #14946.
Previously neither a
#generationfragment nor a?generation=query string worked:VSIGSHandleHelperstores the wholebucket/objectstring as the key and URL-encodes it as a whole, so an appended query string was folded into the object name rather than sent as a real query parameter.Notes for review
GS_SECRET_ACCESS_KEY), the generation is also added to the string-to-sign's canonical resource. This branch carries aTODOin code:Testing
autotest/gcore/vsigs.py: one asserts the request carries?generation=<n>, one asserts an invalid value is rejected.gcore/vsigs.pysuite passes locally (31 passed, 3 skipped), no regression to the existing read / signing tests.pre-commit(clang-format, black, isort, flake8) passes on the changed files.