mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 11:07:31 +01:00
When a layer's dirty set is unknown, its first cut used to hash-compare every chunk under the capture barrier, which paused writes for a whole-volume copy. The unknown case is a lost or mismatched bitmap, or a BASE install that just finished. Now the layer reconciles in the background, outside the barrier: - The reconcile set is every chunk with a local copy (an absent chunk never written locally is HEAD's content). - A layer-owned reconciler, joined on Close, takes bounded slices. Per chunk it reads through the normal read path, hashes, and compares with HEAD; a mismatch sets the chunk's dirty bit. A write racing the comparison marks its chunk dirty anyway. - When the set is empty, the dirty set is saved first, then a header naming HEAD. A crash between the two leaves a mismatching header, so the next attach reconciles again rather than trusting an incomplete bitmap. Then cuts resume, uploading only dirty chunks. While reconciling, no HEAD moves: - Cut, Capture and MakeRemoteDurable return ErrChunkReconciling (retryable). - Detach waits for reconciliation within its deadline, then makes its normal cut; otherwise ErrChunkReconciling. - The automatic cut scheduler skips the tick (not a failure, no backoff). A fresh host (FreshFromHead) starts with an empty dirty set instead of an unknown one. Its local volume is new and accepts no write before attach, so a new volume never reconciles. Stats gains Reconciling and ReconcileDone/ReconcileTotal. DirtyChunks (the scheduler's threshold) does not count chunks awaiting reconciliation. Test changes: - The storage fixture waits for reconciliation after attach. - The BASE tests wait after EndBaseInstall. - The chunkstore source-host fixtures (including the catalog fork test) attach as fresh hosts, which is what a new empty volume is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>