Commit 803a85f
KAFKA-20711: Measure restore progress in offset slots
The restore-remaining-records metric never reached zero when a
changelog contained offsets the restore consumer does not return as
records, such as transaction markers or compacted-away records. The
metric is initialized from the offset range (restoreEndOffset minus
startOffset), which counts every offset slot, but it was decremented
by the number of records actually restored. Those two quantities
diverge whenever the changelog has gaps, leaving the metric stuck at a
positive value after restoration completed.
The decrements are now expressed in offset slots rather than record
counts. Each batch advances the metric by the change in store offset,
and on completion any trailing slots between the last restored record
and the end offset are accounted for, so the metric lands at exactly
zero. The store offset before each batch is captured to measure the
slots covered, and the consumer position at which restoration began is
recorded so progress can be tracked from the first record onward.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 5b70498 commit 803a85f
2 files changed
Lines changed: 118 additions & 2 deletions
File tree
- streams/src
- main/java/org/apache/kafka/streams/processor/internals
- test/java/org/apache/kafka/streams/processor/internals
Lines changed: 44 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
144 | 150 | | |
145 | 151 | | |
146 | 152 | | |
| |||
651 | 657 | | |
652 | 658 | | |
653 | 659 | | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
654 | 663 | | |
655 | 664 | | |
656 | 665 | | |
| |||
663 | 672 | | |
664 | 673 | | |
665 | 674 | | |
666 | | - | |
667 | | - | |
| 675 | + | |
668 | 676 | | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
669 | 681 | | |
670 | 682 | | |
671 | 683 | | |
| |||
693 | 705 | | |
694 | 706 | | |
695 | 707 | | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
696 | 713 | | |
697 | 714 | | |
698 | 715 | | |
| |||
713 | 730 | | |
714 | 731 | | |
715 | 732 | | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
716 | 755 | | |
717 | 756 | | |
718 | 757 | | |
| |||
1016 | 1055 | | |
1017 | 1056 | | |
1018 | 1057 | | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
1019 | 1061 | | |
1020 | 1062 | | |
1021 | 1063 | | |
| |||
Lines changed: 74 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| 98 | + | |
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
| |||
663 | 665 | | |
664 | 666 | | |
665 | 667 | | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
666 | 740 | | |
667 | 741 | | |
668 | 742 | | |
| |||
0 commit comments