Skip to content

Commit 5d3bae2

Browse files
committed
remove dead VERS_EXPERIMENTAL code
changed to use DBUG keywords instead, so that the code is compiled and tested added tests.
1 parent 376b0ea commit 5d3bae2

File tree

13 files changed

+80
-129
lines changed

13 files changed

+80
-129
lines changed

mysql-test/suite/versioning/r/alter.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ alter table t modify column row_start bigint unsigned;
388388
ERROR HY000: Can not change system versioning field `row_start`
389389
set system_versioning_alter_history= SURVIVE;
390390
ERROR 42000: Variable 'system_versioning_alter_history' can't be set to the value of 'SURVIVE'
391-
set system_versioning_alter_history= DROP;
391+
set system_versioning_alter_history= 'DROP';
392392
ERROR 42000: Variable 'system_versioning_alter_history' can't be set to the value of 'DROP'
393393
create or replace table t (a int) with system versioning;
394394
alter table t add system versioning;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
create table t1 (a int);
2+
show create table t1;
3+
Table Create Table
4+
t1 CREATE TABLE `t1` (
5+
`a` int(11) DEFAULT NULL
6+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
7+
create temporary table tt1 (a int) with system versioning;
8+
ERROR HY000: System versioning prohibited for TEMPORARY tables
9+
set @old_dbug=@@global.debug_dbug;
10+
set global debug_dbug='+d,sysvers_force';
11+
create table t2 (a int);
12+
show create table t2;
13+
Table Create Table
14+
t2 CREATE TABLE `t2` (
15+
`a` int(11) DEFAULT NULL
16+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
17+
create temporary table tt2 (a int) with system versioning;
18+
show create table tt2;
19+
Table Create Table
20+
tt2 CREATE TEMPORARY TABLE `tt2` (
21+
`a` int(11) DEFAULT NULL
22+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
23+
connect con1, localhost, root;
24+
create table t3 (a int);
25+
show create table t3;
26+
Table Create Table
27+
t3 CREATE TABLE `t3` (
28+
`a` int(11) DEFAULT NULL
29+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
30+
create temporary table tt3 (a int) with system versioning;
31+
show create table tt3;
32+
Table Create Table
33+
tt3 CREATE TEMPORARY TABLE `tt3` (
34+
`a` int(11) DEFAULT NULL
35+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
36+
disconnect con1;
37+
connection default;
38+
set global debug_dbug=@old_dbug;
39+
drop table t1, t2, t3;

mysql-test/suite/versioning/t/alter.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ alter table t modify column row_start bigint unsigned;
272272
set system_versioning_alter_history= SURVIVE;
273273

274274
--error ER_WRONG_VALUE_FOR_VAR
275-
set system_versioning_alter_history= DROP;
275+
set system_versioning_alter_history= 'DROP';
276276

277277
if (0)
278278
{
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--source include/have_debug.inc
2+
3+
create table t1 (a int);
4+
show create table t1;
5+
6+
--error ER_VERS_TEMPORARY
7+
create temporary table tt1 (a int) with system versioning;
8+
9+
set @old_dbug=@@global.debug_dbug;
10+
set global debug_dbug='+d,sysvers_force';
11+
12+
create table t2 (a int);
13+
show create table t2;
14+
15+
create temporary table tt2 (a int) with system versioning;
16+
show create table tt2;
17+
18+
--connect con1, localhost, root
19+
20+
create table t3 (a int);
21+
show create table t3;
22+
23+
create temporary table tt3 (a int) with system versioning;
24+
show create table tt3;
25+
--disconnect con1
26+
--connection default
27+
28+
set global debug_dbug=@old_dbug;
29+
drop table t1, t2, t3;

sql/field.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,10 +1474,6 @@ class Field: public Value_source
14741474
return flags & VERS_UPDATE_UNVERSIONED_FLAG;
14751475
}
14761476

1477-
#ifdef VERS_EXPERIMENTAL
1478-
bool vers_sys_invisible(THD *thd) const;
1479-
#endif
1480-
14811477
virtual bool vers_trx_id() const
14821478
{
14831479
return false;

sql/handler.cc

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6962,13 +6962,9 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields(
69626962
}
69636963
}
69646964

6965-
#ifdef VERS_EXPERIMENTAL
6966-
if (thd->variables.vers_force)
6967-
{
6968-
alter_info->flags|= Alter_info::ALTER_ADD_SYSTEM_VERSIONING;
6969-
options|= HA_VERSIONED_TABLE;
6970-
}
6971-
#endif
6965+
DBUG_EXECUTE_IF("sysvers_force", if (!tmp_table()) {
6966+
alter_info->flags|= Alter_info::ALTER_ADD_SYSTEM_VERSIONING;
6967+
options|= HA_VERSIONED_TABLE; });
69726968

69736969
// Possibly override default storage engine to match one used in source table.
69746970
if (vers_tables && alter_info->flags & Alter_info::ALTER_ADD_SYSTEM_VERSIONING &&
@@ -7183,11 +7179,7 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
71837179
if (!need_check(alter_info) && !share->versioned)
71847180
return false;
71857181

7186-
if (share->tmp_table && share->tmp_table != INTERNAL_TMP_TABLE
7187-
#ifdef VERS_EXPERIMENTAL
7188-
&& !thd->variables.vers_force
7189-
#endif
7190-
)
7182+
if (DBUG_EVALUATE_IF("sysvers_force", 0, share->tmp_table))
71917183
{
71927184
my_error(ER_VERS_TEMPORARY, MYF(0));
71937185
return true;

sql/mysqld.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9852,11 +9852,6 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
98529852
if (thread_cache_size > max_connections)
98539853
SYSVAR_AUTOSIZE(thread_cache_size, max_connections);
98549854

9855-
#ifdef VERS_EXPERIMENTAL
9856-
if (opt_bootstrap)
9857-
global_system_variables.vers_force= 0;
9858-
#endif
9859-
98609855
return 0;
98619856
}
98629857

sql/mysqld.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,6 @@ struct vers_asof_timestamp_t
200200
{}
201201
};
202202

203-
#ifdef VERS_EXPERIMENTAL
204-
enum vers_show_enum
205-
{
206-
VERS_SHOW_OFF= 0,
207-
VERS_SHOW_RANGE,
208-
VERS_SHOW_ALWAYS
209-
};
210-
#endif
211-
212203
enum vers_alter_history_enum
213204
{
214205
VERS_ALTER_HISTORY_ERROR= 0,

sql/sql_base.cc

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7617,35 +7617,6 @@ bool get_key_map_from_key_list(key_map *map, TABLE *table,
76177617
}
76187618

76197619

7620-
#ifdef VERS_EXPERIMENTAL
7621-
inline
7622-
bool Field::vers_sys_invisible(THD *thd) const
7623-
{
7624-
DBUG_ASSERT(vers_sys_field());
7625-
DBUG_ASSERT(table);
7626-
DBUG_ASSERT(table->versioned());
7627-
DBUG_ASSERT(table->pos_in_table_list);
7628-
7629-
if (thd->lex->sql_command != SQLCOM_SELECT)
7630-
return invisible;
7631-
7632-
switch (thd->variables.vers_show)
7633-
{
7634-
case VERS_SHOW_RANGE:
7635-
{
7636-
vers_system_time_t vers_type= table->pos_in_table_list->vers_conditions.type;
7637-
return vers_type > SYSTEM_TIME_AS_OF ? false : invisible;
7638-
}
7639-
case VERS_SHOW_ALWAYS:
7640-
return false;
7641-
default:
7642-
break;
7643-
};
7644-
return invisible;
7645-
}
7646-
#endif
7647-
7648-
76497620
/*
76507621
Drops in all fields instead of current '*' field
76517622
@@ -7775,12 +7746,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
77757746
Field_iterator_natural_join).
77767747
But view fields can never be invisible.
77777748
*/
7778-
if ((field= field_iterator.field()) && (
7779-
#ifdef VERS_EXPERIMENTAL
7780-
field->vers_sys_field() && field->table->versioned() ?
7781-
field->vers_sys_invisible(thd) :
7782-
#endif
7783-
field->invisible != VISIBLE))
7749+
if ((field= field_iterator.field()) && field->invisible != VISIBLE)
77847750
continue;
77857751

77867752
Item *item;

sql/sql_class.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -708,10 +708,6 @@ typedef struct system_variables
708708
uint in_subquery_conversion_threshold;
709709

710710
vers_asof_timestamp_t vers_asof_timestamp;
711-
#ifdef VERS_EXPERIMENTAL
712-
my_bool vers_force;
713-
ulong vers_show;
714-
#endif
715711
my_bool vers_innodb_algorithm_simple;
716712
ulong vers_alter_history;
717713
} SV;

0 commit comments

Comments
 (0)