mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge revisions 3907--3914 from lp:~codership/codership-mysql/5.5-23
------------------------------------------------------------ revno: 3914 3kB/s | committer: Vladislav Klyachin <vladislav.klyachin@codership.com> branch nick: 5.5-23 timestamp: Thu 2013-09-12 15:00:46 +0400 message: References lp:1217653 - fix index-id evaluation of FOREIGN KEY, when referenced table without PRIMARY KEY ------------------------------------------------------------ revno: 3913 committer: Vladislav Klyachin <vladislav.klyachin@codership.com> branch nick: 5.5-23 timestamp: Wed 2013-09-11 13:58:02 +0400 message: References lp:1217653 - fix index-id evaluation of FOREIGN KEY, when referenced table without PRIMARY KEY ------------------------------------------------------------ revno: 3912 committer: Seppo Jaakola <seppo.jaakola@codership.com> branch nick: wsrep-5.5-23 timestamp: Fri 2013-09-06 13:13:48 +0300 message: References: lp:1212955 - releasing MDL after failed BEGIN and "SET AUTOCOMMIT" ------------------------------------------------------------ revno: 3911 committer: Seppo Jaakola <seppo.jaakola@codership.com> branch nick: wsrep-5.5-23 timestamp: Wed 2013-09-04 10:52:31 +0300 message: References: lp:1123233 - avoiding to set wsrep_seqno_changed for replaying transactions Note, also missing transactions don't declare seqno_changed anymore. Earlier they would have caused crash at wsrep_cleanup_transaction phase. ------------------------------------------------------------ revno: 3910 [merge] committer: Vladislav Klyachin <vladislav.klyachin@codership.com> branch nick: 5.5-23 timestamp: Tue 2013-09-03 15:27:02 +0400 message: References lp:1049599 - expose desync functionality to the client ------------------------------------------------------------ revno: 3909 committer: Seppo Jaakola <seppo.jaakola@codership.com> branch nick: wsrep-5.5-23 timestamp: Tue 2013-09-03 09:41:08 +0300 message: References: lp:1123233 - rollback for transaction which has not appended key information ------------------------------------------------------------ revno: 3908 committer: Vladislav Klyachin <vladislav.klyachin@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-09-01 13:29:12 +0400 message: lp:1201893 - fix command for default IP address ------------------------------------------------------------ revno: 3907 committer: Seppo Jaakola <seppo.jaakola@codership.com> branch nick: wsrep-5.5-23 timestamp: Thu 2013-08-29 12:16:42 +0300 message: References: lp:1212955 - releasing transactional MDL locks after commit failures (e.g. certification failure).
This commit is contained in:
@@ -713,6 +713,7 @@ wsrep_aborting_thd_t wsrep_aborting_thd= NULL;
|
||||
mysql_mutex_t LOCK_wsrep_replaying;
|
||||
mysql_cond_t COND_wsrep_replaying;
|
||||
mysql_mutex_t LOCK_wsrep_slave_threads;
|
||||
mysql_mutex_t LOCK_wsrep_desync;
|
||||
int wsrep_replaying= 0;
|
||||
static void wsrep_close_threads(THD* thd);
|
||||
#endif
|
||||
@@ -788,7 +789,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
|
||||
PSI_mutex_key key_LOCK_wsrep_rollback, key_LOCK_wsrep_thd,
|
||||
key_LOCK_wsrep_replaying, key_LOCK_wsrep_ready, key_LOCK_wsrep_sst,
|
||||
key_LOCK_wsrep_sst_thread, key_LOCK_wsrep_sst_init,
|
||||
key_LOCK_wsrep_slave_threads;
|
||||
key_LOCK_wsrep_slave_threads, key_LOCK_wsrep_desync;
|
||||
#endif
|
||||
PSI_mutex_key key_RELAYLOG_LOCK_index;
|
||||
|
||||
@@ -867,6 +868,7 @@ static PSI_mutex_info all_server_mutexes[]=
|
||||
{ &key_LOCK_wsrep_thd, "THD::LOCK_wsrep_thd", 0},
|
||||
{ &key_LOCK_wsrep_replaying, "LOCK_wsrep_replaying", PSI_FLAG_GLOBAL},
|
||||
{ &key_LOCK_wsrep_slave_threads, "LOCK_wsrep_slave_threads", PSI_FLAG_GLOBAL},
|
||||
{ &key_LOCK_wsrep_desync, "LOCK_wsrep_desync", PSI_FLAG_GLOBAL},
|
||||
#endif
|
||||
{ &key_PARTITION_LOCK_auto_inc, "HA_DATA_PARTITION::LOCK_auto_inc", 0}
|
||||
};
|
||||
@@ -2072,6 +2074,7 @@ static void clean_up_mutexes()
|
||||
(void) mysql_mutex_destroy(&LOCK_wsrep_replaying);
|
||||
(void) mysql_cond_destroy(&COND_wsrep_replaying);
|
||||
(void) mysql_mutex_destroy(&LOCK_wsrep_slave_threads);
|
||||
(void) mysql_mutex_destroy(&LOCK_wsrep_desync);
|
||||
#endif
|
||||
mysql_mutex_destroy(&LOCK_server_started);
|
||||
mysql_cond_destroy(&COND_server_started);
|
||||
@@ -4148,6 +4151,8 @@ static int init_thread_environment()
|
||||
mysql_cond_init(key_COND_wsrep_replaying, &COND_wsrep_replaying, NULL);
|
||||
mysql_mutex_init(key_LOCK_wsrep_slave_threads,
|
||||
&LOCK_wsrep_slave_threads, MY_MUTEX_INIT_FAST);
|
||||
mysql_mutex_init(key_LOCK_wsrep_desync,
|
||||
&LOCK_wsrep_desync, MY_MUTEX_INIT_FAST);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -9190,4 +9195,3 @@ template class I_List<i_string_pair>;
|
||||
template class I_List<Statement>;
|
||||
template class I_List_iterator<Statement>;
|
||||
#endif
|
||||
|
||||
|
@@ -2412,7 +2412,11 @@ mysql_execute_command(THD *thd)
|
||||
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
|
||||
/* Commit the normal transaction if one is active. */
|
||||
if (trans_commit_implicit(thd))
|
||||
{
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
WSREP_DEBUG("implicit commit failed, MDL released: %lu", thd->thread_id);
|
||||
goto error;
|
||||
}
|
||||
/* Release metadata locks acquired in this transaction. */
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
}
|
||||
@@ -4134,7 +4138,11 @@ end_with_restore_list:
|
||||
|
||||
case SQLCOM_BEGIN:
|
||||
if (trans_begin(thd, lex->start_transaction_opt))
|
||||
{
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
WSREP_DEBUG("BEGIN failed, MDL released: %lu", thd->thread_id);
|
||||
goto error;
|
||||
}
|
||||
my_ok(thd);
|
||||
break;
|
||||
case SQLCOM_COMMIT:
|
||||
@@ -4148,7 +4156,11 @@ end_with_restore_list:
|
||||
(thd->variables.completion_type == 2 &&
|
||||
lex->tx_release != TVL_NO));
|
||||
if (trans_commit(thd))
|
||||
{
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
WSREP_DEBUG("COMMIT failed, MDL released: %lu", thd->thread_id);
|
||||
goto error;
|
||||
}
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
/* Begin transaction with the same isolation level. */
|
||||
if (tx_chain)
|
||||
@@ -4181,7 +4193,11 @@ end_with_restore_list:
|
||||
(thd->variables.completion_type == 2 &&
|
||||
lex->tx_release != TVL_NO));
|
||||
if (trans_rollback(thd))
|
||||
{
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
WSREP_DEBUG("rollback failed, MDL released: %lu", thd->thread_id);
|
||||
goto error;
|
||||
}
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
/* Begin transaction with the same isolation level. */
|
||||
if (tx_chain)
|
||||
@@ -4725,7 +4741,11 @@ create_sp_error:
|
||||
break;
|
||||
case SQLCOM_XA_COMMIT:
|
||||
if (trans_xa_commit(thd))
|
||||
{
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
WSREP_DEBUG("XA commit failed, MDL released: %lu", thd->thread_id);
|
||||
goto error;
|
||||
}
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
/*
|
||||
We've just done a commit, reset transaction
|
||||
@@ -4736,7 +4756,11 @@ create_sp_error:
|
||||
break;
|
||||
case SQLCOM_XA_ROLLBACK:
|
||||
if (trans_xa_rollback(thd))
|
||||
{
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
WSREP_DEBUG("XA rollback failed, MDL released: %lu", thd->thread_id);
|
||||
goto error;
|
||||
}
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
/*
|
||||
We've just done a rollback, reset transaction
|
||||
|
@@ -2534,6 +2534,8 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type)
|
||||
if (trans_commit_stmt(thd) || trans_commit(thd))
|
||||
{
|
||||
thd->variables.option_bits&= ~OPTION_AUTOCOMMIT;
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
WSREP_DEBUG("autocommit, MDL TRX lock released: %lu", thd->thread_id);
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
@@ -3808,6 +3810,15 @@ static Sys_var_enum Sys_wsrep_OSU_method(
|
||||
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
|
||||
ON_UPDATE(0));
|
||||
|
||||
static PolyLock_mutex PLock_wsrep_desync(&LOCK_wsrep_desync);
|
||||
static Sys_var_mybool Sys_wsrep_desync (
|
||||
"wsrep_desync", "To desynchronize the node from the cluster",
|
||||
GLOBAL_VAR(wsrep_desync),
|
||||
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
|
||||
&PLock_wsrep_desync, NOT_IN_BINLOG,
|
||||
ON_CHECK(wsrep_desync_check),
|
||||
ON_UPDATE(wsrep_desync_update));
|
||||
|
||||
static Sys_var_enum Sys_wsrep_forced_binlog_format(
|
||||
"wsrep_forced_binlog_format", "binlog format to take effect over user's choice",
|
||||
GLOBAL_VAR(wsrep_forced_binlog_format),
|
||||
|
@@ -331,7 +331,15 @@ wsrep_run_wsrep_commit(
|
||||
}
|
||||
if (WSREP_UNDEFINED_TRX_ID == thd->wsrep_trx_handle.trx_id)
|
||||
{
|
||||
WSREP_WARN("SQL statement was ineffective: %s\n => Skipping replication", thd->query());
|
||||
WSREP_WARN("SQL statement was ineffective, THD: %lu, buf: %d\n"
|
||||
"QUERY: %s\n"
|
||||
" => Skipping replication",
|
||||
thd->thread_id, data_len, thd->query());
|
||||
if (wsrep_debug)
|
||||
{
|
||||
wsrep_write_rbr_buf(thd, rbr_data, data_len);
|
||||
}
|
||||
rcode = WSREP_TRX_FAIL;
|
||||
}
|
||||
else if (!rcode)
|
||||
{
|
||||
@@ -343,13 +351,14 @@ wsrep_run_wsrep_commit(
|
||||
data_len,
|
||||
(thd->wsrep_PA_safe) ? WSREP_FLAG_PA_SAFE : 0ULL,
|
||||
&thd->wsrep_trx_seqno);
|
||||
if (rcode == WSREP_TRX_MISSING) {
|
||||
switch (rcode) {
|
||||
case WSREP_TRX_MISSING:
|
||||
WSREP_WARN("Transaction missing in provider, thd: %ld, SQL: %s",
|
||||
thd->thread_id, thd->query());
|
||||
wsrep_write_rbr_buf(thd, rbr_data, data_len);
|
||||
|
||||
rcode = WSREP_OK;
|
||||
} else if (rcode == WSREP_BF_ABORT) {
|
||||
break;
|
||||
case WSREP_BF_ABORT:
|
||||
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
|
||||
thd->wsrep_conflict_state = MUST_REPLAY;
|
||||
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
||||
@@ -358,8 +367,11 @@ wsrep_run_wsrep_commit(
|
||||
WSREP_DEBUG("replaying increased: %d, thd: %lu",
|
||||
wsrep_replaying, thd->thread_id);
|
||||
mysql_mutex_unlock(&LOCK_wsrep_replaying);
|
||||
break;
|
||||
default:
|
||||
thd->wsrep_seqno_changed = true;
|
||||
break;
|
||||
}
|
||||
thd->wsrep_seqno_changed = true;
|
||||
} else {
|
||||
WSREP_ERROR("I/O error reading from thd's binlog iocache: "
|
||||
"errno=%d, io cache code=%d", my_errno, cache->error);
|
||||
|
@@ -50,6 +50,7 @@ my_bool wsrep_replicate_myisam = 0; // enable myisam replication
|
||||
my_bool wsrep_log_conflicts = 0; //
|
||||
ulong wsrep_mysql_replication_bundle = 0;
|
||||
my_bool wsrep_load_data_splitting = 1; // commit load data every 10K intervals
|
||||
my_bool wsrep_desync = 0; // desynchronize the node from the cluster
|
||||
|
||||
/*
|
||||
* End configuration options
|
||||
|
@@ -93,6 +93,7 @@ extern long wsrep_max_protocol_version;
|
||||
extern long wsrep_protocol_version;
|
||||
extern ulong wsrep_forced_binlog_format;
|
||||
extern ulong wsrep_OSU_method_options;
|
||||
extern my_bool wsrep_desync;
|
||||
extern my_bool wsrep_recovery;
|
||||
extern my_bool wsrep_replicate_myisam;
|
||||
extern my_bool wsrep_log_conflicts;
|
||||
@@ -173,6 +174,9 @@ extern bool wsrep_sst_donor_update UPDATE_ARGS;
|
||||
extern bool wsrep_slave_threads_check CHECK_ARGS;
|
||||
extern bool wsrep_slave_threads_update UPDATE_ARGS;
|
||||
|
||||
extern bool wsrep_desync_check CHECK_ARGS;
|
||||
extern bool wsrep_desync_update UPDATE_ARGS;
|
||||
|
||||
extern bool wsrep_before_SE(); // initialize wsrep before storage
|
||||
// engines (true) or after (false)
|
||||
extern int wsrep_init();
|
||||
@@ -349,6 +353,7 @@ extern long wsrep_max_ws_rows;
|
||||
extern int wsrep_to_isolation;
|
||||
extern my_bool wsrep_certify_nonPK;
|
||||
extern mysql_mutex_t LOCK_wsrep_slave_threads;
|
||||
extern mysql_mutex_t LOCK_wsrep_desync;
|
||||
|
||||
extern PSI_mutex_key key_LOCK_wsrep_ready;
|
||||
extern PSI_mutex_key key_COND_wsrep_ready;
|
||||
@@ -363,6 +368,7 @@ extern PSI_cond_key key_COND_wsrep_rollback;
|
||||
extern PSI_mutex_key key_LOCK_wsrep_replaying;
|
||||
extern PSI_cond_key key_COND_wsrep_replaying;
|
||||
extern PSI_mutex_key key_LOCK_wsrep_slave_threads;
|
||||
extern PSI_mutex_key key_LOCK_wsrep_desync;
|
||||
|
||||
struct TABLE_LIST;
|
||||
int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
|
||||
|
@@ -359,7 +359,7 @@ size_t guess_ip (char* buf, size_t buf_len)
|
||||
const char cmd[] = "/sbin/ifconfig -a | "
|
||||
"/usr/gnu/bin/grep -m1 -1 -E 'net[0-9]:' | tail -n 1 | awk '{ print $2 }'";
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__)
|
||||
const char cmd[] = "route -nv get 8.8.8.8 | tail -n1 | awk '{print $5}'";
|
||||
const char cmd[] = "/sbin/route -nv get 8.8.8.8 | tail -n1 | awk '{print $(NF)}'";
|
||||
#else
|
||||
char *cmd;
|
||||
#error "OS not supported"
|
||||
|
@@ -470,6 +470,45 @@ bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var)
|
||||
{
|
||||
bool new_wsrep_desync = var->value->val_bool();
|
||||
if (wsrep_desync == new_wsrep_desync) {
|
||||
if (new_wsrep_desync) {
|
||||
push_warning (thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WRONG_VALUE_FOR_VAR,
|
||||
"'wsrep_desync' is already ON.");
|
||||
} else {
|
||||
push_warning (thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WRONG_VALUE_FOR_VAR,
|
||||
"'wsrep_desync' is already OFF.");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wsrep_desync_update (sys_var *self, THD* thd, enum_var_type type)
|
||||
{
|
||||
wsrep_status_t ret(WSREP_WARNING);
|
||||
if (wsrep_desync) {
|
||||
ret = wsrep->desync (wsrep);
|
||||
if (ret != WSREP_OK) {
|
||||
WSREP_WARN ("SET desync failed %d for %s", ret, thd->query());
|
||||
my_error (ER_CANNOT_USER, MYF(0), "'desync'", thd->query());
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
ret = wsrep->resync (wsrep);
|
||||
if (ret != WSREP_OK) {
|
||||
WSREP_WARN ("SET resync failed %d for %s", ret, thd->query());
|
||||
my_error (ER_CANNOT_USER, MYF(0), "'resync'", thd->query());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Status variables stuff below
|
||||
*/
|
||||
|
@@ -7234,8 +7234,10 @@ wsrep_append_foreign_key(
|
||||
UT_LIST_GET_FIRST(foreign->foreign_table->indexes);
|
||||
int i = 0;
|
||||
while (idx != NULL && idx != idx_target) {
|
||||
if (innobase_strcasecmp (idx->name, innobase_index_reserve_name) != 0) {
|
||||
i++;
|
||||
}
|
||||
idx = UT_LIST_GET_NEXT(indexes, idx);
|
||||
i++;
|
||||
}
|
||||
ut_a(idx);
|
||||
key[0] = (char)i;
|
||||
|
@@ -8268,8 +8268,10 @@ wsrep_append_foreign_key(
|
||||
UT_LIST_GET_FIRST(foreign->foreign_table->indexes);
|
||||
int i = 0;
|
||||
while (idx != NULL && idx != idx_target) {
|
||||
if (innobase_strcasecmp (idx->name, innobase_index_reserve_name) != 0) {
|
||||
i++;
|
||||
}
|
||||
idx = UT_LIST_GET_NEXT(indexes, idx);
|
||||
i++;
|
||||
}
|
||||
ut_a(idx);
|
||||
key[0] = (char)i;
|
||||
|
Reference in New Issue
Block a user