From d246630d739717a58d9b1c33705ce7f1d8504b43 Mon Sep 17 00:00:00 2001 From: sjaakola Date: Mon, 7 Mar 2016 23:34:03 +0200 Subject: [PATCH] Refs MW-252 - changed the condition when to do implicit desync as part of FTWRL to cover only case when node is PC and synced. Donor node has alreaydy desycned and other states mean that node is not in cluster, so desync is not even possible. --- sql/lock.cc | 9 ++++++--- sql/wsrep_mysqld.cc | 4 ++++ sql/wsrep_mysqld.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sql/lock.cc b/sql/lock.cc index fea28753739..7153b85d740 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1073,7 +1073,8 @@ void Global_read_lock::unlock_global_read_lock(THD *thd) { wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; wsrep->resume(wsrep); - if (!wsrep_desync && !wsrep_node_is_donor()) + /* resync here only if we did implicit desync earlier */ + if (!wsrep_desync && wsrep_node_is_synced()) { int ret = wsrep->resync(wsrep); if (ret != WSREP_OK) @@ -1149,8 +1150,10 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd) DBUG_RETURN(FALSE); } - /* if already desynced or donor, avoid double desyncing */ - if (wsrep_desync || wsrep_node_is_donor()) + /* if already desynced or donor, avoid double desyncing + if not in PC and synced, desyncing is not possible either + */ + if (wsrep_desync || !wsrep_node_is_synced()) { WSREP_DEBUG("desync set upfont, skipping implicit desync for FTWRL: %d", wsrep_desync); diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 734406080e9..e392aef32eb 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1592,3 +1592,7 @@ bool wsrep_node_is_donor() { return (WSREP_ON) ? (local_status.get() == 2) : false; } +bool wsrep_node_is_synced() +{ + return (WSREP_ON) ? (local_status.get() == 4) : false; +} diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 514c1f32cff..f499443ca2c 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -331,4 +331,5 @@ void wsrep_init_sidno(const wsrep_uuid_t&); #endif /* GTID_SUPPORT */ bool wsrep_node_is_donor(); +bool wsrep_node_is_synced(); #endif /* WSREP_MYSQLD_H */