mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-07-20 06:52:24 +00:00
log_buffer: cap the shared-snapshot race test's heap (#10281)
TestSharedSnapshotConcurrentIntegrity writes as fast as one core can marshal for two seconds, so its transient heap scales with host speed. On linux/386 a fast runner walks the heap into the 4GB address-space ceiling and the run dies with out of memory. Set a 1GB memory limit for the duration of the test so the GC paces the writer instead of the address space; the seal-and-recycle race being tested is unaffected.
This commit is contained in:
@@ -2,6 +2,7 @@ package log_buffer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -85,6 +86,12 @@ func TestSharedSnapshotSurvivesRecycle(t *testing.T) {
|
||||
// and recycling windows. Every delivered entry must unmarshal cleanly with the
|
||||
// expected payload — corruption here means a reader saw recycled bytes.
|
||||
func TestSharedSnapshotConcurrentIntegrity(t *testing.T) {
|
||||
// The writer below is deliberately unthrottled, so transient marshal garbage
|
||||
// scales with host speed; on linux/386 a fast runner can hit the 4GB
|
||||
// address-space ceiling. Cap the heap so the GC paces the writer instead.
|
||||
prevLimit := debug.SetMemoryLimit(1 << 30)
|
||||
defer debug.SetMemoryLimit(prevLimit)
|
||||
|
||||
lb := NewLogBuffer("test", time.Hour, func(*LogBuffer, time.Time, time.Time, []byte, int64, int64) {}, nil, nil)
|
||||
defer lb.ShutdownLogBuffer()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user