mariadb/mysql-test/suite/innodb_fts/t/versioning.test
Marko Mäkelä 72e2d1d220 MDEV-25004 Refactorings
* Avoid some pessimization
  * Slightly smaller upgrade dataset
  * Simplify vers_row_same_trx() and its caller
2022-12-27 00:02:02 +03:00

131 lines
3.7 KiB
Text

--source include/have_innodb.inc
--source include/have_gzip.inc
--source include/not_embedded.inc
# Combinations
#
# upgrade: test upgrade on prepared databases from std_data.
# prepare: requires $OLD_BINDIR, test upgrade and downgrade with old-version
# server. Also prepare std_data files during the run in the source
# directory (you just have to commit or reject them).
#
# Examples
#
# export OLD_BINDIR="/home/midenok/src/mariadb/10.3b/build"
# ./mtr innodb_fts.versioning,prepare
#
if ($MTR_COMBINATION_PREPARE)
{
if (!$OLD_BINDIR)
{
--skip Requires OLD_BINDIR parameter (see test comment)
}
}
--let $server_id= `select @@server_id`
--let $datadir= `select @@datadir`
--let $std_dir= $MYSQL_TEST_DIR/std_data/versioning
--let $restart_noprint= 3
--echo # Upgrade test
let $stopword_table= articles2;
if ($MTR_COMBINATION_PREPARE)
{
let $restart_bindir= $OLD_BINDIR;
--source include/restart_mysqld.inc
let $create_options= with system versioning;
let $basic_stage= create_table;
--source basic.inc
let $basic_stage= insert_1;
--source basic.inc
let $basic_stage= insert_2;
--source basic.inc
let $basic_stage= insert_3;
--source basic.inc
let $stopword_stage= create_table;
--source stopword.inc
eval insert into $stopword_table (title, body)
values ('test for stopwords','this is it...');
insert into user_stopword values("the");
delete from user_stopword;
insert into user_stopword values("this");
--source include/shutdown_mysqld.inc
--exec mkdir -p $std_dir
--exec cp -af $datadir/ibdata1 $datadir/test/*.frm $std_dir
# zero out the doublewrite buffer
--exec dd if=/dev/zero of=$std_dir/ibdata1 bs=16k seek=64 count=128 conv=notrunc
--exec gzip -9f $std_dir/ibdata1 $std_dir/*.frm
}
if ($MTR_COMBINATION_UPGRADE)
{
--disable_query_log
call mtr.add_suppression("InnoDB: Table `mysql`.\`innodb_(table|index)_stats`");
--enable_query_log
--source include/shutdown_mysqld.inc
--exec rm -f $datadir/test/*.ibd $datadir/ib*
--exec cp -af $std_dir/ibdata1.gz $datadir
--exec cp -af $std_dir/*.frm.gz $datadir/test
--exec gzip -df $datadir/ibdata1.gz $datadir/test/*.frm.gz
}
let $restart_bindir=;
--source include/start_mysqld.inc
--error ER_INDEX_CORRUPT
SELECT * FROM articles WHERE MATCH (title,body)
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
call mtr.add_suppression("test/articles.? contains 3 indexes inside InnoDB");
alter table articles force;
flush tables;
show create table articles;
let $basic_stage= select_1;
source basic.inc;
let $basic_stage= select_2;
source basic.inc;
let $basic_stage= select_3;
source basic.inc;
set global innodb_ft_server_stopword_table= "test/user_stopword";
let $stopword_stage= select_1;
--source stopword.inc
eval drop index idx on $stopword_table;
eval create fulltext index idx on $stopword_table(title, body);
--source stopword.inc
if ($MTR_COMBINATION_PREPARE)
{
--echo # Downgrade test
let $restart_bindir= $OLD_BINDIR;
--source include/restart_mysqld.inc
alter table articles force;
flush tables;
show create table articles;
let $basic_stage= select_1;
source basic.inc;
let $basic_stage= select_2;
source basic.inc;
let $basic_stage= select_3;
source basic.inc;
set global innodb_ft_server_stopword_table= "test/user_stopword";
let $stopword_stage= select_1;
# Downgrade faults with assertion "dict_index_get_n_unique(index) == 1"
# until we rebuilt the index:
eval drop index idx on $stopword_table;
eval create fulltext index idx on $stopword_table(title, body);
source stopword.inc;
let $restart_bindir=;
--source include/restart_mysqld.inc
}
--echo # Cleanup
eval drop tables articles, $stopword_table, user_stopword;
set global innodb_ft_server_stopword_table= default;