Skip to content

Commit 80984f8

Browse files
authored
Merge pull request #1174 from vincentbernat/fix/maxvers
kgo: fix remaining usage of kgo.maxVers/kgo.maxVersion
2 parents 2698ed0 + 13ea38e commit 80984f8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pkg/kgo/broker.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ start:
328328
return
329329
}
330330

331-
// If v.maxVers[0] is non-negative, then we loaded API
331+
// If v.maxVersion(0) is non-negative, then we loaded API
332332
// versions. If the version for this request is negative, we
333333
// know the broker cannot handle this request.
334334
if v.maxVersion(0) >= 0 && v.maxVersion(req.Key()) < 0 {
@@ -881,9 +881,9 @@ func (cxn *brokerCxn) sasl() error {
881881
req := kmsg.NewPtrSASLHandshakeRequest()
882882

883883
start:
884-
if mechanism.Name() != "GSSAPI" && v.maxVers[req.Key()] >= 0 {
884+
if mechanism.Name() != "GSSAPI" && v.maxVersion(req.Key()) >= 0 {
885885
req.Mechanism = mechanism.Name()
886-
req.Version = v.maxVers[req.Key()]
886+
req.Version = v.maxVersion(req.Key())
887887
cxn.cl.cfg.logger.Log(LogLevelDebug, "issuing SASLHandshakeRequest", "broker", logID(cxn.b.meta.NodeID))
888888
corrID, bytesWritten, writeWait, timeToWrite, readEnqueue, writeErr := cxn.writeRequest(nil, time.Now(), req)
889889
if writeErr != nil {
@@ -970,7 +970,7 @@ func (cxn *brokerCxn) doSasl(authenticate bool) error {
970970
} else {
971971
req := kmsg.NewPtrSASLAuthenticateRequest()
972972
req.SASLAuthBytes = clientWrite
973-
req.Version = cxn.b.loadVersions().maxVers[req.Key()]
973+
req.Version = cxn.b.loadVersions().maxVersion(req.Key())
974974
cxn.cl.cfg.logger.Log(LogLevelDebug, "issuing SASLAuthenticate", "broker", logID(cxn.b.meta.NodeID), "version", req.Version, "step", step)
975975

976976
// Lifetime: we take the timestamp before we write our

pkg/kgo/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ func (cl *Client) supportsKeyVersion(key, version int16) bool {
910910
cl.loadSeeds(),
911911
} {
912912
for _, b := range brokers {
913-
if v := b.loadVersions(); v != nil && v.maxVers[key] >= version {
913+
if v := b.loadVersions(); v != nil && v.maxVersion(key) >= version {
914914
return true
915915
}
916916
}

0 commit comments

Comments
 (0)