Commit 7c3f8447 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Extended manual section about MySQL states

parent 76ed6c26
......@@ -9419,7 +9419,7 @@ work:
CC="cc -pthread"
CFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed all -arch host"
CXX="cxx -pthread"
CXXFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed all -arch host"
CXXFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed all -arch host -noexceptions -nortti"
export CC CFLAGS CXX CXXFLAGS
./configure \
--prefix=/usr/local/mysql \
......@@ -18622,36 +18622,103 @@ one extra connection for a client with the @code{Process_priv} privilege
to ensure that you should always be able to login and check the system
(assuming you are not giving this privilege to all your users).
Some frequently asked states in @code{mysqladmin processlist}
@code{WAITING FOR TABLES}
This means that the server is trying to get a lock of a
table(s). Usually this should happen very fast, unless there is some
problem around, such as another program holding table files open (e.g
@code{myisamchk}, anohter instance of @code{mysqld}), @code{mysqld} is
run without @code{--skip-locking}, table files are nfs mounted for
@code{mysqld}, etc.
@code{OPENING TABLES}
This simply means that the thread is trying to open a table. This also
should be very instant procedure, unless something prevents opening. An
@code{ALTER TABLE}, for example, can prevent opening a table until the
command is finished. If someone runs @code{FLUSH TABLES} simultaneously
with an @code{ALTER TABLE}, then all the threads that are trying to use
the table in @code{ALTER TABLE} query will be in this state.
@code{CLOSING TABLES}
Means that the thread is closing the tables that the thread was using.
If this is taking long, please check for the above for possible reasons
why it might be taking long.
All of the above are usually very quick operations. If threads last
in any of these states for many seconds, there may be a problem around
that needs to be investigated. Check also that you have not run out
of harddisk space.
Some frequently states in @code{mysqladmin processlist}
@itemize @bullet
@item @code{Checking table}
The thread doing an [automatic ?] checking of the table.
@item @code{Closing tables}
Means that the thread is flushing the changed table data to disk and
closing the used tables. This should be a fast operation. If not, then
you should check that you don't have a full disk or that the disk is not
in very heavy use.
@item @code{Copying to tmp table on disk}
The temporary result set was larger than @code{tmp_table_size} and the
thread is now changing the in memory based temporary table to a disk
based one to save memory.
@item @code{Creating tmp table}
The thread is creating a temporary table to hold a part of the result for
the query.
@item @code{deleting from main table}
When executing the first part of a multi-table delete and we are only
deleting from the first table.
@item @code{deleting from reference tables}
When executing the second part of a multi-table delete and we are deleting
the matched rows from the other tables.
@item @code{Flushing tables}
The thread is executing @code{FLUSH TABLES} and is waiting for all
threads to close their tables.
@item @code{Killed}
Someone has sent a kill to the thread and it should abort next time it
checks the kill flag. The flag is checked in each major loop in MySQL,
but in some cases it may still take a short time for the thread to die.
If the thread is locked by some other thread, the kill will take affect
as soon as the other thread releases it's lock.
@item @code{Sending data}
The thread is processing rows for a @code{SELECT} statement and is
also sending data to the client.
@item @code{Sorting for group}
The thread is doing a sort to satsify a @code{GROUP BY}.
@item @code{Sorting for order}
The thread is doing a sort to satsify a @code{ORDER BY}.
@item @code{Opening tables}
This simply means that the thread is trying to open a table. This is
should be very fast procedure, unless something prevents opening. For
example an @code{ALTER TABLE} or a @code{LOCK TABLE} can prevent opening
a table until the command is finished.
@item @code{Removing duplicates}
The query was using @code{SELECT DISTINCT} in such a way that MySQL
couldn't optimize that distinct away at an early stage. Because of this
MySQL has to do an extra stage to remove all duplicated rows before
sending the result to the client.
@item @code{Reopen table}
The thread got a lock for the table, but noticed after getting the lock
that the underlying table structure changed. It has freed the lock,
closed the table and is now trying to reopen it.
@item @code{Repair by sorting}
The repair code is using sorting to create indexes.
@item @code{Repair with keycache}
The repair code is using creating keys one by one through the key cache.
This is much slower than @code{Repair by sorting}.
@item @code{Searching rows for update}
The thread is doing a first phase to find all matching rows before
updating them. This has to be done if the @code{UPDATE} is changing
the index that is used to find the involved rows.
@item @code{Sleeping}
The thread is wating for the client to send a new command to it.
@item @code{System lock}
The thread is waiting for getting to get a external system lock for the
table. If you are not using multiple mysqld servers that are accessing
the same tables, you can disable system locks with the
@code{--skip-locking} option.
@item @code{Upgrading lock}
The @code{INSERT DELAYED} handler is trying to get a lock for the table
to insert rows.
@item @code{Updating}
The thread is searching for rows to update and updating them.
@item @code{User Lock}
The thread is waiting on a @code{GET_LOCK()}.
@item @code{Waiting for tables}
The thread got a notification that the underlying structure for a table
has changed and it needs to reopen the table to get the new structure.
To be able to reopen the table it must however wait until all other
threads have closed the table in question.
This notification happens if another thread has used @code{FLUSH TABLES}
or one of the following commands on the table in question: @code{FLUSH
TABLES table_name}, @code{ALTER TABLE}, @code{RENAME TABLE},
@code{REPAIR TABLE}, @code{ANALYZE TABLE} or @code{OPTIMIZE TABLE}.
@item @code{waiting for handler insert}
The @code{INSERT DELAYED} handler has processed all inserts and are
waiting to get new ones.
@end itemize
Most states are very quick operations. If threads last in any of these
states for many seconds, there may be a problem around that needs to be
investigated.
There are some other states that are not mentioned above, but most of
these are only useful to find bugs in @code{mysqld}.
@node SHOW GRANTS, SHOW CREATE TABLE, SHOW PROCESSLIST, SHOW
@subsubsection @code{SHOW GRANTS}
......@@ -72,7 +72,7 @@ char *get_tty_password(char *opt_message)
char *pos=to,*end=to+sizeof(to)-1;
int i=0;
DBUG_ENTER("get_tty_password");
fprintf(stdout,opt_message ? opt_message : "Enter password: ");
fprintf(stderr,opt_message ? opt_message : "Enter password: ");
for (;;)
{
char tmp;
......@@ -125,8 +125,8 @@ static void get_password(char *to,uint length,int fd,bool echo)
{
if (echo)
{
fputs("\b \b",stdout);
fflush(stdout);
fputs("\b \b",stderr);
fflush(stderr);
}
pos--;
continue;
......@@ -138,8 +138,8 @@ static void get_password(char *to,uint length,int fd,bool echo)
continue;
if (echo)
{
fputc('*',stdout);
fflush(stdout);
fputc('*',stderr);
fflush(stderr);
}
*(pos++) = tmp;
}
......@@ -172,10 +172,10 @@ char *get_tty_password(char *opt_message)
memset(passbuff, 0, _PASSWORD_LEN);
#endif
#else
if (isatty(fileno(stdout)))
if (isatty(fileno(stderr)))
{
fputs(opt_message ? opt_message : "Enter password: ",stdout);
fflush(stdout);
fputs(opt_message ? opt_message : "Enter password: ",stderr);
fflush(stderr);
}
#if defined(HAVE_TERMIOS_H)
tcgetattr(fileno(stdin), &org);
......@@ -184,7 +184,7 @@ char *get_tty_password(char *opt_message)
tmp.c_cc[VMIN] = 1;
tmp.c_cc[VTIME] = 0;
tcsetattr(fileno(stdin), TCSADRAIN, &tmp);
get_password(buff, sizeof(buff)-1, fileno(stdin), isatty(fileno(stdout)));
get_password(buff, sizeof(buff)-1, fileno(stdin), isatty(fileno(stderr)));
tcsetattr(fileno(stdin), TCSADRAIN, &org);
#elif defined(HAVE_TERMIO_H)
ioctl(fileno(stdin), (int) TCGETA, &org);
......@@ -193,7 +193,7 @@ char *get_tty_password(char *opt_message)
tmp.c_cc[VMIN] = 1;
tmp.c_cc[VTIME]= 0;
ioctl(fileno(stdin),(int) TCSETA, &tmp);
get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stdout)));
get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stderr)));
ioctl(fileno(stdin),(int) TCSETA, &org);
#else
gtty(fileno(stdin), &org);
......@@ -201,11 +201,11 @@ char *get_tty_password(char *opt_message)
tmp.sg_flags &= ~ECHO;
tmp.sg_flags |= RAW;
stty(fileno(stdin), &tmp);
get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stdout)));
get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stderr)));
stty(fileno(stdin), &org);
#endif
if (isatty(fileno(stdout)))
fputc('\n',stdout);
if (isatty(fileno(stderr)))
fputc('\n',stderr);
#endif /* HAVE_GETPASS */
DBUG_RETURN(my_strdup(buff,MYF(MY_FAE)));
......
......@@ -218,7 +218,7 @@ sub process_mail_file
{
chop;
if ($type ne "message")
{
{
if (/^Reply-To: (.*)/i)
{
$type = "reply";
......@@ -288,8 +288,11 @@ sub process_mail_file
$values{$type} .= "\n" . $_;
}
}
$values{'hash'} = checksum("$values{'message'}");
update_table($dbh, $file_name, \%values);
if (defined($values{'message'}))
{
$values{'hash'} = checksum("$values{'message'}");
update_table($dbh, $file_name, \%values);
}
}
####
......
......@@ -342,17 +342,17 @@ static void handle_sigterm(int sig __attribute__((unused)))
exit(0);
}
#ifdef DO_STACKTRACE
static void handle_segfault(int sig)
{
if (in_segfault)
exit(1);
in_segfault=1;
fprintf(errfp,"Got fatal signal %d\n",sig);
#ifdef DO_STACKTRACE
print_stacktrace();
#endif
exit(1);
}
#endif
static void handle_sigpipe(int __attribute__((unused)) sig)
{
......
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