PR-140 - Add CPU cache configuration info to pt-summary

- Merge branch '3.x' into HEAD
- Move code to the proper place: library files
- Fix tests
This commit is contained in:
Sveta Smirnova
2024-01-25 01:41:20 +03:00
2167 changed files with 297347 additions and 29069 deletions

View File

@@ -16,6 +16,10 @@ source "$LIB_DIR/safeguards.sh"
source "$LIB_DIR/alt_cmds.sh"
source "$LIB_DIR/collect.sh"
# We need flush tables, otherwise we won't have stable results for opentables tests
CMD_MYSQL="$(_which mysql)"
$CMD_MYSQL --defaults-file=/tmp/12345/my.sandbox.cnf -ss -e 'FLUSH TABLES'
parse_options "$BIN_DIR/pt-stalk" --run-time 1 -- --defaults-file=/tmp/12345/my.sandbox.cnf
# Prefix (with path) for the collect files.
@@ -26,6 +30,8 @@ collect "$PT_TMPDIR/collect" "2011_12_05" > $p-output 2>&1
wait_for_files "$p-hostname" "$p-opentables2" "$p-variables" "$p-df" "$p-innodbstatus2"
cat "$p-opentables2" > /tmp/collect.test
# Even if this system doesn't have all the cmds, collect should still
# have created some files for cmds that (hopefully) all systems have.
ls -1 $PT_TMPDIR/collect | sort > $PT_TMPDIR/collect-files
@@ -68,15 +74,6 @@ cmd_ok \
"grep -q 'error log seems to be .*/mysqld.log' $p-output" \
"Finds MySQL error log"
if [[ "$SANDBOX_VERSION" > "5.0" ]]; then
wait_for_files "$p-log_error"
cmd_ok \
"grep -qE 'Memory status|Open streams|Begin safemalloc' $p-log_error" \
"debug"
else
is "1" "1" "SKIP Can't determine MySQL 5.0 error log"
fi
if [ "$(which lsof 2>/dev/null)" ]; then
cmd_ok \
"grep -q 'COMMAND[ ]\+PID[ ]\+USER' $p-lsof" \
@@ -126,7 +123,10 @@ for file in $p-*; do
empty_files=1
break
fi
if [ -z "$(grep -v '^TS ' --max-count 1 $file)" ]; then
# We need additional check here in case if first match
# is empty string.
if [ 0 -eq "$(grep -vc '^TS ' --max-count 1 $file)" ] ||
[ 0 -eq "$(grep -vc '^$' --max-count 1 $file)" ]; then
empty_files=1
break
fi
@@ -134,6 +134,37 @@ done
is "$empty_files" "0" "No empty files"
# ###########################################################################
# Debug option for mysqladmin is not default now, we will test it separately.
# ###########################################################################
#Skipping until PT-2242 is fixed
if false; then
parse_options "$BIN_DIR/pt-stalk" --run-time 2 -- --defaults-file=/tmp/12345/my.sandbox.cnf
rm $PT_TMPDIR/collect/*
# Prefix (with path) for the collect files.
p="$PT_TMPDIR/collect/2011_12_05"
CMD_MYSQLADMIN="mysqladmin debug"
# Default collect, no extras like gdb, tcpdump, etc.
collect "$PT_TMPDIR/collect" "2011_12_05" > $p-output 2>&1
wait_for_files "$p-hostname" "$p-opentables2" "$p-variables" "$p-df" "$p-innodbstatus2"
if [[ "$SANDBOX_VERSION" > "5.0" ]]; then
wait_for_files "$p-log_error"
cmd_ok \
"grep -qE 'Memory status|Open streams|Begin safemalloc' $p-log_error" \
"debug"
else
is "1" "1" "SKIP Can't determine MySQL 5.0 error log"
fi
else
is "1" "1" "SKIP until PT-2242 is fixed"
fi
# ###########################################################################
# Try longer run time.
# ###########################################################################

View File

@@ -42,9 +42,9 @@ wait
file_count=$(ls "$p" | wc -l)
if [ "$sys_cnf_file" ]; then
n_files=14
n_files=18
else
n_files=13
n_files=17
fi
is $file_count $n_files "Creates the correct number of files (without --databases)"

View File

@@ -218,9 +218,9 @@ else
skip 1 5 "Tests exclusive for Linux"
fi
# propietary_raid_controller
# proprietary_raid_controller
test_propietary_raid_controller () {
test_proprietary_raid_controller () {
local dir="$1"
local CMD_ARCCONF=""
@@ -232,24 +232,24 @@ test_propietary_raid_controller () {
for controller in "AACRAID" "HP Smart Array" "LSI Logic MegaRAID SAS"; do
rm "$dir/1/summary" 2>/dev/null
touch "$dir/1/summary"
propietary_raid_controller "$dir/1/raid-controller" "$dir/1/summary" "$dir/1" "$controller"
proprietary_raid_controller "$dir/1/raid-controller" "$dir/1/summary" "$dir/1" "$controller"
is \
"$(get_var "internal::raid_opt" "$dir/1/summary")" \
0 \
"propietary_raid_controller: correct raid_opt default for $controller"
"proprietary_raid_controller: correct raid_opt default for $controller"
cmd_ok \
"grep -q 'RAID controller software not found' \"$dir/1/raid-controller\"" \
"propietary_raid_controller: correct default for $controller if the command isn't available"
"proprietary_raid_controller: correct default for $controller if the command isn't available"
done
mkdir "$dir/2"
fake_command arcconf "ok arcconf"
propietary_raid_controller "$dir/2/raid-controller" "$dir/2/summary" "$dir/2" "AACRAID"
proprietary_raid_controller "$dir/2/raid-controller" "$dir/2/summary" "$dir/2" "AACRAID"
is \
"$(get_var "internal::raid_opt" "$dir/2/summary")" \
1 \
"propietary_raid_controller: correct raid_opt default for $controller when arcconf is there"
"proprietary_raid_controller: correct raid_opt default for $controller when arcconf is there"
is \
"$(cat "$dir/2/raid-controller")" \
@@ -258,7 +258,7 @@ test_propietary_raid_controller () {
}
mkdir "$PT_TMPDIR/raid_controller"
test_propietary_raid_controller "$PT_TMPDIR/raid_controller"
test_proprietary_raid_controller "$PT_TMPDIR/raid_controller"
# notable_processes_info

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
plan 44
plan 46
. "$LIB_DIR/alt_cmds.sh"
. "$LIB_DIR/log_warn_die.sh"
@@ -231,7 +231,8 @@ is \
echo "INNODB_CMP ACTIVE" >> $PT_TMPDIR/plugins
is \
"$(get_plugin_status $PT_TMPDIR/plugins "INNODB_CMP" )" \
"ACTIVE"
"ACTIVE" \
"InnoDB compression active"
cat <<EOF > $PT_TMPDIR/plugins
binlog ACTIVE STORAGE ENGINE NULL GPL
@@ -476,7 +477,7 @@ cat <<EOF > "$PT_TMPDIR/expected"
EOF
format_overall_db_stats "$samples/mysql-schema-001.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "format_overall_db_stats"
cat <<EOF > $PT_TMPDIR/expected
@@ -719,7 +720,10 @@ OPT_READ_SAMPLES=""
OPT_ALL_DATABASES=""
NAME_VAL_LEN=25
report_mysql_summary "$samples/tempdir" | tail -n+3 > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$samples/expected_result_report_summary.txt"
no_diff \
"$PT_TMPDIR/got" \
"$samples/expected_result_report_summary.txt" \
"report_mysql_summary, default result"
_NO_FALSE_NEGATIVES=""
OPT_SLEEP=10
@@ -753,6 +757,18 @@ no_diff \
"$samples/expected_output_temp007.txt" \
"report_mysql_summary, dir: temp007 (PXC, traditional master)"
report_mysql_summary "$samples/temp_enc008" 2>/dev/null | tail -n+3 > "$PT_TMPDIR/got"
no_diff \
"$PT_TMPDIR/got" \
"$samples/expected_output_temp_enc008.txt" \
"report_mysql_summary, dir: temp_enc008 (libjemalloc, encryption)"
report_mysql_summary "$samples/temp_enc009" 2>/dev/null | tail -n+3 > "$PT_TMPDIR/got"
no_diff \
"$PT_TMPDIR/got" \
"$samples/expected_output_temp_enc009.txt" \
"report_mysql_summary, dir: temp_enc009 (keyring plugin, MyRocks)"
# ###########################################################################
# parse_wsrep_provider_options
# ###########################################################################
@@ -803,7 +819,6 @@ no_diff \
"Bug 1015590: section_percona_server_features works on 5.1 with innodb_adaptive_checkpoint=none"
section_percona_server_features "$samples/percona-server-5.1-variables-martin" > "$PT_TMPDIR/got"
cp "$PT_TMPDIR/got" /tmp/dasgot
no_diff \
"$PT_TMPDIR/got" \
"$samples/expected_output_ps-5.1-martin.txt" \

View File

@@ -768,6 +768,7 @@ cat <<EOF > "$PT_TMPDIR/expected"
Total | 3.9G
Free | 1.4G
Used | physical = 2.5G, swap allocated = 4.9G, swap used = 0.0, virtual = 2.5G
Shared | 0.0
Buffers | 131.8M
Caches | 1.9G
Dirty | 60 kB
@@ -832,6 +833,7 @@ cat <<EOF > "$PT_TMPDIR/expected"
Total | 1010.5M
Free | 784.4M
Used | physical = 226.1M, swap allocated = 2.0G, swap used = 0.0, virtual = 226.1M
Shared | 0.0
Buffers | 48.8M
Caches | 122.2M
Dirty | 152 kB
@@ -1316,10 +1318,10 @@ Architecture | CPU = 32-bit, OS = 32-bit
Speeds | 2109
Models | AMD Athlon(tm) 64 X2 Dual Core Processor 4000+
# Memory #####################################################
Total | 499.4M
Virtual | 511.9M
Used | 66.4M
UsedRSS | 17.7M
Total | 499.4M
Virtual | 511.9M
Used | 66.4M
UsedRSS | 17.7M
# Mounted Filesystems ########################################
Filesystem Size Used Type Opts Mountpoint
/dev/ad0s1a 620M 30% ufs local /
@@ -1353,6 +1355,8 @@ Architecture | CPU = 32-bit, OS = 32-bit
0 0 0 58164 339792 0 0 0 0 0 0 0 0 230 107 231 0 9 91
0 0 0 58164 339792 0 0 0 0 0 0 0 0 230 107 229 0 3 97
0 0 0 58164 339792 0 0 0 0 0 0 0 0 231 115 229 0 5 95
# Memory management ##########################################
Transparent huge pages are enabled.
# The End ####################################################
EOF
report_system_summary "$samples/BSD/freebsd_001" | tail -n +3 > "$PT_TMPDIR/got"
@@ -1372,10 +1376,10 @@ Architecture | CPU = 32-bit, OS = 32-bit
Models | 1xAMD Athlon(tm) 64 X2 Dual Core Processor 4000+
Caches |
# Memory #####################################################
Total | 127.6M
User | 127.2M
Swap | 64.5M
UsedRSS | 10.6M
Total | 127.6M
User | 127.2M
Swap | 64.5M
UsedRSS | 10.6M
# Mounted Filesystems ########################################
Filesystem Size Used Type Opts Mountpoint
/dev/sd0e 3.8G 0% yp dev/sd0e 3.8G 17M 3.7G 0% /mnt/usb on /mnt/usb type msdos (local /mnt/usb
@@ -1407,6 +1411,8 @@ Architecture | CPU = 32-bit, OS = 32-bit
0 0 0 78564 21364 1208 0 0 0 0 0 0 0 98 806 43 2 9 89
0 0 0 78564 21364 0 0 0 0 0 0 0 0 101 11 9 0 0 100
0 0 0 78564 21364 0 0 0 0 0 0 0 0 101 11 10 0 0 100
# Memory management ##########################################
Transparent huge pages are enabled.
# The End ####################################################
EOF
report_system_summary "$samples/BSD/netbsd_001" | tail -n +3 > "$PT_TMPDIR/got"
@@ -1425,10 +1431,10 @@ Architecture | CPU = 32-bit, OS = 32-bit
Speeds | 2111
Models | AMD
# Memory #####################################################
Total | 255.5M
User | 255.5M
Swap | 81.1M
UsedRSS | 5.3M
Total | 255.5M
User | 255.5M
Swap | 81.1M
UsedRSS | 5.3M
# Mounted Filesystems ########################################
Filesystem Size Used Type Opts Mountpoint
/dev/sd0i 3.8G 0% yp long /mnt/usb
@@ -1459,6 +1465,8 @@ Architecture | CPU = 32-bit, OS = 32-bit
1 0 0 7600 191360 9461 0 0 0 0 0 0 0 256 14435 285 6 94 0
0 0 0 7496 191456 1272 0 0 0 0 0 0 0 256 1973 50 2 12 85
0 0 0 7496 191456 11 0 0 0 0 0 0 0 230 23 12 0 0 100
# Memory management ##########################################
Transparent huge pages are enabled.
# The End ####################################################
EOF
report_system_summary "$samples/BSD/openbsd_001" | tail -n +3 > "$PT_TMPDIR/got"
@@ -1481,16 +1489,21 @@ Architecture | CPU = 32-bit, OS = 32-bit
Speeds | 1x1000.000, 1x1666.000
Models | 2xIntel(R) Atom(TM) CPU N455 @ 1.66GHz
Caches | 2x512 KB
Designation Configuration Size Associativity
========================= ============================== ======== ======================
Unknown Enabled, Not Socketed, Level 2 512 KB 8-way Set-associative
Unknown Enabled, Not Socketed, Level 1 32 KB 8-way Set-associative
# Memory #####################################################
Total | 2.0G
Free | 477.3M
Used | physical = 1.5G, swap allocated = 2.0G, swap used = 0.0, virtual = 1.5G
Buffers | 194.9M
Caches | 726.8M
Dirty | 144 kB
UsedRSS | 1.1G
Swappiness | 60
DirtyPolicy | 20, 10
Total | 2.0G
Free | 477.3M
Used | physical = 1.5G, swap allocated = 2.0G, swap used = 0.0, virtual = 1.5G
Shared | 0.0
Buffers | 194.9M
Caches | 726.8M
Dirty | 144 kB
UsedRSS | 1.1G
Swappiness | 60
DirtyPolicy | 20, 10
Locator Size Speed Form Factor Type Type Detail
========= ======== ================= ============= ============= ===========
DIMM0 2048 MB 667 MHz (1.5 ns) SODIMM DDR2 Synchronous
@@ -1511,7 +1524,7 @@ Architecture | CPU = 32-bit, OS = 32-bit
# Disk Schedulers And Queue Size #############################
sda | [cfq] 128
sdb | [cfq] 128
# Disk Partioning ############################################
# Disk Partitioning ##########################################
Device Type Start End Size
============ ==== ========== ========== ==================
/dev/sda Disk 500107862016
@@ -1577,6 +1590,8 @@ Unable to collect information
0 0 0 0 0 0 200 200 1 0 99 0
1 0 0 0 0 150 225 225 1 1 95 3
0 0 0 0 0 150 250 250 1 0 99 0
# Memory management ##########################################
Transparent huge pages are enabled.
# The End ####################################################
EOF