Insight of the day: #ApacheKafka actually implements a three-phase commit protocol (not just the standard two-phase protocol) for its transactional writes . \1
We usually explain it as a two-phase commit, and the third phase is somewhat hidden. The reason is, that the coordination of the protocol is split between the producer and the broker TX-coordinator.
The producer waits until all writes are flushed, replicated, and acked before it starts the commit. This waiting completes the first phase. \3
The actual commitTx call from the producer to the broker TX-coordinator completes the second phase. (We often describe this as the end of the first phase of the commit, as the data is not readable yet, because no commit markers are written to the data partition yet). \4
However the waiting of the producer effectively ensures, that the broker side TX-coordinator conceptually transit into preparedCommit state! I always missed this detail! Read up at en.wikipedia.org/wiki/Three-pha… \5
Why does it matter? Well, the standard two-phase commit protocol could block for some error cases, while the three-phase commit protocol helps to avoid blocking for those cases! \6
Thanks to @hostirosti who asked about it! After he pointed out the difference between both protocols I read up on it and discover this sweet little detail! Always good to discuss with @hostirost!

\theEnd

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Matthias J. Sax

Matthias J. Sax Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!