Skip to content

[Server] Convert view definitions, column type texts and function definitions to text with schema steps - #2394

Merged
yili-db merged 15 commits into
unitycatalog:mainfrom
shba24:uc-pr1928-flyway-steps
Dec 2, 2026
Merged

yili-db merged 15 commits into
unitycatalog:mainfrom
shba24:uc-pr1928-flyway-steps

Conversation

@shba24

@shba24 shba24 commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added or modified a feature, documentation in docs is updated

Description of changes

Completes #1928 by @s-maling-celonis, which drops @Lob from the entities that hold view definitions, column type texts and function definitions, so PostgreSQL stores them as text instead of large objects and listing tables no longer fetches each value separately. Schema steps V17 to V19 convert the existing PostgreSQL columns during --upgrade-schema, as step V4 does for credentials. H2 and MySQL are unchanged.

Changes on top of #1928: diff, from #1928's head.

Also in this PR: the Helm chart tests set up chart-testing once more, after a pause, when the setup fails. Its download from GitHub failed with HTTP 618 on this PR, a code the action's curl --retry does not retry.

Merge order: #1928 first, then this PR right after. In between, main's PostgreSQL schema checks fail.

Known gap: PostgreSQL text cannot hold a NUL character. A stored definition containing one makes the steps fail on every run, and --check-schema does not detect it beforehand.

📐 Design notes & details

Compatibility (PostgreSQL only):

  • Run bin/start-uc-server --upgrade-schema with the servers stopped.
  • Each step rewrites its table and locks it until it commits.
  • A release before these steps cannot read the converted columns, so going back needs the backup.
  • Database-level access to these values now follows table privileges instead of per-large-object privileges. Unity Catalog's own authorization is unchanged.
  • The old large objects stay in the database. vacuumlo removes them, but only run it when the database holds nothing but Unity Catalog, and dry-run it with -n first.

The gap in detail: steps V17 to V19 also fail when the database's encoding cannot hold a stored character, as step V4 does. After the upgrade, creating a definition with a NUL character fails, as it already does for other text columns.

Possible follow-up for the gap: --check-schema and --upgrade-schema could run each pending conversion as a read-only query before any step runs. That would report a NUL character, a missing large object or one the user cannot read, before anything changes.

Tests run:

  • server/testOnly io.unitycatalog.server.migrate.* with UC_TEST_MIGRATION_CHECKS=true on H2, PostgreSQL 18 and MySQL 8.
  • RealUpgradeTest with UC_TEST_UPGRADES=true on H2, PostgreSQL 18 and MySQL 8.
  • UC_TEST_DATABASE=POSTGRES_18 dev/run-tests.py, every project: 240 suites, 4,058 tests, 0 failed.

This pull request and its description were written by Isaac.

s-maling-celonis and others added 7 commits September 25, 2026 15:37
On PostgreSQL Hibernate maps a @lob String to an oid large object, and pgjdbc
reads each one with separate lo_open/loread/lo_close round trips. listTables
reads type_text for every column of a page, so a page of a wide schema spends
tens of seconds on those reads and the caller times out. Plain text columns
come back with the row.

This covers every @lob in the model: column type text, view definitions,
function routine definitions and credentials. The credential column gets an
explicit length so it maps to text rather than varchar(255).

Existing PostgreSQL databases still hold oid columns; the next commit converts
them before Hibernate's schema update runs.

Signed-off-by: s-maling-celonis <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
PostgreSQL databases written by the @lob mapping hold these columns as oid.
Left to Hibernate's schema update, the type change would cast each oid to its
decimal string and lose the value. Before the session factory is built, read
each large object into the column with lo_get and change the type to text.

The conversion checks the column type, so it does nothing on H2, MySQL or once
converted, and servers starting together serialize on an advisory lock. It
gives up after 30 s waiting for the table lock rather than stalling queries
behind it; the next start retries. The large objects themselves are left for
vacuumlo: unlinking takes one lock each, more than a single transaction can
hold on a large catalog.

Signed-off-by: s-maling-celonis <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The migration qualified tables with hibernate.default_schema unquoted. With
globally_quoted_identifiers, Hibernate targets "MixedCase" while PostgreSQL
folded the migration's MixedCase to mixedcase, so the oid columns went
unseen and the schema update cast them to decimal oid strings.

Take the names from the mapping metadata instead, formatted with the same
default schema, catalog and quoting settings the schema update uses, and
match them with to_regclass and parse_ident, which read quoted and unquoted
names as SQL does. The configurator builds the metadata first so the
migration can run between it and the session factory. The test now also
upgrades a quoted mixed-case default schema.

Signed-off-by: s-maling-celonis <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Upgrading now changes existing PostgreSQL column types. Describe what is
converted, the backup a rollback needs, stopping old servers first, the
downtime (the 30 s lock_timeout bounds only the wait; the conversion holds
ACCESS EXCLUSIVE locks until it commits), and the vacuumlo cleanup.

Signed-off-by: s-maling-celonis <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Under repeatable read the check after the advisory lock would reuse the
snapshot of the first check and miss a conversion another server made in
the meantime, so set read committed for the transaction.

Add a PostgreSQL test that blocks the last table's conversion, lets it
time out, checks that all four columns are still large objects with
their values, and then converts them on retry.

Signed-off-by: s-maling-celonis <[email protected]>
With hbm2ddl.auto set to none or validate, the server now refuses to
start while the columns are still oid, instead of altering them.
Document converting them by hand for those deployments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Signed-off-by: s-maling-celonis <[email protected]>
@shba24 shba24 closed this Nov 30, 2026
@shba24 shba24 reopened this Nov 30, 2026
@shba24
shba24 marked this pull request as draft November 30, 2026 23:35
@shba24
shba24 marked this pull request as ready for review November 30, 2026 23:48
@shba24
shba24 marked this pull request as draft November 30, 2026 23:59
@shba24

shba24 commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@shba24
shba24 marked this pull request as ready for review December 1, 2026 00:05
@yili-db

yili-db commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

/review

@timothyw553 timothyw553 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the conversion approach looks reasonable overall. i left a few comments about handling invalid stored values during the upgrade, the merge order with #1928, and splitting out the helm retry.

about the merge order in the PR description — if we merge #1928 first and rebase this PR after, wouldn't main fail postgresql schema checks in between? since this branch already includes #1928's changes, could we just land this PR and close #1928 as superseded so main stays green?

Comment thread .github/workflows/helm-chart-tests.yml Resolved
@shba24

shba24 commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thanks for the careful review, Tim! Good catch on the window where main would fail. #1928 now holds only the entity change, so we'll merge it first and this PR a few minutes after, back to back, which keeps that window to the minutes between the two merges.

@shba24

shba24 commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator Author

To clarify: we'll merge #1928 first and this PR right after it, back to back, so the window where main's PostgreSQL checks fail is only the minutes between the two merges.

@yili-db yili-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[AI Assisted] No blocker found. Migration checks pass on H2, PostgreSQL 18 and MySQL 8, and the restart and recovery paths behave as the docs describe.

Step numbering: V17 to V19 here collide with #2354 (V17 to V20) and #2369 (V17 to V20, including two Java migrations). Whichever of the three merges second needs its steps renumbered above the last merged step.

Before approval:

  • A failure test for V17 to V19 (inline).
  • The NUL and recovery note in the upgrades doc (inline).
  • The helm chart-testing retry in its own PR (inline).
  • DAO comment wording (inline).

Nits:

  • The description says "H2 and MySQL are unchanged". The stored schema is unchanged there, but the entity mapping changes on every database.
  • The NUL pre-check idea in the description has no tracking issue. Linking one from the docs section would help.

Comment thread docs/server/upgrades.md Resolved
Comment thread .github/workflows/helm-chart-tests.yml Resolved
@shba24
shba24 marked this pull request as draft December 1, 2026 07:34
@shba24
shba24 marked this pull request as ready for review December 1, 2026 08:45
@s-maling-celonis

Copy link
Copy Markdown
Contributor

thank you @shba24 completing this

Schema changes now ship as Flyway steps run by --upgrade-schema, so drop the startup conversion (LargeObjectColumnMigration, its test and the HibernateConfigurator changes) and the deployment guide section. Steps V17 to V19 in unitycatalog#2394 convert the PostgreSQL columns. CredentialDAO keeps main's mapping, which already stores the credential as text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Signed-off-by: Simon Maling <[email protected]>
shba24 and others added 6 commits December 1, 2026 09:33
Main runs schema changes as Flyway steps through --upgrade-schema, so
the conversion unitycatalog#1928 ran at server start becomes three PostgreSQL steps,
V17 to V19, for uc_tables.view_definition, uc_columns.type_text and
uc_functions.routine_definition. They use the conversion unitycatalog#1928 wrote,
convert_from(lo_get(c), 'UTF8'), the same form unitycatalog#2169 used for
uc_credentials.credential in step V4. The steps change nothing on H2
(clob) and MySQL (mediumtext).

LargeObjectColumnMigration and its test go away: --upgrade-schema
already holds the lock and runs with the servers stopped.

SchemaMigratorTest stores the three values as large objects at step 16
and reads them back through the entities after the upgrade. The upgrade
guide gets the steps next to the credentials one.

Co-authored-by: s-maling-celonis <[email protected]>
Signed-off-by: Shubham Bansal <[email protected]>
Co-authored-by: Isaac <[email protected]>
…new section

- SchemaMigratorTest also upgrades a table and a function without a
  definition, which stay NULL, and the credential insert takes its id
  from gen_random_uuid() as the column insert does.
- The upgrade guide says the user must be able to read every large object
  the three columns reference, and the rollback paragraph links the new
  section as well.
- The three DAO fields say why they are not @lob, as CredentialDAO does.

Signed-off-by: Shubham Bansal <[email protected]>
Co-authored-by: Isaac <[email protected]>
The new section told readers to run vacuumlo after step V19 without the
care the credentials section gives it: vacuumlo removes every large
object no column references, so it must run only when the database holds
nothing but Unity Catalog, after a dry run. The section also no longer
says which step takes longest, which depends on the catalog.

Signed-off-by: Shubham Bansal <[email protected]>
Co-authored-by: Isaac <[email protected]>
helm/chart-testing-action downloads chart-testing with curl --retry,
which retries only the errors curl counts as transient. GitHub's release
download failed with HTTP 618 on this PR's Helm jobs, which curl does not
retry, so one matrix job failed before the chart was linted or installed.
A failed setup now runs once more after a pause, with chart-testing
removed from the tool cache first: the action moves ct into the cache
before installing yamllint and Yamale, and skips that install when ct is
already there.

Signed-off-by: Shubham Bansal <[email protected]>
Co-authored-by: Isaac <[email protected]>
After steps V17 to V19, as after step V4, a database user with SELECT on
the tables reads these values directly; large object privileges no
longer apply to them.

Signed-off-by: Shubham Bansal <[email protected]>
Co-authored-by: Isaac <[email protected]>
The data set the real upgrade test writes now has a view, and its
definition, its column's type text and the function's definition are
over 255 characters with multi-byte characters. Release 0.7.0 stores
them as large objects on PostgreSQL; after steps V17 to V19 the current
server reads them back, and also writes and reads its own copy in the
upgraded database.

Signed-off-by: Shubham Bansal <[email protected]>
Co-authored-by: Isaac <[email protected]>
@shba24
shba24 force-pushed the uc-pr1928-flyway-steps branch from 9be3025 to 9d4b838 Compare December 1, 2026 09:34
@shba24

shba24 commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator Author

Replying to @yili-db on this review body:

[AI Assisted] No blocker found. Migration checks pass on H2, PostgreSQL 18 and MySQL 8, and the restart and recovery paths behave as the docs describe.

Step numbering: V17 to V19 here collide with #2354 (V17 to V20) and #2369 (V17 to V20, including two Java migrations). Whichever of the three merge

Thank you for the careful read. On the first point, you are right: dropping @​Lob changes the entity mapping on every database, and only the stored schema stays the same on H2 and MySQL. The sentence in the description should say that, instead of "H2 and MySQL are unchanged". I have not edited the description in this round. The code stays as it is, because the mapping and the steps behave correctly on every database.

On the second point, a docs link to a tracking issue would go against what we settled in the earlier thread on docs/server/upgrades.md: the NUL case goes in the release notes, not the upgrade guide, so I am not adding a link there. The NUL pre-check stays a possible follow-up in the PR description. That follow-up is not filed yet.

@yili-db

yili-db commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

/review

@timothyw553 timothyw553 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

overall looks good. left one small doc nit on the upgrade guide.

Comment thread docs/server/upgrades.md
On PostgreSQL, schema steps V17 to V19 store `uc_tables.view_definition`, `uc_columns.type_text`
and `uc_functions.routine_definition` as text instead of large objects, the way step V4 stores
credentials. A server then reads them with the rows instead of fetching each large object, which
made listing tables with many columns slow. The steps change nothing on H2 and MySQL. Afterwards,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: the v4 section above only talks about large-object SELECT grants during the upgrade and doesn't mention that table-level SELECT exposes converted credentials afterward. should we add a sentence there too so this reference lines up?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for reading the two sections against each other. The "Credentials as text" section stays as it is in this pull request. It is about what --upgrade-schema needs during step V4, the large-object SELECT grants. The new section on view definitions, column type texts and function definitions states the table-level SELECT change for its own tables and points back to credentials. This is a one-sentence nit and I am leaving it out of this pull request to keep it to the conversion. If you ask for it again, I will add the sentence in the next round.

yili-db pushed a commit that referenced this pull request Dec 2, 2026
…itions as text (#1928)

**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [ ] If there is a related issue, make sure it is linked to this PR.
- [ ] If you've fixed a bug or added code that should be tested, add
tests! (in #2394)
- [ ] If you've added or modified a feature, documentation in `docs` is
updated (in #2394)

**Description of changes**

On PostgreSQL, Hibernate stores a `@Lob String` as an `oid` large
object, and pgjdbc reads each value with separate
`lo_open`/`loread`/`lo_close` round trips. `listTables` reads
`type_text` for every column of a page, so on a schema with a few
thousand columns one page spent about 37 s in these reads.

This PR drops `@Lob` from `ColumnInfoDAO.typeText`,
`TableInfoDAO.viewDefinition` and `FunctionInfoDAO.routineDefinition`,
so they map like `type_json`:

| Database | Column type |
|---|---|
| PostgreSQL | `oid` → `text` |
| MySQL | `mediumtext`, unchanged |
| H2 | `clob`, unchanged |

`uc_credentials.credential` is not part of this PR anymore: main already
stores it as text (step V4).

**Converting existing databases: #2394**

#2394 by @shba24 adds schema steps V17 to V19, which convert the
existing PostgreSQL columns during `bin/start-uc-server
--upgrade-schema`, plus the tests and the upgrade notes in
`docs/server/upgrades.md`. The startup conversion this PR originally had
is gone; schema changes now ship as Flyway steps.

**Merge order:** this PR first, then #2394 right after. In between,
main's PostgreSQL schema checks fail, because the entities no longer
match the schema the steps build.

**Tests run** (H2):
- `server/compile` and `server/javafmtCheckAll`
- `BaselineMatchesEntitiesTest` and `MigrationStepRulesTest` with
`UC_TEST_MIGRATION_CHECKS=true`
- `SdkTableCRUDTest` and `SdkFunctionCRUDTest`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: s-maling-celonis <[email protected]>
Signed-off-by: Simon Maling <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
- Resolve the three DAO conflicts by keeping this branch's comment above the former `@Lob` columns
- `@Lob` removal itself now comes from main (unitycatalog#1928)

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Yi Li <[email protected]>
@yili-db

yili-db commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

/review

@yili-db
yili-db merged commit 56fd6f7 into unitycatalog:main Dec 2, 2026
26 checks passed
yili-db added a commit that referenced this pull request Dec 2, 2026
… on the external location (#2289)

## 🥞 Stacked PR
Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/2289/files) to
review incremental changes.
-
[**stack/s3compat_location_endpoint**](#2289)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2289/files)]
← _this PR_
-
[stack/s3compat_external_location_id](#2395)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2395/files/279e4214f62311816d4cec93fd0150a021d5f495..8a58c1528404e758093091408a9a4266eeb581e4)]

---------
Finalizes S3-compatible storage, which the stack #2170 to #2175 and
#2169 (all merged) built.

**Description of changes**

**Why.** The S3 endpoint belongs to the storage a location is on, not to
the key pair that reaches it. With the endpoint on the credential, one
credential could not serve locations on several storage hosts, and
moving a bucket to a new host meant editing the credential. This PR
moves the endpoint, and whether its requests are path-style, to the
external location. The vend returns the location's settings beside the
keys, so a client always gets the endpoint, region and addressing style
that match the keys it signs with. It also takes the feature out of
experimental status.

**API** (`api/all.yaml`, `api/delta.yaml`, regenerated `api/` docs)

Storage credential and external location:

```json
{"name": "aistor_cred", "purpose": "STORAGE",
 "s3_compatible_access_key": {"access_key_id": "uc-user", "secret_access_key": "...",
                              "sts_endpoint": "https://sts.example.com", "role_arn": "arn:aws:iam:::role/uc-tables"}}

{"name": "aistor_loc", "url": "s3://sales/tables", "credential_name": "aistor_cred",
 "endpoint": "https://aistor.example.com", "path_style_access": true}
```

Vended credentials (`TemporaryCredentials`):

```json
{"aws_temp_credentials": {"access_key_id": "...", "secret_access_key": "...", "session_token": "..."},
 "expiration_time": 1764200000000,
 "external_location_settings": {
   "s3_compatible": {"endpoint": "https://aistor.example.com", "region": "us-east-1", "path_style_access": true}}}
```

- The credential field `s3_compatible` is renamed
`s3_compatible_access_key` (`S3CompatibleAccessKeyRequest`/`Response`).
It holds the keys plus the optional flat STS fields `sts_endpoint` and
`role_arn`. `s3_endpoint`, the nested `assume_role` (`S3AssumeRole`) and
`sts_region` are removed.
- `CreateExternalLocation`, `UpdateExternalLocation` and
`ExternalLocationInfo` get `endpoint` (`http[s]://host[:port]`, at most
2048 characters, without a path) and `path_style_access` (boolean).
`UpdateExternalLocation.path_style_access` has its own description: it
needs a stored `endpoint`, and leaving it out keeps the stored value.
- A location's `endpoint` and a credential's `sts_endpoint` are stored,
returned and vended with the scheme and host in lowercase. The
`sts_endpoint` text states the same `http[s]://host[:port]` form, and
`updateExternalLocation` says which rules fail with `INVALID_ARGUMENT`.
- The schemas carry the server's limits: `maxLength: 2048` on the
endpoint, `minLength: 1` on the keys, and `pattern: '^arn:'` on
`role_arn`. Vended credentials carry the location's `endpoint`; a
credential's `sts_endpoint` is only where the server calls STS, and is
never vended.
- `ui/src/types/api/catalog.gen.ts` is regenerated from `api/all.yaml`,
which also picks up earlier spec changes it was missing (`browse_only`,
`include_browse`, the required `purpose`).
- `TemporaryCredentials` gets `external_location_settings`
(`ExternalLocationSettings`), set exactly when the path is on
S3-compatible storage. It has `s3_compatible` (`endpoint`, `region`,
`path_style_access`). `AwsCredentials` carries only keys again:
`s3_endpoint` and `s3_region` are removed. An endpoint-only vend returns
the settings and `expiration_time` without `aws_temp_credentials`.
- Delta API: the credential `config` key map carries `s3.endpoint`,
`client.region` and `s3.path-style-access`, the same keys the Iceberg
REST config uses.
- No "EXPERIMENTAL" labels remain on S3-compatible storage.
- `spec/protocols/ManagedDeltaTablesSpec.md` matches `api/delta.yaml`:
the config carries `s3.endpoint`, `client.region` and the boolean
`s3.path-style-access`, so its values are strings or a boolean, and a
false or absent `s3.path-style-access` means virtual-hosted.

**Rules**
- A location has an `endpoint`, and may have `path_style_access`,
exactly when it is on S3-compatible storage: required with an
`s3_compatible_access_key` credential, refused with another, and kept
after its credential is force-deleted. An update that leaves either out
keeps the stored value.
- A missing or false `path_style_access` means virtual-hosted. Then the
bucket name must be a host name label: 3 to 63 lowercase letters, digits
and hyphens, a letter or digit at both ends, and no dots, since a dot
breaks wildcard TLS certificates. Create and update refuse other names
and name the bucket. `ExternalLocationInfo` always returns
`path_style_access` when the location has an `endpoint`.
- STS is on when `role_arn` is set. It holds the ARN of the role to
assume, for example `arn:aws:iam:::role/uc-tables`, sent unchanged as
AssumeRole's `RoleArn`; a value that doesn't start with `arn:` is
refused. Storage that ignores the role, such as MinIO, still needs an
ARN-shaped value. `sts_endpoint` is allowed only with `role_arn`.
Without it, AssumeRole goes to the location's endpoint, signed with the
bucket region the server detects.
- A location keeps its storage kind, which its stored `endpoint`
decides, also after its credential was force-deleted. A location with an
endpoint can only get another `s3_compatible_access_key` credential; one
without can get neither an endpoint, nor `path_style_access`, nor such a
credential. Moving a location to other storage means deleting it and
creating a new one, so an update can't clear `endpoint` or
`path_style_access`. A credential's type can't change while a location
uses it; new keys or a new role can.
- Changing `endpoint` or `path_style_access` of a location in use is
refused unless `force` is set, with the same in-use check as a URL
change. Resending the stored value isn't a change, and neither is an
`endpoint` that differs only in the case of its scheme or host.
- A location whose credential was force-deleted still checks its own
settings on update: the endpoint form and length, the `s3://` URL, and
the bucket rule for virtual-hosted addressing. Vending under it fails
until it is repaired.

**Server**
- Schema steps `V20__external_location_endpoint` (nullable
`varchar(2048)`) and `V21__external_location_path_style_access`
(nullable boolean, `bit` on MySQL), with their effect files. A
virtual-hosted location stores `false`, so the column is null exactly
without an endpoint.
- `ExternalLocationUtils.getExternalLocationCredentialForPath` returns
the location together with its credential, read from one snapshot
(`TransactionManager.snapshotIsolation`: REPEATABLE READ on PostgreSQL
and MySQL, SERIALIZABLE on H2), so a vend never pairs a location with a
credential from another committed state. A location of an
`s3_compatible_access_key` credential without an endpoint fails the vend
with `INTERNAL`, so keys are never sent to AWS S3 by mistake.
- The location's endpoint, detected region and path style travel through
`CredentialContext` and the vend cache key into
`external_location_settings`; the `endpoint-only` client response, built
after the cache in `StorageCredentialVendorImpl`, carries the same
settings; the Iceberg REST config (`s3.endpoint`, `client.region`,
`s3.path-style-access`) and the Delta config. Region discovery addresses
the bucket as the location says.
- The server property `server.s3-compatible-storage.enabled` is removed,
with every guard that read it. The encryption key
`server.credential-encryption-key` is now read whenever it's set: a
malformed key refuses startup. Without a key, creating or updating an
`s3_compatible_access_key` secret fails with `FAILED_PRECONDITION`,
while stored credentials stay readable, renamable and deletable.
`server.s3-compatible-storage.static-key-vending` is unchanged.

**Clients**
- Hadoop connector: reads the endpoint, region and path style from
`external_location_settings.s3_compatible`. Settings that are absent
mean AWS S3, and a missing `path_style_access` means virtual-hosted. It
sets `fs.s3a.bucket.<bucket>.path.style.access`, records the style per
bucket and in the file system cache id, and renewal refuses a changed
style just as it refuses a changed endpoint.
- CLI:
- `credential create`/`update`: `--s3_endpoint` and `--s3_sts_region`
are removed, and `--s3_role_arn` sets `role_arn`.
- `external_location create`/`update`: new `--endpoint` and
`--path_style_access`.
  - The Delta Kernel path reads the location's settings.
- `docs/usage/cli.md` documents `--endpoint` and `--path_style_access`
on `external_location create`/`update`, and that `--force` also covers
an endpoint or path-style change on a location in use.
- Docs, Helm and `etc/conf/server.properties` use the new names and no
longer mention the enable property. The chart needs only
`server.credentialEncryptionKeySecret`, and the Helm CI install case
passes only the key Secret.

**Tests**
- External location CRUD (SDK and CLI): the endpoint rules and forms
(including an over-long one), one credential on two endpoints, the
storage-kind refusals, key and role changes of credentials in use,
endpoint and path-style changes while in use (with and without `force`),
locations whose credential was force-deleted, and `path_style_access`
defaults, updates and the bucket-name rule.
- Vending under an S3-compatible location whose credential was
force-deleted fails, and works again after repair.
- Mixed-case `endpoint` and `sts_endpoint` values on create and update
are stored, returned and vended lowercased, and a case-only `endpoint`
edit on a location in use needs no `force`.
- Region discovery for one bucket on one endpoint with both addressing
styles: `forcePathStyle(true)` and `forcePathStyle(false)`, cached
apart.
- Credential CRUD and DAO: `role_arn` and `sts_endpoint` validation.
- Vending, unit and on real storage: the settings for STS sessions,
static keys and endpoint-only vends. AssumeRole gets the role's ARN, the
detected region, and the location endpoint as fallback.
- The cache key includes the path style.
- The Iceberg and Delta configs, for both path-style values.
- AWS S3 credentials from the UC API, the Delta API and the constructors
are equal: the path style is only kept with an endpoint, and a missing
flag is virtual-hosted.
- The cached credential id (`FileSystemCredId.create(Configuration)`)
differs by endpoint, region and path style.
- Connector and CLI settings, including renewal refusing a changed
style, a bucket whose two paths differ only in style, and a cached
credential not shared across styles. Both new connector tests fail when
the style check or the `pathStyle.` key of the cache id is removed.
- Secret store and repository behavior without a key or with a malformed
one.
- The real-storage harness reaches its containers at `127.0.0.1` ports,
so its locations set `path_style_access: true`. Virtual-hosted
addressing isn't run against real storage.

Follow-ups: `external_location_id` in `ExternalLocationSettings` (#2395,
stacked on this PR); `ExternalLocationSettings` entries for other
storage types: `s3` (with `region`), `adls` and `gcs`.

**Compatibility.** S3-compatible storage hasn't been released, so these
API, property and CLI changes need no compatibility shim, and no data is
migrated. Credentials, locations and vends for other storage are
unchanged.

**Tests run** on the final head, rebased onto main with #2268, #1928 and
#2394:
- `io.unitycatalog.server.migrate.*` with
`UC_TEST_MIGRATION_CHECKS=true` on H2, PostgreSQL 18 and MySQL 8: 241
tests each.
- `dev/run-tests.py`, full suite on H2: 4,085 tests.
- The server suite on PostgreSQL 18 and on MySQL 8: 1,779 tests each.
- On MinIO (`UC_TEST_STORAGE=MINIO`): the S3-compatible, external
location and credential tests plus `spark/test`, 576 tests.
- The Hadoop connector tests (1,530), on the head before the last
rebase.
- The Helm workflow's lint and render checks, and `helm/README.md`
regenerated with helm-docs v1.14.2.
- Regenerating the API docs and the UI types leaves no diff; `yarn
test:format` passes in `ui/`, and `tsc --noEmit` reports no errors
outside `node_modules`, as before.

On an earlier head, before the endpoint length limit: the S3-compatible
tests plus `spark/test` on Garage (555). All pass.

**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [ ] If there is a related issue, make sure it is linked to this PR.
- [x] If you've fixed a bug or added code that should be tested, add
tests!
- [x] If you've added or modified a feature, documentation in `docs` is
updated

This pull request and its description were written by Isaac.

---------

Signed-off-by: Yi Li <[email protected]>
Co-authored-by: Isaac <[email protected]>
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