summaryrefslogtreecommitdiff
path: root/client/mysqlslap.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/mysqlslap.c')
-rw-r--r--client/mysqlslap.c65
1 files changed, 12 insertions, 53 deletions
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index 4ca69c9ed0a..54301576ba9 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -172,8 +172,6 @@ File csv_file;
static uint opt_protocol= 0;
-static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
-
static int get_options(int *argc,char ***argv);
static uint opt_mysql_port= 0;
@@ -335,13 +333,6 @@ int main(int argc, char **argv)
exit(1);
}
- /* Command line options override configured protocol */
- if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
- && protocol_to_force != opt_protocol)
- {
- warn_protocol_override(host, &opt_protocol, protocol_to_force);
- }
-
sf_leaking_memory=0; /* from now on we cleanup properly */
/* Seed the random number generator if we will be using it. */
@@ -737,9 +728,6 @@ static my_bool
get_one_option(const struct my_option *opt, const char *argument,
const char *filename)
{
- /* Track when protocol is set via CLI to not force overrides */
- static my_bool ignore_protocol_override = FALSE;
-
DBUG_ENTER("get_one_option");
switch(opt->id) {
case 'v':
@@ -769,13 +757,6 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'W':
#ifdef _WIN32
opt_protocol= MYSQL_PROTOCOL_PIPE;
-
- /* Prioritize pipe if explicit via command line */
- if (filename[0] == '\0')
- {
- ignore_protocol_override = TRUE;
- protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
- }
#endif
break;
case OPT_MYSQL_PROTOCOL:
@@ -785,45 +766,19 @@ get_one_option(const struct my_option *opt, const char *argument,
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
-
- /* Specification of protocol via CLI trumps implicit overrides */
- if (filename[0] == '\0')
- {
- ignore_protocol_override = TRUE;
- protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
- }
-
break;
case 'P':
- /* If port and socket are set, fall back to default behavior */
- if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
- {
- ignore_protocol_override = TRUE;
- protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
- }
-
- /* If port is set via CLI, try to force protocol to TCP */
- if (filename[0] == '\0' &&
- !ignore_protocol_override &&
- protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
+ if (filename[0] == '\0')
{
- protocol_to_force = MYSQL_PROTOCOL_TCP;
+ /* Port given on command line, switch protocol to use TCP */
+ opt_protocol= MYSQL_PROTOCOL_TCP;
}
break;
case 'S':
- /* If port and socket are set, fall back to default behavior */
- if (protocol_to_force == MYSQL_PROTOCOL_TCP)
- {
- ignore_protocol_override = TRUE;
- protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
- }
-
- /* Prioritize socket if set via command line */
- if (filename[0] == '\0' &&
- !ignore_protocol_override &&
- protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
+ if (filename[0] == '\0')
{
- protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
+ /* Socket given on command line, switch protocol to use SOCKETSt */
+ opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
break;
case '#':
@@ -1828,6 +1783,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
uint x;
struct timeval start_time, end_time;
thread_context con;
+ int error;
pthread_t mainthread; /* Thread descriptor */
pthread_attr_t attr; /* Thread attributes */
DBUG_ENTER("run_scheduler");
@@ -1836,8 +1792,11 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
con.limit= limit;
pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr,
- PTHREAD_CREATE_DETACHED);
+ if ((error= pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)))
+ {
+ printf("Got error: %d from pthread_attr_setdetachstate\n", error);
+ exit(1);
+ }
pthread_mutex_lock(&counter_mutex);
thread_counter= 0;