-
Notifications
You must be signed in to change notification settings - Fork 65
kernel: distribute the kernel via per-platform bindings modules (go get, no build step, all 5 platforms) #440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,3 +53,24 @@ require ( | |
| github.com/rs/zerolog v1.28.0 | ||
| golang.org/x/sys v0.47.0 // indirect | ||
| ) | ||
|
|
||
| // Per-platform kernel library modules, distributed by the separate | ||
| // github.com/databricks/databricks-sql-kernel-bindings repo (one nested Go | ||
| // module per platform, lib/<os>_<arch>). Each carries that platform's prebuilt | ||
| // kernel static archive + its cgo link directive; a kernel build downloads only | ||
| // the archive for the platform it targets (build-tag gated), and a pure-Go | ||
| // Thrift build downloads none of them. | ||
| // | ||
| // The versions are pinned in lockstep with the driver release. A consumer's | ||
| // `go get github.com/databricks/databricks-sql-go@vX.Y.Z` transitively pins the | ||
| // matching per-platform kernel archive; upgrading the driver moves the kernel | ||
| // version. See the databricks-sql-kernel-bindings repo README. | ||
| require ( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium — These 7 bindings modules are added as direct requirements, but the only packages that import them are gated behind Consequences worth confirming before merge:
If the bindings repo is public and its tags are immutable, this is acceptable coupling — but please verify that's the intent, since it makes the default CUJ depend on kernel-artifact availability. |
||
| github.com/databricks/databricks-sql-kernel-bindings/lib/darwin_amd64 v0.2.3 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High — This adds direct This coupling of the public driver to a private dependency should be resolved (bindings repo made public, or the require gated) before tagging a release, otherwise the default install path breaks for everyone outside the Databricks network. At minimum, confirm the bindings repo will be public at the driver tag that carries this go.mod. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 Low — Version mismatch between the PR narrative and the pinned versions: the PR description (and the |
||
| github.com/databricks/databricks-sql-kernel-bindings/lib/darwin_arm64 v0.2.3 | ||
| github.com/databricks/databricks-sql-kernel-bindings/lib/linux_amd64 v0.2.3 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 Low — All seven Worth guarding against: either document that |
||
| github.com/databricks/databricks-sql-kernel-bindings/lib/linux_arm v0.2.3 | ||
| github.com/databricks/databricks-sql-kernel-bindings/lib/linux_arm64 v0.2.3 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High — The
Two concrete problems:
Either add |
||
| github.com/databricks/databricks-sql-kernel-bindings/lib/windows_amd64 v0.2.3 | ||
| github.com/databricks/databricks-sql-kernel-bindings/lib/windows_arm64 v0.2.3 | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| //go:build cgo && databricks_kernel && darwin && amd64 | ||
|
|
||
| package kernel | ||
|
|
||
| // darwin/amd64 link wiring: blank-import the external per-platform module | ||
| // github.com/databricks/databricks-sql-kernel-bindings/lib/darwin_amd64 (databricks-sql-kernel-bindings) so cgo collects its | ||
| // `#cgo LDFLAGS` at link time and pulls libdatabricks_sql_kernel.a into the | ||
| // binary. Same build constraint as that module's prebuilt.go. | ||
| import _ "github.com/databricks/databricks-sql-kernel-bindings/lib/darwin_amd64" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,16 +2,8 @@ | |
|
|
||
| package kernel | ||
|
|
||
| // Link flags for linux/amd64. The static archive is forced with the | ||
| // -l:<file>.a form (a GNU-ld extension) so the linker never prefers a | ||
| // same-named .so — the kernel's cargo build emits both a .a and a .so into the | ||
| // same dir, and a bare -ldatabricks_sql_kernel would pick the .so and bake in | ||
| // an rpath. -lstdc++/-lm/-ldl are the kernel's transitive system deps. | ||
| // | ||
| // The path is ${SRCDIR}-relative; `make kernel-lib` drops the archive at | ||
| // ${SRCDIR}/lib/linux_amd64/libdatabricks_sql_kernel.a. | ||
|
|
||
| /* | ||
| #cgo LDFLAGS: -L${SRCDIR}/lib/linux_amd64 -l:libdatabricks_sql_kernel.a -lstdc++ -lm -ldl | ||
| */ | ||
| import "C" | ||
| // linux/amd64 link wiring: blank-import the external per-platform module | ||
| // github.com/databricks/databricks-sql-kernel-bindings/lib/linux_amd64 (databricks-sql-kernel-bindings) so cgo collects its | ||
| // `#cgo LDFLAGS` at link time and pulls libdatabricks_sql_kernel.a into the | ||
| // binary. Same build constraint as that module's prebuilt.go. | ||
| import _ "github.com/databricks/databricks-sql-kernel-bindings/lib/linux_amd64" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 Low — The new blank-imports of |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| //go:build cgo && databricks_kernel && linux && arm | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium — This new shim (and its sibling Enabling a |
||
|
|
||
| package kernel | ||
|
|
||
| // linux/arm (armv7) link wiring: blank-import the external per-platform module | ||
| // github.com/databricks/databricks-sql-kernel-bindings/lib/linux_arm (databricks-sql-kernel-bindings) so cgo collects its | ||
| // `#cgo LDFLAGS` at link time and pulls libdatabricks_sql_kernel.a into the | ||
| // binary. Same build constraint as that module's prebuilt.go. | ||
| import _ "github.com/databricks/databricks-sql-kernel-bindings/lib/linux_arm" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| //go:build cgo && databricks_kernel && linux && arm64 | ||
|
|
||
| package kernel | ||
|
|
||
| // linux/arm64 link wiring: blank-import the external per-platform module | ||
| // github.com/databricks/databricks-sql-kernel-bindings/lib/linux_arm64 (databricks-sql-kernel-bindings) so cgo collects its | ||
| // `#cgo LDFLAGS` at link time and pulls libdatabricks_sql_kernel.a into the | ||
| // binary. Same build constraint as that module's prebuilt.go. | ||
| import _ "github.com/databricks/databricks-sql-kernel-bindings/lib/linux_arm64" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,18 @@ | ||
| //go:build cgo && databricks_kernel && !(linux && amd64) && !(darwin && arm64) && !(windows && amd64) | ||
| //go:build cgo && databricks_kernel && !(linux && amd64) && !(linux && arm64) && !(linux && arm) && !(darwin && arm64) && !(darwin && amd64) && !(windows && amd64) && !(windows && arm64) | ||
|
|
||
| package kernel | ||
|
|
||
| // This file is compiled only on GOOS/GOARCH combinations the kernel backend does | ||
| // not support. Per-platform link flags (cgo_<os>.go) exist only for linux/amd64, | ||
| // darwin/arm64, and windows/amd64; on any other target there is no static archive | ||
| // to link, so cgo.go's C ABI calls would otherwise fail at the LINK step with an | ||
| // opaque "undefined reference to kernel_*". The Makefile's host==target guard | ||
| // does not catch this — it happily source-builds a host .a on e.g. linux/arm64 | ||
| // (Graviton) or an Intel Mac, only for the link to fall over with no matching | ||
| // LDFLAGS file. Referencing an undefined identifier here fails earlier, at | ||
| // COMPILE time, with a message that names the supported targets — a legible build | ||
| // error instead of a linker dump. | ||
| // not support. Per-platform link shims (cgo_<os>[_<arch>].go) exist for | ||
| // linux/amd64, linux/arm64, linux/arm, darwin/arm64, darwin/amd64, windows/amd64, | ||
| // and windows/arm64; on any other target there is no static archive to link, so | ||
| // cgo.go's C ABI calls would otherwise fail at the LINK step with an opaque | ||
| // "undefined reference to kernel_*". Referencing an undefined identifier here | ||
| // fails earlier, at COMPILE time, with a message that names the supported | ||
| // targets — a legible build error instead of a linker dump. | ||
| // | ||
| // Broader OS/arch coverage is tracked in the distribution design (native per-OS | ||
| // runners or a staged prebuilt .a); until then this guard makes the supported | ||
| // boundary explicit rather than latent. | ||
| const _ = kernel_backend_supports_only_linux_amd64_darwin_arm64_and_windows_amd64 | ||
| // The supported set maps 1:1 to the per-platform modules published by | ||
| // github.com/databricks/databricks-sql-kernel-bindings. Adding a platform = | ||
| // publish its bindings module + add a cgo_<os>_<arch>.go shim + drop it from this | ||
| // exclusion list. | ||
| const _ = kernel_backend_supports_only_linux_amd64_linux_arm64_linux_arm_darwin_arm64_darwin_amd64_windows_amd64_and_windows_arm64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 High — Adding these five
requires to the driver'sgo.modwhile thedatabricks-sql-kernel-bindingsrepo is still private will break the default Thriftgo get/go buildfor every external consumer — contradicting the PR's core claim that "the default Thrift CUJ is completely unchanged."Go's (pruned) module-graph resolution needs the
go.modfile of every module listed in a dependency'srequireblock, even for modules whose packages are never imported by the current build. A downstreamgo buildthat importsdatabricks-sql-gotherefore has to fetch thego.modof all fivelib/<platform>modules from the proxy/direct git to compute the build list. If that repo is private (410/auth failure from the public proxy), resolution fails before any build-tag gating applies — thedatabricks_kerneltag only controls whether the zip (archive) is downloaded, not whether thego.modis read for graph construction. Thego.sumhashes present here don't help: they verify content, they don't cache it.docs/RELEASING.mdexplicitly acknowledges the repo is private and that publicgo get"requires it to be made public." Merging thisrequireblock before that happens makes the public module un-buildable for OSS users. Recommend gating this merge on the bindings repo being public (or otherwise confirming the module-graph impact on a pure Thrift consumer build from a clean module cache with noGOPRIVATE).