1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
###############################################################################
# #
# Variable Name: Host_Cache_Size #
# Scope: Global #
# Access Type: Dynamic #
# Data Type: numeric #
# #
# #
# Creation Date: 2012-08-31 #
# Author : Tanjot Singh Uppal #
# #
# #
# Description:Test Cases of Dynamic System Variable Host_Cache_Size #
# that checks the behavior of this variable in the following ways #
# * Value Check #
# * Scope Check #
# * Functionality Check #
# * Accessability Check #
# #
# This test does not perform the crash recovery on this variable #
# For crash recovery test on default change please run the ibtest #
###############################################################################
-- source include/have_innodb.inc
-- source include/not_embedded.inc
-- source include/have_innodb_16k.inc
--disable_warnings
echo '#________________________VAR_06_Host_Cache_Size__________________#'
echo '##'
--echo '#---------------------WL6372_VAR_6_01----------------------#'
####################################################################
# Checking default value #
####################################################################
SELECT COUNT(@@GLOBAL.Host_Cache_Size);
--echo 1 Expected
#set @Default_host_cache_size=(select if(if(@@global.max_connections<500,128+@@global.max_connections,128+@@global.max_connections+floor((@@global.max_connections-500)/20))>2000,2000,if(@@global.max_connections<500,128+@@global.max_connections,128+@@global.max_connections+floor((@@global.max_connections-500)/20))));
set @Default_host_cache_size=128;
select @@global.Host_Cache_Size=@Default_host_cache_size;
--echo 1 Expected
--echo '#---------------------WL6372_VAR_6_02----------------------#'
#################################################################################
# Checking the Default value post starting the server with other value #
#################################################################################
--echo # Restart server with Host_Cache_Size 1
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
--shutdown_server 10
--source include/wait_until_disconnected.inc
-- exec echo "restart:--host_cache_size=1 " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
--disable_warnings
SELECT @@GLOBAL.Host_Cache_Size;
--echo 1 Expected
#set @Default_host_cache_size=(select if(if(@@global.max_connections<500,128+@@global.max_connections,128+@@global.max_connections+floor((@@global.max_connections-500)/20))>2000,2000,if(@@global.max_connections<500,128+@@global.max_connections,128+@@global.max_connections+floor((@@global.max_connections-500)/20))));
set @Default_host_cache_size=128;
SET @@GLOBAL.Host_Cache_Size=DEFAULT;
select @@global.Host_Cache_Size=@Default_host_cache_size;
--echo 1 Expected
--echo '#---------------------WL6372_VAR_6_03----------------------#'
####################################################################
# Checking Value can be set - Dynamic #
####################################################################
--error ER_GLOBAL_VARIABLE
SET @@local.Host_Cache_Size=1;
--echo Expected error 'Global variable'
--error ER_GLOBAL_VARIABLE
SET @@session.Host_Cache_Size=1;
--echo Expected error 'Global variable'
SET @@GLOBAL.Host_Cache_Size=1;
SET @@GLOBAL.Host_Cache_Size=DEFAULT;
SELECT COUNT(@@GLOBAL.Host_Cache_Size);
--echo 1 Expected
select @@global.Host_Cache_Size=@Default_host_cache_size;
--echo 1 Expected
--echo '#---------------------WL6372_VAR_6_04----------------------#'
#################################################################
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
SELECT @@GLOBAL.Host_Cache_Size = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='Host_Cache_Size';
--echo 1 Expected
SELECT COUNT(@@GLOBAL.Host_Cache_Size);
--echo 1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='Host_Cache_Size';
--echo 1 Expected
--echo '#---------------------WL6372_VAR_6_05----------------------#'
################################################################################
# Checking Variable Scope #
################################################################################
SELECT @@Host_Cache_Size = @@GLOBAL.Host_Cache_Size;
--echo 1 Expected
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@local.Host_Cache_Size);
--echo Expected error 'Variable is a GLOBAL variable'
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@SESSION.Host_Cache_Size);
--echo Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.Host_Cache_Size);
--echo 1 Expected
--Error ER_BAD_FIELD_ERROR
SELECT Host_Cache_Size = @@SESSION.Host_Cache_Size;
--echo Expected error 'Unknown column Host_Cache_Size in field list'
#The below check has been commented out as the IP fetch is different in a P2P connection than BroadBand connection
#--echo '#---------------------WL6372_VAR_6_06----------------------#'
###############################################################################
# Checking the Host cahce functionality #
###############################################################################
#SET @@GLOBAL.Host_Cache_Size=2;
#--disable_warnings
#--perl
#my $ip=`ifconfig | egrep "inet addr|inet" | sed -e 's/^.*inet addr://' -e 's/^.*inet//'| sed 's/ .*\$//'|egrep -i "broadcast|bcast"|head -1|awk '{print $1}'`;
#open (LOGFH, ">" . $ENV{'MYSQL_TMP_DIR'} . "/bind_ip");
#print LOGFH "let \$bind_ip = $ip;\n";
#close LOGFH;
#EOF
#--source $MYSQL_TMP_DIR/bind_ip
#--remove_file $MYSQL_TMP_DIR/bind_ip
#let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
#--exec echo "wait" > $restart_file
#--shutdown_server 10
#--source include/wait_until_disconnected.inc
#-- exec echo "restart:--bind-address=$bind_ip " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
#-- enable_reconnect
#-- source include/wait_until_connected_again.inc
#connection default;
#--disable_warnings
#create user binduser;
#grant all on *.* to binduser;
#select count(IP) from performance_schema.host_cache;
#--echo 0 Expected
#connect (con1,$bind_ip,binduser,,);
#select count(IP) from performance_schema.host_cache;
#--echo 1 Expected
#disconnect con1;
#connection default;
#--disable_warnings
# The below check is hashed until the BUG14689561# is fixed
#
#flush hosts;
#connect (con2,$bind_ip,binduser,,);
#select count(IP) from performance_schema.host_cache;
#--echo 1 Expected
#disconnect con2;
SET @@GLOBAL.Host_Cache_Size=DEFAULT;
|