mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
storage: an aborted cut reissues the touch request (red); the row in the approved wording
A cut that took a recovery's clean-fill request and aborts (its copy window cannot install) reissues the request under a fresh generation: a new red checks the next cut still covers the fills. The ordering row takes the approved wording: a reader clears by a CAS on its own generation, a barrier takes the request before the set, and an aborted cut reissues it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dfc25c9c72
commit
feb70ac198
2 files changed
+40
-1
No files matched your search
@@ -561,3 +561,42 @@ func TestCandidateSetCopiedWordsListTheMembers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A cut that took a recovery's request and then aborts (its copy window
|
||||
// cannot install) reissues the request under a fresh generation, so the
|
||||
// next cut still covers the clean fills it owed.
|
||||
func TestACutThatAbortsAfterTakingTheRequestReissuesIt(t *testing.T) {
|
||||
_, l, _ := filledFreshVolume(t)
|
||||
if _, err := l.Cut(ctTimeout(t)); err != nil { // consume the seed, empty the set
|
||||
t.Fatal(err)
|
||||
}
|
||||
findings := localOracle(t)
|
||||
l.testBeforeBarrierLockHook = func() { l.noteAllMutated() } // after prepareTouched: the barrier takes it
|
||||
var taken uint64
|
||||
l.testBetweenTakes = func() {
|
||||
taken = l.touchFilledSeq.Load() // the generation the barrier just took
|
||||
l.cowMu.Lock()
|
||||
l.cowTransitions++ // the copy window cannot install: the cut aborts
|
||||
l.cowMu.Unlock()
|
||||
}
|
||||
t.Cleanup(func() { l.testBeforeBarrierLockHook, l.testBetweenTakes = nil, nil })
|
||||
if _, err := l.Cut(ctTimeout(t)); !errors.Is(err, errCutCOWAborted) {
|
||||
t.Fatalf("a cut whose window cannot install: %v", err)
|
||||
}
|
||||
l.testBeforeBarrierLockHook, l.testBetweenTakes = nil, nil
|
||||
l.cowMu.Lock()
|
||||
l.cowTransitions--
|
||||
l.cowMu.Unlock()
|
||||
if got := l.touchFilled.Load(); got == 0 || got == taken {
|
||||
t.Fatalf("after the aborted cut the request is %d (taken %d): want a fresh pending generation", got, taken)
|
||||
}
|
||||
if _, err := l.Cut(ctTimeout(t)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if f := findings(); len(f) != 0 {
|
||||
t.Fatalf("the cut after an aborted one missed %d candidates; first: %s", len(f), f[0])
|
||||
}
|
||||
if got := l.touchFilled.Load(); got != 0 {
|
||||
t.Fatalf("the next cut left request generation %d pending", got)
|
||||
}
|
||||
}
|
||||
@@ -645,7 +645,7 @@ The "Machine / transition" column refers to Part A. Notes under a table record w
|
||||
| `INV-WAL-V3-WRITE-AHEAD-001` | No extent byte reaches the disk before its WAL record is durable: the flusher writes an extent only from dirty entries at or below the synced (acknowledged) WAL frontier; Recover and the install log fsync their records before raising it. | M1 Serving (flusher extent write) | `core/storage/flusher.go` `flushOnceInternal`; `walstore_v3.go` `recoverV3` (descriptor publish fsync before `wack`); `install_log_v3.go` | `TestRedCrashKeepingAnUnsyncedExtentWriteLeavesLocalAndHEADApart` (`core/storage/chunk_u1_reorder_test.go`); `TestFlusherWriteAheadNeverFlushingGuestReachesExtentAtPressure` (`core/storage/flusher_write_ahead_test.go`) | A checkpoint may pass a synced record superseded by an unsynced newer one only because the cycle's sync covers the whole file, WAL included (one file, one descriptor: `INV-WAL-FLUSH-SYNC-COVERS-WAL-001`); separating WAL and extent, or a range sync, must first change the checkpoint bound | ACTIVE |
|
||||
| `INV-WAL-V3-CAPTURE-CANDIDATES-001` | A retained WAL entry already covered by HEAD is not dirt since HEAD. New post-HEAD WAL entries, UNKNOWN map chunks and map max-LSN above HEAD remain capture candidates, except as `INV-WAL-V3-CAPTURE-COMPARED-001`. | M5 candidate selection | `chunk_layer.go` `captureCandidates` | `TestChunkLayerV3CapturedUncheckpointedWALIsCleanUntilRewritten`, `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestBaseInstallV3CompletePersistsTheMapUnknownOfBaseWrites` | Conservative reachability unchanged; narrower redundant work | ACTIVE |
|
||||
| `INV-WAL-V3-CAPTURE-CANDIDATES-TOUCHED-001` | The barrier's candidate step judges only a touched set (a chunk bitmap with a word summary) with INV-WAL-V3-CAPTURE-CANDIDATES-001's predicate, never every chunk; the set covers every chunk whose answer may have changed since the barrier took it. The cut syncs before the barrier, outside the pause. | M5 candidate selection (CandBitmap: NoBitLost, SummaryCovers) | `chunk_layer.go` `candidatesFrom`, `takeTouched`, `seedTouched`, `touch`, `OnMapEntryChange`, `noteMutation`, `setHeadLocked`, `applyCommitLocked`; `walstore_map_checkpoint_v3.go` `recordMapWriteV3`; `base_install_v3.go` `markMapUnknownV3`; `chunk_record_candidates.go` `candidateSet` | `TestIdleCutCandidateWorkIsFlatInS`, `TestOneChangedChunkCutVisitsNoFullScan`, `TestCutSyncsBeforeItsBarrier`, `TestUnknownCommitOutcomeLosesNoChunk`, `TestCandidateSetOrBackKeepsTheSummary` (`chunk_cut_candidate_set_test.go`); `TestEveryLocalWriteAfterACleanFillMakesTheChunkACandidate`, `TestACleanFillRecordEndsWithItsHeadRef` (`chunk_fresh_readback_candidates_test.go`); `TestSpacePerChunkAt1TiBShape` (`chunk_space_baseline_test.go`) | The candidate set is the same; an idle cut's candidate work no longer grows with S | ACTIVE |
|
||||
| `INV-WAL-V3-TOUCH-FILLED-ORDER-001` | Every fill a request still owes at a barrier's start is covered by that cut (by the request or by its touches); a request is cleared only after its touches are in the set, and only by a CAS on its own generation. | M5 candidate selection | `core/storage/chunk_layer.go` `resolveTouchFilled`, `requestTouchFilled`, `captureLocked` | `TestAReaderMidResolveDoesNotHideARecoveryFromACut`, `TestAReaderResolvingInsideTheBarrierDoesNotHideARecovery` (`core/storage/chunk_cut_candidate_set_test.go`) | TouchFilled CutSeesRequest, NoLostRequest | ACTIVE |
|
||||
| `INV-WAL-V3-TOUCH-FILLED-ORDER-001` | Every fill a request still owes at a barrier's start is covered by that cut (by the request or by its touches); a reader clears a request only after its touches are in the set, by a CAS on its own generation; a barrier takes it before the set, and an aborted cut reissues it. | M5 candidate selection | `core/storage/chunk_layer.go` `resolveTouchFilled`, `requestTouchFilled`, `captureLocked` | `TestAReaderMidResolveDoesNotHideARecoveryFromACut`, `TestAReaderResolvingInsideTheBarrierDoesNotHideARecovery`, `TestANewerRecoveryRequestOutlivesAnOlderReader`, `TestACutThatAbortsAfterTakingTheRequestReissuesIt` (`core/storage/chunk_cut_candidate_set_test.go`) | TouchFilled CutSeesRequest, NoLostRequest | ACTIVE |
|
||||
| `INV-WAL-V3-CAPTURE-COMPARED-001` | A chunk known equal to HEAD is neither staged nor compared again while its mutation version and HEAD ref match; own-batch chunks remain candidates. An interrupted or refused cut retains these proofs and requeues only unproven chunks. All candidate paths use one predicate. | M5 candidate selection | `core/storage/chunk_layer.go` `knownEqualToHeadLocked`, `captureCandidates`, `captureLocked`, `recordCapturedEqualMarks`, `stage`, `requeueCut`; `chunk_cut_payload.go` `markEqualNow` | `TestFreshFromHeadReadBackLeavesNoCutCandidates`, `TestFreshFromHeadFilledThenWrittenIsACandidate`, `TestEveryLocalWriteAfterACleanFillMakesTheChunkACandidate`, `TestABaseInstallAfterCleanFillsEndsTheirRecords`, `TestACleanFillRecordEndsWithItsHeadRef`, `TestARestoreTargetThatOnlyReadCutsNothing`, `TestARerunAfterAFailedCutComparesOnlyWhatDiffers`, `TestWithoutAFailedCutEveryUnknownChunkIsCompared`, `TestACutOffCompareKeepsItsWorkAndTheRerunComparesOnlyTheRest`, `TestFilledChunksAreFirstCutCandidatesAfterARestart`, `TestEveryDirtyMapInsertNotesTheChunkMutation`, `TestOwnBatch_BoundedBatchesReplaceEveryForeignKey`; `TestRefusedFullCutStagesOnlyTheUnmarkedChunk` (`core/storage/chunk_staging_equal_test.go`); `TestCopyErrorKeepsCapturedEqualMarks`, `TestInterruptedStagingKeepsEqualWork` (`core/storage/chunk_copy_error_equal_test.go`); `TestTimedOutRequestsThenRefusedCommitKeepEqualWork` (`core/frontend/chunkstore/layout_staging_retry_test.go`); also in `core/storage/chunk_fresh_readback_candidates_test.go`, `core/frontend/durable/first_cut_known_zero_test.go`, `core/storage/chunk_compare_progress_test.go`, `core/storage/chunk_mutation_note_guard_test.go`, `core/storage/chunk_own_test.go` | EqualMarks.MarkSound, EqualMarks.NoRecompare (must-violate rows 102-104); conservative reachability unchanged | ACTIVE |
|
||||
| `INV-CHUNK-STATE-UPGRADE-FENCE-001` | The chunk-state upgrade fence succeeds only after both descriptor slots are fsynced and read back with the format marker and local-work epoch; matching reopened slots require a fresh sync; uncertain writes or readback latch until reopen. | M1 format upgrade (caller not wired) | `core/storage/chunk_state_upgrade.go` `WALStore.FenceChunkStateUpgrade` | `TestChunkStateUpgradeFencesBothSlotsBeforeCompletion`, `TestChunkStateUpgradeUncertainSecondSlotRequiresReopen`, `TestChunkStateUpgradeFailureNeverCompletesUntilReopen`, `TestChunkStateUpgradeOldReaderPublicationRestartsTheFence`, `TestChunkStateUpgradeReopenedCachedPairNeedsFreshSync`, `TestChunkStateUpgradeRejectsSuccessfulWrongReadback` (`core/storage/chunk_state_upgrade_test.go`; single-publication and unlatched-readback mutant controls) | `CHUNK-STATE-r3` section 18; `SlotFence` rows 146-149 | STUB |
|
||||
| `INV-STORE-FORMAT-NEWER-001` | An intact descriptor slot naming a store format newer than this binary reads is refused typed (`ErrStoreFormatNewer`), never as an invalid descriptor; an open refused at slot selection removes no file. | M1 open | `core/storage/superblock_v3.go` `decodeSlotV3`, `selectSlotV3`; `core/storage/walstore_v3.go` `openWALStoreV3File` | `TestANewerStoreFormatIsRefusedTypedAndUntouched` (`core/storage/superblock_v3_format_newer_test.go`; refusal without the typed check and discard-before-select controls) | `SlotFence2` OpenNew | ACTIVE |
|
||||
|
||||
Reference in new issue
Block a user