Repository navigation
Spec: Add named storage configurations to the management API - #5721
sririshindra wants to merge 5 commits into
Conversation
41070bc to
9ff2c1f
Compare
| storageConfigInfos: | ||
| type: array | ||
| nullable: true | ||
| description: Optional list of additional named storage configurations held by the catalog, alongside its default storageConfigInfo. Each entry is identified by its storageName, which is required. Names are trimmed, must match ^[a-zA-Z0-9_-]{1,128}$, are case-sensitive, must be unique within the list, and must differ from the storageName of the default storageConfigInfo. Unlike the default storageConfigInfo, each entry must list at least one allowedLocations entry. |
There was a problem hiding this comment.
A note on why named entries must list at least one allowed location, while the default configuration doesn't have to:
- When the default
storageConfigInfohas noallowedLocations, Polaris uses the catalog'sdefault-base-locationinstead (CatalogEntity.Builder#processStorageConfigurationInfo). A named entry has no equivalent to fall back on. It usually points at different storage than the catalog default (another bucket, another account, sometimes another storage type), so borrowing the catalog's base location would either allow the wrong place or fail the storage-type prefix check. - An empty list doesn't mean "anywhere".
StorageLocationValidator.validateAllowedLocationsaccepts a location only if it is under one of the allowed locations. With an empty list, every table create, commit and credential request that uses the entry would fail with 403. It's better to reject the entry with a 400 when it is defined than to have it fail later on every table that uses it. - The cross-catalog overlap check also works from
allowedLocations, so an entry without any would never be checked against other catalogs.
Happy to change this if people would prefer a different rule.
|
Is this ready for review? 😅 |
Yes, sorry for the delay. |
vigneshio
left a comment
There was a problem hiding this comment.
Thanks @sririshindra. Left a couple of comments on the spec..
| description: The version of the catalog object used to determine if the catalog metadata has changed | ||
| storageConfigInfo: | ||
| $ref: "#/components/schemas/StorageConfigInfo" | ||
| storageConfigInfos: |
There was a problem hiding this comment.
storageName already picks the deployment time credential set (polaris.storage.aws.<name> / RESOLVE_CREDENTIALS_BY_STORAGE_NAME). here its also the identity for each named entry, and it can't reuse the default config's name..
Can we settle the identity part before this spec lands? if one field keeps doing both jobs, multiple configs can't share one credential set. And changing it later would be a breaking management API change.
There was a problem hiding this comment.
Yes, we need to distinguish the config name from the "base" storage credential name.
There was a problem hiding this comment.
I changed storageConfigInfos to a map from configuration name to StorageConfigInfo. The key is the name, so that's the identity now. storageName inside an entry still just picks the credential set, and it's optional, so entries can share one or leave it unset. The default config still has no name.
Keys are meant to match ^[a-zA-Z0-9_-]{1,128}$. OpenAPI 3.0 can't put a pattern on map keys, so that's in the description and the server will enforce it.
| 404: | ||
| description: "The principal role does not exist" | ||
|
|
||
| /catalogs/{catalogName}/storage-configs: |
There was a problem hiding this comment.
Do we really need these item routes in the same spec as Catalog.storageConfigInfos? create/get/update catalog already carry the list. Same thing Dimitri asked on #5556
There was a problem hiding this comment.
IIRC our dev discussions, this was "phase 2", where we move storage configs to top-level entities under a catalog.
There was a problem hiding this comment.
Agreed, removed. Create, get and update catalog already cover all of it, and updateCatalog checks currentEntityVersion. The endpoints can come back in Phase 2 when configs become entities.
| fetchedCatalog.getEntityVersion(), Map.of("foo", "bar"), null /* storageConfigIno */); | ||
| fetchedCatalog.getEntityVersion(), | ||
| Map.of("foo", "bar"), | ||
| null /* storageConfigIno */, |
| 404: | ||
| description: "The principal role does not exist" | ||
|
|
||
| /catalogs/{catalogName}/storage-configs: |
There was a problem hiding this comment.
IIRC our dev discussions, this was "phase 2", where we move storage configs to top-level entities under a catalog.
| description: "The principal role does not exist" | ||
|
|
||
| /catalogs/{catalogName}/storage-configs: | ||
| parameters: |
There was a problem hiding this comment.
Please add pagination upfront. We do not know how many configs users may have, so we should make sure clients do not assume all of them can be obtained in one response.
There was a problem hiding this comment.
The list endpoint is gone from this PR. When it comes back with Phase 2 it will be paginated from the start, like the catalog API lists (pageToken / next-page-token).
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: "#/components/schemas/StorageConfigInfo" |
There was a problem hiding this comment.
We probably need entity version for concurrency control.
There was a problem hiding this comment.
Agreed. The PUT took no version, so last write would have won. With the routes gone, changes go through updateCatalog, which already checks currentEntityVersion. In Phase 2 each config will have its own version.
| description: The version of the catalog object used to determine if the catalog metadata has changed | ||
| storageConfigInfo: | ||
| $ref: "#/components/schemas/StorageConfigInfo" | ||
| storageConfigInfos: |
There was a problem hiding this comment.
Yes, we need to distinguish the config name from the "base" storage credential name.
| description: The version of the catalog object used to determine if the catalog metadata has changed | ||
| storageConfigInfo: | ||
| $ref: "#/components/schemas/StorageConfigInfo" | ||
| storageConfigInfos: |
There was a problem hiding this comment.
I think this field contradicts the new endpoints (above).
If the storage config is part of the catalog object, we do not need the new endpoints.
If we use the new endpoints, the configs should be independent entities (referenced by name).
There was a problem hiding this comment.
My reading of the proposal is that in Phase 1 we add storage configs as sub-elements in the Catalog. So this change makes sense.
I'd have expected the dedicated config endpoints to be added later... WDYT?
There was a problem hiding this comment.
Makes sense. I dropped the endpoints, so this PR now only adds the field on the catalog.
e18e367 to
2603fb6
Compare
|
The test-site-guides failure is unrelated and would be addressed by #5812 . A rebase should fix it. |
dimas-b
left a comment
There was a problem hiding this comment.
LGTM overall 👍 Just one remaining concern about type arrays in the API spec.
| $ref: "#/components/schemas/StorageConfigInfo" | ||
| storageConfigInfos: | ||
| type: object | ||
| nullable: true |
| description: The version of the catalog object used to determine if the catalog metadata has changed | ||
| storageConfigInfo: | ||
| $ref: "#/components/schemas/StorageConfigInfo" | ||
| storageConfigInfos: |
There was a problem hiding this comment.
nit: I'd call this storageConfigurations. It would be easier to distinguish from the singular storageConfigInfo property.
Adds an optional `storageConfigInfos` array to `Catalog` and
`UpdateCatalogRequest`, the `StorageConfigInfos` list schema, and the
`/catalogs/{catalogName}/storage-configs[/{storageConfigName}]` endpoints
for managing one named storage configuration at a time.
This is the API part of apache#5556. The server does not implement it yet: the
new endpoints answer with the generated 501 default, and the server
ignores `storageConfigInfos`.
`storageConfigInfos` is `nullable: true` and `openApiNullable` is disabled
for the model module, so an omitted array stays `null` instead of becoming
an empty list, and the field keeps a plain `List<StorageConfigInfo>` type.
Existing callers of the all-args constructors pass `null` for the new
argument.
…oints
Make Catalog.storageConfigInfos and UpdateCatalogRequest.storageConfigInfos a
map from configuration name to StorageConfigInfo. The key is the
configuration's identity. The storageName of each entry keeps its existing
meaning (it selects a server-side storage configuration), so entries can share
one, or leave it unset, and the default configuration needs no name.
Remove the /catalogs/{catalogName}/storage-configs endpoints and the
StorageConfigInfos schema. In this phase named storage configurations are part
of the catalog and are managed through create, get and update catalog, where
updateCatalog already checks currentEntityVersion. Dedicated endpoints belong
with storage configurations as entities of their own.
Also fix a typo in a comment in PolarisManagementServiceIntegrationTest.
… arrays for nullability
2603fb6 to
2b68344
Compare
orca-review-bot
left a comment
There was a problem hiding this comment.
Note
AI-generated review. Written by an agent. It can be wrong, so please push back where it is.
The spec-first split makes sense to me, and keeping the map key separate from storageName is a nice call. Main ask: the PR description still describes the earlier design (an array identified by trimmed storageName, a uniqueness rule against the default's storageName, and four /storage-configs endpoints returning 501). The diff is now a name-keyed map with no endpoints. Can we update the description before this goes back to dev@, so people review the shape that's actually here?
Also, can we add a short entry in CHANGELOG.md under ## [Unreleased]? It should mention the new (ignored for now) field and that the all-args constructors of Catalog/UpdateCatalogRequest gained a trailing parameter, which breaks downstream Java callers.
I checked: openApiNullable=false matches the catalog-service and semantic-models setup, and the test edits are purely mechanical.
| $ref: "#/components/schemas/StorageConfigInfo" | ||
| storageConfigurations: | ||
| type: [ object, "null" ] | ||
| description: Optional additional named storage configurations held by the catalog, alongside its default storageConfigInfo, keyed by configuration name. Each key must match ^[a-zA-Z0-9_-]{1,128}$ and is case-sensitive. The default storageConfigInfo is not part of this map and has no configuration name. The storageName of an entry keeps its meaning of selecting a server-side storage configuration and is independent of the key, so entries may share a storageName or leave it unset. Unlike the default storageConfigInfo, each entry must list at least one allowedLocations entry. |
There was a problem hiding this comment.
The key rule only lives in the description, so generated clients and schema validators won't see it. Since the spec is OpenAPI 3.1, can we add propertyNames: { pattern: '^[a-zA-Z0-9_-]{1,128}$' } here (and on the UpdateCatalogRequest field)?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
There was a problem hiding this comment.
I'm OK with the key pattern written in the description.
| $ref: "#/components/schemas/StorageConfigInfo" | ||
| storageConfigurations: | ||
| type: [ object, "null" ] | ||
| description: Optional replacement set of named storage configurations, keyed by configuration name. When present, replaces the catalog's entire set of named storage configurations (an empty object removes them all); when absent, the existing set is left unaltered. Keys and entries follow the same rules as Catalog.storageConfigurations. |
There was a problem hiding this comment.
This defines 'absent' vs {}, but not an explicit "storageConfigurations": null. With openApiNullable=false, an explicit null deserializes the same as an omitted field, so it would mean 'leave the set unchanged'. Is that the intent? If so, can we say it here so clients don't send null expecting a clear?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
There was a problem hiding this comment.
We cannot rely on the build config(penApiNullable=false) to ensure the correctness. Downstreams or clients may have different build configs, which causes the behavior changes. It is fragile to use the absent/null/emptyMap to control whether deleting or preserving the map. We may need to either introduce a special update type for the storageConfig map, or let clients to always send the whole map(this may have compatible issue, given the old clients don't know this field at all).
| $ref: "#/components/schemas/StorageConfigInfo" | ||
| storageConfigurations: | ||
| type: [ object, "null" ] | ||
| description: Optional additional named storage configurations held by the catalog, alongside its default storageConfigInfo, keyed by configuration name. Each key must match ^[a-zA-Z0-9_-]{1,128}$ and is case-sensitive. The default storageConfigInfo is not part of this map and has no configuration name. The storageName of an entry keeps its meaning of selecting a server-side storage configuration and is independent of the key, so entries may share a storageName or leave it unset. Unlike the default storageConfigInfo, each entry must list at least one allowedLocations entry. |
There was a problem hiding this comment.
| description: Optional additional named storage configurations held by the catalog, alongside its default storageConfigInfo, keyed by configuration name. Each key must match ^[a-zA-Z0-9_-]{1,128}$ and is case-sensitive. The default storageConfigInfo is not part of this map and has no configuration name. The storageName of an entry keeps its meaning of selecting a server-side storage configuration and is independent of the key, so entries may share a storageName or leave it unset. Unlike the default storageConfigInfo, each entry must list at least one allowedLocations entry. | |
| description: Optional additional storage configurations held by the catalog, alongside its default storageConfigInfo. A map from configuration name to StorageConfigInfo. Configuration names are case sensitive and must match ^[a-zA-Z0-9_-]{1,128}$. The default storageConfigInfo is not included in this map and has no configuration name. Unlike the default storageConfigInfo, each entry must list at least one allowedLocations entry. |
I'd prefer to not mention storageName here. Maybe just me, it seems more confusing with explanation. We can definitely add more description for storageName though. Giving an example also helps, but I'm OK without an example.
There was a problem hiding this comment.
Leaving storageName out of this description make sense 👍
I'd still keep names in the first sentence because it indicates how the configurations are distinguished from each other.
A map from configuration name to StorageConfigInfo - I'm not sure what this means 🤔
There was a problem hiding this comment.
That's what storageConfigurations is. It is a map with key(configuraiton name) and value(a StorageConfigInfo). Open to any wording suggestion.
There was a problem hiding this comment.
I dropped the storageName mention from the Catalog.storageConfigurations description and kept "names" in the first sentence. I spelled out the map as "keys are configuration names, values are StorageConfigInfo objects", which should answer @dimas-b's question. The independence of storageName from the configuration name is now documented on StorageConfigInfo.storageName. Happy to adjust the wording if it's still unclear.
Replace UpdateCatalogRequest.storageConfigurations with setStorageConfigurations (add or replace entries) and removeStorageConfigurations (remove by name). Omitted and empty values are no-ops, so the outcome no longer depends on how a client or server treats absent, null or empty maps. Reword the Catalog.storageConfigurations description and document that storageName is independent of the configuration name.
| storageName: | ||
| type: string | ||
| description: An optional name referencing a server-side storage configuration | ||
| description: An optional name referencing a server-side storage configuration. This is independent of the configuration name under which a StorageConfigInfo is held in Catalog.storageConfigurations, so several entries may share a storageName or leave it unset. |
There was a problem hiding this comment.
Thanks for accepting to separate this field from the storage configuration name. I also appreciate that you added a sentence to disambiguate the two concepts.
I would go even further and rephrase the description more deeply, as follows:
An optional name referencing a storage credential configuration section in the Polaris server configuration. If present, Polaris will use the credentials declared under
polaris.storage.aws.<name>.*instead of the default ones, declared underpolaris.storage.aws.*, when contacting STS. This is currently only supported for AWS.
Note: this name is unrelated to the configuration name under which aStorageConfigInfois stored inCatalog.storageConfigurations.
There was a problem hiding this comment.
+1 to mentioning that storageName can be used for base credential lookup in the default Polaris Server.
However, I'd prefer to avoid referencing specific configuration properties in this API spec. Different server builds may choose to use different mechanisms for finding base credentials.
Also, storageName is not limited to base credential lookup. It is exposed to pluggable PolarisStorageIntegration components. Let's keep the usage options open for customization.
Essentially, storageName is a plugin point for connecting StorageConfigInfo to build-specific configuration.
My proposal:
This name is meant for associating StorageConfigInfo objects to deployment-specific
configuration. The interpretation of this name depends on specific runtime components
that are included in a server to support interacting with storage systems. Standard Apache
Polaris servers use this name for finding base S3 and STS credentials.
Note: this name is optional and unrelated to the configuration name under which a
StorageConfigInfo is stored in Catalog.storageConfigurations.
WDYT?
There was a problem hiding this comment.
API changes LGTM overall (minor doc comments are not a blocker)👍
@sririshindra : Please fix CI 😅
Describe storageName as a plugin point for deployment-specific storage configuration without naming server properties, and pass the new incremental storage configuration arguments in the Java callers of UpdateCatalogRequest.
|
Closing this in favor of #5943. As discussed on dev@ (https://lists.apache.org/thread/ytdc13npxq4m0dz54vm1g7n3ygpywf5q), we're skipping the approach of keeping several storage configurations inside the catalog and making them dedicated, catalog-scoped entities instead. Thanks to everyone who reviewed this. |
Why
#5556 adds named storage configurations to catalogs, but it is large. This PR takes only its API
change so the shape of the management API can be agreed on first. The implementation will follow
in smaller PRs built on this one. #5556 stays open for anyone who wants to see the whole change.
Background: today a catalog has exactly one storage configuration. The design discussed on dev@
(thread) lets a catalog also
hold named storage configurations next to its default one, so that later on namespaces and
tables can use a different bucket, role or cloud than the catalog default.
Related: #5556, #4023, #3409.
What changes
spec/polaris-management-service.ymlCatalogandUpdateCatalogRequestget an optionalstorageConfigurationsarray. The existingstorageConfigInfostays the catalog's default configuration.storageName. Names are trimmed and must match^[a-zA-Z0-9_-]{1,128}$. They are case-sensitive, must be unique within the list, and mustdiffer from the default configuration's
storageName. Unlike the default, every named entrymust list at least one allowed location, because there is no base location to fall back to.
storageConfigurationsout keeps the current set. Sending an array replacesthe whole set, and an empty array removes them all.
resending all the others:
GET /catalogs/{catalogName}/storage-configslists the named configurations (not thedefault).
GET /catalogs/{catalogName}/storage-configs/{storageConfigName}PUT /catalogs/{catalogName}/storage-configs/{storageConfigName}creates or replaces oneentry. If the body sets
storageName, it must match the path; if the body leaves it out,the path name is used.
DELETE /catalogs/{catalogName}/storage-configs/{storageConfigName}api/management-model/build.gradle.ktsSets
openApiNullable=false. The update rule above needs "field left out" to be different from"empty array". Marking the field
nullable: truemakes the generated defaultnullinstead ofan empty list. With
openApiNullabledisabled, the Java type stays a plainList<StorageConfigInfo>instead ofJsonNullable<...>. The catalog API and the semantic-modelsextension already use the same setting. In this spec, only the two new fields are
nullable, sono other generated model changes.
Existing callers
The new field adds a trailing argument to the all-args constructors of
CatalogandUpdateCatalogRequest. Every existing call passesnull, which accounts for all of the one-linetest changes.
Behavior after this PR
PolarisCatalogsApiService.storageConfigurationsin a request but ignores it, and doesn't include it inresponses. Because the models use
JsonInclude.NON_NULL, catalog responses look exactly asbefore.
Next steps
storageConfigurationson catalog create, update and get. This will be behinda new feature flag,
ENABLE_NAMED_STORAGE_CONFIGURATIONS, which defaults to off./storage-configsendpoints.Using a named configuration for a namespace or table, and vending credentials from it, comes after
that and is not part of this spec.
Testing
No new tests, because this PR has no server behavior. Existing tests that build
CatalogorUpdateCatalogRequestnow pass the extra argument. CI covers the full build.Checklist
CHANGELOG.md(if needed): not yet; the entry comes with the implementationsite/content/in-dev/unreleased(if needed): not yet; nothing is usable until the implementation lands