GLM-5.3 · Balanced
unified-storage-performance-optimizations-grafana-codex
Grafana · Go · S · 30–99 lines · 5 files
The normal review, with one generalist agent. Judge: Claude Haiku 5.5.
- Gold bugs found
- 2 of 3
- Comments published
- 4
- Comments matching a bug
- 2
- Comments not matching
- 2
- Cost of this PR
- $1.143
Published comments (4)
Removing whole-function lock exposes data race and lost errors in searchSupport.init workers — With `cacheMu` gone, the `group.Go` workers race on shared `err` and `totalBatchesIndexed`, tripping CI's `-race` detector and letting a `nil` overwrite a build failure so `init` reports success with missing indexes. Declare a local `err` per closure and make `totalBatchesIndexed` atomic or mutex-protected.
TotalDocs reads bleve cache without lock, racing with index-building goroutine — An unlocked iteration of `b.cache` while the event goroutine's `BuildIndex` writes it is an unrecoverable concurrent map crash. Acquire `cacheMu.RLock()` inside `TotalDocs`, which also covers the lockless prometheus read in bleve_index_metrics.go.
Blocking Init in NewResourceServer stalls Grafana startup on search-index build — Since `ProvideUnifiedStorageClient` wires this into the main Grafana server, the synchronous `Init` blocks wire-graph and HTTP/metrics readiness behind the full index build, risking probe failures and crash loops. Keep eager init for the standalone storage-server; build asynchronously with a readiness gate when constructed in-process.
Postgres skip disables only CI coverage of changed StorageServer startup path — The commit history shows this test now fails under Drone with postgres after these changes, so the skip masks a live regression in the eager `Init` startup instead of fixing it. Resolve the underlying startup or timing failure and remove the skip.