mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
Save the config file itself, not just its path.
This commit is contained in:
@@ -911,10 +911,12 @@ collect_mysql_info () {
|
||||
"SELECT LEFT(NOW() - INTERVAL ${uptime} SECOND, 16)")"
|
||||
|
||||
local port="$(get_var port "$dir/mysql-variables")"
|
||||
local cnf_file=$(find_my_cnf_file "$dir/mysqld-instances" ${port});
|
||||
local cnf_file="$(find_my_cnf_file "$dir/mysqld-instances" ${port})"
|
||||
|
||||
cat "$cnf_file" > "$dir/mysql-config-file"
|
||||
|
||||
echo "pt-summary-internal-current_time $current_time" >> "$dir/mysql-variables"
|
||||
echo "pt-summary-internal-Config_File $cnf_file" >> "$dir/mysql-variables"
|
||||
echo "pt-summary-internal-Config_File_path $cnf_file" >> "$dir/mysql-variables"
|
||||
collect_internal_vars >> "$dir/mysql-variables"
|
||||
|
||||
if [ -n "${OPT_DATABASES}" ]; then
|
||||
@@ -2139,10 +2141,10 @@ report_mysql_summary () {
|
||||
section_noteworthy_variables "$dir/mysql-variables"
|
||||
|
||||
section Configuration_File
|
||||
local cnf_file="$(get_var "pt-summary-internal-Config_File" "$dir/mysql-variables")"
|
||||
local cnf_file="$(get_var "pt-summary-internal-Config_File_path" "$dir/mysql-variables")"
|
||||
if [ -n "${cnf_file}" ]; then
|
||||
name_val "Config File" "${cnf_file}"
|
||||
pretty_print_cnf_file "${cnf_file}"
|
||||
pretty_print_cnf_file "$data_dir/mysql-config-file"
|
||||
else
|
||||
name_val "Config File" "Cannot autodetect or find, giving up"
|
||||
fi
|
||||
|
@@ -213,11 +213,13 @@ collect_mysql_info () {
|
||||
"SELECT LEFT(NOW() - INTERVAL ${uptime} SECOND, 16)")"
|
||||
|
||||
local port="$(get_var port "$dir/mysql-variables")"
|
||||
local cnf_file=$(find_my_cnf_file "$dir/mysqld-instances" ${port});
|
||||
local cnf_file="$(find_my_cnf_file "$dir/mysqld-instances" ${port})"
|
||||
|
||||
cat "$cnf_file" > "$dir/mysql-config-file"
|
||||
|
||||
# TODO: Do these require a file of their own?
|
||||
echo "pt-summary-internal-current_time $current_time" >> "$dir/mysql-variables"
|
||||
echo "pt-summary-internal-Config_File $cnf_file" >> "$dir/mysql-variables"
|
||||
echo "pt-summary-internal-Config_File_path $cnf_file" >> "$dir/mysql-variables"
|
||||
collect_internal_vars >> "$dir/mysql-variables"
|
||||
|
||||
if [ -n "${OPT_DATABASES}" ]; then
|
||||
|
@@ -1136,6 +1136,7 @@ report_mysql_summary () {
|
||||
# ########################################################################
|
||||
# Plugins
|
||||
# ########################################################################
|
||||
# TODO: what would be good is to show nonstandard plugins here.
|
||||
section Plugins
|
||||
name_val "InnoDB compression" "$(get_plugin_status "$dir/mysql-plugins" "INNODB_CMP")"
|
||||
|
||||
@@ -1239,6 +1240,12 @@ report_mysql_summary () {
|
||||
else
|
||||
name_val "Partitioning" "No"
|
||||
fi
|
||||
if grep -e 'ENGINE=InnoDB.*ROW_FORMAT' \
|
||||
-e 'ENGINE=InnoDB.*KEY_BLOCK_SIZE' "$dir/mysqldump" > /dev/null; then
|
||||
name_val "InnoDB Compression" "Yes"
|
||||
else
|
||||
name_val "InnoDB Compression" "No"
|
||||
fi
|
||||
fi
|
||||
local ssl="$(get_var Ssl_accepts "$dir/mysql-status")"
|
||||
if [ -n "$ssl" -a "${ssl:-0}" -gt 0 ]; then
|
||||
@@ -1338,10 +1345,10 @@ report_mysql_summary () {
|
||||
# If there is a my.cnf in a standard location, see if we can pretty-print it.
|
||||
# ########################################################################
|
||||
section Configuration_File
|
||||
local cnf_file="$(get_var "pt-summary-internal-Config_File" "$dir/mysql-variables")"
|
||||
local cnf_file="$(get_var "pt-summary-internal-Config_File_path" "$dir/mysql-variables")"
|
||||
if [ -n "${cnf_file}" ]; then
|
||||
name_val "Config File" "${cnf_file}"
|
||||
pretty_print_cnf_file "${cnf_file}"
|
||||
pretty_print_cnf_file "$dir/mysql-config-file"
|
||||
else
|
||||
name_val "Config File" "Cannot autodetect or find, giving up"
|
||||
fi
|
||||
|
@@ -25,7 +25,7 @@ local $ENV{PTDEBUG} = "";
|
||||
|
||||
my $dir = tempdir( "percona-testXXXXXXXX", CLEANUP => 1 );
|
||||
|
||||
`$trunk/bin/$tool --sleep 1 --save-samples $dir`;
|
||||
`$trunk/bin/$tool --sleep 1 --save-samples $dir -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
|
||||
|
||||
ok(
|
||||
-e $dir,
|
||||
@@ -36,7 +36,7 @@ my @files = glob("$dir/*");
|
||||
|
||||
is(
|
||||
scalar @files,
|
||||
12,
|
||||
13,
|
||||
"And leaves all files in there"
|
||||
);
|
||||
|
||||
@@ -46,7 +46,7 @@ undef($dir);
|
||||
# --databases
|
||||
#
|
||||
|
||||
my $out = `$trunk/bin/$tool --sleep 1 --databases mysql 2>/dev/null`;
|
||||
my $out = `$trunk/bin/$tool --sleep 1 --databases mysql 2>/dev/null -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
|
||||
|
||||
like(
|
||||
$out,
|
||||
@@ -60,7 +60,7 @@ for my $i (2..4) {
|
||||
no_diff(
|
||||
sub {
|
||||
local $ENV{_NO_FALSE_NEGATIVES} = 1;
|
||||
print `$trunk/bin/$tool --read-samples $trunk/t/pt-mysql-summary/samples/temp00$i | tail -n+3 | perl -wlnpe 's/Skipping schema analysis.*/Skipping schema analysis/'`
|
||||
print `$trunk/bin/$tool --read-samples $trunk/t/pt-mysql-summary/samples/temp00$i -- --defaults-file=/tmp/12345/my.sandbox.cnf | tail -n+3 | perl -wlnpe 's/Skipping schema analysis.*/Skipping schema analysis/'`
|
||||
},
|
||||
"t/pt-mysql-summary/samples/expected_output_temp00$i.txt",
|
||||
),
|
||||
|
@@ -250,40 +250,29 @@ log_queries_not_using_indexes | OFF
|
||||
Config File | /etc/mysql/my.cnf
|
||||
|
||||
[client]
|
||||
port = 3306
|
||||
socket = /var/run/mysqld/mysqld.sock
|
||||
|
||||
[mysqld_safe]
|
||||
socket = /var/run/mysqld/mysqld.sock
|
||||
nice = 0
|
||||
user = msandbox
|
||||
password = msandbox
|
||||
port = 12345
|
||||
socket = /tmp/12345/mysql_sandbox12345.sock
|
||||
|
||||
[mysqld]
|
||||
user = mysql
|
||||
socket = /var/run/mysqld/mysqld.sock
|
||||
port = 3306
|
||||
basedir = /usr
|
||||
datadir = /var/lib/mysql
|
||||
tmpdir = /tmp
|
||||
skip-external-locking
|
||||
bind-address = 127.0.0.1
|
||||
key_buffer = 16M
|
||||
max_allowed_packet = 16M
|
||||
thread_stack = 192K
|
||||
thread_cache_size = 8
|
||||
myisam-recover = BACKUP
|
||||
query_cache_limit = 1M
|
||||
query_cache_size = 16M
|
||||
log_error = /var/log/mysql/error.log
|
||||
expire_logs_days = 10
|
||||
max_binlog_size = 100M
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
quote-names
|
||||
max_allowed_packet = 16M
|
||||
|
||||
[mysql]
|
||||
|
||||
[isamchk]
|
||||
key_buffer = 16M
|
||||
port = 12345
|
||||
socket = /tmp/12345/mysql_sandbox12345.sock
|
||||
pid-file = /tmp/12345/data/mysql_sandbox12345.pid
|
||||
basedir = /home/hugmeir/mysql5/mysqlbrew/mysqls/Percona-Server-5.1/
|
||||
datadir = /tmp/12345/data
|
||||
key_buffer_size = 16M
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_data_home_dir = /tmp/12345/data
|
||||
innodb_log_group_home_dir = /tmp/12345/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_file_size = 5M
|
||||
log-bin = mysql-bin
|
||||
relay_log = mysql-relay-bin
|
||||
log_slave_updates
|
||||
server-id = 12345
|
||||
report-host = 127.0.0.1
|
||||
report-port = 12345
|
||||
log-error = mysqld.log
|
||||
innodb_lock_wait_timeout = 3
|
||||
# The End ####################################################
|
||||
|
@@ -231,40 +231,29 @@ log_queries_not_using_indexes | OFF
|
||||
Config File | /etc/mysql/my.cnf
|
||||
|
||||
[client]
|
||||
port = 3306
|
||||
socket = /var/run/mysqld/mysqld.sock
|
||||
|
||||
[mysqld_safe]
|
||||
socket = /var/run/mysqld/mysqld.sock
|
||||
nice = 0
|
||||
user = msandbox
|
||||
password = msandbox
|
||||
port = 12345
|
||||
socket = /tmp/12345/mysql_sandbox12345.sock
|
||||
|
||||
[mysqld]
|
||||
user = mysql
|
||||
socket = /var/run/mysqld/mysqld.sock
|
||||
port = 3306
|
||||
basedir = /usr
|
||||
datadir = /var/lib/mysql
|
||||
tmpdir = /tmp
|
||||
skip-external-locking
|
||||
bind-address = 127.0.0.1
|
||||
key_buffer = 16M
|
||||
max_allowed_packet = 16M
|
||||
thread_stack = 192K
|
||||
thread_cache_size = 8
|
||||
myisam-recover = BACKUP
|
||||
query_cache_limit = 1M
|
||||
query_cache_size = 16M
|
||||
log_error = /var/log/mysql/error.log
|
||||
expire_logs_days = 10
|
||||
max_binlog_size = 100M
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
quote-names
|
||||
max_allowed_packet = 16M
|
||||
|
||||
[mysql]
|
||||
|
||||
[isamchk]
|
||||
key_buffer = 16M
|
||||
port = 12345
|
||||
socket = /tmp/12345/mysql_sandbox12345.sock
|
||||
pid-file = /tmp/12345/data/mysql_sandbox12345.pid
|
||||
basedir = /home/hugmeir/mysql5/mysqlbrew/mysqls/Percona-Server-5.1/
|
||||
datadir = /tmp/12345/data
|
||||
key_buffer_size = 16M
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_data_home_dir = /tmp/12345/data
|
||||
innodb_log_group_home_dir = /tmp/12345/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_file_size = 5M
|
||||
log-bin = mysql-bin
|
||||
relay_log = mysql-relay-bin
|
||||
log_slave_updates
|
||||
server-id = 12345
|
||||
report-host = 127.0.0.1
|
||||
report-port = 12345
|
||||
log-error = mysqld.log
|
||||
innodb_lock_wait_timeout = 3
|
||||
# The End ####################################################
|
||||
|
26
t/pt-mysql-summary/samples/temp002/mysql-config-file
Normal file
26
t/pt-mysql-summary/samples/temp002/mysql-config-file
Normal file
@@ -0,0 +1,26 @@
|
||||
[client]
|
||||
user = msandbox
|
||||
password = msandbox
|
||||
port = 12345
|
||||
socket = /tmp/12345/mysql_sandbox12345.sock
|
||||
|
||||
[mysqld]
|
||||
port = 12345
|
||||
socket = /tmp/12345/mysql_sandbox12345.sock
|
||||
pid-file = /tmp/12345/data/mysql_sandbox12345.pid
|
||||
basedir = /home/hugmeir/mysql5/mysqlbrew/mysqls/Percona-Server-5.1/
|
||||
datadir = /tmp/12345/data
|
||||
key_buffer_size = 16M
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_data_home_dir = /tmp/12345/data
|
||||
innodb_log_group_home_dir = /tmp/12345/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_file_size = 5M
|
||||
log-bin = mysql-bin
|
||||
relay_log = mysql-relay-bin
|
||||
log_slave_updates
|
||||
server-id = 12345
|
||||
report-host = 127.0.0.1
|
||||
report-port = 12345
|
||||
log-error = mysqld.log
|
||||
innodb_lock_wait_timeout = 3
|
@@ -363,7 +363,7 @@ version_compile_machine i686
|
||||
version_compile_os Linux
|
||||
wait_timeout 28800
|
||||
pt-summary-internal-current_time 2012-03-22 18:50
|
||||
pt-summary-internal-Config_File /etc/mysql/my.cnf
|
||||
pt-summary-internal-Config_File_path /etc/mysql/my.cnf
|
||||
pt-summary-internal-now 2012-03-23 21:05:32
|
||||
pt-summary-internal-user hugmeir@localhost
|
||||
pt-summary-internal-FNV_64 Unknown
|
||||
|
26
t/pt-mysql-summary/samples/temp003/mysql-config-file
Normal file
26
t/pt-mysql-summary/samples/temp003/mysql-config-file
Normal file
@@ -0,0 +1,26 @@
|
||||
[client]
|
||||
user = msandbox
|
||||
password = msandbox
|
||||
port = 12345
|
||||
socket = /tmp/12345/mysql_sandbox12345.sock
|
||||
|
||||
[mysqld]
|
||||
port = 12345
|
||||
socket = /tmp/12345/mysql_sandbox12345.sock
|
||||
pid-file = /tmp/12345/data/mysql_sandbox12345.pid
|
||||
basedir = /home/hugmeir/mysql5/mysqlbrew/mysqls/Percona-Server-5.1/
|
||||
datadir = /tmp/12345/data
|
||||
key_buffer_size = 16M
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_data_home_dir = /tmp/12345/data
|
||||
innodb_log_group_home_dir = /tmp/12345/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_file_size = 5M
|
||||
log-bin = mysql-bin
|
||||
relay_log = mysql-relay-bin
|
||||
log_slave_updates
|
||||
server-id = 12345
|
||||
report-host = 127.0.0.1
|
||||
report-port = 12345
|
||||
log-error = mysqld.log
|
||||
innodb_lock_wait_timeout = 3
|
@@ -275,7 +275,7 @@ warning_count 0
|
||||
internal::nice_of_1529 0
|
||||
internal::oom_of_1529 0
|
||||
pt-summary-internal-current_time 2012-03-27 16:15
|
||||
pt-summary-internal-Config_File /tmp/12345/my.sandbox.cnf
|
||||
pt-summary-internal-Config_File_path /tmp/12345/my.sandbox.cnf
|
||||
pt-summary-internal-mysql_executable /home/vagrant/mysql-5.1.49-barebones/bin/mysql
|
||||
pt-summary-internal-now 2012-03-27 16:33:46
|
||||
pt-summary-internal-user msandbox@%
|
||||
|
26
t/pt-mysql-summary/samples/temp004/mysql-config-file
Normal file
26
t/pt-mysql-summary/samples/temp004/mysql-config-file
Normal file
@@ -0,0 +1,26 @@
|
||||
[client]
|
||||
user = msandbox
|
||||
password = msandbox
|
||||
port = 12345
|
||||
socket = /tmp/12345/mysql_sandbox12345.sock
|
||||
|
||||
[mysqld]
|
||||
port = 12345
|
||||
socket = /tmp/12345/mysql_sandbox12345.sock
|
||||
pid-file = /tmp/12345/data/mysql_sandbox12345.pid
|
||||
basedir = /home/hugmeir/mysql5/mysqlbrew/mysqls/Percona-Server-5.1/
|
||||
datadir = /tmp/12345/data
|
||||
key_buffer_size = 16M
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_data_home_dir = /tmp/12345/data
|
||||
innodb_log_group_home_dir = /tmp/12345/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_file_size = 5M
|
||||
log-bin = mysql-bin
|
||||
relay_log = mysql-relay-bin
|
||||
log_slave_updates
|
||||
server-id = 12345
|
||||
report-host = 127.0.0.1
|
||||
report-port = 12345
|
||||
log-error = mysqld.log
|
||||
innodb_lock_wait_timeout = 3
|
@@ -275,7 +275,7 @@ warning_count 0
|
||||
internal::nice_of_2837 0
|
||||
internal::oom_of_2837 0
|
||||
pt-summary-internal-current_time 2012-03-27 09:09
|
||||
pt-summary-internal-Config_File /tmp/12345/my.sandbox.cnf
|
||||
pt-summary-internal-Config_File_path /tmp/12345/my.sandbox.cnf
|
||||
pt-summary-internal-mysql_executable /usr/bin/mysql
|
||||
pt-summary-internal-now 2012-03-27 09:16:44
|
||||
pt-summary-internal-user msandbox@%
|
||||
|
26
t/pt-mysql-summary/samples/tempdir/mysql-config-file
Normal file
26
t/pt-mysql-summary/samples/tempdir/mysql-config-file
Normal file
@@ -0,0 +1,26 @@
|
||||
[client]
|
||||
user = msandbox
|
||||
password = msandbox
|
||||
port = 12345
|
||||
socket = /tmp/12345/mysql_sandbox12345.sock
|
||||
|
||||
[mysqld]
|
||||
port = 12345
|
||||
socket = /tmp/12345/mysql_sandbox12345.sock
|
||||
pid-file = /tmp/12345/data/mysql_sandbox12345.pid
|
||||
basedir = /home/hugmeir/mysql5/mysqlbrew/mysqls/Percona-Server-5.1/
|
||||
datadir = /tmp/12345/data
|
||||
key_buffer_size = 16M
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_data_home_dir = /tmp/12345/data
|
||||
innodb_log_group_home_dir = /tmp/12345/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_file_size = 5M
|
||||
log-bin = mysql-bin
|
||||
relay_log = mysql-relay-bin
|
||||
log_slave_updates
|
||||
server-id = 12345
|
||||
report-host = 127.0.0.1
|
||||
report-port = 12345
|
||||
log-error = mysqld.log
|
||||
innodb_lock_wait_timeout = 3
|
@@ -277,7 +277,7 @@ warning_count 0
|
||||
pt-summary-internal-now 2012-02-22 06:24:23
|
||||
pt-summary-internal-current_time 2012-02-22 06:21
|
||||
pt-summary-internal-user
|
||||
pt-summary-internal-Config_File /etc/mysql/my.cnf
|
||||
pt-summary-internal-Config_File_path /etc/mysql/my.cnf
|
||||
pt-summary-internal-FNV_64 Unknown
|
||||
pt-summary-internal-trigger_count 0
|
||||
pt-summary-internal-symbols No
|
||||
|
Reference in New Issue
Block a user