You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Vincent Jiang (Jira)" <ji...@apache.org> on 2022/12/15 20:06:00 UTC

[jira] [Created] (KAFKA-14497) LastStableOffset is advanced prematurely when a log is reopened.

Vincent Jiang created KAFKA-14497:
-------------------------------------

             Summary: LastStableOffset is advanced prematurely when a log is reopened.
                 Key: KAFKA-14497
                 URL: https://issues.apache.org/jira/browse/KAFKA-14497
             Project: Kafka
          Issue Type: Bug
            Reporter: Vincent Jiang


In below test case, last stable offset of log is advanced prematurely after reopen:
 # producer #1 appends transaction records to leader. offsets = [0, 1, 2, 3]
 # producer #2 appends transactional records to leader. offsets =  [4, 5, 6, 7]
 # all records are replicated to followers and high watermark advanced to 8.
 # at this point, lastStableOffset = 0. (first offset of an open transaction)
 # producer #1 aborts the transaction by writing an abort marker at offset 8.  ProducerStateManager.unreplicatedTxns contains the aborted transaction (firstOffset=0, lastOffset=8)
 # then the log is closed and reopened.
 # after reopen, log.lastStableOffset is initialized to 4.  This is because ProducerStateManager.unreplicatedTxns is empty after reopening log.

 

We should rebuild ProducerStateManager.unreplicatedTxns when reloading a log, so that lastStableOffset remains unchanged before and after reopen.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)