diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-01-26 23:23:11 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-01-28 22:21:48 +0200 |
commit | 041a32abcdd9791761a15d93e77ff2ea7dbc9d7c (patch) | |
tree | 827c4375243f085d4e30f866f8bdf3d271c83a12 | |
parent | b8c92d752c34e51dbe8ed551542415e2481581d7 (diff) | |
download | mariadb-git-041a32abcdd9791761a15d93e77ff2ea7dbc9d7c.tar.gz |
Remove trx_mod_tables_t::vers_by_trx
Only invoke set_versioned() on trx_id versioned tables.
dict_table_t::versioned_by_id(): New accessor, to determine if
a table is system versioned by transaction ID.
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 4 | ||||
-rw-r--r-- | storage/innobase/include/dict0mem.h | 4 | ||||
-rw-r--r-- | storage/innobase/include/trx0trx.h | 13 | ||||
-rw-r--r-- | storage/innobase/row/row0merge.cc | 4 | ||||
-rw-r--r-- | storage/innobase/trx/trx0rec.cc | 9 |
5 files changed, 14 insertions, 20 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index cb38d5c72cc..5992ad0229b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3636,8 +3636,8 @@ static ulonglong innodb_prepare_commit_versioned(THD* thd, ulonglong *trx_id) for (trx_mod_tables_t::const_iterator t = trx->mod_tables.begin(); t != trx->mod_tables.end(); t++) { - if (t->second.is_trx_versioned()) { - DBUG_ASSERT(t->first->versioned()); + if (t->second.is_versioned()) { + DBUG_ASSERT(t->first->versioned_by_id()); DBUG_ASSERT(trx->rsegs.m_redo.rseg); mutex_enter(&trx_sys.mutex); diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 52bfc7b35ae..e9b60debbc9 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1543,6 +1543,10 @@ struct dict_table_t { void add_to_cache(); bool versioned() const { return vers_start || vers_end; } + bool versioned_by_id() const + { + return vers_start && cols[vers_start].mtype == DATA_INT; + } void inc_fk_checks() { diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 23c01ec7854..adf54fa9bbc 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2017, MariaDB Corporation. +Copyright (c) 2015, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -699,7 +699,6 @@ class trx_mod_table_time_t undo_no_t first; /** First modification of a system versioned column */ undo_no_t first_versioned; - bool vers_by_trx; /** Magic value signifying that a system versioned column of a table was never modified in a transaction. */ @@ -709,8 +708,7 @@ 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), - vers_by_trx(false) {} + : first(rows), first_versioned(UNVERSIONED) {} #ifdef UNIV_DEBUG /** Validation @@ -723,18 +721,13 @@ public: #endif /* UNIV_DEBUG */ /** @return if versioned columns were modified */ bool is_versioned() const { return first_versioned != UNVERSIONED; } - bool is_trx_versioned() const - { - return is_versioned() && vers_by_trx; - } /** 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, bool by_trx_id) + void set_versioned(undo_no_t rows) { ut_ad(!is_versioned()); first_versioned = rows; - vers_by_trx = by_trx_id; ut_ad(valid()); } diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index a71da05b9ca..0c0c10bb357 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. +Copyright (c) 2014, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -2881,7 +2881,7 @@ wait_again: .insert(trx_mod_tables_t::value_type( const_cast<dict_table_t*>(new_table), 0)) .first->second; - time.set_versioned(0, true); + time.set_versioned(0); } trx->op_info = ""; diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 70d17df53fa..c3f7d23f3ba 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -2114,14 +2114,11 @@ trx_undo_report_row_operation( ut_ad(time.valid(limit)); if (!time.is_versioned() - && index->table->versioned() + && index->table->versioned_by_id() && (!rec /* INSERT */ || !update /* DELETE */ - || update->affects_versioned())) - { - dict_col_t &col = index->table->cols[index->table->vers_start]; - bool by_trx_id = col.mtype == DATA_INT; - time.set_versioned(limit, by_trx_id); + || update->affects_versioned())) { + time.set_versioned(limit); } } |