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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
bc2dc83c
Commit
bc2dc83c
authored
Dec 01, 2020
by
Anel Husakovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-22485: add the test case
Closes PR #1649
parent
47c4caf1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
152 additions
and
0 deletions
+152
-0
mysql-test/main/mysqlslap.opt
mysql-test/main/mysqlslap.opt
+1
-0
mysql-test/main/mysqlslap.result
mysql-test/main/mysqlslap.result
+100
-0
mysql-test/main/mysqlslap.test
mysql-test/main/mysqlslap.test
+51
-0
No files found.
mysql-test/main/mysqlslap.opt
View file @
bc2dc83c
--sql_mode='NO_ENGINE_SUBSTITUTION'
--log-output=TABLE,FILE --general-log=0 --slow-query-log=0
mysql-test/main/mysqlslap.result
View file @
bc2dc83c
...
...
@@ -258,3 +258,103 @@ DROP TABLE t1;
#
# Bug MDEV-15789 (Upstream: #80329): MYSQLSLAP OPTIONS --AUTO-GENERATE-SQL-GUID-PRIMARY and --AUTO-GENERATE-SQL-SECONDARY-INDEXES DONT WORK
#
#
# MDEV-22485: mysqlslap does not use current user as default for connecting to server
#
set @old_general_log=@@global.general_log;
set @old_general_log_file=@@global.general_log_file;
select @old_general_log;
@old_general_log
0
show global variables
where Variable_name = 'general_log' or Variable_name = 'slow_query_log';
Variable_name Value
general_log OFF
slow_query_log OFF
truncate table mysql.general_log;
select * from mysql.general_log;
event_time user_host thread_id server_id command_type argument
set global general_log=ON;
current_user.log;
@@current_user.log
current_user.log
SET GLOBAL general_log_file=general_log.log;
show global variables
where Variable_name = 'general_log' or Variable_name = 'slow_query_log';
Variable_name Value
general_log ON
slow_query_log OFF
flush logs;
create user anel@localhost;
grant all on *.* to anel@localhost;
connect con1,localhost,anel,,;
connection con1;
create table t(t int);
# Run mysqlslap user anel
Benchmark
Average number of seconds to run all queries: X seconds
Minimum number of seconds to run all queries: X seconds
Maximum number of seconds to run all queries: X seconds
Number of clients running queries: 1
Average number of queries per client: 1
flush tables;
select user_host, command_type, argument from mysql.general_log;
user_host command_type argument
root[root] @ localhost [] Query select @@general_log_file
root[root] @ localhost [] Query SET GLOBAL general_log_file=current_user.log
root[root] @ localhost [] Query show global variables
where Variable_name = 'general_log' or Variable_name = 'slow_query_log'
root[root] @ localhost [] Query flush logs
root[root] @ localhost [] Query create user anel@localhost
root[root] @ localhost [] Query grant all on *.* to anel@localhost
[anel] @ localhost [] Connect anel@localhost as anonymous on test
anel[anel] @ localhost [] Query create table t(t int)
[root] @ localhost [] Connect root@localhost as anonymous on
[root] @ localhost [] Connect root@localhost as anonymous on test
root[root] @ localhost [] Query SELECT current_user()
root[root] @ localhost [] Quit
root[root] @ localhost [] Quit
anel[anel] @ localhost [] Query flush tables
anel[anel] @ localhost [] Query select user_host, command_type, argument from mysql.general_log
disconnect con1;
connection default;
# Run mysqlslap user root
Benchmark
Average number of seconds to run all queries: X seconds
Minimum number of seconds to run all queries: X seconds
Maximum number of seconds to run all queries: X seconds
Number of clients running queries: 1
Average number of queries per client: 1
flush tables;
select user_host, command_type, argument from mysql.general_log;
user_host command_type argument
root[root] @ localhost [] Query select @@general_log_file
root[root] @ localhost [] Query SET GLOBAL general_log_file=current_user.log
root[root] @ localhost [] Query show global variables
where Variable_name = 'general_log' or Variable_name = 'slow_query_log'
root[root] @ localhost [] Query flush logs
root[root] @ localhost [] Query create user anel@localhost
root[root] @ localhost [] Query grant all on *.* to anel@localhost
[anel] @ localhost [] Connect anel@localhost as anonymous on test
anel[anel] @ localhost [] Query create table t(t int)
[root] @ localhost [] Connect root@localhost as anonymous on
[root] @ localhost [] Connect root@localhost as anonymous on test
root[root] @ localhost [] Query SELECT current_user()
root[root] @ localhost [] Quit
root[root] @ localhost [] Quit
anel[anel] @ localhost [] Query flush tables
anel[anel] @ localhost [] Query select user_host, command_type, argument from mysql.general_log
anel[anel] @ localhost [] Quit
[root] @ localhost [] Connect root@localhost as anonymous on
[root] @ localhost [] Connect root@localhost as anonymous on test
root[root] @ localhost [] Query SELECT current_user()
root[root] @ localhost [] Quit
root[root] @ localhost [] Quit
root[root] @ localhost [] Query flush tables
root[root] @ localhost [] Query select user_host, command_type, argument from mysql.general_log
drop user anel@localhost;
drop table t;
set global general_log= @old_general_log;
set global general_log_file= @old_general_log_file;
mysql-test/main/mysqlslap.test
View file @
bc2dc83c
...
...
@@ -88,3 +88,54 @@ DROP TABLE t1;
--
exec
$MYSQL_SLAP
--
concurrency
=
1
--
silent
--
iterations
=
1
--
number
-
int
-
cols
=
2
--
number
-
char
-
cols
=
3
--
auto
-
generate
-
sql
--
auto
-
generate
-
sql
-
guid
-
primary
--
create
-
schema
=
slap
--
exec
$MYSQL_SLAP
--
concurrency
=
1
--
silent
--
iterations
=
1
--
number
-
int
-
cols
=
2
--
number
-
char
-
cols
=
3
--
auto
-
generate
-
sql
--
auto
-
generate
-
sql
-
secondary
-
indexes
=
1
--
create
-
schema
=
slap
--
echo
#
--
echo
# MDEV-22485: mysqlslap does not use current user as default for connecting to server
--
echo
#
--
disable_ps_protocol
set
@
old_general_log
=@@
global
.
general_log
;
set
@
old_general_log_file
=@@
global
.
general_log_file
;
select
@
old_general_log
;
show
global
variables
where
Variable_name
=
'general_log'
or
Variable_name
=
'slow_query_log'
;
truncate
table
mysql
.
general_log
;
# empty log at the beginning
select
*
from
mysql
.
general_log
;
set
global
general_log
=
ON
;
--
replace_regex
/
[
\
/
\w
:
](
?!.
log
)
.*/
current_user
.
log
/
select
@@
general_log_file
;
--
replace_regex
/=.+
"/=general_log.log/
--let
$gen_log_file
=
$MYSQLTEST_VARDIR
/tmp/general_log.log
--replace_regex /"
.+
"/general_log.log/
--eval SET GLOBAL general_log_file="
$gen_log_file
"
show global variables
where Variable_name = 'general_log' or Variable_name = 'slow_query_log';
flush logs;
create user anel@localhost;
grant all on *.* to anel@localhost;
connect con1,localhost,anel,,;
connection con1;
create table t(t int);
--echo # Run mysqlslap user anel
--replace_regex /\d[.]\d+/X/
--exec
$MYSQL_SLAP
--create-schema=test --query="
SELECT
current_user
()
" --concurrency=1 --iterations=1
flush tables;
--replace_regex /"
.+/
current_user
.
log
/
/
[
::
1
]
//
select
user_host
,
command_type
,
argument
from
mysql
.
general_log
;
disconnect
con1
;
connection
default
;
--
echo
# Run mysqlslap user root
--
replace_regex
/
\d
[
.
]
\d
+/
X
/
--
exec
$MYSQL_SLAP
--
create
-
schema
=
test
--
query
=
"SELECT current_user()"
--
concurrency
=
1
--
iterations
=
1
flush
tables
;
#--exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --create-schema=slap
--
replace_regex
/
".+/current_user.log/ /[::1]//
select user_host, command_type, argument from mysql.general_log;
drop user anel@localhost;
drop table t;
set global general_log= @old_general_log;
set global general_log_file= @old_general_log_file;
--enable_ps_protocol
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