mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
storage: a rewind writes the earliest outstanding position
A rewind whose cursor write failed leaves the walk position at its chunk; a later rewind to a higher chunk writes that position, not its own, so a reopen never skips the chunks of the failed one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2cd6f1de1a
commit
22e80a6e73
2 files changed
+5
-3
No files matched your search
@@ -179,11 +179,13 @@ func (p *upgradePass) Rewind(chunk uint64) error {
|
||||
p.next = chunk
|
||||
}
|
||||
p.since = 0
|
||||
if chunk >= p.cur.Next {
|
||||
// The walk position is the earliest outstanding rewind: a rewind whose
|
||||
// cursor write failed is kept there, and a later rewind writes it.
|
||||
if p.next >= p.cur.Next {
|
||||
return nil
|
||||
}
|
||||
c := p.cur
|
||||
c.Next = chunk
|
||||
c.Next = p.next
|
||||
return p.persistLocked(c)
|
||||
}
|
||||
|
||||
|
||||
@@ -615,7 +615,7 @@ The "Machine / transition" column refers to Part A. Notes under a table record w
|
||||
| `INV-WAL-V3-DESCRIPTOR-001` | A v3 descriptor slot is used only if it is valid: a matching CRC32C (Castagnoli), every reserved byte zero, an accepted impl, a nonzero slotGen at most 2^64-2, a nonzero nonce, and geometry consistent under checked arithmetic. | M1 Opened (v3 descriptor selection) | `core/storage/superblock_v3.go` `decodeSlotV3`, `descriptorV3.validate`, `checkedAddV3` | `TestSlotV3VectorsDecodeAsExpected`, `TestSlotV3CounterExhaustion` (`core/storage/superblock_v3_test.go`) | — | STUB |
|
||||
| `INV-WAL-V3-DESCRIPTOR-BASE-001` | A valid v3 descriptor slot has CheckpointLSN ≤ mapCoveredCheckpoint ≤ W, and BASE fields that follow the rules of its BASE state. | M1 Opened (v3 descriptor selection) | `core/storage/superblock_v3.go` `descriptorV3.validate` | `TestSlotV3VectorsDecodeAsExpected`, `TestSlotV3InstalledMayHaveCursorBelowTail` (`core/storage/superblock_v3_test.go`) | — | STUB |
|
||||
| `INV-CHUNK-RECORD-PAGES-CURRENT-001` | An unfinished chunk record is used, and its header written, only when every page passes its check and is valid through exactly the store's synced position after recovery (behind: missed writes; ahead: not durable); an unmarked store discards it; the header follows the two-slot fence. | M1 Opened (chunk record load, v1.1 upgrade) | `core/storage/chunk_record.go` `loadChunkRecord`, `completeChunkRecord` | `TestUnfinishedRecordPagesBehindTheStoreAreNotTrusted`, `TestUnfinishedRecordAfterAnOldCheckpointIsDiscarded`, `TestStalePagesAreNeverCompleted`, `TestUnfinishedPagesAheadOfTheStoreAreNotTrusted`, `TestCompleteRecordAheadOfTheStoreIsNotTrusted`, `TestCompleteRecordPagePositions`, `TestRecordHeaderWaitsForTheFence`, `TestRecordHeaderIsNotWrittenAheadOfTheSyncedStore`, `TestDamagedPage` (`core/storage/chunk_record_test.go`) | SlotFence `PagesCurrent`, `FenceHolds`; pages carry chunk-kernel/2 states (the per-chunk state models are not in this repository) | STUB |
|
||||
| `INV-CHUNK-UPGRADE-PASS-CURSOR-001` | The upgrade's compare pass persists its cursor only after the pages of every chunk behind it, resumes at the persisted cursor after a restart, moves it back to a rebuilt page's first chunk, and refuses a request needing every hash known with in_progress and its progress. | M1 Opened (v1.1 upgrade compare pass) | `core/storage/chunk_upgrade_pass.go` `upgradePass.Run`, `advance`, `Rewind`, `Admit` | `TestUpgradePassCursorFollowsThePagesBehindIt`, `TestUpgradePassRestartContinuesAtTheCursor`, `TestUpgradePassRewindAfterARebuiltPage`, `TestUpgradePassRefusesWithProgress`, `TestUpgradePassPauseAndHurry`, `TestUpgradePassFailedRewindKeepsAdmissionClosed`, `TestUpgradePassOneRunAndRewindDuringACompare`, `TestUpgradePassKeepsItsCountAcrossRuns` (`core/storage/chunk_upgrade_pass_test.go`) | UpgradePass `BehindCursorKnown`, `NoWorkTwice` (the per-chunk state models are not in this repository) | STUB |
|
||||
| `INV-CHUNK-UPGRADE-PASS-CURSOR-001` | The upgrade's compare pass persists its cursor only after the pages of every chunk behind it, resumes at the persisted cursor after a restart, moves it back to a rebuilt page's first chunk, and refuses a request needing every hash known with in_progress and its progress. | M1 Opened (v1.1 upgrade compare pass) | `core/storage/chunk_upgrade_pass.go` `upgradePass.Run`, `advance`, `Rewind`, `Admit` | `TestUpgradePassCursorFollowsThePagesBehindIt`, `TestUpgradePassRestartContinuesAtTheCursor`, `TestUpgradePassRewindAfterARebuiltPage`, `TestUpgradePassRefusesWithProgress`, `TestUpgradePassPauseAndHurry`, `TestUpgradePassFailedRewindKeepsAdmissionClosed`, `TestUpgradePassAFailedRewindIsKeptByTheNext`, `TestUpgradePassOneRunAndRewindDuringACompare`, `TestUpgradePassKeepsItsCountAcrossRuns` (`core/storage/chunk_upgrade_pass_test.go`) | UpgradePass `BehindCursorKnown`, `NoWorkTwice` (the per-chunk state models are not in this repository) | STUB |
|
||||
| `INV-CHUNK-RECORD-PAYLOAD-001` | Persisting and loading a chunk record preserves every entry's state and hash, including entries on either side of a segment boundary. | M1 chunk record codec (caller not wired) | `core/storage/chunk_record.go` `encodeChunkRecordPage`, `decodeChunkRecordPage` | `TestRecordEntryPayloadRoundTripsAcrossSegments` (`core/storage/chunk_record_test.go`; state-zero and one-entry hash-drop controls) | Encoding fidelity; no state transition change | STUB |
|
||||
| `INV-WAL-V3-DESCRIPTOR-SELECT-001` | Of the two v3 descriptor slots, open selects the valid selectable slot with the higher slotGen, and never a prepared migration slot. | M1 Opened (v3 descriptor selection) | `core/storage/superblock_v3.go` `selectSlotV3` | `TestSlotV3Selection` (`core/storage/superblock_v3_test.go`); `TestWALStoreV3CloseKeepsTheNewestSlotAAndItsW` (`core/storage/walstore_close_v3_test.go`) | — | ACTIVE |
|
||||
| `INV-WAL-V3-DESCRIPTOR-CONFLICT-001` | Open is refused when both v3 descriptor slots are valid but carry the same slotGen with different bytes, or disagree on the UUID or the geometry. | M1 Opened (v3 descriptor selection) | `core/storage/superblock_v3.go` `selectSlotV3`, `sameGeometryV3` | `TestSlotV3Selection` (`core/storage/superblock_v3_test.go`) | — | ACTIVE |
|
||||
|
||||
Reference in new issue
Block a user