Repository navigation
Conversation
The journal raid of a node is built over the journal partitions of its devices and kept that member list for life: a device migrated out after a failure left the raid degraded for good, and a device with a journal partition the raid did not use never joined it. A raid0 leg cannot take a member in or give one up, and the raid has no superblock, so the raid is now built anew, empty, over the members the node's devices call for, and the journal coordinator of the LVS leader resynchronises it from the node's other journal copies. A jm_raid_reshape task does it on the restart runner: queued when a device reaches failed_and_migrated or is added, started only on an active cluster with every node online, no migration or restart open and every journal in sync, one node at a time, and finished once jc_get_jm_status reports the journals in sync on three consecutive polls. A device that is only missing keeps its member, as before. Raid legs are capped at four devices: two legs up to eight devices, three from nine to twelve, and so on. A JM that holds a journal is rebuilt from the legs recorded for it and never from the planner, so a node of more than eight devices built as two halves keeps reading its journal. On block-device nodes every device now gives a journal partition of --jm-percent of the node's smallest device, where it was sized from the node's total capacity and the number of devices. The size no longer depends on the device count, so a device that joins later is split to the same size. The journal partition of a device that left the raid is not offered as a new data device by a restart. The planner helpers that assumed exactly two legs and had no caller are removed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The jm_raid_reshape task trusted jc_get_jm_status to tell when the rebuilt, empty JM was back in sync. On the lab the LVS leader reported every JM of its journal ready while the leader's own rebuilt JM did not hold that journal at all: the journal coordinator re-levels a JM it reaches over the network when it reconnects, and does not for its local one. The task reported "journals in sync" on a node whose JM held two of three journals. The JM itself is now asked whether it holds each journal it is a copy of (bdev_jm_get_status), and a journal it lacks that nobody replicates is started with jc_explicit_synchronization on the confirmed LVS leader, never on a follower. A journal that still does not arrive after ten synchronisations costs the task retries instead of an endless wait. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The rebuild, its task and the journal resync read and write node and task records, so their tests belong to the integration tier: 36 cases drive the restart runner's spec over seeded clusters in FoundationDB, with only the SPDK RPC client, the leadership probe and the device-status fan-out replaced. The unit file keeps what is pure logic. Writing them showed the task marking itself as rebuilding before it knew the rebuild could start: a member that was absent then cost a retry and, worse, let every later attempt skip the quiet-cluster checks although nothing had been taken down. Whether the raid can be rebuilt is now asked with the other preconditions, before the phase is recorded. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The task synchronised a journal to the rebuilt JM only when the JM reported that it did not hold it. On the lab that report was wrong more often than right: after a rebuild the leader's own JM answered bdev_jm_get_status with the journal as held while nothing had been replicated to it, and a restart of the node then found that journal not on its disks and had it replicated from the peers. The journals that were replicated (SPDK logs the start and the end of the replication) did read back after an immediate restart. Neither status RPC proves a rebuilt JM was brought up to date, so every journal the JM is a copy of is now synchronised explicitly on its LVS leader once after the rebuild, and again while the JM reports it missing. A journal whose replication is already running is synchronised when that is over, not on top of it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
failed_and_migrated says a device's data was moved elsewhere and its place in the cluster given up; a replacement enters as a new record (new_device_from_failed). Nothing enforced that. device_set_state treated only "failed" as a state with restricted exits, and the node monitor's re-admit of a recovered node's devices skipped the online, removed and failed ones and set every other device ONLINE. On the lab a node was marked unreachable for a moment while a peer restarted, and was cleared back to ONLINE. The monitor set the three devices of that node that had been migrated out ONLINE again. SPDK could open none of them, each was walked through unavailable to removed, and with the peer still restarting the cluster was suspended and client IO failed. device_set_state now refuses every transition out of failed_and_migrated, whatever the cause, and the re-admit names the states it leaves alone, failed_and_migrated and new (a device that is not part of the cluster yet) among them. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> (cherry picked from commit 40a572f)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1689 (base branch
feat/lblk-journal-raid). Review and merge that one first.What this changes
The journal raid of a node follows its devices. The raid is built over the journal partitions of the node's devices and used to keep that member list for life. A device migrated out after a failure left the raid degraded for good, and a device with a journal partition the raid did not use never joined it.
A raid0 leg cannot take a member in or give one up, and the raid has no superblock. So the raid is built anew, empty, over the members the node's devices call for, and the journal is resynchronised from the node's other journal copies. A
jm_raid_reshapetask does it, on the existing restart runner (no new service to deploy):failed_and_migrated, or a device is added;jc_get_jm_statusreports them in sync on three consecutive polls.A device that is only missing keeps its member, as in #1689: the JM runs on the other legs and the leg is rebuilt when the device returns.
Raid legs are capped at four devices (decision from the design discussion): 1 device no raid, 2 devices raid1, 3-8 devices raid1 over two raid0 legs, 9-12 over three, and so on. Up to eight devices the split is the one every existing RAID 0+1 JM was built with.
A JM that holds a journal is rebuilt from the legs recorded for it, never from the planner. Without this, a node of more than eight devices built as two halves would be re-read as three legs after the upgrade and its journal would be unreadable.
Block-device nodes: the journal partition is
--jm-percentof the node's smallest device, on every device. #1689 sized it from the node's total capacity and the number of devices. The size no longer depends on the device count, so a device that joins later is split to the same size. This must not be released after #1689 alone: the partition size cannot be changed on disks that hold data.Clusters pinned to the legacy mirror-over-all-devices layout keep it, also through a rebuild.
Found on the lab and fixed here
The first lab run reported "journals in sync" on a node whose rebuilt JM held two of its three journals. The LVS leader re-levels a JM it reaches over the network when it reconnects; it does not for its own local JM, and
jc_get_jm_statusstill reports that JM ready. The task now asks the JM itself (bdev_jm_get_status) and starts a missing journal withjc_explicit_synchronizationon the confirmed LVS leader, never on a follower.Tested
Unit: 79 new test functions (
tests/unit/test_jm_raid_reshape.py), existing planner and sizing tests updated. Lint clean.Lab (Talos, 3 nodes, 4 emulated NVMe drives each, 1+1, verified fio randrw running throughout):
Not tested, and known gaps
helper_sync_setter: jfi_w_set_crossjm_sync_id failed, JM is excluded from further operationonce, in both lab runs. The JM kept receiving records and read back after a restart; to be confirmed as harmless by the data-plane team.🤖 Generated with Claude Code