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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
874e4e47
Commit
874e4e47
authored
Aug 07, 2017
by
Monty
Committed by
Sergei Golubchik
Aug 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better error message for mysql_upgrade if upgrade file can't be updated.
parent
b6c5657e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
+18
-11
client/mysql_upgrade.c
client/mysql_upgrade.c
+18
-11
No files found.
client/mysql_upgrade.c
View file @
874e4e47
...
...
@@ -673,7 +673,7 @@ static int get_upgrade_info_file_name(char* name)
*/
static
int
upgrade_already_done
(
void
)
static
int
upgrade_already_done
(
myf
flags
)
{
FILE
*
in
;
char
upgrade_info_file
[
FN_REFLEN
]
=
{
0
};
...
...
@@ -681,17 +681,23 @@ static int upgrade_already_done(void)
if
(
get_upgrade_info_file_name
(
upgrade_info_file
))
return
0
;
/* Could not get filename => not sure */
if
(
!
(
in
=
my_fopen
(
upgrade_info_file
,
O_RDONLY
,
MYF
(
0
)
)))
if
(
!
(
in
=
my_fopen
(
upgrade_info_file
,
O_RDONLY
,
flags
)))
return
0
;
/* Could not open file => not sure */
bzero
(
upgrade_from_version
,
sizeof
(
upgrade_from_version
));
if
(
!
fgets
(
upgrade_from_version
,
sizeof
(
upgrade_from_version
),
in
))
{
/* Ignore, will be detected by strncmp() below */
/* Preserve errno for caller */
int
save_errno
=
errno
;
(
void
)
my_fclose
(
in
,
flags
);
errno
=
save_errno
;
return
0
;
}
my_fclose
(
in
,
MYF
(
0
));
if
(
my_fclose
(
in
,
flags
))
return
0
;
errno
=
0
;
return
(
strncmp
(
upgrade_from_version
,
MYSQL_SERVER_VERSION
,
sizeof
(
MYSQL_SERVER_VERSION
)
-
1
)
==
0
);
}
...
...
@@ -720,23 +726,24 @@ static void create_mysql_upgrade_info_file(void)
{
fprintf
(
stderr
,
"Could not create the upgrade info file '%s' in "
"the M
ySQL
Servers datadir, errno: %d
\n
"
,
"the M
ariaDB
Servers datadir, errno: %d
\n
"
,
upgrade_info_file
,
errno
);
return
;
}
/* Write new version to file */
fputs
(
MYSQL_SERVER_VERSION
,
out
);
my_fclose
(
out
,
MYF
(
0
));
my_fwrite
(
out
,
(
uchar
*
)
MYSQL_SERVER_VERSION
,
sizeof
(
MYSQL_SERVER_VERSION
),
MY_WME
);
my_fclose
(
out
,
MYF
(
MY_WME
));
/*
Check if the upgrad_info_file was properly created/updated
It's not a fatal error -> just print a message if it fails
*/
if
(
!
upgrade_already_done
())
if
(
!
upgrade_already_done
(
MY_WME
))
fprintf
(
stderr
,
"
Could not write to the upgrade info file '%s' in
"
"
the MySQL Servers datadir, errno
: %d
\n
"
,
"
Upgrade file '%s' was not properly created.
"
"
Got error errno while checking file content
: %d
\n
"
,
upgrade_info_file
,
errno
);
return
;
}
...
...
@@ -1191,7 +1198,7 @@ int main(int argc, char **argv)
Read the mysql_upgrade_info file to check if mysql_upgrade
already has been run for this installation of MySQL
*/
if
(
!
opt_force
&&
upgrade_already_done
())
if
(
!
opt_force
&&
upgrade_already_done
(
0
))
{
printf
(
"This installation of MySQL is already upgraded to %s, "
"use --force if you still need to run mysql_upgrade
\n
"
,
...
...
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