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

Fixed bug in CHECK TABLE ... EXTENDED

Added keyword MEDIUM to CHECK TABLE
New benchmarks results for Linux-alpha
parent 513490e7
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -18419,13 +18419,15 @@ running!
@example
CHECK TABLE tbl_name[,tbl_name...] [option [option...]]
option = QUICK | FAST | EXTEND | CHANGED
option = QUICK | FAST | MEDIUM | EXTEND | CHANGED
@end example
@code{CHECK TABLE} only works on @code{MyISAM} and @code{BDB} tables. On
@code{MyISAM} tables it's the same thing as running @code{myisamchk -m
table_name} on the table.
If you don't specify any option @code{MEDIUM} is used.
Checks the table(s) for errors. For @code{MyISAM} tables the key statistics
is updated. The command returns a table with the following columns:
@@ -18451,9 +18453,14 @@ The different check types stand for the following:
@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{MEDIUM} @tab Scan rows to verify that deleted links are ok. This also calculates a key checksum for the rows and verifies this with a calcualted checksum for the keys.
@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
For dynamic sized @code{MyISAM} tables a started check will always
do a @code{MEDIUM} check. For static size rows we skip the row scan 
for @code{QUICK} and @code{FAST} as the rows are very seldom corrupted.
Note that for BDB tables the different check options doesn't affect the
check in any way!
@@ -40396,6 +40403,13 @@ though, so Version 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.31
@itemize @bullet
@item
@code{SHOW TABLE STATUS} didn't show correct average row length for tables
bigger than 4G.
@item
@code{CHECK TABLE .. EXTENED} didn't check row links for fixed size tables.
@item
Added option @code{MEDIUM} to @code{CHECK TABLE}.
@item
Fixed problem when using @code{DECIMAL()} keys on negative numbers.
@item
@code{HOUR()} on a @code{CHAR} column always returned @code{NULL}.
+7 −2
Original line number Diff line number Diff line
@@ -65,8 +65,13 @@ int mi_close(register MI_INFO *info)
			 share->temporary ? FLUSH_IGNORE_CHANGED :
			 FLUSH_RELEASE))
      error=my_errno;
    if (share->kfile >= 0 && my_close(share->kfile,MYF(0)))
    if (share->kfile >= 0)
    {
      if (share->mode != O_RDONLY && mi_is_crashed(info))
	mi_state_info_write(share->kfile, &share->state, 1);
      if (my_close(share->kfile,MYF(0)))
        error = my_errno;
    }
#ifdef HAVE_MMAP
    if (share->file_map)
      _mi_unmap_file(info);
+2 −2
Original line number Diff line number Diff line
@@ -59,8 +59,8 @@ int mi_status(MI_INFO *info, register MI_ISAMINFO *x, uint flag)
    x->keys	 	= share->state.header.keys;
    x->check_time	= share->state.check_time;
    x->mean_reclength	= info->state->records ?
      (ulong) (info->state->data_file_length-info->state->empty)/
      info->state->records : (ulong) share->min_pack_length;
      (ulong) ((info->state->data_file_length-info->state->empty)/
	       info->state->records) : (ulong) share->min_pack_length;
  }
  if (flag & HA_STATUS_ERRKEY)
  {
+2 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ Table Op Msg_type Msg_text
test.t1	check	status	OK
Table	Op	Msg_type	Msg_text
test.t1	check	status	OK
Table	Op	Msg_type	Msg_text
test.t1	check	status	OK
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Comment
t1	0	PRIMARY	1	a	A	5	NULL	NULL	
t1	1	b	1	b	A	1	NULL	NULL	
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ check table t1 type=fast;
check table t1 type=changed;
insert into t1 values (5,5,5);
check table t1 type=changed;
check table t1 type=medium;
check table t1 type=extended;
show keys from t1;
!$1062 insert into t1 values (5,5,5);
Loading