diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2023-03-17 14:22:35 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2023-03-17 14:22:35 +0200 |
commit | df08731b5879514cca7adaee007d1c7613982491 (patch) | |
tree | c226078076f9d87735d0a55c819816b7cc5edb6c /storage | |
parent | 3dd33789c1b2003dab7f98d4ec390476076a2267 (diff) | |
parent | 1147e326887e145d6de6157a32f31020f484a5e7 (diff) | |
download | mariadb-git-df08731b5879514cca7adaee007d1c7613982491.tar.gz |
Merge 10.9 into 10.10
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 29 | ||||
-rw-r--r-- | storage/innobase/handler/i_s.cc | 9 | ||||
-rw-r--r-- | storage/innobase/trx/trx0roll.cc | 6 |
3 files changed, 33 insertions, 11 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index bf1d5d83afb..40adc90f7f1 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4455,6 +4455,25 @@ innobase_commit_ordered( DBUG_VOID_RETURN; } +/** Mark the end of a statement. +@param trx transaction +@return whether an error occurred */ +static bool end_of_statement(trx_t *trx) +{ + trx_mark_sql_stat_end(trx); + if (UNIV_LIKELY(trx->error_state == DB_SUCCESS)) + return false; + + trx_savept_t savept; + savept.least_undo_no= 0; + trx->rollback(&savept); + /* MariaDB will roll back the entire transaction. */ + trx->bulk_insert= false; + trx->last_sql_stat_start.least_undo_no= 0; + trx->savepoints_discard(); + return true; +} + /*****************************************************************//** Commits a transaction in an InnoDB database or marks an SQL statement ended. @@ -4531,10 +4550,7 @@ innobase_commit( /* Store the current undo_no of the transaction so that we know where to roll back if we have to roll back the next SQL statement */ - - trx_mark_sql_stat_end(trx); - if (UNIV_UNLIKELY(trx->error_state != DB_SUCCESS)) { - trx_rollback_for_mysql(trx); + if (UNIV_UNLIKELY(end_of_statement(trx))) { DBUG_RETURN(1); } } @@ -16954,10 +16970,7 @@ innobase_xa_prepare( /* Store the current undo_no of the transaction so that we know where to roll back if we have to roll back the next SQL statement */ - - trx_mark_sql_stat_end(trx); - if (UNIV_UNLIKELY(trx->error_state != DB_SUCCESS)) { - trx_rollback_for_mysql(trx); + if (UNIV_UNLIKELY(end_of_statement(trx))) { return 1; } } diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 9510a4a8bfc..3b537afef40 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -6142,8 +6142,13 @@ static int i_s_sys_tablespaces_fill(THD *thd, const fil_space_t &s, TABLE *t) OK(f->store(name.data(), name.size(), system_charset_info)); f->set_notnull(); } - else - f->set_notnull(); + else if (srv_is_undo_tablespace(s.id)) + { + char name[15]; + snprintf(name, sizeof name, "innodb_undo%03u", + (s.id - srv_undo_space_id_start + 1)); + OK(f->store(name, strlen(name), system_charset_info)); + } else f->set_notnull(); } fields[SYS_TABLESPACES_NAME]->set_null(); diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index 45dc78b4440..99cf1364192 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -557,9 +557,13 @@ trx_release_savepoint_for_mysql( if (savep != NULL) { trx_roll_savepoint_free(trx, savep); + return DB_SUCCESS; + } else if (trx->last_sql_stat_start.least_undo_no == 0) { + /* Bulk insert could have discarded savepoints */ + return DB_SUCCESS; } - return(savep != NULL ? DB_SUCCESS : DB_NO_SAVEPOINT); + return DB_NO_SAVEPOINT; } /*******************************************************************//** |