Commit 3ad3020
KAFKA-20711: Measure restore-remaining-records in offset slots
The restore-remaining-records-total metric is initialized from the
changelog offset range (restoreEndOffset - startOffset), which counts
every offset slot, but it was decremented by the number of records
actually restored. These diverge whenever the changelog contains
offsets the restore consumer never returns as records -- transaction
markers or compacted-away records -- leaving the metric stuck above
zero after restoration completed.
The metric is now decremented in offset slots: each batch advances it
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 it lands at exactly zero. Task#recordRestoration takes the
offset-slot count separately from the record count so that
restore-total and restore-rate continue to measure records restored.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent da3b5e7 commit 3ad3020
8 files changed
Lines changed: 126 additions & 20 deletions
File tree
- streams/src
- main/java/org/apache/kafka/streams/processor/internals
- test/java/org/apache/kafka/streams/processor/internals
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
Lines changed: 32 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
144 | 147 | | |
145 | 148 | | |
146 | 149 | | |
| |||
668 | 671 | | |
669 | 672 | | |
670 | 673 | | |
| 674 | + | |
| 675 | + | |
671 | 676 | | |
672 | 677 | | |
673 | 678 | | |
| |||
680 | 685 | | |
681 | 686 | | |
682 | 687 | | |
683 | | - | |
684 | | - | |
685 | 688 | | |
| 689 | + | |
| 690 | + | |
686 | 691 | | |
687 | 692 | | |
688 | 693 | | |
| |||
710 | 715 | | |
711 | 716 | | |
712 | 717 | | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
713 | 722 | | |
714 | 723 | | |
715 | 724 | | |
| |||
730 | 739 | | |
731 | 740 | | |
732 | 741 | | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
733 | 759 | | |
734 | 760 | | |
735 | 761 | | |
| |||
1033 | 1059 | | |
1034 | 1060 | | |
1035 | 1061 | | |
| 1062 | + | |
| 1063 | + | |
1036 | 1064 | | |
1037 | 1065 | | |
1038 | 1066 | | |
| |||
1045 | 1073 | | |
1046 | 1074 | | |
1047 | 1075 | | |
1048 | | - | |
1049 | | - | |
| 1076 | + | |
| 1077 | + | |
1050 | 1078 | | |
1051 | 1079 | | |
1052 | 1080 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
| 257 | + | |
258 | 258 | | |
259 | | - | |
| 259 | + | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
| 262 | + | |
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
217 | 221 | | |
218 | 222 | | |
219 | 223 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
487 | | - | |
| 487 | + | |
| 488 | + | |
488 | 489 | | |
489 | 490 | | |
490 | 491 | | |
491 | 492 | | |
492 | | - | |
| 493 | + | |
493 | 494 | | |
494 | 495 | | |
495 | 496 | | |
| |||
Lines changed: 74 additions & 3 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 | + | |
666 | 737 | | |
667 | 738 | | |
668 | 739 | | |
| |||
700 | 771 | | |
701 | 772 | | |
702 | 773 | | |
703 | | - | |
| 774 | + | |
704 | 775 | | |
705 | 776 | | |
706 | 777 | | |
| |||
798 | 869 | | |
799 | 870 | | |
800 | 871 | | |
801 | | - | |
| 872 | + | |
802 | 873 | | |
803 | 874 | | |
804 | 875 | | |
| |||
893 | 964 | | |
894 | 965 | | |
895 | 966 | | |
896 | | - | |
| 967 | + | |
897 | 968 | | |
898 | 969 | | |
899 | 970 | | |
| |||
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
886 | 886 | | |
887 | 887 | | |
888 | 888 | | |
889 | | - | |
| 889 | + | |
| 890 | + | |
890 | 891 | | |
891 | 892 | | |
892 | 893 | | |
893 | | - | |
| 894 | + | |
| 895 | + | |
894 | 896 | | |
895 | 897 | | |
896 | 898 | | |
897 | | - | |
| 899 | + | |
898 | 900 | | |
899 | | - | |
| 901 | + | |
900 | 902 | | |
901 | 903 | | |
902 | 904 | | |
903 | | - | |
| 905 | + | |
904 | 906 | | |
905 | 907 | | |
906 | 908 | | |
| |||
0 commit comments