Commit ad5d80d
committed
feat(mergetree): support spill-to-disk write buffer and writer memory manager
Introduce ExternalSortBuffer that wraps an InMemorySortBuffer and spills
sorted runs to disk via IOManager channels when the in-memory budget is
reached. Spilled runs are merged back through the existing sort-merge
reader path on flush.
Also add WriterMemoryManager to coordinate write-buffer memory across
multiple BatchWriters by picking the largest writer to flush when the
global budget is exceeded.
New CoreOptions:
- write-buffer-spillable
- write-buffer-spill.max-disk-size
- local-sort.max-num-file-handles
- spill-compression
- spill-compression.zstd-level (moved next to other spill options)
Tests:
- sort_buffer_test: external sort buffer spill & merge behaviour
- writer_memory_manager_test: memory accounting and shrink-to-limit
- extend sort_merge_reader_test / core_options_test / data_generator_test
Generated-by: Aone Copilot (claude-4.7-opus)1 parent c7492e6 commit ad5d80d
20 files changed
Lines changed: 1516 additions & 249 deletions
File tree
- include/paimon
- src/paimon
- common
- utils
- core
- disk
- mergetree
- compact
- testing/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
181 | 202 | | |
182 | 203 | | |
183 | 204 | | |
| |||
405 | 426 | | |
406 | 427 | | |
407 | 428 | | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | 429 | | |
413 | 430 | | |
414 | 431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
254 | 255 | | |
| 256 | + | |
255 | 257 | | |
256 | 258 | | |
257 | 259 | | |
| |||
633 | 635 | | |
634 | 636 | | |
635 | 637 | | |
| 638 | + | |
636 | 639 | | |
637 | 640 | | |
638 | 641 | | |
| 642 | + | |
639 | 643 | | |
640 | 644 | | |
641 | 645 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
104 | 109 | | |
105 | 110 | | |
106 | 111 | | |
107 | | - | |
108 | 112 | | |
109 | 113 | | |
110 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
329 | 335 | | |
330 | 336 | | |
331 | 337 | | |
| |||
0 commit comments