Commit 041a32ab authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent b8c92d75
...@@ -3636,8 +3636,8 @@ static ulonglong innodb_prepare_commit_versioned(THD* thd, ulonglong *trx_id) ...@@ -3636,8 +3636,8 @@ static ulonglong innodb_prepare_commit_versioned(THD* thd, ulonglong *trx_id)
for (trx_mod_tables_t::const_iterator t for (trx_mod_tables_t::const_iterator t
= trx->mod_tables.begin(); = trx->mod_tables.begin();
t != trx->mod_tables.end(); t++) { t != trx->mod_tables.end(); t++) {
if (t->second.is_trx_versioned()) { if (t->second.is_versioned()) {
DBUG_ASSERT(t->first->versioned()); DBUG_ASSERT(t->first->versioned_by_id());
DBUG_ASSERT(trx->rsegs.m_redo.rseg); DBUG_ASSERT(trx->rsegs.m_redo.rseg);
mutex_enter(&trx_sys.mutex); mutex_enter(&trx_sys.mutex);
......
...@@ -1543,6 +1543,10 @@ struct dict_table_t { ...@@ -1543,6 +1543,10 @@ struct dict_table_t {
void add_to_cache(); void add_to_cache();
bool versioned() const { return vers_start || vers_end; } 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() void inc_fk_checks()
{ {
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
...@@ -699,7 +699,6 @@ class trx_mod_table_time_t ...@@ -699,7 +699,6 @@ class trx_mod_table_time_t
undo_no_t first; undo_no_t first;
/** First modification of a system versioned column */ /** First modification of a system versioned column */
undo_no_t first_versioned; undo_no_t first_versioned;
bool vers_by_trx;
/** Magic value signifying that a system versioned column of a /** Magic value signifying that a system versioned column of a
table was never modified in a transaction. */ table was never modified in a transaction. */
...@@ -709,8 +708,7 @@ class trx_mod_table_time_t ...@@ -709,8 +708,7 @@ class trx_mod_table_time_t
/** Constructor /** Constructor
@param[in] rows number of modified rows so far */ @param[in] rows number of modified rows so far */
trx_mod_table_time_t(undo_no_t rows) trx_mod_table_time_t(undo_no_t rows)
: first(rows), first_versioned(UNVERSIONED), : first(rows), first_versioned(UNVERSIONED) {}
vers_by_trx(false) {}
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/** Validation /** Validation
...@@ -723,18 +721,13 @@ class trx_mod_table_time_t ...@@ -723,18 +721,13 @@ class trx_mod_table_time_t
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/** @return if versioned columns were modified */ /** @return if versioned columns were modified */
bool is_versioned() const { return first_versioned != UNVERSIONED; } 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 /** After writing an undo log record, set is_versioned() if needed
@param[in] rows number of modified rows so far */ @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()); ut_ad(!is_versioned());
first_versioned = rows; first_versioned = rows;
vers_by_trx = by_trx_id;
ut_ad(valid()); ut_ad(valid());
} }
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
...@@ -2881,7 +2881,7 @@ row_merge_read_clustered_index( ...@@ -2881,7 +2881,7 @@ row_merge_read_clustered_index(
.insert(trx_mod_tables_t::value_type( .insert(trx_mod_tables_t::value_type(
const_cast<dict_table_t*>(new_table), 0)) const_cast<dict_table_t*>(new_table), 0))
.first->second; .first->second;
time.set_versioned(0, true); time.set_versioned(0);
} }
trx->op_info = ""; trx->op_info = "";
......
...@@ -2114,14 +2114,11 @@ trx_undo_report_row_operation( ...@@ -2114,14 +2114,11 @@ trx_undo_report_row_operation(
ut_ad(time.valid(limit)); ut_ad(time.valid(limit));
if (!time.is_versioned() if (!time.is_versioned()
&& index->table->versioned() && index->table->versioned_by_id()
&& (!rec /* INSERT */ && (!rec /* INSERT */
|| !update /* DELETE */ || !update /* DELETE */
|| update->affects_versioned())) || update->affects_versioned())) {
{ time.set_versioned(limit);
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);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment