Repository navigation
fix(controller,satellite): re-add a tiebreaker only after the survivors dropped the old peer - #307
Conversation
Deleting one diskful replica out of three leaves two and calls for a tiebreaker. When the only spare is the node that just lost its replica, the controller placed the witness there as soon as that node's Resource was gone, while the survivors' kernels still held the old connection. The witness came up with a new node-id and each survivor's adjust failed `new-peer ... name already exists` until the stale slot was reaped some 30 s later. LINSTOR keeps a deleted replica in the definition, flagged DELETE, until every satellite has dropped it, so its autoplacer never offers that node in this window. Do the same: a node any replica of the definition still reports a kernel connection to is not a tiebreaker candidate. A definition flagged DELETE gets no witness either, as LINSTOR never runs its auto-tiebreaker helper on a definition being deleted. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
A replica deleted and recreated on the same node before a survivor had run del-peer for it comes back under a new node-id. The kernel still holds the node under the old one, so adjust's new-peer fails `(174) name already exists`. drbdadm adjust does not get out of it: it matches peers by node-id, and the del-peer it schedules for the old id waits on that same failing new-peer. tearDownRemovedPeers does not see it either, as the node's name never left the .res. The apply failed on every pass until the stale-slot prune reaped the connection some 30 s later. Before the adjust, remove a kernel connection whose peer the desired state names under another node-id, by node-id through drbdsetup del-peer, as LINSTOR's satellite removes a peer being deleted, and forget its slot. The kernel is read only when the rendered .res does not already carry every peer's node-id, so a steady resource pays no extra call. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The tiebreaker picker keeps a node off while any replica's kernel still reports a connection to it. A replica whose satellite is offline keeps the connections it last reported for as long as it stays away, and nobody drops them, so a single offline survivor held the witness off the only spare node indefinitely and left the definition with two diskful replicas and no tiebreaker. LINSTOR's resource delete does not wait for an offline satellite either: the update to it ends in a not-connected warning and the delete goes on. The satellite learns the node's new node-id when it is back and drops the old connection itself, so only online replicas' kernel peers count now. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The comment claimed a definition adopted from LINSTOR mid-delete could carry the flag, but linstor-migrate skips such definitions. It also did not say that the guard stops all witness management for the definition, removal and the quorum recount included, which matters when the flag is written by hand and never cleared. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The re-identified peer teardown drops any kernel connection whose node-id differs from the one the controller now gives the peer. In the case it exists for, the replica behind the old node-id is gone, so the old connection sits in Connecting or StandAlone. A Connected slot under a mismatching node-id means the ids disagree some other way, and dropping it cuts a working peer, possibly the only UpToDate source of a diskless primary. Before the teardown existed, adjust simply failed in that case and the connection stayed up; it does so again. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The old connection can go on its own between the kernel read and the del-peer, which then fails with "unknown connection" and failed the whole apply pass. LINSTOR's satellite hits the same race when two replicas are deleted at once and swallows it: it still runs forget-peer, and drops the del-peer error once forget-peer succeeds or the kernel no longer holds the peer. Do the same; a del-peer failure with the connection still present stays an error. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The re-identified peer check reads the kernel only while the .res names a peer under a stale node-id. A pass that rewrote the .res with the new node-id without reading the kernel (an unreadable kernel, or an older satellite before an upgrade) closed that window for good: the .res looked current, the adjust kept failing with "name already exists", and recovery waited on the stale-slot prune again. The check now also runs after the resource's last DRBD apply failed. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
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. |
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
On main this is correct: the kernel-peer exclusion ignores OFFLINE survivors, the satellite never drops a Connected slot, and a del-peer that lost a race is checked against the kernel before it fails the pass. Nothing blocking.
One merge-order hazard with #308, with no textual conflict to catch it. This PR relies on the RD reconciler's standing 5 s requeue to come back once the survivors have run del-peer. #308 removes that requeue, and the RD reconciler's Resource watch passes only generation changes, so a survivor dropping the old connection (a status write) wakes nothing. With both merged, the RD that skipped the node at the replica's delete stays without a witness, and with quorum off, until the informer resync. Whichever of the two lands second should ask for a retry (askRDRetry with rdReconcileRequeue) when a node was excluded only for a kernel connection, with a test like the placement-hold requeue one in #303.
What this PR does
When linstor-csi deletes a volume it removes the replicas one at a time. Removing one diskful replica out of three leaves two, so the controller wants a tiebreaker. On a three-node cluster the only free node is the one that just lost its replica. The controller put the tiebreaker there as soon as that node's Resource was gone, but the other replicas' kernels still held the old connection to it. The new replica got a new DRBD node-id, and each survivor's
drbdadm adjustfailed with(174) Already exists ... drbdsetup new-peer <res> <id> --_name=<node>on every pass, until the stale-slot prune removed the old connection about 30 seconds later. Each failure recorded aWarning ApplyFailedEvent.LINSTOR does not hit this. It keeps a deleted replica in the definition, flagged DELETE, until every connected satellite has dropped it, so its autoplacer cannot pick that node for a tiebreaker in the meantime. Its satellite also removes a peer being deleted with
drbdsetup del-peer <res> <node-id>, so a stale connection never sits in front of a new one.Controller:
Status.Connections) is not a tiebreaker candidate. The tiebreaker lands once every online survivor has run del-peer for the old replica. The reconciler already requeues every 5 seconds, so it does not wait for another event.Satellite:
drbdsetup del-peer, and its slot is forgotten when the local replica has metadata.drbdadm adjustcannot do this on its own: it matches peers by node-id, and the del-peer it schedules for the old id waits on the new-peer that fails.tearDownRemovedPeersmisses it too, because the node's name never left the.res..resdoes not already list every peer under its node-id, or when the resource's last DRBD apply on this satellite failed, so a resource whose peers have not changed makes no extra call. The second condition covers a.resalready rewritten with the new node-id by a pass that could not read the kernel, or by an older satellite before an upgrade, where the.reslooks current while the adjust keeps failing.Behaviour changes
ApplyFailedEvent for it.Known limitations
Reconcilerfields and conflict textually. Whichever merges second should read the kernel onadjustFailedBeforeand drop the separate map.Testing
internal/controller: no tiebreaker goes to a node while either online survivor still reports a connection to it, and one goes there once both have dropped it. The stale connections of an OFFLINE survivor do not keep the tiebreaker off. A definition flagged DELETE gets no tiebreaker. All fail without the fix.pkg/satellite: a peer the kernel holds under node-id 1 while the desired state lists it under node-id 3 is removed withdrbdsetup del-peer <res> 1and then forgotten. ThroughApply, that del-peer runs beforedrbdadm adjust. A peer under its current node-id, one without a node-id yet, or a Connected one is left alone. With an up-to-date.res, no command runs, and after anApplywhose adjust failed the nextApplyruns the del-peer before its adjust. A del-peer failing with "unknown connection" passes when forget-peer succeeds or the connection is gone, and fails when the connection is still there. Every branch was mutation-checked.dev/v0.4.0-alpha.10: the controller tests fail there, the commits cherry-pick cleanly, and the controller, satellite and drbd packages pass with them.make lint-config,golangci-lint run(0 issues),go test ./...andgo test -tags=integration ./tests/integration/....Not tested