Commit a7f87eff authored by Michael Widenius's avatar Michael Widenius

Merge with 5.1 + fixes for build failures in 5.2

cmd-line-utils/libedit/map.c:
  Fixed compiler warning
cmd-line-utils/libedit/terminal.c:
  Fixed compiler warning
cmd-line-utils/libedit/tty.c:
  Fixed compiler warning
sql/sql_base.cc:
  Fixed memory leak found by valgrind
storage/maria/compat_aliases.cc:
  Ensure that recover_alias is also a set
storage/maria/ma_bitmap.c:
  Proper fix for compiler warning
support-files/compiler_warnings.supp:
  Fixed compiler warning
parents 389acf0a a19f4e3a
......@@ -1300,7 +1300,7 @@ map_bind(EditLine *el, int argc, const Char **argv)
default:
(void) fprintf(el->el_errfile,
"" FSTR ": Invalid switch `%c'.\n",
argv[0], p[1]);
argv[0], (int) p[1]);
}
else
break;
......
......@@ -908,17 +908,17 @@ terminal_set(EditLine *el, const char *term)
terminal_alloc(el, t, NULL);
} else {
/* auto/magic margins */
Val(T_am) = tgetflag("am");
Val(T_xn) = tgetflag("xn");
Val(T_am) = tgetflag((char*) "am");
Val(T_xn) = tgetflag((char*) "xn");
/* Can we tab */
Val(T_pt) = tgetflag("pt");
Val(T_xt) = tgetflag("xt");
Val(T_pt) = tgetflag((char*) "pt");
Val(T_xt) = tgetflag((char*) "xt");
/* do we have a meta? */
Val(T_km) = tgetflag("km");
Val(T_MT) = tgetflag("MT");
Val(T_km) = tgetflag((char*) "km");
Val(T_MT) = tgetflag((char*) "MT");
/* Get the size */
Val(T_co) = tgetnum("co");
Val(T_li) = tgetnum("li");
Val(T_co) = tgetnum((char*) "co");
Val(T_li) = tgetnum((char*) "li");
for (t = tstr; t->name != NULL; t++) {
/* XXX: some systems' tgetstr needs non const */
terminal_alloc(el, t, tgetstr(strchr(t->name, *t->name),
......
......@@ -1215,7 +1215,7 @@ tty_stty(EditLine *el, int argc __attribute__((__unused__)), const Char **argv)
default:
(void) fprintf(el->el_errfile,
"%s: Unknown switch `%c'.\n",
name, argv[0][1]);
name, (int) argv[0][1]);
return -1;
}
......
......@@ -339,6 +339,8 @@ extern void maria_enable_logging(MARIA_HA *info);
#define HA_RECOVER_FORCE 4 /* Recover even if we loose rows */
#define HA_RECOVER_QUICK 8 /* Don't check rows in data file */
#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 */
......
......@@ -792,6 +792,7 @@ void intern_close_table(TABLE *table)
delete table->triggers;
if (table->file) // Not true if name lock
VOID(closefrm(table, 1)); // close file
table->alias.free();
DBUG_VOID_RETURN;
}
......@@ -2328,9 +2329,9 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list, bool link_in)
object to its original state.
*/
memcpy(table, &orig_table, sizeof(*table));
bzero(&orig_table, sizeof(orig_table)); // Ensure alias is not freed
DBUG_RETURN(TRUE);
}
orig_table.alias.free();
share= table->s;
/*
......@@ -3674,7 +3675,7 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock)
char *key= table->s->table_cache_key.str;
uint key_length= table->s->table_cache_key.length;
DBUG_PRINT("loop", ("table_name: %s", table->alias.c_ptr()));
DBUG_PRINT("loop", ("table_name: %s.%s", key, strend(key)+1));
HASH_SEARCH_STATE state;
for (TABLE *search= (TABLE*) hash_first(&open_cache, (uchar*) key,
key_length, &state);
......
......@@ -102,8 +102,8 @@ static MYSQL_SYSVAR_ULONG(pagecache_division_limit, pagecache_division_limit_ali
"Deprecated, use --aria-pagecache-division-limit instead",
0, 0, 100, 1, 100, 1);
ulong recover_alias;
static MYSQL_SYSVAR_ENUM(recover, recover_alias, PLUGIN_VAR_OPCMDARG,
ulonglong recover_alias;
static MYSQL_SYSVAR_SET(recover, recover_alias, PLUGIN_VAR_OPCMDARG,
"Deprecated, use --aria-recover instead",
NULL, NULL, HA_RECOVER_DEFAULT, &maria_recover_typelib);
......
......@@ -61,7 +61,7 @@ ulonglong pagecache_buffer_size;
good. It would happen only after Recovery, if the table is still
corrupted.
*/
ulong maria_recover_options= HA_RECOVER_NONE;
ulonglong maria_recover_options= HA_RECOVER_NONE;
handlerton *maria_hton;
/* bits in maria_recover_options */
......@@ -71,10 +71,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=
{
......@@ -241,10 +240,10 @@ static MYSQL_SYSVAR_ULONG(pagecache_division_limit, pagecache_division_limit,
"The minimum percentage of warm blocks in key cache", 0, 0,
100, 1, 100, 1);
static MYSQL_SYSVAR_ENUM(recover, maria_recover_options, PLUGIN_VAR_OPCMDARG,
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,
......@@ -1015,7 +1014,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;
......@@ -1615,9 +1614,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
......@@ -3240,7 +3236,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"
" --aria-recover[=...] to automatically check and"
" repair tables when logs are removed by option"
......
......@@ -24,7 +24,7 @@
extern ulong maria_sort_buffer_size;
extern TYPELIB maria_recover_typelib;
extern ulong maria_recover_options;
extern ulonglong maria_recover_options;
class ha_maria :public handler
{
......@@ -136,7 +136,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);
......
......@@ -284,10 +284,10 @@ my_bool _ma_bitmap_init(MARIA_SHARE *share, File file,
*/
{
pgcache_page_no_t last_bitmap_page;
pgcache_page_no_t blocks, bytes;
ulong blocks, bytes;
last_bitmap_page= *last_page - *last_page % bitmap->pages_covered;
blocks= *last_page - last_bitmap_page;
blocks= (ulong) (*last_page - last_bitmap_page);
bytes= (blocks * 3) / 8; /* 3 bit per page / 8 bits per byte */
/* Size needs to be aligned on 6 */
bytes/= 6;
......
......@@ -3901,7 +3901,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;
......
......@@ -183,6 +183,7 @@ ctype-simple\.c : .*unary minus operator applied to unsigned type, result still
regexec\.c : passing argument 3 of.*matcher.* discards qualifiers from pointer target type
libmysql\.c: passing argument 2 of .*memcpy.* discards qualifiers from pointer target type : 3000-4000
storage/xtradb/dict/dict0dict\.c : passing argument 1 of .*strcpy.* discards qualifiers from pointer target type : 2500-3500
storage/xtradb/sync/sync0rw\.c : passing argument 1 of .*memset.* discards qualifiers from pointer target type : 200-300
#
# Strange things from autoconf that is probably safe to ignore
......
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