summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Docs/manual.texi7
-rw-r--r--myisam/mi_check.c3
-rw-r--r--myisam/myisamdef.h7
-rw-r--r--sql/ha_myisam.cc29
-rw-r--r--sql/sql_base.cc4
5 files changed, 32 insertions, 18 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 7d60130e819..81939e8317a 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -16319,7 +16319,8 @@ Version 3.22. @code{ADDDATE()} and @code{SUBDATE()} are synonyms for
@code{DATE_ADD()} and @code{DATE_SUB()}.
In @strong{MySQL} Version 3.23, you can use @code{+} and @code{-} instead of
-@code{DATE_ADD()} and @code{DATE_SUB()}. (See example)
+@code{DATE_ADD()} and @code{DATE_SUB()} if the expression on the right side is
+a date or datetime column. (See example)
@code{date} is a @code{DATETIME} or @code{DATE} value specifying the starting
date. @code{expr} is an expression specifying the interval value to be added
@@ -20221,7 +20222,9 @@ this join type is good.
@item range
Only rows that are in a given range will be retrieved, using an index to
-select the rows. The @code{ref} column indicates which index is used.
+select the rows. The @code{key} column indicates which index is used.
+The @code{key_len} contains the longest key part that was used.
+The @code{ref} column will be NULL for this type.
@item index
This is the same as @code{ALL}, except that only the index tree is
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 31d4aca1309..b95767d33cb 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -504,7 +504,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
if (used_length > keyinfo->block_length)
{
- mi_check_print_error(param,"Wrong pageinfo at page: %s", llstr(page,llbuff));
+ mi_check_print_error(param,"Wrong pageinfo at page: %s",
+ llstr(page,llbuff));
goto err;
}
for ( ;; )
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index 1af94de1990..a65694dbd94 100644
--- a/myisam/myisamdef.h
+++ b/myisam/myisamdef.h
@@ -575,6 +575,10 @@ enum myisam_log_commands {
#define myisam_log_command(a,b,c,d,e) if (myisam_log_file >= 0) _myisam_log_command(a,b,c,d,e)
#define myisam_log_record(a,b,c,d,e) if (myisam_log_file >= 0) _myisam_log_record(a,b,c,d,e)
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern uint _mi_get_block_info(MI_BLOCK_INFO *,File, my_off_t);
extern uint _mi_rec_pack(MI_INFO *info,byte *to,const byte *from);
extern uint _mi_pack_get_block_info(MI_INFO *mysql, MI_BLOCK_INFO *, File,
@@ -630,9 +634,6 @@ int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share);
int mi_open_keyfile(MYISAM_SHARE *share);
/* Functions needed by mi_check */
-#ifdef __cplusplus
-extern "C" {
-#endif
void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...));
void mi_check_print_warning _VARARGS((MI_CHECK *param, const char *fmt,...));
void mi_check_print_info _VARARGS((MI_CHECK *param, const char *fmt,...));
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 5ceacfd52de..8be9bc62ba7 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -57,6 +57,8 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
my_vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
msgbuf[sizeof(msgbuf) - 1] = 0; // healthy paranoia
+ DBUG_PRINT(msg_type,("message: %s",msgbuf));
+
if (thd->net.vio == 0)
{
sql_print_error(msgbuf);
@@ -413,8 +415,8 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
myisamchk_init(&param);
param.thd = thd;
param.op_name = (char*) "repair";
- param.testflag = (check_opt->flags | T_SILENT | T_FORCE_CREATE |
- T_REP_BY_SORT);
+ param.testflag = ((check_opt->flags | T_SILENT | T_FORCE_CREATE) |
+ (check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT));
if (check_opt->quick)
param.opt_rep_quick++;
param.sort_buffer_length= check_opt->sort_buffer_size;
@@ -429,8 +431,8 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
}
if ((param.testflag & T_REP_BY_SORT))
{
- param.testflag= (param.testflag & ~T_REP_BY_SORT) | T_REP;
- sql_print_error("Warning: Retrying recover of: %s with safe repair",
+ param.testflag= (param.testflag & ~T_REP_BY_SORT) | T_REP;
+ sql_print_error("Warning: Retrying recover of: %s with keycache",
table->path);
continue;
}
@@ -463,13 +465,14 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
char fixed_name[FN_REFLEN];
const char *old_proc_info=thd->proc_info;
MYISAM_SHARE* share = file->s;
+ DBUG_ENTER("ha_myisam::repair");
param.table_name = table->table_name;
param.tmpfile_createflag = O_RDWR | O_TRUNC;
param.using_global_keycache = 1;
param.thd=thd;
param.tmpdir=mysql_tmpdir;
-
+ param.out_flag=0;
VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT,
4+ (param.opt_follow_links ? 16 : 0)));
@@ -479,15 +482,16 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))))
{
optimize_done=1;
- if (mi_test_if_sort_rep(file,file->state->records,0))
+ if (mi_test_if_sort_rep(file,file->state->records,0) &&
+ (param.testflag & T_REP_BY_SORT))
{
param.testflag|= T_STATISTICS; // We get this for free
- thd->proc_info="Repairing by sorting";
+ thd->proc_info="Repair by sorting";
error = mi_repair_by_sort(&param, file, fixed_name, param.opt_rep_quick);
}
else
{
- thd->proc_info="Repairing";
+ thd->proc_info="Repair with keycache";
error= mi_repair(&param, file, fixed_name, param.opt_rep_quick);
}
}
@@ -558,8 +562,9 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
}
if (param.out_flag & O_NEW_DATA)
error|=change_to_newfile(fixed_name,MI_NAME_DEXT,
- DATA_TMP_EXT, 0, MYF(0));
-
+ DATA_TMP_EXT, 0,
+ (param.testflag & T_BACKUP_DATA ?
+ MYF(MY_REDEL_MAKE_BACKUP): MYF(0)));
if (param.out_flag & O_NEW_INDEX)
error|=change_to_newfile(fixed_name,MI_NAME_IEXT,
INDEX_TMP_EXT, 0, MYF(0));
@@ -574,8 +579,8 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
}
}
thd->proc_info=old_proc_info;
- return (error ? HA_ADMIN_FAILED :
- !optimize_done ? HA_ADMIN_ALREADY_DONE : HA_ADMIN_OK);
+ DBUG_RETURN(error ? HA_ADMIN_FAILED :
+ !optimize_done ? HA_ADMIN_ALREADY_DONE : HA_ADMIN_OK);
}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index a6b563046c7..584bacc237c 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1165,6 +1165,10 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
entry) ||
(entry->file->is_crashed() && entry->file->check_and_repair(thd)))
{
+ /* Give right error message */
+ thd->net.last_error[0]=0;
+ thd->net.last_errno=0;
+ entry->file->print_error(HA_ERR_CRASHED,MYF(0));
sql_print_error("Error: Couldn't repair table: %s.%s",db,name);
closefrm(entry);
error=1;