summaryrefslogtreecommitdiff
path: root/mysql-test/suite/maria/t/maria-autozerofill.test
blob: 2f47d13ba50e9a21d477e8fa63082c4990fdb1b5 (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
# Test to verify that auto-zerofilling happens when a table is
# imported from a different Aria instance

# can't restart in embedded
--source include/not_embedded.inc
--source include/have_maria.inc

let $MARIA_LOG=.;

--disable_warnings
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
let $mms_tname=t;

connect (admin, localhost, root,,mysqltest,,);
--enable_reconnect

connection default;
use mysqltest;
--enable_reconnect

create table t1(a int) engine=aria;
insert into t1 values(1);
flush table t1;
# Check that table is not zerofilled, not movable
let $MYSQLD_DATADIR= `select @@datadir`;
--exec $MARIA_CHK -dv $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
perl;
    use strict;
    use warnings;
    my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/ariachk.txt";
    open(FILE, "<", $fname) or die;
    my @content= <FILE>;
    print grep(/Status:.*(zerofilled|movable)/, @content);
    print "create_rename_lsn has non-magic value\n" if grep(/create_rename \([0-9]+/, @content);
    close FILE;
EOF

# this will remove control file, so change the uuid of the Aria
# instance, thus t1 will appear as imported from elsewhere.

-- source include/maria_empty_logs.inc

disable_ps_protocol; # see aria-recover.test
replace_regex /Table.*t1/t1/ ;
select * from t1;
enable_ps_protocol;
flush table t1;

# Check that table is auto-zerofilled, movable
--exec $MARIA_CHK -dv $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
perl;
    use strict;
    use warnings;
    my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/ariachk.txt";
    open(FILE, "<", $fname) or die;
    my @content= <FILE>;
    print grep(/Status:.*zerofilled/, @content);
    print "create_rename_lsn has magic value\n" if grep(/create_rename \(0,0x2\)/, @content);
    close FILE;
EOF

# this will attach t1 to the current Aria instance
insert into t1 values(2);
flush table t1;

# Check that table is not zerofilled, not movable
--exec $MARIA_CHK -dv $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
perl;
    use strict;
    use warnings;
    my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/ariachk.txt";
    open(FILE, "<", $fname) or die;
    my @content= <FILE>;
    print grep(/Status:.*(zerofilled|movable)/, @content);
    print "create_rename_lsn has non-magic value\n" if grep(/create_rename \([0-9]+/, @content);
    close FILE;
EOF

drop database mysqltest;