Commit 8e2b20bf authored by Oleg Smirnov's avatar Oleg Smirnov

MDEV-30639 Upgrade to 10.8 and later does not work on Windows

During the upgrade procedure on Windows mysqld.exe is started with
the named pipe connection protocol. mysqladmin.exe then pings the
server to check if is up and running. Command line looks like:
   mysqladmin.exe --protocol=pipe --socket=mysql_upgrade_service_xxx ping
But the "socket" parameter resets the "protocol" which was previously
initialized with the "pipe" value, setting it to "socket".
As a result, connection cannot be established and the upgrade
procedure fails.
"socket" in Windows is used to pass the name of the pipe so resetting
the protocol is not valid in this case.

This commit fixes resetting of the "protocol" parameter with "socket"
parameter in the case when protocol has been previously initialized
to "pipe" value
parent cd39f4ab
......@@ -2048,8 +2048,15 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'S':
if (filename[0] == '\0')
{
/* Socket given on command line, switch protocol to use SOCKETSt */
opt_protocol= MYSQL_PROTOCOL_SOCKET;
/*
Socket given on command line, switch protocol to use SOCKETSt
Except on Windows if 'protocol= pipe' has been provided in
the config file or command line.
*/
if (opt_protocol != MYSQL_PROTOCOL_PIPE)
{
opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
}
break;
case 'I':
......
......@@ -321,8 +321,15 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'S':
if (filename[0] == '\0')
{
/* Socket given on command line, switch protocol to use SOCKETSt */
opt_protocol= MYSQL_PROTOCOL_SOCKET;
/*
Socket given on command line, switch protocol to use SOCKETSt
Except on Windows if 'protocol= pipe' has been provided in
the config file or command line.
*/
if (opt_protocol != MYSQL_PROTOCOL_PIPE)
{
opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
}
break;
}
......
......@@ -2447,8 +2447,15 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'S':
if (filename[0] == '\0')
{
/* Socket given on command line, switch protocol to use SOCKETSt */
opt_protocol= MYSQL_PROTOCOL_SOCKET;
/*
Socket given on command line, switch protocol to use SOCKETSt
Except on Windows if 'protocol= pipe' has been provided in
the config file or command line.
*/
if (opt_protocol != MYSQL_PROTOCOL_PIPE)
{
opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
}
break;
case 'v':
......
......@@ -387,8 +387,15 @@ get_one_option(const struct my_option *opt,
case 'S':
if (filename[0] == '\0')
{
/* Socket given on command line, switch protocol to use SOCKETSt */
opt_protocol= MYSQL_PROTOCOL_SOCKET;
/*
Socket given on command line, switch protocol to use SOCKETSt
Except on Windows if 'protocol= pipe' has been provided in
the config file or command line.
*/
if (opt_protocol != MYSQL_PROTOCOL_PIPE)
{
opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
}
break;
}
......
......@@ -1074,8 +1074,15 @@ get_one_option(const struct my_option *opt,
case 'S':
if (filename[0] == '\0')
{
/* Socket given on command line, switch protocol to use SOCKETSt */
opt_protocol= MYSQL_PROTOCOL_SOCKET;
/*
Socket given on command line, switch protocol to use SOCKETSt
Except on Windows if 'protocol= pipe' has been provided in
the config file or command line.
*/
if (opt_protocol != MYSQL_PROTOCOL_PIPE)
{
opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
}
break;
}
......
......@@ -271,8 +271,15 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'S':
if (filename[0] == '\0')
{
/* Socket given on command line, switch protocol to use SOCKETSt */
opt_protocol= MYSQL_PROTOCOL_SOCKET;
/*
Socket given on command line, switch protocol to use SOCKETSt
Except on Windows if 'protocol= pipe' has been provided in
the config file or command line.
*/
if (opt_protocol != MYSQL_PROTOCOL_PIPE)
{
opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
}
break;
case '#':
......
......@@ -346,8 +346,15 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'S':
if (filename[0] == '\0')
{
/* Socket given on command line, switch protocol to use SOCKETSt */
opt_protocol= MYSQL_PROTOCOL_SOCKET;
/*
Socket given on command line, switch protocol to use SOCKETSt
Except on Windows if 'protocol= pipe' has been provided in
the config file or command line.
*/
if (opt_protocol != MYSQL_PROTOCOL_PIPE)
{
opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
}
break;
break;
......
......@@ -784,8 +784,15 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'S':
if (filename[0] == '\0')
{
/* Socket given on command line, switch protocol to use SOCKETSt */
opt_protocol= MYSQL_PROTOCOL_SOCKET;
/*
Socket given on command line, switch protocol to use SOCKETSt
Except on Windows if 'protocol= pipe' has been provided in
the config file or command line.
*/
if (opt_protocol != MYSQL_PROTOCOL_PIPE)
{
opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
}
break;
case '#':
......
......@@ -12,6 +12,12 @@ Connection: localhost via named pipe
# exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via named pipe
# exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via TCP/IP
Connection: localhost via named pipe
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via TCP/IP
#
# MDEV-30639: Upgrade to 10.8 and later does not work on Windows
# due to connection protocol overwrite
#
# exec MYSQL --host=localhost --protocol=pipe --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via named pipe
......@@ -25,3 +25,10 @@
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
--echo #
--echo # MDEV-30639: Upgrade to 10.8 and later does not work on Windows
--echo # due to connection protocol overwrite
--echo #
--echo # exec MYSQL --host=localhost --protocol=pipe --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
--exec $MYSQL --host=localhost --protocol=pipe --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment