summaryrefslogtreecommitdiff
path: root/storage/maria
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-03-28 13:58:14 +0300
committerMichael Widenius <monty@askmonty.org>2012-03-28 13:58:14 +0300
commitbb6cc525280044eba19462a0d9ab24b67031feaa (patch)
treef7d9c1a6fa0213f6a2f3a683ade44546c73609d9 /storage/maria
parent6131d708e889cd4f93490c22bfee00d0728edfd2 (diff)
parent3bc932ec175ae9ac2fc6c0c5be29002819c9b102 (diff)
downloadmariadb-git-bb6cc525280044eba19462a0d9ab24b67031feaa.tar.gz
Automatic merge
Diffstat (limited to 'storage/maria')
-rw-r--r--storage/maria/ha_maria.cc24
-rw-r--r--storage/maria/ha_maria.h10
-rw-r--r--storage/maria/ma_open.c2
3 files changed, 32 insertions, 4 deletions
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 41e79187409..8b75d7641f3 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -52,6 +52,9 @@ C_MODE_END
ulong pagecache_division_limit, pagecache_age_threshold;
ulonglong pagecache_buffer_size;
+const char *zerofill_error_msg=
+ "Table is from another system and must be zerofilled or repaired to be "
+ "usable on this system";
/**
As the auto-repair is initiated when opened from the SQL layer
@@ -1058,7 +1061,15 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
}
if (!(file= maria_open(name, mode, test_if_locked | HA_OPEN_FROM_SQL_LAYER)))
+ {
+ if (my_errno == HA_ERR_OLD_FILE)
+ {
+ push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_CRASHED_ON_USAGE,
+ zerofill_error_msg);
+ }
return (my_errno ? my_errno : -1);
+ }
file->s->chst_invalidator= query_cache_invalidate_by_MyISAM_filename_ref;
/* Set external_ref, mainly for temporary tables */
@@ -1172,6 +1183,14 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
return HA_ADMIN_ALREADY_DONE;
maria_chk_init_for_check(&param, file);
+
+ if ((file->s->state.changed & (STATE_CRASHED_FLAGS | STATE_MOVED)) ==
+ STATE_MOVED)
+ {
+ _ma_check_print_error(&param, zerofill_error_msg);
+ return HA_ADMIN_CORRUPT;
+ }
+
old_proc_info= thd_proc_info(thd, "Checking status");
thd_progress_init(thd, 3);
(void) maria_chk_status(&param, file); // Not fatal
@@ -2166,6 +2185,11 @@ bool ha_maria::check_and_repair(THD *thd)
if ((file->s->state.changed & (STATE_CRASHED_FLAGS | STATE_MOVED)) ==
STATE_MOVED)
{
+ /* Remove error about crashed table */
+ mysql_reset_errors(thd, true);
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_CRASHED_ON_USAGE,
+ "Zerofilling moved table %s", table->s->path.str);
sql_print_information("Zerofilling moved table: '%s'",
table->s->path.str);
if (!(error= zerofill(thd, &check_opt)))
diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h
index b5d7b18c49a..48ee9a99474 100644
--- a/storage/maria/ha_maria.h
+++ b/storage/maria/ha_maria.h
@@ -151,8 +151,14 @@ public:
bool check_and_repair(THD * thd);
bool is_crashed() const;
bool is_changed() const;
- bool auto_repair() const
- { return test(maria_recover_options & HA_RECOVER_ANY); }
+ bool auto_repair(int error) const
+ {
+ /* Always auto-repair moved tables (error == HA_ERR_OLD_FILE) */
+ return ((test(maria_recover_options & HA_RECOVER_ANY) &&
+ error == HA_ERR_CRASHED_ON_USAGE) ||
+ error == HA_ERR_OLD_FILE);
+
+ }
int optimize(THD * thd, HA_CHECK_OPT * check_opt);
int restore(THD * thd, HA_CHECK_OPT * check_opt);
int backup(THD * thd, HA_CHECK_OPT * check_opt);
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index 84da4f12f65..83ad41a9a38 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -1006,8 +1006,6 @@ err:
tmp_name.length= strlen(name);
_ma_report_error(save_errno, &tmp_name);
}
- if (save_errno == HA_ERR_OLD_FILE) /* uuid is different ? */
- save_errno= HA_ERR_CRASHED_ON_USAGE; /* the code to trigger auto-repair */
switch (errpos) {
case 5:
if (data_file >= 0)