mysql-server/mysql-test/t/persisted_variables_for_component.test
2025-03-05 14:31:37 +07:00

105 lines
3.7 KiB
Text

-- source include/have_validate_password_component.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo #
--echo # WL#8688: Support ability to persist SET GLOBAL settings
--echo #
SET PERSIST server_id=47, @@persist.general_log=0;
SET PERSIST concurrent_insert=NEVER;
--echo # TEST plugin variables
call mtr.add_suppression("Dictionary file not specified");
INSTALL COMPONENT "file://component_validate_password";
--echo # before restart
SELECT @@global.validate_password.policy, @@global.validate_password.length;
--echo # persist plugin variables
SET PERSIST validate_password.policy= 2;
SET PERSIST validate_password.length= 13;
--echo # Restart server
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--echo # after restart
SELECT @@global.server_id;
SELECT @@global.general_log;
SELECT @@global.concurrent_insert;
SELECT @@global.validate_password.policy;
SELECT @@global.validate_password.length;
--echo # uninstall component
UNINSTALL COMPONENT "file://component_validate_password";
CALL mtr.add_suppression("currently unknown variable 'validate_password*");
--echo # Restart server after plugin uninstall this should report
--echo # warnings in server log
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--echo # Search for warnings in error log.
--let $log_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let LOGF= $log_file
CALL mtr.add_suppression("currently unknown variable 'validate_password*");
let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/mysqld-auto.cnf
--echo # Restart server
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--echo # Test RESET PERSIST for component variables.
INSTALL COMPONENT "file://component_validate_password";
SELECT * FROM performance_schema.persisted_variables;
SET PERSIST validate_password.policy= 2;
# return 1 row
SELECT * FROM performance_schema.persisted_variables;
SET PERSIST validate_password.length= 13;
# return 2 rows
SELECT * FROM performance_schema.persisted_variables;
RESET PERSIST `validate_password.length`;
# return 1 row
SELECT * FROM performance_schema.persisted_variables;
--echo # uninstall component
UNINSTALL COMPONENT "file://component_validate_password";
# return 1 row
SELECT * FROM performance_schema.persisted_variables;
--echo # Test RESET PERSIST after plugin is uninstalled
RESET PERSIST;
# return 0 rows
SELECT * FROM performance_schema.persisted_variables;
--echo #
--echo # BUG#31968366: SET PERSIST FOR COMPONENTS GENERATES A FLOOD OF WARNINGS
--echo #
INSTALL COMPONENT 'file://component_validate_password';
SET @@persist.validate_password.length=10;
SET @@persist.validate_password.check_user_name=OFF;
# return 2 rows
SELECT COUNT(*) FROM performance_schema.persisted_variables;
UNINSTALL COMPONENT 'file://component_validate_password';
INSTALL COMPONENT 'file://component_validate_password';
# with fix should return 0 rows, without fix it will return 63 rows
SELECT COUNT(*) FROM performance_schema.error_log WHERE ERROR_CODE = "MY-013185";
UNINSTALL COMPONENT 'file://component_validate_password';
--echo # Test RESET PERSIST after component is uninstalled
RESET PERSIST;
# return 0 rows
SELECT * FROM performance_schema.persisted_variables;