Skip to content

[#13330] feat(iceberg): apply table-format-version properties on the Iceberg REST catalog - #13332

Open
nevzheng wants to merge 2 commits into
apache:mainfrom
nevzheng:feat/13330-table-format-version-iceberg-rest
Open

nevzheng wants to merge 2 commits into
apache:mainfrom
nevzheng:feat/13330-table-format-version-iceberg-rest

Conversation

@nevzheng

Copy link
Copy Markdown
Collaborator

Stacked on #13331: please review only the last commit.

What changes were proposed in this pull request?

Apply table-format-version.default and table-format-version.max in the Iceberg REST service, with the same names, rules and messages as the Gravitino API in #13331:

  • A create or stage-create without format-version gets the catalog default. Iceberg does not apply table-default. properties to staged metadata, so the service sets it on the stage-create request.
  • A create, stage-create, upgrade-format-version or staged-create commit above the maximum fails with HTTP 400. Above 4, the build ceiling from [#13330] feat(iceberg): add table-format-version default and max catalog properties #13331, it fails with the ceiling message even when the maximum is unset. Existing tables above the maximum still load and commit.
  • Static catalogs (gravitino.iceberg-rest.table-format-version.*) are validated at startup. Dynamic catalogs use the catalog properties and are validated when they load.
  • Catalogs with the rest backend forward requests unchanged, so the properties are not read, validated or applied: IcebergConfig.governsTableFormatVersions() keeps CatalogWrapperForREST from parsing them, and a catalog with table-format-version.max=abc loads and forwards.

Why are the changes needed?

Without this, the Iceberg REST service ignores the catalog's format-version settings, so a client could create or upgrade a table past the version the operator allows.

Part of #13330

Does this PR introduce any user-facing change?

Yes. The Iceberg REST service honours the two catalog properties and the build ceiling, and adds the static keys gravitino.iceberg-rest.table-format-version.default and gravitino.iceberg-rest.table-format-version.max. They are documented in docs/iceberg-rest-service.md and the conf template; docs/lakehouse-iceberg-catalog.md gains the upgrade limit. A catalog that sets neither behaves as before, except that a version above 4 is refused with the ceiling message.

How was this patch tested?

Unit tests only. Coverage for the Iceberg REST service, in TestCatalogWrapperForREST unless noted ("n/a" means the case doesn't arise on that path):

Case Create Stage-create Upgrade Staged commit rest backend
No version, both unset 2 2 n/a n/a n/a
No version, default=3 3 3 n/a n/a not applied
Requested up to max kept kept kept kept n/a
Requested above a set max 400, max message 400 400 400 not capped
Requested 5, max unset 400, ceiling message 400 400, stays v4 400 n/a
Existing table above max n/a n/a loads and commits n/a n/a
Bad property value (0, 5, abc, blank) catalog refused catalog refused n/a n/a ignored (TestIcebergCatalogWrapperManagerForREST)
Default above max, or conflicting table-default.format-version, at load catalog refused n/a n/a n/a ignored
Static config bad value startup fails (TestStaticIcebergConfigProvider) skipped

testAboveBuildCeilingIsRefusedWithMaxUnset is one parameterized test over the four paths; it also checks that nothing is created and the upgraded table stays at v4. TestIcebergConfig and TestDynamicIcebergConfigProvider cover the config side.

./gradlew :catalogs:catalog-common:test :catalogs:catalog-lakehouse-iceberg:test :iceberg:iceberg-common:test :iceberg:iceberg-rest-server:test -PskipITs: 710 tests, 0 failures, 0 errors, 0 skipped (catalog-common 40, catalog-lakehouse-iceberg 124, iceberg-common 83, iceberg-rest-server 463).

…x catalog properties

Add the table-format-version.default and table-format-version.max catalog
properties so operators can choose the format version of new tables that do
not request one and cap the version tables may be created at. Both are
validated as supported Iceberg versions (1-4), default to 2 and 4, and a
conflicting table-default.format-version fails catalog initialization.

A format-version above 4, the highest this Gravitino build accepts, is now
refused as unsupported by this Gravitino (supports 1-4) rather than as
exceeding an unset table-format-version.max. The Gravitino API's table
property validation reports the same message as its cause.

A guard test fails when the ceiling and the bundled Iceberg's
TableMetadata.SUPPORTED_TABLE_FORMAT_VERSION differ, so an Iceberg upgrade
forces a review of the ceiling.

Pin what a stored catalog with table-format-version.default above .max
does: it loads as metadata, and its first schema or table operation fails
with an IllegalArgumentException (HTTP 400) naming both properties.

Docs: drop the upgrade clause from this layer (the Iceberg REST catalog
adds it) and state the ceiling and the load-time behaviour.
…n the Iceberg REST catalog

Apply table-format-version.default and table-format-version.max in the Iceberg
REST service: a stage-create without format-version gets the catalog default,
and create, stage-create and upgrade-format-version commits above the maximum
fail with 400. Static catalogs are validated at startup, and catalogs with the
rest backend are exempt because they forward requests unchanged.

A federated catalog no longer reads table-format-version.max at all, so a
value that would not parse (for example max=abc) neither stops it from
loading nor keeps a request from reaching the remote catalog.

Cover the build's ceiling on the Iceberg REST catalog: with the maximum
unset, format-version 5 on create, stage-create, upgrade-format-version and
a staged-create commit is refused with HTTP 400 and the ceiling message,
and nothing is created or changed.

Docs: add the upgrade clause to the catalog doc now that the Iceberg REST
service enforces it, and state the ceiling in the REST service doc.
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.

1 participant