Repository navigation
Support multiple named storage configurations per catalog - #5556
sririshindra wants to merge 3 commits into
Conversation
A catalog can now hold named storage configurations alongside its default one, through a new optional storageConfigInfos array on the catalog create, update, and read payloads. Each entry is keyed by its own trimmed storageName and is persisted in a new storage_configuration_infos internal property on the catalog entity, as a single JSON object of nested configs that keep their polymorphic type discriminator. Each entry is validated independently: name syntax and catalog-uniqueness (including against the default config's name), non-empty allowedLocations under the existing max-locations cap and storage-type prefix rules, and the same constrained-change rules the default configuration is subject to on update, matched by name. On update a supplied array replaces the whole set while an omitted one leaves it unchanged; an empty array removes the internal property rather than writing an empty object, so a catalog with no named configurations stays byte-identical to a pre-change catalog. Named configurations' allowed locations now also participate in the cross-catalog overlap guard, which keeps an existing storage-isolation invariant accurate rather than adding a new restriction: a catalog previously declared its storage footprint in one place and now declares it in two. Nothing resolves a named configuration yet, so credential vending is unchanged and tables and namespaces continue to use the catalog's default configuration.
Adds GET /catalogs/{catalogName}/storage-configs and
GET/PUT/DELETE /catalogs/{catalogName}/storage-configs/{storageConfigName}
so one named storage configuration can be read, created or replaced, and
removed without a full-catalog update. Each call reads the current catalog,
changes only that entry, and goes through the same update-diff, overlap and
optimistic-concurrency checks as updateCatalog. GET requires GET_CATALOG;
PUT and DELETE require UPDATE_CATALOG.
Adds ENABLE_NAMED_STORAGE_CONFIGURATIONS (default false). Adding or
replacing named configurations, through storageConfigInfos on create/update
or through PUT, requires it; reading and removing them does not.
Named entries now also get the default configuration's request checks
(SUPPORTED_CATALOG_STORAGE_TYPES, ALLOW_SETTING_S3_ENDPOINTS), which the
storageConfigInfos array previously skipped.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ge-config endpoints PUT stored the trimmed path name, but GET and DELETE looked it up untrimmed, so a config created through " hot " could not be read or removed through the same path. Both now trim, as PUT and the storageConfigInfos array do. Adds privilege tests showing listStorageConfigs/getStorageConfig require the same privileges as getCatalog, and putStorageConfig/deleteStorageConfig the same as updateCatalog. Co-Authored-By: Claude Opus 5.5 <[email protected]>
c2d2acc to
3462ceb
Compare
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.
| 404: | ||
| description: "The principal role does not exist" | ||
|
|
||
| /catalogs/{catalogName}/storage-configs: |
There was a problem hiding this comment.
Do we need new endpoints for storage configs? It looks like they are accessible via the existing create/list catalog API plus the new storageConfigInfos catalog 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.
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.
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
orca-review-bot
left a comment
There was a problem hiding this comment.
Nice work overall. Reusing the version-checked persist, the per-entry update guards and the overlap check keeps this tight, and the authz tests cover all four endpoints. I checked authz: reads go through GET_CATALOG, and PUT/DELETE authorize UPDATE_CATALOG before loading the entity. Main thing to settle: deleting and re-adding a name gets around the role/account-change guard. Smaller asks:
- Can we add tests for delete-then-re-PUT with a different account, and for echoing back an unchanged array with the flag off?
- Can we mention the new
storageConfigInfosconstructor parameter on the generatedUpdateCatalogRequestand catalog models in the CHANGELOG? - Can we retitle the PR to
feat: ...? - #5721 specs the same management API. Can we make sure the two specs agree?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
| Set<String> allNamedConfigNames = new HashSet<>(currentNamedConfigs.keySet()); | ||
| allNamedConfigNames.addAll(newNamedConfigs.keySet()); | ||
| for (String name : allNamedConfigNames) { | ||
| validateStorageConfigDiffOrThrow(currentNamedConfigs.get(name), newNamedConfigs.get(name)); |
There was a problem hiding this comment.
If a name exists on only one side, validateStorageConfigDiffOrThrow returns early. So DELETE hot followed by PUT hot with a different AWS account (or storage type) works without ALLOW_UNRESTRICTED_STORAGE_CONFIG_ROLE_CHANGES. Harmless now since nothing resolves names. Once tables point at hot, though, they'd silently start vending credentials for another account. Is that intended? If so, can we file a follow-up so the resolution PRs close it?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
| if (updateRequest.getStorageConfigInfo() != null) { | ||
| validateStorageConfig(updateRequest.getStorageConfigInfo()); | ||
| } | ||
| validateNamedStorageConfigs(updateRequest.getStorageConfigInfos()); |
There was a problem hiding this comment.
With the flag off, a client that reads a catalog and sends its existing non-empty storageConfigInfos back on update gets a feature-disabled error, even though nothing is added. Should the flag only kick in when the set actually changes compared with the current entity?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
| private RealmConfig realmConfig; | ||
| private StorageConfigInfo storageConfigModel; | ||
| // Nullable and distinct from "empty": null means "not supplied, leave the persisted named-map | ||
| // untouched"; empty means "supplied and empty, so remove every named entry" (design.md D6a). |
There was a problem hiding this comment.
design.md D6a isn't in the repo, so readers can't follow this reference (same at :471, and PR #4023 at :332). Can we drop these or link the dev@ design doc?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
| } | ||
|
|
||
| @Override | ||
| public Response putStorageConfig( |
There was a problem hiding this comment.
This can change a catalog's role ARN or tenant, but unlike updateCatalog it fires no event, so audit listeners miss it. I see the PR description calls this out. Can we fire BEFORE/AFTER_UPDATE_CATALOG here and in deleteStorageConfig, or at least track it as a follow-up?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
|
Heads-up: #5967 has been merged, so Could you rebase onto |
|
@sririshindra : Is this superseded by #5943 ? |
Yes, let me close this. |
Why
A Polaris catalog can hold only one storage configuration today. Real deployments need
team-isolated buckets, separate credential boundaries per namespace, and more than one cloud
under a single catalog.
This is the first PR of the multi-storage-configuration design discussed on dev@
(thread,
design doc).
Related: #3409, #5030, #4023.
It lets a catalog hold named storage configurations. Nothing resolves them yet: there is no
reference property and no change to credential vending, so tables and namespaces keep using the
catalog's default configuration.
What changes
API (
spec/polaris-management-service.yml)New optional
storageConfigInfos: [StorageConfigInfo]onCatalog(create input and allresponses) and on
UpdateCatalogRequest. The singularstorageConfigInfostays the default.On update, an omitted array leaves the set unchanged, a present array replaces the whole set,
and an empty array clears it. To keep "omitted" and "empty" distinct, the property is
nullable: trueandopenApiNullableis disabled, so the generated getter returnsnullwhen the field is omitted.
New endpoints for managing one configuration at a time:
GET /catalogs/{catalogName}/storage-configsGET | PUT | DELETE /catalogs/{catalogName}/storage-configs/{storageConfigName}PUTcreates or replaces one entry. If the body setsstorageName, it must match the path(400 otherwise); if it doesn't, the path name is used. Each call runs the same validation,
overlap check and version compare-and-swap as
updateCatalog(409 on a concurrent change).Reads require
GET_CATALOG, andPUT/DELETErequireUPDATE_CATALOG; there are no newprivileges. An unknown name returns 404. These calls do not emit events.
Feature flag:
ENABLE_NAMED_STORAGE_CONFIGURATIONS, defaultfalse. Adding or replacingnamed configurations (a non-empty array, or
PUT) requires it. Reading and removing them(an empty array, or
DELETE) do not, so an operator can still clean up after turning it off.Validation
^[a-zA-Z0-9_-]{1,128}$, the same rule as feat(storage): inline polaris.storage.name overrides for namespace/table #4023'sStorageNameValidator.storageName(400). This is checked on the final state, so renaming the default onto an existing entry is
also rejected.
polaris.storage.aws.<name>), sowhether a request is accepted doesn't depend on server config the caller can't see.
allowedLocations, is subject toSTORAGE_CONFIGURATION_MAX_LOCATIONS, and gets the existing storage-type prefix checks and theSUPPORTED_CATALOG_STORAGE_TYPESandALLOW_SETTING_S3_ENDPOINTSchecks.ALLOW_UNRESTRICTED_STORAGE_CONFIG_ROLE_CHANGES) apply to each named entry, matched by name.Adding or removing an entry is not restricted.
archive).Cross-catalog overlap: named entries'
allowedLocationsnow count towardcatalogOverlapsWithExistingCatalog. Without this, a named entry could overlap another catalog'sstorage unnoticed.
ALLOW_OVERLAPPING_CATALOG_URLSstill overrides the check, and overlappingyour own catalog's default config is allowed.
Persistence (
polaris-core): the named entries are stored in a new internal property,storage_configuration_infos, as one JSON object mapping each name to its config.serializeMap/deserializeMapwrite through aTypeReference, so each entry keeps itspolymorphic
@type(a plainwriteValueAsStringdrops it).Compatibility and rollback
getCatalogresponses for existing catalogs are byte-identical.Testing
CatalogEntityTest: name normalization and syntax, the 128/129-character length limit,duplicate and default-name collisions, per-entry location limits and prefixes, the
omitted/empty/replace semantics, and legacy entities.
PolarisStorageConfigurationInfoTest: a mixed AWS and Azure map round-trips with its@typediscriminators.
ManagementServiceTest:PUTvalidation, and path-name trimming;PolarisAdminServiceAuthzTest: the new endpoints require the same privileges asgetCatalog/updateCatalog.PolarisOverlappingCatalogTest: overlap through a named entry via both the array andPUT,with and without the override.
PolarisManagementServiceIntegrationTest: create/update/read and the endpoints over HTTP,both catalog types, and no
storageConfigInfoskey in the JSON when no named configs are set.Diff-size note: the new schema property adds a trailing constructor argument to
CatalogandUpdateCatalogRequest. The one-linenulladditions in eleven test files come from that andchange no behavior.
Out of scope (follow-up PRs)
polaris.storage.namereference on namespaces and tables, and resolving it during credentialvending (feat(storage): inline polaris.storage.name overrides for namespace/table #4023).
site/, deferred until named configs can be resolved.Checklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed): deferred, see above🤖 Generated with Claude Code