diff options
author | Sachin Setiya <sachin.setiya@mariadb.com> | 2017-03-17 02:05:20 +0530 |
---|---|---|
committer | Sachin Setiya <sachin.setiya@mariadb.com> | 2017-03-17 02:05:20 +0530 |
commit | f66395f7c06f357e7ace74317e6563a1e5dbc3ae (patch) | |
tree | d1669b069aa722c9c73abe52e5924b7bbba41b39 /client | |
parent | c401773c8dd97bd9f6bf6cff9fcafdf24fbd0ee1 (diff) | |
parent | c4f3e64c23fe7f7fd18c0a79f87f9771df15fe9f (diff) | |
download | mariadb-git-f66395f7c06f357e7ace74317e6563a1e5dbc3ae.tar.gz |
Merge tag 'mariadb-10.0.30' into bb-sachin-10.0-galera-merge
Signed-off-by: Sachin Setiya <sachin.setiya@mariadb.com>
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqladmin.cc | 98 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 2 | ||||
-rw-r--r-- | client/mysqldump.c | 5 | ||||
-rw-r--r-- | client/mysqltest.cc | 3 |
4 files changed, 98 insertions, 10 deletions
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 7f32658f1b2..78a73c01218 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -38,8 +38,8 @@ char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN]; ulonglong last_values[MAX_MYSQL_VAR]; static int interval=0; static my_bool option_force=0,interrupted=0,new_line=0, - opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0, - tty_password= 0, opt_nobeep; + opt_compress= 0, opt_local= 0, opt_relative= 0, opt_verbose= 0, + opt_vertical= 0, tty_password= 0, opt_nobeep; static my_bool debug_info_flag= 0, debug_check_flag= 0; static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations; static uint opt_count_iterations= 0, my_end_arg; @@ -102,9 +102,12 @@ enum commands { ADMIN_PING, ADMIN_EXTENDED_STATUS, ADMIN_FLUSH_STATUS, ADMIN_FLUSH_PRIVILEGES, ADMIN_START_SLAVE, ADMIN_STOP_SLAVE, ADMIN_START_ALL_SLAVES, ADMIN_STOP_ALL_SLAVES, - ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD, ADMIN_FLUSH_SLOW_LOG, + ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD, ADMIN_FLUSH_BINARY_LOG, + ADMIN_FLUSH_ENGINE_LOG, ADMIN_FLUSH_ERROR_LOG, ADMIN_FLUSH_GENERAL_LOG, + ADMIN_FLUSH_RELAY_LOG, ADMIN_FLUSH_SLOW_LOG, ADMIN_FLUSH_TABLE_STATISTICS, ADMIN_FLUSH_INDEX_STATISTICS, ADMIN_FLUSH_USER_STATISTICS, ADMIN_FLUSH_CLIENT_STATISTICS, + ADMIN_FLUSH_USER_RESOURCES, ADMIN_FLUSH_ALL_STATUS, ADMIN_FLUSH_ALL_STATISTICS }; static const char *command_names[]= { @@ -116,9 +119,10 @@ static const char *command_names[]= { "ping", "extended-status", "flush-status", "flush-privileges", "start-slave", "stop-slave", "start-all-slaves", "stop-all-slaves", - "flush-threads", "old-password", "flush-slow-log", + "flush-threads", "old-password", "flush-binary-log", "flush-engine-log", + "flush-error-log", "flush-general-log", "flush-relay-log", "flush-slow-log", "flush-table-statistics", "flush-index-statistics", - "flush-user-statistics", "flush-client-statistics", + "flush-user-statistics", "flush-client-statistics", "flush-user-resources", "flush-all-status", "flush-all-statistics", NullS }; @@ -160,6 +164,9 @@ static struct my_option my_long_options[] = NO_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"local", 'l', "Local command, don't write to binlog.", + &opt_local, &opt_local, 0, GET_BOOL, NO_ARG, 0, 0, 0, + 0, 0, 0}, {"no-beep", 'b', "Turn off beep on error.", &opt_nobeep, &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', @@ -617,6 +624,18 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) */ struct my_rnd_struct rand_st; + char buff[FN_REFLEN + 20]; + + if (opt_local) + { + sprintf(buff, "set local sql_log_bin=0"); + if (mysql_query(mysql, buff)) + { + my_printf_error(0, "SET LOCAL SQL_LOG_BIN=0 failed; error: '%-.200s'", + error_flags, mysql_error(mysql)); + return -1; + } + } for (; argc > 0 ; argv++,argc--) { @@ -624,7 +643,6 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) switch ((command= find_type(argv[0],&command_typelib,FIND_TYPE_BASIC))) { case ADMIN_CREATE: { - char buff[FN_REFLEN+20]; if (argc < 2) { my_printf_error(0, "Too few arguments to create", error_flags); @@ -902,6 +920,56 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) } break; } + case ADMIN_FLUSH_BINARY_LOG: + { + if (mysql_query(mysql, "flush binary logs")) + { + my_printf_error(0, "flush failed; error: '%s'", error_flags, + mysql_error(mysql)); + return -1; + } + break; + } + case ADMIN_FLUSH_ENGINE_LOG: + { + if (mysql_query(mysql,"flush engine logs")) + { + my_printf_error(0, "flush failed; error: '%s'", error_flags, + mysql_error(mysql)); + return -1; + } + break; + } + case ADMIN_FLUSH_ERROR_LOG: + { + if (mysql_query(mysql, "flush error logs")) + { + my_printf_error(0, "flush failed; error: '%s'", error_flags, + mysql_error(mysql)); + return -1; + } + break; + } + case ADMIN_FLUSH_GENERAL_LOG: + { + if (mysql_query(mysql, "flush general logs")) + { + my_printf_error(0, "flush failed; error: '%s'", error_flags, + mysql_error(mysql)); + return -1; + } + break; + } + case ADMIN_FLUSH_RELAY_LOG: + { + if (mysql_query(mysql, "flush relay logs")) + { + my_printf_error(0, "flush failed; error: '%s'", error_flags, + mysql_error(mysql)); + return -1; + } + break; + } case ADMIN_FLUSH_SLOW_LOG: { if (mysql_query(mysql,"flush slow logs")) @@ -972,6 +1040,16 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) } break; } + case ADMIN_FLUSH_USER_RESOURCES: + { + if (mysql_query(mysql, "flush user_resources")) + { + my_printf_error(0, "flush failed; error: '%s'", error_flags, + mysql_error(mysql)); + return -1; + } + break; + } case ADMIN_FLUSH_CLIENT_STATISTICS: { if (mysql_query(mysql,"flush client_statistics")) @@ -1295,12 +1373,18 @@ static void usage(void) flush-index-statistics Flush index statistics\n\ flush-logs Flush all logs\n\ flush-privileges Reload grant tables (same as reload)\n\ + flush-binary-log Flush binary log\n\ + flush-engine-log Flush engine log(s)\n\ + flush-error-log Flush error log\n\ + flush-general-log Flush general log\n\ + flush-relay-log Flush relay log\n\ flush-slow-log Flush slow query log\n\ - flush-status Clear status variables\n\ + flush-status Clear status variables\n\ flush-table-statistics Clear table statistics\n\ flush-tables Flush all tables\n\ flush-threads Flush the thread cache\n\ flush-user-statistics Flush user statistics\n\ + flush-user-resources Flush user resources\n\ kill id,id,... Kill mysql threads"); #if MYSQL_VERSION_ID >= 32200 puts("\ diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 4be31421f9b..29355d013c7 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -106,7 +106,7 @@ static const char* sock= 0; static char *opt_plugindir= 0, *opt_default_auth= 0; #ifdef HAVE_SMEM -static char *shared_memory_base_name= 0; +static const char *shared_memory_base_name= 0; #endif static char* user = 0; static char* pass = 0; diff --git a/client/mysqldump.c b/client/mysqldump.c index 64ed21ac7fc..27aeea5a7b3 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -698,8 +698,9 @@ static void write_header(FILE *sql_file, char *db_name) "-- MySQL dump %s Distrib %s, for %s (%s)\n--\n", DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); - print_comment(sql_file, 0, "-- Host: %s Database: %s\n", - fix_for_comment(current_host ? current_host : "localhost"), + print_comment(sql_file, 0, "-- Host: %s ", + fix_for_comment(current_host ? current_host : "localhost")); + print_comment(sql_file, 0, "Database: %s\n", fix_for_comment(db_name ? db_name : "")); print_comment(sql_file, 0, "-- ------------------------------------------------------\n" diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 15db5759ac9..ecc8c07605e 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3341,6 +3341,8 @@ void do_exec(struct st_command *command) DBUG_ENTER("do_exec"); DBUG_PRINT("enter", ("cmd: '%s'", cmd)); + var_set_int("$sys_errno",0); + /* Skip leading space */ while (*cmd && my_isspace(charset_info, *cmd)) cmd++; @@ -3457,6 +3459,7 @@ void do_exec(struct st_command *command) report_or_die("command \"%s\" failed with wrong error: %d", command->first_argument, status); } + var_set_int("$sys_errno",status); } else if (command->expected_errors.err[0].type == ERR_ERRNO && command->expected_errors.err[0].code.errnum != 0) |