hachikuji commented on a change in pull request #9676:
URL: https://github.com/apache/kafka/pull/9676#discussion_r552084319



##########
File path: core/src/main/scala/kafka/log/Log.scala
##########
@@ -1093,19 +1097,25 @@ class Log(@volatile private var _dir: File,
                      assignOffsets: Boolean,
                      leaderEpoch: Int,
                      ignoreRecordSize: Boolean): LogAppendInfo = {
-    maybeHandleIOException(s"Error while appending records to $topicPartition 
in dir ${dir.getParent}") {
-      val appendInfo = analyzeAndValidateRecords(records, origin, 
ignoreRecordSize)
 
-      // return if we have no valid messages or if this is a duplicate of the 
last appended entry
-      if (appendInfo.shallowCount == 0) appendInfo
-      else {
+    val appendInfo = analyzeAndValidateRecords(records, origin, 
ignoreRecordSize)
 
-        // trim any invalid bytes or partial messages before appending it to 
the on-disk log
-        var validRecords = trimInvalidBytes(records, appendInfo)
+    // return if we have no valid messages or if this is a duplicate of the 
last appended entry
+    if (appendInfo.shallowCount == 0) appendInfo
+    else {
 
-        // they are valid, insert them in the log
-        lock synchronized {
+      // trim any invalid bytes or partial messages before appending it to the 
on-disk log
+      var validRecords = trimInvalidBytes(records, appendInfo)
+
+      // they are valid, insert them in the log
+      lock synchronized {
+        maybeHandleIOException(s"Error while appending records to 
$topicPartition in dir ${dir.getParent}") {
           checkIfMemoryMappedBufferClosed()
+
+          // check for offline log dir in case a retry following an 
IOException happens before the log dir
+          // is taken offline, which would result in inconsistent producer 
state
+          checkForLogDirFailure()

Review comment:
       Do we still need this since this check is in `maybeHandleIOException`?




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

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


Reply via email to