← Back to team overview

maria-developers team mailing list archive

Re: Help with running a transaction inside the server

 

Hi!

>>>>> "Kristian" == Kristian Nielsen <knielsen@xxxxxxxxxxxxxxx> writes:

Kristian> Sergei Golubchik <serg@xxxxxxxxxxxx> writes:
>> What file is it in? I didn't find it in sql_repl.cc

Kristian> Sorry, it is rpl_slave_state::record_gtid() in sql/log_event.cc:

Kristian>     http://bazaar.launchpad.net/~maria-captains/maria/10.0-mdev26/view/head:/sql/log_event.cc#L6140

>> You could do all that in a single statement, and you won't need a
>> multi-statement transaction.

Kristian> Right. In fact, I think perhaps I am doing it in a single statement already:

Kristian>   mysql_reset_thd_for_next_command(thd, 0);
Kristian>   open_and_lock_tables(thd, &tlist, FALSE, 0);
Kristian>   table->file->ha_write_row(table->record[0]);
Kristian>   table->file->ha_rnd_pos_by_record(table->record[0]));
Kristian>   table->file->ha_delete_row(table->record[0]);
Kristian>   ha_commit_trans(thd, FALSE);
Kristian>   close_thread_tables(thd);
Kristian>   if (!in_transaction)
Kristian>     ha_commit_trans(thd, TRUE);

Why doing an insert + delete instead of one update?

Regards,
Monty


Follow ups

References