0

I read a lot of articles about Kafka and still don't understand. In a few words my questions is: is it possible, to have message in physical files in Replicas(Followers) meanwhile Partition Leader thinks that message is unacknowledged?

In details: Say: rf=3, min.isr=2, acks=all.

  1. Producer sends message to partition leader (kafka instance).
  2. Followers periodically come to leader and fetch messages.
  3. Each replica saves message to disk, and after that sends ack to producer.
  4. Leader receives enough acks and sends ack to producer.

Now what if: On step 3, replica saves message to disk(page cache+flush) and then can NOT send ack(packet loss, network problem, or just process crash). Leader will think that replica didn't persist message, and will send reject to producer. Meanwhile replica has the message on disk in segment (in physical file). In this case we have a problem. Producer and Leader think that message was not stored, but actually replica saved it (and other replicas could save it too).

I read a lot of articles and watched a lot of videos. Checked source, but too much to check. I reviewed existed questions, and they didn't have answers.

livkonrol
  • 13
  • 4
  • "will send reject to producer" - Only if retries are disabled. When retries are disabled/exhausted, then that record batch is lost – OneCricketeer May 24 '23 at 16:47
  • but what will be with the record on follower in my scenario? is it true that it can be saved on disk meanwhile leader does not receive ack from replica? – livkonrol May 24 '23 at 22:20
  • I've not done failure scenarios around it, but I know there are test cases around this in the broker's code... Ultimately, it depends if you have unclean leader election disabled, if log segments get truncated to completely replicated watermarks. But I don't think data is written to the leader until all min ISR acks are received – OneCricketeer May 25 '23 at 12:23

0 Answers0