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

Method commit_trx

sql/semisync_master.cc:869–1123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

867}
868
869int Repl_semi_sync_master::commit_trx(const char *trx_wait_binlog_name,
870 my_off_t trx_wait_binlog_pos)
871{
872 bool success= 0;
873 DBUG_ENTER("Repl_semi_sync_master::commit_trx");
874
875 if (!rpl_semi_sync_master_clients && !rpl_semi_sync_master_wait_no_slave)
876 {
877 lock();
878 m_active_tranxs->unlink_thd_as_waiter(trx_wait_binlog_name,
879 trx_wait_binlog_pos);
880 unlock();
881 rpl_semi_sync_master_no_transactions++;
882 DBUG_RETURN(0);
883 }
884
885 if (get_master_enabled() && trx_wait_binlog_name)
886 {
887 struct timespec start_ts;
888 struct timespec abstime;
889 int wait_result;
890 PSI_stage_info old_stage;
891 THD *thd= current_thd;
892 bool aborted __attribute__((unused)) = 0;
893 set_timespec(start_ts, 0);
894
895 DEBUG_SYNC(thd, "rpl_semisync_master_commit_trx_before_lock");
896 /* Acquire the mutex. */
897 lock();
898
899 /* This must be called after acquired the lock */
900 THD_ENTER_COND(thd, &thd->COND_wakeup_ready, &LOCK_binlog,
901 &stage_waiting_for_semi_sync_ack_from_slave, &old_stage);
902
903 /* This is the real check inside the mutex. */
904 if (!get_master_enabled() || !is_on())
905 goto l_end;
906
907 DBUG_PRINT("semisync", ("%s: wait pos (%s, %lu), repl(%d)",
908 "Repl_semi_sync_master::commit_trx",
909 trx_wait_binlog_name, (ulong)trx_wait_binlog_pos,
910 (int)is_on()));
911
912 while (is_on() && !(aborted= thd_killed(thd)))
913 {
914 /* We have to check these again as things may have changed */
915 if (!rpl_semi_sync_master_clients && !rpl_semi_sync_master_wait_no_slave)
916 {
917 aborted= 1;
918 break;
919 }
920
921 if (m_reply_file_name_inited)
922 {
923 int cmp = Active_tranx::compare(m_reply_file_name, m_reply_file_pos,
924 trx_wait_binlog_name,
925 trx_wait_binlog_pos);
926 if (cmp >= 0)

Callers

nothing calls this directly

Calls 11

lockClass · 0.85
thd_killedFunction · 0.85
compareFunction · 0.85
get_wait_timeFunction · 0.85
unlink_thd_as_waiterMethod · 0.80
is_thd_waiterMethod · 0.80
is_killedMethod · 0.80
is_tranx_end_posMethod · 0.80
sql_print_informationFunction · 0.70
sql_print_warningFunction · 0.70
is_emptyMethod · 0.45

Tested by

no test coverage detected