diff options
author | Teemu Ollakka <teemu.ollakka@galeracluster.com> | 2019-03-15 07:09:13 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2019-03-15 07:09:13 +0200 |
commit | 1ef50a34ec53d0e3e43776f414dd99f343d5d6ba (patch) | |
tree | 59e612b17a4956d002ce1045460aafc1706d868f /sql/wsrep_mysqld.cc | |
parent | b234f81037d79b64f46a8de1602a8a7e3a45aada (diff) | |
download | mariadb-git-1ef50a34ec53d0e3e43776f414dd99f343d5d6ba.tar.gz |
10.4 wsrep group commit fixes (#1224)
* MDEV-16509 Improve wsrep commit performance with binlog disabled
Release commit order critical section early after trx_commit_low() if
binlog is not transaction coordinator. In order to avoid two phase commit,
binlog_hton is not registered for THD during IO_CACHE population.
Implemented a test which verifies that the transactions release
commit order early.
This optimization will change behavior during recovery as the commit
is not two phase when binlog is off. Fixed and recorded wsrep-recover-v25
and wsrep-recover to match the behavior.
* MDEV-18730 Ordering for wsrep binlog group commit
Previously out of order execution was allowed for wsrep commits.
Established proper ordering by populating wait_for_commit
for every wsrep THD and making group commit leader to wait for
prior commits before proceeding to trx_group_commit_leader().
* MDEV-18730 Added a test case to verify correct commit ordering
* MDEV-16509, MDEV-18730 Review fixes
Use WSREP_EMULATE_BINLOG() macro to decide if the binlog_hton
should be registered. Whitespace/syntax fixes and cleanups.
* MDEV-16509 Require binlog for galera_var_innodb_disallow_writes test
If the commit to InnoDB is done in one phase, the native InnoDB behavior
is that the transaction is committed in memory before it is persisted to
disk. This means that the innodb_disallow_writes=ON may not prevent
transaction to become visible to other readers before commit is completely
over. On the other hand, if the commit is two phase (as it is with binlog),
the transaction will be blocked in prepare phase.
Fixed the test to use binlog, which enforces two phase commit, which
in turn makes commit to block before the changes become visible to
other connections. This guarantees that the test produces expected
result.
Diffstat (limited to 'sql/wsrep_mysqld.cc')
-rw-r--r-- | sql/wsrep_mysqld.cc | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 71d0ca90f4f..dba793aba55 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -148,6 +148,7 @@ mysql_cond_t COND_wsrep_slave_threads; mysql_mutex_t LOCK_wsrep_cluster_config; mysql_mutex_t LOCK_wsrep_desync; mysql_mutex_t LOCK_wsrep_config_state; +mysql_mutex_t LOCK_wsrep_group_commit; mysql_mutex_t LOCK_wsrep_SR_pool; mysql_mutex_t LOCK_wsrep_SR_store; @@ -161,6 +162,7 @@ PSI_mutex_key key_LOCK_wsrep_sst_thread, key_LOCK_wsrep_sst_init, key_LOCK_wsrep_slave_threads, key_LOCK_wsrep_desync, key_LOCK_wsrep_config_state, key_LOCK_wsrep_cluster_config, + key_LOCK_wsrep_group_commit, key_LOCK_wsrep_SR_pool, key_LOCK_wsrep_SR_store, key_LOCK_wsrep_thd_queue; @@ -185,6 +187,7 @@ static PSI_mutex_info wsrep_mutexes[]= { &key_LOCK_wsrep_cluster_config, "LOCK_wsrep_cluster_config", PSI_FLAG_GLOBAL}, { &key_LOCK_wsrep_desync, "LOCK_wsrep_desync", PSI_FLAG_GLOBAL}, { &key_LOCK_wsrep_config_state, "LOCK_wsrep_config_state", PSI_FLAG_GLOBAL}, + { &key_LOCK_wsrep_group_commit, "LOCK_wsrep_group_commit", PSI_FLAG_GLOBAL}, { &key_LOCK_wsrep_SR_pool, "LOCK_wsrep_SR_pool", PSI_FLAG_GLOBAL}, { &key_LOCK_wsrep_SR_store, "LOCK_wsrep_SR_store", PSI_FLAG_GLOBAL} }; @@ -766,6 +769,7 @@ void wsrep_thr_init() mysql_mutex_init(key_LOCK_wsrep_cluster_config, &LOCK_wsrep_cluster_config, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_LOCK_wsrep_desync, &LOCK_wsrep_desync, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_LOCK_wsrep_config_state, &LOCK_wsrep_config_state, MY_MUTEX_INIT_FAST); + mysql_mutex_init(key_LOCK_wsrep_group_commit, &LOCK_wsrep_group_commit, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_LOCK_wsrep_SR_pool, &LOCK_wsrep_SR_pool, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_LOCK_wsrep_SR_store, @@ -870,6 +874,7 @@ void wsrep_thr_deinit() mysql_mutex_destroy(&LOCK_wsrep_cluster_config); mysql_mutex_destroy(&LOCK_wsrep_desync); mysql_mutex_destroy(&LOCK_wsrep_config_state); + mysql_mutex_destroy(&LOCK_wsrep_group_commit); mysql_mutex_destroy(&LOCK_wsrep_SR_pool); mysql_mutex_destroy(&LOCK_wsrep_SR_store); @@ -2456,20 +2461,6 @@ bool wsrep_provider_is_SR_capable() return Wsrep_server_state::has_capability(wsrep::provider::capability::streaming); } - -int wsrep_ordered_commit_if_no_binlog(THD* thd, bool all) -{ - if (((wsrep_thd_is_local(thd) && - (WSREP_EMULATE_BINLOG(thd) || !thd->variables.sql_log_bin)) || - (wsrep_thd_is_applying(thd) && !opt_log_slave_updates)) - && wsrep_thd_trx_seqno(thd) > 0) - { - wsrep_apply_error unused; - return wsrep_ordered_commit(thd, all, unused); - } - return 0; -} - int wsrep_thd_retry_counter(const THD *thd) { return thd->wsrep_retry_counter; |