From 74c7f57e81dd45033e9eec3bacbc4dca75fef83d Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Mon, 21 Sep 2020 21:56:29 -0600 Subject: [PATCH] add support for ApiVersions changes (KIP-584) KIP-584 was partially implemented a bit ago; this adds support for that. --- generate/DEFINITIONS | 20 ++++++++++++++++++++ generate/gen.go | 4 ++-- pkg/kversion/kversion.go | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/generate/DEFINITIONS b/generate/DEFINITIONS index faa5e496..0d29c610 100644 --- a/generate/DEFINITIONS +++ b/generate/DEFINITIONS @@ -1793,6 +1793,26 @@ ApiVersionsResponse => // For Kafka < 2.0.0, the throttle is applied before issuing a response. // For Kafka >= 2.0.0, the throttle is applied after issuing a response. ThrottleMillis: int32 // v1+ + // Features supported by the broker (see KIP-584). + SupportedFeatures: [=>] // tag 0 + // The name of the feature. + Name: string + // The minimum supported version for the feature. + MinVersion: int16 + // The maximum supported version for the feature. + MaxVersion: int16 + // The monotonically increasing epoch for the finalized features information, + // where -1 indicates an unknown epoch. + FinalizedFeaturesEpoch: int32 // tag 1 + // The list of cluster-wide finalized features (only valid if + // FinalizedFeaturesEpoch is >= 0). + FinalizedFeatures: [=>] // tag 2 + // The name of the feature. + Name: string + // The cluster-wide finalized max version level for the feature. + MaxVersionLevel: int16 + // The cluster-wide finalized min version level for the feature. + MinVersionLevel: int16 // CreateTopicsRequest creates Kafka topics. // diff --git a/generate/gen.go b/generate/gen.go index c9ee1256..912a3ca7 100644 --- a/generate/gen.go +++ b/generate/gen.go @@ -177,7 +177,7 @@ func (s Struct) WriteAppend(l *LineWriter) { f.Type.WriteAppend(l) case NullableString: primAppend("CompactNullableString", l) // all tags are compact - case Struct: + case Array, Struct: l.Write("sized := false") l.Write("lenAt := len(dst)") line := l.line @@ -459,7 +459,7 @@ func (s Struct) WriteDecode(l *LineWriter) { l.Write("}") } - case NullableString: + case NullableString, Array: default: die("type %v unsupported in decode! fix this!", f.Type) diff --git a/pkg/kversion/kversion.go b/pkg/kversion/kversion.go index c2eb049b..c7d6dce7 100644 --- a/pkg/kversion/kversion.go +++ b/pkg/kversion/kversion.go @@ -396,6 +396,8 @@ func Tip() Versions { v[25]++ // 2 add offsets to txn v[26]++ // 2 end txn + v[18]++ // KAFKA-10027 4f96c5b424956355339dd3216c426c1c0388fe9e KIP-584 + v = append(v, 0, // 50 describe user scram creds, KAFKA-10259 e8524ccd8fca0caac79b844d87e98e9c055f76fb KIP-554 0, // 51 alter user scram creds, same