Certain thread states can have very different meanings in a Galera Cluster environment. For example:
- checking permissions - For DDL, this often means that the thread is waiting for some other transaction(s) to finish, so that the DDL can be executed in isolation (when wsrep_OSU_method=TOI).
- statistics - I believe that this can mean that the thread is waiting, either because flow control is in effect or because DDL is being executed in isolation (when wsrep_OSU_method=TOI).
- query end - I believe that this usually means that either that flow control is in effect, so the query can't be certified yet, or that the query's writeset is being certified by the other nodes, but it hasn't finished yet.
Thread states might be overloaded in other cases too, but these are the ones that I see most often.
Maybe we need some new thread states, such as the following?:
- waiting to execute in isolation - DDL is waiting to execute in TOI mode.
- waiting for TOI DDL - some other statement is waiting for DDL to complete.
- waiting for flow control - some statement is paused while flow control is in effect.
- waiting for certification - the transaction is being certified.