Skip to content

Support multiple named storage configurations per catalog - #5556

Closed
sririshindra wants to merge 3 commits into
apache:mainfrom
sririshindra:multi-storage-config-catalog
Closed

sririshindra wants to merge 3 commits into
apache:mainfrom
sririshindra:multi-storage-config-catalog

Conversation

@sririshindra

@sririshindra sririshindra commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

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] on Catalog (create input and all
    responses) and on UpdateCatalogRequest. The singular storageConfigInfo stays 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: true and openApiNullable is disabled, so the generated getter returns null
    when the field is omitted.

  • New endpoints for managing one configuration at a time:

    • GET /catalogs/{catalogName}/storage-configs
    • GET | PUT | DELETE /catalogs/{catalogName}/storage-configs/{storageConfigName}

    PUT creates or replaces one entry. If the body sets storageName, 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, and PUT/DELETE require UPDATE_CATALOG; there are no new
    privileges. An unknown name returns 404. These calls do not emit events.

Feature flag: ENABLE_NAMED_STORAGE_CONFIGURATIONS, default false. Adding or replacing
named 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

  • Names are trimmed and must match ^[a-zA-Z0-9_-]{1,128}$, the same rule as feat(storage): inline polaris.storage.name overrides for namespace/table #4023's
    StorageNameValidator.
  • Names are unique and case-sensitive. They must not equal the default config's storageName
    (400). This is checked on the final state, so renaming the default onto an existing entry is
    also rejected.
  • Names are not checked against server-side credential sets (polaris.storage.aws.<name>), so
    whether a request is accepted doesn't depend on server config the caller can't see.
  • Each entry needs non-empty allowedLocations, is subject to
    STORAGE_CONFIGURATION_MAX_LOCATIONS, and gets the existing storage-type prefix checks and the
    SUPPORTED_CATALOG_STORAGE_TYPES and ALLOW_SETTING_S3_ENDPOINTS checks.
  • The existing update rules (no storage-type or role-identity change without
    ALLOW_UNRESTRICTED_STORAGE_CONFIG_ROLE_CHANGES) apply to each named entry, matched by name.
    Adding or removing an entry is not restricted.
  • Storage types can differ between entries (for example, S3 default and an Azure archive).

Cross-catalog overlap: named entries' allowedLocations now count toward
catalogOverlapsWithExistingCatalog. Without this, a named entry could overlap another catalog's
storage unnoticed. ALLOW_OVERLAPPING_CATALOG_URLS still overrides the check, and overlapping
your 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/deserializeMap write through a TypeReference, so each entry keeps its
polymorphic @type (a plain writeValueAsString drops it).

Compatibility and rollback

  • A catalog without named configs doesn't write the new key at all, so stored entities and
    getCatalog responses for existing catalogs are byte-identical.
  • Older servers ignore the key. Rollback is a plain revert with no data migration.

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 @type
    discriminators.
  • ManagementServiceTest:
    • blocked role and storage-type changes on a named entry, and the override flag;
    • a mixed valid/invalid update rejected as a whole;
    • feature flag enabled and disabled;
    • the full endpoint round trip, 404s, PUT validation, and path-name trimming;
    • type and S3-endpoint checks on both the array and the endpoints.
  • PolarisAdminServiceAuthzTest: the new endpoints require the same privileges as
    getCatalog/updateCatalog.
  • PolarisOverlappingCatalogTest: overlap through a named entry via both the array and PUT,
    with and without the override.
  • PolarisManagementServiceIntegrationTest: create/update/read and the endpoints over HTTP,
    both catalog types, and no storageConfigInfos key in the JSON when no named configs are set.

Diff-size note: the new schema property adds a trailing constructor argument to Catalog and
UpdateCatalogRequest. The one-line null additions in eleven test files come from that and
change no behavior.

Out of scope (follow-up PRs)

Checklist

  • 🛡️ Don't disclose security issues! (contact [email protected])
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Related to feat(storage): inline polaris.storage.name overrides for namespace/table #4023
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed): deferred, see above

🤖 Generated with Claude Code

@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board Sep 19, 2026
@sririshindra
sririshindra marked this pull request as ready for review September 29, 2026 01:15
sririshindra and others added 3 commits October 3, 2026 10:57
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]>
@sririshindra
sririshindra force-pushed the multi-storage-config-catalog branch from c2d2acc to 3462ceb Compare October 3, 2026 15:04
sririshindra added a commit to sririshindra/polaris that referenced this pull request Oct 6, 2026
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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤔

sririshindra added a commit to sririshindra/polaris that referenced this pull request Oct 18, 2026
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.
sririshindra added a commit to sririshindra/polaris that referenced this pull request Oct 20, 2026
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.
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the stale label Nov 6, 2026
@adutra adutra removed the stale label Nov 9, 2026

@orca-review-bot orca-review-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 storageConfigInfos constructor parameter on the generated UpdateCatalogRequest and 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));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@adutra

adutra commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Heads-up: #5967 has been merged, so CHANGELOG.md is no longer edited directly. Changelog entries now go in a fragment file under changelog.d/, which avoids merge conflicts on CHANGELOG.md. See changelog.d/README.md for the format.

Could you rebase onto main, revert your changes to CHANGELOG.md, and add a fragment file instead if your change needs a changelog entry? A fragment is only needed for things worth calling out in release notes, such as breaking changes, metastore schema changes, or changes that require manual steps during an upgrade. Thanks!

@dimas-b

dimas-b commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

@sririshindra : Is this superseded by #5943 ?

@sririshindra

Copy link
Copy Markdown
Contributor Author

@sririshindra : Is this superseded by #5943 ?

Yes, let me close this.

@github-project-automation github-project-automation Bot moved this from PRs In Progress to Done in Basic Kanban Board Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants