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
8ac1d067
Commit
8ac1d067
authored
Jan 29, 2007
by
brian@zim.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1-arch
into zim.(none):/home/brian/mysql/archive-newformat-5.1
parents
bf7efc3c
9fc89fac
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
21 deletions
+69
-21
client/client_priv.h
client/client_priv.h
+2
-0
client/mysqlslap.c
client/mysqlslap.c
+65
-21
mysql-test/r/mysqlslap.result
mysql-test/r/mysqlslap.result
+2
-0
No files found.
client/client_priv.h
View file @
8ac1d067
...
@@ -56,6 +56,8 @@ enum options_client
...
@@ -56,6 +56,8 @@ enum options_client
OPT_MYSQL_PRESERVE_SCHEMA
,
OPT_MYSQL_PRESERVE_SCHEMA
,
OPT_IGNORE_TABLE
,
OPT_INSERT_IGNORE
,
OPT_SHOW_WARNINGS
,
OPT_DROP_DATABASE
,
OPT_IGNORE_TABLE
,
OPT_INSERT_IGNORE
,
OPT_SHOW_WARNINGS
,
OPT_DROP_DATABASE
,
OPT_TZ_UTC
,
OPT_AUTO_CLOSE
,
OPT_CREATE_SLAP_SCHEMA
,
OPT_TZ_UTC
,
OPT_AUTO_CLOSE
,
OPT_CREATE_SLAP_SCHEMA
,
OPT_SLAP_CSV
,
OPT_SLAP_CREATE_STRING
,
OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE
,
OPT_SLAP_AUTO_GENERATE_WRITE_NUM
,
OPT_MYSQL_REPLACE_INTO
,
OPT_BASE64_OUTPUT
,
OPT_SERVER_ID
,
OPT_MYSQL_REPLACE_INTO
,
OPT_BASE64_OUTPUT
,
OPT_SERVER_ID
,
OPT_FIX_TABLE_NAMES
,
OPT_FIX_DB_NAMES
,
OPT_SSL_VERIFY_SERVER_CERT
,
OPT_FIX_TABLE_NAMES
,
OPT_FIX_DB_NAMES
,
OPT_SSL_VERIFY_SERVER_CERT
,
OPT_DEBUG_INFO
,
OPT_COLUMN_TYPES
OPT_DEBUG_INFO
,
OPT_COLUMN_TYPES
...
...
client/mysqlslap.c
View file @
8ac1d067
...
@@ -128,6 +128,7 @@ static my_bool opt_slave;
...
@@ -128,6 +128,7 @@ static my_bool opt_slave;
static
my_bool
opt_compress
=
FALSE
,
tty_password
=
FALSE
,
static
my_bool
opt_compress
=
FALSE
,
tty_password
=
FALSE
,
opt_silent
=
FALSE
,
opt_silent
=
FALSE
,
auto_generate_sql
=
FALSE
;
auto_generate_sql
=
FALSE
;
const
char
*
auto_generate_sql_type
=
"mixed"
;
static
unsigned
long
connect_flags
=
CLIENT_MULTI_RESULTS
;
static
unsigned
long
connect_flags
=
CLIENT_MULTI_RESULTS
;
...
@@ -136,6 +137,7 @@ static int iterations;
...
@@ -136,6 +137,7 @@ static int iterations;
static
char
*
default_charset
=
(
char
*
)
MYSQL_DEFAULT_CHARSET_NAME
;
static
char
*
default_charset
=
(
char
*
)
MYSQL_DEFAULT_CHARSET_NAME
;
static
ulonglong
actual_queries
=
0
;
static
ulonglong
actual_queries
=
0
;
static
ulonglong
num_of_query
;
static
ulonglong
num_of_query
;
static
ulonglong
auto_generate_sql_number
;
const
char
*
concurrency_str
=
NULL
;
const
char
*
concurrency_str
=
NULL
;
static
char
*
create_string
;
static
char
*
create_string
;
uint
*
concurrency
;
uint
*
concurrency
;
...
@@ -395,19 +397,27 @@ static struct my_option my_long_options[] =
...
@@ -395,19 +397,27 @@ static struct my_option my_long_options[] =
"Generate SQL where not supplied by file or command line."
,
"Generate SQL where not supplied by file or command line."
,
(
gptr
*
)
&
auto_generate_sql
,
(
gptr
*
)
&
auto_generate_sql
,
(
gptr
*
)
&
auto_generate_sql
,
(
gptr
*
)
&
auto_generate_sql
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"auto-generate-sql-load-type"
,
OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE
,
"Load types are mixed, write, or read. Default is mixed
\n
"
,
(
gptr
*
)
&
auto_generate_sql_type
,
(
gptr
*
)
&
auto_generate_sql_type
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"auto-generate-sql-write_number"
,
OPT_SLAP_AUTO_GENERATE_WRITE_NUM
,
"Number of rows to insert to used in read and write loads (default is 100).
\n
"
,
(
gptr
*
)
&
auto_generate_sql_number
,
(
gptr
*
)
&
auto_generate_sql_number
,
0
,
GET_ULL
,
REQUIRED_ARG
,
100
,
0
,
0
,
0
,
0
,
0
},
{
"compress"
,
'C'
,
"Use compression in server/client protocol."
,
{
"compress"
,
'C'
,
"Use compression in server/client protocol."
,
(
gptr
*
)
&
opt_compress
,
(
gptr
*
)
&
opt_compress
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
(
gptr
*
)
&
opt_compress
,
(
gptr
*
)
&
opt_compress
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
0
,
0
},
{
"concurrency"
,
'c'
,
"Number of clients to simulate for query to run."
,
{
"concurrency"
,
'c'
,
"Number of clients to simulate for query to run."
,
(
gptr
*
)
&
concurrency_str
,
(
gptr
*
)
&
concurrency_str
,
0
,
GET_STR
,
(
gptr
*
)
&
concurrency_str
,
(
gptr
*
)
&
concurrency_str
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"create"
,
OPT_
CREATE_SLAP_SCHEMA
,
"File or string to use create tables."
,
{
"create"
,
OPT_
SLAP_CREATE_STRING
,
"File or string to use create tables."
,
(
gptr
*
)
&
create_string
,
(
gptr
*
)
&
create_string
,
0
,
GET_STR
,
REQUIRED_ARG
,
(
gptr
*
)
&
create_string
,
(
gptr
*
)
&
create_string
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
0
,
0
,
0
,
0
,
0
},
{
"create-schema"
,
OPT_CREATE_SLAP_SCHEMA
,
"Schema to run tests in."
,
{
"create-schema"
,
OPT_CREATE_SLAP_SCHEMA
,
"Schema to run tests in."
,
(
gptr
*
)
&
create_schema_string
,
(
gptr
*
)
&
create_schema_string
,
0
,
GET_STR
,
(
gptr
*
)
&
create_schema_string
,
(
gptr
*
)
&
create_schema_string
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"csv"
,
OPT_
CREATE_SLAP_SCHEMA
,
{
"csv"
,
OPT_
SLAP_CSV
,
"Generate CSV output to named file or to stdout if no file is named."
,
"Generate CSV output to named file or to stdout if no file is named."
,
(
gptr
*
)
&
opt_csv_str
,
(
gptr
*
)
&
opt_csv_str
,
0
,
GET_STR
,
(
gptr
*
)
&
opt_csv_str
,
(
gptr
*
)
&
opt_csv_str
,
0
,
GET_STR
,
OPT_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
OPT_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
...
@@ -591,7 +601,6 @@ get_random_string(char *buf)
...
@@ -591,7 +601,6 @@ get_random_string(char *buf)
DBUG_ENTER
(
"get_random_string"
);
DBUG_ENTER
(
"get_random_string"
);
for
(
x
=
RAND_STRING_SIZE
;
x
>
0
;
x
--
)
for
(
x
=
RAND_STRING_SIZE
;
x
>
0
;
x
--
)
*
buf_ptr
++=
ALPHANUMERICS
[
random
()
%
ALPHANUMERICS_SIZE
];
*
buf_ptr
++=
ALPHANUMERICS
[
random
()
%
ALPHANUMERICS_SIZE
];
DBUG_PRINT
(
"info"
,
(
"random string: '%*s'"
,
(
int
)
(
buf_ptr
-
buf
),
buf
));
DBUG_RETURN
(
buf_ptr
-
buf
);
DBUG_RETURN
(
buf_ptr
-
buf
);
}
}
...
@@ -638,7 +647,6 @@ build_table_string(void)
...
@@ -638,7 +647,6 @@ build_table_string(void)
ptr
->
string
=
(
char
*
)
my_malloc
(
table_string
.
length
+
1
,
MYF
(
MY_WME
));
ptr
->
string
=
(
char
*
)
my_malloc
(
table_string
.
length
+
1
,
MYF
(
MY_WME
));
ptr
->
length
=
table_string
.
length
+
1
;
ptr
->
length
=
table_string
.
length
+
1
;
strmov
(
ptr
->
string
,
table_string
.
str
);
strmov
(
ptr
->
string
,
table_string
.
str
);
DBUG_PRINT
(
"info"
,
(
"create_string %s"
,
ptr
->
string
));
dynstr_free
(
&
table_string
);
dynstr_free
(
&
table_string
);
DBUG_RETURN
(
ptr
);
DBUG_RETURN
(
ptr
);
}
}
...
@@ -686,7 +694,6 @@ build_insert_string(void)
...
@@ -686,7 +694,6 @@ build_insert_string(void)
ptr
->
string
=
(
char
*
)
my_malloc
(
insert_string
.
length
+
1
,
MYF
(
MY_WME
));
ptr
->
string
=
(
char
*
)
my_malloc
(
insert_string
.
length
+
1
,
MYF
(
MY_WME
));
ptr
->
length
=
insert_string
.
length
+
1
;
ptr
->
length
=
insert_string
.
length
+
1
;
strmov
(
ptr
->
string
,
insert_string
.
str
);
strmov
(
ptr
->
string
,
insert_string
.
str
);
DBUG_PRINT
(
"info"
,
(
"generated_insert_data %s"
,
ptr
->
string
));
dynstr_free
(
&
insert_string
);
dynstr_free
(
&
insert_string
);
DBUG_RETURN
(
ptr
);
DBUG_RETURN
(
ptr
);
}
}
...
@@ -733,7 +740,6 @@ build_query_string(void)
...
@@ -733,7 +740,6 @@ build_query_string(void)
ptr
->
string
=
(
char
*
)
my_malloc
(
query_string
.
length
+
1
,
MYF
(
MY_WME
));
ptr
->
string
=
(
char
*
)
my_malloc
(
query_string
.
length
+
1
,
MYF
(
MY_WME
));
ptr
->
length
=
query_string
.
length
+
1
;
ptr
->
length
=
query_string
.
length
+
1
;
strmov
(
ptr
->
string
,
query_string
.
str
);
strmov
(
ptr
->
string
,
query_string
.
str
);
DBUG_PRINT
(
"info"
,
(
"user_supplied_query %s"
,
ptr
->
string
));
dynstr_free
(
&
query_string
);
dynstr_free
(
&
query_string
);
DBUG_RETURN
(
ptr
);
DBUG_RETURN
(
ptr
);
}
}
...
@@ -799,19 +805,62 @@ get_options(int *argc,char ***argv)
...
@@ -799,19 +805,62 @@ get_options(int *argc,char ***argv)
if
(
auto_generate_sql
)
if
(
auto_generate_sql
)
{
{
unsigned
long
long
x
=
0
;
statement
*
ptr_statement
;
create_statements
=
build_table_string
();
create_statements
=
build_table_string
();
if
(
auto_generate_sql_type
[
0
]
==
'r'
)
{
for
(
ptr_statement
=
create_statements
,
x
=
0
;
x
<
auto_generate_sql_number
;
x
++
,
ptr_statement
=
ptr_statement
->
next
)
{
ptr_statement
->
next
=
build_insert_string
();
}
query_statements
=
build_query_string
();
}
else
if
(
auto_generate_sql_type
[
0
]
==
'w'
)
{
/*
We generate a number of strings in case the engine is
Archive (since strings which were identical one after another
would be too easily optimized).
*/
query_statements
=
build_insert_string
();
query_statements
=
build_insert_string
();
DBUG_PRINT
(
"info"
,
(
"auto-generated insert is %s"
,
query_statements
->
string
));
for
(
ptr_statement
=
query_statements
,
x
=
0
;
query_statements
->
next
=
build_query_string
();
x
<
auto_generate_sql_number
;
DBUG_PRINT
(
"info"
,
(
"auto-generated is %s"
,
query_statements
->
next
->
string
));
x
++
,
ptr_statement
=
ptr_statement
->
next
)
if
(
verbose
>=
1
)
{
{
fprintf
(
stderr
,
"auto-generated insert is:
\n
"
);
ptr_statement
->
next
=
build_insert_string
();
fprintf
(
stderr
,
"%s
\n
"
,
query_statements
->
string
);
}
fprintf
(
stderr
,
"auto-generated is:
\n
"
);
fprintf
(
stderr
,
"%s
\n
"
,
query_statements
->
next
->
string
);
}
}
else
/* Mixed mode is default */
{
int
coin
=
0
;
query_statements
=
build_insert_string
();
/*
This logic should be extended to do a more mixed load,
at the moment it results in "every other".
*/
for
(
ptr_statement
=
query_statements
,
x
=
0
;
x
<
4
;
x
++
,
ptr_statement
=
ptr_statement
->
next
)
{
if
(
coin
)
{
ptr_statement
->
next
=
build_insert_string
();
coin
=
0
;
}
else
{
ptr_statement
->
next
=
build_query_string
();
coin
=
1
;
}
}
}
}
}
else
else
{
{
...
@@ -905,7 +954,6 @@ create_schema(MYSQL *mysql, const char *db, statement *stmt,
...
@@ -905,7 +954,6 @@ create_schema(MYSQL *mysql, const char *db, statement *stmt,
DBUG_ENTER
(
"create_schema"
);
DBUG_ENTER
(
"create_schema"
);
len
=
snprintf
(
query
,
HUGE_STRING_LENGTH
,
"CREATE SCHEMA `%s`"
,
db
);
len
=
snprintf
(
query
,
HUGE_STRING_LENGTH
,
"CREATE SCHEMA `%s`"
,
db
);
DBUG_PRINT
(
"info"
,
(
"query %s"
,
query
));
if
(
run_query
(
mysql
,
query
,
len
))
if
(
run_query
(
mysql
,
query
,
len
))
{
{
...
@@ -1190,7 +1238,7 @@ limit_not_met:
...
@@ -1190,7 +1238,7 @@ limit_not_met:
goto
end
;
goto
end
;
}
}
if
(
!
con
->
stmt
&&
con
->
limit
&&
queries
<
con
->
limit
)
if
(
con
->
limit
&&
queries
<
con
->
limit
)
goto
limit_not_met
;
goto
limit_not_met
;
end:
end:
...
@@ -1220,8 +1268,6 @@ parse_delimiter(const char *script, statement **stmt, char delm)
...
@@ -1220,8 +1268,6 @@ parse_delimiter(const char *script, statement **stmt, char delm)
uint
length
=
strlen
(
script
);
uint
length
=
strlen
(
script
);
uint
count
=
0
;
/* We know that there is always one */
uint
count
=
0
;
/* We know that there is always one */
DBUG_PRINT
(
"info"
,
(
"Parsing %s
\n
"
,
script
));
for
(
tmp
=
*
sptr
=
(
statement
*
)
my_malloc
(
sizeof
(
statement
),
MYF
(
MY_ZEROFILL
));
for
(
tmp
=
*
sptr
=
(
statement
*
)
my_malloc
(
sizeof
(
statement
),
MYF
(
MY_ZEROFILL
));
(
retstr
=
strchr
(
ptr
,
delm
));
(
retstr
=
strchr
(
ptr
,
delm
));
tmp
->
next
=
(
statement
*
)
my_malloc
(
sizeof
(
statement
),
MYF
(
MY_ZEROFILL
)),
tmp
->
next
=
(
statement
*
)
my_malloc
(
sizeof
(
statement
),
MYF
(
MY_ZEROFILL
)),
...
@@ -1230,7 +1276,6 @@ parse_delimiter(const char *script, statement **stmt, char delm)
...
@@ -1230,7 +1276,6 @@ parse_delimiter(const char *script, statement **stmt, char delm)
count
++
;
count
++
;
tmp
->
string
=
my_strndup
(
ptr
,
(
size_t
)(
retstr
-
ptr
),
MYF
(
MY_FAE
));
tmp
->
string
=
my_strndup
(
ptr
,
(
size_t
)(
retstr
-
ptr
),
MYF
(
MY_FAE
));
tmp
->
length
=
(
size_t
)(
retstr
-
ptr
);
tmp
->
length
=
(
size_t
)(
retstr
-
ptr
);
DBUG_PRINT
(
"info"
,
(
" Creating : %.*s
\n
"
,
(
uint
)
tmp
->
length
,
tmp
->
string
));
ptr
+=
retstr
-
ptr
+
1
;
ptr
+=
retstr
-
ptr
+
1
;
if
(
isspace
(
*
ptr
))
if
(
isspace
(
*
ptr
))
ptr
++
;
ptr
++
;
...
@@ -1242,7 +1287,6 @@ parse_delimiter(const char *script, statement **stmt, char delm)
...
@@ -1242,7 +1287,6 @@ parse_delimiter(const char *script, statement **stmt, char delm)
tmp
->
string
=
my_strndup
(
ptr
,
(
size_t
)((
script
+
length
)
-
ptr
),
tmp
->
string
=
my_strndup
(
ptr
,
(
size_t
)((
script
+
length
)
-
ptr
),
MYF
(
MY_FAE
));
MYF
(
MY_FAE
));
tmp
->
length
=
(
size_t
)((
script
+
length
)
-
ptr
);
tmp
->
length
=
(
size_t
)((
script
+
length
)
-
ptr
);
DBUG_PRINT
(
"info"
,
(
" Creating : %.*s
\n
"
,
(
uint
)
tmp
->
length
,
tmp
->
string
));
count
++
;
count
++
;
}
}
...
...
mysql-test/r/mysqlslap.result
View file @
8ac1d067
...
@@ -129,6 +129,7 @@ INSERT INTO t1 VALUES (1, 'This is a test');
...
@@ -129,6 +129,7 @@ INSERT INTO t1 VALUES (1, 'This is a test');
insert into t2 values ('test', 'test2');
insert into t2 values ('test', 'test2');
select * from t1;
select * from t1;
select * from t2;
select * from t2;
select * from t1;
DROP SCHEMA IF EXISTS `mysqlslap`;
DROP SCHEMA IF EXISTS `mysqlslap`;
DROP SCHEMA IF EXISTS `mysqlslap`;
DROP SCHEMA IF EXISTS `mysqlslap`;
CREATE SCHEMA `mysqlslap`;
CREATE SCHEMA `mysqlslap`;
...
@@ -140,4 +141,5 @@ INSERT INTO t1 VALUES (1, 'This is a test');
...
@@ -140,4 +141,5 @@ INSERT INTO t1 VALUES (1, 'This is a test');
insert into t2 values ('test', 'test2');
insert into t2 values ('test', 'test2');
select * from t1;
select * from t1;
select * from t2;
select * from t2;
select * from t1;
DROP SCHEMA IF EXISTS `mysqlslap`;
DROP SCHEMA IF EXISTS `mysqlslap`;
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