~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/t/backup.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
# The server need to be started in $MYSQLTEST_VARDIR since it
 
3
# uses ../../std_data/
 
4
--source include/uses_vardir.inc
 
5
 
 
6
# Save the initial number of concurrent sessions
 
7
--source include/count_sessions.inc
 
8
 
 
9
#
 
10
# This test is a bit tricky as we can't use backup table to overwrite an old
 
11
# table
 
12
#
 
13
connect (con1,localhost,root,,);
 
14
connect (con2,localhost,root,,);
 
15
connection con1;
 
16
set SQL_LOG_BIN=0;
 
17
--disable_warnings
 
18
drop table if exists t1, t2, t3, t4;
 
19
--enable_warnings
 
20
create table t4(n int);
 
21
--replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
22
backup table t4 to '../../bogus';
 
23
backup table t4 to '../../tmp';
 
24
--replace_result ": 7" ": X" ": 17" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
25
backup table t4 to '../../tmp';
 
26
drop table t4;
 
27
restore table t4 from '../../tmp';
 
28
select count(*) from t4;
 
29
 
 
30
create table t1(n int);
 
31
insert into t1 values (23),(45),(67);
 
32
backup table t1 to '../../tmp';
 
33
drop table t1;
 
34
--replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
35
restore table t1 from '../../bogus';
 
36
restore table t1 from '../../tmp';
 
37
select n from t1;
 
38
create table t2(m int not null primary key);
 
39
create table t3(k int not null primary key);
 
40
insert into t2 values (123),(145),(167);
 
41
insert into t3 values (223),(245),(267);
 
42
backup table t2,t3 to '../../tmp';
 
43
drop table t1,t2,t3;
 
44
restore table t1,t2,t3 from '../../tmp';
 
45
select n from t1;
 
46
select m from t2;
 
47
select k from t3;
 
48
drop table t1,t2,t3,t4;
 
49
restore table t1 from '../../tmp';
 
50
connection con2;
 
51
rename table t1 to t5;
 
52
--send
 
53
lock tables t5 write;
 
54
connection con1;
 
55
--send
 
56
backup table t5 to '../../tmp';
 
57
connection con2;
 
58
reap;
 
59
unlock tables;
 
60
connection con1;
 
61
reap;
 
62
drop table t5;
 
63
connection default;
 
64
disconnect con1;
 
65
disconnect con2;
 
66
remove_file $MYSQLTEST_VARDIR/tmp/t1.MYD;
 
67
remove_file $MYSQLTEST_VARDIR/tmp/t2.MYD;
 
68
remove_file $MYSQLTEST_VARDIR/tmp/t3.MYD;
 
69
remove_file $MYSQLTEST_VARDIR/tmp/t4.MYD;
 
70
remove_file $MYSQLTEST_VARDIR/tmp/t5.MYD;
 
71
remove_file $MYSQLTEST_VARDIR/tmp/t1.frm;
 
72
remove_file $MYSQLTEST_VARDIR/tmp/t2.frm;
 
73
remove_file $MYSQLTEST_VARDIR/tmp/t3.frm;
 
74
remove_file $MYSQLTEST_VARDIR/tmp/t4.frm;
 
75
remove_file $MYSQLTEST_VARDIR/tmp/t5.frm;
 
76
 
 
77
 
 
78
# End of 4.1 tests
 
79
# End of 5.0 tests
 
80
 
 
81
#
 
82
# Bug#18775 - Temporary table from alter table visible to other threads
 
83
#
 
84
# Backup did not encode table names.
 
85
--disable_warnings
 
86
DROP TABLE IF EXISTS `t+1`;
 
87
--enable_warnings
 
88
CREATE  TABLE `t+1` (c1 INT);
 
89
INSERT  INTO  `t+1` VALUES (1), (2), (3);
 
90
BACKUP  TABLE `t+1` TO '../../tmp';
 
91
DROP    TABLE `t+1`;
 
92
#
 
93
# Same for restore.
 
94
RESTORE TABLE `t+1` FROM '../../tmp';
 
95
SELECT * FROM `t+1`;
 
96
DROP    TABLE `t+1`;
 
97
#
 
98
remove_file $MYSQLTEST_VARDIR/tmp/t@002b1.frm;
 
99
remove_file $MYSQLTEST_VARDIR/tmp/t@002b1.MYD;
 
100
 
 
101
 
 
102
# Wait till all disconnects are completed
 
103
--source include/wait_until_count_sessions.inc
 
104