Commit 06f7cb3
authored
MINOR: Unwrap exceptions in CoordinatorTimerImpl and CoordinatorExecutorImpl (#21458)
The exceptionally handlers in CoordinatorTimerImpl and
CoordinatorExecutorImpl use instanceof checks to determine how to handle
failures. However, exceptions propagated through CompletableFuture
chains may be wrapped in CompletionException, causing the instanceof
checks to fail and the exceptions to be misclassified. This could lead
to incorrect behavior such as retrying when the coordinator is no
longer active or logging at the wrong level.
This patch unwraps exceptions using Errors.maybeUnwrapException at the
top of each exceptionally handler before performing the instanceof
checks. It also adds parameterized test coverage in
CoordinatorTimerImplTest to verify correct behavior with both wrapped
and unwrapped exceptions.
Reviewers: Sean Quah <[email protected]>, Chia-Ping Tsai
<[email protected]>1 parent 6d9ba76 commit 06f7cb3
File tree
3 files changed
+30
-9
lines changed- coordinator-common/src
- main/java/org/apache/kafka/coordinator/common/runtime
- test/java/org/apache/kafka/coordinator/common/runtime
3 files changed
+30
-9
lines changedLines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
88 | 94 | | |
89 | 95 | | |
90 | 96 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
100 | 106 | | |
101 | 107 | | |
102 | 108 | | |
| |||
Lines changed: 18 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
313 | 316 | | |
314 | 317 | | |
315 | 318 | | |
316 | | - | |
317 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
318 | 322 | | |
319 | 323 | | |
320 | 324 | | |
321 | 325 | | |
322 | 326 | | |
323 | 327 | | |
324 | | - | |
| 328 | + | |
| 329 | + | |
325 | 330 | | |
326 | 331 | | |
327 | 332 | | |
| |||
354 | 359 | | |
355 | 360 | | |
356 | 361 | | |
357 | | - | |
358 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
359 | 365 | | |
360 | 366 | | |
361 | 367 | | |
362 | 368 | | |
363 | 369 | | |
364 | 370 | | |
365 | | - | |
| 371 | + | |
| 372 | + | |
366 | 373 | | |
367 | 374 | | |
368 | 375 | | |
| |||
578 | 585 | | |
579 | 586 | | |
580 | 587 | | |
581 | | - | |
582 | | - | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
583 | 591 | | |
584 | 592 | | |
585 | 593 | | |
| |||
588 | 596 | | |
589 | 597 | | |
590 | 598 | | |
591 | | - | |
| 599 | + | |
| 600 | + | |
592 | 601 | | |
593 | 602 | | |
594 | 603 | | |
| |||
0 commit comments