doc/design-docs/VTTabletFastStateTransitions.md
This issue is in response to #6645. When vttablet transitions from primary to non-primary, the following problems can occur under different circumstances:
transaction_shutdown_grace_period must acquire a new meaning. It should be renamed to shutdown_grace_period, and must also apply to queries that are exceeding this time limit. This limit applies to all queries: streaming, oltp read, reserved, and in_transaction.Many approaches were discussed in #6645. Those approaches are all non-viable because they don't address all of the above concerns.
To fix all these problems, some refactoring will need to be done. Here's the proposal:
During a previous code review, I also found a (rare) race condition in tx_engine, which I forgot to document. I'll redo the analysis and fix the race if it's trivial.
The most important guarantee of this change is that a shutdown will not take longer than the shutdown_grace_period if it was specified.