-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5452 from kamil-holubicki/PS-9382-8.0
PS-9453: percona_telemetry causes a long wait on COND_thd_list due to the absence of the root user
- Loading branch information
Showing
20 changed files
with
226 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
mysql-test/suite/component_percona_telemetry/r/no_user.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
SELECT * FROM information_schema.table_privileges WHERE grantee = "'mysql.session'@'localhost'" ORDER BY table_schema, table_name; | ||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE | ||
'mysql.session'@'localhost' def mysql component SELECT NO | ||
'mysql.session'@'localhost' def mysql user SELECT NO | ||
'mysql.session'@'localhost' def performance_schema replication_group_members SELECT NO | ||
SHOW GRANTS FOR 'mysql.session'@'localhost'; | ||
Grants for mysql.session@localhost | ||
GRANT SHUTDOWN, SUPER, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO `mysql.session`@`localhost` | ||
GRANT AUDIT_ABORT_EXEMPT,AUTHENTICATION_POLICY_ADMIN,BACKUP_ADMIN,CLONE_ADMIN,CONNECTION_ADMIN,FIREWALL_EXEMPT,PERSIST_RO_VARIABLES_ADMIN,SESSION_VARIABLES_ADMIN,SYSTEM_USER,SYSTEM_VARIABLES_ADMIN ON *.* TO `mysql.session`@`localhost` | ||
GRANT SELECT ON `performance_schema`.* TO `mysql.session`@`localhost` | ||
GRANT SELECT ON `mysql`.`component` TO `mysql.session`@`localhost` | ||
GRANT SELECT ON `mysql`.`user` TO `mysql.session`@`localhost` | ||
GRANT SELECT ON `performance_schema`.`replication_group_members` TO `mysql.session`@`localhost` | ||
# restart:--percona_telemetry.grace_interval=30 --percona_telemetry.scrape_interval=30 --percona_telemetry.telemetry_root_dir=<telemetry_root_dir> | ||
RENAME USER 'root'@'localhost' to 'root.tmp'@'localhost'; | ||
Warnings: | ||
Warning 4005 User 'root'@'localhost' is referenced as a definer account in a stored routine. | ||
Warning 4005 User 'root'@'localhost' is referenced as a definer account in a trigger. | ||
'root' user used by component's 1st verison does not exist. Telemetry dir should contain 1 file. | ||
1 | ||
RENAME USER 'root.tmp'@'localhost' to 'root'@'localhost'; | ||
Warnings: | ||
Warning 4005 User 'root'@'localhost' is referenced as a definer account in a stored routine. | ||
Warning 4005 User 'root'@'localhost' is referenced as a definer account in a trigger. | ||
# restart:--percona_telemetry.grace_interval=30 --percona_telemetry.scrape_interval=30 --percona_telemetry.telemetry_root_dir=<telemetry_root_dir> | ||
RENAME USER 'mysql.session'@'localhost' to 'mysql.session.tmp'@'localhost'; | ||
include/assert.inc [No orphaned sessions expected in processlist] | ||
'mysql.session' user used by component does not exist. Telemetry dir should still contain 1 file. | ||
1 | ||
RENAME USER 'mysql.session.tmp'@'localhost' to 'mysql.session'@'localhost'; | ||
# restart:--percona_telemetry.grace_interval=30 --percona_telemetry.scrape_interval=30 --percona_telemetry.telemetry_root_dir=<telemetry_root_dir> |
70 changes: 70 additions & 0 deletions
70
mysql-test/suite/component_percona_telemetry/t/no_user.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Test that lack of the user used by Percona Telemetry Component | ||
# doesn't cause hangs during server restart and no orphaned sessions are created. | ||
|
||
--source include/have_percona_telemetry.inc | ||
|
||
--let $telemetry_root_dir = $MYSQL_TMP_DIR/telemetry_dir | ||
--let $grace_interval = 30 | ||
--let $scrape_interval = 30 | ||
|
||
--mkdir $telemetry_root_dir | ||
|
||
# Record mysql.session user privileges | ||
SELECT * FROM information_schema.table_privileges WHERE grantee = "'mysql.session'@'localhost'" ORDER BY table_schema, table_name; | ||
SHOW GRANTS FOR 'mysql.session'@'localhost'; | ||
|
||
# restart the server with custom telemetry file path and timeouts | ||
--let $restart_parameters = "restart:--percona_telemetry.grace_interval=$grace_interval --percona_telemetry.scrape_interval=$scrape_interval --percona_telemetry.telemetry_root_dir=$telemetry_root_dir" | ||
--replace_regex /telemetry_root_dir=.*telemetry_dir/telemetry_root_dir=<telemetry_root_dir>/ | ||
--source include/restart_mysqld.inc | ||
|
||
# Rename 'root' user (1st version of Percona Telemetry Component used 'root' user) | ||
# 1st version will not collect any data and will not create telemetry file and the restart will hang. | ||
# Fixed version will work properly as it doesn't use 'root' user. | ||
RENAME USER 'root'@'localhost' to 'root.tmp'@'localhost'; | ||
|
||
# sleep more than grace_interval and check that telemetry file was created | ||
--let $timeout = `select $grace_interval + 10` | ||
--sleep $timeout | ||
|
||
--echo 'root' user used by component's 1st verison does not exist. Telemetry dir should contain 1 file. | ||
--exec ls -1 $telemetry_root_dir | wc -l | ||
|
||
# | ||
# It should be possible to restart the server. | ||
# | ||
RENAME USER 'root.tmp'@'localhost' to 'root'@'localhost'; | ||
--let $restart_parameters = "restart:--percona_telemetry.grace_interval=$grace_interval --percona_telemetry.scrape_interval=$scrape_interval --percona_telemetry.telemetry_root_dir=$telemetry_root_dir" | ||
--replace_regex /telemetry_root_dir=.*telemetry_dir/telemetry_root_dir=<telemetry_root_dir>/ | ||
--source include/restart_mysqld.inc | ||
|
||
|
||
# | ||
# Now rename the user used by component | ||
# | ||
RENAME USER 'mysql.session'@'localhost' to 'mysql.session.tmp'@'localhost'; | ||
|
||
# Wait a few cycles and ensure that SHOW PROCESSLIST does not contain rows related to orphaned sessions. | ||
--let $timeout = `select $grace_interval + 3 * $scrape_interval` | ||
--sleep $timeout | ||
|
||
--let $assert_text = No orphaned sessions expected in processlist | ||
--let $assert_cond = [SELECT COUNT(*) as Result FROM performance_schema.processlist WHERE user = "mysql.session";, Result, 1] = 0 | ||
--source include/assert.inc | ||
|
||
# Check that no new telemetry file was created | ||
--echo 'mysql.session' user used by component does not exist. Telemetry dir should still contain 1 file. | ||
--exec ls -1 $telemetry_root_dir | wc -l | ||
|
||
|
||
# | ||
# It should be still possible to restart the server. | ||
# | ||
RENAME USER 'mysql.session.tmp'@'localhost' to 'mysql.session'@'localhost'; | ||
--let $restart_parameters = "restart:--percona_telemetry.grace_interval=$grace_interval --percona_telemetry.scrape_interval=$scrape_interval --percona_telemetry.telemetry_root_dir=$telemetry_root_dir" | ||
--replace_regex /telemetry_root_dir=.*telemetry_dir/telemetry_root_dir=<telemetry_root_dir>/ | ||
--source include/restart_mysqld.inc | ||
|
||
# cleanup | ||
--force-rmdir $telemetry_root_dir | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--loose-percona-telemetry-disable=ON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--loose-percona-telemetry-disable=ON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--loose-percona-telemetry-disable=ON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.