Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kversions: skip many more broker-to-broker keys #739

Merged
merged 1 commit into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions pkg/kversion/kversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,6 @@ type guessOpt struct{ fn func(*guessCfg) }
func (opt guessOpt) apply(cfg *guessCfg) { opt.fn(cfg) }

// SkipKeys skips the given keys while guessing versions.
//
// The current default is to skip keys that are only used by brokers:
//
// 4: LeaderAndISR
// 5: StopReplica
// 6: UpdateMetadata
// 7: ControlledShutdown
// 27: WriteTxnMarkers
func SkipKeys(keys ...int16) VersionGuessOpt {
return guessOpt{func(cfg *guessCfg) { cfg.skipKeys = keys }}
}
Expand Down Expand Up @@ -337,7 +329,7 @@ func (vs *Versions) versionGuess(opts ...VersionGuessOpt) guess {
//
// TODO: add introduced-version to differentiate some specific
// keys.
skipKeys: []int16{4, 5, 6, 7, 27, 58},
skipKeys: []int16{4, 5, 6, 7, 27, 52, 53, 54, 55, 56, 57, 58, 59, 62, 63, 64, 67},
}
for _, opt := range opts {
opt.apply(&cfg)
Expand Down
39 changes: 39 additions & 0 deletions pkg/kversion/kversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,42 @@ func TestFromString(t *testing.T) {
}
}
}

func TestGuessVersions(t *testing.T) {
for _, test := range []struct {
vs *Versions
exp string
}{
{V0_8_0(), "v0.8.0"},
{V0_8_1(), "v0.8.1"},
{V0_8_2(), "v0.8.2"},
{V0_9_0(), "v0.9.0"},
{V0_10_0(), "v0.10.0"},
{V0_10_1(), "v0.10.1"},
{V0_10_2(), "v0.10.2"},
{V0_11_0(), "v0.11.0"},
{V1_0_0(), "v1.0"},
{V1_1_0(), "v1.1"},
{V2_0_0(), "v2.0"},
{V2_1_0(), "v2.1"},
{V2_2_0(), "v2.2"},
{V2_3_0(), "v2.3"},
{V2_4_0(), "v2.4"},
{V2_5_0(), "v2.5"},
{V2_6_0(), "v2.6"},
{V2_7_0(), "v2.7"},
{V2_8_0(), "v2.8"},
{V3_0_0(), "v3.0"},
{V3_1_0(), "v3.1"},
{V3_2_0(), "v3.2"},
{V3_3_0(), "v3.3"},
{V3_4_0(), "v3.4"},
{V3_5_0(), "v3.5"},
{V3_6_0(), "v3.6"},
} {
got := test.vs.VersionGuess()
if got != test.exp {
t.Errorf("got %s != exp %s", got, test.exp)
}
}
}
Loading