summaryrefslogtreecommitdiff
path: root/sql/lock.cc
diff options
context:
space:
mode:
authormkaruza <mario.karuza@galeracluster.com>2019-02-25 17:08:02 +0100
committerJan Lindström <jan.lindstrom@mariadb.com>2019-03-07 07:59:44 +0200
commit32badae31f852e327c0cb9a1aabb936ccf13dd37 (patch)
treebe432b60200cfe108c7baad83e0c4906eb6184c4 /sql/lock.cc
parent7b9981fbdf3c3dba2e67d8877e97b7312c44f540 (diff)
downloadmariadb-git-32badae31f852e327c0cb9a1aabb936ccf13dd37.tar.gz
Fix for galera_3nodes.galera_var_dirty_reads2
Call desync_and_pause() and resync_and_resume() only if state is s_synced.
Diffstat (limited to 'sql/lock.cc')
-rw-r--r--sql/lock.cc25
1 files changed, 13 insertions, 12 deletions
diff --git a/sql/lock.cc b/sql/lock.cc
index c1140eddaae..70e5f18125e 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -1101,13 +1101,14 @@ void Global_read_lock::unlock_global_read_lock(THD *thd)
if (m_state == GRL_ACQUIRED_AND_BLOCKS_COMMIT)
{
Wsrep_server_state& server_state= Wsrep_server_state::instance();
- if (server_state.state() == Wsrep_server_state::s_donor)
+ if (server_state.state() == Wsrep_server_state::s_donor ||
+ (wsrep_on(thd) && server_state.state() != Wsrep_server_state::s_synced))
{
/* TODO: maybe redundant here?: */
wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED;
server_state.resume();
}
- else if (WSREP(thd))
+ else if (wsrep_on(thd) && server_state.state() == Wsrep_server_state::s_synced)
{
server_state.resume_and_resync();
}
@@ -1155,26 +1156,26 @@ 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.
+ /* Native threads should bail out before wsrep operations to follow.
Donor servicing thread is an exception, it should pause provider
- but not desync, as it is already desynced in donor state
+ but not desync, as it is already desynced in donor state.
+ Desync should be called only when we are in synced state.
*/
Wsrep_server_state& server_state= Wsrep_server_state::instance();
- if (!WSREP(thd) && server_state.state() != Wsrep_server_state::s_donor)
- {
- DBUG_RETURN(FALSE);
- }
-
wsrep::seqno paused_seqno;
- if (server_state.state() == Wsrep_server_state::s_donor)
+ if (server_state.state() == Wsrep_server_state::s_donor ||
+ (wsrep_on(thd) && server_state.state() != Wsrep_server_state::s_synced))
{
paused_seqno= server_state.pause();
}
- else
+ else if (wsrep_on(thd) && server_state.state() == Wsrep_server_state::s_synced)
{
paused_seqno= server_state.desync_and_pause();
}
+ else
+ {
+ DBUG_RETURN(FALSE);
+ }
WSREP_INFO("Server paused at: %lld", paused_seqno.get());
if (paused_seqno.get() >= 0)
{