Commit c851317
committed
fix(pool): force drain_orphans=off on SF startup-recovery delegates
A startup-recovery delegate is built from the shared config string, so with
drain_orphans=on it inherited the flag. Since recovery forces
initial_connect_mode=OFF (one connect attempt), against a reachable server the
build succeeds and reaches startOrphanDrainers(), standing up a
BackgroundDrainerPool for any foreign/out-of-range orphan. Its close() --
called from drainCandidateSlotForRecovery() on the PoolHousekeeper thread,
BEFORE cursorEngine.close() releases the slot flock -- then blocks up to
GRACEFUL_DRAIN_MILLIS + STOP_GRACE_MILLIS (3s) against a
reachable-but-not-acking server. That makes one recovery step ~1s drain + ~3s
drainerPool.close ~= 4s, overrunning RECOVERY_DRAIN_BUDGET_MILLIS and
PoolHousekeeper.STOP_TIMEOUT_MILLIS (2s); a close() landing mid-step then
returns with the flock still held, resurfacing the "sf slot already in use"
window this PR exists to eliminate.
Recovery delegates now force drain_orphans=off: their sole job is to drain
their own slot. Sibling in-range slots are covered by recoverOneSlotStep's own
passes; foreign/out-of-range orphans are covered by the live pooled senders'
drainers (whose close() senderPool.close() awaits synchronously, so they
release their flock before close() returns).
Adds testRecoveryStepStaysBoundedWithDrainOrphansAgainstNonAckingServer:
seeds an in-range stranded slot + a foreign orphan, restarts with
drain_orphans=on against a reachable-but-silent server, drives one recovery
step, and asserts it returns within STOP_TIMEOUT_MILLIS with the foreign data
preserved (not lost, not .failed). Fails pre-fix (~3.5s), passes post-fix
(~1s).1 parent db44da8 commit c851317
2 files changed
Lines changed: 120 additions & 0 deletions
File tree
- core/src
- main/java/io/questdb/client/impl
- test/java/io/questdb/client/test/impl
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1024 | 1024 | | |
1025 | 1025 | | |
1026 | 1026 | | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
1027 | 1033 | | |
1028 | 1034 | | |
1029 | 1035 | | |
| |||
1063 | 1069 | | |
1064 | 1070 | | |
1065 | 1071 | | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
1066 | 1093 | | |
1067 | 1094 | | |
1068 | 1095 | | |
| |||
Lines changed: 93 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1452 | 1452 | | |
1453 | 1453 | | |
1454 | 1454 | | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
1455 | 1548 | | |
1456 | 1549 | | |
1457 | 1550 | | |
| |||
0 commit comments