1source include/not_valgrind.inc; 2source include/have_memcached_plugin.inc; 3source include/not_windows.inc; 4 5--disable_query_log 6CALL mtr.add_suppression("daemon-memcached-r-batch-size': unsigned value"); 7CALL mtr.add_suppression("Could not obtain server's UPN to be used as target service name"); 8CALL mtr.add_suppression("Warning: MySQL is trying to drop"); 9--enable_query_log 10 11--enable_connect_log 12SET @auto_commit= @@global.autocommit; 13SET @@global.autocommit=0; 14SET @transaction_isolation= @@global.transaction_isolation; 15SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE; 16SET @lock_wait=@@global.lock_wait_timeout; 17SET @@global.lock_wait_timeout=1; 18SET @innodb_lock_wait=@@global.innodb_lock_wait_timeout; 19SET @@global.innodb_lock_wait_timeout=1; 20 21# Create the memcached tables 22--disable_query_log 23source include/memcache_config.inc; 24--enable_query_log 25 26INSERT INTO cache_policies VALUES("cache_policy", "innodb_only", 27 "innodb_only", "innodb_only", "innodb_only"); 28 29INSERT INTO config_options VALUES("separator", "|"); 30 31# describe table for memcache 32INSERT INTO containers VALUES ("desc_t1", "test", "t1", 33 "c1", "c2,c21", "c3", "c4", "c5", "PRIMARY"); 34 35CREATE USER mysqltest1@localhost; 36COMMIT; 37connect (mysqltest1,localhost,mysqltest1,,); 38connection mysqltest1; 39 40USE test; 41 42--disable_warnings 43DROP TABLE IF EXISTS t1; 44--enable_warnings 45CREATE TABLE t1 (c1 VARCHAR(32), 46 c2 VARCHAR(1024), 47 c21 VARCHAR(1024), 48 c3 INT, c4 BIGINT UNSIGNED, c5 INT, primary key(c1)) 49ENGINE = INNODB; 50 51COMMIT; 52 53connection default; 54# Tables must exist before plugin can be started! 55--let $memcached_address=127.0.0.1:11266 56--source ../include/load_daemon_memcached_expecting_success.inc 57SELECT @@global.daemon_memcached_w_batch_size; 58--error ER_INCORRECT_GLOBAL_LOCAL_VAR 59SET @@global.daemon_memcached_w_batch_size=100; 60 61connection mysqltest1; 62 63--sorted_result 64SELECT c1,c2,c21 FROM t1; 65COMMIT; 66 67connection default; 68perl; 69use DBI; 70use Cache::Memcached; 71my $memd = new Cache::Memcached { 72 'servers' => [ "127.0.0.1:11266" ], 73 'connect_timeout' => 20, 74 'select_timeout' => 20 75}; 76#print "Here are the memcached :\n"; 77$val = $memd->set("B","Berlin|Mitte"); 78if ($val) { print "$val\n"; } 79$val = $memd->set("D","Darmstadt|City"); 80if ($val) { print "$val\n"; } 81$val = $memd->set("C","Cottbus|Süd"); 82if ($val) { print "$val\n"; } 83$val = $memd->set("H","Hamburg|Altona"); 84if ($val) { print "$val\n"; } 85$memd->disconnect_all; 86EOF 87--sorted_result 88SELECT c1,c2,c21 FROM test.t1; 89 90connection mysqltest1; 91--sorted_result 92SELECT c1,c2,c21 FROM t1 FOR UPDATE; 93ROLLBACK; 94 95connection default; 96perl; 97use DBI; 98use Cache::Memcached; 99my $memd = new Cache::Memcached { 100 'servers' => [ "127.0.0.1:11266" ], 101 'connect_timeout' => 20, 102 'select_timeout' => 20 103}; 104print "Here are the memcached results:\n"; 105$val = $memd->add("M","München|Perlach"); 106if ($val) { print "$val\n"; } 107$val = $memd->add("N","Nürnberg|Nord"); 108if ($val) { print "$val\n"; } 109$val = $memd->add("O","Oldenburg|Friesland"); 110if ($val) { print "$val\n"; } 111$val = $memd->add("S","Stuttgart|Schwaben"); 112if ($val) { print "$val\n"; } 113$val = $memd->add("G","Gossen|City"); 114if ($val) { print "$val\n"; } 115$val = $memd->add("F","Frankfurt|Sachsenhausen"); 116if ($val) { print "$val\n"; } 117$val = $memd->add("E","Essen|West"); 118if ($val) { print "$val\n"; } 119$val = $memd->add("P","Paderborn|City"); 120if ($val) { print "$val\n"; } 121$memd->disconnect_all; 122EOF 123--sorted_result 124SELECT c1,c2,c21 FROM test.t1; 125 126connection mysqltest1; 127SELECT c1,c2,c21 FROM test.t1 FOR UPDATE; 128COMMIT; 129 130connection default; 131perl; 132use DBI; 133use Cache::Memcached; 134my $memd = new Cache::Memcached { 135 'servers' => [ "127.0.0.1:11266" ], 136 'connect_timeout' => 20, 137 'select_timeout' => 20 138}; 139print "Here are the memcached results:\n"; 140$val = $memd->replace("G","Gossen|C"); 141if ($val) { print "$val\n"; } 142$val = $memd->replace("F","Frankfurt|S"); 143if ($val) { print "$val\n"; } 144$val = $memd->replace("E","Essen|W"); 145if ($val) { print "$val\n"; } 146$memd->disconnect_all; 147EOF 148--sorted_result 149SELECT SLEEP(2); 150SELECT c1,c2,c21 FROM test.t1; 151 152connection mysqltest1; 153# With latest checkin, the memcached plugin will automatically commit 154# transactions when you close the connection. So we cannot test the 155# timeout with the memcached connection closed. If there are new ways 156# to test such, we can re-enable this 157# --error ER_LOCK_WAIT_TIMEOUT 158SELECT c1,c2,c21 FROM test.t1 FOR UPDATE; 159DROP TABLE test.t1; 160COMMIT; 161 162connection default; 163disconnect mysqltest1; 164 165UNINSTALL PLUGIN daemon_memcached; 166DROP DATABASE innodb_memcache; 167DROP USER mysqltest1@localhost; 168 169SET @@global.transaction_isolation= @transaction_isolation; 170SET @@global.autocommit=@auto_commit; 171SET @@global.lock_wait_timeout=@lock_wait; 172SET @@global.innodb_lock_wait_timeout=@innodb_lock_wait; 173