From 6fb5b05d17ea35a110398e5754d6d0f0e001be14 Mon Sep 17 00:00:00 2001 From: Dmitriy Kulagin <86959543+Dmitriy-Kulagin@users.noreply.github.com> Date: Mon, 17 Nov 2025 23:24:05 +0100 Subject: [PATCH] correct lengthRemain handling into message_read.readMessageV2 --- message_reader.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/message_reader.go b/message_reader.go index a0a0385ef..03ce090dc 100644 --- a/message_reader.go +++ b/message_reader.go @@ -292,6 +292,9 @@ func (r *messageSetReader) readMessageV2(_ int64, key readBytesFunc, val readByt // stack. here we set the parent count to 0 so that when the child set is exhausted, the // reader will then try to read the header of the next message set r.readerStack.parent.count = 0 + // lengthRemain have to be adjusted to length of decompressed data + // otherwise we can end up with negative lengthRemain that will fail the check into batch.go:readMessage:283, that leads to endlessly reading the same compacted batch + r.lengthRemain = r.remain } } remainBefore := r.remain