Commit 5dfec37
refactor: non-blocking TRUNCATE via barrier queue (#61)
## Summary
- TRUNCATE now uses the same non-blocking `PendingDdl` barrier queue as
DDL sync (ADD/DROP/RENAME COLUMN), instead of blocking the WAL consumer
for up to 30s via `drain_and_wait_table()`
- The flush thread autonomously drains pending changes then executes
`DELETE FROM` on the target — the WAL consumer enqueues the barrier and
continues immediately
- For truncate-only barriers the DuckDB worker stays alive (schema
unchanged), avoiding unnecessary reconnection overhead
- Removes the now-dead `drain_and_wait_table()` method (shutdown uses
the separate `drain_and_wait_all()`)
## Test plan
- [x] `make installcheck` — all 42 regression tests pass, including
`truncate` and `fan_in` which exercise TRUNCATE propagation, fan-in
scoped DELETE, and INSERT-after-TRUNCATE semantics
- [x] `cargo check` — clean compilation (no new warnings)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 69b7bd9 commit 5dfec37
3 files changed
Lines changed: 52 additions & 57 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
520 | | - | |
| 520 | + | |
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
| |||
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
646 | | - | |
| 646 | + | |
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
| |||
660 | 660 | | |
661 | 661 | | |
662 | 662 | | |
663 | | - | |
| 663 | + | |
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
77 | 80 | | |
78 | 81 | | |
79 | | - | |
80 | | - | |
| 82 | + | |
| 83 | + | |
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| |||
604 | 607 | | |
605 | 608 | | |
606 | 609 | | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
607 | 618 | | |
608 | 619 | | |
609 | 620 | | |
| |||
800 | 811 | | |
801 | 812 | | |
802 | 813 | | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | 814 | | |
826 | 815 | | |
827 | 816 | | |
| |||
1208 | 1197 | | |
1209 | 1198 | | |
1210 | 1199 | | |
1211 | | - | |
| 1200 | + | |
1212 | 1201 | | |
1213 | 1202 | | |
1214 | 1203 | | |
| |||
1229 | 1218 | | |
1230 | 1219 | | |
1231 | 1220 | | |
1232 | | - | |
1233 | | - | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
| 1221 | + | |
| 1222 | + | |
1237 | 1223 | | |
1238 | 1224 | | |
1239 | 1225 | | |
1240 | 1226 | | |
1241 | | - | |
| 1227 | + | |
1242 | 1228 | | |
1243 | 1229 | | |
1244 | 1230 | | |
1245 | | - | |
| 1231 | + | |
1246 | 1232 | | |
1247 | 1233 | | |
1248 | 1234 | | |
| |||
1275 | 1261 | | |
1276 | 1262 | | |
1277 | 1263 | | |
1278 | | - | |
| 1264 | + | |
1279 | 1265 | | |
1280 | 1266 | | |
1281 | 1267 | | |
| |||
1552 | 1538 | | |
1553 | 1539 | | |
1554 | 1540 | | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
1555 | 1548 | | |
1556 | | - | |
| 1549 | + | |
1557 | 1550 | | |
1558 | 1551 | | |
1559 | 1552 | | |
1560 | | - | |
| 1553 | + | |
1561 | 1554 | | |
1562 | 1555 | | |
1563 | 1556 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
684 | 684 | | |
685 | 685 | | |
686 | 686 | | |
687 | | - | |
| 687 | + | |
| 688 | + | |
688 | 689 | | |
689 | 690 | | |
690 | 691 | | |
| |||
704 | 705 | | |
705 | 706 | | |
706 | 707 | | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
707 | 720 | | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
715 | 725 | | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | 726 | | |
725 | 727 | | |
726 | 728 | | |
| |||
0 commit comments