From 4ed6c1a6ce1b6d53ea9ee965214da0c3adb3f3bd Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 17 Oct 2026 21:59:41 +0200 Subject: [PATCH] perf: clone sqlx test databases from a migrated template (#11848) * perf: clone sqlx test databases from a migrated template * perf: lock sqlx test templates shared while cloning * chore: note the tag that keeps the sqlx fork rev fetchable --- backend/Cargo.lock | 14 +++++++------- backend/Cargo.toml | 19 +++++++++++-------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 2b553c9396..4762c7f47d 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -12610,7 +12610,7 @@ dependencies = [ [[package]] name = "sqlx" version = "0.8.6" -source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457" +source = "git+https://github.com/windmill-labs/sqlx?rev=bc69ecc388ded2a5d770a83bf54803af24706057#bc69ecc388ded2a5d770a83bf54803af24706057" dependencies = [ "sqlx-core", "sqlx-macros", @@ -12622,7 +12622,7 @@ dependencies = [ [[package]] name = "sqlx-core" version = "0.8.6" -source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457" +source = "git+https://github.com/windmill-labs/sqlx?rev=bc69ecc388ded2a5d770a83bf54803af24706057#bc69ecc388ded2a5d770a83bf54803af24706057" dependencies = [ "base64 0.22.1", "bigdecimal", @@ -12660,7 +12660,7 @@ dependencies = [ [[package]] name = "sqlx-macros" version = "0.8.6" -source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457" +source = "git+https://github.com/windmill-labs/sqlx?rev=bc69ecc388ded2a5d770a83bf54803af24706057#bc69ecc388ded2a5d770a83bf54803af24706057" dependencies = [ "proc-macro2", "quote", @@ -12672,7 +12672,7 @@ dependencies = [ [[package]] name = "sqlx-macros-core" version = "0.8.6" -source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457" +source = "git+https://github.com/windmill-labs/sqlx?rev=bc69ecc388ded2a5d770a83bf54803af24706057#bc69ecc388ded2a5d770a83bf54803af24706057" dependencies = [ "dotenvy", "either", @@ -12696,7 +12696,7 @@ dependencies = [ [[package]] name = "sqlx-mysql" version = "0.8.6" -source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457" +source = "git+https://github.com/windmill-labs/sqlx?rev=bc69ecc388ded2a5d770a83bf54803af24706057#bc69ecc388ded2a5d770a83bf54803af24706057" dependencies = [ "atoi", "base64 0.22.1", @@ -12740,7 +12740,7 @@ dependencies = [ [[package]] name = "sqlx-postgres" version = "0.8.6" -source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457" +source = "git+https://github.com/windmill-labs/sqlx?rev=bc69ecc388ded2a5d770a83bf54803af24706057#bc69ecc388ded2a5d770a83bf54803af24706057" dependencies = [ "atoi", "base64 0.22.1", @@ -12780,7 +12780,7 @@ dependencies = [ [[package]] name = "sqlx-sqlite" version = "0.8.6" -source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457" +source = "git+https://github.com/windmill-labs/sqlx?rev=bc69ecc388ded2a5d770a83bf54803af24706057#bc69ecc388ded2a5d770a83bf54803af24706057" dependencies = [ "atoi", "chrono", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 070ea1ce5f..88f59124b2 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -226,7 +226,10 @@ all_sqlx_features = ["all_languages", "enterprise", "enterprise_saml", "embeddin "windmill-git-sync/all_sqlx_features"] [patch.crates-io] -# v0.8.6 plus one commit: `Pool::begin` is not cancel-safe on Postgres. sqlx raises the +# v0.8.6 plus two changes, the fix below and a `#[sqlx::test]`-only one: each test database is +# cloned from a template migrated once per migration set instead of migrating it per test. +# The rev is tagged `windmill-0.8.6-test-template-bc69ecc` in the fork so it stays fetchable. +# The fix: `Pool::begin` is not cancel-safe on Postgres. sqlx raises the # transaction depth its rollback-on-drop guard keys on only *after* the BEGIN round trip, so # a cancelled caller (a disconnecting API client, a `timeout`, an aborted task) leaves the # session in a transaction nothing will end, and the pool hands that connection out again — @@ -239,13 +242,13 @@ all_sqlx_features = ["all_languages", "enterprise", "enterprise_saml", "embeddin # Changing any of this — a bump, a rebase of the fork, dropping these lines — still compiles # clean, so run the guard that actually checks the behaviour is still there: # cargo test -p windmill-common --test sqlx_begin_cancel_safe -- --ignored -sqlx = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" } -sqlx-core = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" } -sqlx-macros = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" } -sqlx-macros-core = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" } -sqlx-postgres = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" } -sqlx-mysql = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" } -sqlx-sqlite = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" } +sqlx = { git = "https://github.com/windmill-labs/sqlx", rev = "bc69ecc388ded2a5d770a83bf54803af24706057" } +sqlx-core = { git = "https://github.com/windmill-labs/sqlx", rev = "bc69ecc388ded2a5d770a83bf54803af24706057" } +sqlx-macros = { git = "https://github.com/windmill-labs/sqlx", rev = "bc69ecc388ded2a5d770a83bf54803af24706057" } +sqlx-macros-core = { git = "https://github.com/windmill-labs/sqlx", rev = "bc69ecc388ded2a5d770a83bf54803af24706057" } +sqlx-postgres = { git = "https://github.com/windmill-labs/sqlx", rev = "bc69ecc388ded2a5d770a83bf54803af24706057" } +sqlx-mysql = { git = "https://github.com/windmill-labs/sqlx", rev = "bc69ecc388ded2a5d770a83bf54803af24706057" } +sqlx-sqlite = { git = "https://github.com/windmill-labs/sqlx", rev = "bc69ecc388ded2a5d770a83bf54803af24706057" } object_store = { git = "https://github.com/apache/arrow-rs-object-store", rev = "36752c975d4f29e20b57c91f81a10872dcd48ae7" } # Use tiberius main branch for libgssapi 0.8.1 fix (https://github.com/prisma/tiberius/issues/343) tiberius = { git = "https://github.com/prisma/tiberius", rev = "59db57960a14b422fb3a1309aa4aa47880896ff8" }