mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Changes for to control the tables and log clean up.
sql/mysqld.cc: Added Monty's code for to call the handler of named pipes at shutdown. Change the code to call the stop service after the clean up. Change the create/open the mysql.err files for to print the InnoDB start messages. sql/nt_servc.cc: Modify the WaitHint for to kill the service. This will be modify for to be defined through an user variable.
This commit is contained in:
parent
dc09f16694
commit
8f61f5475c
2 changed files with 49 additions and 35 deletions
|
@ -469,15 +469,28 @@ static void close_connections(void)
|
|||
}
|
||||
}
|
||||
#ifdef __NT__
|
||||
if ( hPipe != INVALID_HANDLE_VALUE )
|
||||
if ( hPipe != INVALID_HANDLE_VALUE )
|
||||
{
|
||||
HANDLE temp;
|
||||
DBUG_PRINT( "quit", ("Closing named pipes") );
|
||||
|
||||
/* Create connection to the handle named pipe handler to break the loop */
|
||||
if ((temp = CreateFile(szPipeName,
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
0,
|
||||
NULL )) != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
HANDLE hTempPipe = &hPipe;
|
||||
DBUG_PRINT( "quit", ("Closing named pipes") );
|
||||
hPipe = INVALID_HANDLE_VALUE;
|
||||
CancelIo( hTempPipe );
|
||||
DisconnectNamedPipe( hTempPipe );
|
||||
CloseHandle( hTempPipe );
|
||||
WaitNamedPipe(szPipeName, 1000);
|
||||
DWORD dwMode = PIPE_READMODE_BYTE | PIPE_WAIT;
|
||||
SetNamedPipeHandleState(temp, &dwMode, NULL, NULL);
|
||||
CancelIo(temp);
|
||||
DisconnectNamedPipe(temp);
|
||||
CloseHandle(temp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
if (unix_sock != INVALID_SOCKET)
|
||||
|
@ -1857,6 +1870,14 @@ The server will not act as a slave.");
|
|||
if (opt_slow_log)
|
||||
open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log",
|
||||
LOG_NORMAL);
|
||||
#ifdef __WIN__
|
||||
#define MYSQL_ERR_FILE "mysql.err"
|
||||
if (!opt_console)
|
||||
{
|
||||
freopen(MYSQL_ERR_FILE,"a+",stdout);
|
||||
freopen(MYSQL_ERR_FILE,"a+",stderr);
|
||||
}
|
||||
#endif
|
||||
if (ha_init())
|
||||
{
|
||||
sql_print_error("Can't init databases");
|
||||
|
@ -1882,13 +1903,8 @@ The server will not act as a slave.");
|
|||
ft_init_stopwords(ft_precompiled_stopwords); /* SerG */
|
||||
|
||||
#ifdef __WIN__
|
||||
#define MYSQL_ERR_FILE "mysql.err"
|
||||
if (!opt_console)
|
||||
{
|
||||
freopen(MYSQL_ERR_FILE,"a+",stdout);
|
||||
freopen(MYSQL_ERR_FILE,"a+",stderr);
|
||||
FreeConsole(); // Remove window
|
||||
}
|
||||
FreeConsole(); // Remove window
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -1986,7 +2002,7 @@ The server will not act as a slave.");
|
|||
#ifdef __NT__
|
||||
if (hPipe == INVALID_HANDLE_VALUE && !have_tcpip)
|
||||
{
|
||||
sql_print_error("TCP/IP must be installed on Win98 platforms");
|
||||
sql_print_error("TCP/IP or Named Pipes should be installed on NT OS");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2044,25 +2060,6 @@ The server will not act as a slave.");
|
|||
#ifdef EXTRA_DEBUG
|
||||
sql_print_error("After lock_thread_count");
|
||||
#endif
|
||||
#else
|
||||
if (Service.IsNT())
|
||||
{
|
||||
if(start_mode)
|
||||
{
|
||||
if (WaitForSingleObject(hEventShutdown,1000)==WAIT_TIMEOUT)
|
||||
Service.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
Service.SetShutdownEvent(0);
|
||||
if(hEventShutdown) CloseHandle(hEventShutdown);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Service.SetShutdownEvent(0);
|
||||
if(hEventShutdown) CloseHandle(hEventShutdown);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Wait until cleanup is done */
|
||||
|
@ -2072,6 +2069,23 @@ The server will not act as a slave.");
|
|||
pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
|
||||
}
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
#ifdef __WIN__
|
||||
if (Service.IsNT())
|
||||
{
|
||||
if(start_mode)
|
||||
Service.Stop();
|
||||
else
|
||||
{
|
||||
Service.SetShutdownEvent(0);
|
||||
if(hEventShutdown) CloseHandle(hEventShutdown);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Service.SetShutdownEvent(0);
|
||||
if(hEventShutdown) CloseHandle(hEventShutdown);
|
||||
}
|
||||
#endif
|
||||
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
|
||||
exit(0);
|
||||
return(0); /* purecov: deadcode */
|
||||
|
|
|
@ -28,7 +28,7 @@ NTService::NTService()
|
|||
|
||||
//time-out variables
|
||||
nStartTimeOut = 15000;
|
||||
nStopTimeOut = 15000;
|
||||
nStopTimeOut = 86400000;
|
||||
nPauseTimeOut = 5000;
|
||||
nResumeTimeOut = 5000;
|
||||
|
||||
|
@ -253,7 +253,7 @@ void NTService::ServiceMain(DWORD argc, LPTSTR *argv)
|
|||
WaitForSingleObject (pService->hExitEvent, INFINITE);
|
||||
|
||||
// wait for thread to exit
|
||||
if (WaitForSingleObject (pService->hThreadHandle, 1000) == WAIT_TIMEOUT)
|
||||
if (WaitForSingleObject (pService->hThreadHandle, INFINITE) == WAIT_TIMEOUT)
|
||||
CloseHandle(pService->hThreadHandle);
|
||||
|
||||
pService->Exit(0);
|
||||
|
|
Loading…
Reference in a new issue