mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Initial merge result with mariaDB 10: lp:maria
This commit is contained in:
@@ -1017,7 +1017,11 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
thd->transaction.stmt.modified_non_trans_table ||
|
||||
was_insert_delayed)
|
||||
{
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
|
||||
#else
|
||||
if (mysql_bin_log.is_open())
|
||||
#endif
|
||||
{
|
||||
int errcode= 0;
|
||||
if (error <= 0)
|
||||
@@ -3641,8 +3645,15 @@ bool select_insert::send_eof()
|
||||
DBUG_PRINT("enter", ("trans_table=%d, table_type='%s'",
|
||||
trans_table, table->file->table_type()));
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
error= (thd->wsrep_conflict_state == MUST_ABORT ||
|
||||
thd->wsrep_conflict_state == CERT_FAILURE) ? -1 :
|
||||
(thd->locked_tables_mode <= LTM_LOCK_TABLES ?
|
||||
table->file->ha_end_bulk_insert() : 0);
|
||||
#else
|
||||
error= (thd->locked_tables_mode <= LTM_LOCK_TABLES ?
|
||||
table->file->ha_end_bulk_insert() : 0);
|
||||
#endif /* WITH_WSREP */
|
||||
if (!error && thd->is_error())
|
||||
error= thd->stmt_da->sql_errno();
|
||||
|
||||
@@ -3670,8 +3681,13 @@ bool select_insert::send_eof()
|
||||
events are in the transaction cache and will be written when
|
||||
ha_autocommit_or_rollback() is issued below.
|
||||
*/
|
||||
#ifdef WITH_WSREP
|
||||
if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) &&
|
||||
(!error || thd->transaction.stmt.modified_non_trans_table))
|
||||
#else
|
||||
if (mysql_bin_log.is_open() &&
|
||||
(!error || thd->transaction.stmt.modified_non_trans_table))
|
||||
#endif
|
||||
{
|
||||
int errcode= 0;
|
||||
if (!error)
|
||||
@@ -3754,7 +3770,11 @@ void select_insert::abort_result_set() {
|
||||
if (!can_rollback_data())
|
||||
thd->transaction.all.modified_non_trans_table= TRUE;
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
|
||||
#else
|
||||
if (mysql_bin_log.is_open())
|
||||
#endif
|
||||
{
|
||||
int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
|
||||
/* error of writing binary log is ignored */
|
||||
@@ -4141,7 +4161,11 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
|
||||
/* show_database */ TRUE);
|
||||
DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
|
||||
#else
|
||||
if (mysql_bin_log.is_open())
|
||||
#endif /* WITH_WSREP */
|
||||
{
|
||||
int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
|
||||
result= thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
@@ -4151,6 +4175,9 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
|
||||
/* suppress_use */ FALSE,
|
||||
errcode);
|
||||
}
|
||||
#ifdef WITH_WSREP
|
||||
ha_wsrep_fake_trx_id(thd);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -4207,6 +4234,18 @@ bool select_create::send_eof()
|
||||
{
|
||||
trans_commit_stmt(thd);
|
||||
trans_commit_implicit(thd);
|
||||
#ifdef WITH_WSREP
|
||||
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
|
||||
if (thd->wsrep_conflict_state != NO_CONFLICT)
|
||||
{
|
||||
WSREP_DEBUG("select_create commit failed, thd: %lu err: %d %s",
|
||||
thd->thread_id, thd->wsrep_conflict_state, thd->query());
|
||||
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
||||
abort_result_set();
|
||||
return TRUE;
|
||||
}
|
||||
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
||||
#endif /* WITH_WSREP */
|
||||
}
|
||||
|
||||
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
|
||||
|
Reference in New Issue
Block a user