mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
* filer, mount: read a manifest's chunks only within its span Until #13042, a truncate through a manifest only shortened the manifest chunk; the chunks it holds stayed whole. Reads resolve those chunks at their own offsets and sizes, so once such a file grows over the cut again without writing it, by an extending truncate or a write past the end, the cut bytes come back where zeros belong. #13042 keeps new truncates from leaving such manifests, but files a mount truncated between #12462 and #13042 still have them. Reproduced with weed mount on a local cluster: a mount from before #13042 appends 700 lines with one close() each, so the first 256 fold into a manifest, and truncates the file to 100 lines; a mount from current master then extends it past its old end with ftruncate. The extended range read 8,580 bytes of the cut lines instead of zeros, through that mount and through the filer. Reads now cut each manifest's chunks to the manifest's span: ResolveChunkManifestForRead, used by NonOverlappingVisibleIntervals (filer and S3 streaming, WebDAV, the mount's merge reads), the S3 ranged reads and the mount's peer reads, and ChunkGroup for the mount's reads. A manifest made by MaybeManifestize spans its chunks exactly, so only shortened ones change. ResolveChunkManifest still returns the chunks whole: MinusChunks, deletions and the other chunk-list comparisons need every chunk a manifest references, or the chunks past the cut would never be deleted. * sw-client: read a manifest's chunks only within its span Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * java client: read a manifest's chunks only within its span Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: drop PR numbers from the manifest span comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: fold ResolveChunkManifestForRead into ResolveChunkManifest ResolveChunkManifest takes cutToSpan: the read paths pass true, the deletion and chunk-list comparison paths pass false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: cut manifests to their span when flattening an object's chunks A full-object SSE GET, CopyObject and UploadPartCopy flatten the source's manifests into a plain chunk list, which drops each manifest's span, so the chunks a truncate left past a shortened manifest came back as object data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: purge a volume.fsck path only for chunks within a manifest's span A chunk past a shortened manifest's span is still referenced but never read, so a missing volume under it loses nothing. The purge decision now uses the span-cut chunks while the inventory keeps every reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: cut manifests to their span in fs.distribute_chunks The entry is rewritten with the resolved chunks as a flat list or a new manifest that spans them, so chunks past a shortened manifest's span became readable again. The filer's update still deletes them, since it compares against the old entry's uncut chunks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: verify only the chunks within a manifest's span in fs.verify A chunk past a shortened manifest's span is never read, so a missing needle under it failed the entry and, with -pruneEntries, deleted a file whose readable bytes were intact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: mark the chunks past a manifest's span instead of allowing the visible ones The purge gate now skips only the resolved chunks that the span cut drops, so chunks that come from outside the manifests keep their purge behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: skip the purge for a missing past-span chunk on a listed volume volume.fsck -findMissingChunksInFiler queued a path for deletion when a listed volume's index lacked any chunk the uncut inventory recorded, including a chunk past a shortened manifest's span that no read reaches. Record those chunks per path during the filer walk and let only a missing chunk within the span queue the purge. The path is still reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>