| 10551 | } |
| 10552 | |
| 10553 | bool |
| 10554 | MYSQL_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) |
no test coverage detected