1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-16536 Remove shared memory transport

This commit is contained in:
Vladislav Vaintroub
2018-08-20 13:06:33 +01:00
parent 4299b82ad8
commit ee98e95e25
34 changed files with 67 additions and 3562 deletions

View File

@ -49,7 +49,7 @@ enum options_client
OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE, OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE,
OPT_DELETE_MASTER_LOGS, OPT_COMPACT, OPT_DELETE_MASTER_LOGS, OPT_COMPACT,
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL, 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_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_SERVER_ARG, OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_SERVER_ARG,
OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,

View File

@ -196,9 +196,6 @@ static char delimiter[16]= DEFAULT_DELIMITER;
static uint delimiter_length= 1; static uint delimiter_length= 1;
unsigned short terminal_width= 80; unsigned short terminal_width= 80;
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
static uint opt_protocol=0; static uint opt_protocol=0;
static CHARSET_INFO *charset_info= &my_charset_latin1; static CHARSET_INFO *charset_info= &my_charset_latin1;
@ -1340,9 +1337,6 @@ sig_handler mysql_end(int sig)
my_free(full_username); my_free(full_username);
my_free(part_username); my_free(part_username);
my_free(default_prompt); my_free(default_prompt);
#ifdef HAVE_SMEM
my_free(shared_memory_base_name);
#endif
my_free(current_prompt); my_free(current_prompt);
while (embedded_server_arg_count > 1) while (embedded_server_arg_count > 1)
my_free(embedded_server_args[--embedded_server_arg_count]); my_free(embedded_server_args[--embedded_server_arg_count]);
@ -1373,10 +1367,6 @@ static bool do_connect(MYSQL *mysql, const char *host, const char *user,
#endif #endif
if (opt_protocol) if (opt_protocol)
mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&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) if (opt_plugin_dir && *opt_plugin_dir)
mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
@ -1612,7 +1602,7 @@ static struct my_option my_long_options[] =
{"prompt", OPT_PROMPT, "Set the mysql prompt to this value.", {"prompt", OPT_PROMPT, "Set the mysql prompt to this value.",
&current_prompt, &current_prompt, 0, GET_STR_ALLOC, &current_prompt, &current_prompt, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 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}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q', {"quick", 'q',
"Don't cache result, print it row by row. This may slow down the server " "Don't cache result, print it row by row. This may slow down the server "
@ -1626,11 +1616,6 @@ static struct my_option my_long_options[] =
&opt_reconnect, &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, &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, " {"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}, "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.", {"socket", 'S', "The socket file to use for connection.",
&opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR_ALLOC, &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

View File

@ -135,13 +135,8 @@ static struct my_option my_long_options[]=
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, {"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}, 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, {"silent", OPT_SILENT, "Print less information", &opt_silent,
&opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "The socket file to use for connection.", {"socket", 'S', "The socket file to use for connection.",
@ -354,7 +349,6 @@ get_one_option(int optid, const struct my_option *opt,
case 'P': /* --port */ case 'P': /* --port */
case 'S': /* --socket */ case 'S': /* --socket */
case OPT_MYSQL_PROTOCOL: /* --protocol */ case OPT_MYSQL_PROTOCOL: /* --protocol */
case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */
case OPT_PLUGIN_DIR: /* --plugin-dir */ case OPT_PLUGIN_DIR: /* --plugin-dir */
case OPT_DEFAULT_AUTH: /* --default-auth */ case OPT_DEFAULT_AUTH: /* --default-auth */
add_one_option_cmd_line(&conn_args, opt, argument); add_one_option_cmd_line(&conn_args, opt, argument);

View File

@ -49,9 +49,6 @@ static char * unix_port=0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static bool sql_log_bin_off= false; static bool sql_log_bin_off= false;
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
static uint opt_protocol=0; static uint opt_protocol=0;
static myf error_flags; /* flags to pass to my_printf_error, like ME_BELL */ static myf error_flags; /* flags to pass to my_printf_error, like ME_BELL */
@ -185,18 +182,13 @@ static struct my_option my_long_options[] =
#endif #endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
&tcp_port, &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, &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}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relative", 'r', {"relative", 'r',
"Show difference between current and previous values when used with -i. " "Show difference between current and previous values when used with -i. "
"Currently only works with extended-status.", "Currently only works with extended-status.",
&opt_relative, &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0, &opt_relative, &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
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.", {"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}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "The socket file to use for connection.", {"socket", 'S', "The socket file to use for connection.",
@ -367,10 +359,6 @@ int main(int argc,char *argv[])
#endif #endif
if (opt_protocol) if (opt_protocol)
mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&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); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
error_flags= (myf)(opt_nobeep ? 0 : ME_BELL); error_flags= (myf)(opt_nobeep ? 0 : ME_BELL);
@ -496,9 +484,6 @@ err2:
mysql_library_end(); mysql_library_end();
my_free(opt_password); my_free(opt_password);
my_free(user); my_free(user);
#ifdef HAVE_SMEM
my_free(shared_memory_base_name);
#endif
free_defaults(save_argv); free_defaults(save_argv);
my_end(my_end_arg); my_end(my_end_arg);
return error; return error;

View File

@ -124,9 +124,6 @@ static uint my_end_arg;
static const char* sock= 0; static const char* sock= 0;
static char *opt_plugindir= 0, *opt_default_auth= 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* user = 0;
static char* pass = 0; static char* pass = 0;
static char *charset= 0; static char *charset= 0;
@ -1644,7 +1641,7 @@ static struct my_option my_options[] =
&port, &port, 0, GET_INT, REQUIRED_ARG, &port, &port, 0, GET_INT, REQUIRED_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, {"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}, 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 MySQL server.",
&remote_opt, &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, &remote_opt, &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
@ -1685,12 +1682,6 @@ static struct my_option my_options[] =
{"set-charset", OPT_SET_CHARSET, {"set-charset", OPT_SET_CHARSET,
"Add 'SET NAMES character_set' to the output.", &charset, "Add 'SET NAMES character_set' to the output.", &charset,
&charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, &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 " {"short-form", 's', "Just show regular queries: no extra info, no "
"row-based events and no row counts. This is mainly for testing only, " "row-based events and no row counts. This is mainly for testing only, "
"and should not be used to feed to the MariaDB server. " "and should not be used to feed to the MariaDB server. "
@ -2134,11 +2125,6 @@ static Exit_status safe_connect()
if (opt_protocol) if (opt_protocol)
mysql_options(mysql, MYSQL_OPT_PROTOCOL, (char*) &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_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
"program_name", "mysqlbinlog"); "program_name", "mysqlbinlog");

View File

@ -55,7 +55,6 @@ static int first_error = 0;
static char *opt_skip_database; static char *opt_skip_database;
DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds; DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds;
DYNAMIC_ARRAY views4repair; DYNAMIC_ARRAY views4repair;
static char *shared_memory_base_name=0;
static uint opt_protocol=0; static uint opt_protocol=0;
enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_FIX_NAMES }; 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) ").", "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
&opt_mysql_port, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, &opt_mysql_port, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 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}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q', {"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.", "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', {"repair", 'r',
"Can fix almost anything except unique keys that aren't unique.", "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}, 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, {"silent", 's', "Print only error messages.", &opt_silent,
&opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip_database", 0, "Don't process the database specified as argument", {"skip_database", 0, "Don't process the database specified as argument",
@ -1112,8 +1106,6 @@ static int dbConnect(char *host, char *user, char *passwd)
#endif #endif
if (opt_protocol) if (opt_protocol)
mysql_options(&mysql_connection,MYSQL_OPT_PROTOCOL,(char*)&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) if (opt_plugin_dir && *opt_plugin_dir)
mysql_options(&mysql_connection, MYSQL_PLUGIN_DIR, opt_plugin_dir); mysql_options(&mysql_connection, MYSQL_PLUGIN_DIR, opt_plugin_dir);
@ -1253,8 +1245,7 @@ int main(int argc, char **argv)
delete_dynamic(&alter_table_cmds); delete_dynamic(&alter_table_cmds);
} }
end1: end1:
my_free(opt_password); my_free(opt_password);;
my_free(shared_memory_base_name);
mysql_library_end(); mysql_library_end();
free_defaults(defaults_argv); free_defaults(defaults_argv);
my_end(my_end_arg); my_end(my_end_arg);

View File

@ -159,9 +159,6 @@ static MYSQL_RES *routine_res, *routine_list_res;
FILE *md_result_file= 0; FILE *md_result_file= 0;
FILE *stderror_file=0; FILE *stderror_file=0;
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
static uint opt_protocol= 0; static uint opt_protocol= 0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0;
@ -472,7 +469,7 @@ static struct my_option my_long_options[] =
&opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0}, 0},
{"protocol", OPT_MYSQL_PROTOCOL, {"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}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q', "Don't buffer query, dump directly to stdout.", {"quick", 'q', "Don't buffer query, dump directly to stdout.",
&quick, &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, &quick, &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
@ -494,11 +491,6 @@ static struct my_option my_long_options[] =
"Add 'SET NAMES default_character_set' to the output.", "Add 'SET NAMES default_character_set' to the output.",
&opt_set_charset, &opt_set_charset, 0, GET_BOOL, NO_ARG, 1, &opt_set_charset, &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 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
/* /*
Note that the combination --single-transaction --master-data Note that the combination --single-transaction --master-data
will give bullet-proof binlog position only if server >=4.1.3. That's the will give bullet-proof binlog position only if server >=4.1.3. That's the
@ -1719,10 +1711,6 @@ static int connect_to_db(char *host, char *user,char *passwd)
#endif #endif
if (opt_protocol) if (opt_protocol)
mysql_options(&mysql_connection,MYSQL_OPT_PROTOCOL,(char*)&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); mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset);
if (opt_plugin_dir && *opt_plugin_dir) if (opt_plugin_dir && *opt_plugin_dir)
@ -6255,10 +6243,6 @@ err:
if (opt_slave_data) if (opt_slave_data)
do_start_slave_sql(mysql); do_start_slave_sql(mysql);
#ifdef HAVE_SMEM
my_free(shared_memory_base_name);
#endif
dbDisconnect(current_host); dbDisconnect(current_host);
if (!path) if (!path)
write_footer(md_result_file); write_footer(md_result_file);

View File

@ -65,10 +65,6 @@ static longlong opt_ignore_lines= -1;
static char **argv_to_free; static char **argv_to_free;
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
static struct my_option my_long_options[] = static struct my_option my_long_options[] =
{ {
{"character-sets-dir", OPT_CHARSETS_DIR, {"character-sets-dir", OPT_CHARSETS_DIR,
@ -157,15 +153,10 @@ static struct my_option my_long_options[] =
&opt_mysql_port, &opt_mysql_port,
&opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 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}, 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", 'r', "If duplicate unique key was found, replace old row.",
&replace, &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &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, {"silent", 's', "Be more silent.", &silent, &silent, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "The socket file to use for connection.", {"socket", 'S', "The socket file to use for connection.",
@ -458,10 +449,6 @@ static MYSQL *db_connect(char *host, char *database,
#endif #endif
if (opt_protocol) if (opt_protocol)
mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&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) if (opt_plugin_dir && *opt_plugin_dir)
mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
@ -514,9 +501,6 @@ static void safe_exit(int error, MYSQL *mysql)
if (mysql) if (mysql)
mysql_close(mysql); mysql_close(mysql);
#ifdef HAVE_SMEM
my_free(shared_memory_base_name);
#endif
free_defaults(argv_to_free); free_defaults(argv_to_free);
mysql_library_end(); mysql_library_end();
my_free(opt_password); my_free(opt_password);

View File

@ -39,9 +39,6 @@ static uint opt_verbose=0;
static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME; static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
static char *opt_plugin_dir= 0, *opt_default_auth= 0; 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 uint opt_protocol=0;
static void get_options(int *argc,char ***argv); static void get_options(int *argc,char ***argv);
@ -131,10 +128,7 @@ int main(int argc, char **argv)
#endif #endif
if (opt_protocol) if (opt_protocol)
mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&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); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (opt_plugin_dir && *opt_plugin_dir) if (opt_plugin_dir && *opt_plugin_dir)
@ -177,9 +171,6 @@ error:
mysql_close(&mysql); /* Close & free connection */ mysql_close(&mysql); /* Close & free connection */
my_free(opt_password); my_free(opt_password);
mysql_server_end(); mysql_server_end();
#ifdef HAVE_SMEM
my_free(shared_memory_base_name);
#endif
free_defaults(defaults_argv); free_defaults(defaults_argv);
my_end(my_end_arg); my_end(my_end_arg);
exit(error ? 1 : 0); exit(error ? 1 : 0);
@ -243,14 +234,8 @@ static struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"protocol", OPT_MYSQL_PROTOCOL, {"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}, 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.", {"show-table-type", 't', "Show table type column.",
&opt_table_type, &opt_table_type, 0, GET_BOOL, &opt_table_type, &opt_table_type, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},

View File

@ -98,9 +98,6 @@ TODO:
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
/* Global Thread counter */ /* Global Thread counter */
uint thread_counter; uint thread_counter;
@ -309,10 +306,6 @@ void set_mysql_connect_options(MYSQL *mysql)
#endif #endif
if (opt_protocol) if (opt_protocol)
mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&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); mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
} }
@ -423,10 +416,6 @@ int main(int argc, char **argv)
statement_cleanup(pre_statements); statement_cleanup(pre_statements);
statement_cleanup(post_statements); statement_cleanup(post_statements);
option_cleanup(engine_options); option_cleanup(engine_options);
#ifdef HAVE_SMEM
my_free(shared_memory_base_name);
#endif
free_defaults(defaults_argv); free_defaults(defaults_argv);
mysql_library_end(); mysql_library_end();
my_end(my_end_arg); my_end(my_end_arg);
@ -689,17 +678,11 @@ static struct my_option my_long_options[] =
&pre_system, &pre_system, &pre_system, &pre_system,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, {"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}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"query", 'q', "Query to run or file containing query to run.", {"query", 'q', "Query to run or file containing query to run.",
&user_supplied_query, &user_supplied_query, &user_supplied_query, &user_supplied_query,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 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
{"silent", 's', "Run program in silent mode - no output.", {"silent", 's', "Run program in silent mode - no output.",
&opt_silent, &opt_silent, 0, GET_BOOL, NO_ARG, &opt_silent, &opt_silent, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},

View File

@ -107,7 +107,6 @@ enum {
static int record= 0, opt_sleep= -1; static int record= 0, opt_sleep= -1;
static char *opt_db= 0, *opt_pass= 0; static char *opt_db= 0, *opt_pass= 0;
const char *opt_user= 0, *opt_host= 0, *unix_sock= 0, *opt_basedir= "./"; 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_logdir= "";
const char *opt_prologue= 0, *opt_charsets_dir; const char *opt_prologue= 0, *opt_charsets_dir;
static int opt_port= 0; static int opt_port= 0;
@ -5950,7 +5949,6 @@ do_handle_error:
<opts> - options to use for the connection <opts> - options to use for the connection
* SSL - use SSL if available * SSL - use SSL if available
* COMPRESS - use compression if available * COMPRESS - use compression if available
* SHM - use shared memory if available
* PIPE - use named pipe if available * PIPE - use named pipe if available
*/ */
@ -5962,7 +5960,6 @@ void do_connect(struct st_command *command)
char *ssl_cipher __attribute__((unused))= 0; char *ssl_cipher __attribute__((unused))= 0;
my_bool con_ssl= 0, con_compress= 0; my_bool con_ssl= 0, con_compress= 0;
my_bool con_pipe= 0; my_bool con_pipe= 0;
my_bool con_shm __attribute__ ((unused))= 0;
int read_timeout= 0; int read_timeout= 0;
int write_timeout= 0; int write_timeout= 0;
int connect_timeout= 0; int connect_timeout= 0;
@ -5977,9 +5974,6 @@ void do_connect(struct st_command *command)
static DYNAMIC_STRING ds_sock; static DYNAMIC_STRING ds_sock;
static DYNAMIC_STRING ds_options; static DYNAMIC_STRING ds_options;
static DYNAMIC_STRING ds_default_auth; static DYNAMIC_STRING ds_default_auth;
#ifdef HAVE_SMEM
static DYNAMIC_STRING ds_shm;
#endif
const struct command_arg connect_args[] = { const struct command_arg connect_args[] = {
{ "connection name", ARG_STRING, TRUE, &ds_connection_name, "Name of the connection" }, { "connection name", ARG_STRING, TRUE, &ds_connection_name, "Name of the connection" },
{ "host", ARG_STRING, TRUE, &ds_host, "Host to connect to" }, { "host", ARG_STRING, TRUE, &ds_host, "Host to connect to" },
@ -6008,11 +6002,6 @@ void do_connect(struct st_command *command)
die("Illegal argument for port: '%s'", ds_port.str); 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 */ /* Sock */
if (ds_sock.length) if (ds_sock.length)
{ {
@ -6061,8 +6050,6 @@ void do_connect(struct st_command *command)
con_compress= 1; con_compress= 1;
else if (length == 4 && !strncmp(con_options, "PIPE", 4)) else if (length == 4 && !strncmp(con_options, "PIPE", 4))
con_pipe= 1; con_pipe= 1;
else if (length == 3 && !strncmp(con_options, "SHM", 3))
con_shm= 1;
else if (strncasecmp(con_options, "read_timeout=", else if (strncasecmp(con_options, "read_timeout=",
sizeof("read_timeout=")-1) == 0) sizeof("read_timeout=")-1) == 0)
{ {
@ -6168,22 +6155,6 @@ void do_connect(struct st_command *command)
(char*)&connect_timeout); (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 */ /* Use default db name */
if (ds_database.length == 0) if (ds_database.length == 0)
dynstr_set(&ds_database, opt_db); dynstr_set(&ds_database, opt_db);
@ -6223,9 +6194,6 @@ void do_connect(struct st_command *command)
dynstr_free(&ds_sock); dynstr_free(&ds_sock);
dynstr_free(&ds_options); dynstr_free(&ds_options);
dynstr_free(&ds_default_auth); dynstr_free(&ds_default_auth);
#ifdef HAVE_SMEM
dynstr_free(&ds_shm);
#endif
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -7109,7 +7077,7 @@ static struct my_option my_long_options[] =
GET_INT, REQUIRED_ARG, DEFAULT_MAX_CONN, 8, 5120, 0, 0, 0}, GET_INT, REQUIRED_ARG, DEFAULT_MAX_CONN, 8, 5120, 0, 0, 0},
{"password", 'p', "Password to use when connecting to server.", {"password", 'p', "Password to use when connecting to server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 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}, 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 " {"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, " "order of preference, my.cnf, $MYSQL_TCP_PORT, "
@ -7142,10 +7110,6 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-file", 'F', "Read embedded server arguments from file.", {"server-file", 'F', "Read embedded server arguments from file.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 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", 's', "Suppress all normal output. Synonym for --quiet.",
&silent, &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &silent, &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sleep", 'T', "Always sleep this many seconds on sleep commands.", {"sleep", 'T', "Always sleep this many seconds on sleep commands.",
@ -9340,11 +9304,6 @@ int main(int argc, char **argv)
} }
#endif #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)))) if (!(con->name = my_strdup("default", MYF(MY_WME))))
die("Out of memory"); die("Out of memory");
mysql_options(con->mysql, MYSQL_OPT_NONBLOCK, 0); mysql_options(con->mysql, MYSQL_OPT_NONBLOCK, 0);

View File

@ -133,11 +133,6 @@
#define F_UNLCK 3 #define F_UNLCK 3
#define F_TO_EOF 0x3FFFFFFF #define F_TO_EOF 0x3FFFFFFF
/* Shared memory and named pipe connections are supported. */
#define HAVE_SMEM 1
#define HAVE_NAMED_PIPE 1
#define shared_memory_buffer_length 16000
#define default_shared_memory_base_name "MYSQL"
#endif /* _WIN32*/ #endif /* _WIN32*/
@ -1186,8 +1181,6 @@ typedef struct { const char *dli_fname, dli_fbase; } Dl_info;
/* Things we don't need in the embedded version of MySQL */ /* Things we don't need in the embedded version of MySQL */
/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
#undef HAVE_SMEM /* No shared memory */
#else #else
#define HAVE_REPLICATION #define HAVE_REPLICATION
#define HAVE_EXTERNAL_CLIENT #define HAVE_EXTERNAL_CLIENT

View File

@ -25,7 +25,6 @@
/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
#undef HAVE_DLOPEN /* No udf functions */ #undef HAVE_DLOPEN /* No udf functions */
#undef HAVE_SMEM /* No shared memory */
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_EMBED_INCLUDED */ #endif /* MYSQL_EMBED_INCLUDED */

View File

@ -38,7 +38,7 @@ typedef struct st_vio Vio;
enum enum_vio_type enum enum_vio_type
{ {
VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE, VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE,
VIO_TYPE_SSL, VIO_TYPE_SHARED_MEMORY VIO_TYPE_SSL
}; };
/** /**
@ -265,17 +265,6 @@ struct st_vio
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
void *ssl_arg; void *ssl_arg;
#endif #endif
#ifdef HAVE_SMEM
HANDLE handle_file_map;
char *handle_map;
HANDLE event_server_wrote;
HANDLE event_server_read;
HANDLE event_client_wrote;
HANDLE event_client_read;
HANDLE event_conn_closed;
size_t shared_memory_remain;
char *shared_memory_pos;
#endif /* HAVE_SMEM */
#ifdef _WIN32 #ifdef _WIN32
HANDLE hPipe; HANDLE hPipe;
OVERLAPPED overlapped; OVERLAPPED overlapped;

View File

@ -209,13 +209,6 @@ my @mysqld_rules=
{ 'bind-address' => \&fix_bind_address }, { 'bind-address' => \&fix_bind_address },
); );
if (IS_WINDOWS)
{
# For simplicity, we use the same names for shared memory and
# named pipes.
push(@mysqld_rules, {'shared-memory-base-name' => \&fix_socket});
}
# #
# Rules to run for [client] section # Rules to run for [client] section
# - will be run in order listed here # - will be run in order listed here
@ -281,19 +274,6 @@ sub post_check_client_group {
} }
$config->insert($client_group_name, $name_to, $option->value()) $config->insert($client_group_name, $name_to, $option->value())
} }
if (IS_WINDOWS)
{
if (! $self->{ARGS}->{embedded})
{
# Shared memory base may or may not be defined (e.g not defined in embedded)
my $shm = $group_to_copy_from->option("shared-memory-base-name");
if (defined $shm)
{
$config->insert($client_group_name,"shared-memory-base-name", $shm->value());
}
}
}
} }
@ -340,7 +320,6 @@ sub post_check_embedded_group {
( (
'log-error', # Embedded server writes stderr to mysqltest's log file 'log-error', # Embedded server writes stderr to mysqltest's log file
'slave-net-timeout', # Embedded server are not build with replication 'slave-net-timeout', # Embedded server are not build with replication
'shared-memory-base-name', # No shared memory for embedded
); );
foreach my $option ( $mysqld->options(), $first_mysqld->options() ) { foreach my $option ( $mysqld->options(), $first_mysqld->options() ) {

View File

@ -1,6 +1,6 @@
--- a/mysql-test/r/mysqld--help.result --- mysqld--help.result 2018-08-12 00:10:13.694793500 +0100
+++ b/mysql-test/r/mysqld--help.result +++ mysqld--help,win.reject 2018-08-16 20:31:08.353317200 +0100
@@ -381,7 +381,6 @@ The following options may be given as the first argument: @@ -386,7 +386,6 @@
The number of segments in a key cache The number of segments in a key cache
-L, --language=name Client error messages in given language. May be given as -L, --language=name Client error messages in given language. May be given as
a full path. Deprecated. Use --lc-messages-dir instead. a full path. Deprecated. Use --lc-messages-dir instead.
@ -8,7 +8,7 @@
--lc-messages=name Set the language used for the error messages. --lc-messages=name Set the language used for the error messages.
-L, --lc-messages-dir=name -L, --lc-messages-dir=name
Directory where error messages are Directory where error messages are
@@ -603,6 +602,7 @@ The following options may be given as the first argument: @@ -608,6 +607,7 @@
Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME,
DATETIME, TIMESTAMP columns. DATETIME, TIMESTAMP columns.
(Defaults to on; use --skip-mysql56-temporal-format to disable.) (Defaults to on; use --skip-mysql56-temporal-format to disable.)
@ -16,17 +16,7 @@
--net-buffer-length=# --net-buffer-length=#
Buffer length for TCP/IP and socket communication Buffer length for TCP/IP and socket communication
--net-read-timeout=# --net-read-timeout=#
@@ -1048,6 +1048,9 @@ The following options may be given as the first argument: @@ -1188,6 +1188,10 @@
characteristics (isolation level, read only/read
write,snapshot - but not any work done / data modified
within the transaction).
+ --shared-memory Enable the shared memory
+ --shared-memory-base-name=name
+ Base name of shared memory
--show-slave-auth-info
Show user and password in SHOW SLAVE HOSTS on this
master.
@@ -1171,6 +1174,10 @@ The following options may be given as the first argument:
Log slow queries to given log file. Defaults logging to Log slow queries to given log file. Defaults logging to
'hostname'-slow.log. Must be enabled to activate other 'hostname'-slow.log. Must be enabled to activate other
slow log options slow log options
@ -37,7 +27,7 @@
--socket=name Socket file to use for connection --socket=name Socket file to use for connection
--sort-buffer-size=# --sort-buffer-size=#
Each thread that needs to do a sort allocates a buffer of Each thread that needs to do a sort allocates a buffer of
@@ -1190,6 +1197,7 @@ The following options may be given as the first argument: @@ -1207,6 +1211,7 @@
EMPTY_STRING_IS_NULL, SIMULTANEOUS_ASSIGNMENT EMPTY_STRING_IS_NULL, SIMULTANEOUS_ASSIGNMENT
--stack-trace Print a symbolic stack trace on failure --stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.) (Defaults to on; use --skip-stack-trace to disable.)
@ -45,7 +35,7 @@
--standard-compliant-cte --standard-compliant-cte
Allow only CTEs compliant to SQL standard Allow only CTEs compliant to SQL standard
(Defaults to on; use --skip-standard-compliant-cte to disable.) (Defaults to on; use --skip-standard-compliant-cte to disable.)
@@ -1257,6 +1265,11 @@ The following options may be given as the first argument: @@ -1277,6 +1282,11 @@
--thread-pool-max-threads=# --thread-pool-max-threads=#
Maximum allowed number of worker threads in the thread Maximum allowed number of worker threads in the thread
pool pool
@ -57,7 +47,7 @@
--thread-pool-oversubscribe=# --thread-pool-oversubscribe=#
How many additional active worker threads in a group are How many additional active worker threads in a group are
allowed. allowed.
@@ -1295,8 +1308,8 @@ The following options may be given as the first argument: @@ -1315,8 +1325,8 @@
automatically convert it to an on-disk MyISAM or Aria automatically convert it to an on-disk MyISAM or Aria
table. table.
-t, --tmpdir=name Path for temporary files. Several paths may be specified, -t, --tmpdir=name Path for temporary files. Several paths may be specified,
@ -68,7 +58,7 @@
--transaction-alloc-block-size=# --transaction-alloc-block-size=#
Allocation block size for transactions to be stored in Allocation block size for transactions to be stored in
binary log binary log
@@ -1430,7 +1443,6 @@ key-cache-block-size 1024 @@ -1451,7 +1461,6 @@
key-cache-division-limit 100 key-cache-division-limit 100
key-cache-file-hash-size 512 key-cache-file-hash-size 512
key-cache-segments 0 key-cache-segments 0
@ -76,7 +66,7 @@
lc-messages en_US lc-messages en_US
lc-messages-dir MYSQL_SHAREDIR/ lc-messages-dir MYSQL_SHAREDIR/
lc-time-names en_US lc-time-names en_US
@@ -1502,6 +1514,7 @@ myisam-sort-buffer-size 134216704 @@ -1523,6 +1532,7 @@
myisam-stats-method NULLS_UNEQUAL myisam-stats-method NULLS_UNEQUAL
myisam-use-mmap FALSE myisam-use-mmap FALSE
mysql56-temporal-format TRUE mysql56-temporal-format TRUE
@ -84,16 +74,7 @@
net-buffer-length 16384 net-buffer-length 16384
net-read-timeout 30 net-read-timeout 30
net-retry-count 10 net-retry-count 10
@@ -1612,6 +1625,8 @@ session-track-schema TRUE @@ -1660,6 +1670,7 @@
session-track-state-change FALSE
session-track-system-variables autocommit,character_set_client,character_set_connection,character_set_results,time_zone
session-track-transaction-info OFF
+shared-memory FALSE
+shared-memory-base-name MYSQL
show-slave-auth-info FALSE
silent-startup FALSE
skip-grant-tables TRUE
@@ -1638,6 +1653,7 @@ slave-transaction-retry-interval 0
slave-type-conversions slave-type-conversions
slow-launch-time 2 slow-launch-time 2
slow-query-log FALSE slow-query-log FALSE
@ -101,7 +82,7 @@
sort-buffer-size 2097152 sort-buffer-size 2097152
sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
stack-trace TRUE stack-trace TRUE
@@ -1652,9 +1668,9 @@ sync-relay-log 10000 @@ -1674,9 +1685,9 @@
sync-relay-log-info 10000 sync-relay-log-info 10000
sysdate-is-now FALSE sysdate-is-now FALSE
system-versioning-alter-history ERROR system-versioning-alter-history ERROR
@ -113,7 +94,7 @@
table-open-cache-instances 8 table-open-cache-instances 8
tc-heuristic-recover OFF tc-heuristic-recover OFF
tcp-keepalive-interval 0 tcp-keepalive-interval 0
@@ -1663,6 +1679,8 @@ tcp-keepalive-time 0 @@ -1686,6 +1697,8 @@
thread-cache-size 151 thread-cache-size 151
thread-pool-idle-timeout 60 thread-pool-idle-timeout 60
thread-pool-max-threads 65536 thread-pool-max-threads 65536

View File

@ -1 +0,0 @@
--skip-grant-tables --loose-shared-memory-base-name=HeyMrBaseNameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX$MTR_BUILD_THREAD --loose-shared-memory=1

File diff suppressed because it is too large Load Diff

View File

@ -1,47 +0,0 @@
# We currently only have shm support on windows, so in order
# to optimize things we skip this test on all other platforms
--source include/windows.inc
# thread pool causes different results
-- source include/not_threadpool.inc
# Only run this test if shared memory is avaliable
let $shm= query_get_value("SHOW VARIABLES LIKE 'shared_memory'", Value, 1);
if ($shm != ON){
skip No shm support;
}
let $shm_name= query_get_value("SHOW GLOBAL VARIABLES LIKE 'shared_memory_base_name'", Value, 1);
# Connect using SHM for testing
connect(shm_con,localhost,root,,,,$shm_name,SHM);
# Source select test case
-- source include/common-tests.inc
connection default;
disconnect shm_con;
#
# Bug #24924: shared-memory-base-name that is too long causes buffer overflow
#
--exec $MYSQLADMIN --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --shared-memory-base-name=HeyMrBaseNameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ping
#
# Bug #33899: Deadlock in mysql_real_query with shared memory connections
#
let $stmt= `SELECT REPEAT('a', 2048)`;
SET @max_allowed_packet= @@global.max_allowed_packet;
SET @net_buffer_length= @@global.net_buffer_length;
SET GLOBAL max_allowed_packet= 1024;
SET GLOBAL net_buffer_length= 1024;
--error 1
--exec echo SELECT '$stmt'| $MYSQL --protocol=memory --shared-memory-base-name=$shm_name 2>&1
SET GLOBAL max_allowed_packet= @max_allowed_packet;
SET GLOBAL net_buffer_length= @net_buffer_length;
--echo End of 5.0 tests.

View File

@ -1,21 +0,0 @@
select @@global.shared_memory_base_name;
@@global.shared_memory_base_name
MYSQL_TMP_DIR/mysqld.1.sock
select @@session.shared_memory_base_name;
ERROR HY000: Variable 'shared_memory_base_name' is a GLOBAL variable
show global variables like 'shared_memory_base_name';
Variable_name Value
shared_memory_base_name MYSQL_TMP_DIR/mysqld.1.sock
show session variables like 'shared_memory_base_name';
Variable_name Value
shared_memory_base_name MYSQL_TMP_DIR/mysqld.1.sock
select * from information_schema.global_variables where variable_name='shared_memory_base_name';
VARIABLE_NAME VARIABLE_VALUE
SHARED_MEMORY_BASE_NAME MYSQL_TMP_DIR/mysqld.1.sock
select * from information_schema.session_variables where variable_name='shared_memory_base_name';
VARIABLE_NAME VARIABLE_VALUE
SHARED_MEMORY_BASE_NAME MYSQL_TMP_DIR/mysqld.1.sock
set global shared_memory_base_name=1;
ERROR HY000: Variable 'shared_memory_base_name' is a read only variable
set session shared_memory_base_name=1;
ERROR HY000: Variable 'shared_memory_base_name' is a read only variable

View File

@ -1,21 +0,0 @@
select @@global.shared_memory;
@@global.shared_memory
0
select @@session.shared_memory;
ERROR HY000: Variable 'shared_memory' is a GLOBAL variable
show global variables like 'shared_memory';
Variable_name Value
shared_memory OFF
show session variables like 'shared_memory';
Variable_name Value
shared_memory OFF
select * from information_schema.global_variables where variable_name='shared_memory';
VARIABLE_NAME VARIABLE_VALUE
SHARED_MEMORY OFF
select * from information_schema.session_variables where variable_name='shared_memory';
VARIABLE_NAME VARIABLE_VALUE
SHARED_MEMORY OFF
set global shared_memory=1;
ERROR HY000: Variable 'shared_memory' is a read only variable
set session shared_memory=1;
ERROR HY000: Variable 'shared_memory' is a read only variable

View File

@ -1,25 +0,0 @@
--source include/windows.inc
--source include/not_embedded.inc
#
# only global
#
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
select @@global.shared_memory_base_name;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.shared_memory_base_name;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
show global variables like 'shared_memory_base_name';
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
show session variables like 'shared_memory_base_name';
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
select * from information_schema.global_variables where variable_name='shared_memory_base_name';
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
select * from information_schema.session_variables where variable_name='shared_memory_base_name';
#
# show that it's read-only
#
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set global shared_memory_base_name=1;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set session shared_memory_base_name=1;

View File

@ -1,20 +0,0 @@
--source include/windows.inc
--source include/not_embedded.inc
#
# only global
#
select @@global.shared_memory;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.shared_memory;
show global variables like 'shared_memory';
show session variables like 'shared_memory';
select * from information_schema.global_variables where variable_name='shared_memory';
select * from information_schema.session_variables where variable_name='shared_memory';
#
# show that it's read-only
#
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set global shared_memory=1;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set session shared_memory=1;

View File

@ -102,7 +102,7 @@ my_bool my_disable_copystat_in_redel=0;
/* Typelib by all clients */ /* Typelib by all clients */
const char *sql_protocol_names_lib[] = const char *sql_protocol_names_lib[] =
{ "TCP", "SOCKET", "PIPE", "MEMORY", NullS }; { "TCP", "SOCKET", "PIPE", NullS };
TYPELIB sql_protocol_typelib ={ array_elements(sql_protocol_names_lib) - 1, "", TYPELIB sql_protocol_typelib ={ array_elements(sql_protocol_names_lib) - 1, "",
sql_protocol_names_lib, NULL }; sql_protocol_names_lib, NULL };

View File

@ -121,10 +121,6 @@ char *mysql_unix_port= 0;
const char *unknown_sqlstate= "HY000"; const char *unknown_sqlstate= "HY000";
const char *not_error_sqlstate= "00000"; const char *not_error_sqlstate= "00000";
const char *cant_connect_sqlstate= "08001"; const char *cant_connect_sqlstate= "08001";
#ifdef HAVE_SMEM
char *shared_memory_base_name= 0;
const char *def_shared_memory_base_name= default_shared_memory_base_name;
#endif
static void mysql_close_free_options(MYSQL *mysql); static void mysql_close_free_options(MYSQL *mysql);
static void mysql_close_free(MYSQL *mysql); static void mysql_close_free(MYSQL *mysql);
@ -320,248 +316,6 @@ HANDLE create_named_pipe(MYSQL *mysql, uint connect_timeout, char **arg_host,
#endif #endif
/*
Create new shared memory connection, return handler of connection
SYNOPSIS
create_shared_memory()
mysql Pointer of mysql structure
net Pointer of net structure
connect_timeout Timeout of connection
*/
#ifdef HAVE_SMEM
HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
{
ulong smem_buffer_length = shared_memory_buffer_length + 4;
/*
event_connect_request is event object for start connection actions
event_connect_answer is event object for confirm, that server put data
handle_connect_file_map is file-mapping object, use for create shared
memory
handle_connect_map is pointer on shared memory
handle_map is pointer on shared memory for client
event_server_wrote,
event_server_read,
event_client_wrote,
event_client_read are events for transfer data between server and client
handle_file_map is file-mapping object, use for create shared memory
*/
HANDLE event_connect_request = NULL;
HANDLE event_connect_answer = NULL;
HANDLE handle_connect_file_map = NULL;
char *handle_connect_map = NULL;
char *handle_map = NULL;
HANDLE event_server_wrote = NULL;
HANDLE event_server_read = NULL;
HANDLE event_client_wrote = NULL;
HANDLE event_client_read = NULL;
HANDLE event_conn_closed = NULL;
HANDLE handle_file_map = NULL;
ulong connect_number;
char connect_number_char[22], *p;
char *tmp= NULL;
char *suffix_pos;
DWORD error_allow = 0;
DWORD error_code = 0;
DWORD event_access_rights= SYNCHRONIZE | EVENT_MODIFY_STATE;
char *shared_memory_base_name = mysql->options.shared_memory_base_name;
static const char *name_prefixes[] = {"","Global\\"};
const char *prefix;
uint i;
/*
If this is NULL, somebody freed the MYSQL* options. mysql_close()
is a good candidate. We don't just silently (re)set it to
def_shared_memory_base_name as that would create really confusing/buggy
behavior if the user passed in a different name on the command-line or
in a my.cnf.
*/
DBUG_ASSERT(shared_memory_base_name != NULL);
/*
get enough space base-name + '_' + longest suffix we might ever send
*/
if (!(tmp= (char *)my_malloc(strlen(shared_memory_base_name) + 32L, MYF(MY_FAE))))
goto err;
/*
The name of event and file-mapping events create agree next rule:
shared_memory_base_name+unique_part
Where:
shared_memory_base_name is unique value for each server
unique_part is uniquel value for each object (events and file-mapping)
*/
for (i = 0; i< array_elements(name_prefixes); i++)
{
prefix= name_prefixes[i];
suffix_pos = strxmov(tmp, prefix , shared_memory_base_name, "_", NullS);
strmov(suffix_pos, "CONNECT_REQUEST");
event_connect_request= OpenEvent(event_access_rights, FALSE, tmp);
if (event_connect_request)
{
break;
}
}
if (!event_connect_request)
{
error_allow = CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR;
goto err;
}
strmov(suffix_pos, "CONNECT_ANSWER");
if (!(event_connect_answer= OpenEvent(event_access_rights,FALSE,tmp)))
{
error_allow = CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR;
goto err;
}
strmov(suffix_pos, "CONNECT_DATA");
if (!(handle_connect_file_map= OpenFileMapping(FILE_MAP_WRITE,FALSE,tmp)))
{
error_allow = CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR;
goto err;
}
if (!(handle_connect_map= MapViewOfFile(handle_connect_file_map,
FILE_MAP_WRITE,0,0,sizeof(DWORD))))
{
error_allow = CR_SHARED_MEMORY_CONNECT_MAP_ERROR;
goto err;
}
/* Send to server request of connection */
if (!SetEvent(event_connect_request))
{
error_allow = CR_SHARED_MEMORY_CONNECT_SET_ERROR;
goto err;
}
/* Wait of answer from server */
if (WaitForSingleObject(event_connect_answer,connect_timeout*1000) !=
WAIT_OBJECT_0)
{
error_allow = CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR;
goto err;
}
/* Get number of connection */
connect_number = uint4korr(handle_connect_map);/*WAX2*/
p= int10_to_str(connect_number, connect_number_char, 10);
/*
The name of event and file-mapping events create agree next rule:
shared_memory_base_name+unique_part+number_of_connection
Where:
shared_memory_base_name is uniquel value for each server
unique_part is uniquel value for each object (events and file-mapping)
number_of_connection is number of connection between server and client
*/
suffix_pos = strxmov(tmp, prefix , shared_memory_base_name, "_", connect_number_char,
"_", NullS);
strmov(suffix_pos, "DATA");
if ((handle_file_map = OpenFileMapping(FILE_MAP_WRITE,FALSE,tmp)) == NULL)
{
error_allow = CR_SHARED_MEMORY_FILE_MAP_ERROR;
goto err2;
}
if ((handle_map = MapViewOfFile(handle_file_map,FILE_MAP_WRITE,0,0,
smem_buffer_length)) == NULL)
{
error_allow = CR_SHARED_MEMORY_MAP_ERROR;
goto err2;
}
strmov(suffix_pos, "SERVER_WROTE");
if ((event_server_wrote = OpenEvent(event_access_rights,FALSE,tmp)) == NULL)
{
error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
goto err2;
}
strmov(suffix_pos, "SERVER_READ");
if ((event_server_read = OpenEvent(event_access_rights,FALSE,tmp)) == NULL)
{
error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
goto err2;
}
strmov(suffix_pos, "CLIENT_WROTE");
if ((event_client_wrote = OpenEvent(event_access_rights,FALSE,tmp)) == NULL)
{
error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
goto err2;
}
strmov(suffix_pos, "CLIENT_READ");
if ((event_client_read = OpenEvent(event_access_rights,FALSE,tmp)) == NULL)
{
error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
goto err2;
}
strmov(suffix_pos, "CONNECTION_CLOSED");
if ((event_conn_closed = OpenEvent(event_access_rights,FALSE,tmp)) == NULL)
{
error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
goto err2;
}
/*
Set event that server should send data
*/
SetEvent(event_server_read);
err2:
if (error_allow == 0)
{
net->vio= vio_new_win32shared_memory(handle_file_map,handle_map,
event_server_wrote,
event_server_read,event_client_wrote,
event_client_read,event_conn_closed);
}
else
{
error_code = GetLastError();
if (event_server_read)
CloseHandle(event_server_read);
if (event_server_wrote)
CloseHandle(event_server_wrote);
if (event_client_read)
CloseHandle(event_client_read);
if (event_client_wrote)
CloseHandle(event_client_wrote);
if (event_conn_closed)
CloseHandle(event_conn_closed);
if (handle_map)
UnmapViewOfFile(handle_map);
if (handle_file_map)
CloseHandle(handle_file_map);
}
err:
my_free(tmp);
if (error_allow)
error_code = GetLastError();
if (event_connect_request)
CloseHandle(event_connect_request);
if (event_connect_answer)
CloseHandle(event_connect_answer);
if (handle_connect_map)
UnmapViewOfFile(handle_connect_map);
if (handle_connect_file_map)
CloseHandle(handle_connect_file_map);
if (error_allow)
{
if (error_allow == CR_SHARED_MEMORY_EVENT_ERROR)
set_mysql_extended_error(mysql, error_allow, unknown_sqlstate,
ER(error_allow), suffix_pos, error_code);
else
set_mysql_extended_error(mysql, error_allow, unknown_sqlstate,
ER(error_allow), error_code);
return(INVALID_HANDLE_VALUE);
}
return(handle_map);
}
#endif
/** /**
Read a packet from server. Give error message if socket was down Read a packet from server. Give error message if socket was down
or packet is an error message or packet is an error message
@ -981,7 +735,7 @@ static const char *default_options[]=
"ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath", "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath",
"character-sets-dir", "default-character-set", "interactive-timeout", "character-sets-dir", "default-character-set", "interactive-timeout",
"connect-timeout", "local-infile", "disable-local-infile", "connect-timeout", "local-infile", "disable-local-infile",
"ssl-cipher", "max-allowed-packet", "protocol", "shared-memory-base-name", "ssl-cipher", "max-allowed-packet", "protocol",
"multi-results", "multi-statements", "multi-queries", "secure-auth", "multi-results", "multi-statements", "multi-queries", "secure-auth",
"report-data-truncation", "plugin-dir", "default-auth", "report-data-truncation", "plugin-dir", "default-auth",
"bind-address", "ssl-crl", "ssl-crlpath", "bind-address", "ssl-crl", "ssl-crlpath",
@ -994,7 +748,7 @@ enum option_id {
OPT_ssl_key, OPT_ssl_cert, OPT_ssl_ca, OPT_ssl_capath, OPT_ssl_key, OPT_ssl_cert, OPT_ssl_ca, OPT_ssl_capath,
OPT_character_sets_dir, OPT_default_character_set, OPT_interactive_timeout, OPT_character_sets_dir, OPT_default_character_set, OPT_interactive_timeout,
OPT_connect_timeout, OPT_local_infile, OPT_disable_local_infile, OPT_connect_timeout, OPT_local_infile, OPT_disable_local_infile,
OPT_ssl_cipher, OPT_max_allowed_packet, OPT_protocol, OPT_shared_memory_base_name, OPT_ssl_cipher, OPT_max_allowed_packet, OPT_protocol,
OPT_multi_results, OPT_multi_statements, OPT_multi_queries, OPT_secure_auth, OPT_multi_results, OPT_multi_statements, OPT_multi_queries, OPT_secure_auth,
OPT_report_data_truncation, OPT_plugin_dir, OPT_default_auth, OPT_report_data_truncation, OPT_plugin_dir, OPT_default_auth,
OPT_bind_address, OPT_ssl_crl, OPT_ssl_crlpath, OPT_bind_address, OPT_ssl_crl, OPT_ssl_crlpath,
@ -1235,13 +989,6 @@ void mysql_read_default_options(struct st_mysql_options *options,
options->protocol= UINT_MAX32; options->protocol= UINT_MAX32;
} }
break; break;
case OPT_shared_memory_base_name:
#ifdef HAVE_SMEM
if (options->shared_memory_base_name != def_shared_memory_base_name)
my_free(options->shared_memory_base_name);
options->shared_memory_base_name=my_strdup(opt_arg,MYF(MY_WME));
#endif
break;
case OPT_multi_results: case OPT_multi_results:
options->client_flag|= CLIENT_MULTI_RESULTS; options->client_flag|= CLIENT_MULTI_RESULTS;
break; break;
@ -1632,10 +1379,6 @@ mysql_init(MYSQL *mysql)
mysql->options.client_flag|= CLIENT_LOCAL_FILES; mysql->options.client_flag|= CLIENT_LOCAL_FILES;
#endif #endif
#ifdef HAVE_SMEM
mysql->options.shared_memory_base_name= (char*) def_shared_memory_base_name;
#endif
mysql->options.methods_to_use= MYSQL_OPT_GUESS_CONNECTION; mysql->options.methods_to_use= MYSQL_OPT_GUESS_CONNECTION;
mysql->options.report_data_truncation= TRUE; /* default */ mysql->options.report_data_truncation= TRUE; /* default */
@ -2840,12 +2583,6 @@ void mpvio_info(Vio *vio, MYSQL_PLUGIN_VIO_INFO *info)
info->protocol= MYSQL_VIO_PIPE; info->protocol= MYSQL_VIO_PIPE;
info->handle= vio->hPipe; info->handle= vio->hPipe;
return; return;
case VIO_TYPE_SHARED_MEMORY:
info->protocol= MYSQL_VIO_MEMORY;
#ifdef HAVE_SMEM
info->handle= vio->handle_file_map; /* or what ? */
#endif
return;
#endif #endif
default: DBUG_ASSERT(0); default: DBUG_ASSERT(0);
} }
@ -3180,42 +2917,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* /*
Part 0: Grab a socket and connect it to the server Part 0: Grab a socket and connect it to the server
*/ */
#if defined(HAVE_SMEM)
if ((!mysql->options.protocol ||
mysql->options.protocol == MYSQL_PROTOCOL_MEMORY) &&
(!host || !strcmp(host,LOCAL_HOST)) &&
mysql->options.shared_memory_base_name)
{
DBUG_PRINT("info", ("Using shared memory"));
if ((create_shared_memory(mysql,net, mysql->options.connect_timeout)) ==
INVALID_HANDLE_VALUE)
{
DBUG_PRINT("error",
("host: '%s' socket: '%s' shared memory: %s have_tcpip: %d",
host ? host : "<null>",
unix_socket ? unix_socket : "<null>",
mysql->options.shared_memory_base_name,
(int) have_tcpip));
if (mysql->options.protocol == MYSQL_PROTOCOL_MEMORY)
goto error;
/*
Try also with PIPE or TCP/IP. Clear the error from
create_shared_memory().
*/
net_clear_error(net);
}
else
{
mysql->options.protocol=MYSQL_PROTOCOL_MEMORY;
unix_socket = 0;
host=mysql->options.shared_memory_base_name;
my_snprintf(host_info=buff, sizeof(buff)-1,
ER(CR_SHARED_MEMORY_CONNECTION), host);
}
}
#endif /* HAVE_SMEM */
#if defined(HAVE_SYS_UN_H) #if defined(HAVE_SYS_UN_H)
if (!net->vio && if (!net->vio &&
(!mysql->options.protocol || (!mysql->options.protocol ||
@ -3828,10 +3530,6 @@ static void mysql_close_free_options(MYSQL *mysql)
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
mysql_ssl_free(mysql); mysql_ssl_free(mysql);
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
#ifdef HAVE_SMEM
if (mysql->options.shared_memory_base_name != def_shared_memory_base_name)
my_free(mysql->options.shared_memory_base_name);
#endif /* HAVE_SMEM */
if (mysql->options.extension) if (mysql->options.extension)
{ {
struct mysql_async_context *ctxt= mysql->options.extension->async_context; struct mysql_async_context *ctxt= mysql->options.extension->async_context;
@ -4314,13 +4012,6 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
case MYSQL_OPT_PROTOCOL: case MYSQL_OPT_PROTOCOL:
mysql->options.protocol= *(uint*) arg; mysql->options.protocol= *(uint*) arg;
break; break;
case MYSQL_SHARED_MEMORY_BASE_NAME:
#ifdef HAVE_SMEM
if (mysql->options.shared_memory_base_name != def_shared_memory_base_name)
my_free(mysql->options.shared_memory_base_name);
mysql->options.shared_memory_base_name=my_strdup(arg,MYF(MY_WME));
#endif
break;
case MYSQL_OPT_USE_REMOTE_CONNECTION: case MYSQL_OPT_USE_REMOTE_CONNECTION:
case MYSQL_OPT_USE_EMBEDDED_CONNECTION: case MYSQL_OPT_USE_EMBEDDED_CONNECTION:
case MYSQL_OPT_GUESS_CONNECTION: case MYSQL_OPT_GUESS_CONNECTION:
@ -4458,8 +4149,8 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
} }
} }
break; break;
case MYSQL_SHARED_MEMORY_BASE_NAME:
default: default:
break;
DBUG_RETURN(1); DBUG_RETURN(1);
} }
DBUG_RETURN(0); DBUG_RETURN(0);

View File

@ -319,22 +319,15 @@ MY_TIMER_INFO sys_timer_info;
/* static variables */ /* static variables */
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
#if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY) #if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
static PSI_thread_key key_thread_handle_con_namedpipes; static PSI_thread_key key_thread_handle_con_namedpipes;
static PSI_cond_key key_COND_handler_count; static PSI_cond_key key_COND_handler_count;
#endif /* _WIN32 || HAVE_SMEM && !EMBEDDED_LIBRARY */
#if defined(HAVE_SMEM) && !defined(EMBEDDED_LIBRARY)
static PSI_thread_key key_thread_handle_con_sharedmem;
#endif /* HAVE_SMEM && !EMBEDDED_LIBRARY */
#if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY)
static PSI_thread_key key_thread_handle_con_sockets; static PSI_thread_key key_thread_handle_con_sockets;
#endif /* _WIN32 || HAVE_SMEM && !EMBEDDED_LIBRARY */ #endif /* _WIN32 |&& !EMBEDDED_LIBRARY */
#ifdef __WIN__ #ifdef _WIN32
static PSI_thread_key key_thread_handle_shutdown; static PSI_thread_key key_thread_handle_shutdown;
#endif /* __WIN__ */ #endif
#ifdef HAVE_OPENSSL10 #ifdef HAVE_OPENSSL10
static PSI_rwlock_key key_rwlock_openssl; static PSI_rwlock_key key_rwlock_openssl;
@ -1098,9 +1091,9 @@ PSI_cond_key key_COND_ack_receiver;
static PSI_cond_info all_server_conds[]= static PSI_cond_info all_server_conds[]=
{ {
#if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY) #if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
{ &key_COND_handler_count, "COND_handler_count", PSI_FLAG_GLOBAL}, { &key_COND_handler_count, "COND_handler_count", PSI_FLAG_GLOBAL},
#endif /* _WIN32 || HAVE_SMEM && !EMBEDDED_LIBRARY */ #endif /* _WIN32 && !EMBEDDED_LIBRARY */
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
{ &key_PAGE_cond, "PAGE::cond", 0}, { &key_PAGE_cond, "PAGE::cond", 0},
{ &key_COND_active, "TC_LOG_MMAP::COND_active", 0}, { &key_COND_active, "TC_LOG_MMAP::COND_active", 0},
@ -1161,21 +1154,11 @@ PSI_thread_key key_thread_ack_receiver;
static PSI_thread_info all_server_threads[]= static PSI_thread_info all_server_threads[]=
{ {
#if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY) #if (defined (_WIN32) && !defined (EMBEDDED_LIBRARY))
{ &key_thread_handle_con_namedpipes, "con_named_pipes", PSI_FLAG_GLOBAL}, { &key_thread_handle_con_namedpipes, "con_named_pipes", PSI_FLAG_GLOBAL},
#endif /* _WIN32 || HAVE_SMEM && !EMBEDDED_LIBRARY */
#if defined(HAVE_SMEM) && !defined(EMBEDDED_LIBRARY)
{ &key_thread_handle_con_sharedmem, "con_shared_mem", PSI_FLAG_GLOBAL},
#endif /* HAVE_SMEM && !EMBEDDED_LIBRARY */
#if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY)
{ &key_thread_handle_con_sockets, "con_sockets", PSI_FLAG_GLOBAL}, { &key_thread_handle_con_sockets, "con_sockets", PSI_FLAG_GLOBAL},
#endif /* _WIN32 || HAVE_SMEM && !EMBEDDED_LIBRARY */
#ifdef __WIN__
{ &key_thread_handle_shutdown, "shutdown", PSI_FLAG_GLOBAL}, { &key_thread_handle_shutdown, "shutdown", PSI_FLAG_GLOBAL},
#endif /* __WIN__ */ #endif
{ &key_thread_bootstrap, "bootstrap", PSI_FLAG_GLOBAL}, { &key_thread_bootstrap, "bootstrap", PSI_FLAG_GLOBAL},
{ &key_thread_delayed_insert, "delayed_insert", 0}, { &key_thread_delayed_insert, "delayed_insert", 0},
@ -1519,11 +1502,7 @@ int deny_severity = LOG_WARNING;
ulong query_cache_min_res_unit= QUERY_CACHE_MIN_RESULT_DATA_SIZE; ulong query_cache_min_res_unit= QUERY_CACHE_MIN_RESULT_DATA_SIZE;
Query_cache query_cache; Query_cache query_cache;
#endif #endif
#ifdef HAVE_SMEM
const char *shared_memory_base_name= default_shared_memory_base_name;
my_bool opt_enable_shared_memory;
HANDLE smem_event_connect_request= 0;
#endif
my_bool opt_use_ssl = 0; my_bool opt_use_ssl = 0;
char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL, char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL,
@ -1585,9 +1564,6 @@ static bool read_init_file(char *file_name);
#ifdef _WIN32 #ifdef _WIN32
pthread_handler_t handle_connections_namedpipes(void *arg); pthread_handler_t handle_connections_namedpipes(void *arg);
#endif #endif
#ifdef HAVE_SMEM
pthread_handler_t handle_connections_shared_memory(void *arg);
#endif
pthread_handler_t handle_slave(void *arg); pthread_handler_t handle_slave(void *arg);
static void clean_up(bool print_message); static void clean_up(bool print_message);
static int test_if_case_insensitive(const char *dir_name); static int test_if_case_insensitive(const char *dir_name);
@ -2011,21 +1987,6 @@ static void __cdecl kill_server(int sig_ptr)
else else
sql_print_error(ER_DEFAULT(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */ sql_print_error(ER_DEFAULT(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */
#ifdef HAVE_SMEM
/*
Send event to smem_event_connect_request for aborting
*/
if (opt_enable_shared_memory)
{
if (!SetEvent(smem_event_connect_request))
{
DBUG_PRINT("error",
("Got error: %ld from SetEvent of smem_event_connect_request",
GetLastError()));
}
}
#endif
/* Stop wsrep threads in case they are running. */ /* Stop wsrep threads in case they are running. */
if (wsrep_running_threads > 0) if (wsrep_running_threads > 0)
{ {
@ -5629,7 +5590,7 @@ static int init_server_components()
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
#ifdef _WIN32
static void create_shutdown_thread() static void create_shutdown_thread()
{ {
#ifdef __WIN__ #ifdef __WIN__
@ -5647,19 +5608,14 @@ static void create_shutdown_thread()
#endif /* __WIN__ */ #endif /* __WIN__ */
} }
#endif /* EMBEDDED_LIBRARY */
#if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY)
static void handle_connections_methods() static void handle_connections_methods()
{ {
pthread_t hThread; pthread_t hThread;
int error; int error;
DBUG_ENTER("handle_connections_methods"); DBUG_ENTER("handle_connections_methods");
if (hPipe == INVALID_HANDLE_VALUE && if (hPipe == INVALID_HANDLE_VALUE && opt_disable_networking)
(!have_tcpip || opt_disable_networking) &&
!opt_enable_shared_memory)
{ {
sql_print_error("TCP/IP, --shared-memory, or --named-pipe should be configured on NT OS"); sql_print_error("TCP/IP, or --named-pipe should be configured on Windows");
unireg_abort(1); // Will not return unireg_abort(1); // Will not return
} }
@ -5690,20 +5646,6 @@ static void handle_connections_methods()
handler_count--; handler_count--;
} }
} }
#ifdef HAVE_SMEM
if (opt_enable_shared_memory)
{
handler_count++;
if ((error= mysql_thread_create(key_thread_handle_con_sharedmem,
&hThread, &connection_attrib,
handle_connections_shared_memory, 0)))
{
sql_print_warning("Can't create thread to handle shared memory",
" (errno= %d)", error);
handler_count--;
}
}
#endif
while (handler_count > 0) while (handler_count > 0)
mysql_cond_wait(&COND_handler_count, &LOCK_start_thread); mysql_cond_wait(&COND_handler_count, &LOCK_start_thread);
@ -5719,10 +5661,11 @@ void decrement_handler_count()
mysql_mutex_unlock(&LOCK_start_thread); mysql_mutex_unlock(&LOCK_start_thread);
my_thread_end(); my_thread_end();
} }
#else #else /* WIN32*/
#define create_shutdown_thread()
#define decrement_handler_count() #define decrement_handler_count()
#endif /* defined(_WIN32) || defined(HAVE_SMEM) */ #endif
#endif /* EMBEDDED_LIBRARY */
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
@ -6194,11 +6137,11 @@ int mysqld_main(int argc, char **argv)
/* Memory used when everything is setup */ /* Memory used when everything is setup */
start_memory_used= global_status_var.global_memory_used; start_memory_used= global_status_var.global_memory_used;
#if defined(_WIN32) || defined(HAVE_SMEM) #ifdef _WIN32
handle_connections_methods(); handle_connections_methods();
#else #else
handle_connections_sockets(); handle_connections_sockets();
#endif /* _WIN32 || HAVE_SMEM */ #endif /* _WIN32 */
/* (void) pthread_attr_destroy(&connection_attrib); */ /* (void) pthread_attr_destroy(&connection_attrib); */
@ -7029,250 +6972,6 @@ pthread_handler_t handle_connections_namedpipes(void *arg)
} }
#endif /* _WIN32 */ #endif /* _WIN32 */
#ifdef HAVE_SMEM
/**
Thread of shared memory's service.
@param arg Arguments of thread
*/
pthread_handler_t handle_connections_shared_memory(void *arg)
{
/* file-mapping object, use for create shared memory */
HANDLE handle_connect_file_map= 0;
char *handle_connect_map= 0; // pointer on shared memory
HANDLE event_connect_answer= 0;
ulong smem_buffer_length= shared_memory_buffer_length + 4;
ulong connect_number= 1;
char *tmp= NULL;
char *suffix_pos;
char connect_number_char[22], *p;
const char *errmsg= 0;
SECURITY_ATTRIBUTES *sa_event= 0, *sa_mapping= 0;
my_thread_init();
DBUG_ENTER("handle_connections_shared_memorys");
DBUG_PRINT("general",("Waiting for allocated shared memory."));
/*
get enough space base-name + '_' + longest suffix we might ever send
*/
if (!(tmp= (char *)my_malloc(strlen(shared_memory_base_name) + 32L,
MYF(MY_FAE))))
goto error;
if (my_security_attr_create(&sa_event, &errmsg,
GENERIC_ALL, SYNCHRONIZE | EVENT_MODIFY_STATE))
goto error;
if (my_security_attr_create(&sa_mapping, &errmsg,
GENERIC_ALL, FILE_MAP_READ | FILE_MAP_WRITE))
goto error;
/*
The name of event and file-mapping events create agree next rule:
shared_memory_base_name+unique_part
Where:
shared_memory_base_name is unique value for each server
unique_part is unique value for each object (events and file-mapping)
*/
suffix_pos= strxmov(tmp,shared_memory_base_name,"_",NullS);
strmov(suffix_pos, "CONNECT_REQUEST");
if ((smem_event_connect_request= CreateEvent(sa_event,
FALSE, FALSE, tmp)) == 0)
{
errmsg= "Could not create request event";
goto error;
}
strmov(suffix_pos, "CONNECT_ANSWER");
if ((event_connect_answer= CreateEvent(sa_event, FALSE, FALSE, tmp)) == 0)
{
errmsg="Could not create answer event";
goto error;
}
strmov(suffix_pos, "CONNECT_DATA");
if ((handle_connect_file_map=
CreateFileMapping(INVALID_HANDLE_VALUE, sa_mapping,
PAGE_READWRITE, 0, sizeof(connect_number), tmp)) == 0)
{
errmsg= "Could not create file mapping";
goto error;
}
if ((handle_connect_map= (char *)MapViewOfFile(handle_connect_file_map,
FILE_MAP_WRITE,0,0,
sizeof(DWORD))) == 0)
{
errmsg= "Could not create shared memory service";
goto error;
}
while (!abort_loop)
{
/* Wait a request from client */
WaitForSingleObject(smem_event_connect_request,INFINITE);
/*
it can be after shutdown command
*/
if (abort_loop)
goto error;
HANDLE handle_client_file_map= 0;
char *handle_client_map= 0;
HANDLE event_client_wrote= 0;
HANDLE event_client_read= 0; // for transfer data server <-> client
HANDLE event_server_wrote= 0;
HANDLE event_server_read= 0;
HANDLE event_conn_closed= 0;
CONNECT *connect= 0;
p= int10_to_str(connect_number, connect_number_char, 10);
/*
The name of event and file-mapping events create agree next rule:
shared_memory_base_name+unique_part+number_of_connection
Where:
shared_memory_base_name is uniquel value for each server
unique_part is unique value for each object (events and file-mapping)
number_of_connection is connection-number between server and client
*/
suffix_pos= strxmov(tmp,shared_memory_base_name,"_",connect_number_char,
"_",NullS);
strmov(suffix_pos, "DATA");
if ((handle_client_file_map=
CreateFileMapping(INVALID_HANDLE_VALUE, sa_mapping,
PAGE_READWRITE, 0, smem_buffer_length, tmp)) == 0)
{
errmsg= "Could not create file mapping";
goto errorconn;
}
if ((handle_client_map= (char*)MapViewOfFile(handle_client_file_map,
FILE_MAP_WRITE,0,0,
smem_buffer_length)) == 0)
{
errmsg= "Could not create memory map";
goto errorconn;
}
strmov(suffix_pos, "CLIENT_WROTE");
if ((event_client_wrote= CreateEvent(sa_event, FALSE, FALSE, tmp)) == 0)
{
errmsg= "Could not create client write event";
goto errorconn;
}
strmov(suffix_pos, "CLIENT_READ");
if ((event_client_read= CreateEvent(sa_event, FALSE, FALSE, tmp)) == 0)
{
errmsg= "Could not create client read event";
goto errorconn;
}
strmov(suffix_pos, "SERVER_READ");
if ((event_server_read= CreateEvent(sa_event, FALSE, FALSE, tmp)) == 0)
{
errmsg= "Could not create server read event";
goto errorconn;
}
strmov(suffix_pos, "SERVER_WROTE");
if ((event_server_wrote= CreateEvent(sa_event,
FALSE, FALSE, tmp)) == 0)
{
errmsg= "Could not create server write event";
goto errorconn;
}
strmov(suffix_pos, "CONNECTION_CLOSED");
if ((event_conn_closed= CreateEvent(sa_event,
TRUE, FALSE, tmp)) == 0)
{
errmsg= "Could not create closed connection event";
goto errorconn;
}
if (abort_loop)
goto errorconn;
if (!(connect= new CONNECT))
{
errmsg= "Could not create CONNECT object";
goto errorconn;
}
/* Send number of connection to client */
int4store(handle_connect_map, connect_number);
if (!SetEvent(event_connect_answer))
{
errmsg= "Could not send answer event";
goto errorconn;
}
/* Set event that client should receive data */
if (!SetEvent(event_client_read))
{
errmsg= "Could not set client to read mode";
goto errorconn;
}
if (!(connect->vio= vio_new_win32shared_memory(handle_client_file_map,
handle_client_map,
event_client_wrote,
event_client_read,
event_server_wrote,
event_server_read,
event_conn_closed)))
{
errmsg= "Could not create VIO object";
goto errorconn;
}
connect->host= my_localhost; /* Host is unknown */
create_new_thread(connect);
connect_number++;
continue;
errorconn:
/* Could not form connection; Free used handlers/memort and retry */
if (errmsg)
{
char buff[180];
strxmov(buff, "Can't create shared memory connection: ", errmsg, ".",
NullS);
sql_perror(buff);
}
if (handle_client_file_map)
CloseHandle(handle_client_file_map);
if (handle_client_map)
UnmapViewOfFile(handle_client_map);
if (event_server_wrote)
CloseHandle(event_server_wrote);
if (event_server_read)
CloseHandle(event_server_read);
if (event_client_wrote)
CloseHandle(event_client_wrote);
if (event_client_read)
CloseHandle(event_client_read);
if (event_conn_closed)
CloseHandle(event_conn_closed);
delete connect;
statistic_increment(aborted_connects,&LOCK_status);
statistic_increment(connection_errors_internal, &LOCK_status);
}
/* End shared memory handling */
error:
if (tmp)
my_free(tmp);
if (errmsg)
{
char buff[180];
strxmov(buff, "Can't create shared memory service: ", errmsg, ".", NullS);
sql_perror(buff);
}
my_security_attr_free(sa_event);
my_security_attr_free(sa_mapping);
if (handle_connect_map) UnmapViewOfFile(handle_connect_map);
if (handle_connect_file_map) CloseHandle(handle_connect_file_map);
if (event_connect_answer) CloseHandle(event_connect_answer);
if (smem_event_connect_request) CloseHandle(smem_event_connect_request);
DBUG_LEAVE;
decrement_handler_count();
return 0;
}
#endif /* HAVE_SMEM */
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
@ -9076,9 +8775,6 @@ static int mysql_init_variables(void)
ssl_acceptor_fd= 0; ssl_acceptor_fd= 0;
#endif /* ! EMBEDDED_LIBRARY */ #endif /* ! EMBEDDED_LIBRARY */
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
#ifdef HAVE_SMEM
shared_memory_base_name= default_shared_memory_base_name;
#endif
#if defined(__WIN__) #if defined(__WIN__)
/* Allow Win32 users to move MySQL anywhere */ /* Allow Win32 users to move MySQL anywhere */

View File

@ -2711,17 +2711,6 @@ static Sys_var_ulong Sys_query_prealloc_size(
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_thd_mem_root)); ON_UPDATE(fix_thd_mem_root));
#ifdef HAVE_SMEM
static Sys_var_mybool Sys_shared_memory(
"shared_memory", "Enable the shared memory",
READ_ONLY GLOBAL_VAR(opt_enable_shared_memory), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
static Sys_var_charptr Sys_shared_memory_base_name(
"shared_memory_base_name", "Base name of shared memory",
READ_ONLY GLOBAL_VAR(shared_memory_base_name), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(0));
#endif
// this has to be NO_CMD_LINE as the command-line option has a different name // this has to be NO_CMD_LINE as the command-line option has a different name
static Sys_var_mybool Sys_skip_external_locking( static Sys_var_mybool Sys_skip_external_locking(

View File

@ -75,7 +75,6 @@ static bool skip_completion_port_on_success = false;
io_completion_callback - handle client request io_completion_callback - handle client request
timer_callback - handle wait timeout (kill connection) timer_callback - handle wait timeout (kill connection)
shm_read_callback, shm_close_callback - shared memory stuff
login_callback - user login (submitted as threadpool work) login_callback - user login (submitted as threadpool work)
*/ */
@ -89,9 +88,6 @@ static void CALLBACK io_completion_callback(PTP_CALLBACK_INSTANCE instance,
static void CALLBACK work_callback(PTP_CALLBACK_INSTANCE instance, PVOID context, PTP_WORK work); static void CALLBACK work_callback(PTP_CALLBACK_INSTANCE instance, PVOID context, PTP_WORK work);
static void CALLBACK shm_read_callback(PTP_CALLBACK_INSTANCE instance,
PVOID Context, PTP_WAIT wait,TP_WAIT_RESULT wait_result);
static void pre_callback(PVOID context, PTP_CALLBACK_INSTANCE instance); static void pre_callback(PVOID context, PTP_CALLBACK_INSTANCE instance);
/* Get current time as Windows time */ /* Get current time as Windows time */
@ -120,7 +116,6 @@ public:
PTP_CALLBACK_INSTANCE callback_instance; PTP_CALLBACK_INSTANCE callback_instance;
PTP_IO io; PTP_IO io;
PTP_TIMER timer; PTP_TIMER timer;
PTP_WAIT shm_read;
PTP_WORK work; PTP_WORK work;
bool long_callback; bool long_callback;
@ -149,7 +144,6 @@ TP_connection_win::TP_connection_win(CONNECT *c) :
callback_instance(0), callback_instance(0),
io(0), io(0),
timer(0), timer(0),
shm_read(0),
work(0) work(0)
{ {
} }
@ -170,30 +164,20 @@ int TP_connection_win::init()
case VIO_TYPE_NAMEDPIPE: case VIO_TYPE_NAMEDPIPE:
handle= (HANDLE)vio->hPipe; handle= (HANDLE)vio->hPipe;
break; break;
case VIO_TYPE_SHARED_MEMORY:
handle= vio->event_server_wrote;
break;
default: default:
abort(); abort();
} }
if (vio_type == VIO_TYPE_SHARED_MEMORY)
{
CHECK_ALLOC_ERROR(shm_read= CreateThreadpoolWait(shm_read_callback, this, &callback_environ));
}
else
{
/* Performance tweaks (s. MSDN documentation)*/
UCHAR flags= FILE_SKIP_SET_EVENT_ON_HANDLE;
if (skip_completion_port_on_success)
{
flags |= FILE_SKIP_COMPLETION_PORT_ON_SUCCESS;
}
(void)SetFileCompletionNotificationModes(handle, flags);
/* Assign io completion callback */
CHECK_ALLOC_ERROR(io= CreateThreadpoolIo(handle, io_completion_callback, this, &callback_environ));
}
/* Performance tweaks (s. MSDN documentation)*/
UCHAR flags= FILE_SKIP_SET_EVENT_ON_HANDLE;
if (skip_completion_port_on_success)
{
flags |= FILE_SKIP_COMPLETION_PORT_ON_SUCCESS;
}
(void)SetFileCompletionNotificationModes(handle, flags);
/* Assign io completion callback */
CHECK_ALLOC_ERROR(io= CreateThreadpoolIo(handle, io_completion_callback, this, &callback_environ));
CHECK_ALLOC_ERROR(timer= CreateThreadpoolTimer(timer_callback, this, &callback_environ)); CHECK_ALLOC_ERROR(timer= CreateThreadpoolTimer(timer_callback, this, &callback_environ));
CHECK_ALLOC_ERROR(work= CreateThreadpoolWork(work_callback, this, &callback_environ)); CHECK_ALLOC_ERROR(work= CreateThreadpoolWork(work_callback, this, &callback_environ));
return 0; return 0;
@ -214,11 +198,6 @@ int TP_connection_win::start_io()
DWORD last_error= 0; DWORD last_error= 0;
int retval; int retval;
if (shm_read)
{
SetThreadpoolWait(shm_read, handle, NULL);
return 0;
}
StartThreadpoolIo(io); StartThreadpoolIo(io);
if (vio_type == VIO_TYPE_TCPIP || vio_type == VIO_TYPE_SSL) if (vio_type == VIO_TYPE_TCPIP || vio_type == VIO_TYPE_SSL)
@ -297,9 +276,6 @@ TP_connection_win::~TP_connection_win()
if (io) if (io)
CloseThreadpoolIo(io); CloseThreadpoolIo(io);
if (shm_read)
CloseThreadpoolWait(shm_read);
if (work) if (work)
CloseThreadpoolWork(work); CloseThreadpoolWork(work);
@ -420,29 +396,6 @@ static VOID CALLBACK timer_callback(PTP_CALLBACK_INSTANCE instance,
} }
} }
/*
Shared memory read callback.
Invoked when read event is set on connection.
*/
static void CALLBACK shm_read_callback(PTP_CALLBACK_INSTANCE instance,
PVOID context, PTP_WAIT wait,TP_WAIT_RESULT wait_result)
{
TP_connection_win *c= (TP_connection_win *)context;
/* Disarm wait. */
SetThreadpoolWait(wait, NULL, NULL);
/*
This is an autoreset event, and one wakeup is eaten already by threadpool,
and the current state is "not set". Thus we need to reset the event again,
or vio_read will hang.
*/
SetEvent(c->handle);
tp_callback(instance, context);
}
static void CALLBACK work_callback(PTP_CALLBACK_INSTANCE instance, PVOID context, PTP_WORK work) static void CALLBACK work_callback(PTP_CALLBACK_INSTANCE instance, PVOID context, PTP_WORK work)
{ {
tp_callback(instance, context); tp_callback(instance, context);

View File

@ -50,9 +50,6 @@ static char *opt_user= 0;
static char *opt_password= 0; static char *opt_password= 0;
static char *opt_host= 0; static char *opt_host= 0;
static char *opt_unix_socket= 0; static char *opt_unix_socket= 0;
#ifdef HAVE_SMEM
static char *shared_memory_base_name= 0;
#endif
static unsigned int opt_port; static unsigned int opt_port;
static my_bool tty_password= 0, opt_silent= 0; static my_bool tty_password= 0, opt_silent= 0;
@ -253,10 +250,6 @@ static void print_st_error(MYSQL_STMT *stmt, const char *msg)
static MYSQL *mysql_client_init(MYSQL* con) static MYSQL *mysql_client_init(MYSQL* con)
{ {
MYSQL* res = mysql_init(con); MYSQL* res = mysql_init(con);
#ifdef HAVE_SMEM
if (res && shared_memory_base_name)
mysql_options(res, MYSQL_SHARED_MEMORY_BASE_NAME, shared_memory_base_name);
#endif
if (res && non_blocking_api_enabled) if (res && non_blocking_api_enabled)
mysql_options(res, MYSQL_OPT_NONBLOCK, 0); mysql_options(res, MYSQL_OPT_NONBLOCK, 0);
if (opt_plugin_dir && *opt_plugin_dir) if (opt_plugin_dir && *opt_plugin_dir)
@ -1229,11 +1222,6 @@ static struct my_option client_test_long_options[] =
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Be more silent", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, {"silent", 's', "Be more silent", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0,
0}, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", 'm', "Base name of shared memory.",
&shared_memory_base_name, (uchar**)&shared_memory_base_name, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"socket", 'S', "Socket file to use for connection", {"socket", 'S', "Socket file to use for connection",
&opt_unix_socket, &opt_unix_socket, 0, GET_STR, &opt_unix_socket, &opt_unix_socket, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

View File

@ -17,6 +17,6 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${SSL_INCLUDE_DIRS}) ${SSL_INCLUDE_DIRS})
ADD_DEFINITIONS(${SSL_DEFINES}) ADD_DEFINITIONS(${SSL_DEFINES})
SET(VIO_SOURCES vio.c viosocket.c viossl.c viopipe.c vioshm.c viosslfactories.c) SET(VIO_SOURCES vio.c viosocket.c viossl.c viopipe.c viosslfactories.c)
ADD_CONVENIENCE_LIBRARY(vio ${VIO_SOURCES}) ADD_CONVENIENCE_LIBRARY(vio ${VIO_SOURCES})
TARGET_LINK_LIBRARIES(vio ${LIBSOCKET}) TARGET_LINK_LIBRARIES(vio ${LIBSOCKET})

View File

@ -54,18 +54,6 @@ static my_bool has_no_data(Vio *vio __attribute__((unused)))
} }
#ifdef _WIN32 #ifdef _WIN32
my_bool vio_shared_memory_has_data(Vio *vio)
{
return (vio->shared_memory_remain > 0);
}
int vio_shared_memory_shutdown(Vio *vio, int how)
{
SetEvent(vio->event_conn_closed);
SetEvent(vio->event_server_wrote);
return 0;
}
int vio_pipe_shutdown(Vio *vio, int how) int vio_pipe_shutdown(Vio *vio, int how)
{ {
return CancelIoEx(vio->hPipe, NULL); return CancelIoEx(vio->hPipe, NULL);
@ -116,28 +104,7 @@ static void vio_init(Vio *vio, enum enum_vio_type type,
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
#endif #endif
#ifdef HAVE_SMEM
if (type == VIO_TYPE_SHARED_MEMORY)
{
vio->viodelete =vio_delete;
vio->vioerrno =vio_errno;
vio->read =vio_read_shared_memory;
vio->write =vio_write_shared_memory;
vio->fastsend =vio_fastsend;
vio->viokeepalive =vio_keepalive;
vio->should_retry =vio_should_retry;
vio->was_timeout =vio_was_timeout;
vio->vioclose =vio_close_shared_memory;
vio->peer_addr =vio_peer_addr;
vio->vioblocking =vio_blocking;
vio->is_blocking =vio_is_blocking;
vio->io_wait =no_io_wait;
vio->is_connected =vio_is_connected_shared_memory;
vio->has_data =vio_shared_memory_has_data;
vio->shutdown =vio_shared_memory_shutdown;
DBUG_VOID_RETURN;
}
#endif
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
if (type == VIO_TYPE_SSL) if (type == VIO_TYPE_SSL)
{ {
@ -296,31 +263,7 @@ Vio *vio_new_win32pipe(HANDLE hPipe)
DBUG_RETURN(vio); DBUG_RETURN(vio);
} }
#ifdef HAVE_SMEM
Vio *vio_new_win32shared_memory(HANDLE handle_file_map, HANDLE handle_map,
HANDLE event_server_wrote, HANDLE event_server_read,
HANDLE event_client_wrote, HANDLE event_client_read,
HANDLE event_conn_closed)
{
Vio *vio;
DBUG_ENTER("vio_new_win32shared_memory");
if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME))))
{
vio_init(vio, VIO_TYPE_SHARED_MEMORY, 0, VIO_LOCALHOST);
vio->desc= "shared memory";
vio->handle_file_map= handle_file_map;
vio->handle_map= handle_map;
vio->event_server_wrote= event_server_wrote;
vio->event_server_read= event_server_read;
vio->event_client_wrote= event_client_wrote;
vio->event_client_read= event_client_read;
vio->event_conn_closed= event_conn_closed;
vio->shared_memory_remain= 0;
vio->shared_memory_pos= handle_map;
}
DBUG_RETURN(vio);
}
#endif
#endif #endif

View File

@ -35,14 +35,6 @@ int cancel_io(HANDLE handle, DWORD thread_id);
int vio_shutdown_pipe(Vio *vio,int how); int vio_shutdown_pipe(Vio *vio,int how);
#endif #endif
#ifdef HAVE_SMEM
size_t vio_read_shared_memory(Vio *vio, uchar * buf, size_t size);
size_t vio_write_shared_memory(Vio *vio, const uchar * buf, size_t size);
my_bool vio_is_connected_shared_memory(Vio *vio);
int vio_close_shared_memory(Vio * vio);
my_bool vio_shared_memory_has_data(Vio *vio);
int vio_shutdown_shared_memory(Vio *vio, int how);
#endif
int vio_socket_shutdown(Vio *vio, int how); int vio_socket_shutdown(Vio *vio, int how);
my_bool vio_buff_has_data(Vio *vio); my_bool vio_buff_has_data(Vio *vio);

View File

@ -1,217 +0,0 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
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
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "vio_priv.h"
#if defined(_WIN32) && defined(HAVE_SMEM)
size_t vio_read_shared_memory(Vio *vio, uchar *buf, size_t size)
{
size_t length;
size_t remain_local;
char *current_position;
HANDLE events[2];
DWORD timeout;
DBUG_ENTER("vio_read_shared_memory");
remain_local= size;
current_position= buf;
timeout= vio->read_timeout >= 0 ? vio->read_timeout : INFINITE;
events[0]= vio->event_server_wrote;
events[1]= vio->event_conn_closed;
do
{
if (vio->shared_memory_remain == 0)
{
DWORD wait_status;
wait_status= WaitForMultipleObjects(array_elements(events), events,
FALSE, timeout);
/*
WaitForMultipleObjects can return next values:
WAIT_OBJECT_0+0 - event from vio->event_server_wrote
WAIT_OBJECT_0+1 - event from vio->event_conn_closed.
We can't read anything
WAIT_ABANDONED_0 and WAIT_TIMEOUT - fail. We can't read anything
*/
if (wait_status != WAIT_OBJECT_0)
{
/*
If wait_status is WAIT_TIMEOUT, set error code to indicate a
timeout error. If vio->event_conn_closed was set, use an EOF
condition (return value of zero) to indicate that the operation
has been aborted.
*/
if (wait_status == WAIT_TIMEOUT)
SetLastError(SOCKET_ETIMEDOUT);
else if (wait_status == (WAIT_OBJECT_0 + 1))
DBUG_RETURN(0);
DBUG_RETURN(-1);
}
vio->shared_memory_pos= vio->handle_map;
vio->shared_memory_remain= uint4korr((ulong*)vio->shared_memory_pos);
vio->shared_memory_pos+= 4;
}
length= size;
if (vio->shared_memory_remain < length)
length= vio->shared_memory_remain;
if (length > remain_local)
length= remain_local;
memcpy(current_position, vio->shared_memory_pos, length);
vio->shared_memory_remain-= length;
vio->shared_memory_pos+= length;
current_position+= length;
remain_local-= length;
if (!vio->shared_memory_remain)
{
if (!SetEvent(vio->event_client_read))
DBUG_RETURN(-1);
}
} while (remain_local);
length= size;
DBUG_RETURN(length);
}
size_t vio_write_shared_memory(Vio *vio, const uchar *buf, size_t size)
{
size_t length, remain, sz;
HANDLE pos;
const uchar *current_position;
HANDLE events[2];
DWORD timeout;
DBUG_ENTER("vio_write_shared_memory");
remain= size;
current_position= buf;
timeout= vio->write_timeout >= 0 ? vio->write_timeout : INFINITE;
events[0]= vio->event_server_read;
events[1]= vio->event_conn_closed;
while (remain != 0)
{
DWORD wait_status;
wait_status= WaitForMultipleObjects(array_elements(events), events,
FALSE, timeout);
if (wait_status != WAIT_OBJECT_0)
{
/* Set error code to indicate a timeout error or disconnect. */
if (wait_status == WAIT_TIMEOUT)
SetLastError(SOCKET_ETIMEDOUT);
else
SetLastError(ERROR_GRACEFUL_DISCONNECT);
DBUG_RETURN((size_t) -1);
}
sz= (remain > shared_memory_buffer_length ? shared_memory_buffer_length :
remain);
int4store(vio->handle_map, sz);
pos= vio->handle_map + 4;
memcpy(pos, current_position, sz);
remain-= sz;
current_position+= sz;
if (!SetEvent(vio->event_client_wrote))
DBUG_RETURN((size_t) -1);
}
length= size;
DBUG_RETURN(length);
}
my_bool vio_is_connected_shared_memory(Vio *vio)
{
return (WaitForSingleObject(vio->event_conn_closed, 0) != WAIT_OBJECT_0);
}
/**
Close shared memory and DBUG_PRINT any errors that happen on closing.
@return Zero if all closing functions succeed, and nonzero otherwise.
*/
int vio_close_shared_memory(Vio * vio)
{
int error_count= 0;
DBUG_ENTER("vio_close_shared_memory");
if (vio->type != VIO_CLOSED)
{
/*
Set event_conn_closed for notification of both client and server that
connection is closed
*/
SetEvent(vio->event_conn_closed);
/*
Close all handlers. UnmapViewOfFile and CloseHandle return non-zero
result if they are success.
*/
if (UnmapViewOfFile(vio->handle_map) == 0)
{
error_count++;
DBUG_PRINT("vio_error", ("UnmapViewOfFile() failed"));
}
if (CloseHandle(vio->event_server_wrote) == 0)
{
error_count++;
DBUG_PRINT("vio_error", ("CloseHandle(vio->esw) failed"));
}
if (CloseHandle(vio->event_server_read) == 0)
{
error_count++;
DBUG_PRINT("vio_error", ("CloseHandle(vio->esr) failed"));
}
if (CloseHandle(vio->event_client_wrote) == 0)
{
error_count++;
DBUG_PRINT("vio_error", ("CloseHandle(vio->ecw) failed"));
}
if (CloseHandle(vio->event_client_read) == 0)
{
error_count++;
DBUG_PRINT("vio_error", ("CloseHandle(vio->ecr) failed"));
}
if (CloseHandle(vio->handle_file_map) == 0)
{
error_count++;
DBUG_PRINT("vio_error", ("CloseHandle(vio->hfm) failed"));
}
if (CloseHandle(vio->event_conn_closed) == 0)
{
error_count++;
DBUG_PRINT("vio_error", ("CloseHandle(vio->ecc) failed"));
}
}
vio->type= VIO_CLOSED;
vio->mysql_socket= MYSQL_INVALID_SOCKET;
DBUG_RETURN(error_count);
}
#endif /* #if defined(_WIN32) && defined(HAVE_SMEM) */

View File

@ -74,8 +74,7 @@ int vio_errno(Vio *vio __attribute__((unused)))
{ {
/* These transport types are not Winsock based. */ /* These transport types are not Winsock based. */
#ifdef _WIN32 #ifdef _WIN32
if (vio->type == VIO_TYPE_NAMEDPIPE || if (vio->type == VIO_TYPE_NAMEDPIPE)
vio->type == VIO_TYPE_SHARED_MEMORY)
return GetLastError(); return GetLastError();
#endif #endif
@ -363,7 +362,7 @@ int vio_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode)
r= set_blocking_mode ? 0 : 1; r= set_blocking_mode ? 0 : 1;
#endif /* !defined(NO_FCNTL_NONBLOCK) */ #endif /* !defined(NO_FCNTL_NONBLOCK) */
#else /* !defined(__WIN__) */ #else /* !defined(__WIN__) */
if (vio->type != VIO_TYPE_NAMEDPIPE && vio->type != VIO_TYPE_SHARED_MEMORY) if (vio->type != VIO_TYPE_NAMEDPIPE)
{ {
ulong arg; ulong arg;
int old_fcntl=vio->fcntl_mode; int old_fcntl=vio->fcntl_mode;
@ -442,8 +441,7 @@ int vio_nodelay(Vio *vio, my_bool on)
int no_delay= MY_TEST(on); int no_delay= MY_TEST(on);
DBUG_ENTER("vio_nodelay"); DBUG_ENTER("vio_nodelay");
if (vio->type == VIO_TYPE_NAMEDPIPE || vio->type == VIO_TYPE_SHARED_MEMORY if (vio->type == VIO_TYPE_NAMEDPIPE || vio->type == VIO_TYPE_SOCKET)
|| vio->type == VIO_TYPE_SOCKET)
{ {
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -468,7 +466,7 @@ int vio_fastsend(Vio * vio)
int r=0; int r=0;
DBUG_ENTER("vio_fastsend"); DBUG_ENTER("vio_fastsend");
if (vio->type == VIO_TYPE_NAMEDPIPE ||vio->type == VIO_TYPE_SHARED_MEMORY) if (vio->type == VIO_TYPE_NAMEDPIPE)
{ {
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -502,7 +500,7 @@ int vio_keepalive(Vio* vio, my_bool set_keep_alive)
(int)mysql_socket_getfd(vio->mysql_socket), (int)mysql_socket_getfd(vio->mysql_socket),
(int)set_keep_alive)); (int)set_keep_alive));
if (vio->type != VIO_TYPE_NAMEDPIPE && vio->type != VIO_TYPE_SHARED_MEMORY) if (vio->type != VIO_TYPE_NAMEDPIPE)
{ {
if (set_keep_alive) if (set_keep_alive)
opt = 1; opt = 1;
@ -521,7 +519,7 @@ int vio_set_keepalive_options(Vio* vio, const struct vio_keepalive_opts *opts)
struct tcp_keepalive s; struct tcp_keepalive s;
DWORD nbytes; DWORD nbytes;
if (vio->type == VIO_TYPE_NAMEDPIPE || vio->type == VIO_TYPE_SHARED_MEMORY) if (vio->type == VIO_TYPE_NAMEDPIPE)
return 0; return 0;
if (!opts->idle && !opts->interval) if (!opts->idle && !opts->interval)