mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed merge errors and XA prepare
This commit is contained in:
@ -1155,6 +1155,8 @@ THD::THD()
|
||||
wsrep_status_vars = 0;
|
||||
wsrep_mysql_replicated = 0;
|
||||
wsrep_bf_thd = NULL;
|
||||
wsrep_TOI_pre_query = NULL;
|
||||
wsrep_TOI_pre_query_len = 0;
|
||||
#endif
|
||||
/* Call to init() below requires fully initialized Open_tables_state. */
|
||||
reset_open_tables_state(this);
|
||||
|
@ -4883,6 +4883,50 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
|
||||
uint not_used;
|
||||
DBUG_ENTER("mysql_create_like_table");
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd) && !thd->wsrep_applier)
|
||||
{
|
||||
TABLE *tmp_table;
|
||||
bool is_tmp_table= FALSE;
|
||||
|
||||
for (tmp_table= thd->temporary_tables; tmp_table; tmp_table=tmp_table->next)
|
||||
{
|
||||
if (!strcmp(src_table->db, tmp_table->s->db.str) &&
|
||||
!strcmp(src_table->table_name, tmp_table->s->table_name.str))
|
||||
{
|
||||
is_tmp_table= TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!is_tmp_table)
|
||||
{
|
||||
WSREP_TO_ISOLATION_BEGIN(table->db, table->table_name, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
TABLE_LIST tbl;
|
||||
bzero((void*) &tbl, sizeof(tbl));
|
||||
tbl.db= src_table->db;
|
||||
tbl.table_name= tbl.alias= src_table->table_name;
|
||||
tbl.table= tmp_table;
|
||||
char buf[2048];
|
||||
String query(buf, sizeof(buf), system_charset_info);
|
||||
query.length(0); // Have to zero it since constructor doesn't
|
||||
|
||||
(void) store_create_info(thd, &tbl, &query, NULL, TRUE);
|
||||
WSREP_DEBUG("TMP TABLE: %s", query.ptr());
|
||||
|
||||
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);
|
||||
|
||||
thd->wsrep_TOI_pre_query= NULL;
|
||||
thd->wsrep_TOI_pre_query_len= 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
We the open source table to get its description in HA_CREATE_INFO
|
||||
@ -5041,6 +5085,13 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
|
||||
|
||||
err:
|
||||
DBUG_RETURN(res);
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
error:
|
||||
thd->wsrep_TOI_pre_query= NULL;
|
||||
DBUG_RETURN(TRUE);
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -858,14 +858,15 @@ static bool wsrep_prepare_keys_for_isolation(THD* thd,
|
||||
ka->keys_len= 0;
|
||||
|
||||
extern TABLE* find_temporary_table(THD*, const TABLE_LIST*);
|
||||
extern TABLE* find_temporary_table(THD*, const char *, const char *);
|
||||
|
||||
if (db || table)
|
||||
{
|
||||
TABLE_LIST tmp_table;
|
||||
bzero((char*) &tmp_table,sizeof(tmp_table));
|
||||
tmp_table.table_name= (char*)db;
|
||||
tmp_table.db= (char*)table;
|
||||
if (!table || !find_temporary_table(thd, &tmp_table))
|
||||
tmp_table.table_name= (char*)table;
|
||||
tmp_table.db= (char*)db;
|
||||
if (!table || !find_temporary_table(thd, db, table))
|
||||
{
|
||||
if (!(ka->keys= (wsrep_key_t*)my_malloc(sizeof(wsrep_key_t), MYF(0))))
|
||||
{
|
||||
@ -896,8 +897,10 @@ static bool wsrep_prepare_keys_for_isolation(THD* thd,
|
||||
if (!find_temporary_table(thd, table))
|
||||
{
|
||||
wsrep_key_t* tmp;
|
||||
/* In drop table both db and table can be NULL and table_list
|
||||
contains tables, but ka->keys is not yet allocated ? */
|
||||
tmp= (wsrep_key_t*)my_realloc(
|
||||
ka->keys, (ka->keys_len + 1) * sizeof(wsrep_key_t), MYF(0));
|
||||
ka->keys, (ka->keys_len + 1) * sizeof(wsrep_key_t), MYF(MY_ALLOW_ZERO_PTR));
|
||||
if (!tmp)
|
||||
{
|
||||
sql_print_error("Can't allocate memory for key_array");
|
||||
|
@ -2076,7 +2076,7 @@ trx_start_if_not_started_xa_low(
|
||||
transaction, doesn't. */
|
||||
trx->support_xa = thd_supports_xa(trx->mysql_thd);
|
||||
|
||||
trx_start_low(trx);
|
||||
trx_start_if_not_started(trx);
|
||||
/* fall through */
|
||||
case TRX_STATE_ACTIVE:
|
||||
return;
|
||||
|
Reference in New Issue
Block a user