mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
* 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>
32 lines
1.0 KiB
Go
32 lines
1.0 KiB
Go
package command
|
|
|
|
import (
|
|
"bytes"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestCompactDataMethodBadHeaderLeavesNoOutput(t *testing.T) {
|
|
dir := t.TempDir()
|
|
base, offsets := writeFixTestVolume(t, dir, 5)
|
|
doFixOneVolume(dir, "fix_7", "fix", 7, true)
|
|
overwriteAt(t, base+".dat", offsets[2], bytes.Repeat([]byte{0xa5}, 16))
|
|
|
|
savedDir, savedCollection, savedId, savedMethod, savedStatus := *compactVolumePath, *compactVolumeCollection, *compactVolumeId, *compactMethod, commandExitStatus
|
|
defer func() {
|
|
*compactVolumePath, *compactVolumeCollection, *compactVolumeId, *compactMethod, commandExitStatus = savedDir, savedCollection, savedId, savedMethod, savedStatus
|
|
}()
|
|
*compactVolumePath, *compactVolumeCollection, *compactVolumeId, *compactMethod, commandExitStatus = dir, "fix", 7, "data", 0
|
|
|
|
runCompact(cmdCompact, nil)
|
|
|
|
if CommandExitStatus() == 0 {
|
|
t.Error("expected a non-zero exit status")
|
|
}
|
|
for _, ext := range []string{".cpd", ".cpx"} {
|
|
if _, err := os.Stat(base + ext); !os.IsNotExist(err) {
|
|
t.Errorf("%s left behind: %v", ext, err)
|
|
}
|
|
}
|
|
}
|