summaryrefslogtreecommitdiff
path: root/sql/ha_myisam.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/ha_myisam.cc')
-rw-r--r--sql/ha_myisam.cc39
1 files changed, 34 insertions, 5 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 7e6c4a697fa..ac88c802949 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -375,6 +375,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
tmp_check_opt.init();
tmp_check_opt.quick = 1;
+ tmp_check_opt.flags |= T_VERY_SILENT;
return repair(thd, &tmp_check_opt);
err:
@@ -396,24 +397,52 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
char* backup_dir = thd->lex.backup_dir;
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
char* table_name = table->real_name;
+ int error = 0;
+ const char* errmsg = "";
+
if (!fn_format(dst_path, table_name, backup_dir, reg_ext, 4 + 64))
- return HA_ADMIN_INVALID;
+ {
+ errmsg = "failed in fn_format() for .frm file: errno=%d";
+ error = HA_ADMIN_INVALID;
+ goto err;
+ }
+
if (my_copy(fn_format(src_path, table->path,"", reg_ext, 4),
dst_path,
MYF(MY_WME | MY_HOLD_ORIGINAL_MODES )))
{
- return HA_ADMIN_FAILED;
+ error = HA_ADMIN_FAILED;
+ errmsg = "Failed copying .frm file: errno = %d";
+ goto err;
}
if (!fn_format(dst_path, table_name, backup_dir, MI_NAME_DEXT, 4 + 64))
- return HA_ADMIN_INVALID;
+ {
+ errmsg = "failed in fn_format() for .MYD file: errno=%d";
+ error = HA_ADMIN_INVALID;
+ goto err;
+ }
if (my_copy(fn_format(src_path, table->path,"", MI_NAME_DEXT, 4),
dst_path,
MYF(MY_WME | MY_HOLD_ORIGINAL_MODES )) )
- return HA_ADMIN_FAILED;
-
+ {
+ errmsg = "Failed copying .MYD file: errno = %d";
+ error= HA_ADMIN_FAILED;
+ goto err;
+ }
return HA_ADMIN_OK;
+ err:
+ {
+ MI_CHECK param;
+ myisamchk_init(&param);
+ param.thd = thd;
+ param.op_name = (char*)"backup";
+ param.table_name = table->table_name;
+ param.testflag = 0;
+ mi_check_print_error(&param,errmsg, errno );
+ return error;
+ }
}