Commit 57d214b
[Enhancement] Stop leader daemons via interrupt on demotion; disconnect checkpoint HTTP on stop
Rework leader-demotion daemon shutdown from the no-interrupt + cooperative
onStopRequested model to interrupt-based fast-cancel, and make in-flight
checkpoint HTTP disconnectable so it does not block the drain.
LeaderDaemon framework:
- stopGracefully() interrupts the worker by default via a new interruptOnStop()
hook (default true), so a cycle blocked in an interruptible primitive
(queue poll, latch/future await, sleep, interruptible lock) unblocks at once.
- Interrupt-unsafe daemons that call BDBJE/JE directly opt out with
interruptOnStop()=false (CheckpointController, ClusterSnapshotJobScheduler)
and stop cooperatively.
Fix task-level interrupt mishandlers so shutdownNow() is safe:
- ExportExportingTask: an interrupt during the sub-task await no longer cancels
a healthy job as TIMEOUT; it leaves the job EXPORTING for the next leader and
always clears doExportingThread (finally).
- TabletScheduler.blockingAddTabletCtxToScheduler and RoutineLoadTaskScheduler
no longer swallow InterruptedException (re-assert / propagate).
- LeaderTaskExecutor / PriorityLeaderTaskExecutor close() uses shutdownNow() to
cancel in-flight tasks fast.
HTTP fast-fail:
- CheckpointController holds its own in-flight HttpURLConnection and disconnects
it in onStopRequested() to break out of an otherwise-uninterruptible socket
read; it only ever disconnects its own connection (no collateral damage).
- MetaHelper only publishes the connection handle (new Consumer<HttpURLConnection>
overloads) and no longer owns any cancel logic; cancelInFlight() removed.
Update LeaderDaemonTest (default-interrupt + opt-out paths) and
CheckpointControllerTest (disconnect-on-stop).
Signed-off-by: gengjun-git <gengjun@starrocks.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit 42d82ca)1 parent 35fdfb0 commit 57d214b
11 files changed
Lines changed: 279 additions & 106 deletions
File tree
- fe/fe-core/src
- main/java/com/starrocks
- clone
- common/util
- lake/snapshot
- leader
- load/routineload
- task
- test/java/com/starrocks
- common/util
- leader
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
350 | 354 | | |
351 | 355 | | |
352 | 356 | | |
| |||
Lines changed: 35 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| |||
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
148 | | - | |
| 150 | + | |
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| |||
231 | 233 | | |
232 | 234 | | |
233 | 235 | | |
234 | | - | |
235 | | - | |
236 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
237 | 249 | | |
238 | 250 | | |
239 | 251 | | |
| |||
255 | 267 | | |
256 | 268 | | |
257 | 269 | | |
258 | | - | |
259 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
260 | 276 | | |
261 | 277 | | |
262 | 278 | | |
263 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
264 | 292 | | |
265 | 293 | | |
266 | 294 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
129 | 141 | | |
Lines changed: 47 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
110 | 119 | | |
111 | 120 | | |
112 | 121 | | |
| |||
139 | 148 | | |
140 | 149 | | |
141 | 150 | | |
142 | | - | |
143 | | - | |
| 151 | + | |
| 152 | + | |
144 | 153 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
150 | 159 | | |
151 | 160 | | |
152 | 161 | | |
153 | 162 | | |
154 | 163 | | |
155 | 164 | | |
156 | 165 | | |
157 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
158 | 174 | | |
159 | 175 | | |
160 | 176 | | |
| |||
169 | 185 | | |
170 | 186 | | |
171 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
172 | 200 | | |
173 | 201 | | |
174 | 202 | | |
| |||
326 | 354 | | |
327 | 355 | | |
328 | 356 | | |
329 | | - | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
330 | 363 | | |
331 | 364 | | |
332 | 365 | | |
| |||
472 | 505 | | |
473 | 506 | | |
474 | 507 | | |
475 | | - | |
| 508 | + | |
476 | 509 | | |
477 | 510 | | |
478 | 511 | | |
| |||
481 | 514 | | |
482 | 515 | | |
483 | 516 | | |
| 517 | + | |
| 518 | + | |
484 | 519 | | |
485 | 520 | | |
486 | 521 | | |
| |||
508 | 543 | | |
509 | 544 | | |
510 | 545 | | |
| 546 | + | |
511 | 547 | | |
512 | 548 | | |
513 | 549 | | |
| |||
521 | 557 | | |
522 | 558 | | |
523 | 559 | | |
| 560 | + | |
524 | 561 | | |
525 | 562 | | |
526 | 563 | | |
| |||
Lines changed: 30 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | 81 | | |
101 | 82 | | |
102 | 83 | | |
| |||
109 | 90 | | |
110 | 91 | | |
111 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
112 | 105 | | |
113 | 106 | | |
114 | 107 | | |
| |||
117 | 110 | | |
118 | 111 | | |
119 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
120 | 116 | | |
121 | 117 | | |
122 | 118 | | |
| |||
169 | 165 | | |
170 | 166 | | |
171 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
172 | 179 | | |
173 | 180 | | |
174 | 181 | | |
175 | 182 | | |
176 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
177 | 187 | | |
178 | 188 | | |
179 | 189 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
209 | 213 | | |
210 | | - | |
| 214 | + | |
211 | 215 | | |
212 | 216 | | |
213 | 217 | | |
| |||
0 commit comments