summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorJan Lindström <jplindst@mariadb.org>2013-11-25 14:04:49 +0200
committerJan Lindström <jplindst@mariadb.org>2013-11-25 14:04:49 +0200
commit4f85baab95f50448930a8c9915f7178aa121e66e (patch)
tree198e4126b168136140aa00aa8c3c5e3c25ec102b /sql
parent0e248e62bdaf881f8b07b97e361d44ee30933bc1 (diff)
downloadmariadb-git-4f85baab95f50448930a8c9915f7178aa121e66e.tar.gz
Merged revisions 3931--3942 from from lp:~codership/codership-mysql/5.5-23.
------------------------------------------------------------ revno: 3942 committer: Seppo Jaakola <seppo.jaakola@codership.com> branch nick: wsrep-5.5-23 timestamp: Thu 2013-11-07 17:37:10 +0200 message: References: lp:1248921 - checking if index is foreign earlier to adhere to lat ch order protocol ------------------------------------------------------------ revno: 3941 fixes bug: https://launchpad.net/bugs/1248908 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Thu 2013-11-07 14:31:04 +0200 message: References lp:1248908 - Fixed access to trx sys header Pass trx sys header as argument for trx_sys_update_wsrep_checkpoint() and trx_sys_update_mysql_binlog_offset() to avoid successive calls to trx_sysf_get(). ------------------------------------------------------------ revno: 3940 fixes bug: https://launchpad.net/bugs/1244100 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Tue 2013-11-05 15:31:12 +0200 message: References lp:1244100 - assign value for check_purge before return ------------------------------------------------------------ revno: 3939 fixes bug: https://launchpad.net/bugs/1247978 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Tue 2013-11-05 01:01:36 +0200 message: References lp:1247978 - force release transactional MDL locks if wsrep is on a nd no active transaction at the end of mysql_execute_command() ------------------------------------------------------------ revno: 3938 committer: Vladislav Klyachin <vladislav.klyachin@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-11-03 20:48:06 +0400 message: References lp:1232789 - fix FLUSH STATUS zeroes up wsrep_cluster_size and wsre p_local_index ------------------------------------------------------------ revno: 3937 5kB/s - committer: Vladislav Klyachin <vladislav.klyachin@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-11-03 17:06:31 +0400 message: References lp:587170 - reset auto_increment_* vars to defaults for TOI operati ons ------------------------------------------------------------ revno: 3936 committer: Vladislav Klyachin <vladislav.klyachin@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-11-03 00:10:45 +0400 message: References lp:1072839 - fix for memory leaks with wsrep variables ------------------------------------------------------------ revno: 3935 committer: Seppo Jaakola <seppo.jaakola@codership.com> branch nick: wsrep-5.5-23 timestamp: Wed 2013-10-30 14:34:32 +0200 message: References: lp:1246257 - skipping replication for CREATE TEMPORARY TABLE LIKE. .. constructs ------------------------------------------------------------ revno: 3934 6kB/s \ fixes bug: https://launchpad.net/bugs/1241760 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Mon 2013-10-28 11:01:53 +0200 message: References lp:1241760 - save thd->db to wsrep_thd_shadow before replay ------------------------------------------------------------ revno: 3933 fixes bug: https://launchpad.net/bugs/1206129 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-10-27 18:15:12 +0200 message: References lp:1206129 - check binlog_hton->commit() return value, call wsrep_p ost_commit() instead of wsrep_cleanup_transaction() ------------------------------------------------------------ revno: 3932 fixes bug: https://launchpad.net/bugs/1244661 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-10-27 13:14:02 +0200 message: References lp:1244661 - added wsrep_register_hton() to trans_rollback_implicit () ------------------------------------------------------------ revno: 3931 fixes bug: https://launchpad.net/bugs/1244667 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-10-27 11:08:49 +0200 message: References lp:1244667 - restore thd->server_status after replay
Diffstat (limited to 'sql')
-rw-r--r--sql/log.cc1
-rw-r--r--sql/mdl.h7
-rw-r--r--sql/mysqld.cc4
-rw-r--r--sql/sql_alter.cc21
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/sql_parse.cc26
-rw-r--r--sql/sql_table.cc13
-rw-r--r--sql/sys_vars.cc10
-rw-r--r--sql/transaction.cc1
9 files changed, 67 insertions, 18 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 0fb6cd18690..64174a9a454 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -5555,6 +5555,7 @@ int MYSQL_BIN_LOG::rotate(bool force_rotate, bool* check_purge)
#ifdef WITH_WSREP
if (WSREP_ON && wsrep_to_isolation)
{
+ *check_purge= false;
WSREP_DEBUG("avoiding binlog rotate due to TO isolation: %d",
wsrep_to_isolation);
DBUG_RETURN(0);
diff --git a/sql/mdl.h b/sql/mdl.h
index 50a2c2d815a..1363a07e7ab 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -666,6 +666,13 @@ public:
m_tickets[MDL_EXPLICIT].is_empty());
}
+#ifdef WITH_WSREP
+ inline bool has_transactional_locks() const
+ {
+ return !m_tickets[MDL_TRANSACTION].is_empty();
+ }
+#endif /* WITH_WSREP */
+
MDL_savepoint mdl_savepoint()
{
return MDL_savepoint(m_tickets[MDL_STATEMENT].front(),
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 3b0009b5ca9..2bcd946c672 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -7924,8 +7924,8 @@ SHOW_VAR status_vars[]= {
{"wsrep_cluster_state_uuid", (char*) &wsrep_cluster_state_uuid,SHOW_CHAR_PTR},
{"wsrep_cluster_conf_id", (char*) &wsrep_cluster_conf_id, SHOW_LONGLONG},
{"wsrep_cluster_status", (char*) &wsrep_cluster_status, SHOW_CHAR_PTR},
- {"wsrep_cluster_size", (char*) &wsrep_cluster_size, SHOW_LONG},
- {"wsrep_local_index", (char*) &wsrep_local_index, SHOW_LONG},
+ {"wsrep_cluster_size", (char*) &wsrep_cluster_size, SHOW_LONG_NOFLUSH},
+ {"wsrep_local_index", (char*) &wsrep_local_index, SHOW_LONG_NOFLUSH},
{"wsrep_provider_name", (char*) &wsrep_provider_name, SHOW_CHAR_PTR},
{"wsrep_provider_version", (char*) &wsrep_provider_version, SHOW_CHAR_PTR},
{"wsrep_provider_vendor", (char*) &wsrep_provider_vendor, SHOW_CHAR_PTR},
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc
index 00691633aa8..75d27016317 100644
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@ -102,15 +102,20 @@ bool Alter_table_statement::execute(THD *thd)
#ifdef WITH_WSREP
TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl);
- if ((!thd->is_current_stmt_binlog_format_row() ||
- !find_temporary_table(thd, first_table)) &&
- wsrep_to_isolation_begin(thd,
- lex->name.str ? select_lex->db : NULL,
- lex->name.str ? lex->name.str : NULL,
- first_table))
+ if (!thd->is_current_stmt_binlog_format_row() ||
+ !find_temporary_table(thd, first_table))
{
- WSREP_WARN("ALTER TABLE isolation failure");
- DBUG_RETURN(TRUE);
+ if (wsrep_to_isolation_begin(thd,
+ lex->name.str ? select_lex->db : NULL,
+ lex->name.str ? lex->name.str : NULL,
+ first_table))
+ {
+ WSREP_WARN("ALTER TABLE isolation failure");
+ DBUG_RETURN(TRUE);
+ }
+
+ thd->variables.auto_increment_offset = 1;
+ thd->variables.auto_increment_increment = 1;
}
#endif /* WITH_WSREP */
result= mysql_alter_table(thd, select_lex->db, lex->name.str,
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 3d2442b7922..4a84c91c228 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -52,6 +52,8 @@ struct wsrep_thd_shadow {
enum wsrep_exec_mode wsrep_exec_mode;
Vio *vio;
ulong tx_isolation;
+ char *db;
+ size_t db_length;
};
#endif
class Reprepare_observer;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 156acd9c2f7..df1493c8cb1 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2906,6 +2906,9 @@ case SQLCOM_PREPARE:
else
{
#ifdef WITH_WSREP
+ /* in STATEMENT format, we probably have to replicate also temporary
+ tables, like mysql replication does
+ */
if (!thd->is_current_stmt_binlog_format_row() ||
!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
WSREP_TO_ISOLATION_BEGIN(create_table->db, create_table->table_name,
@@ -4985,7 +4988,22 @@ finish:
{
thd->mdl_context.release_statement_locks();
}
- WSREP_TO_ISOLATION_END
+ WSREP_TO_ISOLATION_END;
+
+#ifdef WITH_WSREP
+ /*
+ Force release of transactional locks if not in active MST and wsrep is on.
+ */
+ if (WSREP(thd) &&
+ ! thd->in_sub_stmt &&
+ ! thd->in_active_multi_stmt_transaction() &&
+ thd->mdl_context.has_transactional_locks())
+ {
+ WSREP_DEBUG("Forcing release of transactional locks for thd %lu",
+ thd->thread_id);
+ thd->mdl_context.release_transactional_locks();
+ }
+#endif /* WITH_WSREP */
DBUG_RETURN(res || thd->is_error());
}
@@ -8423,6 +8441,10 @@ void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
shadow->tx_isolation = thd->variables.tx_isolation;
thd->variables.tx_isolation = ISO_READ_COMMITTED;
thd->tx_isolation = ISO_READ_COMMITTED;
+
+ shadow->db = thd->db;
+ shadow->db_length = thd->db_length;
+ thd->reset_db(NULL, 0);
}
void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
@@ -8431,6 +8453,8 @@ void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
thd->wsrep_exec_mode = shadow->wsrep_exec_mode;
thd->net.vio = shadow->vio;
thd->variables.tx_isolation = shadow->tx_isolation;
+
+ thd->reset_db(shadow->db, shadow->db_length);
}
void wsrep_replication_process(THD *thd)
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 06c5b51a438..bd1b4c600fc 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4778,12 +4778,23 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
break;
}
}
- if (!is_tmp_table)
+ if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
+ {
+ /* CREATE TEMPORARY TABLE LIKE must be skipped from replication */
+ WSREP_DEBUG("CREATE TEMPORARY TABLE LIKE... skipped replication\n %s",
+ thd->query());
+ }
+ else if (!is_tmp_table)
{
+ /* this is straight CREATE TABLE LIKE... eith no tmp tables */
WSREP_TO_ISOLATION_BEGIN(table->db, table->table_name, NULL);
}
else
{
+ /* here we have CREATE TABLE LIKE <temporary table>
+ the temporary table definition will be needed in slaves to
+ enable the create to succeed
+ */
TABLE_LIST tbl;
bzero((void*) &tbl, sizeof(tbl));
tbl.db= src_table->db;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 5b4cc4ddb64..88dee072b89 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -3645,7 +3645,7 @@ static Sys_var_charptr Sys_wsrep_data_home_dir(
static Sys_var_charptr Sys_wsrep_cluster_name(
"wsrep_cluster_name", "Name for the cluster",
- GLOBAL_VAR(wsrep_cluster_name), CMD_LINE(REQUIRED_ARG),
+ PREALLOCATED GLOBAL_VAR(wsrep_cluster_name), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(wsrep_cluster_name),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_cluster_name_check),
@@ -3663,13 +3663,13 @@ static Sys_var_charptr Sys_wsrep_cluster_address (
static Sys_var_charptr Sys_wsrep_node_name (
"wsrep_node_name", "Node name",
- GLOBAL_VAR(wsrep_node_name), CMD_LINE(REQUIRED_ARG),
+ PREALLOCATED GLOBAL_VAR(wsrep_node_name), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(wsrep_node_name),
NO_MUTEX_GUARD, NOT_IN_BINLOG);
static Sys_var_charptr Sys_wsrep_node_address (
"wsrep_node_address", "Node address",
- GLOBAL_VAR(wsrep_node_address), CMD_LINE(REQUIRED_ARG),
+ PREALLOCATED GLOBAL_VAR(wsrep_node_address), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(wsrep_node_address),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_node_address_check),
@@ -3677,7 +3677,7 @@ static Sys_var_charptr Sys_wsrep_node_address (
static Sys_var_charptr Sys_wsrep_node_incoming_address(
"wsrep_node_incoming_address", "Client connection address",
- GLOBAL_VAR(wsrep_node_incoming_address),CMD_LINE(REQUIRED_ARG),
+ PREALLOCATED GLOBAL_VAR(wsrep_node_incoming_address),CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(wsrep_node_incoming_address),
NO_MUTEX_GUARD, NOT_IN_BINLOG);
@@ -3769,7 +3769,7 @@ static Sys_var_mybool Sys_wsrep_on (
static Sys_var_charptr Sys_wsrep_start_position (
"wsrep_start_position", "global transaction position to start from ",
- GLOBAL_VAR(wsrep_start_position),
+ PREALLOCATED GLOBAL_VAR(wsrep_start_position),
CMD_LINE(REQUIRED_ARG, OPT_WSREP_START_POSITION),
IN_FS_CHARSET, DEFAULT(wsrep_start_position),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 7976adf38a5..2d1c94e6b52 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -298,7 +298,6 @@ bool trans_rollback(THD *thd)
DBUG_RETURN(test(res));
}
-
/**
Commit the single statement transaction.