Commit 9a6cc65
fix: don't route member-ID discovery onto a still-learner self (#26)
discoverMemberID built its endpoint list from voter peers and then
*unconditionally* appended the member's own client URL as a "self
last" fallback. The comment claimed the learner rejection "only fires
when we route past a voter to a learner", but clientv3's balancer
does not honor endpoint order — it round-robins. So when the member
being discovered is itself a freshly-added learner and a voter peer
is present, the balancer can land MemberList on our own etcd, which
returns "rpc not supported for learner". With a 5s context budget
that wedges discovery: MemberID never gets populated, MemberReady
never flips true, the cluster controller's allMembersReady gate never
opens, the scale-up stalls past progressDeadline, and the next member
is never added.
Observed on dev4 during the cert-manager TLS smoke: a 3-replica
cluster stuck at 2 members (one voter + one perpetual learner) with
the operator logging MemberList against the learner's own endpoint.
Not TLS-specific — any multi-member scale-up where a learner's pod
restarts before promotion (re-triggering discovery) can hit it.
Fix: make self a true fallback — append it only when no voter peer is
available (single-node bootstrap, or no other voter Ready yet),
mirroring memberEndpoints' voter-or-fallback shape. When a voter peer
exists, discovery dials only voters and resolves the learner's ID
from their MemberList by name / peer URL.
Tests: TestDiscoverMemberID_ExcludesSelfWhenVoterAvailable reproduces
the wedge (target IS the learner, one voter peer) and asserts self is
excluded — it fails on the old code with the exact two-endpoint list.
TestDiscoverMemberID_FallsBackToSelfWhenNoVoter pins the single-node
fallback the tightening must preserve.
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent eb9593d commit 9a6cc65
2 files changed
Lines changed: 117 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
883 | 883 | | |
884 | 884 | | |
885 | 885 | | |
886 | | - | |
887 | | - | |
888 | | - | |
889 | | - | |
890 | | - | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
891 | 896 | | |
892 | 897 | | |
893 | 898 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
961 | 961 | | |
962 | 962 | | |
963 | 963 | | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
964 | 1071 | | |
965 | 1072 | | |
966 | 1073 | | |
| |||
0 commit comments