| 1 |
Fromscip-debian debian etcd 3.5.30-2 etcd/patches/`0025-Reduce-InitialMmapSize-on-32-bit-and-riscv64-archite.patch`#From.: Reinhard Tartler <[email protected]scip-debian . . . identity/`[email protected]`.> |
| 2 |
Datescip-debian debian etcd 3.5.30-2 etcd/patches/`0025-Reduce-InitialMmapSize-on-32-bit-and-riscv64-archite.patch`#Date.: Sat, 6 Jun 2026 06:29:50 -0400 |
| 3 |
Subjectscip-debian debian etcd 3.5.30-2 etcd/patches/`0025-Reduce-InitialMmapSize-on-32-bit-and-riscv64-archite.patch`#Subject.: Reduce InitialMmapSize on 32-bit and riscv64 architectures |
| 4 |
|
| 5 |
--- |
| 6 |
server/mvcc/backend/backend.go | 12 +++++++++++- |
| 7 |
1 file changed, 11 insertions(+), 1 deletion(-) |
| 8 |
|
| 9 |
diff --git a/server/mvcc/backend/backend.goscip-debian debian etcd 3.5.30-2 etcd/upstream/`server/mvcc/backend/backend.go`: b/server/mvcc/backend/backend.goscip-debian debian etcd 3.5.30-2 etcd/upstream/`server/mvcc/backend/backend.go`: |
| 10 |
index 10c4275..4ef13c1 100644 |
| 11 |
--- a/server/mvcc/backend/backend.go |
| 12 |
+++ b/server/mvcc/backend/backend.go |
| 13 |
@@ -19,8 +19,10 @@ import ( |
| 14 |
"hash/crc32" |
| 15 |
"io" |
| 16 |
"io/ioutil" |
| 17 |
+ "math/bits" |
| 18 |
"os" |
| 19 |
"path/filepath" |
| 20 |
+ "runtime" |
| 21 |
"sync" |
| 22 |
"sync/atomic" |
| 23 |
"time" |
| 24 |
@@ -39,7 +41,15 @@ var ( |
| 25 |
// InitialMmapSize is the initial size of the mmapped region. Setting this larger than |
| 26 |
// the potential max db size can prevent writer from blocking reader. |
| 27 |
// This only works for linux. |
| 28 |
|
| 29 |
+ InitialMmapSize = func() uint64 { |
| 30 |
+ // 10GB is the default for 64-bit systems. |
| 31 |
+ const defaultSize = uint64(10 * 1024 * 1024 * 1024) |
| 32 |
+ // 32-bit systems can't handle 10GB. 64-bit RISC-V buildds also seem to struggle. |
| 33 |
+ if bits.UintSize == 32 || runtime.GOARCH == "riscv64" { |
| 34 |
+ return 16 * 1024 * 1024 // 16MB |
| 35 |
+ } |
| 36 |
+ return defaultSize |
| 37 |
+ }() |
| 38 |
|
| 39 |
// minSnapshotWarningTimeout is the minimum threshold to trigger a long running snapshot warning. |
| 40 |
minSnapshotWarningTimeout = 30 * time.Second |