Skip to content

Commit

Permalink
SQL: don't update TRT when altered [#305, #302]
Browse files Browse the repository at this point in the history
Tests affected: main.mysqlcheck
  • Loading branch information
midenok committed Nov 17, 2017
1 parent ecf259c commit a4439fe
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
9 changes: 9 additions & 0 deletions mysql-test/r/mysqlcheck.result
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
mysql.user OK
mysql.vtmd_template OK
mtr.global_suppressions Table is already up to date
Expand Down Expand Up @@ -66,6 +67,9 @@ mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry
note : Table does not support optimize, doing recreate + analyze instead
status : OK
mysql.user OK
mysql.vtmd_template
note : Table does not support optimize, doing recreate + analyze instead
Expand Down Expand Up @@ -97,6 +101,7 @@ mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
mysql.user OK
mysql.vtmd_template OK
mysql.column_stats Table is already up to date
Expand Down Expand Up @@ -130,6 +135,9 @@ mysql.time_zone_leap_second Table is already up to date
mysql.time_zone_name Table is already up to date
mysql.time_zone_transition Table is already up to date
mysql.time_zone_transition_type Table is already up to date
mysql.transaction_registry
note : Table does not support optimize, doing recreate + analyze instead
status : OK
mysql.user Table is already up to date
mysql.vtmd_template
note : Table does not support optimize, doing recreate + analyze instead
Expand Down Expand Up @@ -455,6 +463,7 @@ mysql.time_zone_leap_second Table is already up to date
mysql.time_zone_name Table is already up to date
mysql.time_zone_transition Table is already up to date
mysql.time_zone_transition_type Table is already up to date
mysql.transaction_registry OK
mysql.user Table is already up to date
mysql.vtmd_template OK
mysqltest1.t1
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7430,7 +7430,7 @@ static bool mysql_inplace_alter_table(THD *thd,

{
TR_table trt(thd, true);
if (table->file->native_versioned())
if (table->file->native_versioned() && trt != *table_list)
{
if (opt_transaction_registry && trt.update())
return true;
Expand Down
22 changes: 17 additions & 5 deletions sql/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -2961,6 +2961,15 @@ class TR_table: public TABLE_LIST
ulonglong commit_id1= 0, enum_tx_isolation iso_level1= ISO_READ_UNCOMMITTED,
ulonglong commit_id0= 0);

enum_tx_isolation iso_level() const;
void store_iso_level(enum_tx_isolation iso_level)
{
DBUG_ASSERT(iso_level <= ISO_SERIALIZABLE);
store(FLD_ISO_LEVEL, iso_level + 1);
}
bool check();

public:
TABLE * operator-> () const
{
return table;
Expand All @@ -2974,13 +2983,16 @@ class TR_table: public TABLE_LIST
{
return table;
}
enum_tx_isolation iso_level() const;
void store_iso_level(enum_tx_isolation iso_level)
bool operator== (TABLE_LIST &subj) const
{
DBUG_ASSERT(iso_level <= ISO_SERIALIZABLE);
store(FLD_ISO_LEVEL, iso_level + 1);
if (0 != strcmp(db, subj.db))
return false;
return (0 == strcmp(table_name, subj.table_name));
}
bool operator!= (TABLE_LIST &subj) const
{
return !(*this == subj);
}
bool check();
};

#endif /* MYSQL_CLIENT */
Expand Down

0 comments on commit a4439fe

Please sign in to comment.