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

Function wsrep_commit_empty

sql/wsrep_mysqld.cc:4303–4366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4301*/
4302
4303void wsrep_commit_empty(THD* thd, bool all)
4304{
4305 DBUG_ENTER("wsrep_commit_empty");
4306
4307 if (wsrep_is_real(thd, all) &&
4308 wsrep_thd_is_local(thd) &&
4309 thd->wsrep_trx().active() &&
4310 !thd->internal_transaction() &&
4311 thd->wsrep_trx().state() != wsrep::transaction::s_committed)
4312 {
4313#ifndef DBUG_OFF
4314 const bool empty= !wsrep_has_changes(thd);
4315 const bool create= thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
4316 !thd->is_current_stmt_binlog_format_row();
4317 const bool aborted= thd->wsrep_cs().transaction().state() == wsrep::transaction::s_aborted;
4318 const bool ddl_replay= ((sql_command_flags[thd->lex->sql_command] &
4319 (CF_SCHEMA_CHANGE | CF_ADMIN_COMMAND)) &&
4320 thd->wsrep_cs().transaction().state() == wsrep::transaction::s_must_replay);
4321 /* Here transaction is either
4322 (1) empty (i.e. no changes) or
4323 (2) it was CREATE TABLE with no row binlog format or
4324 (3) we have already aborted transaction e.g. because max writeset size
4325 has been reached or
4326 (4) it was DDL and got BF aborted and must replay.
4327 */
4328 if(!(empty || create || aborted || ddl_replay))
4329 {
4330 WSREP_DEBUG("wsrep_commit_empty: thread: %llu client_state: %s client_mode:"
4331 " %s trans_state: %s error: %s empty: %d create: %d aborted:"
4332 " %d ddl_replay: %d sql: %s",
4333 thd_get_thread_id(thd),
4334 wsrep::to_c_string(thd->wsrep_cs().state()),
4335 wsrep::to_c_string(thd->wsrep_cs().mode()),
4336 wsrep::to_c_string(thd->wsrep_cs().transaction().state()),
4337 wsrep::to_c_string(thd->wsrep_cs().current_error()),
4338 empty, create, aborted, ddl_replay,
4339 wsrep_thd_query(thd));
4340
4341 DBUG_ASSERT(empty || // 1
4342 create || // 2
4343 aborted || // 3
4344 ddl_replay); // 4
4345 }
4346#endif /* DBUG_OFF */
4347 bool have_error= wsrep_current_error(thd);
4348 int ret= wsrep_before_rollback(thd, all) ||
4349 wsrep_after_rollback(thd, all) ||
4350 wsrep_after_statement(thd);
4351 /* The committing transaction was empty but it held some locks and
4352 got BF aborted. As there were no certified changes in the
4353 data, we ignore the deadlock error and rely on error reporting
4354 by storage engine/server. */
4355 if (!ret && !have_error && wsrep_current_error(thd))
4356 {
4357 DBUG_ASSERT(wsrep_current_error(thd) == wsrep::e_deadlock_error);
4358 thd->wsrep_cs().reset_error();
4359 }
4360

Callers 3

ha_commit_transFunction · 0.85
wsrep_on_checkFunction · 0.85
sql_parse.ccFile · 0.85

Calls 14

wsrep_is_realFunction · 0.85
wsrep_has_changesFunction · 0.85
thd_get_thread_idFunction · 0.85
wsrep_before_rollbackFunction · 0.85
wsrep_after_rollbackFunction · 0.85
wsrep_after_statementFunction · 0.85
internal_transactionMethod · 0.80
stateMethod · 0.80
wsrep_thd_is_localFunction · 0.70
wsrep_thd_queryFunction · 0.70
wsrep_current_errorFunction · 0.70

Tested by

no test coverage detected