2004-10-23 11:32:52 +04:00
|
|
|
/* Copyright (C) 2003 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
2005-03-22 02:04:14 +03:00
|
|
|
#include "messages.h"
|
2004-10-23 11:32:52 +04:00
|
|
|
|
2006-05-18 18:57:50 +04:00
|
|
|
#include <my_global.h>
|
|
|
|
#include <mysql_com.h>
|
|
|
|
|
2005-03-22 02:04:14 +03:00
|
|
|
#include "mysqld_error.h"
|
|
|
|
#include "mysql_manager_error.h"
|
|
|
|
|
2004-10-23 11:32:52 +04:00
|
|
|
|
|
|
|
static const char *mysqld_error_message(unsigned sql_errno)
|
|
|
|
{
|
|
|
|
switch (sql_errno) {
|
|
|
|
case ER_HANDSHAKE_ERROR:
|
|
|
|
return "Bad handshake";
|
|
|
|
case ER_OUT_OF_RESOURCES:
|
|
|
|
return "Out of memory; Check if mysqld or some other process"
|
|
|
|
" uses all available memory. If not you may have to use"
|
|
|
|
" 'ulimit' to allow mysqld to use more memory or you can"
|
|
|
|
" add more swap space";
|
|
|
|
case ER_ACCESS_DENIED_ERROR:
|
|
|
|
return "Access denied. Bad username/password pair";
|
|
|
|
case ER_NOT_SUPPORTED_AUTH_MODE:
|
|
|
|
return "Client does not support authentication protocol requested by"
|
|
|
|
" server; consider upgrading MySQL client";
|
|
|
|
case ER_UNKNOWN_COM_ERROR:
|
|
|
|
return "Unknown command";
|
|
|
|
case ER_SYNTAX_ERROR:
|
|
|
|
return "You have an error in your command syntax. Check the manual that"
|
|
|
|
" corresponds to your MySQL Instance Manager version for the right"
|
|
|
|
" syntax to use";
|
|
|
|
case ER_BAD_INSTANCE_NAME:
|
|
|
|
return "Bad instance name. Check that the instance with such a name exists";
|
|
|
|
case ER_INSTANCE_IS_NOT_STARTED:
|
more fixes for IM to substitude mysqld_safe in startup scripts
BitKeeper/deleted/.del-thread_repository.cc~bba09f64f8cb4037:
Delete: server-tools/instance-manager/thread_repository.cc
BitKeeper/deleted/.del-thread_repository.h~e6a3b9cab7a6612a:
Delete: server-tools/instance-manager/thread_repository.h
server-tools/instance-manager/commands.cc:
All instances are guarded by default now, so we need to perform check on whether the instance is nonguarded,
rather then guarded when adding it to the list of guarded instnces.
server-tools/instance-manager/guardian.cc:
Guardian rewritten to start instances by default, and shut them down, when exiting. Behaviour of the guardian
in case of the instance crash has changed. Now it tries to restart an instance constantly in the first 2
seconds after the crash was noticed, and then it tries restart an instance once in the MONITORING_INTERVAL.
If it failed to restart instance for "restart_retry" (compiled-in value) times, guardian stops trying to
restart it.
server-tools/instance-manager/guardian.h:
Several new functions and variables declared.
server-tools/instance-manager/instance.cc:
now start doesn't call stop(), but rather tries to remove the pidfile itself
server-tools/instance-manager/instance.h:
cleanup
server-tools/instance-manager/instance_map.cc:
no more "admin" options
server-tools/instance-manager/instance_map.h:
User and password purged from instance_map options, as IM shouldn't know them
server-tools/instance-manager/instance_options.cc:
new option added -- shutdown_delay, guarded option now called nonguaded and has the opposite meaning
server-tools/instance-manager/instance_options.h:
appropriate changes, reflecting options addition/removal
server-tools/instance-manager/manager.cc:
shutdown process is complicated a bit -- at first signal thread should stop guardian, and only then the IM
itself
server-tools/instance-manager/messages.cc:
update error message
server-tools/instance-manager/options.cc:
admin user/password purged from mysqlmanager options
2005-01-31 23:54:08 +03:00
|
|
|
return "Cannot stop instance. Perhaps the instance is not started, or was started"
|
|
|
|
"manually, so IM cannot find the pidfile.";
|
2004-10-23 11:32:52 +04:00
|
|
|
case ER_INSTANCE_ALREADY_STARTED:
|
|
|
|
return "The instance is already started";
|
|
|
|
case ER_CANNOT_START_INSTANCE:
|
|
|
|
return "Cannot start instance. Possible reasons are wrong instance options"
|
|
|
|
" or resources shortage";
|
2005-05-16 01:54:02 +04:00
|
|
|
case ER_OFFSET_ERROR:
|
|
|
|
return "Cannot read negative number of bytes";
|
2004-10-23 11:32:52 +04:00
|
|
|
case ER_STOP_INSTANCE:
|
|
|
|
return "Cannot stop instance";
|
2005-05-16 01:54:02 +04:00
|
|
|
case ER_READ_FILE:
|
|
|
|
return "Cannot read requested part of the logfile";
|
2005-04-09 14:28:39 +04:00
|
|
|
case ER_NO_SUCH_LOG:
|
|
|
|
return "The instance has no such log enabled";
|
|
|
|
case ER_OPEN_LOGFILE:
|
|
|
|
return "Cannot open log file";
|
|
|
|
case ER_GUESS_LOGFILE:
|
|
|
|
return "Cannot guess the log filename. Try specifying full log name"
|
|
|
|
"in the instance options";
|
|
|
|
case ER_ACCESS_OPTION_FILE:
|
|
|
|
return "Cannot open the option file to edit. Check permissions";
|
2006-05-18 18:57:50 +04:00
|
|
|
case ER_DROP_ACTIVE_INSTANCE:
|
|
|
|
return "Cannot drop an active instance. You should stop it first";
|
|
|
|
case ER_CREATE_EXISTING_INSTANCE:
|
|
|
|
return "Instance already exists";
|
|
|
|
case ER_INSTANCE_MISCONFIGURED:
|
|
|
|
return "Instance is misconfigured. Cannot start it";
|
|
|
|
case ER_MALFORMED_INSTANCE_NAME:
|
|
|
|
return "Malformed instance name.";
|
|
|
|
case ER_INSTANCE_IS_ACTIVE:
|
|
|
|
return "The instance is active. Stop the instance first";
|
|
|
|
case ER_THERE_IS_ACTIVE_INSTACE:
|
|
|
|
return "At least one instance is active. Stop all instances first";
|
|
|
|
case ER_INCOMPATIBLE_OPTION:
|
|
|
|
return "Instance Manager-specific options are prohibited from being used "
|
|
|
|
"in the configuration of mysqld-compatible instances";
|
|
|
|
case ER_CONF_FILE_DOES_NOT_EXIST:
|
|
|
|
return "Configuration file does not exist";
|
2004-10-23 11:32:52 +04:00
|
|
|
default:
|
|
|
|
DBUG_ASSERT(0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const char *message(unsigned sql_errno)
|
|
|
|
{
|
|
|
|
return mysqld_error_message(sql_errno);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const char *errno_to_sqlstate(unsigned sql_errno)
|
|
|
|
{
|
|
|
|
return mysql_errno_to_sqlstate(sql_errno);
|
|
|
|
}
|