dajac commented on code in PR #14629:
URL: https://github.com/apache/kafka/pull/14629#discussion_r1381378455


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -864,6 +778,111 @@ class ReplicaManager(val config: KafkaConfig,
     }
   }
 
+  /*
+   * Note: This method can be used as a callback in a different request 
thread. Ensure that correct RequestLocal
+   * is passed when executing this method. Accessing non-thread-safe data 
structures should be avoided if possible.
+   */
+  private def appendEntries(allEntries: Map[TopicPartition, MemoryRecords],
+                            internalTopicsAllowed: Boolean,
+                            origin: AppendOrigin,
+                            requiredAcks: Short,
+                            verificationGuards: Map[TopicPartition, 
VerificationGuard],

Review Comment:
   @hachikuji Yeah, that's right. I think that we could do it as follow:
   1) Apply first verification (e.g. is it the right coordinator, is the member 
valid, etc)
   2) Prepare the transaction (the async call to the transaction coordinator if 
needed)
   3) Re-verify
   4) State change + write
   
   This would reduce the likelihood of preparing the transaction for nothing 
but it could still happen because the state could change in between. I think 
that this is possible regardless of the model that we use.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to