| 1 |
# Embedded server doesn't support binlog |
| 2 |
-- source include/not_embedded.inc |
| 3 |
-- source include/have_innodb.inc |
| 4 |
|
| 5 |
# Creating tables |
| 6 |
--disable_warnings |
| 7 |
drop table if exists t1, t2; |
| 8 |
--enable_warnings |
| 9 |
|
| 10 |
create table t1 (a int) engine=innodb; |
| 11 |
create table t2 (a int) engine=myisam; |
| 12 |
|
| 13 |
# |
| 14 |
# This test checks binlog_cache_use and binlog_cache_disk_use when |
| 15 |
# transactions are committed and after when they are aborted. |
| 16 |
# |
| 17 |
|
| 18 |
set @save_binlog_stmt_cache_size=@@global.binlog_stmt_cache_size; |
| 19 |
set @save_binlog_cache_size=@@global.binlog_cache_size; |
| 20 |
set @@global.binlog_stmt_cache_size=32768; |
| 21 |
set @@global.binlog_cache_size=32768; |
| 22 |
# |
| 23 |
# Checking commit. |
| 24 |
# |
| 25 |
--echo **** Preparing the enviroment to check commit and its effect on status variables. |
| 26 |
--echo **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0. |
| 27 |
--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. |
| 28 |
flush global status; |
| 29 |
let $exp_cache= 0; |
| 30 |
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); |
| 31 |
let $exp_disk= 0; |
| 32 |
let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); |
| 33 |
let $exp_stmt_cache= 0; |
| 34 |
let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); |
| 35 |
let $exp_stmt_disk= 0; |
| 36 |
let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); |
| 37 |
if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) |
| 38 |
{ |
| 39 |
-- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" |
| 40 |
-- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" |
| 41 |
-- die |
| 42 |
} |
| 43 |
|
| 44 |
--echo **** Transactional changes which are long enough so they will be flushed to disk... |
| 45 |
--echo **** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1. |
| 46 |
--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. |
| 47 |
let $1=2000; |
| 48 |
disable_query_log; |
| 49 |
begin; |
| 50 |
while ($1) |
| 51 |
{ |
| 52 |
eval insert into t1 values( $1 ); |
| 53 |
dec $1; |
| 54 |
} |
| 55 |
commit; |
| 56 |
enable_query_log; |
| 57 |
let $exp_cache= 1; |
| 58 |
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); |
| 59 |
let $exp_disk= 1; |
| 60 |
let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); |
| 61 |
let $exp_stmt_cache= 0; |
| 62 |
let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); |
| 63 |
let $exp_stmt_disk= 0; |
| 64 |
let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); |
| 65 |
if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) |
| 66 |
{ |
| 67 |
-- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" |
| 68 |
-- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" |
| 69 |
-- die |
| 70 |
} |
| 71 |
|
| 72 |
--echo **** Transactional changes which should not be flushed to disk and so should not |
| 73 |
--echo **** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. |
| 74 |
--echo **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. |
| 75 |
--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. |
| 76 |
begin; |
| 77 |
insert into t1 values( 1 ); |
| 78 |
commit; |
| 79 |
let $exp_cache= 2; |
| 80 |
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); |
| 81 |
let $exp_disk= 1; |
| 82 |
let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); |
| 83 |
let $exp_stmt_cache= 0; |
| 84 |
let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); |
| 85 |
let $exp_stmt_disk= 0; |
| 86 |
let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); |
| 87 |
if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) |
| 88 |
{ |
| 89 |
-- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" |
| 90 |
-- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" |
| 91 |
-- die |
| 92 |
} |
| 93 |
|
| 94 |
--echo **** Non-Transactional changes which should not be flushed to disk and so should not |
| 95 |
--echo **** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. |
| 96 |
--echo **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. |
| 97 |
--echo **** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0. |
| 98 |
begin; |
| 99 |
insert into t2 values( 1 ); |
| 100 |
commit; |
| 101 |
let $exp_cache= 2; |
| 102 |
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); |
| 103 |
let $exp_disk= 1; |
| 104 |
let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); |
| 105 |
let $exp_stmt_cache= 1; |
| 106 |
let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); |
| 107 |
let $exp_stmt_disk= 0; |
| 108 |
let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); |
| 109 |
if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) |
| 110 |
{ |
| 111 |
-- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" |
| 112 |
-- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" |
| 113 |
-- die |
| 114 |
} |
| 115 |
|
| 116 |
--echo **** Mixed changes which should not be flushed to disk and so should not |
| 117 |
--echo **** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. |
| 118 |
--echo **** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1. |
| 119 |
--echo **** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0. |
| 120 |
begin; |
| 121 |
insert into t1 values( 1 ); |
| 122 |
insert into t2 values( 1 ); |
| 123 |
commit; |
| 124 |
let $exp_cache= 3; |
| 125 |
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); |
| 126 |
let $exp_disk= 1; |
| 127 |
let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); |
| 128 |
let $exp_stmt_cache= 2; |
| 129 |
let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); |
| 130 |
let $exp_stmt_disk= 0; |
| 131 |
let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); |
| 132 |
if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) |
| 133 |
{ |
| 134 |
-- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" |
| 135 |
-- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" |
| 136 |
-- die |
| 137 |
} |
| 138 |
|
| 139 |
# |
| 140 |
# Checking abort. |
| 141 |
# |
| 142 |
--echo **** Preparing the enviroment to check abort and its effect on the status variables. |
| 143 |
--echo **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0. |
| 144 |
--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. |
| 145 |
flush global status; |
| 146 |
let $exp_cache= 0; |
| 147 |
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); |
| 148 |
let $exp_disk= 0; |
| 149 |
let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); |
| 150 |
let $exp_stmt_cache= 0; |
| 151 |
let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); |
| 152 |
let $exp_stmt_disk= 0; |
| 153 |
let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); |
| 154 |
if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) |
| 155 |
{ |
| 156 |
-- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" |
| 157 |
-- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" |
| 158 |
-- die |
| 159 |
} |
| 160 |
|
| 161 |
--echo **** Transactional changes which are long enough so they will be flushed to disk... |
| 162 |
--echo **** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1. |
| 163 |
--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. |
| 164 |
let $1=2000; |
| 165 |
disable_query_log; |
| 166 |
begin; |
| 167 |
while ($1) |
| 168 |
{ |
| 169 |
eval insert into t1 values( $1 ); |
| 170 |
dec $1; |
| 171 |
} |
| 172 |
rollback; |
| 173 |
enable_query_log; |
| 174 |
let $exp_cache= 1; |
| 175 |
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); |
| 176 |
let $exp_disk= 1; |
| 177 |
let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); |
| 178 |
let $exp_stmt_cache= 0; |
| 179 |
let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); |
| 180 |
let $exp_stmt_disk= 0; |
| 181 |
let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); |
| 182 |
if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) |
| 183 |
{ |
| 184 |
-- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" |
| 185 |
-- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" |
| 186 |
-- die |
| 187 |
} |
| 188 |
|
| 189 |
--echo **** Transactional changes which should not be flushed to disk and so should not |
| 190 |
--echo **** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. |
| 191 |
--echo **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. |
| 192 |
--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. |
| 193 |
begin; |
| 194 |
insert into t1 values( 1 ); |
| 195 |
rollback; |
| 196 |
let $exp_cache= 2; |
| 197 |
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); |
| 198 |
let $exp_disk= 1; |
| 199 |
let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); |
| 200 |
let $exp_stmt_cache= 0; |
| 201 |
let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); |
| 202 |
let $exp_stmt_disk= 0; |
| 203 |
let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); |
| 204 |
if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) |
| 205 |
{ |
| 206 |
-- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" |
| 207 |
-- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" |
| 208 |
-- die |
| 209 |
} |
| 210 |
|
| 211 |
--echo **** Non-Transactional changes which should not be flushed to disk and so should not |
| 212 |
--echo **** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. |
| 213 |
--echo **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. |
| 214 |
--echo **** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0. |
| 215 |
begin; |
| 216 |
insert into t2 values( 1 ); |
| 217 |
rollback; |
| 218 |
let $exp_cache= 2; |
| 219 |
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); |
| 220 |
let $exp_disk= 1; |
| 221 |
let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); |
| 222 |
let $exp_stmt_cache= 1; |
| 223 |
let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); |
| 224 |
let $exp_stmt_disk= 0; |
| 225 |
let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); |
| 226 |
if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) |
| 227 |
{ |
| 228 |
-- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" |
| 229 |
-- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" |
| 230 |
-- die |
| 231 |
} |
| 232 |
|
| 233 |
--echo **** Mixed changes which should not be flushed to disk and so should not |
| 234 |
--echo **** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. |
| 235 |
--echo **** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1. |
| 236 |
--echo **** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0. |
| 237 |
begin; |
| 238 |
insert into t1 values( 1 ); |
| 239 |
insert into t2 values( 1 ); |
| 240 |
rollback; |
| 241 |
let $exp_cache= 3; |
| 242 |
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); |
| 243 |
let $exp_disk= 1; |
| 244 |
let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); |
| 245 |
let $exp_stmt_cache= 2; |
| 246 |
let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); |
| 247 |
let $exp_stmt_disk= 0; |
| 248 |
let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); |
| 249 |
if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) |
| 250 |
{ |
| 251 |
-- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" |
| 252 |
-- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" |
| 253 |
-- die |
| 254 |
} |
| 255 |
drop table t1, t2; |
| 256 |
|
| 257 |
set @@global.binlog_stmt_cache_size=@save_binlog_stmt_cache_size; |
| 258 |
set @@global.binlog_cache_size=@save_binlog_cache_size; |