summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb_fts/t/versioning.test
blob: 286597fba3967acc3a79d4570c32a2fe45c5861a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
--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;