Protecting non replicated FLUSH session from brute force aborts
This commit is contained in:
parent
045b31c8f4
commit
c66609017b
@ -861,6 +861,7 @@ extern "C" const char *wsrep_thd_exec_mode_str(THD *thd)
|
|||||||
return
|
return
|
||||||
(!thd) ? "void" :
|
(!thd) ? "void" :
|
||||||
(thd->wsrep_exec_mode == LOCAL_STATE) ? "local" :
|
(thd->wsrep_exec_mode == LOCAL_STATE) ? "local" :
|
||||||
|
(thd->wsrep_exec_mode == LOCAL_FLUSH) ? "flush" :
|
||||||
(thd->wsrep_exec_mode == REPL_RECV) ? "applier" :
|
(thd->wsrep_exec_mode == REPL_RECV) ? "applier" :
|
||||||
(thd->wsrep_exec_mode == TOTAL_ORDER) ? "total order" :
|
(thd->wsrep_exec_mode == TOTAL_ORDER) ? "total order" :
|
||||||
(thd->wsrep_exec_mode == LOCAL_COMMIT) ? "local commit" : "void";
|
(thd->wsrep_exec_mode == LOCAL_COMMIT) ? "local commit" : "void";
|
||||||
|
@ -4165,6 +4165,11 @@ end_with_restore_list:
|
|||||||
}
|
}
|
||||||
|
|
||||||
case SQLCOM_UNLOCK_TABLES:
|
case SQLCOM_UNLOCK_TABLES:
|
||||||
|
#ifdef WITH_WSREP
|
||||||
|
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
|
||||||
|
if (thd->wsrep_exec_mode == LOCAL_FLUSH) thd->wsrep_exec_mode = LOCAL_STATE;
|
||||||
|
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
||||||
|
#endif /* WITH_WSREP */
|
||||||
/*
|
/*
|
||||||
It is critical for mysqldump --single-transaction --master-data that
|
It is critical for mysqldump --single-transaction --master-data that
|
||||||
UNLOCK TABLES does not implicitely commit a connection which has only
|
UNLOCK TABLES does not implicitely commit a connection which has only
|
||||||
@ -4667,6 +4672,12 @@ end_with_restore_list:
|
|||||||
FALSE, UINT_MAX, FALSE))
|
FALSE, UINT_MAX, FALSE))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
#ifdef WITH_WSREP
|
||||||
|
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
|
||||||
|
thd->wsrep_exec_mode = LOCAL_FLUSH;
|
||||||
|
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
||||||
|
#endif /* WITH_WSREP */
|
||||||
|
|
||||||
if (flush_tables_with_read_lock(thd, all_tables))
|
if (flush_tables_with_read_lock(thd, all_tables))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -4687,6 +4698,12 @@ end_with_restore_list:
|
|||||||
{
|
{
|
||||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
|
||||||
|
thd->wsrep_exec_mode = LOCAL_FLUSH;
|
||||||
|
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
||||||
|
}
|
||||||
#endif /* WITH_WSREP*/
|
#endif /* WITH_WSREP*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -40,7 +40,7 @@ void wsrep_cleanup_transaction(THD *thd)
|
|||||||
thd->wsrep_ws_handle.trx_id= WSREP_UNDEFINED_TRX_ID;
|
thd->wsrep_ws_handle.trx_id= WSREP_UNDEFINED_TRX_ID;
|
||||||
thd->wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED;
|
thd->wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED;
|
||||||
thd->wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED;
|
thd->wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED;
|
||||||
thd->wsrep_exec_mode= LOCAL_STATE;
|
if (thd->wsrep_exec_mode != LOCAL_FLUSH) thd->wsrep_exec_mode= LOCAL_STATE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1499,12 +1499,13 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
|
|||||||
mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd);
|
mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
else if (granted_thd->lex->sql_command == SQLCOM_FLUSH)
|
else if (granted_thd->lex->sql_command == SQLCOM_FLUSH ||
|
||||||
|
granted_thd->wsrep_exec_mode == LOCAL_FLUSH)
|
||||||
{
|
{
|
||||||
WSREP_DEBUG("mdl granted over FLUSH BF");
|
WSREP_DEBUG("BF thread waiting for FLUSH");
|
||||||
ticket->wsrep_report(wsrep_debug);
|
ticket->wsrep_report(wsrep_debug);
|
||||||
mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd);
|
mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd);
|
||||||
ret = TRUE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE)
|
else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE)
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,8 @@ class THD;
|
|||||||
enum wsrep_exec_mode {
|
enum wsrep_exec_mode {
|
||||||
/* Transaction processing before replication. */
|
/* Transaction processing before replication. */
|
||||||
LOCAL_STATE,
|
LOCAL_STATE,
|
||||||
|
/* Local flush. */
|
||||||
|
LOCAL_FLUSH,
|
||||||
/* Slave thread applying write sets from other nodes or replaying thread. */
|
/* Slave thread applying write sets from other nodes or replaying thread. */
|
||||||
REPL_RECV,
|
REPL_RECV,
|
||||||
/* Total-order-isolation mode */
|
/* Total-order-isolation mode */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user