summaryrefslogtreecommitdiff
path: root/sql/semisync_master.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-05-09 22:04:06 +0200
committerSergei Golubchik <serg@mariadb.org>2022-05-09 22:04:06 +0200
commitef781162ff2eb97f405b19dc150ab674e91dbc05 (patch)
tree63b897dece50ab65652174af4cd0aabd8f3a8505 /sql/semisync_master.h
parente9af6b2a4d8750c32d4953f08f8bc5f2e33cb9e3 (diff)
parent16cebed54065ad9e18953aa86d48f6007d53c2d3 (diff)
downloadmariadb-git-ef781162ff2eb97f405b19dc150ab674e91dbc05.tar.gz
Merge branch '10.4' into 10.5
Diffstat (limited to 'sql/semisync_master.h')
-rw-r--r--sql/semisync_master.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/sql/semisync_master.h b/sql/semisync_master.h
index 9f0acf57a60..04fc0e5ce50 100644
--- a/sql/semisync_master.h
+++ b/sql/semisync_master.h
@@ -472,6 +472,21 @@ class Repl_semi_sync_master
m_wait_timeout = wait_timeout;
}
+ int sync_get_master_wait_sessions();
+
+ /*
+ Calculates a timeout that is m_wait_timeout after start_arg and saves it
+ in out. If start_arg is NULL, the timeout is m_wait_timeout after the
+ current system time.
+ */
+ void create_timeout(struct timespec *out, struct timespec *start_arg);
+
+ /*
+ Blocks the calling thread until the ack_receiver either receives an ACK
+ or times out (from rpl_semi_sync_master_timeout)
+ */
+ void await_slave_reply();
+
/*set the ACK point, after binlog sync or after transaction commit*/
void set_wait_point(unsigned long ack_point)
{
@@ -620,6 +635,30 @@ class Repl_semi_sync_master
void check_and_switch();
+ /*
+ Determines if the given thread is currently awaiting a semisync_ack. Note
+ that the thread's value is protected by this class's LOCK_binlog, so this
+ function (indirectly) provides safe access.
+ */
+ my_bool is_thd_awaiting_semisync_ack(THD *thd)
+ {
+ lock();
+ my_bool ret= thd->is_awaiting_semisync_ack;
+ unlock();
+ return ret;
+ }
+
+ /*
+ Update the thread's value for is_awaiting_semisync_ack. LOCK_binlog (from
+ this class) should be acquired before calling this function.
+ */
+ void set_thd_awaiting_semisync_ack(THD *thd,
+ my_bool _is_awaiting_semisync_ack)
+ {
+ mysql_mutex_assert_owner(&LOCK_binlog);
+ thd->is_awaiting_semisync_ack= _is_awaiting_semisync_ack;
+ }
+
mysql_mutex_t LOCK_rpl_semi_sync_master_enabled;
};