fix: scope RemoveFromQueue to the calling controller - #16739
fix: scope RemoveFromQueue to the calling controller#16739HarnageaGabriel wants to merge 1 commit into
Conversation
CheckWorkflowExistence's garbage collector lists pending sync_state rows by lock name only, which includes rows from every controller sharing the database, then checks each key against the local informer only. A workflow owned by another controller always looks missing locally, so the GC deletes it. RemoveFromQueue had no controller filter (unlike ReleaseHeld, which already filters on controller), so the delete went through and removed other controllers' legitimate pending rows, breaking lock handover and queue ordering across controllers sharing one sync database. Add the same controller filter to RemoveFromQueue that ReleaseHeld already uses, and thread the local controller name through from databaseSemaphore.removeFromQueue. Fixes argoproj#16737 Signed-off-by: HarnageaGabriel <gabriel.harnagea06@gmail.com>
✅ PR readiness: all clearAll contributor-fixable checks are passing. A maintainer will take it from here — thanks! 🤖 Automated PR-readiness helper — it re-checks each time CI finishes. Unit/E2E test results are not covered here. Questions? See the contributing guide or ask a maintainer. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthrough
ChangesController-scoped queue removal
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change limits pending-row removal to the calling controller, preventing cross-controller queue corruption while preserving single-controller behavior. No actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
make pre-commit -Bmake feature-new) — not a feature, bug fix onlyFixes #16737
Motivation
Multi-controller sync with a shared database:
CheckWorkflowExistence's garbage collector lists pendingsync_staterows by lock name only (no controller filter), so it sees rows from every controller sharing the database. It checks each key against the local informer only, so a workflow owned by another controller always looks missing locally and gets deleted.RemoveFromQueuehad no controller filter — unlikeReleaseHeld, which already filters oncontroller— so the delete went through and removed other controllers' legitimate pending rows, breaking lock handover and queue ordering across controllers.Modifications
util/sync/db/queries.go:RemoveFromQueuenow takescontrollerNameand filters the delete on it, mirroringReleaseHeld.workflow/sync/database_semaphore.go:removeFromQueuepassess.info.Config.ControllerNamethrough.util/sync/db/mocks/SyncQueries.go: mock updated to match (mockery not available locally; hand-edited to match the existing generated style, e.g.ReleaseHeld's mock).workflow/sync/database_semaphore_test.go: regression test asserting the controller name is passed through toRemoveFromQueue.Existing callers (
Release,ReleaseAll, the GC) only ever pass local keys, so behavior for a single-controller setup is unchanged.Verification
go build ./util/sync/... ./workflow/sync/...KUBECONFIG=/dev/null go test ./util/sync/... ./workflow/sync/...— 121 passedgofmt -lclean on changed filesgolangci-lint runclean on changed files (pre-existing gofmt findings on unrelated files in the package, untouched by this change)Documentation
No user-facing documentation change needed — this is an internal bug fix to sync-queue cleanup, no API/CRD/CLI surface changed.
AI
Claude Code was used to investigate the bug and draft the fix; I reviewed the diff and verified the build/tests myself before pushing.