Skip to content

Commit

Permalink
kgo: pin AddPartitionsToTxn to v3 when using one transaction
Browse files Browse the repository at this point in the history
KIP-890 has been updated such that v3 must be used by clients. We will
pin to v3 unless multiple transactions are being added, or unless any
transaction is verify only.

Closes #609.
  • Loading branch information
twmb committed Nov 1, 2023
1 parent 6ebcb43 commit e209bb6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/kgo/client.go
Expand Up @@ -3420,10 +3420,17 @@ func (cl *addPartitionsToTxnSharder) shard(ctx context.Context, kreq kmsg.Reques

var issues []issueShard
for id, req := range brokerReqs {
issues = append(issues, issueShard{
req: req,
broker: id,
})
if len(req.Transactions) <= 1 || len(req.Transactions) == 1 && !req.Transactions[0].VerifyOnly {
issues = append(issues, issueShard{
req: &pinReq{Request: req, pinMax: true, max: 3},
broker: id,
})
} else {
issues = append(issues, issueShard{
req: req,
broker: id,
})
}
}
for _, unkerr := range unkerrs {
issues = append(issues, issueShard{
Expand Down

0 comments on commit e209bb6

Please sign in to comment.