GPT-6.1 Sol · Balanced

dual-storage-architecture-grafana-codex

Grafana · Go · L · 300–799 lines · 4 files

The normal review, with one generalist agent. Judge: Claude Haiku 5.5.

Gold bugs found
5 of 9
Comments published
5
Comments matching a bug
5
Comments not matching
0
Cost of this PR
$1.025

Published comments (5)

highbugpkg/apiserver/rest/dualwriter_mode3.go:50-51

Request cancellation can interrupt asynchronous legacy writes — Request cancellation can stop the legacy goroutine's SQL work before replication completes, also affecting `Update`, `Delete`, and `DeleteCollection`. Apply `context.WithoutCancel(ctx)` before `context.WithTimeoutCause` to preserve namespace and requester values while retaining the ten-second timeout.

highbugpkg/apiserver/rest/dualwriter_mode3.go:139

Legacy updates replay patches against potentially stale objects — Passing the original `objInfo` lets `d.Legacy.Update` apply patches to stale data, preserving field values that differ from the successful unified write. Pass an `updateWrapper` containing a deep copy of `res` instead of replaying the original transformation.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:45

Unified Create and Update failures are attributed to legacy storage metrics — Calling `recordLegacyDuration` when unified `Create` or `Update` fails blames a backend that was never called and hides the actual failure in storage metrics. Use `recordStorageDuration` for both unified-storage error paths.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:165-166

Legacy DeleteCollection metrics are attributed to unified storage — Using `recordStorageDuration` for the `d.Legacy.DeleteCollection` result duplicates the unified observation, misattributes legacy errors, and leaves legacy collection metrics empty. Record this observation with `recordLegacyDuration`.

mediumperformancepkg/apiserver/rest/dualwriter_mode3.go:106

Resource names cause unbounded delete histogram cardinality — Using `name` as the histogram's kind label permanently retains a series for each distinct deleted resource, increasing exporter memory and scrape cardinality. Pass `options.Kind` to `recordStorageDuration` instead, matching the other observations.

Gold bugs found (5)

mediumThe legacy DeleteCollection goroutine records its duration with recordStorageDuration instead of recordLegacyDuration, misattributing legacy latency and errors to the storage metric.
mediumDelete's success path records the storage metric with the object name in the kind label instead of options.Kind, creating per-object series and inconsistent labels.
mediumOn storage Create/Update failure the duration is recorded with recordLegacyDuration, attributing unified-store errors to the legacy metric.
highMode 3 legacy writes now run in background goroutines derived from the request context, which is cancelled when the request completes, so legacy writes can be cancelled and legacy storage falls out of sync.
highLegacy.Update now receives the original objInfo instead of a wrapper carrying the object stored in unified storage, so legacy recomputes the update and can diverge.

Gold bugs missed (4)

mediumThe Mode 3 tests never wait for or assert the asynchronous legacy writes, and legacy and storage share one mock, so removing the legacy calls would not fail them.
highIndependent per-request goroutines remove ordering between legacy writes to the same resource, so legacy can end up with an older version or a resurrected object.
mediumMode 3 legacy-storage write errors (create/update/delete/delete-collection) are no longer logged after moving to async goroutines; only a duration metric with an error flag is recorded.
highDualWriterMode3.Delete now returns on any unified-storage error, including NotFound, before deleting from legacy, so objects that exist only in legacy can no longer be deleted.