mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
Merge pull request #457 from seaweedfs/test/delete-empty-wal-test-files
test: delete the five WAL test files that hold no test
This commit is contained in:
commit
0c7d943ab1
6 files changed
+4
-117
No files matched your search
@@ -152,7 +152,6 @@ func TestDurableStartup_Issue51_SmartWALTornTailRecovers(t *testing.T) {
|
||||
|
||||
// V3 replaces the legacy warning-only recovery policy with nonce-bound,
|
||||
// contiguous WAL recovery. Corruption below strict W must block readiness.
|
||||
// The old v2 warning control is retained in walstore_midhistory_hole_test.go.
|
||||
func TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness(t *testing.T) {
|
||||
const childEnv = "SWBLOCK_V3_STARTUP_CRASH_PATH"
|
||||
if path := os.Getenv(childEnv); path != "" {
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
//go:build linux
|
||||
|
||||
package storage
|
||||
|
||||
const (
|
||||
checkpointCrashHelperEnv = "SW_BLOCK_CHECKPOINT_CRASH_HELPER"
|
||||
checkpointCrashPathEnv = "SW_BLOCK_CHECKPOINT_CRASH_PATH"
|
||||
)
|
||||
@@ -1,11 +0,0 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func replaceFlusherForTest(s *WALStore, interval time.Duration) {
|
||||
s.flusher.Stop()
|
||||
s.flusher = newFlusher(s, flusherConfig{Interval: interval})
|
||||
go s.flusher.run()
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func walOffsetsByLBA(s *WALStore) map[uint64]uint64 {
|
||||
offs := map[uint64]uint64{}
|
||||
for _, e := range s.dm.snapshot() {
|
||||
offs[e.LBA] = e.WALOffset
|
||||
}
|
||||
return offs
|
||||
}
|
||||
|
||||
func holeWarning(s *WALStore) bool {
|
||||
for _, w := range s.RecoveryWarnings() {
|
||||
if strings.HasPrefix(w, WarningWALHoleSuspected+":") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -1,14 +1,10 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
|
||||
"hash/crc32"
|
||||
|
||||
"testing"
|
||||
)
|
||||
import "testing"
|
||||
|
||||
// crashRecoveryHardeningStore drops the store without a clean close: the
|
||||
// committer stops, the owned map and the file descriptor close, nothing is
|
||||
// flushed. Tests reopen the file afterwards to observe crash recovery.
|
||||
func crashRecoveryHardeningStore(t *testing.T, s *WALStore) {
|
||||
t.Helper()
|
||||
s.committer.Stop()
|
||||
@@ -22,44 +18,3 @@ func crashRecoveryHardeningStore(t *testing.T, s *WALStore) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func recoverySnapshotEntriesByLBA(entries []snapshotEntry) map[uint64]snapshotEntry {
|
||||
result := make(map[uint64]snapshotEntry, len(entries))
|
||||
for _, entry := range entries {
|
||||
result[entry.LBA] = entry
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func rewriteRecoveryRecordForTest(
|
||||
t *testing.T,
|
||||
s *WALStore,
|
||||
recordSize uint64,
|
||||
absoluteOffset int64,
|
||||
mutate func([]byte),
|
||||
) {
|
||||
t.Helper()
|
||||
record := make([]byte, recordSize)
|
||||
if _, err := s.fd.ReadAt(record, absoluteOffset); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
mutate(record)
|
||||
binary.LittleEndian.PutUint32(
|
||||
record[len(record)-8:],
|
||||
crc32.ChecksumIEEE(record[:len(record)-8]),
|
||||
)
|
||||
if _, err := s.fd.WriteAt(record, absoluteOffset); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func assertRecoveryHardeningBlock(t *testing.T, s *WALStore, lba uint32, want []byte) {
|
||||
t.Helper()
|
||||
got, err := s.Read(lba)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !bytes.Equal(got, want) {
|
||||
t.Fatalf("current LBA %d mismatch", lba)
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
// A failed fsync is sticky for the open store (the "fsyncgate" pattern: on
|
||||
// Linux the kernel may already have dropped the dirty pages, so a later
|
||||
// successful fsync proves nothing about them). After the first failure the
|
||||
// store acknowledges no further Sync, accepts no further write and advances
|
||||
// no checkpoint, with a typed SubstrateIO failure; only a reopen clears it.
|
||||
|
||||
var errInjectedFsync = errors.New("injected fsync failure")
|
||||
|
||||
func assertStickyFsync(t *testing.T, err error) {
|
||||
t.Helper()
|
||||
if !errors.Is(err, ErrFsyncFailed) {
|
||||
t.Fatalf("err %v; want the sticky ErrFsyncFailed", err)
|
||||
}
|
||||
var rf *RecoveryFailure
|
||||
if !errors.As(err, &rf) || rf.Kind != StorageRecoveryFailureSubstrateIO {
|
||||
t.Fatalf("err %v; want a SubstrateIO RecoveryFailure (io_error)", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user