From ed54f9a6b62b65d96ad965e39ebc6462309eaa45 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Thu, 23 Apr 2026 00:31:45 +0000 Subject: [PATCH] test(vectorindex): skip Recall10k under -race MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TestHNSW_Recall10k is the CI bottleneck at ~410s under -race (68% of the integration job). The workload is fully sequential — build 10k vectors, then 20 query probes — so the race detector has nothing to catch and just adds ~10× overhead. Added a raceEnabled build-tagged constant (standard Go idiom) so the test skips only under -race. TestHNSW_ConcurrentAddSearch still runs under -race and covers the actual concurrent code path. Local timings: go test -run Recall10k 68s (recall=1.000) go test -race -run Recall10k 1s (skip) go test -race -run ConcurrentAdd 2s (unchanged) Integration CI projected: 600s → ~190s. Co-Authored-By: Claude Opus 4.7 (1M context) --- internal/vectorindex/hnsw_test.go | 7 +++++++ internal/vectorindex/race_off.go | 5 +++++ internal/vectorindex/race_on.go | 10 ++++++++++ 3 files changed, 22 insertions(+) create mode 100644 internal/vectorindex/race_off.go create mode 100644 internal/vectorindex/race_on.go diff --git a/internal/vectorindex/hnsw_test.go b/internal/vectorindex/hnsw_test.go index 9883b84..2d8d727 100644 --- a/internal/vectorindex/hnsw_test.go +++ b/internal/vectorindex/hnsw_test.go @@ -215,6 +215,13 @@ func TestHNSW_Recall10k(t *testing.T) { if testing.Short() { t.Skip("skipping 10k benchmark in -short") } + if raceEnabled { + // Workload is fully sequential (no goroutines), so the race + // detector has nothing to catch here — it just adds ~10× overhead + // that dominates CI. Concurrency correctness is covered by + // TestHNSW_ConcurrentAddSearch, which DOES run under -race. + t.Skip("skipping 10k recall benchmark under -race (sequential workload)") + } const ( n = 10_000 dim = 384 diff --git a/internal/vectorindex/race_off.go b/internal/vectorindex/race_off.go new file mode 100644 index 0000000..76d9b3f --- /dev/null +++ b/internal/vectorindex/race_off.go @@ -0,0 +1,5 @@ +//go:build !race + +package vectorindex + +const raceEnabled = false diff --git a/internal/vectorindex/race_on.go b/internal/vectorindex/race_on.go new file mode 100644 index 0000000..16d20ac --- /dev/null +++ b/internal/vectorindex/race_on.go @@ -0,0 +1,10 @@ +//go:build race + +package vectorindex + +// raceEnabled reports whether the package was compiled with -race. +// Some long-running deterministic benchmarks (e.g. TestHNSW_Recall10k) +// gain nothing from the race detector — they're sequential — and pay +// ~10× overhead that dominates CI time. Those tests skip when this is +// true, leaving the explicitly concurrent tests to exercise the detector. +const raceEnabled = true