Skip to content

fix(satellite): bring every local replica up before repeat passes - #298

Merged
Andrei Kvapil (kvaps) merged 6 commits into
mainfrom
fix/satellite-bringup-first
Nov 24, 2026
Merged

Andrei Kvapil (kvaps) merged 6 commits into
mainfrom
fix/satellite-bringup-first

Conversation

@kvaps

@kvaps Andrei Kvapil (kvaps) commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Stacked on #295; review after it.

What this PR does

After a node reboot the satellite now brings every local replica up before it spends a worker on another pass of a replica that is already up.

On a test node with 114 replicas and eight resource workers, 63 replicas came up in about two minutes and then nothing happened for 3 min 10 s: no new attach, no log line, while the remaining 51 replicas waited. controller-runtime queues a Resource that is already in the API when the satellite starts at low priority (initial list) and every later event at normal priority. Each replica that comes up produces kernel and peer events (connections, resyncs, peer disk states) that queue it again at normal priority. Once more replicas are up than there are workers, those repeat passes hold every worker, and the replicas still waiting for their first pass sit behind them until the resync events die down. With a single worker only one replica came up at a time, so the events never piled up; the parallel bring-up of #295 made it visible.

The resource controller's queue now ranks the first pass of every local Resource in this process above every other pass. The ranking is applied at the queue, which every add goes through (the watches, the map functions, the observer channel and the reconciler's own retries). A replica gives the rank up when its first pass starts, whatever that pass ends with, so a replica whose pass keeps failing (its storage pool not imported after the reboot, say) is retried like any other pass and cannot hold every worker for as long as it fails. A pass that only stamps the finalizer does not count, since the pass it requeues is the one that brings the replica up. A replica created later, or created again under a deleted one's name, is ranked first the same way. A first pass's requeue (a failure retry, a wait, work the pass put off) runs at normal priority: #295 names normal priority on every result of Reconcile, and an add that still carries the rank for a replica that had its first pass is put back to normal priority too. This matches LINSTOR's device manager, which dispatches every resource of the first full sync once and retries a failure as an ordinary update.

This PR is stacked on #295 (fix/satellite-parallel-bringup) and carries its current head and main. #295 dropped the periodic re-check and counts passes by reason; the rank is applied in the queue, so every source #295 wires (the For watch, the sibling and definition map functions, the render-input watches, the drift trigger, the observer channel) is ranked the same way for a replica waiting for its first pass, and untouched for one that had it.

Testing

  • New envtest TestColdStartBringsEveryReplicaUpUnderEventChurn: 24 replicas exist before the satellite starts, four workers, and every replica that has had a pass keeps sending observer wake-ups. Without the change 4 of 24 replicas come up within the budget and the rest never get a pass; with it all 24 come up, and each one gives the bring-up rank back afterwards.
  • New envtest TestColdStartFailingReplicasDoNotStarveTheRest: two workers, four healthy replicas and six in a pool whose passes fail and whose replicas keep sending observer wake-ups. Every replica gets its first pass, and an event for a healthy replica afterwards reaches it within five seconds. With the rank held until a clean apply, the event never gets a pass.
  • New unit tests for the queue: a pending replica is raised to the bring-up rank on every kind of add, a replica that already had its first pass keeps the priority it was queued with, a requeue of a first pass runs at normal priority whether the replica came from the initial list or from an event, a failure retry is not ranked, and a forgotten replica is ranked first again.
  • Mutation checks: disabling the rank, holding the rank until a clean apply, dropping the start mark, and letting a requeue keep any priority other than normal each make a test fail.
  • go test ./... with envtest and the integration tests for burst provisioning, spawn, sync progress and resize, on the merge of fix(satellite): bring a rebooted node's resources up in parallel #295's head (f3654ba) and main. Lint is read from CI.

Not tested

  • A reboot of a real storage node with this build: the stall was observed on a test cluster running v0.4.0-alpha.5 and is reproduced here in envtest only.
  • The satellite also runs at its CPU limit for its whole life on that cluster (about 99.8 % of CFS periods throttled, also on idle nodes), which slows every pass. That is a separate problem and is not changed here.

After a reboot with eight workers the satellite brought 63 of 114
replicas up, then went three minutes without a pass reaching a new
replica, and nothing was logged. controller-runtime queues a Resource
from the initial list at low priority and every later event at normal
priority. Each replica that comes up sets off kernel and peer events
that queue it again at normal priority, so once more replicas were up
than there are workers, their repeat passes took every worker and the
replicas still waiting for their first pass stayed behind them until
the resync events died down. With one worker only one replica came up
at a time, so its events never piled up.

Rank a local Resource this process has not brought up yet above every
other pass, at the queue, which every add goes through. LINSTOR's
device manager likewise applies every resource of its first full sync
before it turns to updates. The periodic re-check scheduled by the
pass that brings a replica up goes back to low priority.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
A replica kept the bring-up rank until a pass applied with no failure.
One whose pass never succeeds, its storage pool not imported after a
reboot say, then stayed ahead of every other pass for as long as it
failed: its retries and its kernel and peer events all queued at the
rank, and once there were as many of those replicas as workers, an
event for a healthy replica (a peer coming back, a toggle-disk, a
migration) never got a pass.

Give the rank up when the first pass starts, whatever it ends with.
LINSTOR's device manager does the same: it dispatches every resource
of the first full sync once and retries a failure as an ordinary
update. A pass that only stamps the finalizer does not count, as the
pass it requeues is the one that brings the replica up.

The requeues of a first pass now return to the priority the replica
would have had without the rank instead of always to low priority, so
a replica created while the satellite runs keeps re-checking at
normal priority as it did before. The queue logs through the
controller logger the default queue uses.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a rebase onto #295's current head before I can review its own diff. The branch carries #295 only up to 06b5234, and git merge-tree against #295's head conflicts in pkg/satellite/controllers/resource.go (against main also in reconciler.go). The conflict is in the wiring itself: bringUp sits next to the recheck gate, which #295 replaced with the pass counter, and #295 also dropped the periodic re-check that the body and the requeue tests still describe. How the rank composes with the pass counter and the new render-input and drift watches is a real decision, so I'd rather review it after the rebase.

…gup-first

Bring the stacked base up to its current head. The base now pins
every retry of a pass to normal priority, counts passes by reason
and dropped the periodic re-check, so the bring-up test that used
its interval now uses the failure back-off.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
…-first

Main and the stacked base both changed the requeue after an apply:
main repeats a pass whose grow waits for its device, the base drops
the periodic re-check and retries a failed status stamp. Keep both in
the base's applyRequeue, count a failed apply-failure record as a
failed stamp, and remove the born-solo marker with the .res candidate
on delete.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The base this branch stacks on now names normal priority on every
result Reconcile returns, so every retry runs there and a requeue no
longer comes back at the bring-up rank. The queue's record of the
priority each pending replica asked for, used to send that requeue
back to low priority for a replica of the initial list, had nothing
left to do and contradicted that rule. The queue now keeps only which
replicas had their first pass, and an add that still carries the
rank for one of them, from a pass that ended in a recovered panic,
goes to normal priority like any retry.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@kvaps

Copy link
Copy Markdown
Member Author

Merged #295's current head (f3654ba) in 035e0b6 and then main in 4c90458, no rebase. The main merge resolves the same conflicts #295 will meet: the grow-pending requeue from main now sits in #295's applyRequeue, a failed apply-failure record counts as a failed stamp, and the delete removes both the .res candidate and the born-solo marker.

How the rank composes with the pass counter and the new watches: the rank lives in the queue, so it does not care where an add comes from. The pass counter marks events before they reach the queue and counts a pass when Reconcile starts; the render-input watches and the drift trigger add through the same queue, so a replica still waiting for its first pass is ranked whichever of them queues it, and one that had its first pass keeps the priority the source asked for. The one real interaction was the requeue: #295 now names normal priority on every result of Reconcile, so the bookkeeping this branch had to send a first pass's requeue back to low priority for a replica of the initial list was dead and contradicted that rule. c83fc21 drops it: the queue only remembers which replicas had their first pass, and an add that still carries the rank for one of them (a pass that ended in a recovered panic) goes to normal priority. TestBringUpQueueDropsTheRankAfterTheFirstPass fails if that add keeps any other priority.

The periodic re-check is gone from the tests (the bring-up test used its interval only as a delay and now uses the failure back-off), and the description is updated to match: first passes at the rank, everything else as #295 queues it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. With #295's head merged in, the rank sits in the queue wrapper, so every source #295 wires (For, the map functions, the render-input and drift watches, the observer channel) gets the same treatment, and the pass counter is untouched. Dropping the low-priority requeue bookkeeping in c83fc21 fits #295's rule that Reconcile names normal priority on every result. Against #295's current head and current main this merges cleanly, and reconciler.go comes out identical to #295's, so both main merges resolved the same way. Since the base is still main, this should merge after #295.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@kvaps
Andrei Kvapil (kvaps) merged commit 5c12ff1 into main Nov 24, 2026
4 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants