PT-1536 Updated samples for mysql-summary tests

This commit is contained in:
Carlos Salguero
2018-05-11 11:58:47 -03:00
parent 94e122adc0
commit b6526f6739
9 changed files with 75 additions and 4 deletions

View File

@@ -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\"%';"
}
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=""
@@ -1630,6 +1634,14 @@ format_encrypted_tables() {
fi
}
format_encrypted_tablespaces() {
local encrypted_tablespaces="$1"
if [ ! -z "$encrypted_tablespaces" ]; then
echo "Encrypted tablespaces:"
echo "$encrypted_tablespaces"
fi
}
format_mysql_roles() {
local file=$1
[ -e "$file" ] || return
@@ -2510,12 +2522,15 @@ report_mysql_summary () {
section "Encryption"
local keyring_plugins="$(collect_keyring_plugins)"
local encrypted_tables=""
local encrypted_tablespaces=""
if [ ${OPT_LIST_ENCRYPTED_TABLES} == 'yes' ]; then
encrypted_tables="$(collect_encrypted_tables)"
encrypted_tablespaces="$(collect_encrypted_tablespaces)"
fi
format_keyring_plugins "$keyring_plugins" "$encrypted_tables"
format_encrypted_tables "$encrypted_tables"
format_encrypted_tablespaces "$encrypted_tablespaces"
section "Binary Logging"

View File

@@ -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\"%';"
}
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.
@@ -597,6 +603,14 @@ format_encrypted_tables() {
fi
}
format_encrypted_tablespaces() {
local encrypted_tablespaces="$1"
if [ ! -z "$encrypted_tablespaces" ]; then
echo "Encrypted tablespaces:"
echo "$encrypted_tablespaces"
fi
}
format_mysql_roles() {
local file=$1
[ -e "$file" ] || return
@@ -1568,12 +1582,15 @@ report_mysql_summary () {
section "Encryption"
local keyring_plugins="$(collect_keyring_plugins)"
local encrypted_tables=""
local encrypted_tablespaces=""
if [ ${OPT_LIST_ENCRYPTED_TABLES} == 'yes' ]; then
encrypted_tables="$(collect_encrypted_tables)"
encrypted_tablespaces="$(collect_encrypted_tablespaces)"
fi
format_keyring_plugins "$keyring_plugins" "$encrypted_tables"
format_encrypted_tables "$encrypted_tables"
format_encrypted_tablespaces "$encrypted_tablespaces"
# ########################################################################
# Binary Logging

View File

@@ -9,16 +9,37 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use PerconaTest;
my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/;
use Sandbox;
use DSNParser;
require VersionParser;
use Test::More;
use File::Temp qw( tempdir );
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,
# so use the actual mysqldump from each MySQL bin which should
# always be compatible with itself.

View File

@@ -222,6 +222,8 @@ Uptime 90000 1 1
# Security ###################################################
Users | 6 users, 0 anon, 1 w/o pw, 1 old pw
Old Passwords | OFF
# Encryption #################################################
No keyring plugins found
# Binary Logging #############################################
# Noteworthy Variables #######################################
Auto-Inc Incr/Offset | 1/1
@@ -275,4 +277,5 @@ report-port = 12345
log-error = mysqld.log
innodb_lock_wait_timeout = 3
# Memory management library ##################################
Jemalloc library not found
# The End ####################################################

View File

@@ -156,6 +156,8 @@ Specify --databases or --all-databases to dump and summarize schemas
# Security ###################################################
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
Old Passwords | OFF
# Encryption #################################################
No keyring plugins found
# Binary Logging #############################################
Binlogs | 1
Zero-Sized | 0
@@ -218,4 +220,5 @@ report-port = 12345
log-error = mysqld.log
innodb_lock_wait_timeout = 3
# Memory management library ##################################
Jemalloc library not found
# The End ####################################################

View File

@@ -155,6 +155,8 @@ Specify --databases or --all-databases to dump and summarize schemas
# Security ###################################################
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
Old Passwords | OFF
# Encryption #################################################
No keyring plugins found
# Binary Logging #############################################
Binlogs | 2
Zero-Sized | 0
@@ -217,4 +219,5 @@ report-port = 12345
log-error = mysqld.log
innodb_lock_wait_timeout = 3
# Memory management library ##################################
Jemalloc library not found
# The End ####################################################

View File

@@ -228,6 +228,8 @@ Uptime 90000 1 1
# Security ###################################################
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
Old Passwords | OFF
# Encryption #################################################
No keyring plugins found
# Binary Logging #############################################
Binlogs | 1
Zero-Sized | 0
@@ -290,4 +292,5 @@ report-port = 12345
log-error = mysqld.log
innodb_lock_wait_timeout = 3
# Memory management library ##################################
Jemalloc library not found
# The End ####################################################

View File

@@ -304,6 +304,8 @@ wsrep_cluster_size 100
# Security ###################################################
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
Old Passwords | OFF
# Encryption #################################################
No keyring plugins found
# Binary Logging #############################################
Binlogs | 1
Zero-Sized | 0
@@ -339,4 +341,5 @@ log_queries_not_using_indexes | OFF
# Configuration File #########################################
Config File | Cannot autodetect or find, giving up
# Memory management library ##################################
Jemalloc library not found
# The End ####################################################

View File

@@ -258,6 +258,8 @@ wsrep_local_index 4000000000000 45000000
# Security ###################################################
Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
Old Passwords | OFF
# Encryption #################################################
No keyring plugins found
# Binary Logging #############################################
Binlogs | 1
Zero-Sized | 0
@@ -293,4 +295,5 @@ log_queries_not_using_indexes | OFF
# Configuration File #########################################
Config File | Cannot autodetect or find, giving up
# Memory management library ##################################
Jemalloc library not found
# The End ####################################################