mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-02 02:34:19 +00:00
Merge branch '3.x' into HEAD
This commit is contained in:
@@ -111,11 +111,30 @@ sub _parse_config {
|
||||
}
|
||||
elsif ( my $dbh = $args{dbh} ) {
|
||||
$config_data{format} = $args{format} || 'show_variables';
|
||||
my $mysql_version = _get_version($dbh);
|
||||
my $sql = "SHOW /*!40103 GLOBAL*/ VARIABLES";
|
||||
PTDEBUG && _d($dbh, $sql);
|
||||
my $rows = $dbh->selectall_arrayref($sql);
|
||||
$config_data{vars} = { map { @$_ } @$rows };
|
||||
$config_data{mysql_version} = _get_version($dbh);
|
||||
$config_data{vars} = {
|
||||
map {
|
||||
my ($variable, $value) = @$_;
|
||||
# Starting from MySQL 5.7.6, SHOW VARIABLES retrieves records from
|
||||
# the performance_schema table named GLOBAL_VARIABLES. This table
|
||||
# stores variable values in a VARCHAR(1024) column, meaning longer
|
||||
# values may be truncated. However, the full value can still be
|
||||
# retrieved by accessing the variable with SELECT @@GLOBAL.
|
||||
# https://dev.mysql.com/doc/refman/5.7/en/information-schema-variables-table.html
|
||||
if ( length($value) == 1024 && $mysql_version ge '5.7.0' ) {
|
||||
my $var_sql = "SELECT \@\@global.$variable";
|
||||
PTDEBUG && _d($dbh, $var_sql);
|
||||
my $var_sth = $dbh->prepare($var_sql);
|
||||
$var_sth->execute();
|
||||
($value) = $var_sth->fetchrow_array();
|
||||
}
|
||||
$variable => $value
|
||||
} @$rows
|
||||
};
|
||||
$config_data{mysql_version} = $mysql_version;
|
||||
}
|
||||
else {
|
||||
die "Unknown config source";
|
||||
|
@@ -406,7 +406,9 @@ sub _parse_specs {
|
||||
# These defaults from the POD may be overridden by later calls
|
||||
# to set_defaults().
|
||||
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
|
||||
$self->{defaults}->{$long} = defined $def ? $def : 1;
|
||||
$def = defined $def ? $def : 1;
|
||||
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
|
||||
$self->{defaults}->{$long} = $def;
|
||||
PTDEBUG && _d($long, 'default:', $def);
|
||||
}
|
||||
|
||||
@@ -666,6 +668,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
|
@@ -181,7 +181,7 @@ sub version_check {
|
||||
}
|
||||
|
||||
# Always update the vc file, even if the version check fails.
|
||||
if ( @$instances_to_check ) {
|
||||
if ( $instances_to_check and @$instances_to_check ) {
|
||||
eval {
|
||||
# Update the check time for things we checked. I.e. if we
|
||||
# didn't check it, do _not_ update its time.
|
||||
|
@@ -286,8 +286,15 @@ collect_system_data() {
|
||||
}
|
||||
|
||||
collect_mysql_data_loop() {
|
||||
(echo $ts; $CMD_MYSQL $EXT_ARGV -e "SHOW FULL PROCESSLIST\G") \
|
||||
|
||||
# SHOW FULL PROCESSLIST duplicates information in performance_schema.threads we collecting now
|
||||
# Keeping it for backward compatibility and may remove in the future
|
||||
|
||||
(echo $ts; $CMD_MYSQL $EXT_ARGV -e "SHOW FULL PROCESSLIST\G") \
|
||||
>> "$d/$p-processlist" &
|
||||
(echo $ts; $CMD_MYSQL $EXT_ARGV -e "SELECT * FROM performance_schema.threads\G") \
|
||||
>> "$d/$p-threads" &
|
||||
|
||||
if [ "$have_lock_waits_table" ]; then
|
||||
(echo $ts; lock_waits "$d/lock_waits.running") >>"$d/$p-lock-waits" &
|
||||
(echo $ts; transactions) >>"$d/$p-transactions" &
|
||||
|
Reference in New Issue
Block a user