summaryrefslogtreecommitdiff
path: root/sql/wsrep_mysqld.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/wsrep_mysqld.cc')
-rw-r--r--sql/wsrep_mysqld.cc53
1 files changed, 23 insertions, 30 deletions
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 54313281625..8c238578e3d 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -1176,7 +1176,7 @@ static bool wsrep_prepare_keys_for_isolation(THD* thd,
}
ka->keys[ka->keys_len].key_parts_num= 2;
++ka->keys_len;
- if (!wsrep_prepare_key_for_isolation(table->db, table->table_name,
+ if (!wsrep_prepare_key_for_isolation(table->db.str, table->table_name.str,
(wsrep_buf_t*)ka->keys[ka->keys_len - 1].key_parts,
&ka->keys[ka->keys_len - 1].key_parts_num))
{
@@ -1318,7 +1318,7 @@ static int wsrep_alter_event_query(THD *thd, uchar** buf, size_t* buf_len)
if (wsrep_alter_query_string(thd, &log_query))
{
WSREP_WARN("events alter string failed: schema: %s, query: %s",
- (thd->db ? thd->db : "(null)"), thd->query());
+ thd->get_db(), thd->query());
return 1;
}
return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len);
@@ -1370,25 +1370,23 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len)
view_store_options(thd, views, &buff);
buff.append(STRING_WITH_LEN("VIEW "));
/* Test if user supplied a db (ie: we did not use thd->db) */
- if (views->db && views->db[0] &&
- (thd->db == NULL || strcmp(views->db, thd->db)))
+ if (views->db.str && views->db.str[0] &&
+ (thd->db.str == NULL || cmp(&views->db, &thd->db)))
{
- append_identifier(thd, &buff, views->db,
- views->db_length);
+ append_identifier(thd, &buff, &views->db);
buff.append('.');
}
- append_identifier(thd, &buff, views->table_name,
- views->table_name_length);
+ append_identifier(thd, &buff, &views->table_name);
if (lex->view_list.elements)
{
- List_iterator_fast<LEX_STRING> names(lex->view_list);
- LEX_STRING *name;
+ List_iterator_fast<LEX_CSTRING> names(lex->view_list);
+ LEX_CSTRING *name;
int i;
for (i= 0; (name= names++); i++)
{
buff.append(i ? ", " : "(");
- append_identifier(thd, &buff, name->str, name->length);
+ append_identifier(thd, &buff, name);
}
buff.append(')');
}
@@ -1474,7 +1472,7 @@ static bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table,
{
for (TABLE_LIST* table= first_table; table; table= table->next_global)
{
- if (!thd->find_temporary_table(table->db, table->table_name))
+ if (!thd->find_temporary_table(table->db.str, table->table_name.str))
{
return true;
}
@@ -1558,7 +1556,7 @@ static int wsrep_TOI_begin(THD *thd, const char *db_, const char *table_,
WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. Check wsrep "
"connection state and retry the query.",
ret,
- (thd->db ? thd->db : "(null)"),
+ thd->get_db(),
(thd->query()) ? thd->query() : "void");
my_message(ER_LOCK_DEADLOCK, "WSREP replication failed. Check "
"your wsrep connection state and retry the query.", MYF(0));
@@ -1594,7 +1592,7 @@ static void wsrep_TOI_end(THD *thd) {
else {
WSREP_WARN("TO isolation end failed for: %d, schema: %s, sql: %s",
ret,
- (thd->db ? thd->db : "(null)"),
+ thd->get_db(),
(thd->query()) ? thd->query() : "void");
}
}
@@ -1609,7 +1607,7 @@ static int wsrep_RSU_begin(THD *thd, const char *db_, const char *table_)
if (ret != WSREP_OK)
{
WSREP_WARN("RSU desync failed %d for schema: %s, query: %s",
- ret, (thd->db ? thd->db : "(null)"), thd->query());
+ ret, thd->get_db(), thd->query());
my_error(ER_LOCK_DEADLOCK, MYF(0));
return(ret);
}
@@ -1622,8 +1620,7 @@ static int wsrep_RSU_begin(THD *thd, const char *db_, const char *table_)
{
/* no can do, bail out from DDL */
WSREP_WARN("RSU failed due to pending transactions, schema: %s, query %s",
- (thd->db ? thd->db : "(null)"),
- thd->query());
+ thd->get_db(), thd->query());
mysql_mutex_lock(&LOCK_wsrep_replaying);
wsrep_replaying--;
mysql_mutex_unlock(&LOCK_wsrep_replaying);
@@ -1632,7 +1629,7 @@ static int wsrep_RSU_begin(THD *thd, const char *db_, const char *table_)
if (ret != WSREP_OK)
{
WSREP_WARN("resync failed %d for schema: %s, query: %s",
- ret, (thd->db ? thd->db : "(null)"), thd->query());
+ ret, thd->get_db(), thd->query());
}
my_error(ER_LOCK_DEADLOCK, MYF(0));
@@ -1643,8 +1640,7 @@ static int wsrep_RSU_begin(THD *thd, const char *db_, const char *table_)
if (seqno == WSREP_SEQNO_UNDEFINED)
{
WSREP_WARN("pause failed %lld for schema: %s, query: %s", (long long)seqno,
- (thd->db ? thd->db : "(null)"),
- thd->query());
+ thd->get_db(), thd->query());
return(1);
}
WSREP_DEBUG("paused at %lld", (long long)seqno);
@@ -1667,15 +1663,14 @@ static void wsrep_RSU_end(THD *thd)
if (ret != WSREP_OK)
{
WSREP_WARN("resume failed %d for schema: %s, query: %s", ret,
- (thd->db ? thd->db : "(null)"),
- thd->query());
+ thd->get_db(), thd->query());
}
ret = wsrep->resync(wsrep);
if (ret != WSREP_OK)
{
WSREP_WARN("resync failed %d for schema: %s, query: %s", ret,
- (thd->db ? thd->db : "(null)"), thd->query());
+ thd->get_db(), thd->query());
return;
}
@@ -1698,9 +1693,7 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_,
if (thd->wsrep_conflict_state == MUST_ABORT)
{
WSREP_INFO("thread: %lld schema: %s query: %s has been aborted due to multi-master conflict",
- (longlong) thd->thread_id,
- (thd->db ? thd->db : "(null)"),
- thd->query());
+ (longlong) thd->thread_id, thd->get_db(), thd->query());
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
return WSREP_TRX_FAIL;
}
@@ -2339,7 +2332,7 @@ static int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len)
saved_mode))
{
WSREP_WARN("SP create string failed: schema: %s, query: %s",
- (thd->db ? thd->db : "(null)"), thd->query());
+ thd->get_db(), thd->query());
return 1;
}
@@ -2585,8 +2578,8 @@ bool wsrep_create_like_table(THD* thd, TABLE_LIST* table,
}
else if (!(thd->find_temporary_table(src_table)))
{
- /* this is straight CREATE TABLE LIKE... eith no tmp tables */
- WSREP_TO_ISOLATION_BEGIN(table->db, table->table_name, NULL);
+ /* this is straight CREATE TABLE LIKE... with no tmp tables */
+ WSREP_TO_ISOLATION_BEGIN(table->db.str, table->table_name.str, NULL);
}
else
{
@@ -2609,7 +2602,7 @@ bool wsrep_create_like_table(THD* thd, TABLE_LIST* table,
thd->wsrep_TOI_pre_query= query.ptr();
thd->wsrep_TOI_pre_query_len= query.length();
- WSREP_TO_ISOLATION_BEGIN(table->db, table->table_name, NULL);
+ WSREP_TO_ISOLATION_BEGIN(table->db.str, table->table_name.str, NULL);
thd->wsrep_TOI_pre_query= NULL;
thd->wsrep_TOI_pre_query_len= 0;