summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_myisam.cc12
-rw-r--r--sql/lex.h1
-rw-r--r--sql/sql_yacc.yy3
3 files changed, 12 insertions, 4 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index ecebe9d4ff2..7e6c4a697fa 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -246,7 +246,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
param.thd = thd;
param.op_name = (char*)"check";
param.table_name = table->table_name;
- param.testflag = check_opt->flags | T_CHECK | T_SILENT | T_MEDIUM;
+ param.testflag = check_opt->flags | T_CHECK | T_SILENT;
if (!(table->db_stat & HA_READ_ONLY))
param.testflag|= T_STATISTICS;
@@ -270,15 +270,19 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
if (!error)
{
if ((!check_opt->quick &&
- (share->options &
- (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD))) ||
+ ((share->options &
+ (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) ||
+ (param.testflag & (T_EXTEND | T_MEDIUM)))) ||
mi_is_crashed(file))
{
+ uint old_testflag=param.testflag;
+ param.testflag|=T_MEDIUM;
init_io_cache(&param.read_cache, file->dfile,
my_default_record_cache_size, READ_CACHE,
share->pack.header_length, 1, MYF(MY_WME));
error |= chk_data_link(&param, file, param.testflag & T_EXTEND);
end_io_cache(&(param.read_cache));
+ param.testflag=old_testflag;
}
}
if (!error)
@@ -548,7 +552,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
thd->proc_info="saving state";
if (!error)
{
- if (share->state.changed & STATE_CHANGED)
+ if ((share->state.changed & STATE_CHANGED) || mi_is_crashed(file))
{
share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED |
STATE_CRASHED_ON_REPAIR);
diff --git a/sql/lex.h b/sql/lex.h
index 399106bfd77..dd691f29bbc 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -207,6 +207,7 @@ static SYMBOL symbols[] = {
{ "MEDIUMTEXT", SYM(MEDIUMTEXT),0,0},
{ "MEDIUMINT", SYM(MEDIUMINT),0,0},
{ "MERGE", SYM(MERGE_SYM),0,0},
+ { "MEDIUM", SYM(MEDIUM_SYM),0,0},
{ "MIDDLEINT", SYM(MEDIUMINT),0,0}, /* For powerbuilder */
{ "MIN_ROWS", SYM(MIN_ROWS),0,0},
{ "MINUTE", SYM(MINUTE_SYM),0,0},
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 94c1ea943e7..4c50f50b001 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -205,6 +205,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token MASTER_CONNECT_RETRY_SYM
%token MATCH
%token MAX_ROWS
+%token MEDIUM_SYM
%token MERGE_SYM
%token MIN_ROWS
%token MYISAM_SYM
@@ -1156,6 +1157,7 @@ mi_check_types:
mi_check_type:
QUICK { Lex->check_opt.quick = 1; }
| FAST_SYM { Lex->check_opt.flags|= T_FAST; }
+ | MEDIUM_SYM { Lex->check_opt.flags|= T_MEDIUM; }
| EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; }
| CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; }
@@ -2510,6 +2512,7 @@ keyword:
| MASTER_USER_SYM {}
| MASTER_PASSWORD_SYM {}
| MASTER_CONNECT_RETRY_SYM {}
+ | MEDIUM_SYM {}
| MERGE_SYM {}
| MINUTE_SYM {}
| MIN_ROWS {}