1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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
This commit is contained in:
Oleg Smirnov
2023-06-29 18:34:34 +07:00
parent cd39f4ab6f
commit 8e2b20bfb0
10 changed files with 86 additions and 17 deletions

View File

@ -2048,9 +2048,16 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'S': case 'S':
if (filename[0] == '\0') if (filename[0] == '\0')
{ {
/* Socket given on command line, switch protocol to use SOCKETSt */ /*
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; opt_protocol= MYSQL_PROTOCOL_SOCKET;
} }
}
break; break;
case 'I': case 'I':
case '?': case '?':

View File

@ -321,9 +321,16 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'S': case 'S':
if (filename[0] == '\0') if (filename[0] == '\0')
{ {
/* Socket given on command line, switch protocol to use SOCKETSt */ /*
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; opt_protocol= MYSQL_PROTOCOL_SOCKET;
} }
}
break; break;
} }
return 0; return 0;

View File

@ -2447,9 +2447,16 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'S': case 'S':
if (filename[0] == '\0') if (filename[0] == '\0')
{ {
/* Socket given on command line, switch protocol to use SOCKETSt */ /*
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; opt_protocol= MYSQL_PROTOCOL_SOCKET;
} }
}
break; break;
case 'v': case 'v':
if (argument == disabled_my_option) if (argument == disabled_my_option)

View File

@ -387,9 +387,16 @@ get_one_option(const struct my_option *opt,
case 'S': case 'S':
if (filename[0] == '\0') if (filename[0] == '\0')
{ {
/* Socket given on command line, switch protocol to use SOCKETSt */ /*
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; opt_protocol= MYSQL_PROTOCOL_SOCKET;
} }
}
break; break;
} }

View File

@ -1074,9 +1074,16 @@ get_one_option(const struct my_option *opt,
case 'S': case 'S':
if (filename[0] == '\0') if (filename[0] == '\0')
{ {
/* Socket given on command line, switch protocol to use SOCKETSt */ /*
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; opt_protocol= MYSQL_PROTOCOL_SOCKET;
} }
}
break; break;
} }
return 0; return 0;

View File

@ -271,9 +271,16 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'S': case 'S':
if (filename[0] == '\0') if (filename[0] == '\0')
{ {
/* Socket given on command line, switch protocol to use SOCKETSt */ /*
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; opt_protocol= MYSQL_PROTOCOL_SOCKET;
} }
}
break; break;
case '#': case '#':
DBUG_PUSH(argument ? argument : "d:t:o"); DBUG_PUSH(argument ? argument : "d:t:o");

View File

@ -346,9 +346,16 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'S': case 'S':
if (filename[0] == '\0') if (filename[0] == '\0')
{ {
/* Socket given on command line, switch protocol to use SOCKETSt */ /*
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; opt_protocol= MYSQL_PROTOCOL_SOCKET;
} }
}
break; break;
break; break;
case '#': case '#':

View File

@ -784,9 +784,16 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'S': case 'S':
if (filename[0] == '\0') if (filename[0] == '\0')
{ {
/* Socket given on command line, switch protocol to use SOCKETSt */ /*
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; opt_protocol= MYSQL_PROTOCOL_SOCKET;
} }
}
break; break;
case '#': case '#':
DBUG_PUSH(argument ? argument : default_dbug_option); DBUG_PUSH(argument ? argument : default_dbug_option);

View File

@ -12,6 +12,12 @@ Connection: localhost via named pipe
# exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" # exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via named pipe Connection: localhost via named pipe
# exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" # 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:" # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via TCP/IP 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

View File

@ -25,3 +25,10 @@
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" --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:" --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:"