Skip to content

Spec: Add storage configuration and storage mapping APIs (beta) - #5943

Open
sririshindra wants to merge 31 commits into
apache:mainfrom
sririshindra:named-storage-p1-spec
Open

sririshindra wants to merge 31 commits into
apache:mainfrom
sririshindra:named-storage-p1-spec

Conversation

@sririshindra

@sririshindra sririshindra commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Why

A catalog in Polaris has exactly one storage configuration today, so every namespace and table in
it uses the same locations and the same cloud identity. Teams that keep different data in different
buckets, accounts or clouds need more than one.

On dev@ (thread) we agreed to
skip the earlier approach of putting several configurations inside the catalog (#5721, #5556) and
to make storage configurations a dedicated, catalog-scoped entity instead. This PR supersedes #5721.

This PR is the API contract for the whole feature, spec only, so that the model can be reviewed as
a whole before any server code lands:

  1. Storage configurations (management API) are entities in a catalog, next to the catalog's own
    storageConfigInfo, which stays the default.
  2. Storage mappings (management API) say that the namespace or table with a given fully
    qualified name uses a given storage configuration. An admin creates a storage configuration and
    then maps names to it, both in the management API. A mapping is picked up by any create,
    including plain Iceberg REST creates from engines and CTAS. Engines don't need to know about it.
  3. Create on a storage configuration (catalog API) maps and creates a namespace or table in one
    call, with the Iceberg request and response bodies unchanged.

The binding model

  • Every table, view and generic table keeps the storage configuration it was created on for as
    long as it exists. Polaris writes a table's first metadata file at create time, so the choice has
    to be made before the table exists, and it can't change afterwards without making the files the
    table already has unreadable.
  • A namespace mapping is a default for what is created in the namespace afterwards. It can be
    created, replaced or removed at any time. An object created inside a namespace without a mapping
    of its own uses the mapping of the nearest enclosing namespace that has one, as it is at the time
    of the create, or else the catalog's own storageConfigInfo. Changing a namespace mapping never
    changes an existing object or moves an existing namespace.
  • A table mapping lets one table use different storage from the rest of its namespace, without
    giving it a different name. Examples: one table with personal data in a separate, locked-down
    account; data residency per table; a table registered from another account or cloud; migrating a
    namespace to other storage one table at a time. Putting such a table in its own namespace would
    change its identifier, which breaks every query that uses it, and take it out from under the
    namespace's grants. A table mapping can exist before the table and only while the table doesn't
    exist, and it stays when the table is dropped, so a pipeline that drops and re-creates the table
    through plain Iceberg REST lands on the same storage every time.
  • Staged creates (CTAS) follow the same rule as direct creates. The storage configuration is
    chosen when Polaris checks the location and hands out credentials, which for a staged create is
    at staging, and the commit creates the table on that same storage configuration. If the
    name resolves to a different storage configuration at the commit (a table or namespace mapping
    created, replaced or removed in between), the commit is refused with 409, so a mapping change can't
    leave a table recorded on another storage configuration than the one its data was written with.
    Editing the catalog's own storageConfigInfo during a staged create is not such a change, as
    today. This means the server keeps some state for a staged create until the commit, which Polaris
    doesn't do today. A commit the server can't match to its staging (for example, staged longer ago
    than a server limit, or before an upgrade) is refused too, except in catalogs without storage
    configurations, which behave as before. How the state is kept is part of the implementation plan
    on dev@ (email); the same
    state could later also let staged creates refresh credentials and take part in the location
    overlap check.
  • Renames don't change storage. A table or view keeps its storage configuration and its
    location. A table's own mapping moves with it. A rename onto a name mapped to a different storage
    configuration is refused.
  • Placement without an explicit location. An object created under its own mapping goes under
    the storage configuration's baseLocation. An object created inside a namespace goes under the
    namespace's location if that location is inside the storage configuration's allowedLocations,
    and otherwise under baseLocation (for the catalog's own storageConfigInfo, its
    default-base-location). That covers a namespace whose mapping changed after it was created.
  • Cleanup is explicit and one item at a time. Dropping a namespace or table doesn't remove
    mappings. listStorageMappings can filter on targetExists, listStorageConfigurations on
    referenced, and a client removes or deletes what it no longer wants one item at a time. A storage
    configuration can't be deleted while a mapping references it or an existing object was created on
    it.

How this addresses the points raised on dev@

  • Default base location. Each storage configuration has its own optional baseLocation, and
    its allowedLocations must not be empty.
  • Backward compatibility. The catalog's storageConfigInfo and its properties keep their
    meaning. No existing schema changes shape. Creating or updating a catalog is also checked against
    the storage configurations of other catalogs, which only matters once such configurations exist.
  • Coarse-grained updates. Storage configurations have their own endpoints and are immutable, so
    nothing changes by editing the catalog object.
  • Migration. There is no intermediate model to migrate from.
  • Why mappings rather than a table property at create time. Which cloud identity a table gets
    is the storage owner's decision. With a property, anyone who can create a table would choose it,
    and a re-create without the property would silently land elsewhere. A mapping is created ahead of
    time by an admin and then works with any Iceberg client, CTAS included, without client changes.

What changes

spec/polaris-management-service.yml

Storage configurations:

  • GET/POST /catalogs/{catalogName}/storage-configurations and
    GET/DELETE /catalogs/{catalogName}/storage-configurations/{storageConfigurationName}.
  • StorageConfiguration: name (^[a-zA-Z0-9_-]{1,128}$, unique within its catalog),
    storageConfigInfo (the existing schema; allowedLocations must not be empty), optional
    baseLocation (the placement rule above), createTimestamp.
  • listStorageConfigurations takes referenced (true or false) to list only the storage
    configurations in use or not in use.
  • A storage configuration may name any cloud account or tenant and any supported storage type,
    whatever the catalog's own storageConfigInfo uses. This is the point of the feature, and it
    differs from updateCatalog, which refuses to change the catalog's storage type, AWS account,
    external ID or Azure tenant (unless ALLOW_UNRESTRICTED_STORAGE_CONFIG_ROLE_CHANGES is set). So
    whoever can create a storage configuration chooses the cloud identity and, with storageName, the
    server-side credentials.
  • For S3, Azure and GCS, storageConfigInfo.storageName selects the server-side credentials Polaris
    authenticates with for a storage configuration, so several storage configurations can reuse the
    same credentials by name. A storage configuration always honors it, even on a server that doesn't
    use the name on a catalog's own storageConfigInfo. The credentials stay in server configuration
    and never go through this API, and changing them there is how they are rotated. FILE storage has
    no credentials and ignores the name. Without storageName, Polaris uses the server's default
    credentials for the storage type, not the storageName of the catalog's storageConfigInfo.
    Creating a storage configuration fails with 400 if the server can't resolve the name to
    credentials for the storage type. The error doesn't say why, and no API lists the names a server
    knows. If a name stops resolving later, operations that need storage fail; Polaris never falls
    back to other credentials.
  • Creating a storage configuration does not check that its cloud identity or the selected
    credentials can access its locations.
  • Every location in allowedLocations must match the storage type (an abfss:// location on an S3
    storage configuration is a bad request), and the storage type must be one the server supports, as
    for a catalog.
  • The allowedLocations of a storage configuration must not overlap the locations of another
    catalog or of another catalog's storage configurations, unless ALLOW_OVERLAPPING_CATALOG_URLS is
    set, and creating or updating a catalog is checked against them too. They may overlap the
    catalog's own locations and its other storage configurations.
  • A response always holds all the settings in effect in storageConfigInfo.
  • Storage configurations are immutable: there is no update. To change settings, create a new one
    and map namespaces and tables to it. The catalog's own storageConfigInfo can still be changed
    with updateCatalog, as today. An update operation for storage configurations can be added later
    without breaking anything.
  • Deleting a catalog deletes its storage configurations and storage mappings. As before, a catalog
    can only be deleted when it has no namespaces and no catalog roles other than catalog_admin.
    Storage mappings don't prevent the deletion, because a mapping stays after its namespace or table
    is dropped.
  • StorageConfigInfo.storageName gets a clearer description: it finds base storage credentials,
    and it is unrelated to the name of a storage configuration.

Storage mappings:

  • GET /catalogs/{catalogName}/storage-mappings lists one level at a time, like namespaces (query
    namespace), or every mapping to one storage configuration (query storageConfigurationName),
    optionally filtered by targetExists. Results only include the mappings the caller is authorized
    to see.
  • POST /catalogs/{catalogName}/storage-mappings creates a mapping, and
    POST /catalogs/{catalogName}/storage-mappings/remove removes one. The target is named by type
    (namespace or table) and fully qualified path, like a namespace grant.
  • The rules are those of "The binding model" above.

New operations reuse their parameter definitions (components/parameters) and say "conflicts with
the current state of the catalog" for 409, giving the specific case only as an example.

spec/polaris-catalog-apis/storage-configurations-api.yaml (new, tag "Storage Configuration
API"), referenced from spec/polaris-catalog-service.yaml and listed in spec/README.md;
spec/generated/ regenerated.

  • POST /polaris/v1/{prefix}/storage-configurations/{storage-configuration-name}/namespaces and
    …/namespaces/{namespace}/tables create on a storage configuration, taking Iceberg's
    CreateNamespaceRequest / CreateTableRequest, Iceberg's Idempotency-Key header (and
    X-Iceberg-Access-Delegation for tables), and returning Iceberg's responses. They map the name as
    createStorageMapping does, and refuse a name that is already mapped to a different storage
    configuration. They stay in the catalog API because they return Iceberg responses with vended
    credentials.

Pagination. Every new list uses the shared Polaris pagination definitions from #6028
(spec/polaris-pagination.yaml): any response may be paginated, a client needs neither
pageToken nor pageSize to start, the server decides the page size, and a server may return
everything at once. #6028 is merged, and this branch has main merged in. The file appears in
this PR's diff only for a one-line fix of its header comment, which named the PageToken schema
instead of PolarisPageToken.

Authorization is not part of the spec, as for the other Polaris APIs, since the built-in
authorizer, OPA and Ranger each decide it differently. The intended model follows policies:
managing storage configurations, using one in a mapping, and managing the mappings of a namespace
are separate privileges, and creating or removing a mapping needs both the storage configuration
side and the namespace side. The two catalog API operations that create on a storage configuration
need what createStorageMapping needs plus what the namespace or table create needs, also when the
name is already mapped to that storage configuration. The privileges come with the server code that
enforces them.

All new operations are marked beta.

Behavior after this PR

  • The management operations exist and answer 501 Not Implemented, like any operation the server
    doesn't implement.
  • The two catalog API operations are not served yet: the build only generates server code for the
    catalog API sections it lists.
  • The in-development API reference on the site shows the new operations, marked beta.
  • The server-side lookup behind storageName exists for AWS (feat: storage-scoped aws credentials #3409) and Azure (Support storage-scoped Azure credentials #5952), where a
    catalog's own name is used when RESOLVE_CREDENTIALS_BY_STORAGE_NAME is set. Support storage-scoped GCP credentials #5951 adds it for
    GCS, and this contract assumes it.
  • Nothing else changes. No existing schema changes shape.

Next steps

Draft #6232, on top of this PR, changes this spec to follow the mapping implementation plan on dev@
(email). It is not for review
until that thread settles.

  1. Storage configuration entities: create, get, list and delete, behind a feature flag. This adds
    the first CHANGELOG.md entry.
  2. Storing mappings and resolving storage through them, then the mapping and create endpoints.
  3. The privileges.
  4. Later, separately: an operation to test a storage configuration's access to its locations on
    request, and moving the existing list operations onto the shared pagination definitions.

Testing

StorageConfigurationSerializationTest checks the storage configuration models: round trips for
S3, Azure and GCS, each with a storageName, and the exact JSON of a create request and of a list
page. StorageMappingSerializationTest does the same for the storage mapping models, and checks
the Jackson exception for an unknown target type and for a missing field. There is no server
behavior to test yet.

Checks run locally: ./gradlew format, rat, :polaris-api-management-model:check,
:polaris-api-management-service:check, :polaris-api-catalog-service:check,
:polaris-api-iceberg-service:compileJava, :polaris-runtime-service:compileJava and
compileTestJava, and make spec-bundle-verify (the committed bundle is current).
The full suite was left to CI.

Checklist

@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board Oct 31, 2026
@sririshindra sririshindra changed the title Spec: Add storage configuration and storage mapping APIs (beta) Spec: Add storage configuration, storage mapping and orphan cleanup APIs (beta) Nov 1, 2026
Add the API contract for storage configurations as catalog-scoped
entities, spec only:

- Management API: create, get, list (paginated) and delete storage
  configurations under a catalog. Storage configurations are immutable.
- Catalog API: create, remove and list storage mappings, which map the
  fully qualified name of a namespace or table to a storage
  configuration, and create a namespace or table on a storage
  configuration with the Iceberg request and response bodies.
- Clarify StorageConfigInfo.storageName.

A mapping can only be created or removed while its namespace or table
does not exist, so an existing object always keeps the storage
configuration it was created with.

The management operations answer 501 until implemented; the catalog
API operations are not served yet. No existing schema changes shape.
- State that the catalog's own storageConfigInfo can still be changed
  with updateCatalog, and that Polaris does not check cloud-side access
  of a storage configuration's identity.
- Restate the rename rules as one rule that covers tables with and
  without their own mapping, and say that storage configurations are
  compared by identity.
- Say which creates a mapping applies to (staged create, registerTable),
  that views inside a mapped namespace use its storage configuration,
  and that only namespaces and Iceberg tables can have a mapping.
- Say that undoing a mapping after a failed create-on-configuration is
  best effort, and that the mapping privileges are always required.
- Clarify where baseLocation applies, that a table path has at least
  two elements, and add a paragraph break to storageName.
- List storage-mappings-api.yaml in spec/README.md.
…pings

- Name the mapping privileges after the policy ones: STORAGE_CONFIGURATION_ATTACH
  and STORAGE_CONFIGURATION_DETACH on the storage configuration, with
  NAMESPACE_/CATALOG_ATTACH_STORAGE_CONFIGURATION and
  NAMESPACE_/CATALOG_DETACH_STORAGE_CONFIGURATION on the parent.
- Accept Iceberg's Idempotency-Key header on the two create operations;
  a replay has no additional effects on the storage mapping either.
- Deleting a catalog deletes its storage configurations and storage
  mappings.
- listStorageMappings lists one level at a time, like namespaces: the
  mappings directly inside `namespace`, or of the top-level namespaces
  without it. Listing every mapping to a storage configuration across
  the catalog is a separate mode of the same operation and requires
  CATALOG_MANAGE_METADATA, so mapped names are not visible to callers
  who can't list the namespaces they are in.
- A view can't be renamed into a namespace that uses a different
  storage configuration, as for a table without its own mapping.
- A table with a mapping of its own takes it along on rename, also when
  the new name is already mapped to the same storage configuration: the
  old name is no longer mapped afterwards. Moving a mapping this way
  does not require the mapping privileges.
- Generic tables inside a mapped namespace use its storage
  configuration, like Iceberg tables and views.
- A storage configuration used by existing namespaces or tables can be
  deleted only after they are dropped and their mappings removed.
- The CATALOG_ forms of the mapping privileges apply to top-level
  namespaces.
Dropping a namespace or table never removes a storage mapping, so the
mappings left behind (target-exists is false) are removed explicitly:
DELETE storage-mappings/orphans in the catalog API and DELETE
storage-configurations/orphans in the management API, both with a
dry-run mode. Also document that a rename can't bypass the attach and
detach privileges, that a failed combined create leaves an orphan
mapping, and reserve the storage configuration name "orphans".

The storage mapping models are now generated for the catalog service,
with serialization tests.
…cleanup

The orphan cleanup removes orphan mappings (the target was dropped) by
default and, with include-pending, also pending ones (the target never
existed). Mappings expose target-ever-existed to tell them apart.
Storage configurations expose everReferenced, and the cleanup can skip
those that were never referenced. Both cleanups are paginated, and the
mapping cleanup requires the privileges of removing each mapping,
including STORAGE_CONFIGURATION_DETACH on the mapped configurations.
The allowedLocations of a storage configuration must not overlap another
catalog or another catalog's storage configurations, and creating or updating
a catalog is checked against them too.

A storage configuration may name any cloud account or tenant and any supported
storage type. The limits updateCatalog puts on changing the catalog's
storageConfigInfo do not apply, so whoever holds STORAGE_CONFIGURATION_CREATE
chooses the cloud identity.

A response always holds all the settings in effect.

Define a pending mapping the way target-ever-existed does: the target has not
existed since the mapping was created.
Say that storageConfigInfo.storageName selects the server-side credentials of a storage
configuration, what happens without it and when it can't be resolved, and that locations must
match the storage type. The round trip tests now carry storageName for S3, Azure and GCS.
A storage configuration always honors storageName, even on a server that
doesn't use the name of a catalog's own storageConfigInfo. The rules cover S3,
Azure and GCS; FILE has no credentials and ignores the name. The error for an
unresolvable name doesn't say why, and no API lists the names a server knows.
Whoever can create a storage configuration chooses the server-side credentials.
Changing the credentials behind a name on the server takes effect without
changing the storage configuration, which is how they are rotated.
A per-level listing of storage mappings leaves out table mappings unless the
caller also has TABLE_LIST on the namespace. Rename the list filter to
storage-configuration-name, the style of the Polaris catalog API. State where a
namespace or table with its own mapping is placed under baseLocation, and that
the location rules compare with those locations.
…s locations

Creating a storage configuration stays a static check, because access is often
granted only after it exists. validateStorageConfiguration calls the cloud
provider on request and reports each location, with an optional write check.

Also leave namespace mappings out of a listing for callers who can't list
namespaces, as for tables, and state what the orphan cleanup response names.
@sririshindra
sririshindra force-pushed the named-storage-p1-spec branch from 2eabf9b to 0aeeaa7 Compare November 1, 2026 18:06
@sririshindra
sririshindra marked this pull request as ready for review November 1, 2026 18:50

@dimas-b dimas-b left a comment

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.

Thanks for pushing this feature forward, @sririshindra !

I'm posting some preliminary comments for now.

I need more time to review the mechanism for binding storage configs to entities.

Results are paginated. A client follows `next-page-token` until it is null or absent.
parameters:
- $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
- $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'

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.

Same points as in: #5927 (comment)

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.

If we would move away from IRC pagination schema, let's create a common Polaris pagination schema can be shared by all endpoints requiring pagination. We should avoid fragmentation definition cross endpoints.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed on both points. The IRC PageToken text also contradicts this operation's own description, since it requires a server to return everything when pageToken is absent. I opened #6028 (draft) with one Polaris definition in spec/polaris-pagination.yaml: a pageToken/pageSize pair and a page token schema with the rules from #5927. Any response may be paginated, neither parameter is needed to start, the server decides the page size, and a server may return everything at once. The catalog and management APIs can both use it. Each response keeps its API's field name (next-page-token or nextPageToken), and both point to the same schema. Done in 51b4407: the new list operations here use it instead of the IRC definitions. Existing operations stay as they are in that PR, because the generic table and policy handlers enforce the IRC rule today, so moving them also needs a server change.

Comment thread spec/polaris-management-service.yml Outdated
404:
description: "The catalog does not exist"
409:
description: "A storage configuration with the specified name already exists in the catalog"

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.

409 is a "Conflict". Conflicts can have all sorts of different reasons. Is it valuable to scope it narrowly to only name collisions in the API spec?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair point. I copied the wording from createCatalog, but nothing is gained by narrowing it. Done in b7bf5f9: every new 409 now describes a conflict with the current state of the catalog and gives the previous reason only as an example.

Comment thread spec/polaris-management-service.yml Outdated
**Beta:** The storage configuration API is under active development and may change in a
backward-incompatible way.

Delete the unreferenced storage configurations of a catalog: those that no storage mapping

@dimas-b dimas-b Nov 5, 2026 •

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.

This is not a well-defined operation. The client cannot possibly know what exactly is unreferenced at request time.

Plus, I think it would be extremely hard to implement it atomically in the current Polaris codebase.

I think it would be preferable to support a "find orphans" operation combined with "delete a specific config".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right, the client can't know what the call will delete, and I don't think the atomic page is implementable with the current persistence either. I removed both bulk cleanups (this one and the mapping one) in 19e8182. Instead, listStorageConfigurations takes a referenced filter and listStorageMappings a targetExists filter, so a client finds what to clean up and deletes it one item at a time. The single delete still refuses while the storage configuration is in use.

Comment thread spec/polaris-management-service.yml Outdated
- name: pageToken
in: query
required: false
description: The `nextPageToken` of the previous response. Omit it to get the first page.

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.

It is possible to share parameter definitions across endpoints. It makes reading and maintenance easier. Cf. #5927

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Done in b7bf5f9: the parameters of the new management paths (catalog name, storage configuration name) are defined once under components/parameters and referenced from the paths; the page token and page size now come from the shared definition in #6028 (51b4407). I left the existing paths as they are.

Comment thread spec/polaris-management-service.yml Outdated
required: true
schema:
type: string
pattern: '^(?!orphans$)[a-zA-Z0-9_-]{1,128}$'

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.

Why is orphans special?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Only because DELETE …/storage-configurations/orphans would have collided with deleting a storage configuration named orphans. With the bulk cleanup gone (see the other thread), the reservation is gone too, in 19e8182.

Comment thread spec/polaris-management-service.yml Outdated

Get a storage configuration.

Requires STORAGE_CONFIGURATION_READ on the storage configuration.

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.

STORAGE_CONFIGURATION_READ is a privilege specific to the internal RBAC. Polaris supports multiple Authorizer implementations. I believe it is preferable to define API in terms of concepts shared across all components, which would be the PolarisAuthorizableOperation in this case.

That said, I do not actually think we have to define AuthZ behaviour in an API spec.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, thanks. No other Polaris spec describes authorization, and privilege names only mean something to the built-in authorizer. Done in b7bf5f9: the privilege text is gone from the operation descriptions. Where it described behavior a client can observe, for example a listing leaving out entries the caller may not see, that stays, without privilege names. The privileges will be defined with the authorization code and documented on the access control page.

Comment thread spec/polaris-management-service.yml Outdated
**Beta:** The storage configuration API is under active development and may change in a
backward-incompatible way.

Check that the storage configuration can reach its locations, by calling the cloud provider.

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.

This is a good idea, but perhaps it is a bit of a scope creep? Would you mind adding it later, after the basic storage config APIs and use cases are sorted out?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Happy to. Removed in b7bf5f9; I will propose it separately once the basic storage configuration APIs are settled.

Comment thread spec/polaris-management-service.yml Outdated
409:
description: "A storage mapping references the storage configuration"

/catalogs/{catalogName}/storage-configurations/{storageConfigurationName}/validate:

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.

I'd rename validate -> test. Valid relates to the data of the configuration, but the description talks about runtime behaviours, which may be different from run to run even for an otherwise valid config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, "valid" reads like a check of the content of the configuration. I will call it test when I propose it again.

schema:
$ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
503:
$ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'

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.

How is the IRC spec relevant to the Polaris Management API? What is the rationale for reusing it here?

My counter-point is that someone copying this spec for building a client for managing Polaris in a downstream project, does not necessary have to know or care about the IRC spec and its version.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This file was in the catalog API, and I followed the other catalog API files (policies, generic tables), which reuse the IRC prefix and error responses. But I agree with your point in the other thread that the mapping operations are management operations. They moved to the management API in 9a15ae3 and no longer reference the IRC spec. The only operations left in the catalog API are the two that create a namespace or table on a storage configuration, since they take and return Iceberg's request and response bodies.


---
paths:
/polaris/v1/{prefix}/storage-mappings:

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.

This base path is generally part of "Catalog" APIs, that is APIs dealing with operational aspects of a catalog (create / update / delete entities).

Storage Config-related data is traditionally part of the Management API.

In other words, a non-admin client can deal with entities in a catalog, but does not need to know how storage is managed.

I think it would be worth keeping that distinction. However, these new management endpoints are interleaved with operational endpoints.

WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree. Choosing storage is an admin decision like the catalog's own storage config, and clients working with tables shouldn't need to see it. In 9a15ae3 the mapping operations moved to the management API, under /catalogs/{catalogName}/storage-mappings, next to the storage configurations, so creating a configuration and attaching it are one workflow in one place. The operations that create a namespace or table on a storage configuration return Iceberg responses with vended credentials, so those stay in the catalog API (the file is now storage-configurations-api.yaml).

Comment on lines +108 to +111
Map the fully qualified name of a namespace or table to a storage configuration. The target
must not exist yet; its parent namespace must exist. When a namespace or table is later
created under that name, through the Iceberg REST API (including a staged create and
`registerTable`) or the Polaris API, it is created on the mapped storage configuration:

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 you have a use case for this complex association logic?

Is it not sufficient to reference storage config at the namespace level?

Note that the name may be allocated by one actor, but the entity (table) created by another 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, good questions. Short version: storage placement has to be possible per table, because the namespace is the logical name and the access-control boundary, and storage is a physical choice that shouldn't dictate either.

Use cases where tables in one namespace need different storage:

  • a domain namespace where one table holds personal data that must live in a separate, locked-down account with its own key (sales.customers next to sales.orders);
  • data residency per table (customers.eu_profiles in an EU bucket, customers.us_profiles in a US one);
  • tables whose data already lives in another account or cloud, for example one registered from a partner's bucket next to our own tables, or tables that stay where they are produced to avoid egress;
  • data products in one curated namespace, each stored and paid for by the team that produces it;
  • migrating a namespace to other storage one table at a time without renaming tables.

Putting such a table into its own namespace changes its identifier, which breaks every query and model that uses it, and takes it out from under the namespace's grants. Other systems allow this: in Unity Catalog, an external table in a schema can use a different credential than the schema's managed storage, and in PostgreSQL a table can be put in its own tablespace, with a default tablespace per database. Iceberg itself vends credentials per table.

Why a mapping by name rather than a reference on the table: the table has to be on its storage from its first metadata write, so the choice has to exist before the table does. And it has to survive drops. Pipelines that drop and re-create a table through plain Iceberg REST should land on the same storage every time, without knowing about storage configurations. If the choice lived on the table entity, a re-create from an engine would silently fall back to the namespace's storage.

On the name being allocated by one actor and used by another: that's intentional, and it's how the catalog's own storage works today. The storage owner decides where data goes, and whoever creates the table doesn't choose the cloud identity. Creating a mapping is meant to need rights on both the storage configuration and the namespace, mappings are listable, and the create response shows the location the table landed on. I'd rather keep that decision with the storage owner than let each table creator pick credentials.

I agree it should be simpler, and I cut what isn't essential: the bulk cleanups, the reserved name and the pending/orphan distinction are gone (19e8182). Namespace mappings and table mappings are the same mechanism with a different target, and the implementation can land namespaces first. I also agree with your point about namespaces in the other thread: a namespace's mapping can now be changed or removed at any time, and only objects created afterwards are affected (0b9fa95).

A storage mapping is never changed while its target exists: it can't be created for an
existing namespace or table, and it can't be removed from one. Together with the rename rules
below, this means that a namespace or table created on a storage configuration keeps using it
for as long as it exists. A rename keeps a table on the storage configuration it uses:

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.

This may be too strong for namespaces. They do not hold any data in storage themselves, but act mostly as containers for other entities.

Setting default config in a namespace makes sense, but why forbid changing it? It this it's an admin decision rather than an API capability.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. The restriction was there because tables inherited their namespace's configuration when they were loaded, so changing the namespace would have moved existing tables. I changed that in 0b9fa95: each table, view and generic table keeps the storage configuration it was created on, and a namespace's mapping only decides what new objects get. An admin can now create, replace or remove a namespace's mapping at any time, and existing tables keep theirs. It also simplifies renames: a table or view without a mapping of its own can now be renamed into any namespace. For a table mapping I kept the rule as it is, since the table's files were written with its configuration.

backward-incompatible way.

List storage mappings. A storage mapping says that the namespace or table with a given fully
qualified name uses a given storage configuration (see StorageMappingTarget). Storage

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.

How do we create storage configuration? I assume it would be part of the REST spec. Similar to a policy, the workflow would be 1. create a storage config 2. map/attach it to a ns/table.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Storage configurations are created through the management API in this PR: POST /catalogs/{catalogName}/storage-configurations in polaris-management-service.yml, next to the catalog's own storageConfigInfo, since a storage configuration chooses the cloud identity. And yes, the workflow is create, then attach. The attach operations (storage mappings) are now in the management API too (9a15ae3, following dimas-b's comment on the base path), so both steps are in the same place. One difference from policies: an existing table can't be attached to a different storage configuration, because its files were already written with the old one, so a table gets its configuration when it's created. A namespace's mapping can change at any time and applies to what is created in it afterwards.


StorageConfigurationName:
type: string
description: The name of a storage configuration in the catalog. Case sensitive. `orphans` is reserved.

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.

We would define the storage configurations in the spec. storage configurations shouldn't be not be part of catalog properties.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, and that's how this PR defines them: StorageConfiguration is its own schema with its own endpoints in polaris-management-service.yml (create, get, list, delete under /catalogs/{catalogName}/storage-configurations). Nothing goes into the catalog's properties and the Catalog schema doesn't change. "In the catalog" in this description only meant that a configuration belongs to one catalog; I reworded it in 01e0c34 to "unique within its catalog". Or did you mean something else?

- 409 responses describe any conflict with the current state of the catalog,
  giving the previous reason only as an example.
- The parameters of the new management paths (catalog name, storage
  configuration name, page token, page size) are defined once under
  components/parameters and referenced from the paths.
- Authorization is no longer described in the spec; the privileges come with
  the server code. Behavior a client can observe, such as listings leaving out
  mappings the caller may not see, is described without privilege names.
- The validate operation, its checkWrite parameter and its result schemas are
  removed from this PR and will be proposed separately.
New Polaris list operations either reference the Iceberg REST Catalog
pagination definitions or define their own. The Iceberg definitions
require a server to return all results when a request has no pageToken,
which defeats the purpose of paginating, and per-operation copies drift
apart.

Add spec/polaris-pagination.yaml with one pageToken/pageSize parameter
pair and a page token schema, usable from both the catalog and the
management APIs. Its rules: any response may be paginated, neither
parameter is needed to start, the server decides the page size, and a
server may return everything in one response. Each response names the
token field in its own API's style.

No operation references the file yet. Existing operations keep their
current definitions.
# Conflicts:
#	spec/generated/bundled-polaris-catalog-service.yaml
#	spec/polaris-catalog-service.yaml
The storage mapping lists referenced the Iceberg REST Catalog
pagination definitions, which require a server to return all results
when the request has no pageToken. That contradicted the operations'
own description, which says results are paginated. The management
lists had their own pageToken/pageSize parameters.

Reference spec/polaris-pagination.yaml for both, so every list in this
spec follows the same rules.
deleteOrphanStorageConfigurations and removeOrphanStorageMappings asked
the server to delete a set it computes at request time, so a client
could not know what a call would delete, and the promised atomic page
is not something the persistence layer offers.

Remove both, with their dryRun, skipNeverReferenced and include-pending
parameters. A client now finds what to clean up with a list filter and
deletes one item at a time:

- listStorageConfigurations takes a `referenced` filter; a storage
  configuration is in use while a storage mapping references it, which
  is what deleteStorageConfiguration refuses on;
- listStorageMappings takes a `target-exists` filter;
- removeStorageMapping also removes a mapping whose parent namespace
  has been dropped.

With the bulk cleanups gone, the reserved name `orphans`, the
`everReferenced` field and the `target-ever-existed` field (pending
versus orphan mappings) have no remaining use and are removed too.
Choosing which storage configuration a namespace or table uses is an
administrative decision, like a catalog's own storageConfigInfo, and
clients that work with tables don't need to see it. The mapping
operations were in the catalog API, next to the engine-facing
endpoints, while the storage configurations they reference were in the
management API.

Move listStorageMappings, createStorageMapping and removeStorageMapping
to the management API under /catalogs/{catalogName}/storage-mappings,
next to the storage configurations, so creating a configuration and
mapping a name to it are one workflow in one API. The schemas use the
management API's camelCase JSON, the management API's response style
and the shared Polaris pagination definitions, and no longer reference
the Iceberg REST Catalog spec. Their models are now generated in the
management model module, and the serialization test moves with them.

The two operations that create a namespace or table on a storage
configuration stay in the catalog API, because they take and return
the Iceberg REST bodies, vended credentials included. Their file is
renamed to storage-configurations-api.yaml, with the tag "Storage
Configuration API", since it no longer holds any mapping operation.
"The name of a storage configuration in the catalog" could be read as
a storage configuration being part of the catalog object or its
properties. A storage configuration is its own resource; the name is
only unique within its catalog. Say that.
A namespace holds no data of its own, so its storage mapping is really
a default for what is created in it. Forbidding changes to it while the
namespace exists was only needed because tables inherited their
namespace's storage configuration when they were loaded, so changing
the namespace would have moved existing tables.

Each Iceberg table, view and generic table now keeps the storage
configuration it was created on for as long as it exists. A namespace
mapping only decides what is created afterwards:

- it can be created, replaced or removed while the namespace exists;
- an object created inside a namespace without a mapping of its own
  uses the mapping of the nearest enclosing namespace that has one, as
  it is at the time of the create, or else the catalog's own
  storageConfigInfo;
- existing objects keep their storage configuration and existing
  namespaces don't move.

Table mappings keep the existing rule: created and removed only while
the table does not exist.

Because the storage configuration now travels with the object, a table
or view without a mapping of its own can be renamed into any namespace.
A rename onto a name mapped to a different storage configuration is
still refused.

Without an explicit location, an object created inside a namespace goes
under the namespace's location if that location is inside the storage
configuration's allowedLocations, and otherwise under the storage
configuration's baseLocation (the catalog's default-base-location for
the catalog's own storageConfigInfo), so a re-mapped namespace does not
send new tables outside the allowed locations.

A storage configuration is in use, and can't be deleted, while a
mapping references it or an existing object was created on it.
createNamespaceOnStorageConfiguration still refuses a name that is
mapped to a different storage configuration.
@sririshindra sririshindra changed the title Spec: Add storage configuration, storage mapping and orphan cleanup APIs (beta) Spec: Add storage configuration and storage mapping APIs (beta) Nov 10, 2026

@sririshindra sririshindra left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the reviews. I've replied on each thread and addressed the comments in new commits.

Comment thread spec/polaris-management-service.yml Outdated
404:
description: "The catalog does not exist"
409:
description: "A storage configuration with the specified name already exists in the catalog"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair point. I copied the wording from createCatalog, but nothing is gained by narrowing it. Done in b7bf5f9: every new 409 now describes a conflict with the current state of the catalog and gives the previous reason only as an example.

Comment thread spec/polaris-management-service.yml Outdated
- name: pageToken
in: query
required: false
description: The `nextPageToken` of the previous response. Omit it to get the first page.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Done in b7bf5f9: the parameters of the new management paths (catalog name, storage configuration name) are defined once under components/parameters and referenced from the paths; the page token and page size now come from the shared definition in #6028 (51b4407). I left the existing paths as they are.

Comment thread spec/polaris-management-service.yml Outdated

Get a storage configuration.

Requires STORAGE_CONFIGURATION_READ on the storage configuration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, thanks. No other Polaris spec describes authorization, and privilege names only mean something to the built-in authorizer. Done in b7bf5f9: the privilege text is gone from the operation descriptions. Where it described behavior a client can observe, for example a listing leaving out entries the caller may not see, that stays, without privilege names. The privileges will be defined with the authorization code and documented on the access control page.

Comment thread spec/polaris-management-service.yml Outdated
**Beta:** The storage configuration API is under active development and may change in a
backward-incompatible way.

Check that the storage configuration can reach its locations, by calling the cloud provider.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Happy to. Removed in b7bf5f9; I will propose it separately once the basic storage configuration APIs are settled.

Comment thread spec/polaris-management-service.yml Outdated
409:
description: "A storage mapping references the storage configuration"

/catalogs/{catalogName}/storage-configurations/{storageConfigurationName}/validate:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, "valid" reads like a check of the content of the configuration. I will call it test when I propose it again.


---
paths:
/polaris/v1/{prefix}/storage-mappings:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree. Choosing storage is an admin decision like the catalog's own storage config, and clients working with tables shouldn't need to see it. In 9a15ae3 the mapping operations moved to the management API, under /catalogs/{catalogName}/storage-mappings, next to the storage configurations, so creating a configuration and attaching it are one workflow in one place. The operations that create a namespace or table on a storage configuration return Iceberg responses with vended credentials, so those stay in the catalog API (the file is now storage-configurations-api.yaml).

Comment on lines +108 to +111
Map the fully qualified name of a namespace or table to a storage configuration. The target
must not exist yet; its parent namespace must exist. When a namespace or table is later
created under that name, through the Iceberg REST API (including a staged create and
`registerTable`) or the Polaris API, it is created on the mapped storage configuration:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, good questions. Short version: storage placement has to be possible per table, because the namespace is the logical name and the access-control boundary, and storage is a physical choice that shouldn't dictate either.

Use cases where tables in one namespace need different storage:

  • a domain namespace where one table holds personal data that must live in a separate, locked-down account with its own key (sales.customers next to sales.orders);
  • data residency per table (customers.eu_profiles in an EU bucket, customers.us_profiles in a US one);
  • tables whose data already lives in another account or cloud, for example one registered from a partner's bucket next to our own tables, or tables that stay where they are produced to avoid egress;
  • data products in one curated namespace, each stored and paid for by the team that produces it;
  • migrating a namespace to other storage one table at a time without renaming tables.

Putting such a table into its own namespace changes its identifier, which breaks every query and model that uses it, and takes it out from under the namespace's grants. Other systems allow this: in Unity Catalog, an external table in a schema can use a different credential than the schema's managed storage, and in PostgreSQL a table can be put in its own tablespace, with a default tablespace per database. Iceberg itself vends credentials per table.

Why a mapping by name rather than a reference on the table: the table has to be on its storage from its first metadata write, so the choice has to exist before the table does. And it has to survive drops. Pipelines that drop and re-create a table through plain Iceberg REST should land on the same storage every time, without knowing about storage configurations. If the choice lived on the table entity, a re-create from an engine would silently fall back to the namespace's storage.

On the name being allocated by one actor and used by another: that's intentional, and it's how the catalog's own storage works today. The storage owner decides where data goes, and whoever creates the table doesn't choose the cloud identity. Creating a mapping is meant to need rights on both the storage configuration and the namespace, mappings are listable, and the create response shows the location the table landed on. I'd rather keep that decision with the storage owner than let each table creator pick credentials.

I agree it should be simpler, and I cut what isn't essential: the bulk cleanups, the reserved name and the pending/orphan distinction are gone (19e8182). Namespace mappings and table mappings are the same mechanism with a different target, and the implementation can land namespaces first. I also agree with your point about namespaces in the other thread: a namespace's mapping can now be changed or removed at any time, and only objects created afterwards are affected (0b9fa95).

A storage mapping is never changed while its target exists: it can't be created for an
existing namespace or table, and it can't be removed from one. Together with the rename rules
below, this means that a namespace or table created on a storage configuration keeps using it
for as long as it exists. A rename keeps a table on the storage configuration it uses:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. The restriction was there because tables inherited their namespace's configuration when they were loaded, so changing the namespace would have moved existing tables. I changed that in 0b9fa95: each table, view and generic table keeps the storage configuration it was created on, and a namespace's mapping only decides what new objects get. An admin can now create, replace or remove a namespace's mapping at any time, and existing tables keep theirs. It also simplifies renames: a table or view without a mapping of its own can now be renamed into any namespace. For a table mapping I kept the rule as it is, since the table's files were written with its configuration.

backward-incompatible way.

List storage mappings. A storage mapping says that the namespace or table with a given fully
qualified name uses a given storage configuration (see StorageMappingTarget). Storage

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Storage configurations are created through the management API in this PR: POST /catalogs/{catalogName}/storage-configurations in polaris-management-service.yml, next to the catalog's own storageConfigInfo, since a storage configuration chooses the cloud identity. And yes, the workflow is create, then attach. The attach operations (storage mappings) are now in the management API too (9a15ae3, following dimas-b's comment on the base path), so both steps are in the same place. One difference from policies: an existing table can't be attached to a different storage configuration, because its files were already written with the old one, so a table gets its configuration when it's created. A namespace's mapping can change at any time and applies to what is created in it afterwards.


StorageConfigurationName:
type: string
description: The name of a storage configuration in the catalog. Case sensitive. `orphans` is reserved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, and that's how this PR defines them: StorageConfiguration is its own schema with its own endpoints in polaris-management-service.yml (create, get, list, delete under /catalogs/{catalogName}/storage-configurations). Nothing goes into the catalog's properties and the Catalog schema doesn't change. "In the catalog" in this description only meant that a configuration belongs to one catalog; I reworded it in 01e0c34 to "unique within its catalog". Or did you mean something else?

@dimas-b dimas-b left a comment

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.

Hi @sririshindra ! At this point I'd like to better understand how mapping can work in practice before we continue with the API. Also, staged creates seem kind of problematic. Specific comments below.

Comment thread spec/polaris-management-service.yml Outdated
Comment on lines +132 to +133
Delete an existing catalog. The catalog must be empty. Its storage configurations and storage
mappings are deleted with it.

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.

I see this description as self-contradicting 😅 If storage configs are deleted with the catalog, they must logically be part of it, but then the catalog is not "empty" 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair point, "empty" was never meant literally, and it already wasn't on main: a catalog can be deleted when it has no namespaces and no catalog roles other than catalog_admin, and catalog_admin is deleted together with the catalog. I reworded the description to say exactly that, and that the storage configurations and mappings are deleted the same way. Mappings can't be a reason to refuse the delete, because a mapping stays after its namespace or table is dropped, so a catalog with no namespaces left can still have some.

Comment thread spec/polaris-management-service.yml Outdated
Comment on lines +1037 to +1038
For a staged create, the mapping that counts is the one in place when the create is
committed.

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.

I'm not sure how this can work 🤔 Staged creates are often long-running operations. The initial credentials are vended at the start of the operations not at commit time.

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.

Actually, I think that stages creates are fundamentally hard in Polaris:

  • Vended credentials cannot be refreshed because there is no backing entity.
  • There is no way to prevent location overlaps across two concurrent staged operations.

I'd like to propose treating staged entities as a form of "soft-deleted" entities (#5544), which materialize at commit time. WDYT?

In the transition period we could default staged entities to config of their namespace.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right, the text was wrong: the credentials of a staged create are vended at staging and the engine writes its data with them, so the commit is the wrong moment to decide.

I changed it so that a staged create follows the same rule as a direct create. The storage configuration is chosen at staging, where the location is checked and the credentials come from, and the commit creates the table on that storage configuration and checks the location again. If by then the name resolves to a different storage configuration, because a table or namespace mapping was created, replaced or removed in between, the commit is refused with 409. So a mapping change during a CTAS can't leave a table recorded on another storage configuration than the one its data was written with, and CTAS works for a name that has a mapping of its own.

I'd rather not default staged creates to the namespace's storage configuration in the meantime. Namespace mappings can change at any time too, so it wouldn't close the gap for them, and CTAS would behave differently from CREATE TABLE for a table-mapped name, which is one of the main cases for table mappings.

This does mean the server has to keep something about a staged create until the commit, which I think is your main point. In the plan I posted on dev@ (https://lists.apache.org/thread/06w8zwpgwcv4js6o6ltd3cspj16hy54r) that is a small record of the choice, made at staging and matched at the commit. Materializing staged entities like the soft-deleted ones in #5544 would also work and would go further: it could fix credential refresh and overlap checks for staged creates in general, which this doesn't try to do. The plan changes some details of the rule here, and its spec text will follow in a draft PR on top of this one. WDYT?

404:
description: "The catalog, the namespace or the storage configuration does not exist"
post:
operationId: createStorageMapping

@dimas-b dimas-b Nov 12, 2026 •

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 you have a concrete plan for how mappings are implemented? Could you share it? Sorry, if I missed something 😅

I guess this might be best discussed on dev rather than in this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No worries, you didn't miss anything, it hasn't been written up publicly yet. I agree dev@ is the better place, and it should be settled there before this goes further anyway. I posted the plan here: https://lists.apache.org/thread/06w8zwpgwcv4js6o6ltd3cspj16hy54r

The plan goes further than this PR in a few places, for example what dropping a table does to its mapping. So I kept this PR to what has been reviewed, and the spec text for the plan will follow in a separate draft PR on top of this one. Happy to continue on dev@.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The draft PR is up now: #6232. It builds on this PR and changes its spec text to follow the plan in the email. It stays a draft, not for review, until the dev@ thread settles.

Comment thread spec/polaris-pagination.yaml Resolved

@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, thorough contract. All of it is additive and beta, so existing clients aren't affected. Keeping privileges out of the spec makes sense given the multiple authorizers. My main open question is in the inline comment on the catalog-API shortcut: does it need the same both-sides authorization as createStorageMapping? Skipping the CHANGELOG is fine until server code lands. The serialization tests look good apart from two loose negative assertions.

🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.

tags:
- Storage Configuration API
summary: Create a table on a storage configuration
operationId: createTableOnStorageConfiguration

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 call creates a storage mapping as a side effect of a table create. The PR description says creating a mapping will need both the storage-config side and the namespace side. If the server later gates this shortcut only on table-create, any table creator could put a table on another account's credentials without the mapping privilege. Is the intent that this is authorized like createStorageMapping + createTable? Can we state that in the PR description so the server PR follows it?

🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's the intent. Both create-on-configuration operations need what createStorageMapping needs, on the storage configuration side and on the namespace side, plus the privilege for the namespace or table create itself. That also applies when the name is already mapped to that storage configuration, so replaying a request doesn't need fewer privileges than the first call. I added this to the Authorization paragraph of the description so the server PR follows it.

Comment thread spec/polaris-pagination.yaml Outdated
#

# Pagination definitions shared by the Polaris-specific APIs: the Polaris catalog APIs and the
# management APIs. A list operation references the two parameters and uses the PageToken schema for

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: the schema is named PolarisPageToken, not PageToken. Can we fix the comment (or in #6028)?

🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.

() ->
mapper.readValue(
"{\"type\":\"view\",\"path\":[\"finance\",\"v\"]}", StorageMappingTarget.class))
.isNotNull();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

.isNotNull() passes for any exception, including an NPE from a bug in the test itself. Can we assert the Jackson exception type here instead? Same for line 135.

🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Both tests now assert the Jackson exception type, InvalidFormatException for the unknown target type and MismatchedInputException for the missing field, and check that the message names the rejected value and the missing field respectively.

The deleteCatalog description said the catalog must be empty and then
that its storage configurations and mappings are deleted with it, which
reads as a contradiction. State the actual rule instead: no namespaces,
and no catalog roles other than catalog_admin, which is deleted with the
catalog today. Storage configurations and storage mappings go the same
way. Mappings can't block the delete because they remain after their
namespace or table is dropped.
The two rejection tests only checked that something was thrown, so an
unrelated exception would also have passed. Assert the Jackson exception
type and that the message names the field that failed: an unknown target
type gives InvalidFormatException, a missing storageConfigurationName
gives MismatchedInputException.
The text said that for a staged create the mapping in place at commit
counts. But the credentials of a staged create are vended at staging,
and the engine writes its data with them before the commit, so deciding
at commit could record a table on a different storage configuration
than the one its data was written with.

Choose the storage configuration at staging instead, the same moment as
for a direct create, and create the table on it at commit. The commit is
refused with 409 if the storage configuration the name would get has
changed in between, or if the server no longer keeps the staged create.
This applies equally to table mappings, namespace mappings and the
catalog's own storage configuration. The create-on-configuration
shortcut keeps supporting stage-create under the same rule.
Say that the commit of a staged create checks the location against the
storage configuration chosen at staging again, that a change means the
name resolves to a different storage configuration by identity (editing
the catalog's own storageConfigInfo is not one), and describe the
refusal for a staging the server can no longer match by its effect
rather than by a mechanism. That refusal does not apply while a catalog
has no storage configurations, so such catalogs behave as before. Also
say that the nearest mapped namespace is taken at staging, and that
only a successful staging keeps a mapping created by the shortcut.

@flyrain flyrain left a comment

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.

Thanks for working on it @sririshindra ! Left some comments.

#

---
paths:

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.

I'd prefer the spec changes in one single places, either all here, or all in spec/polaris-management-service.yml. They are easier to reference that way, and we don't have to duplicate schema like StorageConfigurationName in two different places.

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.

oh, I saw the endpoint Post /catalogs/{catalogName}/storage-mappings, in that case, we don't need two endpoints in this doc.

Comment on lines +36 to +44
Create a namespace on the given storage configuration in one call. The request body, the
`Idempotency-Key` header and the response are those of the Iceberg REST `createNamespace`
operation. A request replayed with the same `Idempotency-Key` has no additional effects, on
the namespace or on the storage mapping.

The call maps the namespace name to the storage configuration, as `createStorageMapping` in
the Polaris management API does, then creates the namespace as the Iceberg REST
`createNamespace` operation would. If the name is already mapped to this storage
configuration, the existing mapping is used. Unlike `createStorageMapping`, the call does

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 create a new namespace by this endpoint? I don't think we should do that. Instead, we want to map a storage config to a ns.

content:
application/json:
schema:
$ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/CreateNamespaceRequest'

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.

I think we shouldn't create a new ns via this endpoint.

5XX:
$ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'

/polaris/v1/{prefix}/storage-configurations/{storage-configuration-name}/namespaces/{namespace}/tables:

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.

Same here, I don't think we should support table creation via this endpoint.

Comment on lines +131 to +136
description: >-
Delete an existing catalog. A catalog can only be deleted when it contains no namespaces and
has no catalog roles other than `catalog_admin`. Deleting the catalog also deletes its
`catalog_admin` role, its storage configurations and its storage mappings. Storage mappings
don't prevent the deletion, because a storage mapping remains after its namespace or table is
dropped.

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.

I'm not sure we need this change, some of them are not related to this PR. Some are impl. details. Maybe we can keep it simple by not making this change.

Comment on lines +1104 to +1106
- A table mapping can only be removed while the table does not exist; drop the table first.
- A namespace mapping can be removed whether or not the namespace exists. Whatever was
already created in the namespace keeps its storage configuration.

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.

I'm not sure these are the right behaviors. Removing a table-level S.C. so that a table can inherit the S.C. from its parent ns. It's more of impl details though.
Can we remove them now, and have a separate discussion while implementation?

404:
description: "The catalog does not exist, or no storage mapping exists for the target"
409:
description: "The request conflicts with the current state of the catalog, for example the target table exists"

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.

Does it ever hit 409?

properties:
target:
$ref: "#/components/schemas/StorageMappingTarget"
storageConfigurationName:

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.

Can we refer to an existing component?

properties:
type:
type: string
enum:

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 allow to map to a catalog(the current catalog)? How do we do so if yes.

type: string
enum:
- namespace
- table

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.

-> table-like? it could be view, generic table, etc.

This branch has not been deployed

No deployments
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