From 535b514e4bfc6bec2cdf046bc2bfebf770a37b7d Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 3 Jun 2015 10:35:34 +0200 Subject: MDEV-8123 mysqlcheck: new --process-views option conflicts with --quick, --extended and such --- client/mysqlcheck.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'client') diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 021b89ed4b9..8e76433935e 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -861,11 +861,19 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view) switch (what_to_do) { case DO_CHECK: op = "CHECK"; - if (opt_quick) end = strmov(end, " QUICK"); - if (opt_fast) end = strmov(end, " FAST"); - if (opt_medium_check) end = strmov(end, " MEDIUM"); /* Default */ - if (opt_extended) end = strmov(end, " EXTENDED"); - if (opt_check_only_changed) end = strmov(end, " CHANGED"); + if (view) + { + if (opt_fast || opt_check_only_changed) + DBUG_RETURN(0); + } + else + { + if (opt_quick) end = strmov(end, " QUICK"); + if (opt_fast) end = strmov(end, " FAST"); + if (opt_extended) end = strmov(end, " EXTENDED"); + if (opt_medium_check) end = strmov(end, " MEDIUM"); /* Default */ + if (opt_check_only_changed) end = strmov(end, " CHANGED"); + } if (opt_upgrade) end = strmov(end, " FOR UPGRADE"); break; case DO_REPAIR: -- cgit v1.2.1 From f806b4d44bc49efd4386c263d19e91f9fa8fef7a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 3 Jun 2015 12:13:43 +0200 Subject: MDEV-8124 mysqlcheck: --auto-repair runs REPAIR TABLE instead of REPAIR VIEW on views create a separate list of views to repair, and repair them in a separate loop. --- client/mysqlcheck.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'client') diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 8e76433935e..37ede5cac30 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -53,6 +53,7 @@ static char *opt_password = 0, *current_user = 0, static char *opt_plugin_dir= 0, *opt_default_auth= 0; static int first_error = 0; DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds; +DYNAMIC_ARRAY views4repair; static char *shared_memory_base_name=0; static uint opt_protocol=0; @@ -956,6 +957,7 @@ static void print_result() uint length_of_db; uint i; my_bool found_error=0, table_rebuild=0; + DYNAMIC_ARRAY *array4repair= &tables4repair; DBUG_ENTER("print_result"); res = mysql_use_result(sock); @@ -992,9 +994,10 @@ static void print_result() else { char *table_name= prev + (length_of_db+1); - insert_dynamic(&tables4repair, (uchar*) table_name); + insert_dynamic(array4repair, (uchar*) table_name); } } + array4repair= &tables4repair; found_error=0; table_rebuild=0; prev_alter[0]= 0; @@ -1010,8 +1013,11 @@ static void print_result() we have to run upgrade on it. In this case we write a nicer message than "Please do "REPAIR TABLE""... */ - if (!strcmp(row[2],"error") && strstr(row[3],"REPAIR TABLE")) + if (!strcmp(row[2],"error") && strstr(row[3],"REPAIR ")) + { printf("%-50s %s", row[0], "Needs upgrade"); + array4repair= strstr(row[3], "VIEW") ? &views4repair : &tables4repair; + } else printf("%s\n%-9s: %s", row[0], row[2], row[3]); if (opt_auto_repair && strcmp(row[2],"note")) @@ -1061,7 +1067,7 @@ static void print_result() else { char *table_name= prev + (length_of_db+1); - insert_dynamic(&tables4repair, (uchar*) table_name); + insert_dynamic(array4repair, (uchar*) table_name); } } mysql_free_result(res); @@ -1173,6 +1179,7 @@ int main(int argc, char **argv) if (opt_auto_repair && (my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64) || + my_init_dynamic_array(&views4repair, sizeof(char)*(NAME_LEN*2+2),16,64) || my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,64) || my_init_dynamic_array(&alter_table_cmds, MAX_ALTER_STR_SIZE, 0, 1))) goto end; @@ -1201,6 +1208,13 @@ int main(int argc, char **argv) rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i)); for (i = 0; i < alter_table_cmds.elements ; i++) run_query((char*) dynamic_array_ptr(&alter_table_cmds, i)); + if (!opt_silent && views4repair.elements) + puts("\nRepairing views"); + for (i = 0; i < views4repair.elements ; i++) + { + char *name= (char*) dynamic_array_ptr(&views4repair, i); + handle_request_for_tables(name, fixed_name_length(name), TRUE); + } } ret= test(first_error); @@ -1208,8 +1222,10 @@ int main(int argc, char **argv) dbDisconnect(current_host); if (opt_auto_repair) { + delete_dynamic(&views4repair); delete_dynamic(&tables4repair); delete_dynamic(&tables4rebuild); + delete_dynamic(&alter_table_cmds); } end1: my_free(opt_password); -- cgit v1.2.1 From 02421aa284bf3ff2c56c0e8d58defe2846824d19 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 15 Jun 2015 18:07:41 +0500 Subject: MDEV-7871 Tests fail massively on "Assertion `status_var.memory_used == 0'" when run with --ps --embedded. As the MF_THREAD_SPECIFIC was introduced to the alloc_root's and the prealloc added to the statement::mem_root and statement::result.alloc, we have to adjust the embedded server to it. The preallocation was removed for the embedded server as it makes no sence for it. The msyqltest should free the statement inside the proper thead to make the memory statistics happy. --- client/mysqltest.cc | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'client') diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 697229f9439..e28d56e9187 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -839,6 +839,7 @@ static void handle_no_active_connection(struct st_command* command, #define EMB_END_CONNECTION 3 #define EMB_PREPARE_STMT 4 #define EMB_EXECUTE_STMT 5 +#define EMB_CLOSE_STMT 6 /* workaround for MySQL BUG#57491 */ #undef MY_WME @@ -887,6 +888,9 @@ pthread_handler_t connection_thread(void *arg) case EMB_EXECUTE_STMT: cn->result= mysql_stmt_execute(cn->stmt); break; + case EMB_CLOSE_STMT: + cn->result= mysql_stmt_close(cn->stmt); + break; default: DBUG_ASSERT(0); } @@ -984,6 +988,17 @@ static int do_stmt_execute(struct st_connection *cn) } +static int do_stmt_close(struct st_connection *cn) +{ + /* The cn->stmt is already set. */ + if (!cn->has_thread) + return mysql_stmt_close(cn->stmt); + signal_connection_thd(cn, EMB_CLOSE_STMT); + wait_query_thread_done(cn); + return cn->result; +} + + static void emb_close_connection(struct st_connection *cn) { if (!cn->has_thread) @@ -1019,6 +1034,7 @@ static void init_connection_thd(struct st_connection *cn) #define do_read_query_result(cn) mysql_read_query_result(cn->mysql) #define do_stmt_prepare(cn, q, q_len) mysql_stmt_prepare(cn->stmt, q, q_len) #define do_stmt_execute(cn) mysql_stmt_execute(cn->stmt) +#define do_stmt_close(cn) mysql_stmt_close(cn->stmt) #endif /*EMBEDDED_LIBRARY*/ @@ -1378,11 +1394,11 @@ void close_connections() DBUG_ENTER("close_connections"); for (--next_con; next_con >= connections; --next_con) { + if (next_con->stmt) + do_stmt_close(next_con); #ifdef EMBEDDED_LIBRARY emb_close_connection(next_con); #endif - if (next_con->stmt) - mysql_stmt_close(next_con->stmt); next_con->stmt= 0; mysql_close(next_con->mysql); next_con->mysql= 0; @@ -5635,7 +5651,11 @@ void do_close_connection(struct st_command *command) con->mysql->net.vio = 0; } } -#else +#endif /*!EMBEDDED_LIBRARY*/ + if (con->stmt) + do_stmt_close(con); + con->stmt= 0; +#ifdef EMBEDDED_LIBRARY /* As query could be still executed in a separate theread we need to check if the query's thread was finished and probably wait @@ -5643,9 +5663,6 @@ void do_close_connection(struct st_command *command) */ emb_close_connection(con); #endif /*EMBEDDED_LIBRARY*/ - if (con->stmt) - mysql_stmt_close(con->stmt); - con->stmt= 0; mysql_close(con->mysql); con->mysql= 0; -- cgit v1.2.1 From 26b0cf4d3f0f7c94da9eb21b899e4ba0359dedfe Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 16 Jun 2015 21:18:59 +0200 Subject: MDEV-8183 Adding option mysqldump --no-data-med * new mysqldump option * add more engines to the "external data engines" list * redo the check to be able to print the list of engines in --help --- client/mysqldump.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'client') diff --git a/client/mysqldump.c b/client/mysqldump.c index e1181985499..e4683ab79c4 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -97,7 +97,7 @@ static ulong find_set(TYPELIB *lib, const char *x, uint length, static char *alloc_query_str(ulong size); static void field_escape(DYNAMIC_STRING* in, const char *from); -static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, +static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_med= 1, quick= 1, extended_insert= 1, lock_tables=1,ignore_errors=0,flush_logs=0,flush_privileges=0, opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0, @@ -203,6 +203,8 @@ const char *compatible_mode_names[]= TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1, "", compatible_mode_names, NULL}; +#define MED_ENGINES "MRG_MyISAM, MRG_ISAM, CONNECT, OQGRAPH, SPIDER, VP, FEDERATED" + HASH ignore_table; static struct my_option my_long_options[] = @@ -429,6 +431,9 @@ static struct my_option my_long_options[] = NO_ARG, 0, 0, 0, 0, 0, 0}, {"no-data", 'd', "No row information.", &opt_no_data, &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"no-data-med", 0, "No row information for engines that " + "Manage External Data (" MED_ENGINES ").", &opt_no_data_med, + &opt_no_data_med, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"no-set-names", 'N', "Same as --skip-set-charset.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"opt", OPT_OPTIMIZE, @@ -5406,12 +5411,12 @@ char check_if_ignore_table(const char *table_name, char *table_type) /* If these two types, we do want to skip dumping the table */ - if (!opt_no_data && - (!my_strcasecmp(&my_charset_latin1, table_type, "MRG_MyISAM") || - !strcmp(table_type,"MRG_ISAM") || - !strcmp(table_type,"CONNECT") || - !strcmp(table_type,"FEDERATED"))) - result= IGNORE_DATA; + if (!opt_no_data && opt_no_data_med) + { + const char *found= strstr(" " MED_ENGINES ",", table_type); + if (found && found[-1] == ' ' && found[strlen(table_type)] == ',') + result= IGNORE_DATA; + } } mysql_free_result(res); DBUG_RETURN(result); -- cgit v1.2.1