| 1 |
# Test to verify that auto-zerofilling happens when a table is |
| 2 |
# imported from a different Aria instance |
| 3 |
|
| 4 |
# can't restart in embedded |
| 5 |
--source include/not_embedded.inc |
| 6 |
--source include/have_maria.inc |
| 7 |
|
| 8 |
call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); |
| 9 |
|
| 10 |
let $MARIA_LOG=.; |
| 11 |
|
| 12 |
--disable_warnings |
| 13 |
drop database if exists mysqltest; |
| 14 |
--enable_warnings |
| 15 |
create database mysqltest; |
| 16 |
let $mms_tname=t; |
| 17 |
|
| 18 |
connect (admin, localhost, root,,mysqltest,,); |
| 19 |
--enable_reconnect |
| 20 |
|
| 21 |
connection default; |
| 22 |
use mysqltest; |
| 23 |
--enable_reconnect |
| 24 |
|
| 25 |
# Create some tables for future tests |
| 26 |
create table t1(a int) engine=aria; |
| 27 |
insert into t1 values(1); |
| 28 |
create table t2 (a int) engine=aria; |
| 29 |
INSERT INTO t2 VALUES (1),(2); |
| 30 |
create table t3 (a int) engine=aria; |
| 31 |
INSERT INTO t3 VALUES (1),(2); |
| 32 |
create table t4 (a int) engine=aria; |
| 33 |
INSERT INTO t4 VALUES (1),(2); |
| 34 |
create table t5 (a int) engine=aria; |
| 35 |
INSERT INTO t5 VALUES (1),(2); |
| 36 |
create table t6 (a int) engine=aria; |
| 37 |
INSERT INTO t6 VALUES (1),(2); |
| 38 |
flush tables; |
| 39 |
|
| 40 |
# Check that table is not zerofilled, not movable |
| 41 |
let $MYSQLD_DATADIR= `select @@datadir`; |
| 42 |
--exec $MARIA_CHK -dv --ignore-control-file $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/autozerofill.txt |
| 43 |
perl; |
| 44 |
use strict; |
| 45 |
use warnings; |
| 46 |
my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/autozerofill.txt"; |
| 47 |
open(FILE, "<", $fname) or die; |
| 48 |
my @content= <FILE>; |
| 49 |
print grep(/Status:.*(zerofilled|movable)/, @content); |
| 50 |
print "create_rename_lsn has non-magic value\n" if grep(/create_rename \([0-9]+/, @content); |
| 51 |
close FILE; |
| 52 |
EOF |
| 53 |
|
| 54 |
# this will remove control file, so change the uuid of the Aria |
| 55 |
# instance, thus t1 will appear as imported from elsewhere. |
| 56 |
|
| 57 |
-- source include/maria_empty_logs.inc |
| 58 |
|
| 59 |
disable_ps_protocol; # see aria-recover.test |
| 60 |
replace_regex /Table.*t1/t1/ ; |
| 61 |
replace_result \\ /; |
| 62 |
select * from t1; |
| 63 |
enable_ps_protocol; |
| 64 |
flush table t1; |
| 65 |
|
| 66 |
# Check that table is auto-zerofilled, movable |
| 67 |
--exec $MARIA_CHK -dv --ignore-control-file $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/autozerofill.txt |
| 68 |
perl; |
| 69 |
use strict; |
| 70 |
use warnings; |
| 71 |
my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/autozerofill.txt"; |
| 72 |
open(FILE, "<", $fname) or die; |
| 73 |
my @content= <FILE>; |
| 74 |
print grep(/Status:.*/, @content); |
| 75 |
print "create_rename_lsn has magic value\n" if grep(/create_rename \(0,0x2\)/, @content); |
| 76 |
close FILE; |
| 77 |
EOF |
| 78 |
|
| 79 |
# this will attach t1 to the current Aria instance |
| 80 |
insert into t1 values(2); |
| 81 |
flush table t1; |
| 82 |
|
| 83 |
# Check that table is not zerofilled, not movable |
| 84 |
--exec $MARIA_CHK -dv --ignore-control-file $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/autozerofill.txt |
| 85 |
perl; |
| 86 |
use strict; |
| 87 |
use warnings; |
| 88 |
my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/autozerofill.txt"; |
| 89 |
open(FILE, "<", $fname) or die; |
| 90 |
my @content= <FILE>; |
| 91 |
print grep(/Status:.*(zerofilled|movable)/, @content); |
| 92 |
print "create_rename_lsn has non-magic value\n" if grep(/create_rename \([0-9]+/, @content); |
| 93 |
close FILE; |
| 94 |
EOF |
| 95 |
|
| 96 |
--echo # |
| 97 |
--echo # BUG#44422 "mysql_upgrade destroys Maria tables?" |
| 98 |
--echo # Check repair and optimize of moved table |
| 99 |
--echo # |
| 100 |
|
| 101 |
# Table t2 is regarded as it would be from another server as we removed |
| 102 |
# the aria control file earlier |
| 103 |
check table t2; |
| 104 |
check table t2; |
| 105 |
repair table t2; |
| 106 |
check table t2; |
| 107 |
replace_result \\ /; |
| 108 |
optimize table t3; |
| 109 |
replace_result \\ /; |
| 110 |
analyze table t4; |
| 111 |
repair table t5; |
| 112 |
check table t5; |
| 113 |
repair table t5; |
| 114 |
check table t5; |
| 115 |
|
| 116 |
# Check that if we zerofill with aria_chk, we should not get any warnings when |
| 117 |
# accessing the table |
| 118 |
--error 0,1,11,139 |
| 119 |
--exec $MARIA_CHK --ignore-control-file --zerofill $MYSQLD_DATADIR/mysqltest/t6 >$MYSQLTEST_VARDIR/tmp/autozerofill.txt 2>&1 |
| 120 |
if ($sys_errno != 0) |
| 121 |
{ |
| 122 |
--cat_file $MYSQLTEST_VARDIR/tmp/autozerofill.txt |
| 123 |
--die |
| 124 |
} |
| 125 |
|
| 126 |
select * from t6; |
| 127 |
check table t6; |
| 128 |
|
| 129 |
drop database mysqltest; |