Commit bc2dc83c authored by Anel Husakovic's avatar Anel Husakovic

MDEV-22485: add the test case

Closes PR #1649
parent 47c4caf1
--sql_mode='NO_ENGINE_SUBSTITUTION' --sql_mode='NO_ENGINE_SUBSTITUTION'
--log-output=TABLE,FILE --general-log=0 --slow-query-log=0
...@@ -258,3 +258,103 @@ DROP TABLE t1; ...@@ -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 # 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;
...@@ -88,3 +88,54 @@ DROP TABLE t1; ...@@ -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-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 --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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment