summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/maria.h2
-rw-r--r--storage/maria/ha_maria.cc16
-rw-r--r--storage/maria/ha_maria.h3
-rw-r--r--storage/maria/ma_check.c2
4 files changed, 11 insertions, 12 deletions
diff --git a/include/maria.h b/include/maria.h
index 1f054bce58d..192e5a565aa 100644
--- a/include/maria.h
+++ b/include/maria.h
@@ -335,6 +335,8 @@ extern int maria_begin(MARIA_HA *info);
extern void maria_disable_logging(MARIA_HA *info);
extern void maria_enable_logging(MARIA_HA *info);
+#define HA_RECOVER_ANY (HA_RECOVER_DEFAULT | HA_RECOVER_BACKUP | HA_RECOVER_FORCE | HA_RECOVER_QUICK)
+
/* this is used to pass to mysql_mariachk_table */
#define MARIA_CHK_REPAIR 1 /* equivalent to mariachk -r */
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 4d1348bd07f..e02c8c5e2cd 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -70,10 +70,9 @@ const char *maria_recover_names[]=
Compared to MyISAM, "default" was renamed to "normal" as it collided with
SET var=default which sets to the var's default i.e. what happens when the
var is not set i.e. HA_RECOVER_NONE.
- Another change is that OFF is used to disable, not ""; this is to have OFF
- display in SHOW VARIABLES which is better than "".
+ OFF flag is ignored.
*/
- "OFF", "NORMAL", "BACKUP", "FORCE", "QUICK", NullS
+ "NORMAL", "BACKUP", "FORCE", "QUICK", "OFF", NullS
};
TYPELIB maria_recover_typelib=
{
@@ -200,8 +199,8 @@ static MYSQL_SYSVAR_ULONG(pagecache_division_limit, pagecache_division_limit,
static MYSQL_SYSVAR_SET(recover, maria_recover_options, PLUGIN_VAR_OPCMDARG,
"Specifies how corrupted tables should be automatically repaired."
- " Possible values are \"NORMAL\" (the default), \"BACKUP\", \"FORCE\","
- " \"QUICK\", or \"OFF\" which is like not using the option.",
+ " Possible values are one or more of \"NORMAL\" (the default), "
+ "\"BACKUP\", \"FORCE\", or \"QUICK\".",
NULL, NULL, HA_RECOVER_DEFAULT, &maria_recover_typelib);
static MYSQL_THDVAR_ULONG(repair_threads, PLUGIN_VAR_RQCMDARG,
@@ -966,7 +965,7 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
test_if_locked|= HA_OPEN_MMAP;
#endif
- if (unlikely(maria_recover_options != HA_RECOVER_NONE))
+ if (maria_recover_options & HA_RECOVER_ANY)
{
/* user asked to trigger a repair if table was not properly closed */
test_if_locked|= HA_OPEN_ABORT_IF_CRASHED;
@@ -1568,9 +1567,6 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
_ma_check_print_warning(param, "Number of rows changed from %s to %s",
llstr(rows, llbuff),
llstr(file->state->records, llbuff2));
- /* Abort if warning was converted to error */
- if (table->in_use->is_error())
- error= 1;
}
}
else
@@ -3199,7 +3195,7 @@ static int mark_recovery_start(const char* log_dir)
{
int res;
DBUG_ENTER("mark_recovery_start");
- if (unlikely(maria_recover_options == HA_RECOVER_NONE))
+ if (!(maria_recover_options & HA_RECOVER_ANY))
ma_message_no_user(ME_JUST_WARNING, "Please consider using option"
" --maria-recover[=...] to automatically check and"
" repair tables when logs are removed by option"
diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h
index f326efe17a2..47545b67ff3 100644
--- a/storage/maria/ha_maria.h
+++ b/storage/maria/ha_maria.h
@@ -142,7 +142,8 @@ public:
bool check_and_repair(THD * thd);
bool is_crashed() const;
bool is_changed() const;
- bool auto_repair() const { return maria_recover_options != HA_RECOVER_NONE; }
+ bool auto_repair() const
+ { return test(maria_recover_options & HA_RECOVER_ANY); }
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_check.c b/storage/maria/ma_check.c
index 62299df9f7d..9f3c9059397 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -3884,7 +3884,7 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
_ma_check_print_error(param,
"Rows lost (Found %lu of %lu); Aborting "
"because safe repair was requested",
- (ulong) share->state.state.records,
+ sort_info.new_info->s->state.state.records,
(ulong) start_records);
share->state.state.records=start_records;
goto err;