diff options
author | sjaakola <seppo.jaakola@iki.fi> | 2016-02-29 15:24:06 +0200 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2016-08-21 16:17:01 -0400 |
commit | 4290117b79bccec71b4a92c99beb3e15668627e7 (patch) | |
tree | cfd0610d9750e5139a98e7d57b7288b3ceba10e8 /sql/lock.cc | |
parent | da9650a36a9e1d9b78a55d6f40a37b984d03bce4 (diff) | |
download | mariadb-git-4290117b79bccec71b4a92c99beb3e15668627e7.tar.gz |
Refs MW-252
- enveloped FTWRL processing with wsrep desync/resync calls. This way FTWRL processing node
will not cause flow control to kick in
- donor servicing thread is unfortunate exception, we must let him to pause provider as part
of FTWRL phase, but not desync/resync as this is done as part of donor control on higher
level
Diffstat (limited to 'sql/lock.cc')
-rw-r--r-- | sql/lock.cc | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/sql/lock.cc b/sql/lock.cc index 07ea0b1f6dc..f724606a46d 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1071,6 +1071,16 @@ void Global_read_lock::unlock_global_read_lock(THD *thd) #ifdef WITH_WSREP wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; wsrep->resume(wsrep); + if (!wsrep_desync && !thd->wsrep_donor) + { + int ret = wsrep->resync(wsrep); + if (ret != WSREP_OK) + { + WSREP_WARN("resync failed %d for FTWRL: db: %s, query: %s", ret, + (thd->db ? thd->db : "(null)"), thd->query()); + DBUG_VOID_RETURN; + } + } #endif /* WITH_WSREP */ } thd->mdl_context.release_lock(m_mdl_global_shared_lock); @@ -1106,7 +1116,7 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd) */ #ifdef WITH_WSREP - if (m_mdl_blocks_commits_lock) + if (WSREP(thd) && m_mdl_blocks_commits_lock) { WSREP_DEBUG("GRL was in block commit mode when entering " "make_global_read_lock_block_commit"); @@ -1131,6 +1141,35 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd) m_state= GRL_ACQUIRED_AND_BLOCKS_COMMIT; #ifdef WITH_WSREP + /* Native threads should bail out before wsrep oprations to follow. + Donor servicing thread is an exception, it should pause provider but not desync, + as it is already desynced in donor state + */ + if (!WSREP(thd) && !thd->wsrep_donor) + { + DBUG_RETURN(FALSE); + } + + /* if already desynced or donor, avoid double desyncing */ + if (wsrep_desync || thd->wsrep_donor) + { + WSREP_DEBUG("desync set upfont, skipping implicit desync for FTWRL: %d", + wsrep_desync); + } + else + { + int rcode; + WSREP_DEBUG("running implicit desync for node"); + rcode = wsrep->desync(wsrep); + if (rcode != WSREP_OK) + { + WSREP_WARN("FTWRL desync failed %d for schema: %s, query: %s", + rcode, (thd->db ? thd->db : "(null)"), thd->query()); + my_message(ER_LOCK_DEADLOCK, "wsrep desync failed for FTWRL", MYF(0)); + DBUG_RETURN(TRUE); + } + } + long long ret = wsrep->pause(wsrep); if (ret >= 0) { |