Sergei Golubchik <serg@askmonty.org> writes:
What file is it in? I didn't find it in sql_repl.cc
Sorry, it is rpl_slave_state::record_gtid() in sql/log_event.cc: http://bazaar.launchpad.net/~maria-captains/maria/10.0-mdev26/view/head:/sql...
You could do all that in a single statement, and you won't need a multi-statement transaction.
Right. In fact, I think perhaps I am doing it in a single statement already: mysql_reset_thd_for_next_command(thd, 0); open_and_lock_tables(thd, &tlist, FALSE, 0); table->file->ha_write_row(table->record[0]); table->file->ha_rnd_pos_by_record(table->record[0])); table->file->ha_delete_row(table->record[0]); ha_commit_trans(thd, FALSE); close_thread_tables(thd); if (!in_transaction) ha_commit_trans(thd, TRUE); (The in_transaction flag is true when the code runs as part of a slave replicated transaction. It is false when there is no containing transaction, which is the case I am trying to get to work now). Maybe that is all there is to it? I just thought I would need to somehow specify the start of the "transaction", even if it is just a single statement. Or maybe I need to set autocommit? I am always a little unsure about the logic around the all=TRUE_FALSE flag for commit and autocommit and how that works...
But see above - I don't understand why would you need an explicit multi-statement transaction.
Right, sorry for not explaining my problem very well. I suppose I just need some general advice on how to do DML operations from within the server. What needs to be set up in the THD, what needs to be done at the start of transaction or autocommit statement, and what needs to be done at the end ... Thanks! - Kristian.