Commit dc5e32ea authored by monty@donna.mysql.com's avatar monty@donna.mysql.com
Browse files

Added connect_timeout and fix for transactions per statement

parent 8e332209
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ noinst_SCRIPTS = Support/texi2html Support/generate-text-files.pl \
			Support/generate-mirror-listing.pl
info_TEXINFOS =		manual.texi

targets =		manual.txt mysql.info manual.html $(PDFMANUAL)
targets =		manual.txt mysql.info manual.html

BUILT_SOURCES =		$(targets) manual_toc.html include.texi
EXTRA_DIST =		$(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt INSTALL-BINARY
@@ -30,9 +30,9 @@ txt_files: ../INSTALL-SOURCE ../COPYING ../COPYING.LIB \

CLEAN_FILES:		manual.ps

# The PostScript version is so big that is not included in the
# The PostScript and PDF version are so big that they are not included in the
# standard distribution. It is available for download from the home page.  
paper: manual_a4.ps manual_letter.ps
paper: manual_a4.ps manual_letter.ps  $(PDFMANUAL)

#########################################################################

+90 −33
Original line number Diff line number Diff line
@@ -9401,6 +9401,11 @@ password=my_password
[mysql]
no-auto-rehash
set-variable = connect_timeout=2
[mysql-hot-copy]
interactive-timeout
@end example
@tindex .my.cnf file
@@ -16971,6 +16976,7 @@ mysql> select CONNECTION_ID();
        -> 1
@end example
@cindex timeout
@findex GET_LOCK()
@item GET_LOCK(str,timeout)
Tries to obtain a lock with a name given by the string @code{str}, with a
@@ -18009,6 +18015,8 @@ exist.
@code{RESTRICT} and @code{CASCADE} are allowed to make porting easier.
For the moment they don't do anything.
@cindex tables, defragment
@cindex tables, fragmentation
@findex OPTIMIZE TABLE
@node OPTIMIZE TABLE, CHECK TABLE, DROP TABLE, Reference
@section @code{OPTIMIZE TABLE} Syntax
@@ -18022,7 +18030,7 @@ table or if you have made many changes to a table with variable-length rows
(tables that have @code{VARCHAR}, @code{BLOB}, or @code{TEXT} columns).
Deleted records are maintained in a linked list and subsequent @code{INSERT}
operations reuse old record positions. You can use @code{OPTIMIZE TABLE} to
reclaim the unused space.
reclaim the unused space and to defragment the data file.
For the moment @code{OPTIMIZE TABLE} only works on @strong{MyISAM}
tables.  You can get optimize table to work on other table types by
@@ -18892,6 +18900,8 @@ After every @code{delayed_insert_limit} rows are written, the handler checks
whether or not any @code{SELECT} statements are still pending.  If so, it
allows these to execute before continuing.
@cindex delayed_insert_limit
@cindex timeout
@item
When the handler has no more rows in its queue, the table is unlocked.  If no
new @code{INSERT DELAYED} commands are received within
@@ -18962,7 +18972,8 @@ the old record is deleted before the new record is inserted.
@xref{INSERT, , @code{INSERT}}.
In other words, you can't access the values of the old row from a
@code{REPLACE} statement.
@code{REPLACE} statement.  In some old @strong{MySQL} version it looked
like you could do this, but that was a bug that has been corrected.
@findex LOAD DATA INFILE
@node LOAD DATA, UPDATE, REPLACE, Reference
@@ -20019,6 +20030,7 @@ on @code{MyISAM} tables at the same time as you run @code{SELECT} queries
on them.  You can turn this option off by starting mysqld with @code{--safe}
or @code{--skip-new}.
@cindex timeout
@item @code{connect_timeout}
The number of seconds the @code{mysqld} server is waiting for a connect
packet before responding with @code{Bad handshake}.
@@ -21837,6 +21849,7 @@ This format is a litte more complex because each row has to have a header
that says how long it is. One record can also end up at more than one
location when it is made longer at an update.
@cindex tables, defragment
You can use @code{OPTIMIZE table} or @code{myisamchk} to defragment a
table. If you have static data that you access/change a lot in the same
table as some @code{VARCHAR} or @code{BLOB} columns, it might be a good
@@ -21938,10 +21951,10 @@ Can be uncompressed with @code{myisamchk}.
@node MERGE, ISAM, MyISAM, Table types
@section MERGE Tables
@code{MERGE} tables are new in @strong{MySQL} Version 3.23.25. The code is still
in alpha, but should stabilize soon!  The one thing that is currently
missing is a way for the SQL prompt to say which tables are part of the
@code{MERGE} table.
@code{MERGE} tables are new in @strong{MySQL} Version 3.23.25. The code
is still in alpha, but should stabilize soon!  The one thing that is
currently missing is a way for the SQL prompt to say which tables are
part of the @code{MERGE} table.
A @code{MERGE} table is a collection of identical @code{MyISAM} tables
that can be used as one.  You can only @code{SELECT}, @code{DELETE}, and
@@ -28092,6 +28105,19 @@ Output version information and exit.
Wait and retry if connection is down instead of aborting.
@end table
You can also set the following variables with @code{-O} or
@code{--set-variable}:
@cindex timeout
@multitable @columnfractions .3 .2 .5
@item Variablename @tab Default @tab Description
@item connect_timeout @tab 0 @tab Number of seconds before timeout connection.
@item max_allowed_packet @tab 16777216 @tab Max packetlength to send/receive from to server
@item net_buffer_length @tab 16384 @tab Buffer for TCP/IP and socket communication
@item select_limit @tab 1000 @tab Automatic limit for SELECT when using --i-am-a-dummy
@item max_join_size @tab 1000000 @tab Automatic limit for rows in a join when using --i-am-a-dummy.
@end multitable
If you type 'help' on the command line, @code{mysql} will print out the
commands that it supports:
@@ -29068,9 +29094,9 @@ to start using the new table.
@node Table maintenance, Maintenance regimen, Maintenance, Maintenance
@section Using @code{myisamchk} for table maintenance and crash recovery
Starting with @strong{MySQL} Version 3.23.13, you can check MyISAM tables with the
@code{CHECK TABLE} command. @xref{CHECK TABLE}.  You can repair tables
with the @code{REPAIR TABLE} command. @xref{REPAIR TABLE}.
Starting with @strong{MySQL} Version 3.23.13, you can check MyISAM
tables with the @code{CHECK TABLE} command. @xref{CHECK TABLE}.  You can
repair tables with the @code{REPAIR TABLE} command. @xref{REPAIR TABLE}.
To check/repair MyISAM tables (@code{.MYI} and @code{.MYD}) you should
use the @code{myisamchk} utility. To check/repair ISAM tables
@@ -29146,6 +29172,13 @@ with the path to the @strong{MySQL} data directory:
shell> myisamchk /path/to/datadir/*/*.MYI
@end example
The recommended way to quickly check all tables is:
@example
myisamchk --fast --silent /path/to/datadir/*/*.MYI
isamchk --silent /path/to/datadir/*/*.ISM
@end example
@code{myisamchk} supports the following options:
@menu
@@ -29405,18 +29438,18 @@ If you have a problem with disk space during repair, you can try to use
@node Maintenance regimen, Table-info, Table maintenance, Maintenance
@section Setting up a table maintenance regimen
Starting with @strong{MySQL} Version 3.23.13, you can check MyISAM tables with the
@code{CHECK TABLE} command. @xref{CHECK TABLE}.  You can repair tables
with the @code{REPAIR TABLE} command. @xref{REPAIR TABLE}.
Starting with @strong{MySQL} Version 3.23.13, you can check MyISAM
tables with the @code{CHECK TABLE} command. @xref{CHECK TABLE}.  You can
repair tables with the @code{REPAIR TABLE} command. @xref{REPAIR TABLE}.
It is a good idea to perform table checks on a regular basis rather than
waiting for problems to occur.  For maintenance purposes, you can use
@code{myisamchk -s} to check tables.  The @code{-s} option causes
@code{myisamchk} to run in silent mode, printing messages only when errors
occur.
@code{myisamchk -s} to check tables.  The @code{-s} option (short for
@code{--silent}) causes @code{myisamchk} to run in silent mode, printing
messages only when errors occur.
@tindex .pid (process ID) file
It's a good idea to check tables when the server starts up.
It's also a good idea to check tables when the server starts up.
For example, whenever the machine has done a reboot in the middle of an
update, you usually need to check all the tables that could have been
affected. (This is an ``expected crashed table''.) You could add a test to
@@ -29435,7 +29468,7 @@ operation. At MySQL AB, we run a @code{cron} job to check all our important
tables once a week, using a line like this in a @file{crontab} file:
@example
35 0 * * 0 /path/to/myisamchk -s /path/to/datadir/*/*.MYI
35 0 * * 0 /path/to/myisamchk --fast --silent /path/to/datadir/*/*.MYI
@end example
This prints out information about crashed tables so we can examine and repair
@@ -29450,6 +29483,21 @@ We recommend that to start with, you execute @code{myisamchk -s} each
night on all tables that have been updated during the last 24 hours,
until you come to trust @strong{MySQL} as much as we do.
@cindex tables, defragment
Normally you don't need to maintain MySQL tables that much.  If you are
changing tables with dynamic size rows (tables with @code{VARCHAR},
@code{BLOB} or @code{TEXT} columns) or have tables with many deleted rows
you may want to from time to time (once a month?) defragment/reclaim space
from the tables.
You can do this by using @code{OPTIMIZE TABLE} on the tables in question or
if you can take the @code{mysqld} server down for a while do:
@example
isamchk -r --silent --sort-index -O sort_buffer_size=16M */*.ISM
myisamchk -r --silent --sort-index  -O sort_buffer_size=16M */*.MYI
@end example
@cindex tables, information
@node Table-info, Crash recovery, Maintenance regimen, Maintenance
@section Getting information about a table
@@ -29459,11 +29507,12 @@ below. We explain some of the information in more detail later.
@table @code
@item myisamchk -d tbl_name
Runs @code{myisamchk} in ``describe mode'' to produce a description of your
table. If you start the @strong{MySQL} server using the @code{--skip-locking}
option, @code{myisamchk} may report an error for a table that is updated while
it runs.  However, because @code{myisamchk} doesn't change the table in describe
mode, there isn't any risk of destroying data.
Runs @code{myisamchk} in ``describe mode'' to produce a description of
your table. If you start the @strong{MySQL} server using the
@code{--skip-locking} option, @code{myisamchk} may report an error for a
table that is updated while it runs.  However, because @code{myisamchk}
doesn't change the table in describe mode, there isn't any risk of
destroying data.
@item myisamchk -d -v tbl_name
To produce more information about what @code{myisamchk} is doing, add @code{-v}
@@ -35032,6 +35081,7 @@ Note that the group @code{client} is always read if you use
The specified group in the option file may contain the following options:
@multitable @columnfractions .3 .7
@item @code{connect_timeout} @tab Connect timeout in seconds. On Linux this timeout is also used for waiting for the first answer from the server.
@item @code{compress} @tab Use the compressed client/server protocol.
@item @code{database} @tab Connect to this database if no database was specified in the connect command.
@item @code{debug} @tab Debug options.
@@ -35044,11 +35094,12 @@ The specified group in the option file may contain the following options:
@item @code{return-found-rows} @tab Tell @code{mysql_info()} to return found rows instead of updated rows when using @code{UPDATE}.
@item @code{socket} @tab Default socket number.
@item
@code{timeout} @tab Connect timeout in seconds. On Linux this timeout also
is used for waiting for the first answer from the server.
@item @code{user} @tab Default user.
@end multitable
Note that @code{timeout} has been replaced by @code{connect_timeout}, but
@code{timeout} will still work for a while.
For more information about option files, see @ref{Option files}.
@subsubheading Return values
@@ -35268,8 +35319,8 @@ Failed to wait for a named pipe on Windows.
Failed to get a pipe handler on Windows.
@item CR_SERVER_LOST
If @code{timeout} > 0 and it took longer then @code{timeout} seconds to
connect to the server or if the server died while executing the
If @code{connect_timeout} > 0 and it took longer then @code{connect_timeout}
seconds to connect to the server or if the server died while executing the
@code{init-command}.
@end table
@@ -38846,6 +38897,11 @@ If you do a @code{ROLLBACK} when you have updated a non-transactional table
you will get an error as a warning.
@item
Reset status variable which could cause problem if one used @code{--slow-log}.
@item
Added variable @code{connect_timeout} to @code{mysql} and @code{mysqladmin}.
@item
Added @code{connect_timeout} as an alias for @code{timeout} for config files
read by @code{mysql_options()}.
@end itemize
@node News-3.23.28, News-3.23.27, News-3.23.29, News-3.23.x
@@ -38864,7 +38920,7 @@ Fixed a major performance bug in the table locking code when one
constantly had a LOT of @code{SELECT}, @code{UPDATE} and @code{INSERT}
statements running. The symptom was that the @code{UPDATE} and
@code{INSERT} queries was locked a long time while new @code{SELECT}
statements where executed without locks.
statements where executed before the updates.
@item
When reading options_files with @code{mysql_options()} the
@code{return-found-rows} option was ignored.
@@ -38874,9 +38930,10 @@ is read by @code{mysql_options()}. This makes it possible to force
programs that runs for a long time (like @code{mysqlhotcopy}) to use
@code{interactive_timeout} instead of @code{wait_timeout}.
@item
We now always print when the query was made and who made it in the 'slow
query log'.  If you are using @code{--log-long-format} then also queries
that are not using indexes are printed.
Added to the slow query log the time and the user name for each logged
query. If you are using @code{--log-long-format} then also queries that
are not using indexes are logged, even the query takes less than
@code{long_query_time} seconds.
@item
Fixed problem in @code{LEFT JOIN} which caused all columns in reference
table to be NULL.
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ SUBDIRS = include @docs_dirs@ @readline_dir@ \
CLEANFILES =		linked_client_sources linked_server_sources linked_libmysql_sources linked_libmysql_r_sources linked_include_sources

# This is just so that the linking is done early.
config.h:	linked_include_sources linked_client_sources linked_server_sources
config.h:	linked_include_sources linked_client_sources linked_server_sources linked_libmysql_sources linked_libmysql_r_sources

linked_include_sources:
	cd include; $(MAKE) link_sources
+9 −9
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ static HashTable ht;
enum enum_info_type { INFO_INFO,INFO_ERROR,INFO_RESULT};
typedef enum enum_info_type INFO_TYPE;

const char *VER="11.6";
const char *VER="11.7";

static MYSQL mysql;			/* The connection */
static bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
@@ -118,7 +118,7 @@ static bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
	    opt_compress=0,
	    vertical=0,skip_line_numbers=0,skip_column_names=0,opt_html=0,
	    opt_nopager=1, opt_outfile=0, no_named_cmds=1;
static uint verbose=0,opt_silent=0,opt_mysql_port=0,opt_connect_timeout=0;
static uint verbose=0,opt_silent=0,opt_mysql_port=0;
static my_string opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE;
static char *current_host,*current_db,*current_user=0,*opt_password=0,
@@ -126,7 +126,7 @@ static char *current_host,*current_db,*current_user=0,*opt_password=0,
static char *histfile;
static String glob_buffer,old_buffer;
static STATUS status;
static ulong select_limit,max_join_size;
static ulong select_limit,max_join_size,opt_connect_timeout=0;
static char default_pager[FN_REFLEN];
char pager[FN_REFLEN], outfile[FN_REFLEN];
FILE *PAGER, *OUTFILE;
@@ -371,7 +371,7 @@ sig_handler mysql_end(int sig)
  exit(status.exit_status);
}

enum options {OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, OPT_TIMEOUT,
enum options {OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
	      OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE} ;


@@ -420,7 +420,6 @@ static struct option long_options[] =
  {"socket",	    required_argument,	   0, 'S'},
#include "sslopt-longopts.h"
  {"table",	    no_argument,	   0, 't'},
  {"timeout",	    required_argument,	   0, OPT_TIMEOUT},
#ifndef DONT_ALLOW_USER_CHANGE
  {"user",	    required_argument,	   0, 'u'},
#endif
@@ -434,6 +433,7 @@ static struct option long_options[] =


CHANGEABLE_VAR changeable_vars[] = {
  { "connect_timeout", (long*) &opt_connect_timeout, 0, 0, 3600*12, 0, 1},
  { "max_allowed_packet", (long*) &max_allowed_packet,16*1024L*1024L,4096,
    24*1024L*1024L, MALLOC_OVERHEAD,1024},
  { "net_buffer_length",(long*) &net_buffer_length,16384,1024,24*1024*1024L,
@@ -697,9 +697,6 @@ static int get_options(int argc, char **argv)
      opt_mysql_unix_port=my_strdup(MYSQL_NAMEDPIPE,MYF(0));
#endif
      break;
    case OPT_TIMEOUT:
      opt_connect_timeout=atoi(optarg);
      break;
    case 'V': usage(1); exit(0);
    case 'I':
    case '?':
@@ -2045,8 +2042,11 @@ sql_real_connect(char *host,char *database,char *user,char *password,
  }
  mysql_init(&mysql);
  if (opt_connect_timeout)
  {
    uint timeout=opt_connect_timeout;
    mysql_options(&mysql,MYSQL_OPT_CONNECT_TIMEOUT,
		  (char*) &opt_connect_timeout);
		  (char*) &timeout);
  }
  if (opt_compress)
    mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
#ifdef HAVE_OPENSSL
+28 −9
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
#include <my_pthread.h>				/* because of signal()	*/
#endif

#define ADMIN_VERSION "8.12"
#define ADMIN_VERSION "8.13"
#define MAX_MYSQL_VAR 64
#define MAX_TIME_TO_WAIT 3600			/* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@@ -40,6 +40,7 @@ static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0,option_silent=0,
               opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0;
static uint tcp_port = 0, option_wait = 0;
static ulong opt_connect_timeout;
static my_string unix_port=0;

/* When using extended-status relatively, ex_val_max_len is the estimated
@@ -116,11 +117,12 @@ static struct option long_options[] = {
#endif
  {"port",               required_argument, 0, 'P'},
  {"relative",           no_argument,       0, 'r'},
  {"set-variable",	 required_argument, 0, 'O'},
  {"silent",             no_argument,       0, 's'},
  {"socket",             required_argument, 0, 'S'},
  {"sleep",              required_argument, 0, 'i'},
#include "sslopt-longopts.h"
  {"timeout",            required_argument, 0, 't'},
  {"connect-timeout",    required_argument, 0, 't'},
#ifndef DONT_ALLOW_USER_CHANGE
  {"user",               required_argument, 0, 'u'},
#endif
@@ -131,6 +133,11 @@ static struct option long_options[] = {
  {0, 0, 0, 0}
};

CHANGEABLE_VAR changeable_vars[] = {
  { "connect_timeout", (long*) &opt_connect_timeout, 0, 0, 3600*12, 0, 1},
  { 0, 0, 0, 0, 0, 0, 0}  
};

static const char *load_default_groups[]= { "mysqladmin","client",0 };

int main(int argc,char *argv[])
@@ -143,7 +150,7 @@ int main(int argc,char *argv[])
  mysql_init(&mysql);
  load_defaults("my",load_default_groups,&argc,&argv);

  while ((c=getopt_long(argc,argv,"h:i:p::u:#::P:sS:Ct:fq?vVw::WrE",
  while ((c=getopt_long(argc,argv,"h:i:p::u:#::P:sS:Ct:fq?vVw::WrEO:",
			long_options, &option_index)) != EOF)
  {
    switch(c) {
@@ -187,6 +194,13 @@ int main(int argc,char *argv[])
    case 'E':
      opt_vertical = 1;
      break;
    case 'O':
      if (set_changeable_var(optarg, changeable_vars))
      {
	usage();
	return(1);
      }
      break;
    case 's':
      option_silent = 1;
      break;
@@ -198,12 +212,6 @@ int main(int argc,char *argv[])
      unix_port=MYSQL_NAMEDPIPE;
#endif
      break;
    case 't':
      {
	uint tmp=atoi(optarg);
	mysql_options(&mysql,MYSQL_OPT_CONNECT_TIMEOUT, (char*) &tmp);
	break;
      }
    case '#':
      DBUG_PUSH(optarg ? optarg : "d:t:o,/tmp/mysqladmin.trace");
      break;
@@ -253,6 +261,11 @@ int main(int argc,char *argv[])

  if (opt_compress)
    mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
  if (opt_connect_timeout)
  {
    uint tmp=opt_connect_timeout;
    mysql_options(&mysql,MYSQL_OPT_CONNECT_TIMEOUT, (char*) &tmp);
  }
#ifdef HAVE_OPENSSL
  if (opt_use_ssl)
    mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
@@ -763,6 +776,7 @@ static void print_version(void)

static void usage(void)
{
  uint i;
  print_version();
  puts("Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB");
  puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
@@ -804,6 +818,11 @@ static void usage(void)
  -V, --version		Output version information and exit\n\
  -w, --wait[=retries]  Wait and retry if connection is down\n");
  print_defaults("my",load_default_groups);
  printf("\nPossible variables for option --set-variable (-O) are:\n");
  for (i=0 ; changeable_vars[i].name ; i++)
    printf("%-20s  current value: %lu\n",
	   changeable_vars[i].name,
	   (ulong) *changeable_vars[i].varptr);

  puts("\nWhere command is a one or more of: (Commands may be shortened)\n\
  create databasename	Create a new database\n\
Loading