You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit eade1cb
Browse filesBrowse the repository at this point in the historyBrowse files
Treat draining control planes as live in orphan worker sweep
Follow-up to #407. The startup orphan sweep used
ListActiveControlPlaneInstanceIDs which only returned CPs in state
'active', so a CP that was mid-graceful-shutdown (state='draining',
still serving in-flight queries while waiting for them to finish)
appeared "dead" to a new peer's startup sweep. Phase 1 would then
delete the draining CP's worker pods, killing every query the
draining CP was waiting on.
The pre-existing ListStuckWorkers query already uses
`cp.state <> 'expired'` for the same "alive" notion, so this aligns
the new sweep with the existing convention.
- Renamed ListActiveControlPlaneInstanceIDs to
ListLiveControlPlaneInstanceIDs and changed the underlying query
from `state = 'active'` to `state <> 'expired'`. The doc comment
spells out why draining must count as live.
- Renamed activeCPIDs / activeCPLabels to liveCPIDs / liveCPLabels
in cleanupOrphanedWorkers and updated both the phase 1 pod-delete
filter and the phase 2 owner-skip filter to use them.
- Updated the captureRuntimeWorkerStore mock and existing test
field names.
- Added TestCleanupOrphanedWorkers_PreservesDrainingPeerWorkers as
a regression test: a draining peer with both a busy worker pod
and a stale-looking idle row must end the sweep with the pod
intact and the row untouched.
- Added TestListLiveControlPlaneInstanceIDsPostgres as an
integration test against real Postgres covering active /
draining / expired states.
Workers serving queries are in reserved/hot/activating state, which
phase 2 doesn't query at all (it only lists idle and spawning rows),
so phase 2 was already safe. The bug was strictly in phase 1's
pod-delete filter.
0 commit comments