Skip to content

Commit 041a32a

Browse files
committed
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.
1 parent b8c92d7 commit 041a32a

File tree

5 files changed

+14
-20
lines changed

5 files changed

+14
-20
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3636,8 +3636,8 @@ static ulonglong innodb_prepare_commit_versioned(THD* thd, ulonglong *trx_id)
36363636
for (trx_mod_tables_t::const_iterator t
36373637
= trx->mod_tables.begin();
36383638
t != trx->mod_tables.end(); t++) {
3639-
if (t->second.is_trx_versioned()) {
3640-
DBUG_ASSERT(t->first->versioned());
3639+
if (t->second.is_versioned()) {
3640+
DBUG_ASSERT(t->first->versioned_by_id());
36413641
DBUG_ASSERT(trx->rsegs.m_redo.rseg);
36423642

36433643
mutex_enter(&trx_sys.mutex);

storage/innobase/include/dict0mem.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,6 +1543,10 @@ struct dict_table_t {
15431543
void add_to_cache();
15441544

15451545
bool versioned() const { return vers_start || vers_end; }
1546+
bool versioned_by_id() const
1547+
{
1548+
return vers_start && cols[vers_start].mtype == DATA_INT;
1549+
}
15461550

15471551
void inc_fk_checks()
15481552
{

storage/innobase/include/trx0trx.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2015, 2017, MariaDB Corporation.
4+
Copyright (c) 2015, 2018, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -699,7 +699,6 @@ class trx_mod_table_time_t
699699
undo_no_t first;
700700
/** First modification of a system versioned column */
701701
undo_no_t first_versioned;
702-
bool vers_by_trx;
703702

704703
/** Magic value signifying that a system versioned column of a
705704
table was never modified in a transaction. */
@@ -709,8 +708,7 @@ class trx_mod_table_time_t
709708
/** Constructor
710709
@param[in] rows number of modified rows so far */
711710
trx_mod_table_time_t(undo_no_t rows)
712-
: first(rows), first_versioned(UNVERSIONED),
713-
vers_by_trx(false) {}
711+
: first(rows), first_versioned(UNVERSIONED) {}
714712

715713
#ifdef UNIV_DEBUG
716714
/** Validation
@@ -723,18 +721,13 @@ class trx_mod_table_time_t
723721
#endif /* UNIV_DEBUG */
724722
/** @return if versioned columns were modified */
725723
bool is_versioned() const { return first_versioned != UNVERSIONED; }
726-
bool is_trx_versioned() const
727-
{
728-
return is_versioned() && vers_by_trx;
729-
}
730724

731725
/** After writing an undo log record, set is_versioned() if needed
732726
@param[in] rows number of modified rows so far */
733-
void set_versioned(undo_no_t rows, bool by_trx_id)
727+
void set_versioned(undo_no_t rows)
734728
{
735729
ut_ad(!is_versioned());
736730
first_versioned = rows;
737-
vers_by_trx = by_trx_id;
738731
ut_ad(valid());
739732
}
740733

storage/innobase/row/row0merge.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2014, 2017, MariaDB Corporation.
4+
Copyright (c) 2014, 2018, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -2881,7 +2881,7 @@ row_merge_read_clustered_index(
28812881
.insert(trx_mod_tables_t::value_type(
28822882
const_cast<dict_table_t*>(new_table), 0))
28832883
.first->second;
2884-
time.set_versioned(0, true);
2884+
time.set_versioned(0);
28852885
}
28862886

28872887
trx->op_info = "";

storage/innobase/trx/trx0rec.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,14 +2114,11 @@ trx_undo_report_row_operation(
21142114
ut_ad(time.valid(limit));
21152115

21162116
if (!time.is_versioned()
2117-
&& index->table->versioned()
2117+
&& index->table->versioned_by_id()
21182118
&& (!rec /* INSERT */
21192119
|| !update /* DELETE */
2120-
|| update->affects_versioned()))
2121-
{
2122-
dict_col_t &col = index->table->cols[index->table->vers_start];
2123-
bool by_trx_id = col.mtype == DATA_INT;
2124-
time.set_versioned(limit, by_trx_id);
2120+
|| update->affects_versioned())) {
2121+
time.set_versioned(limit);
21252122
}
21262123
}
21272124

0 commit comments

Comments
 (0)