From 0b89a42ffc7f136632107b795db18dfa380aea69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 24 Nov 2017 12:03:24 +0200 Subject: [PATCH] Remove the flag vers_update_trt THD::vers_update_trt, trx_t::vers_update_trt, trx_savept_t::vers_update_trt: Remove. Instead, determine from trx_t::mod_tables whether versioned columns were affected by the transaction. handlerton::prepare_commit_versioned: Replaces vers_get_trt_data. Return the transaction start ID and also the commit ID, in case the transaction modified any system-versioned columns (0 if not). TR_table::store_data(): Remove (merge with update() below). TR_table::update(): Add the parameters start_id, end_id. ha_commit_trans(): Remove a condition on SQLCOM_ALTER_TABLE. If we need something special for ALTER TABLE...ALGORITHM=INPLACE, that can be done inside InnoDB by modifying trx_t::mod_tables. innodb_prepare_commit_versioned(): Renamed from innodb_get_trt_data(). Check trx_t::mod_tables to see if any changes to versioned columns are present. trx_mod_table_time_t: A pair of logical timestamps, replacing the undo_no_t in trx_mod_tables_t. Keep track of not only the first modification to a persistent table in each transaction, but also the first modification of a versioned column in a table. dtype_t, dict_col_t: Add the accessor is_any_versioned(), to check if the type refers to a system-versioned user or system column. upd_t::affects_versioned(): Check if an update affects a versioned column. trx_undo_report_row_operation(): If a versioned column is affected by the update, invoke trx_mod_table_time_t::set_versioned(). trx_rollback_to_savepoint_low(): If all changes to versioned columns were rolled back, invoke trx_mod_table_time_t::rollback_versioned(), so that trx_mod_table_time_t::is_versioned() will no longer hold. --- mysql-test/suite/versioning/r/alter.result | 3 -- sql/handler.cc | 24 +++++++-- sql/handler.h | 11 ++-- sql/sql_class.cc | 7 --- sql/sql_class.h | 4 -- sql/sql_table.cc | 12 +++-- sql/table.cc | 36 ++++--------- sql/table.h | 27 +++------- sql/vtmd.cc | 8 +-- storage/innobase/handler/ha_innodb.cc | 62 +++++++++++----------- storage/innobase/handler/handler0alter.cc | 4 -- storage/innobase/include/data0type.h | 4 +- storage/innobase/include/dict0mem.h | 2 + storage/innobase/include/row0upd.h | 12 +++++ storage/innobase/include/trx0trx.h | 62 ++++++++++++++++++++-- storage/innobase/include/trx0types.h | 1 - storage/innobase/row/row0merge.cc | 1 - storage/innobase/row/row0mysql.cc | 13 ----- storage/innobase/trx/trx0rec.cc | 23 ++++++-- storage/innobase/trx/trx0roll.cc | 5 +- storage/innobase/trx/trx0trx.cc | 2 - 21 files changed, 185 insertions(+), 138 deletions(-) diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result index a24110013e8..fdceb98ce99 100644 --- a/mysql-test/suite/versioning/r/alter.result +++ b/mysql-test/suite/versioning/r/alter.result @@ -344,7 +344,6 @@ add period for system_time(trx_start, trx_end), add system versioning; call verify_vtq; No A B C D -1 1 1 1 1 show create table t; Table Create Table t CREATE TABLE `t` ( @@ -362,7 +361,6 @@ No A B C D alter table t add system versioning, algorithm=copy; call verify_vtq; No A B C D -1 1 1 1 1 show create table t; Table Create Table t CREATE TABLE `t` ( @@ -415,7 +413,6 @@ No A B C D alter table t add system versioning, algorithm=inplace; call verify_vtq; No A B C D -1 1 1 1 1 show create table t; Table Create Table t CREATE TABLE `t` ( diff --git a/sql/handler.cc b/sql/handler.cc index d2d7b09baae..c6837fd5bd0 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1414,15 +1414,31 @@ int ha_commit_trans(THD *thd, bool all) goto err; } - if (rw_trans || thd->lex->sql_command == SQLCOM_ALTER_TABLE) + if (rw_trans && use_transaction_registry) { - if (use_transaction_registry && thd->vers_update_trt) + ulonglong trx_start_id= 0, trx_end_id= 0; + for (Ha_trx_info *ha_info= trans->ha_list; ha_info; + ha_info= ha_info->next()) { + if (ulonglong (*prepare)(THD*,ulonglong*)= ha_info->ht()-> + prepare_commit_versioned) + { + trx_end_id= prepare(thd, &trx_start_id); + if (trx_end_id) + break; // FIXME: use a common ID for cross-engine transactions + } + } + + if (trx_end_id) + { + DBUG_ASSERT(trx_start_id); TR_table trt(thd, true); - if (trt.update()) + if (trt.update(trx_start_id, trx_end_id)) goto err; - if (all) +#if 1 // FIXME: fix this properly, and remove TR_table::was_updated() + if (all) // avoid a crash in versioning.rpl_stmt commit_one_phase_2(thd, false, &thd->transaction.stmt, false); +#endif } } diff --git a/sql/handler.h b/sql/handler.h index 29bf7a65e4b..9e04453589d 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -980,7 +980,6 @@ struct handler_iterator { class handler; class group_by_handler; struct Query; -class TR_table; typedef class st_select_lex SELECT_LEX; typedef struct st_order ORDER; @@ -1390,10 +1389,12 @@ struct handlerton /* System Versioning */ - /** Fill TRT record for update. - @param[out] trt TRT table which record[0] will be filled with - transaction data. */ - void (*vers_get_trt_data)(TR_table &trt); + /** Determine if system-versioned data was modified by the transaction. + @param[in,out] thd current session + @param[out] trx_id transaction start ID + @return transaction commit ID + @retval 0 if no system-versioned data was affected by the transaction */ + ulonglong (*prepare_commit_versioned)(THD *thd, ulonglong *trx_id); }; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 76875836462..94898628827 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -710,11 +710,6 @@ extern "C" void thd_kill_timeout(THD* thd) mysql_mutex_unlock(&thd->LOCK_thd_data); } -void thd_vers_update_trt(THD * thd, bool value) -{ - thd->vers_update_trt= value; -} - THD::THD(my_thread_id id, bool is_wsrep_applier) :Statement(&main_lex, &main_mem_root, STMT_CONVENTIONAL_EXECUTION, /* statement id */ 0), @@ -1347,8 +1342,6 @@ void THD::init(void) wsrep_skip_wsrep_GTID = false; #endif /* WITH_WSREP */ - vers_update_trt = false; - if (variables.sql_log_bin) variables.option_bits|= OPTION_BIN_LOG; else diff --git a/sql/sql_class.h b/sql/sql_class.h index 6fda5c624d6..f7fbda7dc61 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4565,10 +4565,6 @@ public: /* Handling of timeouts for commands */ thr_timer_t query_timer; - // Storage engine may set this to true is we want to write a row to - // transaction_registry table on transaction commit. - bool vers_update_trt; - public: void set_query_timer() { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9b4a56e9d9c..300a75ffe77 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -7442,10 +7442,16 @@ static bool mysql_inplace_alter_table(THD *thd, { TR_table trt(thd, true); - if (thd->vers_update_trt && trt != *table_list) + if (trt == *table_list || !use_transaction_registry); + else if (ulonglong (*prepare)(THD*,ulonglong*)= table->file->ht-> + prepare_commit_versioned) { - if (use_transaction_registry && trt.update()) - return true; + ulonglong trx_start_id, trx_end_id= prepare(thd, &trx_start_id); + if (trx_end_id && trt.update(trx_start_id, trx_end_id)) + { + my_error(ER_UNKNOWN_ERROR, MYF(0)); + goto rollback; + } } if (table->file->ha_commit_inplace_alter_table(altered_table, diff --git a/sql/table.cc b/sql/table.cc index fe169357d0c..e22bda7a351 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -8525,23 +8525,6 @@ void TR_table::store(uint field_id, timeval ts) table->field[field_id]->set_notnull(); } -void TR_table::store_data(ulonglong trx_id, ulonglong commit_id, timeval commit_ts) -{ - timeval start_time= {static_cast(thd->start_time), - static_cast(thd->start_time_sec_part)}; - store(FLD_TRX_ID, trx_id); - store(FLD_COMMIT_ID, commit_id); - store(FLD_BEGIN_TS, start_time); - if (thd->start_time_ge(commit_ts.tv_sec, commit_ts.tv_usec)) - { - thd->start_time_inc(); - commit_ts.tv_sec= thd->start_time; - commit_ts.tv_usec= thd->start_time_sec_part; - } - store(FLD_COMMIT_TS, commit_ts); - store_iso_level(thd->tx_isolation); -} - enum_tx_isolation TR_table::iso_level() const { enum_tx_isolation res= (enum_tx_isolation) ((*this)[FLD_ISO_LEVEL]->val_int() - 1); @@ -8549,24 +8532,23 @@ enum_tx_isolation TR_table::iso_level() const return res; } -bool TR_table::update() +bool TR_table::update(ulonglong start_id, ulonglong end_id) { if (!table && open()) return true; - DBUG_ASSERT(table->s); - handlerton *hton= table->s->db_type(); - DBUG_ASSERT(hton); - DBUG_ASSERT(hton->flags & HTON_NATIVE_SYS_VERSIONING); - DBUG_ASSERT(thd->vers_update_trt); + timeval start_time= {thd->start_time, long(thd->start_time_sec_part)}; + thd->set_current_time(); + timeval end_time= {thd->start_time, long(thd->start_time_sec_part)}; + store(FLD_TRX_ID, start_id); + store(FLD_COMMIT_ID, end_id); + store(FLD_BEGIN_TS, start_time); + store(FLD_COMMIT_TS, end_time); + store_iso_level(thd->tx_isolation); - hton->vers_get_trt_data(*this); int error= table->file->ha_write_row(table->record[0]); if (error) - { table->file->print_error(error, MYF(0)); - } - thd->vers_update_trt= false; return error; } diff --git a/sql/table.h b/sql/table.h index 37232e876ea..6d4c734df1c 100644 --- a/sql/table.h +++ b/sql/table.h @@ -2983,26 +2983,15 @@ public: */ void store(uint field_id, timeval ts); /** - Stores value to internal transaction_registry TABLE object. + Update the transaction_registry right before commit. + @param start_id transaction identifier at start + @param end_id transaction identifier at commit - @param[in] current (InnoDB) transaction id - @param[in] InnoDB transaction counter at the time of transaction commit - @param[in] transaction commit timestamp - */ - void store_data(ulonglong trx_id, ulonglong commit_id, timeval commit_ts); - /** - Writes a row from internal TABLE object to transaction_registry table. - - @retval true on error, false otherwise. - */ - bool update(); - /** - Checks whether a row with specified transaction_id exists in a - transaction_registry table. - - @param[in] transacton_id value - @retval true if exists, false it not exists or an error occured - */ + @retval false on success + @retval true on error (the transaction must be rolled back) + */ + bool update(ulonglong start_id, ulonglong end_id); + // return true if found; false if not found or error bool query(ulonglong trx_id); /** Gets a row from transaction_registry with the closest commit_timestamp to diff --git a/sql/vtmd.cc b/sql/vtmd.cc index ad03ea02156..6a516178324 100644 --- a/sql/vtmd.cc +++ b/sql/vtmd.cc @@ -255,11 +255,13 @@ err: } quit: - if (!result && use_transaction_registry) + if (result || !use_transaction_registry); + else if (ulonglong (*prepare)(THD*,ulonglong*)= vtmd.table->file->ht-> + prepare_commit_versioned) { - DBUG_ASSERT(thd->vers_update_trt); TR_table trt(thd, true); - result= trt.update(); + ulonglong trx_start_id, trx_end_id= prepare(thd, &trx_start_id); + result= trx_end_id && trt.update(trx_start_id, trx_end_id); } close_log_table(thd, &open_tables_backup); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index fa77f42516e..7f21b431aa2 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3623,22 +3623,37 @@ static const char* ha_innobase_exts[] = { NullS }; -void innodb_get_trt_data(TR_table& trt) { - THD* thd = trt.get_thd(); - trx_t* trx = thd_to_trx(thd); - ut_a(trx); - ut_a(trx->vers_update_trt); - mutex_enter(&trx_sys->mutex); - trx_id_t commit_id = trx_sys_get_new_trx_id(); - ulint sec = 0; - ulint usec = 0; - ut_usectime(&sec, &usec); - mutex_exit(&trx_sys->mutex); +/** Determine if system-versioned data was modified by the transaction. +@param[in,out] thd current session +@param[out] trx_id transaction start ID +@return transaction commit ID +@retval 0 if no system-versioned data was affected by the transaction */ +static ulonglong innodb_prepare_commit_versioned(THD* thd, ulonglong *trx_id) +{ + if (const trx_t* trx = thd_to_trx(thd)) { + *trx_id = trx->id; - // silent downgrade cast warning on win64 - timeval commit_ts = {static_cast(sec), static_cast(usec)}; - trt.store_data(trx->id, commit_id, commit_ts); - trx->vers_update_trt = false; + for (trx_mod_tables_t::const_iterator t + = trx->mod_tables.begin(); + t != trx->mod_tables.end(); t++) { + if (t->second.is_versioned()) { + DBUG_ASSERT(t->first->versioned()); + DBUG_ASSERT(trx->undo_no); + DBUG_ASSERT(trx->rsegs.m_redo.rseg); + + mutex_enter(&trx_sys->mutex); + trx_id_t commit_id = trx_sys_get_new_trx_id(); + mutex_exit(&trx_sys->mutex); + + return commit_id; + } + } + + return 0; + } + + *trx_id = 0; + return 0; } /*********************************************************************//** @@ -3709,7 +3724,8 @@ innobase_init( innobase_hton->table_options = innodb_table_option_list; /* System Versioning */ - innobase_hton->vers_get_trt_data = innodb_get_trt_data; + innobase_hton->prepare_commit_versioned + = innodb_prepare_commit_versioned; innodb_remember_check_sysvar_funcs(); @@ -4894,8 +4910,6 @@ innobase_rollback_to_savepoint( dberr_t error = trx_rollback_to_savepoint_for_mysql( trx, name, &mysql_binlog_cache_pos); - thd_vers_update_trt(thd, trx->vers_update_trt); - if (error == DB_SUCCESS && trx->fts_trx != NULL) { fts_savepoint_rollback(trx, name); } @@ -8376,10 +8390,6 @@ no_commit: /* Step-5: Execute insert graph that will result in actual insert. */ error = row_insert_for_mysql((byte*) record, m_prebuilt, vers_set_fields); - if (m_prebuilt->trx->vers_update_trt) { - thd_vers_update_trt(m_user_thd, true); - } - DEBUG_SYNC(m_user_thd, "ib_after_row_insert"); /* Step-6: Handling of errors related to auto-increment. */ @@ -9199,10 +9209,6 @@ ha_innobase::update_row( } } - if (m_prebuilt->trx->vers_update_trt) { - thd_vers_update_trt(m_user_thd, true); - } - if (error == DB_SUCCESS && autoinc) { /* A value for an AUTO_INCREMENT column was specified in the UPDATE statement. */ @@ -9321,10 +9327,6 @@ ha_innobase::delete_row( error = row_update_for_mysql(m_prebuilt, vers_set_fields); - if (m_prebuilt->trx->vers_update_trt) { - thd_vers_update_trt(m_user_thd, true); - } - innobase_srv_conc_exit_innodb(m_prebuilt); /* Tell the InnoDB server that there might be work for diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index a0fe046eccd..fb3fb05103a 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -7090,10 +7090,6 @@ ok_exit: ctx->m_stage, add_v, eval_table, ha_alter_info->handler_flags & Alter_inplace_info::ALTER_DROP_HISTORICAL); - if (m_prebuilt->trx->vers_update_trt) { - thd_vers_update_trt(m_user_thd, true); - } - #ifndef DBUG_OFF oom: #endif /* !DBUG_OFF */ diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h index c08058f9730..a6a0c79f363 100644 --- a/storage/innobase/include/data0type.h +++ b/storage/innobase/include/data0type.h @@ -561,7 +561,9 @@ struct dtype_t{ mbminlen=DATA_MBMINLEN(mbminmaxlen); mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */ - /** @return whether this is system versioned */ + /** @return whether this is any system versioned field */ + bool is_any_versioned() const { return prtype & DATA_VERSIONED; } + /** @return whether this is system versioned user field */ bool is_versioned() const { return !(~prtype & DATA_VERSIONED); } /** @return whether this is the system version start */ bool is_version_start() const diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index f80aabade6c..1300fe6e3e3 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -653,6 +653,8 @@ struct dict_col_t{ /** @return whether NULL is an allowed value for this column */ bool is_nullable() const { return !(prtype & DATA_NOT_NULL); } + /** @return whether this is any system versioned field */ + bool is_any_versioned() const { return prtype & DATA_VERSIONED; } /** @return whether this is system versioned */ bool is_versioned() const { return !(~prtype & DATA_VERSIONED); } /** @return whether this is the system version start */ diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h index 1d10156b634..d375dcd9e70 100644 --- a/storage/innobase/include/row0upd.h +++ b/storage/innobase/include/row0upd.h @@ -484,6 +484,18 @@ struct upd_t{ return(false); } + /** Determine if the update affects a system versioned column. + @param[in] index the clustered index that is being updated */ + bool affects_versioned() const + { + for (ulint i = 0; i < n_fields; i++) { + if (fields[i].new_val.type.is_any_versioned()) { + return true; + } + } + return false; + } + #ifdef UNIV_DEBUG bool validate() const { diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 0320302538b..9f3db61aa2e 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -779,13 +779,70 @@ struct trx_lock_t { bool start_stmt; }; +/** Logical first modification time of a table in a transaction */ +class trx_mod_table_time_t +{ + /** First modification of the table */ + undo_no_t first; + /** First modification of a system versioned column */ + undo_no_t first_versioned; + + /** Magic value signifying that a system versioned column of a + table was never modified in a transaction. */ + static const undo_no_t UNVERSIONED = IB_ID_MAX; + +public: + /** Constructor + @param[in] rows number of modified rows so far */ + trx_mod_table_time_t(undo_no_t rows) + : first(rows), first_versioned(UNVERSIONED) {} + +#ifdef UNIV_DEBUG + /** Validation + @param[in] rows number of modified rows so far + @return whether the object is valid */ + bool valid(undo_no_t rows = UNVERSIONED) const + { + return first <= first_versioned && first <= rows; + } +#endif /* UNIV_DEBUG */ + /** @return if versioned columns were modified */ + bool is_versioned() const { return first_versioned != UNVERSIONED; } + + /** After writing an undo log record, set is_versioned() if needed + @param[in] rows number of modified rows so far */ + void set_versioned(undo_no_t rows) + { + ut_ad(!is_versioned()); + first_versioned = rows; + ut_ad(valid()); + } + + /** Invoked after partial rollback + @param[in] limit number of surviving modified rows + @return whether this should be erased from trx_t::mod_tables */ + bool rollback(undo_no_t limit) + { + ut_ad(valid()); + if (first >= limit) { + return true; + } + + if (first_versioned < limit && is_versioned()) { + first_versioned = UNVERSIONED; + } + + return false; + } +}; + /** Collection of persistent tables and their first modification in a transaction. We store pointers to the table objects in memory because we know that a table object will not be destroyed while a transaction that modified it is running. */ typedef std::map< - dict_table_t*, undo_no_t, + dict_table_t*, trx_mod_table_time_t, std::less, ut_allocator > trx_mod_tables_t; @@ -1269,9 +1326,6 @@ struct trx_t { os_event_t wsrep_event; /* event waited for in srv_conc_slot */ #endif /* WITH_WSREP */ - /* System Versioning */ - bool vers_update_trt; - /*!< Notify TRT on System Versioned write */ ulint magic_n; /** @return whether any persistent undo log has been generated */ diff --git a/storage/innobase/include/trx0types.h b/storage/innobase/include/trx0types.h index 1bf07763015..be8ef3398ad 100644 --- a/storage/innobase/include/trx0types.h +++ b/storage/innobase/include/trx0types.h @@ -143,7 +143,6 @@ typedef ib_id_t undo_no_t; /** Transaction savepoint */ struct trx_savept_t{ undo_no_t least_undo_no; /*!< least undo number to undo */ - bool vers_update_trt; /*!< Notify TRT for System Versioned write */ }; /** File objects */ diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index ab23edd0fc6..7dd15325369 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2328,7 +2328,6 @@ end_of_index: dtuple_get_nth_field(row, new_table->vers_end); dfield_set_data(start, new_sys_trx_start, 8); dfield_set_data(end, new_sys_trx_end, 8); - trx->vers_update_trt = true; } write_buffers: diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index ee96940e9ff..94ad5f1b7de 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -1586,10 +1586,6 @@ error_exit: node->duplicate = NULL; - if (node->table->versioned() && ins_mode != ROW_INS_NORMAL) { - trx->vers_update_trt = true; - } - if (dict_table_has_fts_index(table)) { doc_id_t doc_id; @@ -2227,15 +2223,6 @@ run_again: prebuilt->table->stat_modified_counter++; } - if (node->table->versioned() - && (node->versioned - || node->vers_delete - // TODO: improve this check (check if we touch only - // unversioned fields in foreigh table) - || node->foreign)) { - trx->vers_update_trt = true; - } - trx->op_info = ""; que_thr_stop_for_mysql_no_error(thr, trx); diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index ac116a572a8..be93f5d8f45 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -2013,10 +2013,25 @@ trx_undo_report_row_operation( mutex_exit(&trx->undo_mutex); if (!is_temp) { - trx->mod_tables.insert( - trx_mod_tables_t::value_type( - index->table, - undo->top_undo_no)); + const undo_no_t limit = undo->top_undo_no; + /* Determine if this is the first time + when this transaction modifies a + system-versioned column in this table. */ + trx_mod_table_time_t& time + = trx->mod_tables.insert( + trx_mod_tables_t::value_type( + index->table, limit)) + .first->second; + ut_ad(time.valid(limit)); + + if (!time.is_versioned() + && index->table->versioned() + && (!rec /* INSERT */ + || !update /* DELETE */ + || update->affects_versioned())) { + + time.set_versioned(limit); + } } *roll_ptr = trx_undo_build_roll_ptr( diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index 30a1efdd251..3118aeb295b 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -130,13 +130,13 @@ trx_rollback_to_savepoint_low( for (trx_mod_tables_t::iterator i = trx->mod_tables.begin(); i != trx->mod_tables.end(); ) { trx_mod_tables_t::iterator j = i++; - if (j->second >= limit) { + ut_ad(j->second.valid()); + if (j->second.rollback(limit)) { trx->mod_tables.erase(j); } } trx->lock.que_state = TRX_QUE_RUNNING; MONITOR_INC(MONITOR_TRX_ROLLBACK_SAVEPOINT); - trx->vers_update_trt = savept->vers_update_trt; } ut_a(trx->error_state == DB_SUCCESS); @@ -626,7 +626,6 @@ trx_savept_take( trx_savept_t savept; savept.least_undo_no = trx->undo_no; - savept.vers_update_trt = trx->vers_update_trt; return(savept); } diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index dd990d984b7..91d28a2e9ab 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -150,8 +150,6 @@ trx_init( trx->check_unique_secondary = true; - trx->vers_update_trt = false; - trx->lock.n_rec_locks = 0; trx->dict_operation = TRX_DICT_OP_NONE;