cobed95 opened a new pull request, #4945:
URL: https://github.com/apache/polaris/pull/4945
## What & why
The Relational JDBC persistence backend hard-codes its database schema as
`POLARIS_SCHEMA` (in `QueryGenerator` and the bootstrap SQL scripts), so
operators cannot run multiple Polaris deployments in a single database or
comply with a schema-naming policy. This adds a configuration option to set
the schema, defaulting to `POLARIS_SCHEMA` so existing deployments are
unaffected.
New option: `polaris.persistence.relational.jdbc.schema-name`.
## Changes
- `RelationalJdbcConfiguration` exposes `schemaName()`; the Quarkus
`@ConfigMapping` picks it up for both the server and the admin tool.
- `QueryGenerator` becomes an instance bound to the schema (was a static
utility). `DatasourceOperations` resolves the value (default
`POLARIS_SCHEMA`), **validates it as a plain SQL identifier** โ it is
interpolated into SQL, not bound, so this closes the injection vector โ
and owns the `QueryGenerator`.
- Bootstrap SQL scripts (postgres / h2 / cockroachdb) use a `${schema}`
placeholder substituted in the single `executeScript` path, so the
configured schema is created and used consistently.
- Exposed as `persistence.relationalJdbc.schemaName` in the Helm chart
(values, configmap, regenerated schema/docs, unittest).
- Documented in the admin tool properties, metastore docs, config
reference, and `CHANGELOG.md`.
## Design note (for discussion)
This touches `RelationalJdbcConfiguration`, which is an extension point, so
per `CONTRIBUTING.md` I'm opening this as a **draft** pending a dev-list
discussion on the approach. Two points worth reviewer input:
1. Converting `QueryGenerator` from static to instance-based is the bulk of
the diff (mechanical call-site updates). An alternative would thread the
schema through method parameters; the instance approach seemed cleaner.
2. For the admin tool, the schema is exposed as the same config property
(not a separate CLI flag) so the admin tool and server cannot bootstrap
into different schemas.
Happy to adjust based on feedback.
## Testing
- `./gradlew :polaris-relational-jdbc:check` (unit tests, checkstyle,
spotless, errorprone) โ green.
- `./gradlew compileAll` โ green (no downstream breakage).
- Added unit tests: instance `QueryGenerator` with a custom schema, and
`DatasourceOperations` default / custom / invalid-schema resolution.
- Added a Helm configmap unittest for `schemaName` set and unset;
verified rendering with `helm template`.
## Checklist
- [ ] ๐ก๏ธ Don't disclose security issues! (contact [email protected])
- [x] ๐ Clearly explained why the changes are needed, or linked related
issues: Fixes #4944
- [x] ๐งช Added/updated tests with good coverage, or manually tested (and
explained how)
- [x] ๐ก Added comments for complex logic
- [x] ๐งพ Updated `CHANGELOG.md` (if needed)
- [x] ๐ Updated documentation in `site/content/in-dev/unreleased` (if needed)
---
_Disclosure: prepared with AI assistance (Claude Code); the author is
responsible for the change._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]