Commit 9d3d1ef
fix: scale default memory pool size by partition count (#6562)
## Summary
- The `FairSpillPool` divides memory evenly across spillable consumers.
With up to 8 partitions, each sort consumer was limited to ~12.5MB from
a flat 100MB pool, causing merge_insert operations with large payloads
to fail with "not enough memory to continue external sort" at very small
batch sizes (e.g. 5 rows with 1MB payloads).
- Scale the default pool size to 100MB **per partition** so each
consumer gets a reasonable allocation. Explicit `LANCE_MEM_POOL_SIZE` or
`mem_pool_size` settings are respected as-is.
- This is a partial fix — very large batches can still exhaust the
per-partition budget. A more complete fix may involve revisiting the
pool type or spilling behavior for merge_insert.
## Test plan
- [x] Added unit test `test_mem_pool_size_scales_with_partitions`
verifying pool size scales correctly
- [x] Verified with a Python repro script that merge_insert with
1MB-per-row payloads no longer fails at 5 rows (now succeeds up to ~50
rows)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 682cdd4 commit 9d3d1ef
1 file changed
Lines changed: 35 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | | - | |
| 316 | + | |
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| 321 | + | |
321 | 322 | | |
322 | 323 | | |
323 | 324 | | |
324 | 325 | | |
325 | 326 | | |
326 | 327 | | |
327 | | - | |
| 328 | + | |
328 | 329 | | |
329 | 330 | | |
330 | | - | |
| 331 | + | |
331 | 332 | | |
332 | 333 | | |
333 | 334 | | |
| |||
1051 | 1052 | | |
1052 | 1053 | | |
1053 | 1054 | | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
1054 | 1086 | | |
0 commit comments