Commit 29f0459
fix(binding-kafka): back off and reconnect proactively on NOT_LEADER_OR_FOLLOWER (#2555)
Port #2551 (support/1.x) to develop.
KafkaCacheClientFetchFactory's cache_client fanout previously tore down
every fetch member and forced the application to reconnect whenever the
broker reported NOT_LEADER_OR_FOLLOWER. It now backs off with capped
exponential delay and reconnects the downstream leg internally, keeping
app-facing members open. KafkaCacheClientMetaFactory notifies both the
fetch and produce fanouts as soon as a meta refresh resolves a new
leader, letting a pending reconnect cut its backoff short. The
onClientFanoutMemberOpening leader-mismatch guard no longer fires while
the fanout's leader is unknown, so it doesn't tear down members that
raced in during the backoff window.
KafkaCacheClientProduceFactory already carried do this backoff/retry
scaffolding; this port adds the missing reconnectAt guard on
doClientFanInitialBeginIfNecessary and its own onLeaderReady hook so it
benefits from the same proactive meta-driven reconnect.
partition.not.leader.reconnect's client script now reflects the
transparent reconnect (no visible reset/second connect). The original
two-hop, application-driven reconnect contract is preserved under new
scenario names (partition.not.leader.client.reconnect for the
CacheFetchIT/FetchIT client-reconnect-delay-0 case, and
partition.not.leader.cache.reconnect for the spec-level peer-to-peer
counterpart), each with a corresponding IT method.
Verified via full `mvnw verify` (checkstyle, license, unit + IT) on
runtime/binding-kafka and specs/binding-kafka.spec: 635 tests, 0
failures.
Claude-Session: https://claude.ai/code/session_01FbdHyarRhpWZ7cqGWrHAzJ
Co-authored-by: Claude <noreply@anthropic.com>1 parent 621aaa4 commit 29f0459
10 files changed
Lines changed: 606 additions & 41 deletions
File tree
- runtime/binding-kafka/src
- main/java/io/aklivity/zilla/runtime/binding/kafka/internal/stream
- test/java/io/aklivity/zilla/runtime/binding/kafka/internal/stream
- specs/binding-kafka.spec/src
- main/scripts/io/aklivity/zilla/specs/binding/kafka/streams/application/fetch
- partition.not.leader.cache.reconnect
- partition.not.leader.client.reconnect
- partition.not.leader.reconnect
- test/java/io/aklivity/zilla/specs/binding/kafka/streams/application
Lines changed: 106 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
111 | 114 | | |
112 | 115 | | |
113 | 116 | | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
| |||
122 | 126 | | |
123 | 127 | | |
124 | 128 | | |
| 129 | + | |
125 | 130 | | |
126 | 131 | | |
127 | 132 | | |
| |||
146 | 151 | | |
147 | 152 | | |
148 | 153 | | |
| 154 | + | |
149 | 155 | | |
150 | 156 | | |
151 | 157 | | |
152 | 158 | | |
153 | 159 | | |
154 | 160 | | |
155 | 161 | | |
| 162 | + | |
156 | 163 | | |
157 | 164 | | |
158 | 165 | | |
| |||
170 | 177 | | |
171 | 178 | | |
172 | 179 | | |
| 180 | + | |
173 | 181 | | |
174 | 182 | | |
175 | 183 | | |
176 | 184 | | |
177 | 185 | | |
178 | 186 | | |
| 187 | + | |
179 | 188 | | |
180 | 189 | | |
181 | 190 | | |
| |||
222 | 231 | | |
223 | 232 | | |
224 | 233 | | |
| 234 | + | |
225 | 235 | | |
226 | 236 | | |
227 | 237 | | |
| |||
240 | 250 | | |
241 | 251 | | |
242 | 252 | | |
| 253 | + | |
243 | 254 | | |
244 | 255 | | |
245 | 256 | | |
| |||
251 | 262 | | |
252 | 263 | | |
253 | 264 | | |
254 | | - | |
255 | 265 | | |
256 | 266 | | |
257 | 267 | | |
| |||
517 | 527 | | |
518 | 528 | | |
519 | 529 | | |
| 530 | + | |
520 | 531 | | |
521 | 532 | | |
522 | 533 | | |
| |||
538 | 549 | | |
539 | 550 | | |
540 | 551 | | |
| 552 | + | |
| 553 | + | |
541 | 554 | | |
542 | 555 | | |
543 | 556 | | |
544 | 557 | | |
545 | 558 | | |
546 | 559 | | |
| 560 | + | |
547 | 561 | | |
548 | 562 | | |
549 | 563 | | |
550 | 564 | | |
551 | 565 | | |
552 | 566 | | |
| 567 | + | |
553 | 568 | | |
554 | 569 | | |
555 | 570 | | |
| |||
563 | 578 | | |
564 | 579 | | |
565 | 580 | | |
566 | | - | |
| 581 | + | |
567 | 582 | | |
568 | 583 | | |
569 | 584 | | |
| |||
603 | 618 | | |
604 | 619 | | |
605 | 620 | | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
606 | 627 | | |
607 | 628 | | |
608 | 629 | | |
609 | 630 | | |
610 | 631 | | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
611 | 643 | | |
612 | 644 | | |
613 | 645 | | |
| |||
622 | 654 | | |
623 | 655 | | |
624 | 656 | | |
625 | | - | |
| 657 | + | |
626 | 658 | | |
627 | | - | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
628 | 689 | | |
629 | 690 | | |
630 | 691 | | |
| |||
814 | 875 | | |
815 | 876 | | |
816 | 877 | | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | 878 | | |
822 | 879 | | |
823 | 880 | | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
824 | 920 | | |
825 | 921 | | |
826 | 922 | | |
| |||
846 | 942 | | |
847 | 943 | | |
848 | 944 | | |
| 945 | + | |
| 946 | + | |
849 | 947 | | |
850 | 948 | | |
851 | 949 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
649 | 651 | | |
650 | 652 | | |
651 | 653 | | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
652 | 673 | | |
653 | 674 | | |
654 | 675 | | |
| |||
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
634 | 645 | | |
635 | 646 | | |
636 | 647 | | |
| |||
639 | 650 | | |
640 | 651 | | |
641 | 652 | | |
642 | | - | |
| 653 | + | |
643 | 654 | | |
644 | 655 | | |
645 | 656 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
116 | 127 | | |
117 | 128 | | |
118 | 129 | | |
| |||
0 commit comments