MCPcopy Create free account
hub / github.com/MariaDB/server / trans_commit

Function trans_commit

sql/transaction.cc:256–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254*/
255
256bool trans_commit(THD *thd)
257{
258 int res;
259 PSI_stage_info org_stage;
260 DBUG_ENTER("trans_commit");
261
262 if (trans_check(thd))
263 DBUG_RETURN(TRUE);
264
265 thd->backup_stage(&org_stage);
266 THD_STAGE_INFO(thd, stage_commit);
267
268 thd->server_status&=
269 ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
270 DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
271 res= ha_commit_trans(thd, TRUE);
272
273 mysql_mutex_assert_not_owner(&LOCK_prepare_ordered);
274 mysql_mutex_assert_not_owner(mysql_bin_log.get_log_lock());
275 mysql_mutex_assert_not_owner(&LOCK_after_binlog_sync);
276 mysql_mutex_assert_not_owner(&LOCK_commit_ordered);
277
278 /*
279 if res is non-zero, then ha_commit_trans has rolled back the
280 transaction, so the hooks for rollback will be called.
281 */
282#ifdef HAVE_REPLICATION
283 if (res)
284 repl_semisync_master.wait_after_rollback(thd, FALSE);
285 else
286 repl_semisync_master.wait_after_commit(thd, FALSE);
287#endif
288 thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_BINLOG_THIS_TRX);
289 thd->transaction->all.reset();
290 thd->lex->start_transaction_opt= 0;
291
292 /* The transaction should be marked as complete in P_S. */
293 DBUG_ASSERT(thd->m_transaction_psi == NULL);
294 trans_track_end_trx(thd);
295
296 THD_STAGE_INFO(thd, org_stage);
297 DBUG_RETURN(MY_TEST(res));
298}
299
300
301/**

Callers 15

commitMethod · 0.85
apply_toiMethod · 0.85
truncate_state_tableMethod · 0.85
store_viewMethod · 0.85
restore_viewMethod · 0.85
recover_sr_transactionsFunction · 0.85
store_gtid_eventMethod · 0.85
allowlist_check_threadFunction · 0.85
commitMethod · 0.85
sql_parse.ccFile · 0.85

Calls 8

trans_checkFunction · 0.85
ha_commit_transFunction · 0.85
trans_track_end_trxFunction · 0.85
backup_stageMethod · 0.80
get_log_lockMethod · 0.80
wait_after_rollbackMethod · 0.80
wait_after_commitMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected