Commit 701d98e
[Enhancement] Drop abandoned agent tasks from AgentTaskQueue on leader demotion
The demotion drain previously only failed the in-flight agent tasks' latches; the tasks
themselves stayed in AgentTaskQueue. A demoting/follower leader no longer processes the BE
reports that normally remove them, so they would leak (including latch-less tasks such as
drop/clone) across a demote/re-elect cycle. Clear the queue as part of the drain, mirroring
how the old System.exit model wiped it via process restart.
Rename AgentTaskQueue.failAllPendingWaiters -> abandonInFlightTasks (and the GlobalStateMgr
demotion stage failInFlightAgentTasks -> abandonInFlightAgentTasks) to reflect that it now
both fails latch waiters and drops all tasks. Safe to clear the whole queue because addTask()
rejects new tasks while demoting, so nothing live is discarded. AgentTaskTest asserts the
queue is emptied.
Signed-off-by: gengjun-git <gengjun@starrocks.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 579b63f commit 701d98e
4 files changed
Lines changed: 28 additions & 21 deletions
File tree
- fe/fe-core/src
- main/java/com/starrocks
- server
- task
- test/java/com/starrocks/task
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2149 | 2149 | | |
2150 | 2150 | | |
2151 | 2151 | | |
2152 | | - | |
| 2152 | + | |
2153 | 2153 | | |
2154 | 2154 | | |
2155 | 2155 | | |
| |||
2175 | 2175 | | |
2176 | 2176 | | |
2177 | 2177 | | |
2178 | | - | |
2179 | | - | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
2180 | 2181 | | |
2181 | | - | |
2182 | | - | |
| 2182 | + | |
| 2183 | + | |
2183 | 2184 | | |
2184 | 2185 | | |
2185 | 2186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
Lines changed: 15 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
282 | 284 | | |
283 | | - | |
| 285 | + | |
284 | 286 | | |
285 | 287 | | |
286 | 288 | | |
| |||
294 | 296 | | |
295 | 297 | | |
296 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
297 | 303 | | |
298 | 304 | | |
299 | 305 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
498 | | - | |
| 498 | + | |
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
509 | 509 | | |
510 | 510 | | |
511 | 511 | | |
512 | | - | |
| 512 | + | |
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
| |||
0 commit comments