New fix for issue#7 about MySQL version reckognition

Adopting scop's idea to write more reliable verification
of MySQL's architecture version, both for local and remote servers.
This commit is contained in:
Dimiter 'Arruor' Nikov 2011-12-29 21:47:13 +02:00
parent 965745d85c
commit f75e9d039b

View file

@ -463,32 +463,29 @@ sub mysql_version_ge {
# Checks for 32-bit boxes with more than 2GB of RAM # Checks for 32-bit boxes with more than 2GB of RAM
my ($arch); my ($arch);
sub check_architecture { sub check_architecture {
if ($doremote eq 1) { # Checking MySQL compiled version
# Setting value for $arch variable to avoid warning about uninitialized if ($myvar{'version_compile_machine'} =~ /x86_64/) {
# variable (more details at https://github.com/rackerhacker/MySQLTuner-perl/issues/7) # We have 64-bit version of MySQL
# $id Dimiter "Arruor" Nikov exp
$arch = 0;
return;
}
if (`uname` =~ /SunOS/ && `isainfo -b` =~ /64/) {
$arch = 64; $arch = 64;
goodprint "Operating on 64-bit architecture\n"; goodprint "Operating on 64-bit version of MySQL\n";
} elsif (`uname` !~ /SunOS/ && `uname -m` =~ /64/) { } elsif ($myvar{'version_compile_machine'} =~ /i*86/) {
$arch = 64; # We have 32-bit version of MySQL
goodprint "Operating on 64-bit architecture\n";
} elsif (`uname` =~ /AIX/ && `bootinfo -K` =~ /64/) {
$arch = 64;
goodprint "Operating on 64-bit architecture\n";
} else {
$arch = 32; $arch = 32;
# Check for available memory and suggest switching to
# 64-bit version of mysql
if ($physical_memory > 2147483648) { if ($physical_memory > 2147483648) {
badprint "Switch to 64-bit OS - MySQL cannot currently use all of your RAM\n"; badprint "Switch to 64-bit version of MySQL\n";
badprint "MySQL cannot currently use all of your RAM\n";
} else { } else {
goodprint "Operating on 32-bit architecture with less than 2GB RAM\n"; goodprint "Operating on 32-bit version of MySQL with less than 2GB RAM\n";
}
} }
} else {
# Unknown version or missing compile string
$arch = 0;
badprint "Operating on unknown version of MySQL\n"
} }
} #end-sub-check_architecture
# Start up a ton of storage engine counts/statistics # Start up a ton of storage engine counts/statistics
my (%enginestats,%enginecount,$fragtables); my (%enginestats,%enginecount,$fragtables);