mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
bd1f24a09bfd79fbc404d9aa93dbd84940ccc76b
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d6a657cd92 |
weed compact -method data: copy past an unreadable record like -method index (#12970)
* storage: resume data compaction past an unreadable record Compacting by data follows record headers through the .dat, so one corrupt header ended the scan: the compaction failed, or, when the header's size jumped past the end, every record after it was dropped. Compacting by index copies past such a record. When the scan stops on a corrupt header or jumps past live records, resume it at each live record the index places further on. A read error still fails the compaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: do not copy a record whose header size disagrees with the index A live record whose header carries a damaged size was copied with that size, and the compacted volume indexed a needle it could not read. The index records each live record's size, so a header that disagrees is damaged: skip it, and let the scan resume at the next live record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: verify a live record's body instead of comparing its size with the index Data compaction copied a record whose body failed to parse, and the size check dropped an intact record when only its index row was wrong. Read the body only for the record the index points at, drop it on the same errors -method index drops on, fail on any other read error, and keep the size the record itself carries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: resume data compaction at every live record the scan did not reach The resume started past the last header the scan parsed, so a corrupt size that landed on a later valid header lost the live records it jumped over. Track the records the scan copied or dropped, resume at each live record it did not reach in .dat order, and stop a resumed scan at a record an earlier pass already handled so nothing is copied twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * command: read the compacted volume's version from its super block in tests Compaction can write a different needle version than the source volume, so parse the .cpd with the version it records instead of the current one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: do not walk a run of damaged headers again on every resume A record whose header id is damaged is not marked as handled, so each resume at one of a run of such records walked the rest of the run before reaching a copied record, which is quadratic in the run length. Remember the offsets resumed scans pass, skip resuming at them, and stop a resume when it reaches one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: count the resumed scans' reads in the damaged-run test The kept keys come out the same when every resume walks the rest of the run, so bound the reads made through the volume's data backend instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: drop a record whose header size runs past the end of the .dat Reading such a record sized its buffer from the corrupt header: a size near 2 GiB allocated that much on 64-bit and panicked in makeslice on 32-bit. Check the record end against the file size first and drop the record as unreadable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * needle: compute ReadBytes slice bounds in int NeedleHeaderSize+size was Size arithmetic and wrapped for a damaged size near MaxInt32, so the slice panicked instead of failing the read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * needle: fail ReadNeedleBlob for a size that does not fit in an int On 32-bit a damaged size near MaxInt32 made the buffer length negative and panicked in makeslice. Return ErrorSizeInvalid instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * needle: compare DataSize bounds in uint64 On 32-bit builds int(DataSize) is negative for a damaged DataSize of 0x80000000 or more, which passes the bounds check and panics on the slice instead of returning ErrorCorrupted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c7cf9db27c |
fix/compact: stop at records past EOF, report -ignoreError failures, clean up failed compaction (#12915)
* fix: do not index a record that runs past the end of the .dat A truncated .dat, or a header whose size points past the file end, left weed fix indexing a needle the volume cannot serve. Stop the scan at such a record instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: exit non-zero under -ignoreError when a volume fails -ignoreError kept going but always exited 0, so an empty or partial index looked like success. Record the failure in the exit status, and keep the existing .idx when the super block could not be read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * compact: remove the partial .cpd/.cpx when compaction fails A failed weed compact exited through glog.Fatalf and left a partial .cpd next to the volume. Remove both outputs and report the failure in the exit status instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: skip the end-of-file check for a volume on a remote tier The scan reads the remote object when the .vif lists one, so a retained local .dat is the wrong length to check records against. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: keep a key deleted when its last record is truncated Stopping before a truncated delete record left the key's earlier live record in the index, so a deleted file came back. Drop the key instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: return the .idx open error from SaveToIdx The bare return gave back the nil named result, so a failure to open the index looked like a successful save. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: exit non-zero when a record is cut off by the end of the .dat A record past EOF ends the scan like a bad header does, so report it the same way while keeping the index of the records before it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * compact: close the volume before removing a failed compaction's output Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: remove a failed .idx only after SaveToIdx opened it An open failure no longer reaches the caller's cleanup, so an existing .idx that could not be opened is left in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(s3vectors): drop the worker and CLI flags #12906 removed (#12911) * test(s3vectors): start weed-worker with only --admin weed-worker no longer accepts --namespace, --masters or --filer-group; it takes the Lance Namespace and the filers from admin. The worker jobs passed all three, so the worker exited on its arguments before registering. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(s3vectors): let weed-vector-cli find the namespace through the masters weed-vector-cli dropped --namespace and looks the Lance Namespace up among the gateways the masters list, so the index job test failed on its arguments once the worker could register. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |