Commit ad19afe
feat: add SpillStore for generic RAII scratch space
Adds a `SpillStore` trait on `Session` providing uniform, reclaimable
scratch space for intermediate state that overflows memory (e.g. index
build posting lists, shuffle runs, BTree pages).
- `SpillStore` / `SpillFile` (lance-io): `create_spill_file()` vends a
RAII handle; `writer()` / `reader()` hand back `Box<dyn Writer>` /
`Box<dyn Reader>` so callers feed spill files directly into
`FileWriter::try_new` and a v2 `FileReader` without leaking an
`ObjectStore` + path. The file is deleted on drop and its bytes are
released back to the store's usage counter.
- `LocalSpillStore`: writes to an OS temp directory; optionally enforces
a byte cap. Enforcement lives entirely in the spill store: the spill
file decorates the writer with a quota-enforcing `QuotaWriter`
(reserve-on-write, release-on-drop-by-stat) rather than threading a
field through `ObjectStore` and every provider, so it works for any
backend the store opens.
- `From<io::Error>` recovers a wrapped lance `Error`, so typed errors
such as `DiskCapExceeded` survive the `AsyncWrite` boundary.
- `ScanScheduler::open_reader` builds a `FileScheduler` over an
already-open `Reader` (no path/size lookup).
- `Session` gains a `spill_store` field (defaults to uncapped
`LocalSpillStore`), a `with_spill_store()` builder, and a
`spill_store()` accessor so callers and tests can inject alternatives.
Mechanism only; consumer migration (IVF shuffler) is a follow-up.
Closes #7300
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 0f2745d commit ad19afe
5 files changed
Lines changed: 576 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
241 | 251 | | |
242 | 252 | | |
243 | 253 | | |
| |||
431 | 441 | | |
432 | 442 | | |
433 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
434 | 453 | | |
435 | 454 | | |
436 | 455 | | |
| |||
512 | 531 | | |
513 | 532 | | |
514 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
515 | 545 | | |
516 | 546 | | |
517 | 547 | | |
| |||
718 | 748 | | |
719 | 749 | | |
720 | 750 | | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
721 | 778 | | |
722 | 779 | | |
723 | 780 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
730 | 730 | | |
731 | 731 | | |
732 | 732 | | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
733 | 755 | | |
734 | 756 | | |
735 | 757 | | |
| |||
1193 | 1215 | | |
1194 | 1216 | | |
1195 | 1217 | | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
1196 | 1243 | | |
1197 | 1244 | | |
1198 | 1245 | | |
| |||
0 commit comments