Commit a19f4e3a authored by Michael Widenius's avatar Michael Widenius

Fixed that maria-recover works as expected.

- "" is now used if no option is set

include/maria.h:
  Added HA_RECOVER_ANY
storage/maria/ha_maria.cc:
  Insert of checking if maria_recover_options == 0, check if any bit is set.
  Fix maria_recover_names to match bitmap. This fixes that recover options works as expected.
storage/maria/ha_maria.h:
  Insert of checking if maria_recover_options == 0, check if any bit is set.
storage/maria/ma_check.c:
  Fixed wrong print
parent 0c3b7843
......@@ -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 */
......
......@@ -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"
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment