showuon commented on code in PR #12667:
URL: https://github.com/apache/kafka/pull/12667#discussion_r975975334


##########
core/src/main/scala/kafka/log/ProducerStateManager.scala:
##########
@@ -233,10 +233,16 @@ private[log] class ProducerAppendInfo(val topicPartition: 
TopicPartition,
 
       // If there is no current producer epoch (possibly because all producer 
records have been deleted due to
       // retention or the DeleteRecords API) accept writes with any sequence 
number
-      if (!(currentEntry.producerEpoch == RecordBatch.NO_PRODUCER_EPOCH || 
inSequence(currentLastSeq, appendFirstSeq))) {
+      if (currentEntry.producerEpoch != RecordBatch.NO_PRODUCER_EPOCH && 
!inSequence(currentLastSeq, appendFirstSeq)) {
         throw new OutOfOrderSequenceException(s"Out of order sequence number 
for producer $producerId at " +
-          s"offset $offset in partition $topicPartition: $appendFirstSeq 
(incoming seq. number), " +
-          s"$currentLastSeq (current end sequence number)")
+          s"offset $offset in partition $topicPartition: producer request 
epoch $producerEpoch, " +
+          s"current entry epoch ${currentEntry.producerEpoch}, " +
+          s"updating entry epoch ${updatedEntry.producerEpoch}, " +
+          s"append first seq $appendFirstSeq, " +
+          s"updating entry last seq ${updatedEntry.lastSeq}, " +
+          s"updating batch empty ${updatedEntry.isEmpty}" +

Review Comment:
   nit: updating entry last seq will be `-1` if `updatedEntry.isEmpty`. Is this 
line still necessary? Or you think it's possible this value might be changed by 
other thread?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to