summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2002-03-25 18:10:36 +0200
committermonty@hundin.mysql.fi <>2002-03-25 18:10:36 +0200
commit93948645e75368ef501cfd85921d6048ffa56e13 (patch)
tree9029773913d45933f73eb828a2eb8b9750e3bd4e
parent9a33ac709d9ae7ea6817b1c6f13e550ef0a3f14d (diff)
downloadmariadb-git-93948645e75368ef501cfd85921d6048ffa56e13.tar.gz
Fixes for --enable-named-pipe
-rw-r--r--Docs/manual.texi32
-rw-r--r--sql/mysqld.cc50
2 files changed, 48 insertions, 34 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index c03ca5462a5..1fa5f026925 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -6349,6 +6349,9 @@ Optimized binary with support for symbolic links, BDB and InnoDB tables.
Like @code{mysqld-max}, but compiled with support for named pipes.
@end multitable
+Starting from 3.23.50, named pipes are only enabled if start mysqld with
+@code{--enable-named-pipe}.
+
All of the above binaries are optimized for the Pentium Pro processor but
should work on any Intel processor >= i386.
@@ -10334,6 +10337,11 @@ You can force a MySQL client to use named pipes by specifying the
@code{--pipe} option or by specifying @code{.} as the host name. Use the
@code{--socket} option to specify the name of the pipe.
+Note that starting from 3.23.50, named pipes are only enabled if start
+mysqld with @code{--enable-named-pipe}. This is because some users have
+experienced problems shutting down the MySQL server when one uses named
+pipes.
+
You can test whether or not MySQL is working by executing the
following commands:
@@ -10613,6 +10621,9 @@ option to the new MySQL clients or create an option file
host = localhost
@end example
+Starting from 3.23.50, named pipes are only enabled if start mysqld with
+@code{--enable-named-pipe}.
+
@item @code{Access denied for user} error
If you get the error @code{Access denied for user: 'some-user@@unknown'
to database 'mysql'} when accessing a MySQL server on the same
@@ -14724,6 +14735,10 @@ Enable system locking. Note that if you use this option on a system
which a not fully working lockd() (as on Linux) you will easily get
mysqld to deadlock.
+@item --enable-named-pipe
+Enable support for named pipes; This only works on NT and newer windows
+versions.
+
@item -T, --exit-info
This is a bit mask of different flags one can use for debugging the
mysqld server; One should not use this option if one doesn't know
@@ -43394,12 +43409,13 @@ are used if you don't specify a hostname or if you specify the special
hostname @code{localhost}.
On Windows you can connect only with TCP/IP if the @code{mysqld} server
-is running on Win95/Win98. If it's running on NT, you can also connect
-with named pipes. The name of the named pipe is MySQL. If you
-don't give a hostname when connecting to @code{mysqld}, a MySQL client
-will first try to connect to the named pipe, and if this doesn't work it
-will connect to the TCP/IP port. You can force the use of named pipes
-on Windows by using @code{.} as the hostname.
+is running on Win95/Win98. If mysqld is running on NT and started with
+@code{enable-named-pipe}, you can also connect with named pipes. The
+name of the named pipe is MySQL. If you don't give a hostname when
+connecting to @code{mysqld}, a MySQL client will first try to connect to
+the named pipe, and if this doesn't work it will connect to the TCP/IP
+port. You can force the use of named pipes on Windows by using @code{.}
+as the hostname.
The error (2002) @code{Can't connect to ...} normally means that there
isn't a MySQL server running on the system or that you are
@@ -46897,6 +46913,10 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.50
@itemize @bullet
@item
+Because of problems on shutdown we have now disabled named pipes on
+windows by default. One can enable this with by starting mysqld with
+@code{--enable-named-pipe}.
+@item
Fixed bug when using @code{WHERE key_column = 'J' or key_column='j'}.
@item
Fixed core-dump bug when using @code{--log-bin} with @code{LOAD DATA
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 16d6838007c..d0824b1ec53 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -155,6 +155,7 @@ static SECURITY_DESCRIPTOR sdPipeDescriptor;
static HANDLE hPipe = INVALID_HANDLE_VALUE;
static pthread_cond_t COND_handler_count;
static uint handler_count;
+static bool opt_enable_named_pipe = 0;
#endif
#ifdef __WIN__
static bool opt_console=0,start_mode=0;
@@ -220,9 +221,6 @@ static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0,
opt_myisam_log=0,
opt_large_files=sizeof(my_off_t) > 4;
-#ifdef __NT__
-static bool opt_enable_named_pipe = 0;
-#endif
bool opt_sql_bin_update = 0, opt_log_slave_updates = 0, opt_safe_show_db=0,
opt_safe_user_create=0;
FILE *bootstrap_file=0;
@@ -472,7 +470,7 @@ static void close_connections(void)
}
}
#ifdef __NT__
-if ( hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe )
+if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe)
{
HANDLE temp;
DBUG_PRINT( "quit", ("Closing named pipes") );
@@ -926,8 +924,8 @@ static void server_init(void)
#ifdef __NT__
/* create named pipe */
- if (Service.IsNT() && mysql_unix_port[0] && !opt_bootstrap
- && opt_enable_named_pipe)
+ if (Service.IsNT() && mysql_unix_port[0] && !opt_bootstrap &&
+ opt_enable_named_pipe)
{
sprintf( szPipeName, "\\\\.\\pipe\\%s", mysql_unix_port );
ZeroMemory( &saPipeSecurity, sizeof(saPipeSecurity) );
@@ -2004,10 +2002,10 @@ The server will not act as a slave.");
fflush(stdout);
#ifdef __NT__
- if ((hPipe == INVALID_HANDLE_VALUE && !have_tcpip ) ||
- (hPipe == INVALID_HANDLE_VALUE && opt_disable_networking) )
+ if (hPipe == INVALID_HANDLE_VALUE &&
+ (!have_tcpip || opt_disable_networking)
{
- sql_print_error("TCP/IP or enable-named-pipe should be configured on NT OS");
+ sql_print_error("TCP/IP or --enable-named-pipe should be configured on NT OS");
unireg_abort(1);
}
else
@@ -2017,7 +2015,7 @@ The server will not act as a slave.");
{
pthread_t hThread;
handler_count=0;
- if ( hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe )
+ if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe)
{
handler_count++;
if (pthread_create(&hThread,&connection_attrib,
@@ -2510,9 +2508,9 @@ pthread_handler_decl(handle_connections_namedpipes,arg)
fConnected = ConnectNamedPipe( hPipe, NULL );
if (abort_loop)
break;
- if ( !fConnected )
+ if (!fConnected)
fConnected = GetLastError() == ERROR_PIPE_CONNECTED;
- if ( !fConnected )
+ if (!fConnected)
{
CloseHandle( hPipe );
if ((hPipe = CreateNamedPipe(szPipeName,
@@ -2550,7 +2548,7 @@ pthread_handler_decl(handle_connections_namedpipes,arg)
continue; // We have to try again
}
- if ( !(thd = new THD))
+ if (!(thd = new THD))
{
DisconnectNamedPipe( hConnectedPipe );
CloseHandle( hConnectedPipe );
@@ -2634,9 +2632,7 @@ enum options {
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
OPT_SAFE_USER_CREATE, OPT_SQL_MODE,
-#ifdef __NT__
- OPT_HAVE_NAMED_PIPE,
-#endif
+ OPT_HAVE_NAMED_PIPE,
OPT_SLAVE_SKIP_ERRORS, OPT_LOCAL_INFILE
};
@@ -2670,6 +2666,7 @@ static struct option long_options[] = {
{"delay-key-write-for-all-tables",
no_argument, 0, (int) OPT_DELAY_KEY_WRITE},
{"enable-locking", no_argument, 0, (int) OPT_ENABLE_LOCK},
+ {"enable-named-pipe", no_argument, 0, (int) OPT_HAVE_NAMED_PIPE},
{"exit-info", optional_argument, 0, 'T'},
{"flush", no_argument, 0, (int) OPT_FLUSH},
#ifdef HAVE_GEMINI_DB
@@ -2766,9 +2763,6 @@ static struct option long_options[] = {
{"skip-host-cache", no_argument, 0, (int) OPT_SKIP_HOST_CACHE},
{"skip-name-resolve", no_argument, 0, (int) OPT_SKIP_RESOLVE},
{"skip-networking", no_argument, 0, (int) OPT_SKIP_NETWORKING},
-#ifdef __NT__
- {"enable-named-pipe", no_argument, 0, (int) OPT_HAVE_NAMED_PIPE},
-#endif
{"skip-new", no_argument, 0, (int) OPT_SKIP_NEW},
{"skip-safemalloc", no_argument, 0, (int) OPT_SKIP_SAFEMALLOC},
{"skip-show-database", no_argument, 0, (int) OPT_SKIP_SHOW_DB},
@@ -3043,6 +3037,9 @@ struct show_var_st init_vars[]= {
{"myisam_max_sort_file_size",(char*) &myisam_max_sort_file_size, SHOW_LONG},
{"myisam_recover_options", (char*) &myisam_recover_options, SHOW_LONG},
{"myisam_sort_buffer_size", (char*) &myisam_sort_buffer_size, SHOW_LONG},
+#ifdef __NT__
+ {"named_pipe", (char*) &opt_enable_named_pipe, SHOW_BOOL},
+#endif
{"net_buffer_length", (char*) &net_buffer_length, SHOW_LONG},
{"net_read_timeout", (char*) &net_read_timeout, SHOW_LONG},
{"net_retry_count", (char*) &mysqld_net_retry_count, SHOW_LONG},
@@ -3059,9 +3056,6 @@ struct show_var_st init_vars[]= {
{"slave_net_timeout", (char*) &slave_net_timeout, SHOW_LONG},
{"skip_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
-#ifdef __NT__
- {"enable_named_pipe", (char*) &opt_enable_named_pipe, SHOW_BOOL},
-#endif
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
{"slow_launch_time", (char*) &slow_launch_time, SHOW_LONG},
{"socket", (char*) &mysql_unix_port, SHOW_CHAR_PTR},
@@ -3437,7 +3431,7 @@ static void set_options(void)
}
#else
const char *tmpenv;
- if ( !(tmpenv = getenv("MY_BASEDIR_VERSION")))
+ if (!(tmpenv = getenv("MY_BASEDIR_VERSION")))
tmpenv = DEFAULT_MYSQL_HOME;
(void) strmov( mysql_home, tmpenv );
#endif
@@ -3770,11 +3764,6 @@ static void get_options(int argc,char **argv)
opt_disable_networking=1;
mysql_port=0;
break;
-#ifdef __NT__
- case (int) OPT_HAVE_NAMED_PIPE:
- opt_enable_named_pipe=1;
- break;
-#endif
case (int) OPT_SKIP_SHOW_DB:
opt_skip_show_db=1;
opt_specialflag|=SPECIAL_SKIP_SHOW_DB;
@@ -3829,6 +3818,11 @@ static void get_options(int argc,char **argv)
case (int) OPT_INIT_FILE:
opt_init_file=optarg;
break;
+ case (int) OPT_HAVE_NAMED_PIPE:
+#if __NT__
+ opt_enable_named_pipe=1;
+#endif
+ break;
#ifdef __WIN__
case (int) OPT_STANDALONE: /* Dummy option for NT */
break;