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

Method write_transaction_with_group_commit

sql/log.cc:10553–10708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10551}
10552
10553bool
10554MYSQL_BIN_LOG::write_transaction_with_group_commit(group_commit_entry *entry)
10555{
10556 DEBUG_SYNC(entry->thd, "before_group_commit_queue");
10557 int is_leader= queue_for_group_commit(entry);
10558 binlog_cache_mngr *cache_mngr= entry->cache_mngr;
10559
10560#ifdef WITH_WSREP
10561 /* commit order was released in queue_for_group_commit() call,
10562 here we check if wsrep_commit_ordered() failed or if we are leader */
10563 switch (is_leader)
10564 {
10565 case -2: /* wsrep_ordered_commit() has failed */
10566 DBUG_ASSERT(wsrep_is_active(entry->thd));
10567 DBUG_ASSERT(wsrep_run_commit_hook(entry->thd, entry->all));
10568 entry->thd->wakeup_subsequent_commits(1);
10569 return true;
10570 case -3: /* this is leader, wait for prior commit to
10571 complete. This establishes total order for group leaders
10572 */
10573 DBUG_ASSERT(wsrep_is_active(entry->thd));
10574 DBUG_ASSERT(wsrep_run_commit_hook(entry->thd, entry->all));
10575 if (entry->thd->wait_for_prior_commit())
10576 return true;
10577
10578 /* retain the correct is_leader value */
10579 is_leader= 1;
10580 break;
10581
10582 default: /* native MariaDB cases */
10583 break;
10584 }
10585#endif /* WITH_WSREP */
10586
10587 /*
10588 The first in the queue handles group commit for all; the others just wait
10589 to be signalled when group commit is done.
10590 */
10591 if (is_leader < 0)
10592 return true; /* Error */
10593 else if (is_leader)
10594 trx_group_commit_leader(entry);
10595 else if (!entry->queued_by_other)
10596 {
10597 DEBUG_SYNC(entry->thd, "after_semisync_queue");
10598
10599 entry->thd->wait_for_wakeup_ready();
10600 }
10601 else
10602 {
10603 /*
10604 If we were queued by another prior commit, then we are woken up
10605 only when the leader has already completed the commit for us.
10606 So nothing to do here then.
10607 */
10608 }
10609
10610 if (!opt_optimize_thread_scheduling)

Callers 1

commitMethod · 0.80

Calls 11

wsrep_is_activeFunction · 0.85
wsrep_run_commit_hookFunction · 0.85
wait_for_wakeup_readyMethod · 0.80
engine_cache_dataMethod · 0.80
get_last_commit_gtidMethod · 0.80
wakeupMethod · 0.80
signal_wakeup_readyMethod · 0.80
get_binlog_cache_dataMethod · 0.80
wait_for_prior_commitMethod · 0.45

Tested by

no test coverage detected