Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
824c6d1c
Commit
824c6d1c
authored
Sep 18, 2009
by
Hakan Kuecuekyilmaz
Browse files
Options
Browse Files
Download
Plain Diff
Merge.
parents
6e0da275
6cf15d08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
27 deletions
+57
-27
client/mysqlslap.c
client/mysqlslap.c
+57
-27
No files found.
client/mysqlslap.c
View file @
824c6d1c
...
...
@@ -448,7 +448,16 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
/* First we create */
if
(
create_statements
)
{
/*
If we have an --engine option, then we indicate
create_schema() to add the engine type to the DDL.
*/
if
(
eptr
)
create_statements
->
type
=
CREATE_TABLE_TYPE
;
create_schema
(
mysql
,
create_schema_string
,
create_statements
,
eptr
);
}
/*
If we generated GUID we need to build a list of them from creation that
...
...
@@ -588,7 +597,9 @@ static struct my_option my_long_options[] =
"Detach (close and reopen) connections after X number of requests."
,
(
uchar
**
)
&
detach_rate
,
(
uchar
**
)
&
detach_rate
,
0
,
GET_UINT
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"engine"
,
'e'
,
"Storage engine to use for creating the table."
,
{
"engine"
,
'e'
,
"Comma separated list of storage engines to use for creating the table."
"The test is run for each engine. You can also specify an option for an engine"
"after a `:', like memory:max_row=2300"
,
(
uchar
**
)
&
default_engine
,
(
uchar
**
)
&
default_engine
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"host"
,
'h'
,
"Connect to host."
,
(
uchar
**
)
&
host
,
(
uchar
**
)
&
host
,
0
,
GET_STR
,
...
...
@@ -958,6 +969,7 @@ build_update_string(void)
ptr
->
type
=
UPDATE_TYPE_REQUIRES_PREFIX
;
else
ptr
->
type
=
UPDATE_TYPE
;
strmov
(
ptr
->
string
,
update_string
.
str
);
dynstr_free
(
&
update_string
);
DBUG_RETURN
(
ptr
);
...
...
@@ -973,8 +985,8 @@ build_update_string(void)
static
statement
*
build_insert_string
(
void
)
{
char
buf
[
HUGE_STRING_LENGTH
];
unsigned
int
col_count
;
char
buf
[
HUGE_STRING_LENGTH
];
unsigned
int
col_count
;
statement
*
ptr
;
DYNAMIC_STRING
insert_string
;
DBUG_ENTER
(
"build_insert_string"
);
...
...
@@ -1064,8 +1076,8 @@ build_insert_string(void)
static
statement
*
build_select_string
(
my_bool
key
)
{
char
buf
[
HUGE_STRING_LENGTH
];
unsigned
int
col_count
;
char
buf
[
HUGE_STRING_LENGTH
];
unsigned
int
col_count
;
statement
*
ptr
;
static
DYNAMIC_STRING
query_string
;
DBUG_ENTER
(
"build_select_string"
);
...
...
@@ -1117,6 +1129,7 @@ build_select_string(my_bool key)
ptr
->
type
=
SELECT_TYPE_REQUIRES_PREFIX
;
else
ptr
->
type
=
SELECT_TYPE
;
strmov
(
ptr
->
string
,
query_string
.
str
);
dynstr_free
(
&
query_string
);
DBUG_RETURN
(
ptr
);
...
...
@@ -1175,8 +1188,6 @@ get_options(int *argc,char ***argv)
exit
(
1
);
}
if
(
auto_generate_sql
&&
num_of_query
&&
auto_actual_queries
)
{
fprintf
(
stderr
,
...
...
@@ -1217,6 +1228,7 @@ get_options(int *argc,char ***argv)
num_int_cols
=
atoi
(
str
->
string
);
if
(
str
->
option
)
num_int_cols_index
=
atoi
(
str
->
option
);
option_cleanup
(
str
);
}
...
...
@@ -1229,6 +1241,7 @@ get_options(int *argc,char ***argv)
num_char_cols_index
=
atoi
(
str
->
option
);
else
num_char_cols_index
=
0
;
option_cleanup
(
str
);
}
...
...
@@ -1463,6 +1476,7 @@ get_options(int *argc,char ***argv)
if
(
tty_password
)
opt_password
=
get_tty_password
(
NullS
);
DBUG_RETURN
(
0
);
}
...
...
@@ -1477,6 +1491,7 @@ static int run_query(MYSQL *mysql, const char *query, int len)
if
(
verbose
>=
3
)
printf
(
"%.*s;
\n
"
,
len
,
query
);
return
mysql_real_query
(
mysql
,
query
,
len
);
}
...
...
@@ -1592,18 +1607,6 @@ create_schema(MYSQL *mysql, const char *db, statement *stmt,
}
}
if
(
engine_stmt
)
{
len
=
snprintf
(
query
,
HUGE_STRING_LENGTH
,
"set storage_engine=`%s`"
,
engine_stmt
->
string
);
if
(
run_query
(
mysql
,
query
,
len
))
{
fprintf
(
stderr
,
"%s: Cannot set default engine: %s
\n
"
,
my_progname
,
mysql_error
(
mysql
));
exit
(
1
);
}
}
count
=
0
;
after_create
=
stmt
;
...
...
@@ -1617,8 +1620,21 @@ limit_not_met:
{
char
buffer
[
HUGE_STRING_LENGTH
];
snprintf
(
buffer
,
HUGE_STRING_LENGTH
,
"%s %s"
,
ptr
->
string
,
engine_stmt
->
option
);
snprintf
(
buffer
,
HUGE_STRING_LENGTH
,
"%s Engine = %s %s"
,
ptr
->
string
,
engine_stmt
->
string
,
engine_stmt
->
option
);
if
(
run_query
(
mysql
,
buffer
,
strlen
(
buffer
)))
{
fprintf
(
stderr
,
"%s: Cannot run query %.*s ERROR : %s
\n
"
,
my_progname
,
(
uint
)
ptr
->
length
,
ptr
->
string
,
mysql_error
(
mysql
));
exit
(
1
);
}
}
else
if
(
engine_stmt
&&
engine_stmt
->
string
&&
ptr
->
type
==
CREATE_TABLE_TYPE
)
{
char
buffer
[
HUGE_STRING_LENGTH
];
snprintf
(
buffer
,
HUGE_STRING_LENGTH
,
"%s Engine = %s"
,
ptr
->
string
,
engine_stmt
->
string
);
if
(
run_query
(
mysql
,
buffer
,
strlen
(
buffer
)))
{
fprintf
(
stderr
,
"%s: Cannot run query %.*s ERROR : %s
\n
"
,
...
...
@@ -1652,6 +1668,7 @@ drop_schema(MYSQL *mysql, const char *db)
{
char
query
[
HUGE_STRING_LENGTH
];
int
len
;
DBUG_ENTER
(
"drop_schema"
);
len
=
snprintf
(
query
,
HUGE_STRING_LENGTH
,
"DROP SCHEMA IF EXISTS `%s`"
,
db
);
...
...
@@ -1940,17 +1957,27 @@ parse_option(const char *origin, option_string **stmt, char delm)
uint
count
=
0
;
/* We know that there is always one */
for
(
tmp
=
*
sptr
=
(
option_string
*
)
my_malloc
(
sizeof
(
option_string
),
MYF
(
MY_ZEROFILL
|
MY_FAE
|
MY_WME
));
MYF
(
MY_ZEROFILL
|
MY_FAE
|
MY_WME
));
(
retstr
=
strchr
(
ptr
,
delm
));
tmp
->
next
=
(
option_string
*
)
my_malloc
(
sizeof
(
option_string
),
MYF
(
MY_ZEROFILL
|
MY_FAE
|
MY_WME
)),
MYF
(
MY_ZEROFILL
|
MY_FAE
|
MY_WME
)),
tmp
=
tmp
->
next
)
{
char
buffer
[
HUGE_STRING_LENGTH
];
/*
Initialize buffer, because otherwise an
--engine=<storage_engine>:<option>,<eng1>,<eng2>
will crash.
*/
char
buffer
[
HUGE_STRING_LENGTH
]
=
""
;
char
*
buffer_ptr
;
count
++
;
strncpy
(
buffer
,
ptr
,
(
size_t
)(
retstr
-
ptr
));
/*
Handle --engine=memory:max_row=200 cases, or more general speaking
--engine=<storage_engine>:<options>, which will be translated to
Engine = storage_engine option.
*/
if
((
buffer_ptr
=
strchr
(
buffer
,
':'
)))
{
char
*
option_ptr
;
...
...
@@ -1971,13 +1998,15 @@ parse_option(const char *origin, option_string **stmt, char delm)
tmp
->
length
=
(
size_t
)(
retstr
-
ptr
);
}
/* Skip delimiter delm */
ptr
+=
retstr
-
ptr
+
1
;
if
(
isspace
(
*
ptr
))
ptr
++
;
count
++
;
}
if
(
ptr
!=
origin
+
length
)
if
(
ptr
!=
origin
+
length
)
{
char
*
origin_ptr
;
...
...
@@ -1986,7 +2015,7 @@ parse_option(const char *origin, option_string **stmt, char delm)
char
*
option_ptr
;
tmp
->
length
=
(
size_t
)(
origin_ptr
-
ptr
);
tmp
->
string
=
my_strndup
(
origin
,
tmp
->
length
,
MYF
(
MY_FAE
));
tmp
->
string
=
my_strndup
(
ptr
,
tmp
->
length
,
MYF
(
MY_FAE
));
option_ptr
=
(
char
*
)
ptr
+
1
+
tmp
->
length
;
...
...
@@ -2036,7 +2065,7 @@ parse_delimiter(const char *script, statement **stmt, char delm)
if
(
ptr
!=
script
+
length
)
{
tmp
->
string
=
my_strndup
(
ptr
,
(
uint
)((
script
+
length
)
-
ptr
),
MYF
(
MY_FAE
));
MYF
(
MY_FAE
));
tmp
->
length
=
(
size_t
)((
script
+
length
)
-
ptr
);
count
++
;
}
...
...
@@ -2094,6 +2123,7 @@ print_conclusions_csv(conclusions *con)
{
char
buffer
[
HUGE_STRING_LENGTH
];
const
char
*
ptr
=
auto_generate_sql_type
?
auto_generate_sql_type
:
"query"
;
snprintf
(
buffer
,
HUGE_STRING_LENGTH
,
"%s,%s,%ld.%03ld,%ld.%03ld,%ld.%03ld,%d,%llu
\n
"
,
con
->
engine
?
con
->
engine
:
""
,
/* Storage engine we ran against */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment