diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/CMakeLists.txt | 5 | ||||
-rw-r--r-- | client/client_priv.h | 5 | ||||
-rw-r--r-- | client/mysql.cc | 50 | ||||
-rw-r--r-- | client/mysql_upgrade.c | 24 | ||||
-rw-r--r-- | client/mysqladmin.cc | 45 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 37 | ||||
-rw-r--r-- | client/mysqlcheck.c | 16 | ||||
-rw-r--r-- | client/mysqldump.c | 34 | ||||
-rw-r--r-- | client/mysqlimport.c | 27 | ||||
-rw-r--r-- | client/mysqlshow.c | 29 | ||||
-rw-r--r-- | client/mysqlslap.c | 24 | ||||
-rw-r--r-- | client/mysqltest.cc | 81 |
12 files changed, 125 insertions, 252 deletions
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 37087b7c6c6..63e4cf36b00 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -56,7 +56,6 @@ TARGET_LINK_LIBRARIES(mysqlcheck ${CLIENT_LIB}) MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c) TARGET_LINK_LIBRARIES(mysqldump ${CLIENT_LIB}) - MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c) SET_SOURCE_FILES_PROPERTIES(mysqlimport.c PROPERTIES COMPILE_FLAGS "-DTHREADS") TARGET_LINK_LIBRARIES(mysqlimport ${CLIENT_LIB}) @@ -93,11 +92,9 @@ TARGET_LINK_LIBRARIES(async_example ${CLIENT_LIB}) SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap mysql_plugin async_example PROPERTIES HAS_CXX TRUE) - -FOREACH(t mysql mysqltest mysqltest mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysql_plugin mysqlbinlog +FOREACH(t mysql mysqltest mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysql_plugin mysqlbinlog mysqladmin mysqlslap async_example) ADD_DEPENDENCIES(${t} GenError ${CLIENT_LIB}) ENDFOREACH() ADD_DEFINITIONS(-DHAVE_DLOPEN) - diff --git a/client/client_priv.h b/client/client_priv.h index d709da0ec40..7a6fa8f3bc8 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -46,10 +46,10 @@ enum options_client OPT_MAX_ALLOWED_PACKET, OPT_NET_BUFFER_LENGTH, OPT_SELECT_LIMIT, OPT_MAX_JOIN_SIZE, OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH, - OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE, + OPT_SSL_CIPHER, OPT_TLS_VERSION, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE, OPT_DELETE_MASTER_LOGS, OPT_COMPACT, OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL, - OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION, + OPT_FRM, OPT_SKIP_OPTIMIZATION, OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_SERVER_ARG, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, @@ -101,6 +101,7 @@ enum options_client OPT_SSL_CRL, OPT_SSL_CRLPATH, OPT_IGNORE_DATA, OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS, + OPT_SHUTDOWN_WAIT_FOR_SLAVES, OPT_MAX_CLIENT_OPTION /* should be always the last */ }; diff --git a/client/mysql.cc b/client/mysql.cc index 2a7c4eaf3e5..b7a2d6c5e72 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -164,6 +164,7 @@ static uint my_end_arg; static char * opt_mysql_unix_port=0; static int connect_flag=CLIENT_INTERACTIVE; static my_bool opt_binary_mode= FALSE; +static my_bool opt_connect_expired_password= FALSE; static int interrupted_query= 0; static char *current_host,*current_db,*current_user=0,*opt_password=0, *current_prompt=0, *delimiter_str= 0, @@ -200,10 +201,8 @@ static char delimiter[16]= DEFAULT_DELIMITER; static uint delimiter_length= 1; unsigned short terminal_width= 80; -#ifdef HAVE_SMEM -static char *shared_memory_base_name=0; -#endif static uint opt_protocol=0; +static const char *opt_protocol_type= ""; static CHARSET_INFO *charset_info= &my_charset_latin1; #include "sslopt-vars.h" @@ -285,9 +284,9 @@ static COMMANDS commands[] = { { "edit", 'e', com_edit, 0, "Edit command with $EDITOR."}, #endif { "ego", 'G', com_ego, 0, - "Send command to mysql server, display result vertically."}, + "Send command to MariaDB server, display result vertically."}, { "exit", 'q', com_quit, 0, "Exit mysql. Same as quit."}, - { "go", 'g', com_go, 0, "Send command to mysql server." }, + { "go", 'g', com_go, 0, "Send command to MariaDB server." }, { "help", 'h', com_help, 1, "Display this help." }, #ifdef USE_POPEN { "nopager",'n', com_nopager,0, "Disable pager, print to stdout." }, @@ -1038,7 +1037,7 @@ static COMMANDS commands[] = { }; static const char *load_default_groups[]= -{ "mysql", "client", "client-server", "client-mariadb", 0 }; +{ "mysql", "mariadb-client", "client", "client-server", "client-mariadb", 0 }; static int embedded_server_arg_count= 0; static char *embedded_server_args[MAX_SERVER_ARGS]; @@ -1328,9 +1327,6 @@ sig_handler mysql_end(int sig) my_free(full_username); my_free(part_username); my_free(default_prompt); -#ifdef HAVE_SMEM - my_free(shared_memory_base_name); -#endif my_free(current_prompt); while (embedded_server_arg_count > 1) my_free(embedded_server_args[--embedded_server_arg_count]); @@ -1355,16 +1351,13 @@ static bool do_connect(MYSQL *mysql, const char *host, const char *user, opt_ssl_capath, opt_ssl_cipher); mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + mysql_options(mysql, MARIADB_OPT_TLS_VERSION, opt_tls_version); } mysql_options(mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); #endif if (opt_protocol) mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); -#ifdef HAVE_SMEM - if (shared_memory_base_name) - mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); -#endif if (opt_plugin_dir && *opt_plugin_dir) mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); @@ -1535,7 +1528,7 @@ static struct my_option my_long_options[] = &ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"init-command", OPT_INIT_COMMAND, - "SQL Command to execute when connecting to MySQL server. Will " + "SQL Command to execute when connecting to MariaDB server. Will " "automatically be re-executed when reconnecting.", &opt_init_command, &opt_init_command, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1597,11 +1590,12 @@ static struct my_option my_long_options[] = "Get progress reports for long running commands (like ALTER TABLE)", &opt_progress_reports, &opt_progress_reports, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"prompt", OPT_PROMPT, "Set the mysql prompt to this value.", + {"prompt", OPT_PROMPT, "Set the command line prompt to this value.", ¤t_prompt, ¤t_prompt, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe).", + &opt_protocol_type, &opt_protocol_type, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, {"quick", 'q', "Don't cache result, print it row by row. This may slow down the server " "if the output is suspended. Doesn't use history file.", @@ -1614,11 +1608,6 @@ static struct my_option my_long_options[] = &opt_reconnect, &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"silent", 's', "Be more silent. Print results with a tab as separator, " "each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_SMEM - {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, - "Base name of shared memory.", &shared_memory_base_name, - &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"socket", 'S', "The socket file to use for connection.", &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1689,6 +1678,11 @@ static struct my_option my_long_options[] = "piped to mysql or loaded using the 'source' command). This is necessary " "when processing output from mysqlbinlog that may contain blobs.", &opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"connect-expired-password", 0, + "Notify the server that this client is prepared to handle expired " + "password sandbox mode even if --batch was specified.", + &opt_connect_expired_password, &opt_connect_expired_password, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -1782,8 +1776,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case OPT_MYSQL_PROTOCOL: #ifndef EMBEDDED_LIBRARY - if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, - opt->name)) <= 0) + if (!argument[0]) + opt_protocol= 0; + else if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) exit(1); #endif break; @@ -1870,6 +1866,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'W': #ifdef __WIN__ opt_protocol = MYSQL_PROTOCOL_PIPE; + opt_protocol_type= "pipe"; #endif break; #include <sslopt-case.h> @@ -3131,7 +3128,7 @@ com_help(String *buffer __attribute__((unused)), put_info("\nGeneral information about MariaDB can be found at\n" "http://mariadb.org\n", INFO_INFO); - put_info("List of all MySQL commands:", INFO_INFO); + put_info("List of all client commands:", INFO_INFO); if (!named_cmds) put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO); for (i = 0; commands[i].name; i++) @@ -4690,6 +4687,9 @@ sql_real_connect(char *host,char *database,char *user,char *password, default_charset= (char *)my_default_csname(); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); + my_bool can_handle_expired= opt_connect_expired_password || !status.batch; + mysql_options(&mysql, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, &can_handle_expired); + if (!do_connect(&mysql, host, user, password, database, connect_flag | CLIENT_MULTI_STATEMENTS)) { diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index a13365d8dbf..5e350cf66bc 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -111,7 +111,7 @@ static struct my_option my_long_options[]= &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade " - "has already been executed for the current version of MySQL.", + "has already been executed for the current version of MariaDB.", &opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -135,13 +135,8 @@ static struct my_option my_long_options[]= "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"protocol", OPT_MYSQL_PROTOCOL, - "The protocol to use for connection (tcp, socket, pipe, memory).", + "The protocol to use for connection (tcp, socket, pipe).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_SMEM - {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, - "Base name of shared memory.", 0, - 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"silent", OPT_SILENT, "Print less information", &opt_silent, &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"socket", 'S', "The socket file to use for connection.", @@ -178,6 +173,7 @@ static const char *load_default_groups[]= { "client", /* Read settings how to connect to server */ "mysql_upgrade", /* Read special settings for mysql_upgrade */ + "mariadb-upgrade", /* Read special settings for mysql_upgrade */ "client-server", /* Reads settings common between client & server */ "client-mariadb", /* Read mariadb unique client settings */ 0 @@ -354,7 +350,6 @@ get_one_option(int optid, const struct my_option *opt, case 'P': /* --port */ case 'S': /* --socket */ case OPT_MYSQL_PROTOCOL: /* --protocol */ - case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */ case OPT_PLUGIN_DIR: /* --plugin-dir */ case OPT_DEFAULT_AUTH: /* --default-auth */ add_one_option_cmd_line(&conn_args, opt, argument); @@ -388,7 +383,7 @@ static int run_command(char* cmd, if (opt_verbose >= 4) puts(cmd); - if (!(res_file= popen(cmd, "r"))) + if (!(res_file= my_popen(cmd, IF_WIN("rt","r")))) die("popen(\"%s\", \"r\") failed", cmd); while (fgets(buf, sizeof(buf), res_file)) @@ -406,7 +401,7 @@ static int run_command(char* cmd, } } - error= pclose(res_file); + error= my_pclose(res_file); return WEXITSTATUS(error); } @@ -814,7 +809,7 @@ static my_bool is_mysql() strstr(ds_events_struct.str, "IGNORE_BAD_TABLE_OPTIONS") != NULL) ret= FALSE; else - verbose("MySQL upgrade detected"); + verbose("MariaDB upgrade detected"); dynstr_free(&ds_events_struct); return(ret); @@ -884,10 +879,15 @@ static int run_mysqlcheck_fixnames(void) static const char *expected_errors[]= { + "ERROR 1051", /* Unknown table */ "ERROR 1060", /* Duplicate column name */ "ERROR 1061", /* Duplicate key name */ "ERROR 1054", /* Unknown column */ + "ERROR 1146", /* Table does not exist */ "ERROR 1290", /* RR_OPTION_PREVENTS_STATEMENT */ + "ERROR 1347", /* 'mysql.user' is not of type 'BASE TABLE' */ + "ERROR 1348", /* Column 'Show_db_priv' is not updatable */ + "ERROR 1356", /* definer of view lack rights (UPDATE) */ 0 }; @@ -1256,7 +1256,7 @@ int main(int argc, char **argv) */ if (!opt_force && upgrade_already_done(0)) { - printf("This installation of MySQL is already upgraded to %s, " + printf("This installation of MariaDB is already upgraded to %s, " "use --force if you still need to run mysql_upgrade\n", MYSQL_SERVER_VERSION); goto end; diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index a4e06b46d94..32096fef996 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB + Copyright (c) 2010, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,8 @@ ulonglong last_values[MAX_MYSQL_VAR+100]; static int interval=0; static my_bool option_force=0,interrupted=0,new_line=0, opt_compress= 0, opt_local= 0, opt_relative= 0, opt_verbose= 0, - opt_vertical= 0, tty_password= 0, opt_nobeep; + opt_vertical= 0, tty_password= 0, opt_nobeep, + opt_shutdown_wait_for_slaves= 0; 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; @@ -50,9 +51,6 @@ static char * unix_port=0; static char *opt_plugin_dir= 0, *opt_default_auth= 0; static bool sql_log_bin_off= false; -#ifdef HAVE_SMEM -static char *shared_memory_base_name=0; -#endif static uint opt_protocol=0; static myf error_flags; /* flags to pass to my_printf_error, like ME_BELL */ @@ -186,18 +184,13 @@ static struct my_option my_long_options[] = #endif "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", &tcp_port, &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).", + {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"relative", 'r', "Show difference between current and previous values when used with -i. " "Currently only works with extended-status.", &opt_relative, &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_SMEM - {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, - "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name, - 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"silent", 's', "Silently exit if one can't connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"socket", 'S', "The socket file to use for connection.", @@ -227,6 +220,11 @@ static struct my_option my_long_options[] = {"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", &opt_shutdown_timeout, &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG, SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0}, + {"wait_for_all_slaves", OPT_SHUTDOWN_WAIT_FOR_SLAVES, + "Defers shutdown until after all binlogged events have been sent to " + "all connected slaves", &opt_shutdown_wait_for_slaves, + &opt_shutdown_wait_for_slaves, 0, GET_BOOL, NO_ARG, 0, 0, 0, + 0, 0, 0}, {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -239,7 +237,8 @@ static struct my_option my_long_options[] = static const char *load_default_groups[]= -{ "mysqladmin", "client", "client-server", "client-mariadb", 0 }; +{ "mysqladmin", "mariadb-admin", "client", "client-server", "client-mariadb", + 0 }; my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -362,16 +361,13 @@ int main(int argc,char *argv[]) opt_ssl_capath, opt_ssl_cipher); mysql_options(&mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(&mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + mysql_options(&mysql, MARIADB_OPT_TLS_VERSION, opt_tls_version); } mysql_options(&mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); #endif if (opt_protocol) mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); -#ifdef HAVE_SMEM - if (shared_memory_base_name) - mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); -#endif if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME)) default_charset= (char *)my_default_csname(); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); @@ -499,9 +495,6 @@ err2: mysql_library_end(); my_free(opt_password); my_free(user); -#ifdef HAVE_SMEM - my_free(shared_memory_base_name); -#endif free_defaults(save_argv); my_end(my_end_arg); return error; @@ -591,7 +584,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) if (!info) { info=1; - fputs("Waiting for MySQL server to answer",stderr); + fputs("Waiting for MariaDB server to answer",stderr); (void) fflush(stderr); } else @@ -711,7 +704,17 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) !stat(pidfile, &pidfile_status)) last_modified= pidfile_status.st_mtime; - if (mysql_shutdown(mysql, SHUTDOWN_DEFAULT)) + if (opt_shutdown_wait_for_slaves) + { + sprintf(buff, "SHUTDOWN WAIT FOR ALL SLAVES"); + if (mysql_query(mysql, buff)) + { + my_printf_error(0, "%s failed; error: '%-.200s'", + error_flags, buff, mysql_error(mysql)); + return -1; + } + } + else if (mysql_shutdown(mysql, SHUTDOWN_DEFAULT)) { my_printf_error(0, "shutdown failed; error: '%s'", error_flags, mysql_error(mysql)); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 1fa16015f4a..2d7b907e045 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -41,6 +41,7 @@ /* That one is necessary for defines of OPTION_NO_FOREIGN_KEY_CHECKS etc */ #include "sql_priv.h" #include "sql_basic_types.h" +#include <atomic> #include "log_event.h" #include "compat56.h" #include "sql_common.h" @@ -94,7 +95,8 @@ static const char *default_dbug_option = "d:t:o,/tmp/mysqlbinlog.trace"; const char *current_dbug_option= default_dbug_option; #endif static const char *load_groups[]= -{ "mysqlbinlog", "client", "client-server", "client-mariadb", 0 }; +{ "mysqlbinlog", "mariadb-binlog", "client", "client-server", "client-mariadb", + 0 }; static void error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2); static void warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2); @@ -125,9 +127,6 @@ static uint my_end_arg; static const char* sock= 0; static char *opt_plugindir= 0, *opt_default_auth= 0; -#ifdef HAVE_SMEM -static const char *shared_memory_base_name= 0; -#endif static char* user = 0; static char* pass = 0; static char *charset= 0; @@ -1611,7 +1610,7 @@ static struct my_option my_options[] = &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"disable-log-bin", 'D', "Disable binary log. This is useful, if you " - "enabled --to-last-log and are sending the output to the same MySQL server. " + "enabled --to-last-log and are sending the output to the same MariaDB server. " "This way you could avoid an endless loop. You would also like to use it " "when restoring after a crash to avoid duplication of the statements you " "already have. NOTE: you will need a SUPER privilege to use this option.", @@ -1654,9 +1653,9 @@ static struct my_option my_options[] = &port, &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"protocol", OPT_MYSQL_PROTOCOL, - "The protocol to use for connection (tcp, socket, pipe, memory).", + "The protocol to use for connection (tcp, socket, pipe).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"read-from-remote-server", 'R', "Read binary logs from a MySQL server.", + {"read-from-remote-server", 'R', "Read binary logs from a MariaDB server.", &remote_opt, &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"raw", 0, "Requires -R. Output raw binlog data instead of SQL " @@ -1695,12 +1694,6 @@ static struct my_option my_options[] = {"set-charset", OPT_SET_CHARSET, "Add 'SET NAMES character_set' to the output.", &charset, &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_SMEM - {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, - "Base name of shared memory.", &shared_memory_base_name, - &shared_memory_base_name, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"short-form", 's', "Just show regular queries: no extra info, no " "row-based events and no row counts. This is mainly for testing only, " "and should not be used to feed to the MariaDB server. " @@ -1715,7 +1708,7 @@ static struct my_option my_options[] = {"start-datetime", OPT_START_DATETIME, "Start reading the binlog at first event having a datetime equal or " "posterior to the argument; the argument must be a date and time " - "in the local time zone, in any format accepted by the MySQL server " + "in the local time zone, in any format accepted by the MariaDB server " "for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 " "(you should probably use quotes for your shell to set it properly).", &start_datetime_str, &start_datetime_str, @@ -1733,7 +1726,7 @@ static struct my_option my_options[] = {"stop-datetime", OPT_STOP_DATETIME, "Stop reading the binlog at first event having a datetime equal or " "posterior to the argument; the argument must be a date and time " - "in the local time zone, in any format accepted by the MySQL server " + "in the local time zone, in any format accepted by the MariaDB server " "for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 " "(you should probably use quotes for your shell to set it properly).", &stop_datetime_str, &stop_datetime_str, @@ -1757,7 +1750,7 @@ static struct my_option my_options[] = 0, 0, 0, 0, 0, 0}, {"to-last-log", 't', "Requires -R. Will not stop at the end of the \ requested binlog but rather continue printing until the end of the last \ -binlog of the MySQL server. If you send the output to the same MySQL server, \ +binlog of the MariaDB server. If you send the output to the same MariaDB server, \ that may lead to an endless loop.", &to_last_remote_log, &to_last_remote_log, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1903,7 +1896,7 @@ static void usage() print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); printf("\ -Dumps a MySQL binary log in a format usable for viewing or for piping to\n\ +Dumps a MariaDB binary log in a format usable for viewing or for piping to\n\ the mysql command line client.\n\n"); printf("Usage: %s [options] log-files\n", my_progname); print_defaults("my",load_groups); @@ -1921,7 +1914,7 @@ static my_time_t convert_str_to_timestamp(const char* str) uint dummy_in_dst_time_gap; /* We require a total specification (date AND time) */ - if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &status) || + if (str_to_datetime_or_date(str, (uint) strlen(str), &l_time, 0, &status) || l_time.time_type != MYSQL_TIMESTAMP_DATETIME || status.warnings) { error("Incorrect date and time argument: %s", str); @@ -2140,6 +2133,7 @@ static Exit_status safe_connect() opt_ssl_capath, opt_ssl_cipher); mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + mysql_options(mysql, MARIADB_OPT_TLS_VERSION, opt_tls_version); } mysql_options(mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); @@ -2153,11 +2147,6 @@ static Exit_status safe_connect() if (opt_protocol) mysql_options(mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol); -#ifdef HAVE_SMEM - if (shared_memory_base_name) - mysql_options(mysql, MYSQL_SHARED_MEMORY_BASE_NAME, - shared_memory_base_name); -#endif mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0); mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "program_name", "mysqlbinlog"); @@ -2314,7 +2303,7 @@ static Exit_status check_master_version() break; default: error("Could not find server version: " - "Master reported unrecognized MySQL version '%s'.", row[0]); + "Master reported unrecognized MariaDB version '%s'.", row[0]); goto err; } if (!glob_description_event || !glob_description_event->is_valid()) diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index aaf77dbb743..c1859440446 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -55,7 +55,6 @@ 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; enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_FIX_NAMES }; @@ -179,7 +178,7 @@ static struct my_option my_long_options[] = "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", &opt_mysql_port, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).", + {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"quick", 'q', "If you are using this option with CHECK TABLE, it prevents the check from scanning the rows to check for wrong links. This is the fastest check. If you are using this option with REPAIR TABLE, it will try to repair only the index tree. This is the fastest repair method for a table.", @@ -188,11 +187,6 @@ static struct my_option my_long_options[] = {"repair", 'r', "Can fix almost anything except unique keys that aren't unique.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_SMEM - {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, - "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name, - 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"silent", 's', "Print only error messages.", &opt_silent, &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip_database", 0, "Don't process the database specified as argument", @@ -228,7 +222,8 @@ static struct my_option my_long_options[] = }; static const char *load_default_groups[]= -{ "mysqlcheck", "client", "client-server", "client-mariadb", 0 }; +{ "mysqlcheck", "mariadb-check", "client", "client-server", "client-mariadb", + 0 }; static void print_version(void); @@ -1115,8 +1110,6 @@ static int dbConnect(char *host, char *user, char *passwd) #endif if (opt_protocol) mysql_options(&mysql_connection,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); - if (shared_memory_base_name) - mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); if (opt_plugin_dir && *opt_plugin_dir) mysql_options(&mysql_connection, MYSQL_PLUGIN_DIR, opt_plugin_dir); @@ -1256,8 +1249,7 @@ int main(int argc, char **argv) delete_dynamic(&alter_table_cmds); } end1: - my_free(opt_password); - my_free(shared_memory_base_name); + my_free(opt_password);; mysql_library_end(); free_defaults(defaults_argv); my_end(my_end_arg); diff --git a/client/mysqldump.c b/client/mysqldump.c index 20f8278c9c2..fc5b3bfabaf 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -187,9 +187,6 @@ static MYSQL_RES *routine_res, *routine_list_res; FILE *md_result_file= 0; FILE *stderror_file=0; -#ifdef HAVE_SMEM -static char *shared_memory_base_name=0; -#endif static uint opt_protocol= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0; @@ -285,10 +282,10 @@ static struct my_option my_long_options[] = 1, 0, 0, 0, 0, 0}, {"compatible", OPT_COMPATIBLE, "Change the dump to be compatible with a given mode. By default tables " - "are dumped in a format optimized for MySQL. Legal modes are: ansi, " + "are dumped in a format optimized for MariaDB. Legal modes are: ansi, " "mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, " "no_table_options, no_field_options. One can use several modes separated " - "by commas. Note: Requires MySQL server version 4.1.0 or higher. " + "by commas. Note: Requires MariaDB server version 4.1.0 or higher. " "This option is ignored with earlier server versions.", &opt_compatible_mode_str, &opt_compatible_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -305,7 +302,7 @@ static struct my_option my_long_options[] = &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"create-options", 'a', - "Include all MySQL specific create options.", + "Include all MariaDB specific create options.", &create_options, &create_options, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"databases", 'B', @@ -506,7 +503,7 @@ static struct my_option my_long_options[] = &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"protocol", OPT_MYSQL_PROTOCOL, - "The protocol to use for connection (tcp, socket, pipe, memory).", + "The protocol to use for connection (tcp, socket, pipe).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"quick", 'q', "Don't buffer query, dump directly to stdout.", &quick, &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, @@ -528,11 +525,6 @@ static struct my_option my_long_options[] = "Add 'SET NAMES default_character_set' to the output.", &opt_set_charset, &opt_set_charset, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, -#ifdef HAVE_SMEM - {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, - "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name, - 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif /* Note that the combination --single-transaction --master-data will give bullet-proof binlog position only if server >=4.1.3. That's the @@ -599,7 +591,8 @@ static struct my_option my_long_options[] = }; static const char *load_default_groups[]= -{ "mysqldump", "client", "client-server", "client-mariadb", 0 }; +{ "mysqldump", "mariadb-dump", "client", "client-server", "client-mariadb", + 0 }; static void maybe_exit(int error); static void die(int error, const char* reason, ...); @@ -693,7 +686,7 @@ static void usage(void) { print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); - puts("Dumping structure and contents of MySQL databases and tables."); + puts("Dumping structure and contents of MariaDB databases and tables."); short_usage_sub(stdout); print_defaults("my",load_default_groups); puts(""); @@ -751,7 +744,7 @@ static void write_header(FILE *sql_file, const char *db_name) else if (!opt_compact) { print_comment(sql_file, 0, - "-- MySQL dump %s Distrib %s, for %s (%s)\n--\n", + "-- MariaDB 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 ", @@ -1864,16 +1857,13 @@ static int connect_to_db(char *host, char *user,char *passwd) opt_ssl_capath, opt_ssl_cipher); mysql_options(&mysql_connection, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(&mysql_connection, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + mysql_options(&mysql_connection, MARIADB_OPT_TLS_VERSION, opt_tls_version); } mysql_options(&mysql_connection,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); #endif if (opt_protocol) mysql_options(&mysql_connection,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); -#ifdef HAVE_SMEM - if (shared_memory_base_name) - mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); -#endif mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset); if (opt_plugin_dir && *opt_plugin_dir) @@ -6230,7 +6220,7 @@ static int start_transaction(MYSQL *mysql_con) if ((mysql_get_server_version(mysql_con) < 40100) && opt_master_data) { fprintf(stderr, "-- %s: the combination of --single-transaction and " - "--master-data requires a MySQL server version of at least 4.1 " + "--master-data requires a MariaDB server version of at least 4.1 " "(current server's version is %s). %s\n", ignore_errors ? "Warning" : "Error", mysql_con->server_version ? mysql_con->server_version : "unknown", @@ -6978,10 +6968,6 @@ err: if (opt_slave_data) do_start_slave_sql(mysql); -#ifdef HAVE_SMEM - my_free(shared_memory_base_name); -#endif - dbDisconnect(current_host); if (!path) write_footer(md_result_file); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 880d3ff07cf..e72eb12cb99 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -67,10 +67,6 @@ static longlong opt_ignore_lines= -1; static char **argv_to_free; -#ifdef HAVE_SMEM -static char *shared_memory_base_name=0; -#endif - static struct my_option my_long_options[] = { {"character-sets-dir", OPT_CHARSETS_DIR, @@ -163,15 +159,10 @@ static struct my_option my_long_options[] = &opt_mysql_port, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).", + {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"replace", 'r', "If duplicate unique key was found, replace old row.", &replace, &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_SMEM - {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, - "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name, - 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"silent", 's', "Be more silent.", &silent, &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"socket", 'S', "The socket file to use for connection.", @@ -196,7 +187,8 @@ static struct my_option my_long_options[] = static const char *load_default_groups[]= -{ "mysqlimport","client", "client-server", "client-mariadb", 0 }; +{ "mysqlimport", "mariadb-import", "client", "client-server", "client-mariadb", + 0 }; static void print_version(void) @@ -210,13 +202,14 @@ static void usage(void) { puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("Copyright 2008-2011 Oracle and Monty Program Ab."); + puts("Copyright 2012-2019 MariaDB Corporation Ab."); print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); printf("\ Loads tables from text files in various formats. The base name of the\n\ text file must be the name of the table that should be used.\n\ -If one uses sockets to connect to the MySQL server, the server will open and\n\ -read the text file directly. In other cases the client will open the text\n\ +If one uses sockets to connect to the MariaDB server, the server will open\n\ +and read the text file directly. In other cases the client will open the text\n\ file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n"); printf("\nUsage: %s [OPTIONS] database textfile...\n",my_progname); @@ -458,16 +451,13 @@ static MYSQL *db_connect(char *host, char *database, opt_ssl_capath, opt_ssl_cipher); mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + mysql_options(mysql, MARIADB_OPT_TLS_VERSION, opt_tls_version); } mysql_options(mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); #endif if (opt_protocol) mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); -#ifdef HAVE_SMEM - if (shared_memory_base_name) - mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); -#endif if (opt_plugin_dir && *opt_plugin_dir) mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); @@ -525,9 +515,6 @@ static void safe_exit(int error, MYSQL *mysql) mysql_close(mysql); mysql_library_end(); -#ifdef HAVE_SMEM - my_free(shared_memory_base_name); -#endif free_defaults(argv_to_free); my_free(opt_password); if (error) diff --git a/client/mysqlshow.c b/client/mysqlshow.c index dfa1eac3673..db5c2bbbbe6 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB + Copyright (c) 2010, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,9 +39,6 @@ static uint opt_verbose=0; static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME; static char *opt_plugin_dir= 0, *opt_default_auth= 0; -#ifdef HAVE_SMEM -static char *shared_memory_base_name=0; -#endif static uint opt_protocol=0; static void get_options(int *argc,char ***argv); @@ -59,7 +56,8 @@ static void print_res_top(MYSQL_RES *result); static void print_res_row(MYSQL_RES *result,MYSQL_ROW cur); static const char *load_default_groups[]= -{ "mysqlshow","client", "client-server", "client-mariadb", 0 }; +{ "mysqlshow", "mariadb-show", "client", "client-server", "client-mariadb", + 0 }; static char * opt_mysql_unix_port=0; int main(int argc, char **argv) @@ -125,16 +123,14 @@ int main(int argc, char **argv) opt_ssl_capath, opt_ssl_cipher); mysql_options(&mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(&mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + mysql_options(&mysql, MARIADB_OPT_TLS_VERSION, opt_tls_version); } mysql_options(&mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); #endif if (opt_protocol) mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); -#ifdef HAVE_SMEM - if (shared_memory_base_name) - mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); -#endif + if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME)) default_charset= (char *)my_default_csname(); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); @@ -179,9 +175,6 @@ error: mysql_close(&mysql); /* Close & free connection */ my_free(opt_password); mysql_server_end(); -#ifdef HAVE_SMEM - my_free(shared_memory_base_name); -#endif free_defaults(defaults_argv); my_end(my_end_arg); exit(error ? 1 : 0); @@ -245,14 +238,8 @@ static struct my_option my_long_options[] = NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"protocol", OPT_MYSQL_PROTOCOL, - "The protocol to use for connection (tcp, socket, pipe, memory).", + "The protocol to use for connection (tcp, socket, pipe).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_SMEM - {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, - "Base name of shared memory.", &shared_memory_base_name, - &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, -#endif {"show-table-type", 't', "Show table type column.", &opt_table_type, &opt_table_type, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -285,7 +272,7 @@ static void usage(void) { print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); - puts("Shows the structure of a MySQL database (databases, tables, and columns).\n"); + puts("Shows the structure of a MariaDB database (databases, tables, and columns).\n"); printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname); puts("\n\ If last argument contains a shell or SQL wildcard (*,?,% or _) then only\n\ @@ -675,7 +662,7 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild) fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n", my_progname,db,wild ? wild : "",mysql_error(mysql)); if (mysql_errno(mysql) == ER_PARSE_ERROR) - fprintf(stderr,"This error probably means that your MySQL server doesn't support the\n\'show table status' command.\n"); + fprintf(stderr,"This error probably means that your MariaDB server doesn't support the\n\'show table status' command.\n"); return 1; } diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 19544384670..c44bf8446f9 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -98,9 +98,6 @@ TODO: #define snprintf _snprintf #endif -#ifdef HAVE_SMEM -static char *shared_memory_base_name=0; -#endif /* Global Thread counter */ uint thread_counter; @@ -180,7 +177,8 @@ static int get_options(int *argc,char ***argv); static uint opt_mysql_port= 0; static const char *load_default_groups[]= -{ "mysqlslap", "client", "client-server", "client-mariadb", 0 }; +{ "mysqlslap", "mariadb-slap", "client", "client-server", "client-mariadb", + 0 }; typedef struct statement statement; @@ -309,10 +307,6 @@ void set_mysql_connect_options(MYSQL *mysql) #endif if (opt_protocol) mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); -#ifdef HAVE_SMEM - if (shared_memory_base_name) - mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); -#endif mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset); } @@ -423,10 +417,6 @@ int main(int argc, char **argv) statement_cleanup(pre_statements); statement_cleanup(post_statements); option_cleanup(engine_options); - -#ifdef HAVE_SMEM - my_free(shared_memory_base_name); -#endif free_defaults(defaults_argv); mysql_library_end(); my_end(my_end_arg); @@ -634,7 +624,7 @@ static struct my_option my_long_options[] = {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"init-command", OPT_INIT_COMMAND, - "SQL Command to execute when connecting to MySQL server. Will " + "SQL Command to execute when connecting to MariaDB server. Will " "automatically be re-executed when reconnecting.", &opt_init_command, &opt_init_command, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -689,17 +679,11 @@ static struct my_option my_long_options[] = &pre_system, &pre_system, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"protocol", OPT_MYSQL_PROTOCOL, - "The protocol to use for connection (tcp, socket, pipe, memory).", + "The protocol to use for connection (tcp, socket, pipe).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"query", 'q', "Query to run or file containing query to run.", &user_supplied_query, &user_supplied_query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_SMEM - {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, - "Base name of shared memory.", &shared_memory_base_name, - &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, -#endif {"silent", 's', "Run program in silent mode - no output.", &opt_silent, &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/client/mysqltest.cc b/client/mysqltest.cc index ad1eb29ab70..08d0c8efbb9 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -109,7 +109,6 @@ enum { static int record= 0, opt_sleep= -1; static char *opt_db= 0, *opt_pass= 0; const char *opt_user= 0, *opt_host= 0, *unix_sock= 0, *opt_basedir= "./"; -static char *shared_memory_base_name=0; const char *opt_logdir= ""; const char *opt_prologue= 0, *opt_charsets_dir; static int opt_port= 0; @@ -139,7 +138,8 @@ static my_bool server_initialized= 0; static my_bool is_windows= 0; static char **default_argv; static const char *load_default_groups[]= -{ "mysqltest", "client", "client-server", "client-mariadb", 0 }; +{ "mysqltest", "mariadb-test", "client", "client-server", "client-mariadb", + 0 }; static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer; /* Info on properties that can be set with --enable_X and --disable_X */ @@ -874,21 +874,6 @@ static char *my_fgets(char * s, int n, FILE * stream, int *len) return buf; } -/* - Wrapper for popen(). - On Windows, uses binary mode to workaround - C runtime bug mentioned in MDEV-9409 -*/ -static FILE* my_popen(const char *cmd, const char *mode) -{ - FILE *f= popen(cmd, mode); -#ifdef _WIN32 - if (f) - _setmode(fileno(f), O_BINARY); -#endif - return f; -} - #ifdef EMBEDDED_LIBRARY #define EMB_SEND_QUERY 1 @@ -1798,7 +1783,7 @@ static int run_command(char* cmd, } } - error= pclose(res_file); + error= my_pclose(res_file); DBUG_RETURN(WEXITSTATUS(error)); } @@ -3384,7 +3369,7 @@ void do_exec(struct st_command *command) { replace_dynstr_append_mem(ds_result, buf, len); } - error= pclose(res_file); + error= my_pclose(res_file); if (display_result_sorted) { @@ -4614,7 +4599,7 @@ void do_perl(struct st_command *command) replace_dynstr_append_mem(&ds_res, buf, len); } } - error= pclose(res_file); + error= my_pclose(res_file); /* Remove the temporary file, but keep it if perl failed */ if (!error) @@ -5841,7 +5826,6 @@ do_handle_error: <opts> - options to use for the connection * SSL - use SSL if available * COMPRESS - use compression if available - * SHM - use shared memory if available * PIPE - use named pipe if available */ @@ -5853,7 +5837,6 @@ void do_connect(struct st_command *command) char *ssl_cipher __attribute__((unused))= 0; my_bool con_ssl= 0, con_compress= 0; my_bool con_pipe= 0; - my_bool con_shm __attribute__ ((unused))= 0; int read_timeout= 0; int write_timeout= 0; int connect_timeout= 0; @@ -5869,9 +5852,6 @@ void do_connect(struct st_command *command) static DYNAMIC_STRING ds_sock; static DYNAMIC_STRING ds_options; static DYNAMIC_STRING ds_default_auth; -#ifdef HAVE_SMEM - static DYNAMIC_STRING ds_shm; -#endif const struct command_arg connect_args[] = { { "connection name", ARG_STRING, TRUE, &ds_connection_name, "Name of the connection" }, { "host", ARG_STRING, TRUE, &ds_host, "Host to connect to" }, @@ -5900,19 +5880,15 @@ void do_connect(struct st_command *command) die("Illegal argument for port: '%s'", ds_port.str); } -#ifdef HAVE_SMEM - /* Shared memory */ - init_dynamic_string(&ds_shm, ds_sock.str, 0, 0); -#endif - /* Sock */ if (ds_sock.length) { /* If the socket is specified just as a name without path + or an abstract socket indicator ('@'), then append tmpdir in front */ - if (*ds_sock.str != FN_LIBCHAR) + if (*ds_sock.str != FN_LIBCHAR && *ds_sock.str != '@') { char buff[FN_REFLEN]; fn_format(buff, ds_sock.str, TMPDIR, "", 0); @@ -5952,8 +5928,6 @@ void do_connect(struct st_command *command) con_compress= 1; else if (length == 4 && !strncmp(con_options, "PIPE", 4)) con_pipe= 1; - else if (length == 3 && !strncmp(con_options, "SHM", 3)) - con_shm= 1; else if (strncasecmp(con_options, "read_timeout=", sizeof("read_timeout=")-1) == 0) { @@ -6026,6 +6000,7 @@ void do_connect(struct st_command *command) opt_ssl_capath, ssl_cipher ? ssl_cipher : opt_ssl_cipher); mysql_options(con_slot->mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(con_slot->mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + mysql_options(con_slot->mysql, MARIADB_OPT_TLS_VERSION, opt_tls_version); #if MYSQL_VERSION_ID >= 50000 /* Turn on ssl_verify_server_cert only if host is "localhost" */ opt_ssl_verify_server_cert= !strcmp(ds_host.str, "localhost"); @@ -6063,22 +6038,6 @@ void do_connect(struct st_command *command) (char*)&connect_timeout); } -#ifdef HAVE_SMEM - if (con_shm) - { - uint protocol= MYSQL_PROTOCOL_MEMORY; - if (!ds_shm.length) - die("Missing shared memory base name"); - mysql_options(con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str); - mysql_options(con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol); - } - else if (shared_memory_base_name) - { - mysql_options(con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, - shared_memory_base_name); - } -#endif - /* Use default db name */ if (ds_database.length == 0) dynstr_set(&ds_database, opt_db); @@ -6123,9 +6082,6 @@ void do_connect(struct st_command *command) dynstr_free(&ds_sock); dynstr_free(&ds_options); dynstr_free(&ds_default_auth); -#ifdef HAVE_SMEM - dynstr_free(&ds_shm); -#endif free(csname); DBUG_VOID_RETURN; } @@ -7017,7 +6973,7 @@ static struct my_option my_long_options[] = GET_INT, REQUIRED_ARG, DEFAULT_MAX_CONN, 8, 5120, 0, 0, 0}, {"password", 'p', "Password to use when connecting to server.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).", + {"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " @@ -7050,10 +7006,6 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"server-file", 'F', "Read embedded server arguments from file.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"shared-memory-base-name", 0, - "Base name of shared memory.", &shared_memory_base_name, - &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, - 0, 0, 0}, {"silent", 's', "Suppress all normal output. Synonym for --quiet.", &silent, &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"sleep", 'T', "Always sleep this many seconds on sleep commands.", @@ -7114,7 +7066,7 @@ void usage() { print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); - printf("Runs a test against the mysql server and compares output with a results file.\n\n"); + printf("Runs a test against the MariaDB server and compares output with a results file.\n\n"); printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname); print_defaults("my",load_default_groups); puts(""); @@ -7872,7 +7824,7 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql) static void handle_no_active_connection(struct st_command *command, struct st_connection *cn, DYNAMIC_STRING *ds) { - handle_error(command, 2006, "MySQL server has gone away", "000000", ds); + handle_error(command, 2006, "MariaDB server has gone away", "000000", ds); cn->pending= FALSE; var_set_errno(2006); } @@ -9231,7 +9183,7 @@ int main(int argc, char **argv) if (mysql_server_init(embedded_server_arg_count, embedded_server_args, (char**) embedded_server_groups)) - die("Can't initialize MySQL server"); + die("Can't initialize MariaDB server"); server_initialized= 1; if (cur_file == file_stack && cur_file->file == 0) { @@ -9289,11 +9241,6 @@ int main(int argc, char **argv) } #endif -#ifdef HAVE_SMEM - if (shared_memory_base_name) - mysql_options(con->mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); -#endif - if (!(con->name = my_strdup("default", MYF(MY_WME)))) die("Out of memory"); mysql_options(con->mysql, MYSQL_OPT_NONBLOCK, 0); @@ -9963,7 +9910,7 @@ void do_get_replace(struct st_command *command) char *buff, *start; char word_end_chars[256], *pos; POINTER_ARRAY to_array, from_array; - DBUG_ENTER("get_replace"); + DBUG_ENTER("do_get_replace"); free_replace(); @@ -10961,7 +10908,7 @@ int get_next_bit(REP_SET *set,uint lastpos) start=set->bits+ ((lastpos+1) / WORD_BIT); end=set->bits + set->size_of_bits; - bits=start[0] & ~((1 << ((lastpos+1) % WORD_BIT)) -1); + bits=start[0] & ~((1U << ((lastpos+1) % WORD_BIT)) -1); while (! bits && ++start < end) bits=start[0]; |