GLM-5.3 · Heavy
unified-storage-performance-optimizations-grafana-codex
Grafana · Go · S · 30–99 lines · 5 files
The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Haiku 5.5.
- Gold bugs found
- 3 of 3
- Comments published
- 4
- Comments matching a bug
- 3
- Comments not matching
- 1
- Cost of this PR
- $1.697
Published comments (4)
TotalDocs reads cache map without lock; concurrent BuildIndex crashes process — If any goroutine is in `BuildIndex` while this log line runs, `bleveBackend.TotalDocs` reads `b.cache` without `b.cacheMu` and the runtime fatally crashes the process. Have `TotalDocs` in `search/bleve.go` take `b.cacheMu.RLock()` before iterating.
Unsynchronized concurrent same-key index builds can duplicate work and corrupt file-backed indexes — Removing the function-wide lock leaves `getOrCreateIndex` unsynchronized, so concurrent same-key builders each scan and the loser's cached index silently drops documents; file-backed builds can corrupt the on-disk index. Add per-key sync — `singleflight` in `getOrCreateIndex`, or a cache re-check under the write lock in `BuildIndex`. **Also found in:** - `pkg/storage/unified/resource/search.go:307-307` - `pkg/storage/unified/search/bleve.go:85-90`
NewResourceServer now blocks on full Init and hard-fails, breaking the constructor contract — Every caller now blocks construction on the full index build and hard-fails on any init error — one consumer already broke and was skipped rather than adapted. Revert `NewResourceServer` to returning immediately, leaving init to the separate `Init` path.
Postgres skip silences failing integration test instead of fixing it — This skip hides a real postgres failure exactly when this PR rewrites the init path it tests, so regressions go undetected. Fix the cause — `addStorageServerToConfig` hardcodes grafanatest credentials instead of parsing the connection string — or scope the skip to Drone.
Gold bugs found (3)
Gold bugs missed (0)
None.