Expanding a bit on my previous email, I am wondering if we could keep the
storage config name in the entity properties. I guess we discussed this
idea some time ago, but I'm not very sure.

Cheers,
Dmitri.

On Fri, Dec 4, 2026 at 8:15 PM Dmitri Bourlatchkov <[email protected]> wrote:

> Hi Rishi,
>
> Thanks for writing down this proposal! It helpes a lot (at least for me :)
> ).
>
> Pre-mapping by table name still sounds flaky and "magical" to me. I also
> suspect it might open backdoors that are hard to foresee in the initial
> implementation.
>
> What is the use case we're trying to solve by pre-mappingby name?
>
> If a client wishes to create a table in a particular storage config, and
> the client knows the name of the config, I'm sure we can find ways to
> communicate that idea to the server.
>
> If the client does not know the proper config name, and an admin user
> pre-maps the table the client is going to create, that's where the
> workflows become too "magical" IMHO.
>
> If the client does not know the config name, it still knows the namespace
> where the new table will be created. Why is namespace-based config
> association not sufficient in this case?
>
> Thanks,
> Dmitri.
>
> On Tue, Nov 24, 2026 at 11:42 PM Srinivas Rishindra <
> [email protected]> wrote:
>
>> Hi all,
>>
>> On the spec PR for storage configurations and storage mappings (#5943
>> [1]),
>> Dmitri asked for a concrete plan for how mappings would be implemented,
>> and
>> suggested discussing it here rather than in the PR. So here it is. None of
>> this is implemented yet; #5943 is spec only. #5943 itself keeps to storage
>> configurations, explicit mappings and creating on a configuration; the
>> spec
>> text for what is described below will follow in a draft PR on top of it.
>> A quick recap
>>
>> A storage configuration is a named, immutable entity inside a catalog,
>> next
>> to the catalog's own storageConfigInfo, which stays the default. A storage
>> mapping says that the namespace or table with a given fully qualified name
>> uses a given storage configuration. An admin can create a mapping before
>> the namespace or table exists, and any create picks it up, including plain
>> Iceberg REST creates and CTAS. All of this is for internal catalogs only.
>>
>> Yufei raised two concerns earlier in this thread about mappings made
>> before
>> the table exists: there is no entity id yet, and a rename must not break
>> the mapping. Below, such a mapping is keyed by name until the object
>> exists, then bound to its entity id, and it moves with the table on
>> rename.
>> The other concern, that an admin can't guess which tables users will
>> create, is what the table property further down is for.
>> The main design point
>>
>> The mapping table is where Polaris records storage configurations, and
>> nothing about storage is written on the table or namespace entities. A
>> mapping has one of two kinds of target:
>>
>>    -
>>
>>    Tables and views always have a mapping. If an admin mapped the name, it
>>    is "explicit". Otherwise Polaris records an "automatic" mapping when
>> the
>>    table or view is created: to the storage configuration of the nearest
>>    enclosing namespace that has a mapping, or else to a snapshot of the
>>    catalog's storageConfigInfo. A snapshot is an ordinary immutable
>> storage
>>    configuration that the server creates from the current settings. So
>> every
>>    table and view keeps the storage configuration it was created on, even
>> on
>>    the default. Its mapping moves with it on rename and is removed when
>> it is
>>    dropped. Listing shows all mappings, with a filter for explicit ones
>> only,
>>    so admins can see which storage configuration each table is on.
>>    -
>>
>>    Namespaces only have explicit mappings, and only if an admin made one.
>> A
>>    namespace mapping is a default for what is created inside the namespace
>>    afterwards (tables, views and child namespaces). It can be created,
>>    replaced or removed at any time, never moves anything that already
>> exists,
>>    and stays when its namespace is dropped. A namespace without a mapping
>> has
>>    no record, and what is created in it uses the next enclosing mapped
>>    namespace or the default.
>>    -
>>
>>    Generic tables get no mappings for now: they only use storage to check
>>    an explicit base location at create. If they ever vend credentials,
>> adding
>>    mappings for them is backward compatible.
>>
>>
>> A heads-up I'd like feedback on: snapshots and automatic mappings apply to
>> every internal catalog once the feature flag is on, not only to catalogs
>> that create a storage configuration. That keeps one model everywhere and
>> costs one mapping read per table load. The consequence is that an edit of
>> storageConfigInfo with updateCatalog (say, rotating the IAM role) reaches
>> tables created after the edit and tables created before the flag was on,
>> which have no mapping and follow it live, but not tables created in
>> between, which stay on the old role (see question 4). Also, with the flag
>> off Polaris reads no mappings, so turning it off after use sends tables
>> back to the live storageConfigInfo; I'd document "don't turn it off after
>> use" rather than pay the read in deployments that never use the feature.
>> Making storageConfigInfo itself immutable is out of scope.
>>
>> Storing mappings
>>
>> Mappings are their own records, the way policy mappings are, not entities,
>> so they don't block dropping a namespace:
>>
>> (catalog, kind, parent namespace path, name) -> (storage configuration id,
>> origin, entity id)
>>
>>    -
>>
>>    origin is explicit or automatic.
>>    -
>>
>>    entity id is the id of the table or view the record is bound to once it
>>    exists, and empty for an explicit mapping made ahead of its target.
>>
>> An index on the storage configuration id answers "who uses this storage
>> configuration".
>>
>> They are keyed by path rather than by entity id, because an explicit
>> mapping can exist before its target, and a namespace mapping after it. In
>> JDBC that is a new table; in NoSQL an index; plus the in-memory store.
>>
>> Resolution
>>
>> For a table or view, Polaris reads the mapping for its name (a namespace's
>> mapping only matters when something is created in it), loads that storage
>> configuration by id and uses it for location checks and credential
>> vending.
>> A bound mapping only applies to the table or view whose entity id it
>> carries; a mapping left over from an interrupted drop or rename and bound
>> to another object fails the request instead of applying, and the next
>> create of that name replaces an automatic leftover and keeps an explicit
>> one, which is listed and can be removed, so that a crash never loses a
>> mapping an admin made. No mapping means the catalog's storageConfigInfo,
>> as
>> today. If the storage configuration can't be found, the request fails;
>> there's no fallback. A storage configuration is an ordinary entity that
>> never changes, so it is loaded through Polaris's existing caches, and the
>> mapping is the only new read per table load.
>>
>> Creates
>>
>> A create of a namespace, table or view looks up, in one query, the name's
>> own explicit mapping and the mappings of the enclosing namespaces; the
>> nearest one wins, otherwise the default (for a table or view, a snapshot
>> of
>> it). Polaris checks the location against that storage configuration and
>> writes the mapping record. The record goes first so that deleting the
>> storage configuration is refused while a create is in flight. Then it
>> writes the first metadata file with the configuration's credentials,
>> creates the entity and returns credentials from it. If the metadata write
>> or the entity create fails, the record is removed again.
>>
>> A table property as a second way in
>>
>> Following the earlier suggestion on this list (Yufei), a createTable
>> request can name a storage configuration in the table property
>> polaris.storage-configuration, so CREATE TABLE ... TBLPROPERTIES (...) AS
>> SELECT works from Spark and other clients with no Polaris-specific call.
>> It
>> does exactly what the "create on a storage configuration" endpoint in
>> #5943
>> does, which stays, with the same authorization. Polaris removes the
>> property before it builds the metadata, so it never reaches metadata.json
>> or loadTable, and table commits still can't set polaris.* properties.
>>
>> Staged creates
>>
>> Credentials are vended at staging, so the storage configuration has to be
>> chosen at staging. Polaris records the choice for the staged table, keyed
>> by the table UUID it puts in the staged metadata, which the Java client
>> sends back as AssignUUID at the commit (I haven't checked the other
>> clients). The commit creates the table on that storage configuration and
>> replaces the UUID key with the table name, in the same write as the entity
>> where the backend allows it (JDBC and the in-memory store can; NoSQL
>> should, if the records live with the catalog's entities; DynamoDB looks
>> possible). Several stagings of one name can coexist, as today; the first
>> commit wins. The commit is refused if the name's explicit mapping is not
>> what it was at staging (none both times, or the same storage configuration
>> both times), or if the storage configuration was deleted. Iceberg REST has
>> no way to abort a staged create (Spark's abortStagedChanges is still a
>> TODO), so an abandoned staging leaves its record behind. I'd like to
>> explore adding an abort separately. I don't plan an expiry here: such
>> records are small, never listed, don't keep a storage configuration from
>> being deleted, and go away with it or with the catalog.
>>
>> Renames, drops, deletes
>>
>> A rename inserts the new name, renames the table, then deletes the old
>> name, only if the record still belongs to that table. A drop removes the
>> table first and its record after, under the same condition. Without
>> multi-entity transactions, an interruption leaves at most a record that
>> never applies to another object. A rename onto a name explicitly mapped to
>> a different storage configuration is refused. Deleting a storage
>> configuration is refused while any mapping references it, which is one
>> indexed query. Deleting a catalog deletes its storage configurations,
>> snapshots and mappings.
>>
>> Authorization
>>
>> This follows policies: creating or removing a mapping needs a privilege on
>> the storage configuration and one on the parent namespace; a plain create
>> needs only the normal create privilege, even when the table inherits its
>> storage configuration; the create-on-a-storage-configuration endpoints and
>> the table property need both, even if the name already has an explicit
>> mapping.
>>
>> Everything above is behind a feature flag that is off by default.
>> Questions
>>
>>    1.
>>
>>    Should dropping a table remove its explicit mapping? The spec says yes
>>    now, and that's my preference, though it reverses what I argued on the
>> PR
>>    earlier: nothing is left over to clean up, a mapping only exists while
>> its
>>    table does or before it is created, and explicit and automatic mappings
>>    behave the same way. (A namespace mapping stays when its namespace is
>>    dropped, because it is a default an admin set for a container, not a
>> record
>>    of what a table uses, and namespaces have no automatic mappings.) The
>>    downsides: a pipeline that drops and re-creates a table has to map it
>> again
>>    or pass the property every time, and a drop destroys a mapping an
>> admin set
>>    up ahead of time. Keeping it would let a re-created table land on the
>> same
>>    storage with any client, but leaves mappings behind that have to be
>> found
>>    and removed one at a time, and a storage configuration can't be deleted
>>    until they are.
>>    2.
>>
>>    A minor one: should a snapshot be reused while the default's settings
>>    haven't changed (my preference: the server names a snapshot after its
>>    content, which makes reuse simple), or should each create get its own?
>>    3.
>>
>>    Is a staging record with no expiry and no abort acceptable, given that
>>    Iceberg REST has neither? And does anyone know whether Trino and Flink
>> send
>>    AssignUUID when committing a staged create?
>>    4.
>>
>>    Should tables created on the catalog's default storage configuration
>> get
>>    a snapshot of it (my proposal, one model for every table), or stay
>> without
>>    a mapping and keep following the live storageConfigInfo, so that an
>>    updateCatalog edit such as rotating the IAM role reaches all of them?
>> The
>>    first gives every table a recorded storage configuration; the second
>> keeps
>>    today's behavior for tables on the default, but then listings can't
>> show
>>    which tables use it.
>>
>>
>> Thanks,
>>
>> Rishi
>>
>> [1] https://github.com/apache/polaris/pull/5943
>>
>

Reply via email to