1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Merge branch '10.0-galera' into 10.1

This commit is contained in:
Nirbhay Choubey
2015-07-14 16:05:29 -04:00
parent 75931feabe
commit dced5146bd
399 changed files with 14892 additions and 1525 deletions

View File

@ -3691,14 +3691,14 @@ void select_insert::store_values(List<Item> &values)
TRG_EVENT_INSERT);
}
bool select_insert::send_eof()
bool select_insert::prepare_eof()
{
int error;
bool const trans_table= table->file->has_transactions();
ulonglong id, row_count;
bool changed;
killed_state killed_status= thd->killed;
DBUG_ENTER("select_insert::send_eof");
DBUG_ENTER("select_insert::prepare_eof");
DBUG_PRINT("enter", ("trans_table=%d, table_type='%s'",
trans_table, table->file->table_type()));
@ -3749,7 +3749,7 @@ bool select_insert::send_eof()
trans_table, FALSE, FALSE, errcode))
{
table->file->ha_release_auto_increment();
DBUG_RETURN(1);
DBUG_RETURN(true);
}
}
table->file->ha_release_auto_increment();
@ -3757,31 +3757,49 @@ bool select_insert::send_eof()
if (error)
{
table->file->print_error(error,MYF(0));
DBUG_RETURN(1);
DBUG_RETURN(true);
}
if (suppress_my_ok)
DBUG_RETURN(0);
DBUG_RETURN(false);
}
bool select_insert::send_ok_packet() {
char message[160]; /* status message */
ulong row_count; /* rows affected */
ulong id; /* last insert-id */
DBUG_ENTER("select_insert::send_ok_packet");
char buff[160];
if (info.ignore)
sprintf(buff, ER_THD(thd, ER_INSERT_INFO), (ulong) info.records,
(ulong) (info.records - info.copied),
(long) thd->get_stmt_da()->current_statement_warn_count());
my_snprintf(message, sizeof(message), ER(ER_INSERT_INFO),
(ulong) info.records, (ulong) (info.records - info.copied),
(long) thd->get_stmt_da()->current_statement_warn_count());
else
sprintf(buff, ER_THD(thd, ER_INSERT_INFO), (ulong) info.records,
(ulong) (info.deleted+info.updated),
(long) thd->get_stmt_da()->current_statement_warn_count());
my_snprintf(message, sizeof(message), ER(ER_INSERT_INFO),
(ulong) info.records, (ulong) (info.deleted + info.updated),
(long) thd->get_stmt_da()->current_statement_warn_count());
row_count= info.copied + info.deleted +
((thd->client_capabilities & CLIENT_FOUND_ROWS) ?
info.touched : info.updated);
((thd->client_capabilities & CLIENT_FOUND_ROWS) ?
info.touched : info.updated);
id= (thd->first_successful_insert_id_in_cur_stmt > 0) ?
thd->first_successful_insert_id_in_cur_stmt :
(thd->arg_of_last_insert_id_function ?
thd->first_successful_insert_id_in_prev_stmt :
(info.copied ? autoinc_value_of_last_inserted_row : 0));
::my_ok(thd, row_count, id, buff);
DBUG_RETURN(0);
::my_ok(thd, row_count, id, message);
DBUG_RETURN(false);
}
bool select_insert::send_eof()
{
bool res;
DBUG_ENTER("select_insert::send_eof");
res= (prepare_eof() || send_ok_packet());
DBUG_RETURN(res);
}
void select_insert::abort_result_set() {
@ -4256,13 +4274,13 @@ void select_create::store_values(List<Item> &values)
bool select_create::send_eof()
{
if (select_insert::send_eof())
DBUG_ENTER("select_create::send_eof");
if (prepare_eof())
{
abort_result_set();
return 1;
DBUG_RETURN(true);
}
exit_done= 1; // Avoid double calls
/*
Do an implicit commit at end of statement for non-temporary
tables. This can fail, but we should unlock the table
@ -4283,7 +4301,7 @@ bool select_create::send_eof()
thd->thread_id, thd->wsrep_conflict_state, thd->query());
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
abort_result_set();
return TRUE;
DBUG_RETURN(true);
}
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
}
@ -4292,9 +4310,17 @@ bool select_create::send_eof()
else if (!thd->is_current_stmt_binlog_format_row())
table->s->table_creation_was_logged= 1;
/*
exit_done must only be set after last potential call to
abort_result_set().
*/
exit_done= 1; // Avoid double calls
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
send_ok_packet();
if (m_plock)
{
MYSQL_LOCK *lock= *m_plock;
@ -4315,12 +4341,12 @@ bool select_create::send_eof()
create_info->
pos_in_locked_tables,
table, lock))
return 0; // ok
DBUG_RETURN(false); // ok
/* Fail. Continue without locking the table */
}
mysql_unlock_tables(thd, lock);
}
return 0;
DBUG_RETURN(false);
}