Debian Codegraph @

mysql-test/suite/innodb/t/bug33788578_incorrect_instant_field.test

raw
1 --source include/have_debug.inc
2 --source include/have_debug_sync.inc
3
4 --disable_query_log
5 call mtr.add_suppression("\\[Error\\] .*MY-\\d+.* Unexpected INSTANTLY Added / Dropped *");
6 call mtr.add_suppression("\\[Error\\] .*MY-\\d+.* We detected index corruption in an InnoDB *");
7 --enable_query_log
8
9 CREATE TABLE t1 (a TEXT) ENGINE=INNODB;
10 INSERT INTO t1 (a) VALUES ('foo');
11
12 ALTER TABLE t1 ADD COLUMN b INT DEFAULT 0, algorithm=instant;
13 SELECT * FROM t1;
14
15 --let $table_name = t1
16
17 connect (con1,localhost,root,,);
18
19 connection con1;
20 SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL update_now WAIT_FOR update_done';
21 send;
22 ALTER TABLE t1 ADD PRIMARY KEY (b);
23
24 connection default;
25 SET DEBUG_SYNC='now WAIT_FOR update_now';
26
27 --source suite/innodb/include/print_instant_part_metadata.inc
28 SELECT * FROM t1;
29 SHOW CREATE TABLE t1;
30 CHECK TABLE t1;
31
32 --echo # Simulate incorrect instant field fetch when reading field from record written with primary index
33
34 SET DEBUG = '+d,incorrect_instant_add_drop_field_fetched';
35 --error ER_NOT_KEYFILE
36 UPDATE t1 SET b = 1;
37
38 SET DEBUG = '-d,incorrect_instant_add_drop_field_fetched';
39
40 --source suite/innodb/include/print_instant_part_metadata.inc
41 SELECT * FROM t1;
42 SHOW CREATE TABLE t1;
43 CHECK TABLE t1;
44 SET DEBUG_SYNC='now SIGNAL update_done';
45
46 connection con1;
47 --error ER_INDEX_CORRUPT
48 reap;
49
50 connection default;
51 disconnect con1;
52
53 --source suite/innodb/include/print_instant_part_metadata.inc
54 SELECT * FROM t1;
55 SHOW CREATE TABLE t1;
56 CHECK TABLE t1;
57 DROP TABLE t1;
58
59 --echo # Now we parse the server ERROR log and print the expected error message
60 --let $grep_pattern= Unexpected INSTANTLY Added / Dropped
61 --let $grep_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
62 --let $grep_output= print_count
63 --source include/grep_pattern.inc
64
65 --echo # Error message:
66
67 --let LOG= $grep_file
68 --let PATTERN= $grep_pattern
69 perl;
70 my $file = $ENV{'LOG'} or die "log file not set";
71 my $pattern = $ENV{'PATTERN'} or die "pattern not set";
72 my $result = "";
73 open(FILE, "$file") or die("Unable to open $file: $!\n");
74 while (<FILE>) {
75 my $line = $_;
76 if ($line =~ /$pattern/) {
77 $result = $result . $line;
78 $result =~ s/^[^E]*/[/;
79 last;
80 }
81 }
82 close(FILE) or die ("Unable to close $file: $!\n");
83 print $result;
84 EOF
85 --echo # End