Commit 71afa21
feat(ilp): connectionGeneration foundation + encode-mid-reconnect retry
Re-adds the volatile generation counter (and its companion retry loop in
flushPendingRows) that the cursor strip had removed. This is the
foundation the reconnect work (#20/#21) builds on — the producer needs a
way to detect that the wire-side actor has rotated state mid-encode so
it can discard now-poisoned schema-ID refs and re-encode with full
schema definitions.
What lands here:
* QwpWebSocketSender: volatile connectionGeneration + lastSeenGeneration
pair. Bumped on initial recovery from disk (the recovered FSNs were
never seen by *this* server connection, so the first batch must
re-publish full schemas). Reconnect path will bump in subsequent
work.
* flushPendingRows: encode-mid-reconnect retry loop. Sample gen before
encode + after finishMessage; if it changed, discard the encoded
bytes (table buffers haven't been reset yet — source rows are
intact) and retry with reset schema state. Bounded at
MAX_SCHEMA_RACE_RETRIES = 10 so reconnect-faster-than-encode
surfaces a hard error instead of spinning.
* CursorSendEngine.wasRecoveredFromDisk(): single-bit accessor the
sender reads during ensureConnected to decide whether to bump.
* SegmentRing.openExisting: filter out empty hot-spare leftovers
(frameCount=0) from prior sessions. Those carry the provisional
baseSeq=0 and would otherwise collide with the real baseSeq=0
segment and trip the contiguity check. Surfaced by the new
recovery test — caught a real bug in the recovery scan.
* Test hooks bumpConnectionGenerationForTest / accessors for gen and
maxSent*Id so reconnect-effect tests can run without spinning up
the (still-not-implemented) reconnect path.
Tests cover: gen=0 for fresh connect, gen=1 after disk recovery, gen
bump triggers schema-state reset on the next encode and is sticky
(further flushes without bump don't re-reset).
Spec decisions #4 and #5 land here.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3caa2d3 commit 71afa21
4 files changed
Lines changed: 369 additions & 23 deletions
File tree
- core/src
- main/java/io/questdb/client/cutlass/qwp/client
- sf/cursor
- test/java/io/questdb/client/test/cutlass/qwp/client
Lines changed: 114 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
167 | 183 | | |
168 | 184 | | |
169 | 185 | | |
| |||
842 | 858 | | |
843 | 859 | | |
844 | 860 | | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
845 | 892 | | |
846 | 893 | | |
847 | 894 | | |
| |||
1298 | 1345 | | |
1299 | 1346 | | |
1300 | 1347 | | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
1301 | 1357 | | |
1302 | 1358 | | |
1303 | 1359 | | |
| |||
1344 | 1400 | | |
1345 | 1401 | | |
1346 | 1402 | | |
1347 | | - | |
1348 | | - | |
1349 | | - | |
1350 | | - | |
1351 | | - | |
1352 | | - | |
1353 | | - | |
1354 | | - | |
1355 | | - | |
1356 | | - | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
1357 | 1422 | | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
1358 | 1444 | | |
1359 | | - | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
| 1445 | + | |
| 1446 | + | |
1363 | 1447 | | |
1364 | | - | |
| 1448 | + | |
| 1449 | + | |
1365 | 1450 | | |
1366 | | - | |
1367 | | - | |
| 1451 | + | |
| 1452 | + | |
1368 | 1453 | | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
1369 | 1465 | | |
1370 | | - | |
| 1466 | + | |
1371 | 1467 | | |
1372 | | - | |
1373 | | - | |
1374 | 1468 | | |
1375 | | - | |
1376 | | - | |
1377 | 1469 | | |
1378 | 1470 | | |
1379 | 1471 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
78 | 84 | | |
79 | 85 | | |
80 | 86 | | |
| |||
150 | 156 | | |
151 | 157 | | |
152 | 158 | | |
| 159 | + | |
153 | 160 | | |
154 | 161 | | |
155 | 162 | | |
| |||
239 | 246 | | |
240 | 247 | | |
241 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
242 | 260 | | |
243 | 261 | | |
244 | 262 | | |
| |||
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
158 | 170 | | |
159 | 171 | | |
160 | 172 | | |
| |||
0 commit comments