1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MW-322 - CTAS fix merged to 5.5-v25 branch

Signed-off-by: Jan Lindström <jan.lindstrom@mariadb.com>
This commit is contained in:
sjaakola
2017-04-27 19:51:18 +03:00
committed by Jan Lindström
parent a481de30bb
commit a4bc8db216
6 changed files with 99 additions and 45 deletions

View File

@ -4313,9 +4313,38 @@ bool select_create::send_eof()
*/
if (!table->s->tmp_table)
{
#ifdef WITH_WSREP
/*
append table level exclusive key for CTAS
*/
wsrep_key_arr_t key_arr= {0, 0};
wsrep_prepare_keys_for_isolation(thd,
create_table->db,
create_table->table_name,
table_list,
&key_arr);
int rcode = wsrep->append_key(
wsrep,
&thd->wsrep_ws_handle,
key_arr.keys, //&wkey,
key_arr.keys_len,
WSREP_KEY_EXCLUSIVE,
false);
wsrep_keys_free(&key_arr);
if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: %d", rcode));
WSREP_ERROR("Appending table key for CTAS failed: %s, %d",
(wsrep_thd_query(thd)) ?
wsrep_thd_query(thd) : "void", rcode);
return true;
}
/* If commit fails, we should be able to reset the OK status. */
thd->stmt_da->can_overwrite_status= TRUE;
#endif /* WITH_WSREP */
trans_commit_stmt(thd);
trans_commit_implicit(thd);
#ifdef WITH_WSREP
thd->stmt_da->can_overwrite_status= FALSE;
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
if (thd->wsrep_conflict_state != NO_CONFLICT)
{