Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,14 @@ lazy val server = (project in file("server"))
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % jacksonVersion,
// Delta Kernel validates set-columns schema evolution.
"io.delta" % "delta-kernel-api" % deltaVersion,
// Keep OpenSharing's Delta Kernel transitives explicit in the published POM, without the
// older published Unity Catalog integrations that would shadow the server's own classes.
"io.delta" % "delta-kernel-defaults" % deltaVersion
exclude("io.unitycatalog", "unitycatalog-client")
exclude("io.unitycatalog", "unitycatalog-hadoop"),
"io.delta" % "delta-storage" % deltaVersion
exclude("io.unitycatalog", "unitycatalog-client")
exclude("io.unitycatalog", "unitycatalog-hadoop"),

"com.google.code.findbugs" % "jsr305" % "3.0.2",
"com.github.ben-manes.caffeine" % "caffeine" % caffeineVersion,
Expand Down Expand Up @@ -476,8 +484,20 @@ lazy val server = (project in file("server"))
// apache5-client instead, so declare apache-client explicitly
"software.amazon.awssdk" % "apache-client" % awsSdkV2Version,

// Hadoop dependencies for ExternalLocationUtils
// Hadoop dependencies for ExternalLocationUtils and OpenSharing's published runtime.
"org.apache.hadoop" % "hadoop-client-api" % hadoopVersion,
"org.apache.hadoop" % "hadoop-client-runtime" % hadoopVersion % Runtime,
"org.apache.hadoop" % "hadoop-aws" % hadoopVersion % Runtime,
"org.apache.hadoop" % "hadoop-azure" % hadoopVersion % Runtime
exclude("com.microsoft.azure", "azure-storage")
exclude("com.microsoft.azure", "azure-keyvault-core")
exclude("org.eclipse.jetty", "jetty-util")
exclude("org.eclipse.jetty", "jetty-util-ajax"),

// Embedded OpenSharing: shares and recipients, and the Delta Sharing protocol. It runs on the
// Hibernate and the Armeria server above, and brings Delta Kernel's defaults, Parquet, and
// Hadoop's S3, Azure and GCS file systems, which read the shared tables.
"io.opensharing" % "opensharing-server-core" % "0.1.1",

// Auth dependencies
"com.unboundid.product.scim2" % "scim2-sdk-common" % "3.2.0",
Expand Down Expand Up @@ -535,6 +555,8 @@ lazy val server = (project in file("server"))
"software.amazon.awssdk" % "sts" % awsSdkV2Version,
"software.amazon.awssdk" % "kms" % awsSdkV2Version,
"software.amazon.awssdk" % "auth" % awsSdkV2Version,
"io.delta" % "delta-kernel-defaults" % deltaVersion,
"io.delta" % "delta-storage" % deltaVersion,
"io.netty" % "netty-all" % nettyVersion,
"io.netty" % "netty-tcnative-classes" % nettyTcnativeVersion,
"io.netty" % "netty-tcnative-boringssl-static" % nettyTcnativeVersion,
Expand All @@ -544,6 +566,11 @@ lazy val server = (project in file("server"))
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % jacksonVersion,
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % jacksonVersion,
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % jacksonVersion,
// OpenSharing builds against a newer Hadoop. Keep the server on Unity Catalog's own release.
"org.apache.hadoop" % "hadoop-client-api" % hadoopVersion,
"org.apache.hadoop" % "hadoop-client-runtime" % hadoopVersion,
"org.apache.hadoop" % "hadoop-aws" % hadoopVersion,
"org.apache.hadoop" % "hadoop-azure" % hadoopVersion,
),

Compile / sourceGenerators += Def.task {
Expand All @@ -562,6 +589,11 @@ lazy val server = (project in file("server"))
(Test / runMain).toTask(s" io.unitycatalog.server.utils.PopulateTestDatabase").value
},
Test / javaOptions += s"-Duser.dir=${(ThisBuild / baseDirectory).value.getAbsolutePath}",
// Same StAX providers UnityCatalogServer sets when it loads, over hadoop-client-runtime's one.
Test / javaOptions ++= Seq(
"-Djavax.xml.stream.XMLInputFactory=com.ctc.wstx.stax.WstxInputFactory",
"-Djavax.xml.stream.XMLOutputFactory=com.ctc.wstx.stax.WstxOutputFactory",
"-Djavax.xml.stream.XMLEventFactory=com.ctc.wstx.stax.WstxEventFactory"),
// Include server and control models in the bin package for server
// This will allow us to have a single maven artifact and not multiple (server, server models, control models)
Compile / packageBin / mappings ++= (Compile / packageBin / mappings).value ++
Expand Down Expand Up @@ -729,7 +761,18 @@ lazy val serverShaded = (project in file("server-shaded"))
),
assemblyPackageScala / assembleArtifact := false,
assembly / fullClasspath := {
// Embedded OpenSharing is never enabled where the shaded server runs, the Spark connector
// tests, and the Hadoop, Parquet and cloud file system jars it brings would clash with the
// ones Spark and Delta put on those classpaths. Only modules that the OpenSharing dependency
// adds are left out; Delta Kernel's API and everything else the server had stays.
val sharingOnlyModules = Set(
"analyticsaccelerator-s3", "commons-pool", "delta-kernel-defaults", "delta-storage",
"gcs-connector", "hadoop-aws", "hadoop-azure", "hadoop-client-runtime",
"hadoop-shaded-guava", "jts-core", "parquet-column", "parquet-common",
"parquet-encoding", "parquet-format-structures",
"parquet-hadoop", "parquet-jackson", "s3-transfer-manager", "wildfly-openssl", "zstd-jni")
val compileClasspath = (server / Compile / fullClasspath).value
.filterNot(entry => entry.get(moduleID.key).exists(m => sharingOnlyModules(m.name)))
val testClasses = (server / Test / products).value
compileClasspath ++ testClasses.map(Attributed.blank)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public class UnityCatalogServer implements AutoCloseable {
private MetricsRegistries.PrometheusMetrics metrics;

static {
useWoodstoxForStax();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we make sure that anything needed for sharing is behind a server property (basically a feature flag, default off)

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.

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.

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.

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.

@yili-db yili-db Nov 17, 2026 •

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.

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

System.setProperty("log4j.configurationFile", "etc/conf/server.log4j2.properties");
Configurator.initialize(null, "etc/conf/server.log4j2.properties");
}
Expand Down Expand Up @@ -508,6 +509,19 @@ private void addSecurityDecorators(
}
}

/**
* hadoop-client-runtime registers a relocated Woodstox that Jackson XML can't use. System
* properties beat META-INF/services whatever the classpath order; an operator's -D still wins.
*/
public static void useWoodstoxForStax() {
System.getProperties()
.putIfAbsent("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory");
System.getProperties()
.putIfAbsent("javax.xml.stream.XMLOutputFactory", "com.ctc.wstx.stax.WstxOutputFactory");
System.getProperties()
.putIfAbsent("javax.xml.stream.XMLEventFactory", "com.ctc.wstx.stax.WstxEventFactory");
}

public static void main(String[] args) {
OptionParser options = new OptionParser();
options.parse(args);
Expand Down
Loading
Loading