Skip to content

[Server][OpenSharing 6/6] Serve the Delta Sharing protocol and recipient activation from Unity Catalog - #1825

Open
littlegrasscao wants to merge 8 commits into
unitycatalog:mainfrom
littlegrasscao:opensharing-embedded
Open

littlegrasscao wants to merge 8 commits into
unitycatalog:mainfrom
littlegrasscao:opensharing-embedded

Conversation

@littlegrasscao

@littlegrasscao littlegrasscao commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

🥞 Stacked PR

Each PR builds on the one before it. Until the earlier PRs merge, a later PR's "Files changed" tab also shows their changes, so use these links to review one PR's own change:

  • Own change: that PR's own commits, inside the PR, so you can comment. The link is updated after each push.
  • Branch compare: the same diff between the fork's branches. It never goes stale, but it is read-only.
# PR Own change Branch compare
1 #2145 Unity Catalog connector and dependencies Files changed main...sharing/connector
2 #2151 OpenSharing's tables in UC's schema steps Files changed sharing/connector...sharing/schema
3 #2152 Authorization for shares and recipients Files changed sharing/schema...sharing/auth
4 #2146 Share API Files changed sharing/auth...sharing/provider-shares
5 #2147 Recipient API and share grants Files changed sharing/provider-shares...sharing/provider-recipients
6 #1825 Sharing protocol and recipient activation ← this PR Files changed sharing/provider-recipients...opensharing-embedded

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: etc/conf/server.properties is updated, but there's no page yet on setting up sharing.

Description of changes

Part 4 of 4 of embedded OpenSharing, which lets one Unity Catalog server share the Delta tables it governs with Delta Sharing recipients.

The four PRs, each building on the one before:

  1. [Server][OpenSharing 1/6] Add the Unity Catalog connector for OpenSharing #2145: the Unity Catalog connector for OpenSharing
  2. [Server][OpenSharing 4/6] Serve OpenSharing's share API from Unity Catalog #2146: the share API (review copy: [Server] Serve OpenSharing's share API from Unity Catalog littlegrasscao/unitycatalog#1)
  3. [Server][OpenSharing 5/6] Serve OpenSharing's recipient API and share grants from Unity Catalog #2147: the recipient API and share grants (review copy: [Server] Serve OpenSharing's recipient API and share grants from Unity Catalog littlegrasscao/unitycatalog#2)
  4. [Server][OpenSharing 6/6] Serve the Delta Sharing protocol and recipient activation from Unity Catalog #1825: the sharing protocol and recipient activation (this PR; review copy: [Server] Serve the Delta Sharing protocol and recipient activation from Unity Catalog littlegrasscao/unitycatalog#3)

GitHub can't stack PRs from a fork, so this PR also shows the earlier PRs' changes until they merge. To see only its own change, review littlegrasscao#3: a draft copy on my fork, based on the previous PR's branch. It won't be merged; this PR will.

This PR lets recipients in. It serves the sharing protocol at /api/1.0/opensharing (Delta Sharing, plus OpenSharing's listing endpoints), and recipient activation at /api/1.0/opensharing/activations, on UC's port.

  • Recipients authenticate with OpenSharing bearer tokens, not UC JWTs. So these routes sit outside UC's security decorators. The new ArmeriaServerBuilder.selfAuthenticated registers them on UC's API virtual host.
  • UC doesn't accept a recipient token, and the protocol doesn't accept a UC token.
  • Profile files name the public URL, as activation links already do.
  • Recipient reads. A recipient's read goes through the connector's check, as the share's owner, both when the table is resolved and when credentials are vended. So revoking the owner's SELECT cuts recipients off on their next request, and to them the table is gone, as if dropped. The same happens when the owner is deleted, since UC keeps a deleted user, disabled.

Tests

  • OpenSharingEmbeddedTest:
    • The recipient flow, through activation and the protocol, with the public URL in links and profiles. Activation works only once, and tokens are isolated in both directions.
    • Access is lost when the share owner's SELECT is revoked, or the owner is deleted.
  • OpenSharingDisabledTest checks that the protocol isn't served when the flag is off.

I ran these on JDK 17, against opensharing-server-core 0.1.0 as published on Maven Central:

  • build/sbt serverSharing/test: 15 tests, all pass.
  • build/sbt "server/testOnly io.unitycatalog.server.UnityCatalogServerTest io.unitycatalog.server.ArmeriaServerBuilderTest io.unitycatalog.server.UnityCatalogServerShutdownTest": 18 tests, all pass.
  • build/sbt server/test on the whole change before it was split, which differs from this branch only in the order of the four new privileges: 1238 tests. All pass except LocalStorageLocationValidatorTest, which fails the same way on main on macOS.

End to end with OSS Spark

I ran UC from server-embedded with authorization on, before the split. It served two tables from the Delta Sharing test data in S3: table1 (3 versions), and a table with the change data feed enabled.

As the UC admin, I created a share, added both tables, created a recipient, granted it the share, and activated its profile. The recipient then read the tables with Spark 4.0.1 and delta-sharing-spark 4.1.0. All eight checks pass, four reads in both the parquet and delta response formats:

  • a snapshot read
  • a filter that matches nothing
  • versionAsOf 1
  • readChangeFeed over versions 0 to 3, which returns six changes

Known gaps

  • Audit: credential vending is audited with the user from UC's JWT. A recipient's read has no UC JWT, so its audit event has no user.
  • Local tables: file: tables can be shared and listed, but recipients can't read them. OpenSharing reads only from cloud storage it has credentials for, so version, metadata and query requests answer 502.
  • Docs: there's no page yet on setting up sharing.

Compatibility

  • Nothing changes with the flag off.

@littlegrasscao littlegrasscao changed the title Run OpenSharing embedded, as a Delta Sharing / Iceberg REST provider Embed OpenSharing to serve Delta Sharing from Unity Catalog Nov 4, 2026
@littlegrasscao littlegrasscao changed the title Embed OpenSharing to serve Delta Sharing from Unity Catalog [Server] Serve Delta Sharing from embedded OpenSharing Nov 6, 2026
@littlegrasscao littlegrasscao changed the title [Server] Serve Delta Sharing from embedded OpenSharing [Server] Serve the Delta Sharing protocol and recipient activation from Unity Catalog Nov 6, 2026
@littlegrasscao
littlegrasscao force-pushed the opensharing-embedded branch 2 times, most recently from cc72729 to b62dbb6 Compare November 8, 2026 00:02
@littlegrasscao
littlegrasscao force-pushed the opensharing-embedded branch 5 times, most recently from 2f780c1 to 674b6bd Compare November 11, 2026 17:11
Sun Cao and others added 8 commits November 17, 2026 22:15
The connector is how embedded OpenSharing reads Unity Catalog: it
resolves a table only for a user UC lets read its data, and vends that
table's read-only credentials with UC's credential vendor, refusing any
other operation instead of downgrading it. Nothing serves OpenSharing
yet.

opensharing-server-core is an ordinary dependency of the server module,
like Iceberg, and the connector lives in the server's service/sharing
package, so every packaging path that collects the server's classpath
carries it. Its Hadoop modules stay on hadoopVersion, Delta Kernel's
defaults stay on the server's Delta version, and the published
unitycatalog-client and unitycatalog-hadoop that delta-storage brings in
are excluded.

hadoop-client-runtime registers its relocated Woodstox for StAX, which
breaks Jackson's XML mapper (S3Mock, the Azure SDK), so the server sets
the StAX factory system properties to Woodstox's own. The shaded server
that the Spark connector tests use leaves out the modules that only
OpenSharing adds, by module name.

Signed-off-by: Sun Cao <[email protected]>

Consume OpenSharing 0.1.1

Bump opensharing-server-core to 0.1.1. OpenSharing now matches the AWS
SDK and Delta Kernel versions this server uses, so those pins are gone.
It builds against a newer Hadoop, so the server keeps overriding the
Hadoop modules to hadoopVersion. Its core excludes the published Unity
Catalog jars from delta-storage itself, so the exclusion here is gone.
The connector reports whether the caller owns the metastore in the
user context's admin flag, which lets them transfer the ownership of
any share or recipient.

Co-authored-by: Isaac <[email protected]>
Keep OpenSharing's Delta and Hadoop versions in the POM and initialize Woodstox for builder-started servers.

Signed-off-by: Sun Cao <[email protected]>

Co-authored-by: Isaac <[email protected]>
OpenSharing reads the admin flag only to let a caller transfer the ownership
of a share or recipient. UC checks that with the AuthorizeExpression on the
provider endpoints, and OpenSharingProviderService sets the flag on the
context it passes in, so the connector's authorize has nothing to decide.

Signed-off-by: Sun Cao <[email protected]>
Co-authored-by: Isaac <[email protected]>
OpenSharing's six tables (os_shares, os_share_properties, os_shared_data_objects, os_recipients, os_share_permissions and os_recipient_tokens) are Unity Catalog schema steps, V4 through V11, for H2, PostgreSQL and MySQL: one statement per step, the tables in foreign-key order, then the owner_id indexes. They are created whether or not embedded OpenSharing is enabled, and the steps build the schema Hibernate builds from OpenSharing's entities, which UC's own session factory now maps. Each step ships its H2 effect file; the PostgreSQL and MySQL ones follow from a run with Docker.

HibernateTransactions runs OpenSharing's store work in sessions of that factory, and joins a transaction the thread already has, so a caller can make several OpenSharing calls and its own steps one unit of work. The schema migrator and the schema snapshot treat os_* tables as Unity Catalog's own, so the steps' index names are not blamed on another application and the snapshots see the tables the steps create.

Signed-off-by: Sun Cao <[email protected]>

Match OpenSharing 0.1.1's schema

OpenSharing 0.1.1 stores ids as the database's native uuid (binary(16) on MySQL), its enums as plain varchar through converters, and names its foreign keys. The steps build the same columns, types and names its V1 does on each dialect, and the owner_id indexes its entities declare.

Co-authored-by: Isaac <[email protected]>
Shares and recipients become securable types, with CREATE SHARE, USE
SHARE, CREATE RECIPIENT and USE RECIPIENT as privileges on the
metastore. UC grants nothing on a share or recipient itself, so
validation of grants, the authorization hierarchy and the OPA input
treat them as roots, and the permissions API refuses them.

The key mapper resolves a share or recipient by name from OpenSharing's
tables, and answers a missing one with the NOT_FOUND that UC gives for
any missing object, not OpenSharing's own exception. It reads those
tables only when asked for such a key, which only OpenSharing's provider
API, once enabled, produces. The result filter reads the ids of
OpenSharing's share and recipient responses.

Signed-off-by: Sun Cao <[email protected]>

Read OpenSharing 0.1.1's UUID ids

OpenSharing 0.1.1 keys its entities by UUID, so the OPA input and the
key mapper look them up directly instead of by their string form, and
the JSON still carries the string form.

Co-authored-by: Isaac <[email protected]>
With server.opensharing.enabled=true, the server serves OpenSharing's
provider API for shares at /api/2.1/unity-catalog/opensharing/provider,
behind UC's authentication and authorization. It is registered as the
OPENSHARING protocol of ArmeriaServerBuilder next to Iceberg and Delta,
with OpenSharing's JSON mapper and error dialect. UC records each
share's owner in its authorizer, in the same transaction as the share
itself. A share that does not exist is OpenSharing's 404 on these
routes. With the flag off, none of this is registered and none of
OpenSharing's tables is read or written.

A sharing docs page describes the provider API, its privileges, how
shared tables are read, and the database tables.

Signed-off-by: Sun Cao <[email protected]>

Consume OpenSharing 0.1.1 and support admin ownership transfers

The provider service answers with OpenSharing's JSON, so its methods
carry ProducesJson: without it Armeria found no response converter and
answered 500. The caller's context now says whether they own the
metastore, and PATCH /shares/{share} takes a catalog admin transferring
the ownership to the body's ownerId, on its own, with UC's owner record
moving to the new owner in the same transaction.

Co-authored-by: Isaac <[email protected]>
The provider API now also creates, reads, changes and deletes
recipients, rotates their tokens, and grants shares to them. UC records
each recipient's owner in its authorizer, in the same transaction as the
recipient itself. Granting a share to a recipient takes owning the
share, and owning the recipient or USE RECIPIENT, checked by annotation
with the recipient read from the typed body, so a request grants to one
recipient at most. Activation links are built on
server.opensharing.public-url, which embedded OpenSharing now requires.
The sharing docs page covers the new endpoints and privileges.

Signed-off-by: Sun Cao <[email protected]>

Support admin ownership transfers of recipients

PATCH /recipients/{recipient} takes a catalog admin transferring the
ownership to the body's ownerId, on its own, with UC's owner record
moving to the new owner in the same transaction.

Co-authored-by: Isaac <[email protected]>

Document ownership transfers in the sharing docs

Co-authored-by: Isaac <[email protected]>
…Catalog

Recipients activate at /api/1.0/opensharing/activations and read shared
tables over the sharing protocol at /api/1.0/opensharing, on UC's port.
They authenticate with OpenSharing's bearer tokens, so these routes sit
outside UC's security decorators: ArmeriaServerBuilder.selfAuthenticated
registers them on the API virtual host. Profiles name the public URL.
The sharing docs page describes recipient access.

Signed-off-by: Sun Cao <[email protected]>

Co-authored-by: Isaac <[email protected]>

This branch has not been deployed

No deployments
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