Repository navigation
[Server][OpenSharing 1/6] Add the Unity Catalog connector for OpenSharing - #2145
littlegrasscao wants to merge 4 commits into
Conversation
0e9a704 to
191a789
Compare
9f202d8 to
d9b8c92
Compare
cdd6fa7 to
acd6905
Compare
| private MetricsRegistries.PrometheusMetrics metrics; | ||
|
|
||
| static { | ||
| useWoodstoxForStax(); |
There was a problem hiding this comment.
can we make sure that anything needed for sharing is behind a server property (basically a feature flag, default off)
There was a problem hiding this comment.
This one is needed for code compilation due to new dependency introduced. Let me explore if it can be guard behind a flag.
Later stack has a flag to guard OpenSharing itself.
There was a problem hiding this comment.
Update: this can't go behind the flag, but not because of compilation. OpenSharing is embedded, so its hadoop-client-runtime dependency is on the server's classpath even when sharing is off. That jar registers a relocated Woodstox as the StAX provider, and the JVM can pick it up at runtime, which breaks Jackson XML, which the server already uses. useWoodstoxForStax() pins StAX to Woodstox's own factories, the same ones main uses today, so with the flag off the server behaves as it does on main. Gating it would cause exactly the flag-off change we want to avoid. Keeping those jars off the classpath when sharing is off would need a separately loaded module, which is a larger change.
What the flag does gate: starting OpenSharing, its routes and the provider API. The os_* schema steps run either way: Flyway steps are numbered, so skipping them would break upgrades for anyone who turns sharing on later.
There was a problem hiding this comment.
Yes I agree that things not directly enabling sharing can avoid this flag guarding:
- Flyway table schema versioning of
os_tables - Dependency and compilation
- Any setup can't be easily turned off, but doesn't enable any sharing functionality
acd6905 to
8daff29
Compare
5a8e6fe to
b24d132
Compare
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]>
b24d132 to
e5fdd23
Compare
Signed-off-by: Sun Cao <[email protected]> Co-authored-by: Isaac <[email protected]>
|
/review |
🥞 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:
PR Checklist
docsis updated: nothing is served yet. [Server][OpenSharing 4/6] Serve OpenSharing's share API from Unity Catalog #2146 adds the docs.Description of changes
This is part 1 of 6 of embedded OpenSharing. OpenSharing lets a Unity Catalog server share the Delta tables it governs with Delta Sharing recipients. It stays off unless
server.opensharing.enabled=true.Each PR builds on the one before. GitHub can't stack PRs from a fork, so the "Files changed" links above show each PR's own change.
This PR adds the connector to
serverand the dependency onio.opensharing:opensharing-server-core:0.1.1. Nothing starts or serves OpenSharing yet.The connector
UnityCatalogCatalogConnectoris how OpenSharing reads Unity Catalog. It uses UC's repositories, its access expressions and its credential vendor.USE CATALOG,USE SCHEMAandSELECT, or ownership.READ METADATAalone isn't enough. It refuses tables that aren't Delta or have no storage location.server.properties.authorizeonly checks that the caller is an enabled UC user, and never marks them as an admin. The provider API in later PRs checks sharing privileges, including who may transfer a share's or recipient's ownership, withAuthorizeExpressionannotations before calling OpenSharing, and sets the admin flag itself.Dependencies
delta-kernel-defaultsanddelta-storageare direct dependencies, and also overrides, atdeltaVersion, so they move withdelta-kernel-api. Both excludeunitycatalog-clientandunitycatalog-hadoop, as OpenSharing's own POM does. Those are older published UC jars that would shadow the server's own classes.hadoop-client-runtime,hadoop-awsandhadoop-azuredirectly. That way the publishedunitycatalog-serverPOM pins them too; sbt'sdependencyOverridesdon't reach the POM. In UC's resolved classpath, the libraries 3.4.3 upgraded are already at newer versions or absent.hadoop-azureexcludes Jetty 9.4 (jetty-util,jetty-util-ajax) and the WASB SDK (azure-storage,azure-keyvault-core). OpenSharing reads onlyabfs/abfss, and the ABFS classes don't reference these jars. Exclude hadoop-azure's unused WASB and Jetty 9.4 jars from core OpenSharing-IO/OpenSharing#183, now merged, makes the same exclusions inopensharing-server-core.commons-poolstays, because Parquet uses it.hadoop-client-runtimeregisters a relocated Woodstox that Jackson XML can't use. That includes Azure credential vending.UnityCatalogServernow points StAX at Woodstox when the class loads, so servers started with the builder get the fix too, not onlymain. A-Dset by the operator still wins.serverShadedleaves out the modules only OpenSharing brings. These are the Hadoop file systems, Parquet and the cloud connectors, which would clash with Spark's. The list is maintained by hand. The shaded jar has the same entries as before this PR.Tests
UnityCatalogCatalogConnectorTestcovers several cases:StaxProviderTestchecks that StAX resolves to Woodstox's own factories, and that a factory the operator set is kept.server/testwithUC_TEST_MIGRATION_CHECKS=truepassed on the top of the stack, and the sharing tests pass again after theauthorizechange. CI runs the suite on H2, PostgreSQL and MySQL.opensharing-server-core0.1.1, which includes Exclude hadoop-azure's unused WASB and Jetty 9.4 jars from core OpenSharing-IO/OpenSharing#183 and Add netty explicitly as dependency #184.This pull request and its description were written by Isaac.