Skip to content

Commit

Permalink
enforce KIP-98 idempotency config rules: acks=all, retries > 0
Browse files Browse the repository at this point in the history
We do not enforce max inflight requests per connection because our
client internally bounds that to 1 unless we notice we are on Kafka
1.0.0, where the limit was raised to 5.
  • Loading branch information
twmb committed Mar 29, 2021
1 parent 2dc7d3f commit bef2311
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/kgo/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ func (cfg *cfg) validate() error {
if cfg.disableIdempotency && cfg.txnID != nil {
return errors.New("cannot both disable idempotent writes and use transactional IDs")
}
if !cfg.disableIdempotency {
if cfg.acks.val != -1 {
return errors.New("idempotency requires acks=all")
}
if cfg.retries == 0 {
return errors.New("idempotency requires RequestRetries to be greater than 0")
}
}

for _, limit := range []struct {
name string
Expand Down

0 comments on commit bef2311

Please sign in to comment.