[storm]消息事务算法的一个理解

https://github.com/nathanmarz/storm/wiki/Guaranteeing-message-processing这篇文章介绍了storm如何处理消息事务,提到了用一个ack value代表一个tuple的生命周期。

其算法是“It is simply the xor of all tuple ids that have been created and/or acked in the tree.”

如果topology是

Spout->A->B

 ,那么计算过程应该是

(0^U(s))^(U(s)^U(A))^(U(A)^0)=0

U(s)代表spout创建的tuple id.也就是tuple创建时和ack时都要XOR一次,当所有component都处理完时,结果值是0.最后一个bolt没有下游bolt时为0.

相关推荐