diff options
-rw-r--r-- | Docs/manual.texi | 81 | ||||
-rw-r--r-- | sql/handler.cc | 6 | ||||
-rw-r--r-- | sql/mysqld.cc | 19 | ||||
-rw-r--r-- | sql/sql_parse.cc | 3 | ||||
-rw-r--r-- | sql/sql_select.cc | 20 |
5 files changed, 87 insertions, 42 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 1e8b509f0b8..39d5447be19 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -30719,6 +30719,10 @@ of real fatal errors) as @code{myisamchk}. On the other hand, flushing tables. @xref{OPTIMIZE TABLE, , @code{OPTIMIZE TABLE}}. +Even that the repair in @code{myisamchk} is quite secure, it's always a +good idea to make a backup BEFORE doing a repair (or anything that could +make a lot of changes to a table) + @menu * myisamchk syntax:: @code{myisamchk} invocation syntax * myisamchk memory:: @code{myisamchk} memory usage @@ -30739,7 +30743,7 @@ described below. (You can also get a list of options by invoking table. To get more information or to tell @code{myisamchk} to take corrective action, specify options as described below and in the following sections. -@code{tbl_name} is the database table you want to check. If you run +@code{tbl_name} is the database table you want to check/repair. If you run @code{myisamchk} somewhere other than in the database directory, you must specify the path to the file, because @code{myisamchk} has no idea where your database is located. Actually, @code{myisamchk} doesn't care whether or not @@ -30775,18 +30779,19 @@ shell> myisamchk /path/to/datadir/*/*.MYI The recommended way to quickly check all tables is: @example -myisamchk --fast --silent /path/to/datadir/*/*.MYI +myisamchk --silent --fast /path/to/datadir/*/*.MYI isamchk --silent /path/to/datadir/*/*.ISM @end example -@code{myisamchk} supports the following options. +If you want to check all tables and repair all tables that are corrupted, +you can use the following line: -@menu -* myisamchk general options:: -* myisamchk check options:: -* myisamchk repair options:: -* myisamchk other options:: -@end menu +@example +myisamchk --silent --force --fast --update-state -O key_buffer=64M -O sort_buffer=64M -O read_buffer=1M -O write_buffer=1M /path/to/datadir/*/*.MYI +isamchk --silent --force -O key_buffer=64M -O sort_buffer=64M -O read_buffer=1M -O write_buffer=1M /path/to/datadir/*/*.ISM +@end example + +The above assumes that you have more than 64 M free. Note that if you get an error like: @@ -30804,11 +30809,20 @@ tables while you are running @code{myisamchk}. In @strong{MySQL} Version 3.23 the easiest way to avoid this problem is to use @code{CHECK TABLE} instead of @code{myisamchk} to check tables. +@menu +* myisamchk general options:: +* myisamchk check options:: +* myisamchk repair options:: +* myisamchk other options:: +@end menu + @cindex options, @code{myisamchk} @cindex @code{myisamchk}, options @node myisamchk general options, myisamchk check options, myisamchk syntax, myisamchk syntax @subsubsection General Options for @code{myisamchk} +@code{myisamchk} supports the following options. + @table @code @item -# or --debug=debug_options Output debug log. The @code{debug_options} string often is @@ -33535,26 +33549,29 @@ Here are some reasons the @code{Can't connect to local MySQL server} error might occur: @itemize @bullet -@item @code{mysqld} is not running. -@item You are running on a system that uses MIT-pthreads. -If you are running on a system that doesn't have native threads, @code{mysqld} -uses the MIT-pthreads package. -@xref{Which OS}. -However, MIT-pthreads doesn't support Unix sockets, so on such a system you -must always specify the hostname explicitly when connecting to the server. -Try using this command to check the connection to the server: +@item +@code{mysqld} is not running. +@item +You are running on a system that uses MIT-pthreads. +If you are running on a system that doesn't have native threads, +@code{mysqld} uses the MIT-pthreads package. @xref{Which OS}. However, +all MIT-pthreads versions doesn't support Unix sockets. On a system +without sockets support you must always specify the hostname explicitly +when connecting to the server. Try using this command to check the +connection to the server: @example shell> mysqladmin -h `hostname` version @end example -@item Someone has removed the Unix socket that @code{mysqld} uses (default -@file{/tmp/mysqld.sock}). You might have a @code{cron} job that removes the -@strong{MySQL} socket (for example, a job that removes old files from the @file{/tmp} -directory). You can always run @code{mysqladmin version} and -check that the socket @code{mysqladmin} is trying to use really exists. -The fix in this case is to change the @code{cron} job to not remove -@file{mysqld.sock} or to place the socket somewhere else. You can specify -a different socket location at @strong{MySQL} configuration time with this -command: +@item +Someone has removed the Unix socket that @code{mysqld} uses (default +@file{/tmp/mysqld.sock}). You might have a @code{cron} job that removes +the @strong{MySQL} socket (for example, a job that removes old files +from the @file{/tmp} directory). You can always run @code{mysqladmin +version} and check that the socket @code{mysqladmin} is trying to use +really exists. The fix in this case is to change the @code{cron} job to +not remove @file{mysqld.sock} or to place the socket somewhere else. You +can specify a different socket location at @strong{MySQL} configuration +time with this command: @example shell> ./configure --with-unix-socket-path=/path/to/socket @end example @@ -33562,7 +33579,8 @@ You can also start @code{safe_mysqld} with the @code{--socket=/path/to/socket} option and set the environment variable @code{MYSQL_UNIX_PORT} to the socket pathname before starting your @strong{MySQL} clients. -@item You have started the @code{mysqld} server with +@item +You have started the @code{mysqld} server with the @code{--socket=/path/to/socket} option. If you change the socket pathname for the server, you must also notify the @strong{MySQL} clients about the new path. You can do this by setting the environment variable @@ -33577,6 +33595,11 @@ You are using Linux and one thread has died (core dumped). In this case you must kill the other @code{mysqld} threads (for example, with the @code{mysql_zap} script before you can start a new @strong{MySQL} server. @xref{Crashing}. +@item +You may not have read and write privilege to either the directory that holds +the socket file or privilege to the socket file itself. In this case you +have to either change the privilege for the directory / file or restart +@code{mysqld} so that it uses a directory that you can access. @end itemize If you get the error message @code{Can't connect to MySQL server on @@ -33871,12 +33894,12 @@ You can check which tables you have in the current database with @cindex multibyte character sets @node Cannot initialize character set, , Cannot find table, Common errors -@subsection @code{Can't initialize character set 'xxx'} error. +@subsection @code{Can@'t initialize character set xxx} error. If you get an error like: @example -MySQL Connection Failed: Can't initialize character set xx +MySQL Connection Failed: Can't initialize character set xxx @end example This means one of the following things: diff --git a/sql/handler.cc b/sql/handler.cc index 3859f496f9a..9023e8e9908 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -178,7 +178,7 @@ void ha_close_connection(THD* thd) { #ifdef HAVE_INNOBASE_DB if (!innobase_skip) - innobase_close_connection(THD* thd); + innobase_close_connection(thd); #endif } @@ -236,7 +236,6 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) my_error(ER_ERROR_DURING_COMMIT, MYF(0), error); error=1; } - trans->innobase_tid=0; } #endif if (error && trans == &thd->transaction.all && mysql_bin_log.is_open()) @@ -263,12 +262,11 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans) #ifdef HAVE_INNOBASE_DB if (trans->innobase_tid) { - if ((error=innobase_rollback(thd))) + if ((error=innobase_rollback(thd, trans->innobase_tid))) { my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), error); error=1; } - trans->innobase_tid=0; } #endif #ifdef USING_TRANSACTIONS diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1ca7d5ff2ef..ca5d3bc7540 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2450,7 +2450,7 @@ static struct option long_options[] = { #ifdef HAVE_INNOBASE_DB {"innobase_data_home_dir", required_argument, 0, OPT_INNOBASE_DATA_HOME_DIR}, - {"innobase_data_file_path", required_argument, 0, + {"innobase_data_file_path", required_argument, 0, OPT_INNOBASE_DATA_FILE_PATH}, {"innobase_log_group_home_dir", required_argument, 0, OPT_INNOBASE_LOG_GROUP_HOME_DIR}, @@ -2575,15 +2575,15 @@ CHANGEABLE_VAR changeable_vars[] = { #ifdef HAVE_INNOBASE_DB {"innobase_mirrored_log_groups", (long*) &innobase_mirrored_log_groups, 1, 1, 10, 0, 1}, - {"innobase_log_files_in_group", - (long*) &innobase_mirrored_log_groups, 2, 2, 100, 0, 1}, - {"innobase_log_file_size", + {"innobase_log_files_in_group", + (long*) &innobase_log_files_in_group, 2, 2, 100, 0, 1}, + {"innobase_log_file_size", (long*) &innobase_log_file_size, 5*1024*1024L, 1*1024*1024L, ~0L, 0, 1024*1024L}, - {"innobase_log_buffer_size", + {"innobase_log_buffer_size", (long*) &innobase_log_buffer_size, 1024*1024L, 256*1024L, ~0L, 0, 1024}, - {"innobase_buffer_pool_size", + {"innobase_buffer_pool_size", (long*) &innobase_buffer_pool_size, 8*1024*1024L, 1024*1024L, ~0L, 0, 1024*1024L}, {"innobase_additional_mem_pool_size", @@ -2591,6 +2591,9 @@ CHANGEABLE_VAR changeable_vars[] = { ~0L, 0, 1024}, {"innobase_file_io_threads", (long*) &innobase_file_io_threads, 9, 4, 64, 0, 1}, + {"innobase_lock_wait_timeout", + (long*) &innobase_lock_wait_timeout, 1024 * 1024 * 1024, 1, + 1024 * 1024 * 1024, 0, 1}, #endif { "interactive_timeout", (long*) &net_interactive_timeout, NET_WAIT_TIMEOUT, 1, 31*24*60*60, 0, 1 }, @@ -3463,13 +3466,13 @@ static void get_options(int argc,char **argv) case OPT_GEMINI_SKIP: #ifdef HAVE_GEMINI_DB gemini_skip=1; - have_gemini_db=SHOW_OPTION_DISABLED; + have_gemini=SHOW_OPTION_DISABLED; #endif break; case OPT_INNOBASE_SKIP: #ifdef HAVE_INNOBASE_DB innobase_skip=1; - have_innobase_db=SHOW_HAVE_DISABLED; + have_innobase=SHOW_OPTION_DISABLED; #endif break; #ifdef HAVE_INNOBASE_DB diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 854a47fd9c0..ae8846f4039 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -209,7 +209,8 @@ check_connections(THD *thd) /* nasty, but any other way? */ uint pkt_len = 0; { - char buff[60],*end; + /* buff[] needs to big enough to hold the server_version variable */ + char buff[SERVER_VERSION_LENGTH + SCRAMBLE_LENGTH+32],*end; int client_flags = CLIENT_LONG_FLAG | CLIENT_CONNECT_WITH_DB | CLIENT_TRANSACTIONS; LINT_INIT(pkt_len); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6ab286195de..5a2f672368b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -475,6 +475,26 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, make_join_readinfo(&join, (select_options & SELECT_DESCRIBE) | SELECT_USE_CACHE); + + /* Need to tell Innobase that to play it safe, it should fetch all + columns of the tables: this is because MySQL + may build row pointers for the rows, and for all columns of the primary + key the field->query_id has not necessarily been set to thd->query_id + by MySQL. */ + +#ifdef HAVE_INNOBASE_DB + if (need_tmp || select_distinct || group || order) + { + for (uint i_h = join.const_tables; i_h < join.tables; i_h++) + { + JOIN_TAB* tab_h = join.join_tab + i_h; + TABLE* table_h = tab_h->table; + if (table_h->db_type == DB_TYPE_INNOBASE) + table_h->file->extra(HA_EXTRA_RESTORE_POS); + } + } +#endif + DBUG_EXECUTE("info",TEST_join(&join);); /* Because filesort always does a full table scan or a quick range scan |