From 295c3d1fa9a1950d1ebf6832da896e36f483d692 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 Oct 2000 02:22:28 +0300 Subject: [PATCH] Fixed bug in how FAST and CHANGED worked Docs/manual.texi: Removed bugs from manual; Updated CHECK TABLE --- Docs/manual.texi | 40 ++++++++++++++++++++++++++-------------- sql/ha_myisam.cc | 7 ++++--- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index ef0dd3af67a..133cb095419 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -12021,6 +12021,7 @@ Website}. @findex SET PASSWORD statement @cindex setting, passwords @node Passwords, Access denied, Adding users, Privilege system +@section Setting passwords In most cases you should use @code{GRANT} to set up your users/passwords, so the following only applies for advanced users. @xref{GRANT, , @code{GRANT}}. @@ -16653,7 +16654,7 @@ This is an "RSA Data Security, Inc. MD5 Message-Digest Algorithm". @item LAST_INSERT_ID([expr]) Returns the last automatically generated value that was inserted into an @code{AUTO_INCREMENT} column. -@xref{mysql_insert_id,, @code{mysql_insert_id()}}: +@xref{mysql_insert_id,, @code{mysql_insert_id()}}. @example mysql> select LAST_INSERT_ID(); @@ -16872,7 +16873,7 @@ mysql> select student_name, AVG(test_score) @itemx MAX(expr) Returns the minimum or maximum value of @code{expr}. @code{MIN()} and @code{MAX()} may take a string argument; in such cases they return the -minimum or maximum string value. @xref{MySQL indexes}: +minimum or maximum string value. @xref{MySQL indexes}. @example mysql> select student_name, MIN(test_score), MAX(test_score) @@ -17813,12 +17814,34 @@ The different check types stand for the following: @multitable @columnfractions .20 .80 @item @strong{Type} @tab @strong{Meaning} -@item @code{QUICK} @tab Don't scan the rows for fixed size record tables. +@item @code{QUICK} @tab Don't scan the rows to check for wrong links. @item @code{FAST} @tab Only check tables which haven't been closed properly. @item @code{CHANGED} @tab Only check tables which have been changed since last check or haven't been closed properly. @item @code{EXTENDED} @tab Do a full key lookup for all keys for each row. This ensures that the table is 100 % consistent, but will take a long time! @end multitable +If a table is corrupted, then it's most likely that the problem is in +the indexes and not in the data part. All of the above check types +checks the indexes throughly and should thus find most errors. + +If you just want to check a table that you assume is ok, you should use +no check options or the @code{QUICK} option. The later should be used +when you are in a hurry and can take the very small risk that +@code{QUICK} didn't find an error in the data file (In most cases +@strong{MySQL} should find, under normal usage, any error in the data +file. If this happens then the table will be marked as 'corrupted'. + +@code{FAST} and @code{CHANGED} are mostly intended to be used from a +script (for example to be executed from cron) if you want to check your +table from time to time. In most cases you @code{FAST} is to be prefered +over @code{CHANGED}. (The only case when it isn't is when you suspect a +bug you have found a bug in the @code{MyISAM} code.). + +@code{EXTENDED} is only to be used after you have run a normal check but +still get strange errors from a table when @strong{MySQL} tries to +update a row or find a row by key (this is VERY unlikely to happen if a +normal check has succeeded!). + @findex BACKUP TABLE @node BACKUP TABLE, RESTORE TABLE, CHECK TABLE, Reference @section @code{BACKUP TABLE} syntax @@ -43265,17 +43288,6 @@ All new development is concentrated to @strong{MySQL}. @page @c This node name is special -@ifset nusphere -@cindex GNU General Public License -@cindex licenses, GNU General Public License -@node GPL license, LGPL license, Unireg, Top -@appendix GNU General Public License - -The GPL License can be found at ... - -@end ifset - -@ifclear nusphere @node GPL license, LGPL license, Unireg, Top @appendix GNU General Public License diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 1c5356e0c32..698a4f64d14 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -250,10 +250,11 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt) if (!mi_is_crashed(file) && (((param.testflag & T_CHECK_ONLY_CHANGED) && - (share->state.changed & (STATE_CHANGED | STATE_CRASHED | - STATE_CRASHED_ON_REPAIR)) && + !(share->state.changed & (STATE_CHANGED | STATE_CRASHED | + STATE_CRASHED_ON_REPAIR)) && share->state.open_count == 0) || - ((param.testflag & T_FAST) && share->state.open_count == 0))) + ((param.testflag & T_FAST) && (share->state.open_count == + (share->global_changed ? 1 : 0))))) return HA_ADMIN_ALREADY_DONE; error = chk_size(¶m, file);