[Maria-developers] How to check for active transaction?
![](https://secure.gravatar.com/avatar/99fde0c1dfd216326aae0aff30d493f1.jpg?s=120&d=mm&r=g)
Hi Serg, I'm merging MWL#234 into 5.5. I have a session variable @@skip_replication. I want to ensure that this variable is not modified in the middle of a statement or while a transaction is active. (The reason for this is that it changes whether changes are replicated or not - and so changing in the middle of statement or transaction could cause us to replicate only half of the event/transaction). In my 5.2-based tree, I had this condition, but this seems to no longer work: thd->locked_tables || thd->active_transaction() Can you help me find how to do this check in 5.5 code base? - Kristian.
![](https://secure.gravatar.com/avatar/3c2329333dd5898f2e72818af773243d.jpg?s=120&d=mm&r=g)
Hi, Kristian! On Feb 29, Kristian Nielsen wrote:
Hi Serg,
I'm merging MWL#234 into 5.5.
I have a session variable @@skip_replication. I want to ensure that this variable is not modified in the middle of a statement or while a transaction is active.
(The reason for this is that it changes whether changes are replicated or not - and so changing in the middle of statement or transaction could cause us to replicate only half of the event/transaction).
In my 5.2-based tree, I had this condition, but this seems to no longer work:
thd->locked_tables || thd->active_transaction()
Can you help me find how to do this check in 5.5 code base?
Use thd->server_status & SERVER_STATUS_IN_TRANS By the way, there's a server variable @@in_transaction, that allows to check that from SQL, if you need to write tests or something. Regards, Sergei
participants (2)
-
Kristian Nielsen
-
Sergei Golubchik