From: Reinhard Tartler Date: Sat, 6 Jun 2026 06:29:50 -0400 Subject: Reduce InitialMmapSize on 32-bit and riscv64 architectures --- server/mvcc/backend/backend.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/mvcc/backend/backend.go b/server/mvcc/backend/backend.go index 10c4275..4ef13c1 100644 --- a/server/mvcc/backend/backend.go +++ b/server/mvcc/backend/backend.go @@ -19,8 +19,10 @@ import ( "hash/crc32" "io" "io/ioutil" + "math/bits" "os" "path/filepath" + "runtime" "sync" "sync/atomic" "time" @@ -39,7 +41,15 @@ var ( // InitialMmapSize is the initial size of the mmapped region. Setting this larger than // the potential max db size can prevent writer from blocking reader. // This only works for linux. - InitialMmapSize = uint64(10 * 1024 * 1024 * 1024) + InitialMmapSize = func() uint64 { + // 10GB is the default for 64-bit systems. + const defaultSize = uint64(10 * 1024 * 1024 * 1024) + // 32-bit systems can't handle 10GB. 64-bit RISC-V buildds also seem to struggle. + if bits.UintSize == 32 || runtime.GOARCH == "riscv64" { + return 16 * 1024 * 1024 // 16MB + } + return defaultSize + }() // minSnapshotWarningTimeout is the minimum threshold to trigger a long running snapshot warning. minSnapshotWarningTimeout = 30 * time.Second