From f57fc7608d722d7ae2861556894ae26c123d5af9 Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Thu, 11 Feb 2021 13:22:46 -0700 Subject: [PATCH] kgo: handle ErrBrokerTooOld in doInitProducerID The comment already referred to handling this, this commit completes the logic. --- pkg/kgo/producer.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/kgo/producer.go b/pkg/kgo/producer.go index 300dc71e..953da11d 100644 --- a/pkg/kgo/producer.go +++ b/pkg/kgo/producer.go @@ -310,12 +310,13 @@ func (cl *Client) doInitProducerID(lastID int64, lastEpoch int16) (*producerID, resp, err := req.RequestWith(cl.ctx, cl) if err != nil { - // If our broker is too old, then well... + // If our broker is too old, or our client is pinned to an old + // version, then well... // - // Note this is dependent on the first broker we hit; - // there are other areas in this client where we assume - // what we hit first is the default. - if err == ErrUnknownRequestKey { + // Note this is dependent on the first broker we hit; there are + // other areas in this client where we assume what we hit first + // is the default. + if err == ErrUnknownRequestKey || err == BrokerTooOld { cl.cfg.logger.Log(LogLevelInfo, "unable to initialize a producer id because the broker is too old, continuing without a producer id") return &producerID{-1, -1, nil}, true }