mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Galera4
This commit is contained in:
committed by
Sergey Vojtovich
parent
382115b992
commit
36a2a185fe
76
sql/lock.cc
76
sql/lock.cc
@ -1100,20 +1100,16 @@ void Global_read_lock::unlock_global_read_lock(THD *thd)
|
||||
#ifdef WITH_WSREP
|
||||
if (m_state == GRL_ACQUIRED_AND_BLOCKS_COMMIT)
|
||||
{
|
||||
if (WSREP(thd) || wsrep_node_is_donor())
|
||||
Wsrep_server_state& server_state= Wsrep_server_state::instance();
|
||||
if (server_state.state() == Wsrep_server_state::s_donor)
|
||||
{
|
||||
/* TODO: maybe redundant here?: */
|
||||
wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED;
|
||||
wsrep->resume(wsrep);
|
||||
/* 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)
|
||||
{
|
||||
WSREP_WARN("resync failed %d for FTWRL: db: %s, query: %s",
|
||||
ret, thd->get_db(), thd->query());
|
||||
}
|
||||
}
|
||||
server_state.resume();
|
||||
}
|
||||
else if (WSREP(thd))
|
||||
{
|
||||
server_state.resume_and_resync();
|
||||
}
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
@ -1159,62 +1155,30 @@ 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
|
||||
Donor servicing thread is an exception, it should pause provider
|
||||
but not desync, as it is already desynced in donor state
|
||||
*/
|
||||
if (!WSREP(thd) && !wsrep_node_is_donor())
|
||||
Wsrep_server_state& server_state= Wsrep_server_state::instance();
|
||||
if (!WSREP(thd) && server_state.state() != Wsrep_server_state::s_donor)
|
||||
{
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
/* 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::seqno paused_seqno;
|
||||
if (server_state.state() == Wsrep_server_state::s_donor)
|
||||
{
|
||||
WSREP_DEBUG("desync set upfont, skipping implicit desync for FTWRL: %d",
|
||||
wsrep_desync);
|
||||
paused_seqno= server_state.pause();
|
||||
}
|
||||
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->get_db(), thd->query());
|
||||
my_message(ER_LOCK_DEADLOCK, "wsrep desync failed for FTWRL", MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
paused_seqno= server_state.desync_and_pause();
|
||||
}
|
||||
|
||||
long long ret = wsrep->pause(wsrep);
|
||||
if (ret >= 0)
|
||||
WSREP_INFO("Server paused at: %lld", paused_seqno.get());
|
||||
if (paused_seqno.get() >= 0)
|
||||
{
|
||||
wsrep_locked_seqno= ret;
|
||||
}
|
||||
else if (ret != -ENOSYS) /* -ENOSYS - no provider */
|
||||
{
|
||||
long long ret = wsrep->pause(wsrep);
|
||||
if (ret >= 0)
|
||||
{
|
||||
wsrep_locked_seqno= ret;
|
||||
}
|
||||
else if (ret != -ENOSYS) /* -ENOSYS - no provider */
|
||||
{
|
||||
WSREP_ERROR("Failed to pause provider: %lld (%s)", -ret, strerror(-ret));
|
||||
|
||||
/*
|
||||
For some reason Galera wants to crash here in debug build.
|
||||
It is equivalent of original assertion.
|
||||
*/
|
||||
DBUG_ASSERT(0);
|
||||
wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED;
|
||||
my_error(ER_LOCK_DEADLOCK, MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
wsrep_locked_seqno= paused_seqno.get();
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
DBUG_RETURN(FALSE);
|
||||
|
Reference in New Issue
Block a user