feat (Synchronizer): forward realm-context header on all Polaris requests - #262
Open
saidixith002 wants to merge 2 commits into
Open
feat (Synchronizer): forward realm-context header on all Polaris requests#262saidixith002 wants to merge 2 commits into
saidixith002 wants to merge 2 commits into
Conversation
Polaris supports a configurable realm-context header (polaris.realm-context.header-name, default Polaris-Realm) for selecting which realm a request targets. The synchronizer client sent no such header on any call. Adds two new source/target properties: realm (the value to send; omitted entirely if unset) and realm-header-name (override, defaults to Polaris-Realm), forwarded on Management API calls, standard Iceberg REST catalog calls via the existing header.* property convention, and the manual loadTable ETag path that bypasses that convention.
AuthenticationSessionWrapper's own HTTPClient never attached the realm header, so the initial client_credentials token fetch went out unrealmed and some deployments reject it before any management/catalog API call ever happens.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Polaris supports a configurable realm-context header for routing requests to a specific realm:
polaris.realm-context.header-name=Polaris-Realm # or a custom name, e.g. catalog-realm
polaris.realm-context.realms=POLARIS,LAKEHOUSE
polaris.realm-context.require-header=false
polaris-synchronizercurrently sends no realm header on any request, which breaks (or silently defaults to the wrong realm) when talking to a Polaris instance withmulti-realm support enabled. This PR forwards a configurable realm header on every outgoing call to Polaris — both Management API calls and Iceberg REST Catalog calls.
Changes
Two new properties are accepted via
--source-properties/--target-properties:realmPOLARIS). If unset, no header is sent at all — fully backward compatible with single-realm deployments andrequire-header=falsedefault.realm-header-namePolaris-Realmpolaris.realm-context.header-name.Source and target are configured independently, since each can point at a different realm.
The header is wired into all three client-side call paths:
PolarisApiService— added to the Management API's request interceptor, alongside the existing OAuth session headers.PolarisIcebergCatalogService— added as aheader.<realm-header-name>catalog property, which Iceberg'sRESTSessionCatalogautomatically converts into an HTTPheader on every standard REST catalog call (list/create/drop namespaces & tables, etc.) — verified via bytecode inspection of
iceberg-corethat this is a genuine built-inconvention (
RESTSessionCatalog.configHeaders()→RESTUtil.extractPrefixMap(properties, "header.")).PolarisCatalog#loadTable(TableIdentifier, String etag)— this method builds a rawHttpRequestmanually to support ETag handling and bypasses the catalog's normalheader pipeline, so the header is attached explicitly here too.
CLIUtildocumentation for--source-properties/--target-propertieswas updated to describe both new keys.Backward compatibility
No behavior change for existing users:
realmis optional and omitted by default, so no header is sent unless explicitly configured — matching Polaris's ownrequire-header=falsedefault.Testing
No existing unit tests cover
PolarisApiService,PolarisIcebergCatalogService, orPolarisCatalogdirectly (they wrap live HTTP clients), so no new tests were added —consistent with current coverage for these classes. Manually verified against a Polaris instance configured with
polaris.realm-context.require-header=truethat requestsfail without
realmset and succeed once it's provided.