From 7a3014410d466055213af6c11d6b18b610c5672d Mon Sep 17 00:00:00 2001 From: Anton Agestam Date: Thu, 13 Jun 2024 08:56:54 +0200 Subject: [PATCH] fix: Clarify comment in backup consumer logic (#781) * fix: Clarify comment in backup consumer logic * Update api.py --- karapace/backup/api.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/karapace/backup/api.py b/karapace/backup/api.py index 5b80c8823..8f2b09f14 100644 --- a/karapace/backup/api.py +++ b/karapace/backup/api.py @@ -299,7 +299,13 @@ def _consume_records( if start_offset >= end_offset: raise EmptyPartition - end_offset -= 1 # high watermark to actual end offset + # confluent-kafka-python returns end offset + 1, i.e. the value that will + # be assigned to the next record to be produced. To get the highest offset + # already produced we need to subtract 1. Note that this has little to do + # with high watermark, which takes into account the highest record offset + # to be fully in sync across ISRs, and therefore can be an arbitrary + # number less than or equal to the LEO. + end_offset -= 1 while True: record: Message | None = consumer.poll(timeout=poll_timeout.seconds)