Skip to content

Service: Make default table/view locations unique - #4606

Merged
flyrain merged 6 commits into
apache:mainfrom
flyrain:uuid-location
Jul 15, 2026
Merged

flyrain merged 6 commits into
apache:mainfrom
flyrain:uuid-location

Conversation

@flyrain

@flyrain flyrain commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

New tables and views created without an explicit location now get a unique, unpredictable location: defaultWarehouseLocation appends a random UUID, controlled by the new DEFAULT_TABLE_LOCATION_USE_UUID feature flag (on by default), so no two tables share a path prefix. Here is an example.
Before:

 s3://my-bucket/warehouse/sales/orders
 Format: <namespace location>/<table name>

After (default, DEFAULT_TABLE_LOCATION_USE_UUID=true):

  s3://my-bucket/warehouse/sales/orders-3f2a8b1c-9d4e-4a7b-8c21-5e6f0a1b2c3d
  Format: <namespace location>/<table name>-<random UUID>

Caller-specified locations are now rejected by default, controlled by the new ALLOW_CLIENT_SPECIFIED_TABLE_LOCATION flag (off by default). I'm OK if people think we should set it to on by default given off is another behavior change. This covers the top-level location field, a SetLocation update, and the write.data.path/write.metadata.path properties, on both create (create-table/create-view) and update (update-table/replace-view) requests. Staged-create commits, register table/view, and federated catalogs are unaffected.

Existing tables and views are untouched. To restore the previous behavior, set polaris.config.default-table-location.use-uuid=false and polaris.config.allow.client-specified.table.location=true.

Followup optimization:

  1. We could skip the location check when uuid location is applied, which improve the overall perf.

Checklist

  • 🛡️ Don't disclose security issues! (contact [email protected])
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 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)

Copilot AI review requested due to automatic review settings June 3, 2026 06:18
@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board Jun 3, 2026

Copilot AI 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.

Pull request overview

This PR changes how Polaris derives managed table/view locations and how it handles client-specified locations, by introducing two new feature flags and enforcing new defaults in the Iceberg service layer.

Changes:

  • Added DEFAULT_TABLE_LOCATION_USE_UUID (default on) to append a random UUID suffix to managed table/view locations when no explicit location is provided.
  • Added ALLOW_CLIENT_SPECIFIED_TABLE_LOCATION (default off) and enforced rejection of client-specified location, SetLocation, and write.data.path / write.metadata.path across create/update paths (including commit-transaction).
  • Updated tests/fixtures and documentation/changelog to reflect the new flags and behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
site/content/in-dev/unreleased/configuration/config-sections/flags-polaris_features.md Documents the two new feature flags and their defaults.
runtime/service/src/testFixtures/java/org/apache/polaris/service/TestServices.java Pins location-related feature flags to legacy behavior for most tests unless explicitly overridden.
runtime/service/src/test/java/org/apache/polaris/service/catalog/Profiles.java Forces legacy location behavior in the shared catalog test profile; relies on dedicated tests for new defaults.
runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/IcebergTableLocationUuidTest.java Adds focused coverage for UUID default locations and default rejection of client-specified locations/write paths.
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java Enforces the client-specified location gate on create/update/replace and commit-transaction flows (and stage-create create path).
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java Implements UUID-suffixed managed location generation when the new default-location feature is enabled.
polaris-core/src/test/java/org/apache/polaris/core/config/PolarisConfigurationTest.java Locks and asserts the production defaults for the two new flags.
polaris-core/src/main/java/org/apache/polaris/core/config/FeatureConfiguration.java Defines the new feature flags, keys, config names, descriptions, and defaults.
CHANGELOG.md Adds upgrade notes, breaking change notes, and new feature entries for the location behavior changes.

Comment thread CHANGELOG.md Outdated
Comment on lines +33 to +37
- Newly created tables and views now use a unique, unpredictable location by default: Polaris appends a random UUID to
the generated location (controlled by the `DEFAULT_TABLE_LOCATION_USE_UUID` feature flag, on by default). Caller-specified
locations are now rejected by default (controlled by `ALLOW_CLIENT_SPECIFIED_TABLE_LOCATION`, off by default): this covers the
`location` field as well as the `write.data.path` / `write.metadata.path` properties, on create-table/create-view,
update-table/replace-view, and commit-transaction requests.
Comment thread CHANGELOG.md Outdated
Existing tables and views are unaffected. To restore the previous behavior, set `polaris.config.default-table-location.use-uuid=false` and `polaris.config.allow.client-specified.table.location=true` (per realm or per catalog).

### Breaking changes
- Create-table, create-view, update-table, replace-view, and commit-transaction requests that specify a location (the `location` field, a `SetLocation` update, or the `write.data.path` / `write.metadata.path` properties) are now rejected by default. Set `ALLOW_CLIENT_SPECIFIED_TABLE_LOCATION` (`polaris.config.allow.client-specified.table.location`) to `true` to allow caller-specified locations. Federated catalogs, staged-create commits, and `register table` / `register view` (which supply a metadata location) are unaffected.
@flyrain flyrain closed this Jun 3, 2026
@github-project-automation github-project-automation Bot moved this from PRs In Progress to Done in Basic Kanban Board Jun 3, 2026
@flyrain flyrain reopened this Jun 3, 2026
@github-project-automation github-project-automation Bot moved this from Done to PRs In Progress in Basic Kanban Board Jun 3, 2026
@MonkeyCanCode

Copy link
Copy Markdown
Contributor

Thanks for tagging. I will look into this later this weekend.

@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 this enhancement, @flyrain ! I support the idea of using randomized table locations in general.

Some impl.-specific comments below.

This this is a major behaviour change, I believe it deserves a mailing list discussion.

Comment on lines +557 to +559
throw new BadRequestException(
"Specifying a table or view location (%s) is not allowed; set %s to true to allow it.",
specifiedBy, FeatureConfiguration.ALLOW_CLIENT_SPECIFIED_TABLE_LOCATION.catalogConfig());

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.

specifiedBy can be "location", leading the confusing message like Specifying a table or view location (location) is not allowed; [...].

FeatureConfiguration.ALLOW_CLIENT_SPECIFIED_TABLE_LOCATION,
getResolvedCatalogEntity())) {
throw new BadRequestException(
"Specifying a table or view location (%s) is not allowed; set %s to true to allow it.",

@dimas-b dimas-b Jun 4, 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.

Re: set %s to true to allow it - if we disallow it for a reason, we should not suggest an "easy button" for by-passing this check. Instead users should read the docs and make a mindful decision, I think.

@dimas-b dimas-b mentioned this pull request Jun 4, 2026
6 tasks done
@dimas-b
dimas-b requested a review from snazy June 4, 2026 17:04
@dimas-b

dimas-b commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

FYI: @venkateshwaracholan @nandorKollar

@flyrain flyrain changed the title Service: Use UUID-based default table/view locations Service: Make default table/view locations unique Jun 7, 2026
@github-actions

github-actions Bot commented Jul 9, 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 Jul 9, 2026
@nandorKollar

Copy link
Copy Markdown
Contributor

Not stale

@dimas-b

dimas-b commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This is being discussed on dev: https://lists.apache.org/thread/wnssxy75j5fb4ytpsfy5z55fvzx3yg3q

ATM, I do not think we have a resolution for the concern about vended credential for long staged create operations 🤔

@flyrain

flyrain commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Hi folks, resolved comments. Please take another look.

@flyrain

flyrain commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

This is being discussed on dev: https://lists.apache.org/thread/wnssxy75j5fb4ytpsfy5z55fvzx3yg3q

ATM, I do not think we have a resolution for the concern about vended credential for long staged create operations 🤔

@dimas-b, IIUC, there is currently no solution for long staged create operations. Can you explain how this PR impacts a feature that doesn't exist today?

@dimas-b

dimas-b commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

@flyrain :

Can you explain how this PR impacts a feature that doesn't exist today?

I'm not sure what you mean by "a feature that doesn't exist today", but my points about potential effects of this PR on end users are noted on dev:

https://lists.apache.org/thread/v9sb48766jkcr5wgl4d3n6v8s1j977m1

https://lists.apache.org/thread/w73ms4w618r5g3ltkpcd856clo6pbsh7

Let's continue this discussion on dev. ATM not many people responded, so it is hard to reason about whether this is something that people are concerned about or not.

Defaulting DEFAULT_UNIQUE_TABLE_LOCATION_ENABLED to false will largely mitigate that concern from my POV.

@github-actions github-actions Bot removed the stale label Jul 10, 2026
Yufei Gu and others added 3 commits July 14, 2026 13:33
Tables and views created without an explicit location now get a unique,
unpredictable suffix by default, so no two tables share a path prefix. This is
controlled by the new DEFAULT_UNIQUE_TABLE_LOCATION_ENABLED feature flag (on by
default); the suffix is generated in defaultWarehouseLocation, so existing
tables/views are untouched. Set it to false to keep the legacy
`<namespace location>/<table name>` layout for new tables.

Caller-specified locations remain honored by default. Operators can set the new
ALLOW_CLIENT_SPECIFIED_TABLE_LOCATION flag to false to make Polaris manage all
locations: that rejects a caller-supplied `location` field, a `SetLocation`
update, and the `write.data.path` / `write.metadata.path` properties on
create-table/create-view, update-table/replace-view, and commit-transaction
requests. Staged-create commits, register table/view, and federated catalogs
are unaffected.

The new behavior is covered by IcebergTableLocationTest and
PolarisConfigurationTest. The legacy layout is pinned (via the unique-location
flag) in the shared unit-test profile, TestServices, the REST integration-test
base, and the regression-test server, because the inherited Iceberg CatalogTests
and the credential-scoping regression tests assert on deterministic locations.
Also regenerates the feature-flags reference docs and updates the CHANGELOG.
@flyrain

flyrain commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@dimas-b :

I'm not sure what you mean by "a feature that doesn't exist today", but my points about potential effects of this PR on end users are noted on dev:

https://lists.apache.org/thread/v9sb48766jkcr5wgl4d3n6v8s1j977m1

https://lists.apache.org/thread/w73ms4w618r5g3ltkpcd856clo6pbsh7

Let's continue this discussion on dev. ATM not many people responded, so it is hard to reason about whether this is something that people are concerned about or not.

Defaulting DEFAULT_UNIQUE_TABLE_LOCATION_ENABLED to false will largely mitigate that concern from my POV.

My point is that we haven't converged on a solution for long staged create operations yet. There are potential approaches that would not be affected by unique table locations, so I think it's a bit premature to conclude that this feature impacts that discussion.

More generally, I agree that we should preserve backward compatibility by defaulting DEFAULT_UNIQUE_TABLE_LOCATION_ENABLED to false. I've made that change in the latest commit. Hope this addresses your concern.

@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 the update, @flyrain !

The current diff LGTM overall 👍 Some minor comments below.

Comment thread regtests/docker-compose.yml Outdated
polaris.features."ENABLE_CATALOG_FEDERATION": "true"
# Regression tests assert on deterministic table locations (e.g. direct S3 access scoped to
# `.../<table>/`), so keep the legacy layout instead of the unique-suffix default.
polaris.features."DEFAULT_UNIQUE_TABLE_LOCATION_ENABLED": "false"

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 the same as default now. So this override is not necessary.

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.

removed

NAMESPACE,
name);
assertThat(normalizedLocation).startsWith(expectedPrefix);
assertThat(normalizedLocation.substring(expectedPrefix.length())).matches("[0-9a-f]{32}");

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 asserts only that the location has a suffix beyond the table name. It does not assert that the suffix is unique 🤷 It might be worth renaming the method to something like assertObjectStorageLocationFormat().

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.

renamed

// Keep the legacy default location layout so the shared catalog test suite keeps its
// historical behavior; the unique-location default is exercised by dedicated tests.
"polaris.features.\"DEFAULT_UNIQUE_TABLE_LOCATION_ENABLED\"",
"false",

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 as default now

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.

reverted


public Builder config(Map<String, Object> config) {
this.config = config;
this.config.putAll(config);

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.

Is this change necessary?

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.

It was needed when TestServices preloaded the legacy location defaults. Those defaults were removed after changing the production default to false, so this is no longer necessary. I’ll revert it.

@github-project-automation github-project-automation Bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jul 15, 2026
@flyrain
flyrain merged commit eeb735a into apache:main Jul 15, 2026
25 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to merge to Done in Basic Kanban Board Jul 15, 2026
@flyrain

flyrain commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @dimas-b !

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.

5 participants