mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge 11.0 into 11.1
This commit is contained in:
@ -4529,10 +4529,15 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
|
||||
|
||||
if ((res= insert_precheck(thd, all_tables)))
|
||||
break;
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd) && thd->wsrep_consistency_check == CONSISTENCY_CHECK_DECLARED)
|
||||
bool wsrep_toi= false;
|
||||
const bool wsrep= WSREP(thd);
|
||||
|
||||
if (wsrep && thd->wsrep_consistency_check == CONSISTENCY_CHECK_DECLARED)
|
||||
{
|
||||
thd->wsrep_consistency_check = CONSISTENCY_CHECK_RUNNING;
|
||||
wsrep_toi= true;
|
||||
WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL);
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
@ -4567,6 +4572,27 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
|
||||
if (!(res=open_and_lock_tables(thd, all_tables, TRUE, 0)))
|
||||
{
|
||||
MYSQL_INSERT_SELECT_START(thd->query());
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
if (wsrep && !first_table->view)
|
||||
{
|
||||
bool is_innodb= (first_table->table->file->ht->db_type == DB_TYPE_INNODB);
|
||||
|
||||
// For consistency check inserted table needs to be InnoDB
|
||||
if (!is_innodb && thd->wsrep_consistency_check != NO_CONSISTENCY_CHECK)
|
||||
{
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
HA_ERR_UNSUPPORTED,
|
||||
"Galera cluster does support consistency check only"
|
||||
" for InnoDB tables.");
|
||||
thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK;
|
||||
}
|
||||
|
||||
// For !InnoDB we start TOI if it is not yet started and hope for the best
|
||||
if (!is_innodb && !wsrep_toi)
|
||||
WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL);
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
/*
|
||||
Only the INSERT table should be merged. Other will be handled by
|
||||
select.
|
||||
@ -5892,13 +5918,11 @@ finish:
|
||||
if (unlikely(thd->is_error()) ||
|
||||
(thd->variables.option_bits & OPTION_MASTER_SQL_ERROR))
|
||||
{
|
||||
THD_STAGE_INFO(thd, stage_rollback);
|
||||
trans_rollback_stmt(thd);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If commit fails, we should be able to reset the OK status. */
|
||||
THD_STAGE_INFO(thd, stage_commit);
|
||||
thd->get_stmt_da()->set_overwrite_status(true);
|
||||
trans_commit_stmt(thd);
|
||||
thd->get_stmt_da()->set_overwrite_status(false);
|
||||
@ -5925,7 +5949,6 @@ finish:
|
||||
one of storage engines (e.g. due to deadlock). Rollback transaction in
|
||||
all storage engines including binary log.
|
||||
*/
|
||||
THD_STAGE_INFO(thd, stage_rollback_implicit);
|
||||
trans_rollback_implicit(thd);
|
||||
thd->release_transactional_locks();
|
||||
}
|
||||
@ -5935,7 +5958,6 @@ finish:
|
||||
DBUG_ASSERT(! thd->in_sub_stmt);
|
||||
if (!(thd->variables.option_bits & OPTION_GTID_BEGIN))
|
||||
{
|
||||
THD_STAGE_INFO(thd, stage_commit_implicit);
|
||||
/* If commit fails, we should be able to reset the OK status. */
|
||||
thd->get_stmt_da()->set_overwrite_status(true);
|
||||
/* Commit the normal transaction if one is active. */
|
||||
|
Reference in New Issue
Block a user