Commit 54cb19d
Share the slot-lock dir and stop false quarantines
Two defects in the parent-anchored logical slot lock, which this branch
introduced: before it, build() took no SlotLock at all and SlotLock
created only the per-process slot directory.
The lock now lives under a directory every sender beneath one sf_dir
must create a file in, and ensureDirectory created it 0755. Whichever
process starts first owns it, so a sender running as a different uid
cannot create its lock file and acquireAt throws "could not open slot
lock file". That is an IllegalStateException, not a LineSenderException,
so a caller following the documented contract does not catch it and
build() fails outright. Create that one directory 0777 instead and let
the deployment's umask decide the sharing policy, exactly as it already
does for the sf_dir the lock lives under: the usual 022 leaves it at the
same 0755 as before, while a shared-group deployment gets the
group-writable directory it needs. Slot directories keep the restrictive
mode -- one process creates each and only that process writes inside it.
The drainer then turned that failure into a permanent one. isLockContention
matches only "already in use", so every other acquireLogical failure --
the permission case above, or a momentary fd exhaustion -- rethrows into
the outer catch, which drops a .failed sentinel. That runs BEFORE
CursorSendEngine takes the slot's own .lock, so the drainer quarantines a
healthy slot another live process still owns. Nothing ever removes the
sentinel and isCandidateOrphan treats it as disqualifying, so when the
real owner later died its unacked data would stay stranded until an
operator intervened. Write the sentinel only when engine is non-null,
which is set once the engine holds the directory-local lock and so marks
genuine adoption; a pre-adoption failure now leaves the slot for the next
scan. The auth/upgrade and wire sentinels are unchanged -- both fire
after adoption and are sanctioned orphan terminals.
Both tests fail without their fix: the mode assertion reports 493 where
511 is required, and the drainer test finds the sentinel in a slot it
never locked. The drainer test blocks the lock by planting .slot-locks as
a regular file rather than by chmod, so it reproduces the failure on any
platform and does not silently pass when CI runs as root.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 4c10246 commit 54cb19d
5 files changed
Lines changed: 144 additions & 8 deletions
File tree
- core/src
- main/java/io/questdb/client
- cutlass/qwp/client/sf/cursor
- std
- test/java/io/questdb/client/test/cutlass/qwp/client/sf/cursor
Lines changed: 21 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
728 | 728 | | |
729 | 729 | | |
730 | 730 | | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
735 | 752 | | |
736 | 753 | | |
737 | 754 | | |
| |||
Lines changed: 16 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| |||
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
121 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
122 | 134 | | |
123 | 135 | | |
124 | 136 | | |
| |||
185 | 197 | | |
186 | 198 | | |
187 | 199 | | |
188 | | - | |
| 200 | + | |
189 | 201 | | |
190 | | - | |
| 202 | + | |
191 | 203 | | |
192 | 204 | | |
193 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
78 | 89 | | |
79 | 90 | | |
80 | 91 | | |
| |||
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
88 | 142 | | |
89 | 143 | | |
90 | 144 | | |
| |||
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
144 | 170 | | |
145 | 171 | | |
146 | 172 | | |
| |||
259 | 285 | | |
260 | 286 | | |
261 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
262 | 304 | | |
263 | 305 | | |
264 | 306 | | |
| |||
0 commit comments