summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2015-06-21 23:54:55 -0400
committerNirbhay Choubey <nirbhay@mariadb.com>2015-06-21 23:54:55 -0400
commit46024098be1d7887134a3a3d8d289dd7711c56dc (patch)
treec175b6b9f5913b2c2424ca4fa799b1c545e3d9a5 /client
parent41d40029875bfd7f4cd6a5255e05a3c93103220f (diff)
parenta6087e7dc1ef3561d8189c8db15e9591d0f9b520 (diff)
downloadmariadb-git-46024098be1d7887134a3a3d8d289dd7711c56dc.tar.gz
Merge tag 'mariadb-10.0.20' into 10.0-galera
Diffstat (limited to 'client')
-rw-r--r--client/mysqlcheck.c41
-rw-r--r--client/mysqldump.c19
-rw-r--r--client/mysqltest.cc29
3 files changed, 68 insertions, 21 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 7e725e4241b..5fe620e23e4 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -54,6 +54,7 @@ static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static int first_error = 0;
static char *opt_skip_database;
DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds;
+DYNAMIC_ARRAY views4repair;
static char *shared_memory_base_name=0;
static uint opt_protocol=0;
@@ -883,11 +884,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:
@@ -972,6 +981,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);
@@ -1008,9 +1018,10 @@ static void print_result()
else
{
char *table_name= prev + (length_of_db+1);
- insert_dynamic(&tables4repair, table_name);
+ insert_dynamic(array4repair, table_name);
}
}
+ array4repair= &tables4repair;
found_error=0;
table_rebuild=0;
prev_alter[0]= 0;
@@ -1026,8 +1037,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"))
@@ -1058,7 +1072,7 @@ static void print_result()
else
{
char *table_name= prev + (length_of_db+1);
- insert_dynamic(&tables4repair, table_name);
+ insert_dynamic(array4repair, table_name);
}
}
mysql_free_result(res);
@@ -1178,6 +1192,8 @@ int main(int argc, char **argv)
if (opt_auto_repair &&
(my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,
64, MYF(0)) ||
+ my_init_dynamic_array(&views4repair, sizeof(char)*(NAME_LEN*2+2),16,
+ 64, MYF(0)) ||
my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,
64, MYF(0)) ||
my_init_dynamic_array(&alter_table_cmds, MAX_ALTER_STR_SIZE, 0, 1,
@@ -1208,6 +1224,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), 1);
+ 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= MY_TEST(first_error);
@@ -1215,8 +1238,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);
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);
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;