From 9e32bf9f11c6a201370a1927e1fa44ab9be62ee6 Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Sat, 8 Jun 2024 16:47:40 -0600 Subject: [PATCH] kgo: ignore aborted txns if using READ_UNCOMMITTED Kafka does not return AbortedTransactions in the fetch response if the client is using read uncommitted, so kgo works perfectly against Kafka. Redpanda DOES return AbortedTransactions (today, although this is being changed) even if the client is using READ_UNCOMMITTED, which causes records to be skipped. Redpanda is changing, but we can address this in kgo as well. --- pkg/kgo/source.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/kgo/source.go b/pkg/kgo/source.go index 316eee27..603b0864 100644 --- a/pkg/kgo/source.go +++ b/pkg/kgo/source.go @@ -1192,7 +1192,10 @@ func (o *cursorOffsetNext) processRespPartition(br *broker, rp *kmsg.FetchRespon o.hwm = rp.HighWatermark } - aborter := buildAborter(rp) + var aborter aborter + if br.cl.cfg.isolationLevel == 1 { + aborter = buildAborter(rp) + } // A response could contain any of message v0, message v1, or record // batches, and this is solely dictated by the magic byte (not the