mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-13 22:50:25 +00:00
PT-1536 Updated samples for mysql-summary tests
This commit is contained in:
@@ -1185,6 +1185,10 @@ collect_encrypted_tables() {
|
|||||||
$CMD_MYSQL $EXT_ARGV --table -ss -e "SELECT TABLE_SCHEMA, TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE CREATE_OPTIONS LIKE '%ENCRYPTION=\"Y\"%';"
|
$CMD_MYSQL $EXT_ARGV --table -ss -e "SELECT TABLE_SCHEMA, TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE CREATE_OPTIONS LIKE '%ENCRYPTION=\"Y\"%';"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
collect_encrypted_tablespaces() {
|
||||||
|
$CMD_MYSQL $EXT_ARGV --table -ss -e "SELECT SPACE, NAME, SPACE_TYPE from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES where FLAG&8192 = 8192;"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_NO_FALSE_NEGATIVES=""
|
_NO_FALSE_NEGATIVES=""
|
||||||
@@ -1630,6 +1634,14 @@ format_encrypted_tables() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
format_encrypted_tablespaces() {
|
||||||
|
local encrypted_tablespaces="$1"
|
||||||
|
if [ ! -z "$encrypted_tablespaces" ]; then
|
||||||
|
echo "Encrypted tablespaces:"
|
||||||
|
echo "$encrypted_tablespaces"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
format_mysql_roles() {
|
format_mysql_roles() {
|
||||||
local file=$1
|
local file=$1
|
||||||
[ -e "$file" ] || return
|
[ -e "$file" ] || return
|
||||||
@@ -2510,12 +2522,15 @@ report_mysql_summary () {
|
|||||||
section "Encryption"
|
section "Encryption"
|
||||||
local keyring_plugins="$(collect_keyring_plugins)"
|
local keyring_plugins="$(collect_keyring_plugins)"
|
||||||
local encrypted_tables=""
|
local encrypted_tables=""
|
||||||
|
local encrypted_tablespaces=""
|
||||||
if [ ${OPT_LIST_ENCRYPTED_TABLES} == 'yes' ]; then
|
if [ ${OPT_LIST_ENCRYPTED_TABLES} == 'yes' ]; then
|
||||||
encrypted_tables="$(collect_encrypted_tables)"
|
encrypted_tables="$(collect_encrypted_tables)"
|
||||||
|
encrypted_tablespaces="$(collect_encrypted_tablespaces)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
format_keyring_plugins "$keyring_plugins" "$encrypted_tables"
|
format_keyring_plugins "$keyring_plugins" "$encrypted_tables"
|
||||||
format_encrypted_tables "$encrypted_tables"
|
format_encrypted_tables "$encrypted_tables"
|
||||||
|
format_encrypted_tablespaces "$encrypted_tablespaces"
|
||||||
|
|
||||||
section "Binary Logging"
|
section "Binary Logging"
|
||||||
|
|
||||||
|
@@ -115,6 +115,12 @@ collect_encrypted_tables() {
|
|||||||
$CMD_MYSQL $EXT_ARGV --table -ss -e "SELECT TABLE_SCHEMA, TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE CREATE_OPTIONS LIKE '%ENCRYPTION=\"Y\"%';"
|
$CMD_MYSQL $EXT_ARGV --table -ss -e "SELECT TABLE_SCHEMA, TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE CREATE_OPTIONS LIKE '%ENCRYPTION=\"Y\"%';"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
collect_encrypted_tablespaces() {
|
||||||
|
# I_S.INNODB_SYS_TABLESPACES has a "flag" field. Encrypted tablespace has bit 14 set. You can check it with "flag & 8192".
|
||||||
|
# And seems like MySQL is capable of bitwise operations. https://dev.mysql.com/doc/refman/5.7/en/bit-functions.html
|
||||||
|
$CMD_MYSQL $EXT_ARGV --table -ss -e "SELECT SPACE, NAME, SPACE_TYPE from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES where FLAG&8192 = 8192;"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# ##############################################################################
|
# ##############################################################################
|
||||||
# Functions for parsing specific files and getting desired info from them.
|
# Functions for parsing specific files and getting desired info from them.
|
||||||
@@ -597,6 +603,14 @@ format_encrypted_tables() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
format_encrypted_tablespaces() {
|
||||||
|
local encrypted_tablespaces="$1"
|
||||||
|
if [ ! -z "$encrypted_tablespaces" ]; then
|
||||||
|
echo "Encrypted tablespaces:"
|
||||||
|
echo "$encrypted_tablespaces"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
format_mysql_roles() {
|
format_mysql_roles() {
|
||||||
local file=$1
|
local file=$1
|
||||||
[ -e "$file" ] || return
|
[ -e "$file" ] || return
|
||||||
@@ -1568,12 +1582,15 @@ report_mysql_summary () {
|
|||||||
section "Encryption"
|
section "Encryption"
|
||||||
local keyring_plugins="$(collect_keyring_plugins)"
|
local keyring_plugins="$(collect_keyring_plugins)"
|
||||||
local encrypted_tables=""
|
local encrypted_tables=""
|
||||||
|
local encrypted_tablespaces=""
|
||||||
if [ ${OPT_LIST_ENCRYPTED_TABLES} == 'yes' ]; then
|
if [ ${OPT_LIST_ENCRYPTED_TABLES} == 'yes' ]; then
|
||||||
encrypted_tables="$(collect_encrypted_tables)"
|
encrypted_tables="$(collect_encrypted_tables)"
|
||||||
|
encrypted_tablespaces="$(collect_encrypted_tablespaces)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
format_keyring_plugins "$keyring_plugins" "$encrypted_tables"
|
format_keyring_plugins "$keyring_plugins" "$encrypted_tables"
|
||||||
format_encrypted_tables "$encrypted_tables"
|
format_encrypted_tables "$encrypted_tables"
|
||||||
|
format_encrypted_tablespaces "$encrypted_tablespaces"
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Binary Logging
|
# Binary Logging
|
||||||
|
@@ -9,16 +9,37 @@ BEGIN {
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings FATAL => 'all';
|
use warnings FATAL => 'all';
|
||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
|
|
||||||
use PerconaTest;
|
use PerconaTest;
|
||||||
|
use Sandbox;
|
||||||
my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/;
|
use DSNParser;
|
||||||
|
require VersionParser;
|
||||||
use Test::More;
|
use Test::More;
|
||||||
use File::Temp qw( tempdir );
|
use File::Temp qw( tempdir );
|
||||||
|
|
||||||
local $ENV{PTDEBUG} = "";
|
local $ENV{PTDEBUG} = "";
|
||||||
|
|
||||||
|
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||||
|
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||||
|
my $master_dbh = $sb->get_dbh_for('master');
|
||||||
|
my $has_keyring_plugin;
|
||||||
|
|
||||||
|
my $db_flavor = VersionParser->new($master_dbh)->flavor();
|
||||||
|
if ( $db_flavor =~ m/Percona Server/ ) {
|
||||||
|
my $rows = $master_dbh->selectall_hashref("SHOW PLUGINS", "name");
|
||||||
|
while (my ($key, $values) = each %$rows) {
|
||||||
|
if ($key =~ m/^keyring_/) {
|
||||||
|
$has_keyring_plugin=1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($has_keyring_plugin) {
|
||||||
|
plan skip_all => 'Keyring plugins are enabled.';
|
||||||
|
}
|
||||||
|
|
||||||
|
my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/;
|
||||||
|
|
||||||
# mysqldump from earlier versions doesn't seem to work with 5.6,
|
# mysqldump from earlier versions doesn't seem to work with 5.6,
|
||||||
# so use the actual mysqldump from each MySQL bin which should
|
# so use the actual mysqldump from each MySQL bin which should
|
||||||
# always be compatible with itself.
|
# always be compatible with itself.
|
||||||
|
@@ -222,6 +222,8 @@ Uptime 90000 1 1
|
|||||||
# Security ###################################################
|
# Security ###################################################
|
||||||
Users | 6 users, 0 anon, 1 w/o pw, 1 old pw
|
Users | 6 users, 0 anon, 1 w/o pw, 1 old pw
|
||||||
Old Passwords | OFF
|
Old Passwords | OFF
|
||||||
|
# Encryption #################################################
|
||||||
|
No keyring plugins found
|
||||||
# Binary Logging #############################################
|
# Binary Logging #############################################
|
||||||
# Noteworthy Variables #######################################
|
# Noteworthy Variables #######################################
|
||||||
Auto-Inc Incr/Offset | 1/1
|
Auto-Inc Incr/Offset | 1/1
|
||||||
@@ -275,4 +277,5 @@ report-port = 12345
|
|||||||
log-error = mysqld.log
|
log-error = mysqld.log
|
||||||
innodb_lock_wait_timeout = 3
|
innodb_lock_wait_timeout = 3
|
||||||
# Memory management library ##################################
|
# Memory management library ##################################
|
||||||
|
Jemalloc library not found
|
||||||
# The End ####################################################
|
# The End ####################################################
|
||||||
|
@@ -156,6 +156,8 @@ Specify --databases or --all-databases to dump and summarize schemas
|
|||||||
# Security ###################################################
|
# Security ###################################################
|
||||||
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
|
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
|
||||||
Old Passwords | OFF
|
Old Passwords | OFF
|
||||||
|
# Encryption #################################################
|
||||||
|
No keyring plugins found
|
||||||
# Binary Logging #############################################
|
# Binary Logging #############################################
|
||||||
Binlogs | 1
|
Binlogs | 1
|
||||||
Zero-Sized | 0
|
Zero-Sized | 0
|
||||||
@@ -218,4 +220,5 @@ report-port = 12345
|
|||||||
log-error = mysqld.log
|
log-error = mysqld.log
|
||||||
innodb_lock_wait_timeout = 3
|
innodb_lock_wait_timeout = 3
|
||||||
# Memory management library ##################################
|
# Memory management library ##################################
|
||||||
|
Jemalloc library not found
|
||||||
# The End ####################################################
|
# The End ####################################################
|
||||||
|
@@ -155,6 +155,8 @@ Specify --databases or --all-databases to dump and summarize schemas
|
|||||||
# Security ###################################################
|
# Security ###################################################
|
||||||
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
|
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
|
||||||
Old Passwords | OFF
|
Old Passwords | OFF
|
||||||
|
# Encryption #################################################
|
||||||
|
No keyring plugins found
|
||||||
# Binary Logging #############################################
|
# Binary Logging #############################################
|
||||||
Binlogs | 2
|
Binlogs | 2
|
||||||
Zero-Sized | 0
|
Zero-Sized | 0
|
||||||
@@ -217,4 +219,5 @@ report-port = 12345
|
|||||||
log-error = mysqld.log
|
log-error = mysqld.log
|
||||||
innodb_lock_wait_timeout = 3
|
innodb_lock_wait_timeout = 3
|
||||||
# Memory management library ##################################
|
# Memory management library ##################################
|
||||||
|
Jemalloc library not found
|
||||||
# The End ####################################################
|
# The End ####################################################
|
||||||
|
@@ -228,6 +228,8 @@ Uptime 90000 1 1
|
|||||||
# Security ###################################################
|
# Security ###################################################
|
||||||
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
|
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
|
||||||
Old Passwords | OFF
|
Old Passwords | OFF
|
||||||
|
# Encryption #################################################
|
||||||
|
No keyring plugins found
|
||||||
# Binary Logging #############################################
|
# Binary Logging #############################################
|
||||||
Binlogs | 1
|
Binlogs | 1
|
||||||
Zero-Sized | 0
|
Zero-Sized | 0
|
||||||
@@ -290,4 +292,5 @@ report-port = 12345
|
|||||||
log-error = mysqld.log
|
log-error = mysqld.log
|
||||||
innodb_lock_wait_timeout = 3
|
innodb_lock_wait_timeout = 3
|
||||||
# Memory management library ##################################
|
# Memory management library ##################################
|
||||||
|
Jemalloc library not found
|
||||||
# The End ####################################################
|
# The End ####################################################
|
||||||
|
@@ -304,6 +304,8 @@ wsrep_cluster_size 100
|
|||||||
# Security ###################################################
|
# Security ###################################################
|
||||||
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
|
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
|
||||||
Old Passwords | OFF
|
Old Passwords | OFF
|
||||||
|
# Encryption #################################################
|
||||||
|
No keyring plugins found
|
||||||
# Binary Logging #############################################
|
# Binary Logging #############################################
|
||||||
Binlogs | 1
|
Binlogs | 1
|
||||||
Zero-Sized | 0
|
Zero-Sized | 0
|
||||||
@@ -339,4 +341,5 @@ log_queries_not_using_indexes | OFF
|
|||||||
# Configuration File #########################################
|
# Configuration File #########################################
|
||||||
Config File | Cannot autodetect or find, giving up
|
Config File | Cannot autodetect or find, giving up
|
||||||
# Memory management library ##################################
|
# Memory management library ##################################
|
||||||
|
Jemalloc library not found
|
||||||
# The End ####################################################
|
# The End ####################################################
|
||||||
|
@@ -258,6 +258,8 @@ wsrep_local_index 4000000000000 45000000
|
|||||||
# Security ###################################################
|
# Security ###################################################
|
||||||
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
|
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
|
||||||
Old Passwords | OFF
|
Old Passwords | OFF
|
||||||
|
# Encryption #################################################
|
||||||
|
No keyring plugins found
|
||||||
# Binary Logging #############################################
|
# Binary Logging #############################################
|
||||||
Binlogs | 1
|
Binlogs | 1
|
||||||
Zero-Sized | 0
|
Zero-Sized | 0
|
||||||
@@ -293,4 +295,5 @@ log_queries_not_using_indexes | OFF
|
|||||||
# Configuration File #########################################
|
# Configuration File #########################################
|
||||||
Config File | Cannot autodetect or find, giving up
|
Config File | Cannot autodetect or find, giving up
|
||||||
# Memory management library ##################################
|
# Memory management library ##################################
|
||||||
|
Jemalloc library not found
|
||||||
# The End ####################################################
|
# The End ####################################################
|
||||||
|
Reference in New Issue
Block a user