← Back to team overview

maria-developers team mailing list archive

Help with running a transaction inside the server

 

Hi Serg,

Can you give me a tip for doing the following (for MDEV-26, global transaction
ID):

I need to run a transaction inside the server. This is in the slave I/O
thread, when it connects to the master it receives the current replication
position as a GTID, and I want to store it in the mysql.rpl_slave_state so
that next reconnect of the slave can use the GTID automatically.

So I basically need to run the equivalent of something like this:

    BEGIN;
    INSERT INTO mysql.rpl_slave_state VALUES (...);
    DELETE FROM mysql.rpl_slave_state WHERE id=...;
    COMMIT;

I think I already have everything except the "BEGIN" part (if you want, you
can check the code in rpl_slave_state::record_gtid() in my branch
lp:~maria-captains/maria/10.0-mdev26/ on Launchpad).

So how do I do the equivalent of BEGIN inside the server code? Can you think
of any existing code I could use as example?

 - Kristian.


Follow ups