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

« back to all changes in this revision

Viewing changes to mysql-test/t/mysql_upgrade.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
# Can't run test of external client with embedded server
 
2
-- source include/not_embedded.inc
 
3
 
 
4
# Only run test if "mysql_upgrade" is found
 
5
--require r/have_mysql_upgrade.result
 
6
--disable_query_log
 
7
select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
 
8
--enable_query_log
 
9
 
 
10
#
 
11
# Hack:
 
12
#
 
13
# If running with Valgrind ($VALGRIND_TEST <> 0) then the resource
 
14
# consumption (CPU) for upgrading a large log table will be intense.
 
15
# Therefore, truncate the log table in advance and issue a statement
 
16
# that should be logged.
 
17
#
 
18
if (`SELECT $VALGRIND_TEST`)
 
19
{
 
20
  --disable_query_log
 
21
  --disable_result_log
 
22
  --disable_abort_on_error
 
23
  TRUNCATE TABLE mysql.general_log;
 
24
  SELECT 1;
 
25
  --enable_abort_on_error
 
26
  --enable_result_log
 
27
  --enable_query_log
 
28
}
 
29
 
 
30
#
 
31
# Basic test that we can run mysql_upgrde and that it finds the
 
32
# expected binaries it uses.
 
33
#
 
34
--echo Run mysql_upgrade once
 
35
--exec $MYSQL_UPGRADE --skip-verbose 2>&1
 
36
 
 
37
# It should have created a file in the MySQL Servers datadir
 
38
let $MYSQLD_DATADIR= `select @@datadir`;
 
39
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
 
40
 
 
41
--echo Run it again - should say already completed
 
42
--replace_result $MYSQL_SERVER_VERSION VERSION
 
43
--error 1
 
44
--exec $MYSQL_UPGRADE --skip-verbose 2>&1
 
45
 
 
46
# It should have created a file in the MySQL Servers datadir
 
47
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
 
48
 
 
49
--echo Force should run it regardless of wether it's been run before
 
50
--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
 
51
 
 
52
# It should have created a file in the MySQL Servers datadir
 
53
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
 
54
 
 
55
 
 
56
#
 
57
# Bug #25452 mysql_upgrade access denied.
 
58
#
 
59
 
 
60
# Password protect a root account and run mysql_upgrade
 
61
 
 
62
CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
 
63
GRANT ALL ON *.* TO mysqltest1@'%';
 
64
--echo Run mysql_upgrade with password protected account
 
65
--exec $MYSQL_UPGRADE --skip-verbose --force --user=mysqltest1 --password=sakila 2>&1
 
66
 
 
67
DROP USER mysqltest1@'%';
 
68
 
 
69
 
 
70
#
 
71
# Bug #26639 mysql_upgrade exits successfully even if external command failed
 
72
#
 
73
 
 
74
--echo Run mysql_upgrade with a non existing server socket
 
75
--replace_result $MYSQLTEST_VARDIR var
 
76
--replace_regex /.*mysqlcheck.*: Got/mysqlcheck: Got/ /\([0-9]*\)/(errno)/
 
77
--error 1
 
78
--exec $MYSQL_UPGRADE --skip-verbose --force --host=not_existing_host 2>&1
 
79
 
 
80
#
 
81
# Bug #28401 mysql_upgrade Failed with STRICT_ALL_TABLES, ANSI_QUOTES and NO_ZERO_DATE
 
82
#
 
83
 
 
84
# The SQL commands used by mysql_upgrade are written to be run
 
85
# with sql_mode set to '' - thus the scripts should change sql_mode
 
86
# for the session to make sure the SQL is legal.
 
87
 
 
88
# Test by setting sql_mode before running mysql_upgrade
 
89
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
 
90
--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
 
91
eval set GLOBAL sql_mode=default;
 
92
 
 
93
 
 
94
--echo #
 
95
--echo # Bug #41569 mysql_upgrade (ver 5.1) add 3 fields to mysql.proc table 
 
96
--echo # but does not set values.
 
97
--echo #
 
98
 
 
99
# Create a stored procedure and set the fields in question to null. 
 
100
# When running mysql_upgrade, a warning should be written.
 
101
 
 
102
CREATE PROCEDURE testproc() BEGIN END;
 
103
UPDATE mysql.proc SET character_set_client = NULL WHERE name LIKE 'testproc';
 
104
UPDATE mysql.proc SET collation_connection = NULL WHERE name LIKE 'testproc';
 
105
UPDATE mysql.proc SET db_collation = NULL WHERE name LIKE 'testproc';
 
106
--exec $MYSQL_UPGRADE --skip-verbose --force 2> $MYSQLTEST_VARDIR/tmp/41569.txt
 
107
CALL testproc();
 
108
DROP PROCEDURE testproc;
 
109
--cat_file $MYSQLTEST_VARDIR/tmp/41569.txt
 
110
--remove_file $MYSQLTEST_VARDIR/tmp/41569.txt