I am trying to understand how data rebalance works. Consider that I have a read-only single-tablet long-running transaction. There are three node A (tablet leader), B and C. The node D is added, and tablet leadership is about to be transferred to it. What will happen to the ongoing transaction which is currently reading data from node A?
Will it prevent leader switch from A to D until it is finished? Or maybe the transaction will be canceled?
Thank you in advance.
In the example you quoted, currently the transaction will be cancelled.
It may be possible to prevent switch from A to D when transactions are in progress, but in an OLTP system this may not be beneficial. Typically, in such applications, the latency of each transaction is small and number of concurrent transactions is large. In these scenarios, waiting and quiescing transactions might be worse (may cause more latency) rather than to do the rebalance immediately.
Does that help? cc @mbautin in case he wants to add anything.
Yes, this helps. Thank you.