mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
bd365f7622
Add support for warnings for prepare of prepared statements Fixed test to work with --ps-protocol Fixed some test results libmysql/libmysql.c: Add support for warnings for prepare of prepared statements mysql-test/r/func_concat.result: After merge fixes mysql-test/r/select.result: Delete conflicting tables form previous tests mysql-test/r/view.result: New code from 4.1 fixed old error mysql-test/t/create.test: Ensure that --ps-protocol return same results as normal test mysql-test/t/func_group.test: Remove not needed --disable_ps_protocol mysql-test/t/func_time.test: Ensure that --ps-protocol return same results as normal test mysql-test/t/having.test: Ensure that --ps-protocol return same results as normal test mysql-test/t/insert_select.test: Remove not needed --disable_ps_protocol mysql-test/t/select.test: Ensure that --ps-protocol return same results as normal test mysql-test/t/sp.test: Fixed comment mysql-test/t/system_mysql_db_fix.test: Fix that results is same as from system_mysql_db.test mysql-test/t/trigger.test: Added comment mysql-test/t/type_blob.test: Remove not needed --disable_ps_protocol mysql-test/t/union.test: Run most of the test with --ps-protocol mysql-test/t/user_limits.test: Ensure that --ps-protocol return same results as normal test mysql-test/t/view.test: Removed --error as bug is now fixed mysql-test/t/warnings.test: Ensure that --ps-protocol return same results as normal test ndb/include/Makefile.am: Don't automaticly use SCCS files sql/ha_ndbcluster.cc: Removed compiler warning sql/log_event.cc: After merge fix sql/sql_class.h: After merge fix sql/sql_insert.cc: After merge fix sql/sql_load.cc: After merge fix sql/sql_prepare.cc: Add support for warnings for prepare of prepared statements sql/sql_update.cc: After merge fixes
158 lines
4.7 KiB
Text
158 lines
4.7 KiB
Text
#
|
|
# Test behavior of various per-account limits (aka quotas)
|
|
#
|
|
|
|
# Prepare play-ground
|
|
--disable_warnings
|
|
drop table if exists t1;
|
|
--enable_warnings
|
|
create table t1 (i int);
|
|
# Just be sure that nothing will bother us
|
|
delete from mysql.user where user like 'mysqltest\_%';
|
|
delete from mysql.db where user like 'mysqltest\_%';
|
|
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
|
delete from mysql.columns_priv where user like 'mysqltest\_%';
|
|
flush privileges;
|
|
|
|
# Limits doesn't work with prepared statements (yet)
|
|
--disable_ps_protocol
|
|
|
|
# Test of MAX_QUERIES_PER_HOUR limit
|
|
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2;
|
|
connect (mqph, localhost, mysqltest_1,,);
|
|
connection mqph;
|
|
select * from t1;
|
|
select * from t1;
|
|
--error 1226
|
|
select * from t1;
|
|
connect (mqph2, localhost, mysqltest_1,,);
|
|
connection mqph2;
|
|
--error 1226
|
|
select * from t1;
|
|
# cleanup
|
|
connection default;
|
|
drop user mysqltest_1@localhost;
|
|
disconnect mqph;
|
|
disconnect mqph2;
|
|
|
|
# Test of MAX_UPDATES_PER_HOUR limit
|
|
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 2;
|
|
connect (muph, localhost, mysqltest_1,,);
|
|
connection muph;
|
|
select * from t1;
|
|
select * from t1;
|
|
select * from t1;
|
|
delete from t1;
|
|
delete from t1;
|
|
--error 1226
|
|
delete from t1;
|
|
select * from t1;
|
|
connect (muph2, localhost, mysqltest_1,,);
|
|
connection muph2;
|
|
--error 1226
|
|
delete from t1;
|
|
select * from t1;
|
|
# Cleanup
|
|
connection default;
|
|
drop user mysqltest_1@localhost;
|
|
disconnect muph;
|
|
disconnect muph2;
|
|
|
|
# Test of MAX_CONNECTIONS_PER_HOUR limit
|
|
grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2;
|
|
connect (mcph1, localhost, mysqltest_1,,);
|
|
connection mcph1;
|
|
select * from t1;
|
|
connect (mcph2, localhost, mysqltest_1,,);
|
|
connection mcph2;
|
|
select * from t1;
|
|
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
|
--error 1226
|
|
connect (mcph3, localhost, mysqltest_1,,);
|
|
# Old connection is still ok
|
|
select * from t1;
|
|
# Let us try to close old connections and try again. This will also test that
|
|
# counters are not thrown away if there are no connections for this user.
|
|
disconnect mcph1;
|
|
disconnect mcph2;
|
|
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
|
--error 1226
|
|
connect (mcph3, localhost, mysqltest_1,,);
|
|
# Cleanup
|
|
connection default;
|
|
drop user mysqltest_1@localhost;
|
|
|
|
# Test of MAX_USER_CONNECTIONS limit
|
|
# We need this to reset internal mqh_used variable
|
|
flush privileges;
|
|
grant usage on *.* to mysqltest_1@localhost with max_user_connections 2;
|
|
connect (muc1, localhost, mysqltest_1,,);
|
|
connection muc1;
|
|
select * from t1;
|
|
connect (muc2, localhost, mysqltest_1,,);
|
|
connection muc2;
|
|
select * from t1;
|
|
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
|
--error 1226
|
|
connect (muc3, localhost, mysqltest_1,,);
|
|
# Closing of one of connections should help
|
|
disconnect muc1;
|
|
connect (muc3, localhost, mysqltest_1,,);
|
|
select * from t1;
|
|
# Changing of limit should also help (and immediately)
|
|
connection default;
|
|
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
|
|
connect (muc4, localhost, mysqltest_1,,);
|
|
connection muc4;
|
|
select * from t1;
|
|
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
|
--error 1226
|
|
connect (muc5, localhost, mysqltest_1,,);
|
|
# Clean up
|
|
connection default;
|
|
disconnect muc2;
|
|
disconnect muc3;
|
|
disconnect muc4;
|
|
drop user mysqltest_1@localhost;
|
|
|
|
# Now let us test interaction between global and per-account
|
|
# max_user_connections limits
|
|
select @@session.max_user_connections, @@global.max_user_connections;
|
|
# Local max_user_connections variable can't be set directly
|
|
# since this limit is per-account
|
|
--error 1229
|
|
set session max_user_connections= 2;
|
|
# But it is ok to set global max_user_connections
|
|
set global max_user_connections= 2;
|
|
select @@session.max_user_connections, @@global.max_user_connections;
|
|
# Let us check that global limit works
|
|
grant usage on *.* to mysqltest_1@localhost;
|
|
connect (muca1, localhost, mysqltest_1,,);
|
|
connection muca1;
|
|
select @@session.max_user_connections, @@global.max_user_connections;
|
|
connect (muca2, localhost, mysqltest_1,,);
|
|
connection muca2;
|
|
select * from t1;
|
|
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
|
--error 1203
|
|
connect (muca3, localhost, mysqltest_1,,);
|
|
# Now we are testing that per-account limit prevails over gloabl limit
|
|
connection default;
|
|
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
|
|
connect (muca3, localhost, mysqltest_1,,);
|
|
connection muca3;
|
|
select @@session.max_user_connections, @@global.max_user_connections;
|
|
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
|
--error 1226
|
|
connect (muca4, localhost, mysqltest_1,,);
|
|
# Cleanup
|
|
connection default;
|
|
disconnect muca1;
|
|
disconnect muca2;
|
|
disconnect muca3;
|
|
set global max_user_connections= 0;
|
|
drop user mysqltest_1@localhost;
|
|
--enable_ps_protocol
|
|
|
|
# Final cleanup
|
|
drop table t1;
|