Commit c25773f
feat(ilp): background drainer pool — adopt orphan slots and replay them
Wires the drainer runtime onto the orphan-scanner foundation. With
drain_orphans=true the foreground sender now actually empties sibling
slots holding unacked data instead of just logging that they exist.
Per-drainer lifecycle:
1. Open CursorSendEngine on the slot — its constructor takes the slot
lock; if another sender or drainer holds it, the engine throws and
the drainer exits silently (LOCKED_BY_OTHER, not a failure).
2. Open a fresh WebSocketClient via the foreground sender's connect
factory — separate connection, same auth/host/port/TLS config.
3. Run a CursorWebSocketSendLoop until ackedFsn catches up to the
publishedFsn snapshot taken at startup.
4. On terminal failure (auth, recovery, budget), drop a .failed
sentinel into the slot. Future scans skip it until an operator
clears it manually — bounded retry, then human-in-the-loop.
Pool: bounded fixed-thread executor, daemon threads, sized by
max_background_drainers (default 4). Closes via cooperative stop +
3s grace; daemon threads ensure no JVM-exit blocking.
Visibility: QwpWebSocketSender#getBackgroundDrainers returns a snapshot
list of live drainers with {slot, target, acked, outcome, lastError}.
Test: ghost sender writes 30 distinct rows against a silent server and
closes fast — leaves an unacked slot. Foreground sender opens the same
group root with a different sender_id and drain_orphans=true against an
ack server; asserts every distinct payload reaches the new server. Plus
a sentinel-skip test confirming an operator-set .failed file disqualifies
the slot from the next foreground run's scan.
Empty active segments and stale hot spares are left in the slot dir per
spec decision #13 ("no automatic cleanup of empty slot dirs"); the
scanner's no-op behavior on empty slots makes this cheap.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent fa5c838 commit c25773f
5 files changed
Lines changed: 709 additions & 33 deletions
File tree
- core/src
- main/java/io/questdb/client
- cutlass/qwp/client
- sf/cursor
- test/java/io/questdb/client/test/cutlass/qwp/client/sf
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1073 | 1073 | | |
1074 | 1074 | | |
1075 | 1075 | | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
1085 | | - | |
1086 | | - | |
1087 | | - | |
1088 | | - | |
1089 | | - | |
1090 | | - | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
1095 | 1076 | | |
1096 | 1077 | | |
1097 | 1078 | | |
| |||
1101 | 1082 | | |
1102 | 1083 | | |
1103 | 1084 | | |
1104 | | - | |
| 1085 | + | |
1105 | 1086 | | |
1106 | 1087 | | |
1107 | 1088 | | |
| |||
1119 | 1100 | | |
1120 | 1101 | | |
1121 | 1102 | | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
1122 | 1125 | | |
1123 | 1126 | | |
1124 | 1127 | | |
| |||
1753 | 1756 | | |
1754 | 1757 | | |
1755 | 1758 | | |
1756 | | - | |
1757 | | - | |
1758 | | - | |
1759 | | - | |
1760 | | - | |
1761 | | - | |
1762 | | - | |
1763 | | - | |
1764 | | - | |
1765 | | - | |
1766 | | - | |
1767 | | - | |
1768 | | - | |
1769 | 1759 | | |
1770 | 1760 | | |
1771 | 1761 | | |
| |||
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
179 | 184 | | |
180 | 185 | | |
181 | 186 | | |
| |||
641 | 646 | | |
642 | 647 | | |
643 | 648 | | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
644 | 660 | | |
645 | 661 | | |
646 | 662 | | |
| |||
985 | 1001 | | |
986 | 1002 | | |
987 | 1003 | | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
988 | 1050 | | |
989 | 1051 | | |
990 | 1052 | | |
| |||
0 commit comments