Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
15a9103c
Commit
15a9103c
authored
Aug 06, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-6535 Ordering of mysql_upgrade tasks is not optimal
first update system tables, then the rest
parent
3390291b
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
202 additions
and
113 deletions
+202
-113
client/mysql_upgrade.c
client/mysql_upgrade.c
+20
-25
client/mysqlcheck.c
client/mysqlcheck.c
+10
-0
mysql-test/r/ctype_upgrade.result
mysql-test/r/ctype_upgrade.result
+16
-14
mysql-test/r/log_tables_upgrade.result
mysql-test/r/log_tables_upgrade.result
+8
-7
mysql-test/r/mysql_upgrade.result
mysql-test/r/mysql_upgrade.result
+96
-58
mysql-test/r/mysql_upgrade_no_innodb.result
mysql-test/r/mysql_upgrade_no_innodb.result
+44
-2
mysql-test/r/mysql_upgrade_ssl.result
mysql-test/r/mysql_upgrade_ssl.result
+8
-7
No files found.
client/mysql_upgrade.c
View file @
15a9103c
...
...
@@ -206,12 +206,12 @@ static void die(const char *fmt, ...)
}
static
void
verbose
(
const
char
*
fmt
,
...)
static
int
verbose
(
const
char
*
fmt
,
...)
{
va_list
args
;
if
(
opt_silent
)
return
;
return
0
;
/* Print the verbose message */
va_start
(
args
,
fmt
);
...
...
@@ -222,6 +222,7 @@ static void verbose(const char *fmt, ...)
fflush
(
stdout
);
}
va_end
(
args
);
return
0
;
}
...
...
@@ -736,20 +737,19 @@ static void print_conn_args(const char *tool_name)
in the server using "mysqlcheck --check-upgrade .."
*/
static
int
run_mysqlcheck_upgrade
(
void
)
static
int
run_mysqlcheck_upgrade
(
const
char
*
arg1
,
const
char
*
arg2
)
{
verbose
(
"Phase 2/3: Checking and upgrading tables"
);
print_conn_args
(
"mysqlcheck"
);
return
run_tool
(
mysqlcheck_path
,
NULL
,
/* Send output from mysqlcheck directly to screen */
"--no-defaults"
,
ds_args
.
str
,
"--check-upgrade"
,
"--all-databases"
,
"--auto-repair"
,
!
opt_silent
||
opt_verbose
?
"--verbose"
:
""
,
opt_silent
?
"--silent"
:
""
,
opt_write_binlog
?
"--write-binlog"
:
"--skip-write-binlog"
,
arg1
,
arg2
,
"2>&1"
,
NULL
);
}
...
...
@@ -757,7 +757,7 @@ static int run_mysqlcheck_upgrade(void)
static
int
run_mysqlcheck_fixnames
(
void
)
{
verbose
(
"Phase
1
/3: Fixing table and database names"
);
verbose
(
"Phase
2
/3: Fixing table and database names"
);
print_conn_args
(
"mysqlcheck"
);
return
run_tool
(
mysqlcheck_path
,
NULL
,
/* Send output from mysqlcheck directly to screen */
...
...
@@ -843,7 +843,6 @@ static int run_sql_fix_privilege_tables(void)
if
(
init_dynamic_string
(
&
ds_result
,
""
,
512
,
512
))
die
(
"Out of memory"
);
verbose
(
"Phase 3/3: Running 'mysql_fix_privilege_tables'..."
);
/*
Individual queries can not be executed independently by invoking
a forked mysql client, because the script uses session variables
...
...
@@ -990,16 +989,12 @@ int main(int argc, char **argv)
/* Find mysql */
find_tool
(
mysql_path
,
IF_WIN
(
"mysql.exe"
,
"mysql"
),
self_name
);
if
(
!
opt_systables_only
)
{
/* Find mysqlcheck */
find_tool
(
mysqlcheck_path
,
IF_WIN
(
"mysqlcheck.exe"
,
"mysqlcheck"
),
self_name
);
}
else
{
if
(
!
opt_silent
)
printf
(
"The --upgrade-system-tables option was used, databases won't be touched.
\n
"
);
}
/* Find mysqlcheck */
find_tool
(
mysqlcheck_path
,
IF_WIN
(
"mysqlcheck.exe"
,
"mysqlcheck"
),
self_name
);
if
(
opt_systables_only
&&
!
opt_silent
)
printf
(
"The --upgrade-system-tables option was used, user tables won't be touched.
\n
"
);
/*
Read the mysql_upgrade_info file to check if mysql_upgrade
...
...
@@ -1019,16 +1014,16 @@ int main(int argc, char **argv)
/*
Run "mysqlcheck" and "mysql_fix_privilege_tables.sql"
*/
if
((
!
opt_systables_only
&&
(
run_mysqlcheck_fixnames
()
||
run_mysqlcheck_upgrade
())
)
||
verbose
(
"Phase 1/3: Running 'mysql_fix_privilege_tables'..."
);
if
(
run_mysqlcheck_upgrade
(
"--databases"
,
"mysql"
)
||
run_sql_fix_privilege_tables
())
{
/*
The upgrade failed to complete in some way or another,
significant error message should have been printed to the screen
*/
die
(
"Upgrade failed"
);
}
if
(
!
opt_systables_only
&&
(
run_mysqlcheck_fixnames
()
||
verbose
(
"Phase 3/3: Checking and upgrading tables"
)
||
run_mysqlcheck_upgrade
(
"--all-databases"
,
"--skip-database=mysql"
)))
die
(
"Upgrade failed"
);
verbose
(
"OK"
);
/* Create a file indicating upgrade has been performed */
...
...
client/mysqlcheck.c
View file @
15a9103c
...
...
@@ -51,6 +51,7 @@ static char *opt_password = 0, *current_user = 0,
*
default_charset
=
0
,
*
current_host
=
0
;
static
char
*
opt_plugin_dir
=
0
,
*
opt_default_auth
=
0
;
static
int
first_error
=
0
;
static
char
*
opt_skip_database
;
DYNAMIC_ARRAY
tables4repair
,
tables4rebuild
,
alter_table_cmds
;
static
char
*
shared_memory_base_name
=
0
;
static
uint
opt_protocol
=
0
;
...
...
@@ -178,6 +179,9 @@ static struct my_option my_long_options[] =
#endif
{
"silent"
,
's'
,
"Print only error messages."
,
&
opt_silent
,
&
opt_silent
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"skip_database"
,
0
,
"Don't process the database specified as argument"
,
&
opt_skip_database
,
&
opt_skip_database
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"socket"
,
'S'
,
"The socket file to use for connection."
,
&
opt_mysql_unix_port
,
&
opt_mysql_unix_port
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
...
...
@@ -246,6 +250,9 @@ static void usage(void)
puts
(
"mysqlrepair: The default option will be -r"
);
puts
(
"mysqlanalyze: The default option will be -a"
);
puts
(
"mysqloptimize: The default option will be -o
\n
"
);
printf
(
"Usage: %s [OPTIONS] database [tables]
\n
"
,
my_progname
);
printf
(
"OR %s [OPTIONS] --databases DB1 [DB2 DB3...]
\n
"
,
my_progname
);
puts
(
"Please consult the MariaDB/MySQL knowledgebase at"
);
puts
(
"http://kb.askmonty.org/v/mysqlcheck for latest information about"
);
puts
(
"this program."
);
...
...
@@ -696,6 +703,9 @@ static int process_one_db(char *database)
{
DBUG_ENTER
(
"process_one_db"
);
if
(
opt_skip_database
&&
!
strcmp
(
database
,
opt_skip_database
))
DBUG_RETURN
(
0
);
if
(
verbose
)
puts
(
database
);
if
(
what_to_do
==
DO_UPGRADE
)
...
...
mysql-test/r/ctype_upgrade.result
View file @
15a9103c
...
...
@@ -227,13 +227,8 @@ DROP TABLE mysql050614_xxx_croatian_ci;
# Checking mysql_upgrade
#
# Running mysql_upgrade
Phase 1/3: Fixing table and database names
Phase 2/3: Checking and upgrading tables
Phase 1/3: Running 'mysql_fix_privilege_tables'...
Processing databases
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stats OK
mysql.columns_priv OK
...
...
@@ -263,6 +258,13 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/3: Fixing table and database names
Phase 3/3: Checking and upgrading tables
Processing databases
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
test.maria050313_ucs2_croatian_ci_def Needs upgrade
...
...
@@ -276,17 +278,11 @@ test.maria050313_ucs2_croatian_ci_def OK
test.maria050313_utf8_croatian_ci OK
test.maria050533_xxx_croatian_ci OK
test.maria100004_xxx_croatian_ci OK
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK
# Running mysql_upgrade for the second time
# This should report OK for all tables
Phase 1/3: Fixing table and database names
Phase 2/3: Checking and upgrading tables
Phase 1/3: Running 'mysql_fix_privilege_tables'...
Processing databases
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stats OK
mysql.columns_priv OK
...
...
@@ -316,6 +312,13 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/3: Fixing table and database names
Phase 3/3: Checking and upgrading tables
Processing databases
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
test.maria050313_ucs2_croatian_ci_def OK
...
...
@@ -323,7 +326,6 @@ test.maria050313_utf8_croatian_ci OK
test.maria050533_xxx_croatian_ci OK
test.maria100004_xxx_croatian_ci OK
test.mysql050614_xxx_croatian_ci OK
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK
SHOW CREATE TABLE maria050313_ucs2_croatian_ci_def;
Table Create Table
...
...
mysql-test/r/log_tables_upgrade.result
View file @
15a9103c
...
...
@@ -11,13 +11,8 @@ Table Op Msg_type Msg_text
test.bug49823 repair status OK
RENAME TABLE general_log TO renamed_general_log;
RENAME TABLE test.bug49823 TO general_log;
Phase 1/3: Fixing table and database names
Phase 2/3: Checking and upgrading tables
Phase 1/3: Running 'mysql_fix_privilege_tables'...
Processing databases
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stats OK
mysql.columns_priv OK
...
...
@@ -48,9 +43,15 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/3: Fixing table and database names
Phase 3/3: Checking and upgrading tables
Processing databases
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK
DROP TABLE general_log;
RENAME TABLE renamed_general_log TO general_log;
...
...
mysql-test/r/mysql_upgrade.result
View file @
15a9103c
This diff is collapsed.
Click to expand it.
mysql-test/r/mysql_upgrade_no_innodb.result
View file @
15a9103c
The --upgrade-system-tables option was used, databases won't be touched.
Phase 3/3: Running 'mysql_fix_privilege_tables'...
The --upgrade-system-tables option was used, user tables won't be touched.
Phase 1/3: Running 'mysql_fix_privilege_tables'...
Processing databases
mysql
mysql.column_stats OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stats OK
mysql.innodb_index_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.roles_mapping OK
mysql.servers OK
mysql.table_stats OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Repairing tables
mysql.innodb_index_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
OK
mysql-test/r/mysql_upgrade_ssl.result
View file @
15a9103c
#
# Bug#55672 mysql_upgrade dies with internal error
#
Phase 1/3: Fixing table and database names
Phase 2/3: Checking and upgrading tables
Phase 1/3: Running 'mysql_fix_privilege_tables'...
Processing databases
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stats OK
mysql.columns_priv OK
...
...
@@ -37,7 +32,13 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/3: Fixing table and database names
Phase 3/3: Checking and upgrading tables
Processing databases
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment