| 1 |
# ************************************************************ |
| 2 |
# wl6504: This testcase is to check the functionality of the |
| 3 |
# innodb_buffer_pool_dump_pct flag |
| 4 |
# step 1.Set innodb_buffer_pool_dump_pct=100 and take the dump |
| 5 |
# step 2.Set innodb_buffer_pool_dump_pct=50 and take the dump |
| 6 |
# step 3.Compare the size of both the dump files |
| 7 |
# Here if the size of step 1 > size of step 2 (pass) else fail |
| 8 |
#************************************************************* |
| 9 |
|
| 10 |
--echo # Set the environmental variables |
| 11 |
let MYSQLD_DATADIR = `SELECT @@datadir`; |
| 12 |
|
| 13 |
--echo # Create a table |
| 14 |
CREATE TABLE tab5 (col1 int auto_increment primary key, |
| 15 |
col2 VARCHAR(25), col3 varchar(25)) ENGINE=InnoDB; |
| 16 |
|
| 17 |
-- echo # Create indexes |
| 18 |
CREATE INDEX idx1 ON tab5(col2(10)); |
| 19 |
CREATE INDEX idx2 ON tab5(col3(10)); |
| 20 |
|
| 21 |
--echo # Insert a sample record |
| 22 |
INSERT INTO tab5(col2,col3) VALUES('Test for wl6504','Test for dump pct'); |
| 23 |
|
| 24 |
--echo # Set the dump file name |
| 25 |
SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool100; |
| 26 |
|
| 27 |
SET GLOBAL innodb_buffer_pool_dump_pct=100; |
| 28 |
|
| 29 |
#*********************************************************** |
| 30 |
# SELECT * |
| 31 |
# FROM performance_schema.global_status |
| 32 |
# WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS' |
| 33 |
# gives |
| 34 |
# a) VARIABLE_NAME VARIABLE_VALUE |
| 35 |
# INNODB_BUFFER_POOL_DUMP_STATUS not started |
| 36 |
# in case there was no innodb_buffer_pool_dump since server start. |
| 37 |
# b) Something like |
| 38 |
# VARIABLE_NAME VARIABLE_VALUE |
| 39 |
# INNODB_BUFFER_POOL_DUMP_STATUS Buffer pool(s) dump completed at 130711 13:43:24 |
| 40 |
# in case there was a innodb_buffer_pool_dump since server start. |
| 41 |
# Attention: |
| 42 |
# - There is no guarantee that the current test is the first test which |
| 43 |
# made an innodb_buffer_pool_dump since server startup. |
| 44 |
# - The granularity of the timestamp is one second. |
| 45 |
# - There could have been some dump caused by some previous test |
| 46 |
# just a few milliseconds before. |
| 47 |
# In order to avoid conflict with previous tests, read the current value |
| 48 |
# of INNODB_BUFFER_POOL_DUMP_STATUS |
| 49 |
# and confirm that the timestamp is different after the dump |
| 50 |
#*********************************************************** |
| 51 |
|
| 52 |
# Read the current value to compare with the new value. |
| 53 |
--disable_warnings |
| 54 |
SELECT variable_value INTO @IBPDS |
| 55 |
FROM performance_schema.global_status |
| 56 |
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'; |
| 57 |
--enable_warnings |
| 58 |
|
| 59 |
--echo # Take the dump file |
| 60 |
SET GLOBAL innodb_buffer_pool_dump_now=ON; |
| 61 |
|
| 62 |
# Sleep one second in order to ensure that the time stamp is |
| 63 |
# different at next dump |
| 64 |
--sleep 1 |
| 65 |
|
| 66 |
--echo # Wait until the system table get updated & dump get created |
| 67 |
--disable_warnings |
| 68 |
let $wait_condition = SELECT count(*) = 1 |
| 69 |
FROM performance_schema.global_status |
| 70 |
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS' |
| 71 |
AND variable_value != @IBPDS |
| 72 |
AND variable_value like 'Buffer pool(s) dump completed at%'; |
| 73 |
--enable_warnings |
| 74 |
|
| 75 |
--echo # Check the dump file exist in the DATADIR |
| 76 |
--file_exists $MYSQLD_DATADIR/ib_buffer_pool100 |
| 77 |
|
| 78 |
--echo # Set the dump file name |
| 79 |
SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool50; |
| 80 |
|
| 81 |
--echo # Set the value 50 |
| 82 |
SET GLOBAL innodb_buffer_pool_dump_pct=50; |
| 83 |
|
| 84 |
--echo # Check the value is 50 |
| 85 |
SELECT @@global.innodb_buffer_pool_dump_pct; |
| 86 |
|
| 87 |
# Read the current value to compare with the new value. |
| 88 |
--disable_warnings |
| 89 |
SELECT variable_value INTO @IBPDS |
| 90 |
FROM performance_schema.global_status |
| 91 |
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'; |
| 92 |
--enable_warnings |
| 93 |
|
| 94 |
--echo # Take the dump file |
| 95 |
SET GLOBAL innodb_buffer_pool_dump_now=ON; |
| 96 |
|
| 97 |
# Sleep one second in order to ensure that the time stamp is |
| 98 |
# different at next dump |
| 99 |
--sleep 1 |
| 100 |
|
| 101 |
--echo # Wait until the system table get updated & dump get created |
| 102 |
--disable_warnings |
| 103 |
let $wait_condition = SELECT count(*) = 1 |
| 104 |
FROM performance_schema.global_status |
| 105 |
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS' |
| 106 |
AND variable_value != @IBPDS |
| 107 |
AND variable_value like 'Buffer pool(s) dump completed at%'; |
| 108 |
--enable_warnings |
| 109 |
|
| 110 |
--echo # Check the dump file exist in the DATADIR |
| 111 |
--file_exists $MYSQLD_DATADIR/ib_buffer_pool50 |
| 112 |
|
| 113 |
--echo # Get the size of the dump files & compare |
| 114 |
perl; |
| 115 |
my $dir = $ENV{'MYSQLD_DATADIR'}; |
| 116 |
my $size; |
| 117 |
opendir(DIR, $dir) or die $!; |
| 118 |
while (my $file = readdir(DIR)) |
| 119 |
{ |
| 120 |
|
| 121 |
if ($file =~ m/\ib_buffer_pool50$/) { |
| 122 |
$size50 = -s "$dir/$file"; |
| 123 |
} elsif ($file =~ m/\ib_buffer_pool100$/) { |
| 124 |
$size100 = -s "$dir/$file"; |
| 125 |
} |
| 126 |
|
| 127 |
} |
| 128 |
|
| 129 |
# Check the size of the dump files ,here size100 should always be greater |
| 130 |
if ($size100 > $size50) { |
| 131 |
print "wl6504 test PASS\n"; |
| 132 |
} else { |
| 133 |
print "wl6504 test FAIL\n"; |
| 134 |
} |
| 135 |
|
| 136 |
close(DIR); |
| 137 |
exit(0) |
| 138 |
EOF |
| 139 |
|
| 140 |
--echo # Reset the default value |
| 141 |
SET GLOBAL innodb_buffer_pool_dump_pct=Default; |
| 142 |
SET GLOBAL innodb_buffer_pool_filename=Default; |
| 143 |
|
| 144 |
--echo # Cleanup |
| 145 |
--remove_file $MYSQLD_DATADIR/ib_buffer_pool100 |
| 146 |
--remove_file $MYSQLD_DATADIR/ib_buffer_pool50 |
| 147 |
DROP TABLE tab5; |