Commit a3d1e2a
fix: reset the claim cursor whenever the consumer group is recreated
recoverFromNoGroup is reached from both readMessages and
claimPendingMessages, but the cursor reset sat at the claim call site only.
The read path is the likelier of the two to notice NOGROUP first, since reads
run on every tick that is not a claim tick -- so the common case left the
cursor pointing into the pending list of a group that no longer exists.
Not self-correcting on a busy stream. A scan starting above the recreated
PEL's entries only wraps once it exhausts the list, and entries arriving after
the stale position keep giving it work at the high end, so the wrap can be
deferred indefinitely while the oldest entries go unexamined -- the exact
starvation this PR exists to remove.
Reset moved into recoverFromNoGroup so both paths get identical treatment and
there is one place that owns it.
Regression test covers the read path specifically. Mutation-checked: moving
the reset back to the claim site alone fails it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 5b04ebf commit a3d1e2a
2 files changed
Lines changed: 64 additions & 3 deletions
File tree
- apps/opik-backend/src
- main/java/com/comet/opik/api/resources/v1/events
- test/java/com/comet/opik/api/resources/v1/events
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
438 | | - | |
| 437 | + | |
| 438 | + | |
439 | 439 | | |
440 | | - | |
441 | 440 | | |
442 | 441 | | |
443 | 442 | | |
| |||
507 | 506 | | |
508 | 507 | | |
509 | 508 | | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
510 | 519 | | |
511 | 520 | | |
512 | 521 | | |
| |||
Lines changed: 52 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
625 | 677 | | |
626 | 678 | | |
627 | 679 | | |
| |||
0 commit comments