From 1670845c3b3364720881ad778e456c6b7d852397 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Thu, 24 Nov 2011 19:23:20 +0200 Subject: Fixed that one can use --maria-recover=backup,force (Before we only allowed one option) --- storage/maria/ha_maria.cc | 4 ++-- storage/maria/ha_maria.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 5661e1f06d7..4d1348bd07f 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -60,7 +60,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 */ @@ -198,7 +198,7 @@ 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.", diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index 6171f89cb18..f326efe17a2 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -30,7 +30,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 { -- cgit v1.2.1 From 0c3b78438b627127f1a567aaede90466be549f52 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 29 Nov 2011 01:10:17 +0100 Subject: Fix Windows build, and a conversion truncation warning. --- storage/maria/ma_bitmap.c | 4 ++-- storage/xtradb/handler/ha_innodb.cc | 9 ++++----- storage/xtradb/include/srv0srv.h | 2 +- storage/xtradb/srv/srv0srv.c | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c index 81b436346b1..00f529be92d 100644 --- a/storage/maria/ma_bitmap.c +++ b/storage/maria/ma_bitmap.c @@ -282,7 +282,7 @@ my_bool _ma_bitmap_init(MARIA_SHARE *share, File file, */ { pgcache_page_no_t last_bitmap_page; - ulong blocks, bytes; + pgcache_page_no_t blocks, bytes; last_bitmap_page= *last_page - *last_page % bitmap->pages_covered; blocks= *last_page - last_bitmap_page; @@ -291,7 +291,7 @@ my_bool _ma_bitmap_init(MARIA_SHARE *share, File file, bytes/= 6; bytes*= 6; bitmap->last_bitmap_page= last_bitmap_page; - bitmap->last_total_size= bytes; + bitmap->last_total_size= (uint)bytes; *last_page= ((last_bitmap_page + bytes*8/3)); } diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index b07f6f0b93d..744865a31f3 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -11603,14 +11603,13 @@ static MYSQL_SYSVAR_ULONG(concurrency_tickets, srv_n_free_tickets_to_enter, "Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket", NULL, NULL, 500L, 1L, ~0L, 0); -static MYSQL_SYSVAR_LONG(kill_idle_transaction, srv_kill_idle_transaction, - PLUGIN_VAR_RQCMDARG, #ifdef EXTENDED_FOR_KILLIDLE - "If non-zero value, the idle session with transaction which is idle over the value in seconds is killed by InnoDB.", +#define kill_idle_help_text "If non-zero value, the idle session with transaction which is idle over the value in seconds is killed by InnoDB." #else - "No effect for this build.", +#define kill_idle_help_text "No effect for this build." #endif - NULL, NULL, 0, 0, LONG_MAX, 0); +static MYSQL_SYSVAR_LONGLONG(kill_idle_transaction, srv_kill_idle_transaction, + PLUGIN_VAR_RQCMDARG, kill_idle_help_text, NULL, NULL, 0, 0, LONG_MAX, 0); static MYSQL_SYSVAR_LONG(file_io_threads, innobase_file_io_threads, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR, diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index c120db5cbcc..8038178c2f3 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -285,7 +285,7 @@ extern ibool srv_print_latch_waits; extern ulint srv_activity_count; extern ulint srv_fatal_semaphore_wait_threshold; extern ulint srv_dml_needed_delay; -extern lint srv_kill_idle_transaction; +extern long long srv_kill_idle_transaction; extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs, query threads, and lock table: we allocate diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c index 2ff729efbb1..176b063d147 100644 --- a/storage/xtradb/srv/srv0srv.c +++ b/storage/xtradb/srv/srv0srv.c @@ -106,7 +106,7 @@ UNIV_INTERN ulint srv_activity_count = 0; UNIV_INTERN ulint srv_fatal_semaphore_wait_threshold = 600; /**/ -UNIV_INTERN lint srv_kill_idle_transaction = 0; +UNIV_INTERN long long srv_kill_idle_transaction = 0; /* How much data manipulation language (DML) statements need to be delayed, in microseconds, in order to reduce the lagging of the purge thread. */ -- cgit v1.2.1 From a19f4e3a3af4c18ec89f8f8a4ae32e3c7d7fec70 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Tue, 29 Nov 2011 15:32:25 +0200 Subject: 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 --- include/maria.h | 2 ++ storage/maria/ha_maria.cc | 16 ++++++---------- storage/maria/ha_maria.h | 3 ++- storage/maria/ma_check.c | 2 +- 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; -- cgit v1.2.1