mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
* mount: merge a flush's folded chunks as the chunks, not as a new manifest A flush folds the handle's chunks into manifests before it commits, and installs the folded list in the handle. When the commit finds that a peer changed the entry, mergeContentEntry replays the handle's changes since its base onto the peer's entry: a chunk not in the base counts as the handle's own write, a base chunk missing from the handle as one it dropped. A manifest the flush just made of base chunks therefore goes in as a write of the handle's, with every chunk it holds: - after a peer rewrote the whole file (a bloat merge, stamped with the oldest data it holds) or dropped chunks, the manifest brings the old chunks back, and where their stamps are newer they hide the peer's bytes; - after a peer folded the same chunks, the entry holds both manifests. Since #12462 a flush folds every 256 small chunks, so two mounts that append to one file, as the ranks of a training job often do with its log, reach this. The flush now records what its fold packed (chunkFold). The merge sees the folded chunks instead of the new manifests, so the fold is no change at all; the merged entry goes out unfolded, and the next flush folds it again. When the commit fails, the fold is taken back out of the handle, whose base still has the chunks, so a later merge or flush does not take the manifests for writes either. Their blobs are left unreferenced, as a failed fold leaves them. * mount: rebase a merged flush onto the entry the filer stored Review follow-up. A merged commit sends the merged chunks unfolded, and the filer can fold them before it stores the entry (cleanupChunks). The flush installed the request in the handle, but took the stored entry as the handle's base (ackedBase), so the handle held flat chunks against a base that lists a manifest. A later merge, such as a peer's truncate reaching the dirty handle, would take those chunks for writes of the handle's and publish them again. The handle is now rebased onto the stored entry it takes as its base, in both flush paths. rebaseEntry still gets the request, so chunks attached after it was taken are kept. TestFlushMergeInstallsTheEntryTheFilerStored: a peer's chmod refuses the first commit, the merged retry sends 256 flat chunks, and a filer that folds them stores a manifest; the handle and its base must both hold the stored entry. It fails with the request installed.