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)