summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-01-10 20:09:06 +0100
committerSergei Golubchik <serg@mariadb.org>2018-01-13 02:01:34 +0100
commit5d3bae242c6756fa57a34adb4ad56232566ef385 (patch)
tree3eb1996ac31018786c84b0117549326d31f9467a
parent376b0ea1da1514ca645ae4e275a412c1bc9d4b7d (diff)
downloadmariadb-git-5d3bae242c6756fa57a34adb4ad56232566ef385.tar.gz
remove dead VERS_EXPERIMENTAL code
changed to use DBUG keywords instead, so that the code is compiled and tested added tests.
-rw-r--r--mysql-test/suite/versioning/r/alter.result2
-rw-r--r--mysql-test/suite/versioning/r/debug.result39
-rw-r--r--mysql-test/suite/versioning/t/alter.test2
-rw-r--r--mysql-test/suite/versioning/t/debug.test29
-rw-r--r--sql/field.h4
-rw-r--r--sql/handler.cc16
-rw-r--r--sql/mysqld.cc5
-rw-r--r--sql/mysqld.h9
-rw-r--r--sql/sql_base.cc36
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_show.cc32
-rw-r--r--sql/sql_yacc.yy16
-rw-r--r--sql/sys_vars.cc15
13 files changed, 80 insertions, 129 deletions
diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result
index 8ebfb96ebc1..04d7139b207 100644
--- a/mysql-test/suite/versioning/r/alter.result
+++ b/mysql-test/suite/versioning/r/alter.result
@@ -388,7 +388,7 @@ alter table t modify column row_start bigint unsigned;
ERROR HY000: Can not change system versioning field `row_start`
set system_versioning_alter_history= SURVIVE;
ERROR 42000: Variable 'system_versioning_alter_history' can't be set to the value of 'SURVIVE'
-set system_versioning_alter_history= DROP;
+set system_versioning_alter_history= 'DROP';
ERROR 42000: Variable 'system_versioning_alter_history' can't be set to the value of 'DROP'
create or replace table t (a int) with system versioning;
alter table t add system versioning;
diff --git a/mysql-test/suite/versioning/r/debug.result b/mysql-test/suite/versioning/r/debug.result
new file mode 100644
index 00000000000..6e704011002
--- /dev/null
+++ b/mysql-test/suite/versioning/r/debug.result
@@ -0,0 +1,39 @@
+create table t1 (a int);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create temporary table tt1 (a int) with system versioning;
+ERROR HY000: System versioning prohibited for TEMPORARY tables
+set @old_dbug=@@global.debug_dbug;
+set global debug_dbug='+d,sysvers_force';
+create table t2 (a int);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
+create temporary table tt2 (a int) with system versioning;
+show create table tt2;
+Table Create Table
+tt2 CREATE TEMPORARY TABLE `tt2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+connect con1, localhost, root;
+create table t3 (a int);
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
+create temporary table tt3 (a int) with system versioning;
+show create table tt3;
+Table Create Table
+tt3 CREATE TEMPORARY TABLE `tt3` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+disconnect con1;
+connection default;
+set global debug_dbug=@old_dbug;
+drop table t1, t2, t3;
diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test
index 1394c3bc791..5e4efb036c6 100644
--- a/mysql-test/suite/versioning/t/alter.test
+++ b/mysql-test/suite/versioning/t/alter.test
@@ -272,7 +272,7 @@ alter table t modify column row_start bigint unsigned;
set system_versioning_alter_history= SURVIVE;
--error ER_WRONG_VALUE_FOR_VAR
-set system_versioning_alter_history= DROP;
+set system_versioning_alter_history= 'DROP';
if (0)
{
diff --git a/mysql-test/suite/versioning/t/debug.test b/mysql-test/suite/versioning/t/debug.test
new file mode 100644
index 00000000000..027af48fff5
--- /dev/null
+++ b/mysql-test/suite/versioning/t/debug.test
@@ -0,0 +1,29 @@
+--source include/have_debug.inc
+
+create table t1 (a int);
+show create table t1;
+
+--error ER_VERS_TEMPORARY
+create temporary table tt1 (a int) with system versioning;
+
+set @old_dbug=@@global.debug_dbug;
+set global debug_dbug='+d,sysvers_force';
+
+create table t2 (a int);
+show create table t2;
+
+create temporary table tt2 (a int) with system versioning;
+show create table tt2;
+
+--connect con1, localhost, root
+
+create table t3 (a int);
+show create table t3;
+
+create temporary table tt3 (a int) with system versioning;
+show create table tt3;
+--disconnect con1
+--connection default
+
+set global debug_dbug=@old_dbug;
+drop table t1, t2, t3;
diff --git a/sql/field.h b/sql/field.h
index 9fd584e88c2..549dc3d00d5 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1474,10 +1474,6 @@ public:
return flags & VERS_UPDATE_UNVERSIONED_FLAG;
}
-#ifdef VERS_EXPERIMENTAL
- bool vers_sys_invisible(THD *thd) const;
-#endif
-
virtual bool vers_trx_id() const
{
return false;
diff --git a/sql/handler.cc b/sql/handler.cc
index 5a008f0dbee..84cb550143c 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -6962,13 +6962,9 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields(
}
}
-#ifdef VERS_EXPERIMENTAL
- if (thd->variables.vers_force)
- {
- alter_info->flags|= Alter_info::ALTER_ADD_SYSTEM_VERSIONING;
- options|= HA_VERSIONED_TABLE;
- }
-#endif
+ DBUG_EXECUTE_IF("sysvers_force", if (!tmp_table()) {
+ alter_info->flags|= Alter_info::ALTER_ADD_SYSTEM_VERSIONING;
+ options|= HA_VERSIONED_TABLE; });
// Possibly override default storage engine to match one used in source table.
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,
if (!need_check(alter_info) && !share->versioned)
return false;
- if (share->tmp_table && share->tmp_table != INTERNAL_TMP_TABLE
-#ifdef VERS_EXPERIMENTAL
- && !thd->variables.vers_force
-#endif
- )
+ if (DBUG_EVALUATE_IF("sysvers_force", 0, share->tmp_table))
{
my_error(ER_VERS_TEMPORARY, MYF(0));
return true;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 321264e8d7b..067b2e70ba6 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -9852,11 +9852,6 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
if (thread_cache_size > max_connections)
SYSVAR_AUTOSIZE(thread_cache_size, max_connections);
-#ifdef VERS_EXPERIMENTAL
- if (opt_bootstrap)
- global_system_variables.vers_force= 0;
-#endif
-
return 0;
}
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 88a0fa00071..dd84adfdff3 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -200,15 +200,6 @@ struct vers_asof_timestamp_t
{}
};
-#ifdef VERS_EXPERIMENTAL
-enum vers_show_enum
-{
- VERS_SHOW_OFF= 0,
- VERS_SHOW_RANGE,
- VERS_SHOW_ALWAYS
-};
-#endif
-
enum vers_alter_history_enum
{
VERS_ALTER_HISTORY_ERROR= 0,
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 69b867da0cb..3c913f83530 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -7617,35 +7617,6 @@ bool get_key_map_from_key_list(key_map *map, TABLE *table,
}
-#ifdef VERS_EXPERIMENTAL
-inline
-bool Field::vers_sys_invisible(THD *thd) const
-{
- DBUG_ASSERT(vers_sys_field());
- DBUG_ASSERT(table);
- DBUG_ASSERT(table->versioned());
- DBUG_ASSERT(table->pos_in_table_list);
-
- if (thd->lex->sql_command != SQLCOM_SELECT)
- return invisible;
-
- switch (thd->variables.vers_show)
- {
- case VERS_SHOW_RANGE:
- {
- vers_system_time_t vers_type= table->pos_in_table_list->vers_conditions.type;
- return vers_type > SYSTEM_TIME_AS_OF ? false : invisible;
- }
- case VERS_SHOW_ALWAYS:
- return false;
- default:
- break;
- };
- return invisible;
-}
-#endif
-
-
/*
Drops in all fields instead of current '*' field
@@ -7775,12 +7746,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
Field_iterator_natural_join).
But view fields can never be invisible.
*/
- if ((field= field_iterator.field()) && (
-#ifdef VERS_EXPERIMENTAL
- field->vers_sys_field() && field->table->versioned() ?
- field->vers_sys_invisible(thd) :
-#endif
- field->invisible != VISIBLE))
+ if ((field= field_iterator.field()) && field->invisible != VISIBLE)
continue;
Item *item;
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 647f254a117..5469171f0e3 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -708,10 +708,6 @@ typedef struct system_variables
uint in_subquery_conversion_threshold;
vers_asof_timestamp_t vers_asof_timestamp;
-#ifdef VERS_EXPERIMENTAL
- my_bool vers_force;
- ulong vers_show;
-#endif
my_bool vers_innodb_algorithm_simple;
ulong vers_alter_history;
} SV;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 41cf8556e87..3fc0568d2a9 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2108,9 +2108,6 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
TABLE *table= table_list->table;
TABLE_SHARE *share= table->s;
sql_mode_t sql_mode= thd->variables.sql_mode;
-#ifdef VERS_EXPERIMENTAL
- ulong vers_show= thd->variables.vers_show;
-#endif
bool explicit_fields= false;
bool foreign_db_mode= sql_mode & (MODE_POSTGRESQL | MODE_ORACLE |
MODE_MSSQL | MODE_DB2 |
@@ -2192,11 +2189,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
uint flags = field->flags;
- if (field->invisible > INVISIBLE_USER
-#ifdef VERS_EXPERIMENTAL
- && !(field->vers_sys_field() && vers_show == VERS_SHOW_ALWAYS)
-#endif
- )
+ if (field->invisible > INVISIBLE_USER)
continue;
if (not_the_first_field)
packet->append(STRING_WITH_LEN(",\n"));
@@ -2344,11 +2337,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
for (uint j=0 ; j < key_info->user_defined_key_parts ; j++,key_part++)
{
Field *field= key_part->field;
- if (field->invisible > INVISIBLE_USER
-#ifdef VERS_EXPERIMENTAL
- && !(field->vers_sys_field() && vers_show == VERS_SHOW_ALWAYS)
-#endif
- )
+ if (field->invisible > INVISIBLE_USER)
continue;
if (j)
@@ -2387,11 +2376,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
DBUG_ASSERT(fe);
explicit_fields= fs->invisible < INVISIBLE_SYSTEM;
DBUG_ASSERT(!explicit_fields || fe->invisible < INVISIBLE_SYSTEM);
- if (explicit_fields
-#ifdef VERS_EXPERIMENTAL
- || vers_show == VERS_SHOW_ALWAYS
-#endif
- )
+ if (explicit_fields)
{
packet->append(STRING_WITH_LEN(",\n PERIOD FOR SYSTEM_TIME ("));
append_identifier(thd,packet,fs->field_name.str, fs->field_name.length);
@@ -2444,11 +2429,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
add_table_options(thd, table, create_info_arg,
table_list->schema_table != 0, 0, packet);
- if (table->versioned()
-#ifdef VERS_EXPERIMENTAL
- && (!thd->variables.vers_force || explicit_fields)
-#endif
- )
+ if (table->versioned())
packet->append(STRING_WITH_LEN(" WITH SYSTEM VERSIONING"));
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -5037,11 +5018,6 @@ public:
static bool get_all_archive_tables(THD *thd,
Dynamic_array<String> &all_archive_tables)
{
-#ifdef VERS_EXPERIMENTAL
- if (thd->variables.vers_show == VERS_SHOW_ALWAYS)
- return false;
-#endif
-
if (thd->variables.vers_alter_history != VERS_ALTER_HISTORY_SURVIVE)
return false;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 6eb53f70aaf..895248f4824 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -6229,9 +6229,7 @@ versioning_option:
{
if (Lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)
{
-#ifdef VERS_EXPERIMENTAL
- if (!thd->variables.vers_force)
-#endif
+ if (DBUG_EVALUATE_IF("sysvers_force", 0, 1))
{
my_error(ER_VERS_TEMPORARY, MYF(0));
MYSQL_YYABORT;
@@ -16161,18 +16159,6 @@ set_expr_or_default:
if ($$ == NULL)
MYSQL_YYABORT;
}
- | DROP
- {
- $$=new (thd->mem_root) Item_string_sys(thd, "DROP", 4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | RANGE_SYM
- {
- $$=new (thd->mem_root) Item_string_sys(thd, C_STRING_WITH_LEN("RANGE"));
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
;
/* Lock function */
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index d00f35e2028..94c77136993 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -396,21 +396,6 @@ static Sys_var_vers_asof Sys_vers_asof_timestamp(
SESSION_VAR(vers_asof_timestamp.type), NO_CMD_LINE,
Sys_var_vers_asof::asof_keywords, DEFAULT(SYSTEM_TIME_UNSPECIFIED));
-#ifdef VERS_EXPERIMENTAL
-static Sys_var_mybool Sys_vers_force(
- "debug_system_versioning_force", "Force system versioning for all created tables",
- SESSION_VAR(vers_force), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
-
-static const char *vers_show_keywords[]= {"OFF", "RANGE", "ALWAYS", NULL};
-static Sys_var_enum Sys_vers_show(
- "debug_system_versioning_show", "Show system fields special rules. "
- "OFF: don't use special show rules; "
- "RANGE: show implicit system fields only in range versioned queries; "
- "ALWAYS: show system fields in all queries",
- SESSION_VAR(vers_show), CMD_LINE(REQUIRED_ARG),
- vers_show_keywords, DEFAULT(VERS_SHOW_OFF));
-#endif
-
static Sys_var_mybool Sys_vers_innodb_algorithm_simple(
"system_versioning_innodb_algorithm_simple",
"Use simple algorithm of timestamp handling in InnoDB instead of TRX_SEES",