diff options
author | Michael Widenius <monty@askmonty.org> | 2011-11-29 22:48:24 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-11-29 22:48:24 +0200 |
commit | a7f87effa57f6486c23bf5b340c8474a635dcf71 (patch) | |
tree | 5f72d973eaaa8a62d871a25640a2618d7284537d | |
parent | 389acf0a30415c745d2c241e1584b0b637ab95ed (diff) | |
parent | a19f4e3a3af4c18ec89f8f8a4ae32e3c7d7fec70 (diff) | |
download | mariadb-git-a7f87effa57f6486c23bf5b340c8474a635dcf71.tar.gz |
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
-rw-r--r-- | cmd-line-utils/libedit/map.c | 2 | ||||
-rw-r--r-- | cmd-line-utils/libedit/terminal.c | 16 | ||||
-rw-r--r-- | cmd-line-utils/libedit/tty.c | 2 | ||||
-rw-r--r-- | include/maria.h | 2 | ||||
-rw-r--r-- | sql/sql_base.cc | 5 | ||||
-rw-r--r-- | storage/maria/compat_aliases.cc | 4 | ||||
-rw-r--r-- | storage/maria/ha_maria.cc | 20 | ||||
-rw-r--r-- | storage/maria/ha_maria.h | 5 | ||||
-rw-r--r-- | storage/maria/ma_bitmap.c | 4 | ||||
-rw-r--r-- | storage/maria/ma_check.c | 2 | ||||
-rw-r--r-- | support-files/compiler_warnings.supp | 1 |
11 files changed, 32 insertions, 31 deletions
diff --git a/cmd-line-utils/libedit/map.c b/cmd-line-utils/libedit/map.c index 946bc185437..17b07391b69 100644 --- a/cmd-line-utils/libedit/map.c +++ b/cmd-line-utils/libedit/map.c @@ -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; diff --git a/cmd-line-utils/libedit/terminal.c b/cmd-line-utils/libedit/terminal.c index 8cfbeac7c52..fb5600a4140 100644 --- a/cmd-line-utils/libedit/terminal.c +++ b/cmd-line-utils/libedit/terminal.c @@ -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), diff --git a/cmd-line-utils/libedit/tty.c b/cmd-line-utils/libedit/tty.c index 46624a87077..eea00bfc245 100644 --- a/cmd-line-utils/libedit/tty.c +++ b/cmd-line-utils/libedit/tty.c @@ -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; } diff --git a/include/maria.h b/include/maria.h index 470f76669f3..328cb491bca 100644 --- a/include/maria.h +++ b/include/maria.h @@ -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 */ diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ee44629a192..600bb641448 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -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); diff --git a/storage/maria/compat_aliases.cc b/storage/maria/compat_aliases.cc index ce8838b2da2..068c8b9bdef 100644 --- a/storage/maria/compat_aliases.cc +++ b/storage/maria/compat_aliases.cc @@ -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); diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 60fa7a58fb6..2afa32e4f01 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -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" diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index c7af191c1e7..2cfa2d8cd9b 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -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); diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c index 7a68c91598c..25ab5c6531e 100644 --- a/storage/maria/ma_bitmap.c +++ b/storage/maria/ma_bitmap.c @@ -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; diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index ef6484adbe9..e31e2e7816a 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -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; diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp index 0a0f08eac16..ec6b742542a 100644 --- a/support-files/compiler_warnings.supp +++ b/support-files/compiler_warnings.supp @@ -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 |