ijuma commented on code in PR #14470:
URL: https://github.com/apache/kafka/pull/14470#discussion_r1345292439


##########
core/src/main/scala/kafka/log/UnifiedLog.scala:
##########
@@ -768,10 +768,10 @@ class UnifiedLog(@volatile var logStartOffset: Long,
     // This will ensure that any log data can be recovered with the correct 
topic ID in the case of failure.
     maybeFlushMetadataFile()
 
-    val appendInfo = analyzeAndValidateRecords(records, origin, 
ignoreRecordSize, leaderEpoch)
+    val appendInfo = analyzeAndValidateRecords(records, origin, 
ignoreRecordSize, !validateAndAssignOffsets, leaderEpoch)
 
     // return if we have no valid messages or if this is a duplicate of the 
last appended entry
-    if (appendInfo.shallowCount == 0) appendInfo
+    if (appendInfo.validBytes <= 0) appendInfo

Review Comment:
   I think we have to be careful about changes like this. The previous version 
had fewer assumptions than this one. I think it's fine not to include the 
shallowCount as a field, but we should have a method that represents the intent 
vs having the implicit assumption regarding how `validBytes` is populated 
(including the behavior when there are duplicates of the last appended entry).



-- 
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