Skip to content

Commit b51a357

Browse files
authored
Merge branch '8.0' into release-8.0.39-30
2 parents 41ebc5d + 420bf0b commit b51a357

File tree

18 files changed

+760
-14
lines changed

18 files changed

+760
-14
lines changed

components/percona_telemetry/data_provider.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class DataProvider {
6161
SERVICE_TYPE(mysql_command_thread) & command_thread_service,
6262
Logger &logger);
6363

64-
~DataProvider() = default;
64+
virtual ~DataProvider() = default;
6565

6666
DataProvider(const DataProvider &rhs) = delete;
6767
DataProvider(DataProvider &&rhs) = delete;
@@ -73,9 +73,9 @@ class DataProvider {
7373
std::string get_report();
7474

7575
private:
76-
bool do_query(const std::string &query, QueryResult *result,
77-
unsigned int *err_no = nullptr,
78-
bool suppress_query_error_log = false);
76+
virtual bool do_query(const std::string &query, QueryResult *result,
77+
unsigned int *err_no = nullptr,
78+
bool suppress_query_error_log = false);
7979
bool collect_db_instance_id_info(rapidjson::Document *document);
8080
bool collect_product_version_info(rapidjson::Document *document);
8181
bool collect_plugins_info(rapidjson::Document *document);

mysql-test/collections/disabled.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ perfschema.idx_compare_ews_by_thread_by_event_name : BUG#31041671
8787
perfschema.idx_compare_ews_by_instance : BUG#31791537
8888
perfschema.idx_compare_rwlock_instances : BUG#31791537
8989

90+
# rocksdb suite tests
91+
rocksdb.non_blocking_manual_compaction : BUG#0000 PS-9381 Often fails in Jenkins due to races.
92+
9093
# rocksdb_stress suite tests
9194
rocksdb_stress.drop_cf_stress : BUG#0000 PS-9381 Often fails in Jenkins due to races.
9295

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CALL mtr.add_suppression("Component percona_telemetry reported: 'Skipping file deletion this_file_should_not_be_removed'");
2+
# restart:--percona_telemetry.grace_interval=30 --percona_telemetry.scrape_interval=30 --percona_telemetry.history_keep_interval=80 --percona_telemetry.telemetry_root_dir=<telemetry_root_dir>
3+
File with the name not conforming to the pattern still should be there
4+
1
5+
Obsolete file should be removed
6+
0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# restart:--percona_telemetry.grace_interval=30 --percona_telemetry.scrape_interval=30 --percona_telemetry.history_keep_interval=80 --percona_telemetry.telemetry_root_dir=<telemetry_root_dir>
2+
Server should still be alive
3+
CALL mtr.add_suppression("Component percona_telemetry reported: 'Problem during telemetry file write: filesystem error: directory iterator cannot open directory: No such file or directory");
4+
include/assert_grep.inc [Percona Telemetry Component warns about nonexistent directory]
5+
Telemetry root dir should contain 1 file
6+
1
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
include/assert.inc [Percona Telemetry Component should not be installed]
2+
UNINSTALL COMPONENT 'file://component_percona_telemetry';
3+
include/assert.inc [Percona Telemetry Component should not be installed]
4+
# restart:
5+
include/assert.inc [Percona Telemetry Component should be installed after server restart]
6+
# restart:--percona-telemetry-disable=1
7+
include/assert.inc [Percona Telemetry Component should not be installed when server is started with --percona-telemetry-disable=1]
8+
INSTALL COMPONENT 'file://component_percona_telemetry';
9+
include/assert.inc [It should be possible to manually install Percona Telemetry Component]
10+
# restart:--percona-telemetry-disable=1
11+
include/assert.inc [Percona Telemetry Component should not be installed when server is started with --percona-telemetry-disable=1]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# restart:--percona_telemetry.grace_interval=30 --percona_telemetry.scrape_interval=30 --percona_telemetry.history_keep_interval=80 --percona_telemetry.telemetry_root_dir=<telemetry_root_dir>
2+
Time passed: 10.0000. Still in grace_interval. Telemetry root dir should contain 0 files
3+
0
4+
Time passed: 40.0000. Time after grace_interval: 10.0000. Telemetry root dir should contain 1 file
5+
1
6+
Time passed: 70.0000. Time after grace_interval: 40.0000. Telemetry root dir should contain 2 files
7+
2
8+
Time passed: 100.0000. Time after grace_interval: 70.0000. Telemetry root dir should contain 3 files
9+
3
10+
Time passed: 130.0000. Time after grace_interval: 100.0000. Telemetry root dir should still contain 3 files
11+
3
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Test that obsolete files from another servers are removed,
2+
# but files with names not conforming to expected pattern are not.
3+
4+
--source include/have_percona_telemetry.inc
5+
--source include/force_restart.inc
6+
7+
CALL mtr.add_suppression("Component percona_telemetry reported: 'Skipping file deletion this_file_should_not_be_removed'");
8+
9+
--let $telemetry_root_dir = $MYSQL_TMP_DIR/telemetry_dir
10+
--let $grace_interval = 30
11+
--let $scrape_interval = 30
12+
--let $history_keep_interval = 80
13+
14+
--let $obsolete_file_name = 313671600-1af5d44c-81f9-4083-807d-e71ca7914f92.json
15+
--let $untouchable_file_name = this_file_should_not_be_removed.json
16+
--let $untouchable_file = $telemetry_root_dir/$untouchable_file_name
17+
--let $obsolete_file = $telemetry_root_dir/$obsolete_file_name
18+
19+
--mkdir $telemetry_root_dir
20+
--exec touch $untouchable_file
21+
--exec touch $obsolete_file
22+
23+
# restart the server with custom telemetry file path and timeouts
24+
--let $restart_parameters = "restart:--percona_telemetry.grace_interval=$grace_interval --percona_telemetry.scrape_interval=$scrape_interval --percona_telemetry.history_keep_interval=$history_keep_interval --percona_telemetry.telemetry_root_dir=$telemetry_root_dir"
25+
--replace_regex /telemetry_root_dir=.*telemetry_dir/telemetry_root_dir=<telemetry_root_dir>/
26+
--source include/restart_mysqld.inc
27+
28+
# Wait for percona_telemetry.grace_interval to pass (+10sec)
29+
--let $timeout = `select $grace_interval + 10`
30+
--sleep $timeout
31+
32+
--echo File with the name not conforming to the pattern still should be there
33+
--file_exists $untouchable_file
34+
--exec ls -1 $telemetry_root_dir | grep $untouchable_file_name | wc -l
35+
36+
--echo Obsolete file should be removed
37+
--exec ls -1 $telemetry_root_dir | grep $obsolete_file_name | wc -l
38+
39+
# cleanup
40+
--force-rmdir $telemetry_root_dir
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Test that Percona Telemetry Component doesn't do any harm to the server when it is not possible
2+
# to store telemetry file
3+
4+
--source include/have_percona_telemetry.inc
5+
--source include/force_restart.inc
6+
7+
--let $telemetry_root_dir = $MYSQL_TMP_DIR/telemetry_dir
8+
--let $grace_interval = 30
9+
--let $scrape_interval = 30
10+
--let $history_keep_interval = 80
11+
12+
13+
# restart the server with custom telemetry file path and timeouts
14+
--let $restart_parameters = "restart:--percona_telemetry.grace_interval=$grace_interval --percona_telemetry.scrape_interval=$scrape_interval --percona_telemetry.history_keep_interval=$history_keep_interval --percona_telemetry.telemetry_root_dir=$telemetry_root_dir"
15+
--replace_regex /telemetry_root_dir=.*telemetry_dir/telemetry_root_dir=<telemetry_root_dir>/
16+
--source include/restart_mysqld.inc
17+
18+
# Wait for more than grace_interval. Component should try to create the telemetry file, but as the target dir
19+
# doesn't exist it will fail. It should complain with a warning in the log, but continue.
20+
--let $timeout = `select $grace_interval + 20`
21+
--sleep $timeout
22+
--echo Server should still be alive
23+
24+
--let $warning_message = Component percona_telemetry reported: 'Problem during telemetry file write: filesystem error: directory iterator cannot open directory: No such file or directory
25+
--eval CALL mtr.add_suppression("$warning_message")
26+
--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err
27+
--let $assert_select = $warning_message
28+
--let $assert_count=1
29+
--let $assert_text = Percona Telemetry Component warns about nonexistent directory
30+
--source include/assert_grep.inc
31+
32+
33+
# Now create the telemetry dir and wait for scrape_interval. Telemetry file should be created
34+
--mkdir $telemetry_root_dir
35+
36+
--let $timeout = $scrape_interval
37+
--sleep $timeout
38+
--echo Telemetry root dir should contain 1 file
39+
--exec ls -1 $telemetry_root_dir | wc -l
40+
41+
# cleanup
42+
--force-rmdir $telemetry_root_dir
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Component enable/disable
2+
3+
--source include/have_percona_telemetry.inc
4+
--source include/force_restart.inc
5+
6+
7+
# Telemetry is enabled. It is checked already by have_percona_telemetry.inc
8+
--let $assert_text = Percona Telemetry Component should not be installed
9+
--let $assert_cond = [SELECT COUNT(*) FROM mysql.component WHERE component_urn = "file://component_percona_telemetry"] = 1
10+
--source include/assert.inc
11+
12+
# Component can be unloaded
13+
UNINSTALL COMPONENT 'file://component_percona_telemetry';
14+
15+
--let $assert_text = Percona Telemetry Component should not be installed
16+
--let $assert_cond = [SELECT COUNT(*) FROM mysql.component WHERE component_urn = "file://component_percona_telemetry"] = 0
17+
--source include/assert.inc
18+
19+
# Restart the server. Percona Telemetry Component should be installed again
20+
--let $restart_parameters = "restart:"
21+
--source include/restart_mysqld.inc
22+
23+
--let $assert_text = Percona Telemetry Component should be installed after server restart
24+
--let $assert_cond = [SELECT COUNT(*) FROM mysql.component WHERE component_urn = "file://component_percona_telemetry"] = 1
25+
--source include/assert.inc
26+
27+
# Now restart the server with --percona-telemetry-disable=1. Component should not be loaded
28+
--let $restart_parameters = "restart:--percona-telemetry-disable=1"
29+
--source include/restart_mysqld.inc
30+
31+
--let $assert_text = Percona Telemetry Component should not be installed when server is started with --percona-telemetry-disable=1
32+
--let $assert_cond = [SELECT COUNT(*) FROM mysql.component WHERE component_urn = "file://component_percona_telemetry"] = 0
33+
--source include/assert.inc
34+
35+
# Component can be loaded
36+
INSTALL COMPONENT 'file://component_percona_telemetry';
37+
38+
--let $assert_text = It should be possible to manually install Percona Telemetry Component
39+
--let $assert_cond = [SELECT COUNT(*) FROM mysql.component WHERE component_urn = "file://component_percona_telemetry"] = 1
40+
--source include/assert.inc
41+
42+
# ... but after restart with --percona-telemetry-disable=1 is should not be there
43+
# Now restart the server with --percona-telemetry-disable=1. Component should not be loaded
44+
--let $restart_parameters = "restart:--percona-telemetry-disable=1"
45+
--source include/restart_mysqld.inc
46+
47+
--let $assert_text = Percona Telemetry Component should not be installed when server is started with --percona-telemetry-disable=1
48+
--let $assert_cond = [SELECT COUNT(*) FROM mysql.component WHERE component_urn = "file://component_percona_telemetry"] = 0
49+
--source include/assert.inc
50+
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Test the telemetry file creation and cleanup
2+
3+
--source include/have_percona_telemetry.inc
4+
--source include/force_restart.inc
5+
6+
--let $telemetry_root_dir = $MYSQL_TMP_DIR/telemetry_dir
7+
--let $grace_interval = 30
8+
--let $scrape_interval = 30
9+
--let $history_keep_interval = 80
10+
11+
--mkdir $telemetry_root_dir
12+
13+
# restart the server with custom telemetry file path and timeouts
14+
--let $restart_parameters = "restart:--percona_telemetry.grace_interval=$grace_interval --percona_telemetry.scrape_interval=$scrape_interval --percona_telemetry.history_keep_interval=$history_keep_interval --percona_telemetry.telemetry_root_dir=$telemetry_root_dir"
15+
--replace_regex /telemetry_root_dir=.*telemetry_dir/telemetry_root_dir=<telemetry_root_dir>/
16+
--source include/restart_mysqld.inc
17+
18+
# time = 0
19+
--let $time_passed = 0
20+
--let $time_after_grace_interval=0
21+
# Right after the server start, due to percona_telemetry.grace_interval, the telemetry file should not be created
22+
--let $timeout = `select $grace_interval / 3`
23+
--sleep $timeout
24+
--let $time_passed = `select $time_passed + $timeout`
25+
26+
### now we are withing grace_interval
27+
--echo Time passed: $time_passed. Still in grace_interval. Telemetry root dir should contain 0 files
28+
--exec ls -1 $telemetry_root_dir | wc -l
29+
30+
31+
32+
# Wait for percona_telemetry.grace_interval to pass (+10sec) and check if telemetry file was created
33+
--let $timeout = `select $grace_interval - $time_passed + 10`
34+
--sleep $timeout
35+
--let $time_passed = `select $time_passed + $timeout`
36+
--let $time_after_grace_interval = `select $time_passed - $grace_interval`
37+
38+
### now we are in 1st scrape interval
39+
--echo Time passed: $time_passed. Time after grace_interval: $time_after_grace_interval. Telemetry root dir should contain 1 file
40+
--exec ls -1 $telemetry_root_dir | wc -l
41+
42+
43+
44+
# Wait a bit more. New telemetry file should be created
45+
--let $timeout = $scrape_interval
46+
--sleep $timeout
47+
--let $time_passed = `select $time_passed + $timeout`
48+
--let $time_after_grace_interval = `select $time_passed - $grace_interval`
49+
50+
### now we are in 2nd scrape interval
51+
--echo Time passed: $time_passed. Time after grace_interval: $time_after_grace_interval. Telemetry root dir should contain 2 files
52+
--exec ls -1 $telemetry_root_dir | wc -l
53+
54+
55+
# Wait a bit more. New telemetry file should be created
56+
--let $timeout = $scrape_interval
57+
--sleep $timeout
58+
--let $time_passed = `select $time_passed + $timeout`
59+
--let $time_after_grace_interval = `select $time_passed - $grace_interval`
60+
61+
### now we are in 3rd scrape interval
62+
--echo Time passed: $time_passed. Time after grace_interval: $time_after_grace_interval. Telemetry root dir should contain 3 files
63+
--exec ls -1 $telemetry_root_dir | wc -l
64+
65+
66+
# Due to history_keep_interval, new files should be created, but old ones should be deleted.
67+
--let $timeout = $scrape_interval
68+
--sleep $timeout
69+
--let $time_passed = `select $time_passed + $timeout`
70+
--let $time_after_grace_interval = `select $time_passed - $grace_interval`
71+
72+
--echo Time passed: $time_passed. Time after grace_interval: $time_after_grace_interval. Telemetry root dir should still contain 3 files
73+
--exec ls -1 $telemetry_root_dir | wc -l
74+
75+
# cleanup
76+
--force-rmdir $telemetry_root_dir

0 commit comments

Comments
 (0)