| 1 |
source include/not_valgrind.inc; |
| 2 |
source include/have_memcached_plugin.inc; |
| 3 |
source include/not_windows.inc; |
| 4 |
|
| 5 |
--disable_query_log |
| 6 |
CALL mtr.add_suppression("daemon-memcached-w-batch-size': unsigned"); |
| 7 |
CALL mtr.add_suppression("Could not obtain server's UPN to be used as target service name"); |
| 8 |
CALL mtr.add_suppression("Warning: MySQL is trying to drop"); |
| 9 |
--enable_query_log |
| 10 |
|
| 11 |
--enable_connect_log |
| 12 |
SET @transaction_isolation= @@global.transaction_isolation; |
| 13 |
SET GLOBAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; |
| 14 |
|
| 15 |
# Create the memcached tables |
| 16 |
--disable_query_log |
| 17 |
source include/memcache_config.inc; |
| 18 |
--enable_query_log |
| 19 |
|
| 20 |
INSERT INTO cache_policies VALUES("cache_policy", "innodb_only", |
| 21 |
"innodb_only", "innodb_only", "innodb_only"); |
| 22 |
|
| 23 |
INSERT INTO config_options VALUES("separator", "|"); |
| 24 |
|
| 25 |
# describe table for memcache |
| 26 |
INSERT INTO containers VALUES ("desc_t1", "test", "t1", |
| 27 |
"c1", "c2,c21", "c3", "c4", "c5", "PRIMARY"); |
| 28 |
INSERT INTO containers VALUES ("int_test", "test", "int_test", |
| 29 |
"k", "v", "", "", "", "PRIMARY"); |
| 30 |
USE test; |
| 31 |
|
| 32 |
--disable_warnings |
| 33 |
DROP TABLE IF EXISTS int_test; |
| 34 |
DROP TABLE IF EXISTS t1; |
| 35 |
--enable_warnings |
| 36 |
CREATE TABLE t1 (c1 VARCHAR(32), |
| 37 |
c2 INT, |
| 38 |
c21 VARCHAR(1024), |
| 39 |
c3 INT, c4 BIGINT UNSIGNED, c5 INT, primary key(c1)) |
| 40 |
ENGINE = INNODB; |
| 41 |
|
| 42 |
CREATE TABLE int_test (k varchar(32), |
| 43 |
v int unsigned NOT NULL, PRIMARY KEY (k)) ENGINE=InnoDB; |
| 44 |
|
| 45 |
INSERT INTO t1 VALUES ('D', 1, 'City', 0, 0, 0); |
| 46 |
INSERT INTO t1 VALUES ('B', 2, 'Mitte', 0, 0, 0); |
| 47 |
INSERT INTO t1 VALUES ('C', 3, 'West', 0, 0 ,0); |
| 48 |
INSERT INTO t1 VALUES ('H', 4, 'Norderstedt', 0, 0, 0); |
| 49 |
|
| 50 |
# Tables must exist before plugin can be started! |
| 51 |
--let $memcached_address=127.0.0.1:11213 |
| 52 |
--source ../include/load_daemon_memcached_expecting_success.inc |
| 53 |
|
| 54 |
--sorted_result |
| 55 |
SELECT c1,c2,c21 FROM t1; |
| 56 |
|
| 57 |
perl; |
| 58 |
use DBI; |
| 59 |
use Cache::Memcached; |
| 60 |
my $memd = new Cache::Memcached { |
| 61 |
'servers' => [ "127.0.0.1:11213" ], |
| 62 |
'connect_timeout' => 20, |
| 63 |
'select_timeout' => 20 |
| 64 |
}; |
| 65 |
print "Here are the memcached results with D,B,H,C:\n"; |
| 66 |
$val = $memd->get("D"); |
| 67 |
if ($val) { print "$val\n"; } |
| 68 |
$val = $memd->get("B"); |
| 69 |
if ($val) { print "$val\n"; } |
| 70 |
$val = $memd->get("H"); |
| 71 |
if ($val) { print "$val\n"; } |
| 72 |
$val = $memd->get("C"); |
| 73 |
if ($val) { print "$val\n"; } |
| 74 |
$memd->disconnect_all; |
| 75 |
EOF |
| 76 |
|
| 77 |
--sorted_result |
| 78 |
SELECT c1,c2,c21 FROM t1; |
| 79 |
|
| 80 |
perl; |
| 81 |
use DBI; |
| 82 |
use Cache::Memcached; |
| 83 |
my $memd = new Cache::Memcached { |
| 84 |
'servers' => [ "127.0.0.1:11213" ], |
| 85 |
'connect_timeout' => 20, |
| 86 |
'select_timeout' => 20 |
| 87 |
}; |
| 88 |
print "Here are the memcached results after set:\n"; |
| 89 |
$val = $memd->set("E","5|Ost"); |
| 90 |
$val = $memd->get("E"); |
| 91 |
if ($val) { print "$val\n"; } |
| 92 |
print "Here are the memcached results after set min border:\n"; |
| 93 |
$val = $memd->set("E","-2147483648|Ost"); |
| 94 |
$val = $memd->get("E"); |
| 95 |
if ($val) { print "$val\n"; } |
| 96 |
print "Here are the memcached results after set max border:\n"; |
| 97 |
$val = $memd->set("E","2147483647|Ost"); |
| 98 |
$val = $memd->get("E"); |
| 99 |
if ($val) { print "$val\n"; } |
| 100 |
print "Here are the memcached results after set over max border:\n"; |
| 101 |
$val = $memd->set("E","2147483648|Ost"); |
| 102 |
$val = $memd->get("E"); |
| 103 |
if ($val) { print "$val\n"; } |
| 104 |
$memd->disconnect_all; |
| 105 |
EOF |
| 106 |
|
| 107 |
--sorted_result |
| 108 |
SELECT c1,c2,c21 FROM t1; |
| 109 |
|
| 110 |
#Test incr/decr command |
| 111 |
perl; |
| 112 |
use DBI; |
| 113 |
use Cache::Memcached; |
| 114 |
my $memd = new Cache::Memcached { |
| 115 |
'servers' => [ "127.0.0.1:11213" ], |
| 116 |
'connect_timeout' => 20, |
| 117 |
'select_timeout' => 20 |
| 118 |
}; |
| 119 |
$val = $memd->set("F","6|Sofia"); |
| 120 |
print "Here are the memcached results after set:\n"; |
| 121 |
$val = $memd->get("F"); |
| 122 |
if ($val) { print "$val\n"; } |
| 123 |
print "Here are the memcached results after calling incr 10:\n"; |
| 124 |
$val = $memd->incr("F",10); |
| 125 |
$val = $memd->get("F"); |
| 126 |
if ($val) { print "$val\n"; } |
| 127 |
print "Here are the memcached results after calling decr 4:\n"; |
| 128 |
$val = $memd->decr("F",4); |
| 129 |
$val = $memd->get("F"); |
| 130 |
if ($val) { print "$val\n"; } |
| 131 |
$val = $memd->delete("F",0); |
| 132 |
$memd->disconnect_all; |
| 133 |
EOF |
| 134 |
|
| 135 |
--sorted_result |
| 136 |
SELECT c1,c2,c21 FROM t1; |
| 137 |
|
| 138 |
ALTER TABLE t1 MODIFY c2 varchar(20); |
| 139 |
|
| 140 |
perl; |
| 141 |
use DBI; |
| 142 |
use Cache::Memcached; |
| 143 |
my $memd = new Cache::Memcached { |
| 144 |
'servers' => [ "127.0.0.1:11213" ], |
| 145 |
'connect_timeout' => 20, |
| 146 |
'select_timeout' => 20 |
| 147 |
}; |
| 148 |
print "Here are the memcached results with D,B,H,C:\n"; |
| 149 |
$val = $memd->get("D"); |
| 150 |
if ($val) { print "$val\n"; } |
| 151 |
$val = $memd->get("B"); |
| 152 |
if ($val) { print "$val\n"; } |
| 153 |
$val = $memd->get("H"); |
| 154 |
if ($val) { print "$val\n"; } |
| 155 |
$val = $memd->get("C"); |
| 156 |
if ($val) { print "$val\n"; } |
| 157 |
print "Here are the memcached results after set:\n"; |
| 158 |
$val = $memd->set("E","5|Ost-VARCHAR"); |
| 159 |
$val = $memd->get("E"); |
| 160 |
if ($val) { print "$val\n"; } |
| 161 |
$memd->disconnect_all; |
| 162 |
EOF |
| 163 |
|
| 164 |
--sorted_result |
| 165 |
SELECT c1,c2,c21 FROM t1; |
| 166 |
|
| 167 |
# Test BIGINT |
| 168 |
ALTER TABLE t1 MODIFY c2 BIGINT; |
| 169 |
|
| 170 |
perl; |
| 171 |
use DBI; |
| 172 |
use Cache::Memcached; |
| 173 |
my $memd = new Cache::Memcached { |
| 174 |
'servers' => [ "127.0.0.1:11213" ], |
| 175 |
'connect_timeout' => 20, |
| 176 |
'select_timeout' => 20 |
| 177 |
}; |
| 178 |
print "Here are the memcached results with D,B,H,C:\n"; |
| 179 |
$val = $memd->get("D"); |
| 180 |
if ($val) { print "$val\n"; } |
| 181 |
$val = $memd->get("B"); |
| 182 |
if ($val) { print "$val\n"; } |
| 183 |
$val = $memd->get("H"); |
| 184 |
if ($val) { print "$val\n"; } |
| 185 |
$val = $memd->get("C"); |
| 186 |
if ($val) { print "$val\n"; } |
| 187 |
print "Here are the memcached results after set:\n"; |
| 188 |
$val = $memd->set("E","5|Ost-BIGINT"); |
| 189 |
$val = $memd->get("E"); |
| 190 |
if ($val) { print "$val\n"; } |
| 191 |
print "Here are the memcached results after set min border:\n"; |
| 192 |
$val = $memd->set("E","-9223372036854775808|Ost"); |
| 193 |
$val = $memd->get("E"); |
| 194 |
if ($val) { print "$val\n"; } |
| 195 |
print "Here are the memcached results after set max border:\n"; |
| 196 |
$val = $memd->set("E","9223372036854775807|Ost"); |
| 197 |
$val = $memd->get("E"); |
| 198 |
if ($val) { print "$val\n"; } |
| 199 |
print "Here are the memcached results after set over max border:\n"; |
| 200 |
$val = $memd->set("E","9223372036854775808|Ost"); |
| 201 |
$val = $memd->get("E"); |
| 202 |
if ($val) { print "$val\n"; } |
| 203 |
print "Here are the memcached results after add:\n"; |
| 204 |
$val = $memd->set("F","-1|Beijing-Signed-BIGINT"); |
| 205 |
$val = $memd->get("F"); |
| 206 |
if ($val) { print "$val\n"; } |
| 207 |
$memd->disconnect_all; |
| 208 |
EOF |
| 209 |
|
| 210 |
--sorted_result |
| 211 |
SELECT c1,c2,c21 FROM t1; |
| 212 |
|
| 213 |
SET sql_mode='NO_ENGINE_SUBSTITUTION'; |
| 214 |
# Test SMALLINT |
| 215 |
ALTER TABLE t1 MODIFY c2 SMALLINT; |
| 216 |
|
| 217 |
perl; |
| 218 |
use DBI; |
| 219 |
use Cache::Memcached; |
| 220 |
my $memd = new Cache::Memcached { |
| 221 |
'servers' => [ "127.0.0.1:11213" ], |
| 222 |
'connect_timeout' => 20, |
| 223 |
'select_timeout' => 20 |
| 224 |
}; |
| 225 |
print "Here are the memcached results with D,B,H,C:\n"; |
| 226 |
$val = $memd->get("D"); |
| 227 |
if ($val) { print "$val\n"; } |
| 228 |
$val = $memd->get("B"); |
| 229 |
if ($val) { print "$val\n"; } |
| 230 |
$val = $memd->get("H"); |
| 231 |
if ($val) { print "$val\n"; } |
| 232 |
$val = $memd->get("C"); |
| 233 |
if ($val) { print "$val\n"; } |
| 234 |
print "Here are the memcached results after set:\n"; |
| 235 |
$val = $memd->set("E","5|Ost-SMALLINT"); |
| 236 |
$val = $memd->get("E"); |
| 237 |
if ($val) { print "$val\n"; } |
| 238 |
print "Here are the memcached results after set min border:\n"; |
| 239 |
$val = $memd->set("E","-32768|Ost"); |
| 240 |
$val = $memd->get("E"); |
| 241 |
if ($val) { print "$val\n"; } |
| 242 |
print "Here are the memcached results after set max border:\n"; |
| 243 |
$val = $memd->set("E","32767|Ost"); |
| 244 |
$val = $memd->get("E"); |
| 245 |
if ($val) { print "$val\n"; } |
| 246 |
print "Here are the memcached results after set over max border:\n"; |
| 247 |
$val = $memd->set("E","32768|Ost"); |
| 248 |
$val = $memd->get("E"); |
| 249 |
if ($val) { print "$val\n"; } |
| 250 |
$memd->disconnect_all; |
| 251 |
EOF |
| 252 |
|
| 253 |
--sorted_result |
| 254 |
SELECT c1,c2,c21 FROM t1; |
| 255 |
|
| 256 |
# Test TINYINT |
| 257 |
ALTER TABLE t1 MODIFY c2 TINYINT; |
| 258 |
|
| 259 |
perl; |
| 260 |
use DBI; |
| 261 |
use Cache::Memcached; |
| 262 |
my $memd = new Cache::Memcached { |
| 263 |
'servers' => [ "127.0.0.1:11213" ], |
| 264 |
'connect_timeout' => 20, |
| 265 |
'select_timeout' => 20 |
| 266 |
}; |
| 267 |
print "Here are the memcached results with D,B,H,C:\n"; |
| 268 |
$val = $memd->get("D"); |
| 269 |
if ($val) { print "$val\n"; } |
| 270 |
$val = $memd->get("B"); |
| 271 |
if ($val) { print "$val\n"; } |
| 272 |
$val = $memd->get("H"); |
| 273 |
if ($val) { print "$val\n"; } |
| 274 |
$val = $memd->get("C"); |
| 275 |
if ($val) { print "$val\n"; } |
| 276 |
print "Here are the memcached results after set:\n"; |
| 277 |
$val = $memd->set("E","5|Ost-TINYINT"); |
| 278 |
$val = $memd->get("E"); |
| 279 |
if ($val) { print "$val\n"; } |
| 280 |
print "Here are the memcached results after set min border:\n"; |
| 281 |
$val = $memd->set("E","-128|Ost"); |
| 282 |
$val = $memd->get("E"); |
| 283 |
if ($val) { print "$val\n"; } |
| 284 |
print "Here are the memcached results after set max border:\n"; |
| 285 |
$val = $memd->set("E","127|Ost"); |
| 286 |
$val = $memd->get("E"); |
| 287 |
if ($val) { print "$val\n"; } |
| 288 |
print "Here are the memcached results after set over max border:\n"; |
| 289 |
$val = $memd->set("E","129|Ost"); |
| 290 |
$val = $memd->get("E"); |
| 291 |
if ($val) { print "$val\n"; } |
| 292 |
$memd->disconnect_all; |
| 293 |
EOF |
| 294 |
|
| 295 |
--sorted_result |
| 296 |
SELECT c1,c2,c21 FROM t1; |
| 297 |
|
| 298 |
# Test BIGINT UNSIGNED |
| 299 |
ALTER TABLE t1 MODIFY c2 BIGINT UNSIGNED; |
| 300 |
|
| 301 |
perl; |
| 302 |
use DBI; |
| 303 |
use Cache::Memcached; |
| 304 |
my $memd = new Cache::Memcached { |
| 305 |
'servers' => [ "127.0.0.1:11213" ], |
| 306 |
'connect_timeout' => 20, |
| 307 |
'select_timeout' => 20 |
| 308 |
}; |
| 309 |
print "Here are the memcached results with D,B,H,C:\n"; |
| 310 |
$val = $memd->get("D"); |
| 311 |
if ($val) { print "$val\n"; } |
| 312 |
$val = $memd->get("B"); |
| 313 |
if ($val) { print "$val\n"; } |
| 314 |
$val = $memd->get("H"); |
| 315 |
if ($val) { print "$val\n"; } |
| 316 |
$val = $memd->get("C"); |
| 317 |
if ($val) { print "$val\n"; } |
| 318 |
print "Here are the memcached results after set:\n"; |
| 319 |
$val = $memd->set("E","5|Ost-BIGINT-UNSIGNED"); |
| 320 |
$val = $memd->get("E"); |
| 321 |
if ($val) { print "$val\n"; } |
| 322 |
print "Here are the memcached results after set max border:\n"; |
| 323 |
$val = $memd->set("E","18446744073709551615|Ost"); |
| 324 |
$val = $memd->get("E"); |
| 325 |
if ($val) { print "$val\n"; } |
| 326 |
print "Here are the memcached results after set over max border:\n"; |
| 327 |
$val = $memd->set("E","18446744073709551616|Ost"); |
| 328 |
$val = $memd->get("E"); |
| 329 |
if ($val) { print "$val\n"; } |
| 330 |
$memd->disconnect_all; |
| 331 |
EOF |
| 332 |
|
| 333 |
# Test MULTI INT COLUMNS |
| 334 |
ALTER TABLE t1 MODIFY c21 BIGINT UNSIGNED; |
| 335 |
|
| 336 |
perl; |
| 337 |
use DBI; |
| 338 |
use Cache::Memcached; |
| 339 |
my $memd = new Cache::Memcached { |
| 340 |
'servers' => [ "127.0.0.1:11213" ], |
| 341 |
'connect_timeout' => 20, |
| 342 |
'select_timeout' => 20 |
| 343 |
}; |
| 344 |
print "Here are the memcached results with D,B,H,C:\n"; |
| 345 |
$val = $memd->get("D"); |
| 346 |
if ($val) { print "$val\n"; } |
| 347 |
$val = $memd->get("B"); |
| 348 |
if ($val) { print "$val\n"; } |
| 349 |
$val = $memd->get("H"); |
| 350 |
if ($val) { print "$val\n"; } |
| 351 |
$val = $memd->get("C"); |
| 352 |
if ($val) { print "$val\n"; } |
| 353 |
print "Here are the memcached results after set:\n"; |
| 354 |
$val = $memd->set("E","5|5"); |
| 355 |
$val = $memd->get("E"); |
| 356 |
if ($val) { print "$val\n"; } |
| 357 |
print "Here are the memcached results after set max border:\n"; |
| 358 |
$val = $memd->set("E","18446744073709551615|18446744073709551615"); |
| 359 |
$val = $memd->get("E"); |
| 360 |
if ($val) { print "$val\n"; } |
| 361 |
print "Here are the memcached results after set over max border:\n"; |
| 362 |
$val = $memd->set("E","18446744073709551616|18446744073709551616"); |
| 363 |
$val = $memd->get("E"); |
| 364 |
if ($val) { print "$val\n"; } |
| 365 |
print "Here are the memcached results after append:\n"; |
| 366 |
$val = $memd->append("E"," abcde"); |
| 367 |
if ($val) { print "$val\n"; } else { print "Append to integer value is not supported.\n"; } |
| 368 |
$val = $memd->get("E"); |
| 369 |
if ($val) { print "$val\n"; } |
| 370 |
$memd->disconnect_all; |
| 371 |
EOF |
| 372 |
|
| 373 |
--sorted_result |
| 374 |
SELECT c1,c2,c21 FROM t1; |
| 375 |
|
| 376 |
--sorted_result |
| 377 |
SELECT c1,c2,c21 FROM t1; |
| 378 |
|
| 379 |
# Test INTEGER KEY |
| 380 |
DELETE FROM t1; |
| 381 |
ALTER TABLE t1 MODIFY c1 INT; |
| 382 |
ALTER TABLE t1 MODIFY c21 VARCHAR(1024); |
| 383 |
INSERT INTO t1 VALUES (1, 1, 'City', 0, 0, 0); |
| 384 |
INSERT INTO t1 VALUES (2, 2, 'Mitte', 0, 0, 0); |
| 385 |
INSERT INTO t1 VALUES (3, 3, 'West', 0, 0 ,0); |
| 386 |
INSERT INTO t1 VALUES (4, 4, 'Norderstedt', 0, 0, 0); |
| 387 |
|
| 388 |
--sorted_result |
| 389 |
SELECT c1,c2,c21 FROM t1; |
| 390 |
|
| 391 |
perl; |
| 392 |
use DBI; |
| 393 |
use Cache::Memcached; |
| 394 |
my $memd = new Cache::Memcached { |
| 395 |
'servers' => [ "127.0.0.1:11213" ], |
| 396 |
'connect_timeout' => 20, |
| 397 |
'select_timeout' => 20 |
| 398 |
}; |
| 399 |
print "Here are the memcached results with 1,2,3,4:\n"; |
| 400 |
$val = $memd->get("1"); |
| 401 |
if ($val) { print "$val\n"; } |
| 402 |
$val = $memd->get("2"); |
| 403 |
if ($val) { print "$val\n"; } |
| 404 |
$val = $memd->get("3"); |
| 405 |
if ($val) { print "$val\n"; } |
| 406 |
$val = $memd->get("4"); |
| 407 |
if ($val) { print "$val\n"; } |
| 408 |
print "Here are the memcached results after set:\n"; |
| 409 |
$val = $memd->set("5","5|Ost-INT-KEY"); |
| 410 |
$val = $memd->get("5"); |
| 411 |
if ($val) { print "$val\n"; } |
| 412 |
print "Here are the memcached results after add key with min border:\n"; |
| 413 |
$val = $memd->add("-2147483648", "6|Ost"); |
| 414 |
$val = $memd->get("-2147483648"); |
| 415 |
if ($val) { print "$val\n"; } |
| 416 |
print "Here are the memcached results after add key with max border:\n"; |
| 417 |
$val = $memd->add("2147483647","7|Ost"); |
| 418 |
$val = $memd->get("2147483647"); |
| 419 |
if ($val) { print "$val\n"; } |
| 420 |
print "Here are the memcached results after add key with over max border:\n"; |
| 421 |
$val = $memd->add("2147483648","8|Ost"); |
| 422 |
$val = $memd->get("2147483648"); |
| 423 |
if ($val) { print "$val\n"; } |
| 424 |
$memd->disconnect_all; |
| 425 |
EOF |
| 426 |
|
| 427 |
DROP TABLE t1; |
| 428 |
SET sql_mode=default; |
| 429 |
|
| 430 |
--echo # |
| 431 |
--echo # Bug#20535517 INCORRECT HANDLING OF UNSIGNED NOT NULL INTEGERS IN INNODB_MEMCACHED |
| 432 |
--echo # |
| 433 |
|
| 434 |
perl; |
| 435 |
use DBI; |
| 436 |
use Cache::Memcached; |
| 437 |
my $memd = new Cache::Memcached { |
| 438 |
'servers' => [ "127.0.0.1:11213" ], |
| 439 |
'connect_timeout' => 20, |
| 440 |
'select_timeout' => 20 |
| 441 |
}; |
| 442 |
|
| 443 |
$memd->get('@@int_test'); |
| 444 |
$memd->set("E","543"); |
| 445 |
|
| 446 |
print "Here are the memcached results with E:\n"; |
| 447 |
$val = $memd->get("E"); |
| 448 |
if ($val) { print "$val\n"; } |
| 449 |
$memd->disconnect_all; |
| 450 |
EOF |
| 451 |
|
| 452 |
SELECT * FROM int_test; |
| 453 |
DROP TABLE int_test; |
| 454 |
|
| 455 |
UNINSTALL PLUGIN daemon_memcached; |
| 456 |
DROP DATABASE innodb_memcache; |
| 457 |
|
| 458 |
SET @@global.transaction_isolation= @transaction_isolation; |