diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2018-06-12 19:39:37 +0300 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2018-06-12 19:39:37 +0300 |
commit | 6e55236c0a72e8f49a240c4e080591994042b0e4 (patch) | |
tree | 4bb2f438004db3dbba5f88f5e4b00aacfd5c1cec /sql/sql_insert.cc | |
parent | aa59ecec89d89a29f7272352471a4064aa6db28c (diff) | |
parent | 215d652c66474c4578b0476385d055e7feae2d3a (diff) | |
download | mariadb-git-6e55236c0a72e8f49a240c4e080591994042b0e4.tar.gz |
Merge branch '10.0-galera' into 10.1
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 634ddb32b71..e103c3b390c 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -4383,12 +4383,44 @@ bool select_create::send_eof() */ if (!table->s->tmp_table) { +#ifdef WITH_WSREP + if (WSREP_ON) + { + /* + 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->get_stmt_da()->set_overwrite_status(TRUE); + } +#endif /* WITH_WSREP */ trans_commit_stmt(thd); if (!(thd->variables.option_bits & OPTION_GTID_BEGIN)) trans_commit_implicit(thd); #ifdef WITH_WSREP if (WSREP_ON) { + thd->get_stmt_da()->set_overwrite_status(FALSE); mysql_mutex_lock(&thd->LOCK_thd_data); if (thd->wsrep_conflict_state != NO_CONFLICT) { |