Skip to content

Commit fe727f8

Browse files
committed
kversion: cut Kafka 3.4
Tested with kcl, we can now probe 3.4 successfully. This required a bit of a change to version guessing (and I really hope KIP-885 is in by the next release...). Previously, we would skip the few internal APIs by default. Now, if the ApiVersion response includes an API we are skipping, we check it.
1 parent ede1adc commit fe727f8

1 file changed

Lines changed: 31 additions & 14 deletions

File tree

‎pkg/kversion/kversion.go‎

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ func (vs *Versions) VersionGuess(opts ...VersionGuessOpt) string {
195195

196196
var last string
197197
cmp := make(map[int16]int16, len(maxTip))
198+
cmpskip := make(map[int16]int16)
198199
for _, comparison := range []struct {
199200
cmp listenerKeys
200201
name string
@@ -222,10 +223,17 @@ func (vs *Versions) VersionGuess(opts ...VersionGuessOpt) string {
222223
{max310, "v3.1"},
223224
{max320, "v3.2"},
224225
{max330, "v3.3"},
226+
{max340, "v3.4"},
225227
} {
226228
for k, v := range comparison.cmp.filter(cfg.listener) {
227-
if !skip[int16(k)] && v != -1 {
228-
cmp[int16(k)] = v
229+
if v == -1 {
230+
continue
231+
}
232+
k16 := int16(k)
233+
if skip[k16] {
234+
cmpskip[k16] = v
235+
} else {
236+
cmp[k16] = v
229237
}
230238
}
231239

@@ -234,7 +242,11 @@ func (vs *Versions) VersionGuess(opts ...VersionGuessOpt) string {
234242
for k, v := range vs.k2v {
235243
k16 := int16(k)
236244
if skip[k16] {
237-
continue
245+
skipv, ok := cmpskip[k16]
246+
if v == -1 || !ok {
247+
continue
248+
}
249+
cmp[k16] = skipv
238250
}
239251
cmpv, has := cmp[k16]
240252
if has {
@@ -350,6 +362,7 @@ func V3_0_0() *Versions { return zkBrokerOf(max300) }
350362
func V3_1_0() *Versions { return zkBrokerOf(max310) }
351363
func V3_2_0() *Versions { return zkBrokerOf(max320) }
352364
func V3_3_0() *Versions { return zkBrokerOf(max330) }
365+
func V3_4_0() *Versions { return zkBrokerOf(max340) }
353366

354367
func zkBrokerOf(lks listenerKeys) *Versions {
355368
return &Versions{lks.filter(zkBroker)}
@@ -934,18 +947,22 @@ var max330 = nextMax(max320, func(v listenerKeys) listenerKeys {
934947
return v
935948
})
936949

950+
var max340 = nextMax(max330, func(v listenerKeys) listenerKeys {
951+
// KAFKA-14304 7b7e40a536a79cebf35cc278b9375c8352d342b9 KIP-866
952+
// KAFKA-14448 67c72596afe58363eceeb32084c5c04637a33831 added BrokerRegistration
953+
// KAFKA-14493 db490707606855c265bc938e1b236070e0e2eba5 changed BrokerRegistration
954+
// KAFKA-14304 0bb05d8679b684ad8fbb2eb40dfc00066186a75a changed BrokerRegistration back to a bool...
955+
// 5b521031edea8ea7cbcca7dc24a58429423740ff added tag to ApiVersions
956+
v[4].inc() // 7 leader and isr
957+
v[5].inc() // 4 stop replica
958+
v[6].inc() // 8 update metadata
959+
v[62].inc() // 1 broker registration
960+
return v
961+
})
962+
937963
var (
938-
maxStable = max330
964+
maxStable = max340
939965
maxTip = nextMax(maxStable, func(v listenerKeys) listenerKeys {
940-
// KAFKA-14304 7b7e40a536a79cebf35cc278b9375c8352d342b9 KIP-866
941-
// KAFKA-14448 67c72596afe58363eceeb32084c5c04637a33831 added BrokerRegistration
942-
// KAFKA-14493 db490707606855c265bc938e1b236070e0e2eba5 changed BrokerRegistration
943-
// KAFKA-14304 0bb05d8679b684ad8fbb2eb40dfc00066186a75a changed BrokerRegistration back to a bool...
944-
// 5b521031edea8ea7cbcca7dc24a58429423740ff added tag to ApiVersions
945-
v[4].inc() // 7 leader and isr
946-
v[5].inc() // 4 stop replica
947-
v[6].inc() // 8 update metadata
948-
v[62].inc() // 1 broker registration
949-
return v
966+
return maxStable
950967
})
951968
)

0 commit comments

Comments
 (0)