Repository navigation
fix(warehouse): hot-reload degraded workspaces without aborting restored uploads - #7564
Conversation
|
👋 I'm rudder-devbox. I opened this PR from task Mention |
|
CI showed two failures. The Snowflake job separately reported The warehouse test passed five runs under |
|
Knowledge distillation completed |
|
The warehouse unit job timed out in The Snowflake integration job separately reports a race in |
|
Knowledge distillation completed |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7564 +/- ##
==========================================
+ Coverage 85.22% 85.24% +0.01%
==========================================
Files 631 631
Lines 62990 63014 +24
==========================================
+ Hits 53683 53716 +33
+ Misses 9304 9295 -9
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Replace HasConnection's (exists, known) pair with ConnectionRemoved, the single answer the router consumes. - Drop the PseudoWarehouseDestinationMap check: routers only exist for warehouse destinations and the lookup already matches on destType. - Filter with lo.OmitByKeys; return the reloadable slice without cloning. - Close WatchConfig when the backend subscription closes, as before. That only happens on context cancellation in production, so the slave worker test no longer needs its own cancel. - Only WatchConfig subscribers write the full snapshot; the router reads it, and routers only exist under a WatchConfig subscriber. - Trim duplicated test code. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
I traced the ClickHouse failure to a lost database connection during This run has a transient ClickHouse connection failure, and the branch makes no ClickHouse load changes or degraded-workspace edits in that test. I made no code change: changing the expected count would conceal the duplicate load, while a source edit cannot repair the dropped test database connection. The integration job needs a rerun against a stable ClickHouse service; repeated occurrences warrant a separate idempotent-retry fix. |
Every WatchConfig subscription wrote fullConfig from its own backend-config subscription. pubsub orders snapshots per subscriber only, so a slow subscriber could overwrite a newer snapshot with an older one. Run is now the only backend-config subscriber and the only writer of fullConfig; WatchConfig subscribers are signalled and filter the latest snapshot, matching the single-writer fan-out used by bcm. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A new WatchConfig subscriber could receive the same snapshot twice: once from its startup signal and once from Run's notification. Track the snapshot version and degraded list last sent, and skip unchanged sends. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
The warehouse unit job timed out in The focused router test passed under |
|
Knowledge distillation completed |
|
The arm64 image build stopped at |
- Initialise the manager in New and drop the lazy init, the stored config and initOnce. - Rename sourceMu to configMu now that it guards the full snapshot, and take a read lock in SourceToWorkspace. - Bump one config version on snapshot and degraded-list changes so watchers dedupe on a single counter. - Drop the scan for uploads without a workspace ID: every upload since the workspace_id column was added carries one, and the router resolves it before checking the connection. - Reuse setupDB in the router pickup test. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Legacy uploads with an empty workspace ID can be incorrectly aborted during restoration because the connection check does not first resolve the workspace from the manager’s unfiltered source mapping.
1 open issue
What changed in this PR
This PR makes warehouse degradation settings reloadable and protects restored uploads while downstream configuration consumers catch up.
Changes:
- Refresh filtered configuration subscribers when backend snapshots or degraded workspace settings change.
- Defer uploads whose exact connection remains in the full snapshot, while preserving aborts for absent connections.
- Add restoration and reload regression tests, and adjust test lifecycle handling.
| File | Description |
|---|---|
| warehouse/slave/worker_test.go | Start the tenant manager and explicitly cancel BCM startup. |
| warehouse/router/router.go | Check the full connection snapshot before aborting uploads. |
| warehouse/router/router_test.go | Cover restoration gaps, initial snapshot delays, and removed connections. |
| warehouse/multitenant/manager.go | Add reloadable degradation settings, shared snapshots, and subscriber notifications. |
| warehouse/multitenant/manager_test.go | Test setting reloads, subscriber refreshes, and connection checks. |
| warehouse/bcm/backend_config_test.go | Start the tenant manager for configuration subscriptions. |
| warehouse/app_test.go | Allow cancellation before an initial snapshot starts a router. |
Review effort: Balanced
| if m.fullConfig == nil { | ||
| return false | ||
| } | ||
| return !connectionInWorkspace(m.fullConfig[workspaceID], sourceID, destinationID, destType) |
lvrach
left a comment
There was a problem hiding this comment.
Note: this review is part of an experiment, the #proj-auto-approve auto-approval process. No human looked at this PR. Auto-approve category: documented bug fix.
Approve. The reloadable degraded list removes the restart loop from INT-7503. Deferring uploads in the gap before BCM catches up is the right fix. CI is green on 187dfd7.
Should-fix 1: legacy uploads of a degraded workspace hold batch slots (warehouse/router/router.go:444).
The SQL skips degraded workspaces with workspace_id <> ALL ($4) (warehouse/internal/repo/upload.go:313). A row with an empty workspace_id passes that filter. The router then resolves it through workspaceBySourceIDs, which is never pruned, so it gets W. ConnectionRemoved(W, …) returns false because the full snapshot still holds the connection. The upload is deferred on every allocator cycle while W stays degraded. LIMIT runs before this check, so with one free worker this row can take the slot each cycle, and healthy workspaces wait. The old code aborted these rows.
Should-fix 2: legacy uploads can still abort just after restore (router.go:427-452).
Start with W degraded while another workspace keeps the router for this destination type running. W's source never enters workspaceBySourceIDs. Remove W from the list. Before the router consumes the restored config, a legacy upload resolves to "". ConnectionRemoved("", …) looks in fullConfig[""], returns true, and the upload is aborted. That is the outcome this PR prevents for normal rows.
Fix for both: resolve an empty workspace ID with tenantManager.SourceToWorkspace (unfiltered) before the removal check. Then skip uploads of degraded workspaces before they count against the limit, or refill the selection after a deferral.
Suggestion: make the deferral visible. The continue at line 444 has no log or stat. A counter by workspace and destination type shows when a deferral never ends.
Nits
WatchConfigreads the degraded list outsideconfigMu. It causes at most one extra delivery.Newregisters a reload observer that is never removed. This matters only in tests that build many managers.app_test.go:379-383now asserts less than before. Check that the weaker assertion is intended.
Checked and not an issue: the PR body's "older subscriber deliveries overwrite the snapshot" finding. Only Run writes fullConfig, and the queued signal delivers the latest version after any stale one.
🤖 I have created a release *beep* *boop* --- ## [1.93.0-rc.1](v1.92.0...v1.93.0-rc.1) (2026-11-09) ### Features * **destination:** recognize machine_oauth accounts as oauth ([#7549](#7549)) ([f51e4ca](f51e4ca)) * incremental definitions on the v2 namespace config ([#7487](#7487)) ([ce51e38](ce51e38)) * **processor:** add flag to abort python transformations on deployments that do not offer them ([#7571](#7571)) ([ca85eb2](ca85eb2)) * **processor:** filter http v2 events by destination message types ([#7538](#7538)) ([58fd176](58fd176)) * **processor:** send the workspace id to per-workspace pyt pods ([#7551](#7551)) ([ea33835](ea33835)) * **warehouse:** add maxcompute destination ([#7568](#7568)) ([a64bfd9](a64bfd9)) ### Bug Fixes * **batchrouter:** abort bq stream all events jobs on terminal auth failures ([#7548](#7548)) ([6b7e023](6b7e023)) * bump andybalholm/brotli to v1.2.7 [SEC-759] ([#7525](#7525)) ([6dfe468](6dfe468)) * bump rudder-go-kit to v0.84.3 ([#7547](#7547)) ([355054a](355054a)) * **core:** schema forwarder panics on shutdown ([#7519](#7519)) ([dd61cfc](dd61cfc)) * database connections hang when context is cancelled during a copy ([#7578](#7578)) ([8dae6e3](8dae6e3)) * **jobsdb:** compaction missing pairs after one that doesn't fit ([#7574](#7574)) ([573271b](573271b)) * **jobsdb:** multiconsumer recovery misses a consumer's executing status after another consumer's later status ([#7554](#7554)) ([69b43e0](69b43e0)) * **jobsdb:** old jobs not expiring for every consumer ([#7573](#7573)) ([366f114](366f114)) * **jobsdb:** pickups stalling on status tables with skewed stats ([#7572](#7572)) ([318446f](318446f)) * **jobsdb:** unionjobsdb functions pick the first datasets by table name ([#7558](#7558)) ([e94d6c5](e94d6c5)) * **router:** event order test only counts drained jobs of the last dataset ([#7552](#7552)) ([b0a097a](b0a097a)) * **router:** mask secrets in array-shaped reporting samples ([#7536](#7536)) ([902160f](902160f)) * **warehouse:** hot-reload degraded workspaces without aborting restored uploads ([#7564](#7564)) ([cb98598](cb98598)) * **warehouse:** match deltalake columns case-insensitively ([#7563](#7563)) ([a7d30d7](a7d30d7)) * **warehouse:** migrate snowflake to gosnowflake v2.3.0 ([#7542](#7542)) ([cc09426](cc09426)) * **warehouse:** skip job-creation error log on router shutdown ([#7567](#7567)) ([895367e](895367e)) ### Miscellaneous * **deps:** bump github.com/go-jose/go-jose/v4 from 4.1.4 to 4.1.6 ([#7545](#7545)) ([35ee952](35ee952)) * export only the +Inf bucket for limiter timers ([#7570](#7570)) ([4429472](4429472)) * **router:** add drainReason label to pipeline_processed_events ([#7561](#7561)) ([af0aef8](af0aef8)) * sync release v1.92.0 to main branch ([#7534](#7534)) ([9ab165d](9ab165d)) * **warehouse:** bump sqlconnect-go to v1.37.1 ([#7575](#7575)) ([acdad67](acdad67)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [1.93.0](v1.92.0...v1.93.0) (2026-11-09) ### Features * **destination:** recognize machine_oauth accounts as oauth ([#7549](#7549)) ([f51e4ca](f51e4ca)) * incremental definitions on the v2 namespace config ([#7487](#7487)) ([ce51e38](ce51e38)) * **processor:** add flag to abort python transformations on deployments that do not offer them ([#7571](#7571)) ([ca85eb2](ca85eb2)) * **processor:** filter http v2 events by destination message types ([#7538](#7538)) ([58fd176](58fd176)) * **processor:** send the workspace id to per-workspace pyt pods ([#7551](#7551)) ([ea33835](ea33835)) * **warehouse:** add maxcompute destination ([#7568](#7568)) ([a64bfd9](a64bfd9)) ### Bug Fixes * **batchrouter:** abort bq stream all events jobs on terminal auth failures ([#7548](#7548)) ([6b7e023](6b7e023)) * bump andybalholm/brotli to v1.2.7 [SEC-759] ([#7525](#7525)) ([6dfe468](6dfe468)) * bump rudder-go-kit to v0.84.3 ([#7547](#7547)) ([355054a](355054a)) * **core:** schema forwarder panics on shutdown ([#7519](#7519)) ([dd61cfc](dd61cfc)) * database connections hang when context is cancelled during a copy ([#7578](#7578)) ([8dae6e3](8dae6e3)) * **jobsdb:** compaction missing pairs after one that doesn't fit ([#7574](#7574)) ([573271b](573271b)) * **jobsdb:** multiconsumer recovery misses a consumer's executing status after another consumer's later status ([#7554](#7554)) ([69b43e0](69b43e0)) * **jobsdb:** old jobs not expiring for every consumer ([#7573](#7573)) ([366f114](366f114)) * **jobsdb:** pickups stalling on status tables with skewed stats ([#7572](#7572)) ([318446f](318446f)) * **jobsdb:** unionjobsdb functions pick the first datasets by table name ([#7558](#7558)) ([e94d6c5](e94d6c5)) * **router:** event order test only counts drained jobs of the last dataset ([#7552](#7552)) ([b0a097a](b0a097a)) * **router:** mask secrets in array-shaped reporting samples ([#7536](#7536)) ([902160f](902160f)) * **warehouse:** hot-reload degraded workspaces without aborting restored uploads ([#7564](#7564)) ([cb98598](cb98598)) * **warehouse:** match deltalake columns case-insensitively ([#7563](#7563)) ([a7d30d7](a7d30d7)) * **warehouse:** migrate snowflake to gosnowflake v2.3.0 ([#7542](#7542)) ([cc09426](cc09426)) * **warehouse:** skip job-creation error log on router shutdown ([#7567](#7567)) ([895367e](895367e)) ### Miscellaneous * **deps:** bump github.com/go-jose/go-jose/v4 from 4.1.4 to 4.1.6 ([#7545](#7545)) ([35ee952](35ee952)) * export only the +Inf bucket for limiter timers ([#7570](#7570)) ([4429472](4429472)) * **router:** add drainReason label to pipeline_processed_events ([#7561](#7561)) ([af0aef8](af0aef8)) * sync release v1.92.0 to main branch ([#7534](#7534)) ([9ab165d](9ab165d)) * **warehouse:** bump sqlconnect-go to v1.37.1 ([#7575](#7575)) ([acdad67](acdad67)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>

Description
Make
Warehouse.degradedWorkspaceIDsreloadable and refresh each WatchConfig subscriber from its last backend snapshot. Protect the interval before BCM/router consumption by deferring uploads whose exact connection is still present in the full snapshot; preserve aborts for absent connections.Linear Ticket
RUD-3445
Security
Validation
go test -race -count=1 ./warehouse/multitenant/...— passed.go test -race -count=1 ./warehouse/router/...— passed.go test -count=1 ./warehouse/multitenant ./warehouse/archive ./warehouse/api ./warehouse/internal/api— passed.go vet ./...,go build ./...,make fmt, andgit diff --check— passed.make lint: golangci-lint reported0 issues; actionlint passed. Simplify pass replaced duplicate test-stat setup withRouter.loadStats(); other suggestions were rejected because they added work for the tiny list or required unfiltered data in BCM.Local
miniintegration: skipped;rudder-servercannot run this checkout from source in the supported sandbox build tier.make lintdoes not finish successfully: its gitleaks security subtarget scans the existing commit history and reports 34 leaks. No security finding in the changed files was reported.mini; its stockrudder-serverimage does not contain these edits.Adversarial self-review surfaced findings that were not auto-fixed. Each carries its disposition — please evaluate before merging.
warehouse/multitenant/manager.go:193— not auto-fixed (iteration budget exhausted)warehouse/router/router.go:443— not auto-fixed (iteration budget exhausted)