| 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-r-batch-size': unsigned value"); |
| 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 @auto_commit= @@global.autocommit; |
| 13 |
SET @innodb_lock_wait_timeout_old=@@global.innodb_lock_wait_timeout; |
| 14 |
SET @@global.innodb_lock_wait_timeout=1; |
| 15 |
SET @lock_wait_timeout_old=@@global.lock_wait_timeout; |
| 16 |
SET @@global.lock_wait_timeout=1; |
| 17 |
SET @@global.autocommit=0; |
| 18 |
SET @transaction_isolation= @@global.transaction_isolation; |
| 19 |
SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE; |
| 20 |
SET @wait= @@global.wait_timeout; |
| 21 |
|
| 22 |
# Create the memcached tables |
| 23 |
--disable_query_log |
| 24 |
source include/memcache_config.inc; |
| 25 |
--enable_query_log |
| 26 |
|
| 27 |
INSERT INTO cache_policies VALUES("cache_policy", "innodb_only", |
| 28 |
"innodb_only", "innodb_only", "innodb_only"); |
| 29 |
|
| 30 |
INSERT INTO config_options VALUES("separator", "|"); |
| 31 |
|
| 32 |
# describe table for memcache |
| 33 |
INSERT INTO containers VALUES ("desc_t1", "test", "t1", |
| 34 |
"c1", "c2,c21", "c3", "c4", "c5", "PRIMARY"); |
| 35 |
|
| 36 |
CREATE USER mysqltest1@localhost; |
| 37 |
COMMIT; |
| 38 |
connect (mysqltest1,localhost,mysqltest1,,); |
| 39 |
connection mysqltest1; |
| 40 |
|
| 41 |
USE test; |
| 42 |
|
| 43 |
--disable_warnings |
| 44 |
DROP TABLE IF EXISTS t1; |
| 45 |
--enable_warnings |
| 46 |
CREATE TABLE t1 (c1 VARCHAR(32), |
| 47 |
c2 VARCHAR(1024), |
| 48 |
c21 VARCHAR(1024), |
| 49 |
c3 INT, c4 BIGINT UNSIGNED, c5 INT, primary key(c1)) |
| 50 |
ENGINE = INNODB; |
| 51 |
|
| 52 |
INSERT INTO t1 VALUES ('D', 'Darmstadt', 'City', 0, 0, 0); |
| 53 |
INSERT INTO t1 VALUES ('B', 'Berlin', 'Mitte', 0, 0, 0); |
| 54 |
INSERT INTO t1 VALUES ('C', 'Cottbus', 'West', 0, 0 ,0); |
| 55 |
INSERT INTO t1 VALUES ('H', 'Hamburg', 'Norderstedt', 0, 0, 0); |
| 56 |
COMMIT; |
| 57 |
|
| 58 |
connection default; |
| 59 |
# Tables must exist before plugin can be started! |
| 60 |
--let $memcached_address=127.0.0.1:11263 |
| 61 |
--source ../include/load_daemon_memcached_expecting_success.inc |
| 62 |
SELECT @@global.daemon_memcached_r_batch_size; |
| 63 |
--error ER_INCORRECT_GLOBAL_LOCAL_VAR |
| 64 |
SET @@global.daemon_memcached_r_batch_size=100; |
| 65 |
|
| 66 |
connection mysqltest1; |
| 67 |
|
| 68 |
--sorted_result |
| 69 |
SELECT c1,c2,c21 FROM t1; |
| 70 |
COMMIT; |
| 71 |
connection default; |
| 72 |
|
| 73 |
|
| 74 |
perl; |
| 75 |
use DBI; |
| 76 |
use Cache::Memcached; |
| 77 |
my $memd = new Cache::Memcached { |
| 78 |
'servers' => [ "127.0.0.1:11263" ], |
| 79 |
'connect_timeout' => 20, |
| 80 |
'select_timeout' => 20 |
| 81 |
}; |
| 82 |
print "Here are the memcached results:\n"; |
| 83 |
$val = $memd->get("B"); |
| 84 |
if ($val) { print "$val\n"; } |
| 85 |
$val = $memd->get("C"); |
| 86 |
if ($val) { print "$val\n"; } |
| 87 |
$memd->disconnect_all; |
| 88 |
EOF |
| 89 |
--sorted_result |
| 90 |
SELECT c1,c2,c21 FROM test.t1; |
| 91 |
|
| 92 |
connection mysqltest1; |
| 93 |
--sorted_result |
| 94 |
SELECT c1,c2,c21 FROM t1 FOR UPDATE; |
| 95 |
ROLLBACK; |
| 96 |
|
| 97 |
connection default; |
| 98 |
perl; |
| 99 |
use DBI; |
| 100 |
use Cache::Memcached; |
| 101 |
my $memd = new Cache::Memcached { |
| 102 |
'servers' => [ "127.0.0.1:11263" ], |
| 103 |
'connect_timeout' => 20, |
| 104 |
'select_timeout' => 20 |
| 105 |
}; |
| 106 |
print "Here are the memcached results:\n"; |
| 107 |
$val = $memd->get("C"); |
| 108 |
if ($val) { print "$val\n"; } |
| 109 |
$val = $memd->get("D"); |
| 110 |
if ($val) { print "$val\n"; } |
| 111 |
$memd->disconnect_all; |
| 112 |
EOF |
| 113 |
--sorted_result |
| 114 |
SELECT c1,c2,c21 FROM test.t1; |
| 115 |
|
| 116 |
connection mysqltest1; |
| 117 |
|
| 118 |
# With latest checkin, the memcached plugin will automatically commit |
| 119 |
# transactions when the connection is closed. So we cannot test the |
| 120 |
# timeout with the memcached connection closed. If there are new ways |
| 121 |
# to test such, we can re-enable this |
| 122 |
#--error 1205 |
| 123 |
SELECT c1,c2,c21 FROM test.t1 FOR UPDATE; |
| 124 |
ROLLBACK; |
| 125 |
|
| 126 |
connection default; |
| 127 |
perl; |
| 128 |
use DBI; |
| 129 |
use Cache::Memcached; |
| 130 |
my $memd = new Cache::Memcached { |
| 131 |
'servers' => [ "127.0.0.1:11263" ], |
| 132 |
'connect_timeout' => 20, |
| 133 |
'select_timeout' => 20 |
| 134 |
}; |
| 135 |
print "Here are the memcached results:\n"; |
| 136 |
$val = $memd->get("D"); |
| 137 |
if ($val) { print "$val\n"; } |
| 138 |
$val = $memd->get("H"); |
| 139 |
if ($val) { print "$val\n"; } |
| 140 |
$val = $memd->get("D"); |
| 141 |
if ($val) { print "$val\n"; } |
| 142 |
$val = $memd->get("H"); |
| 143 |
if ($val) { print "$val\n"; } |
| 144 |
$memd->disconnect_all; |
| 145 |
EOF |
| 146 |
--sorted_result |
| 147 |
SELECT c1,c2,c21 FROM test.t1; |
| 148 |
|
| 149 |
connection mysqltest1; |
| 150 |
--sorted_result |
| 151 |
SELECT c1,c2,c21 FROM t1 FOR UPDATE; |
| 152 |
DROP TABLE test.t1; |
| 153 |
COMMIT; |
| 154 |
|
| 155 |
connection default; |
| 156 |
disconnect mysqltest1; |
| 157 |
|
| 158 |
UNINSTALL PLUGIN daemon_memcached; |
| 159 |
DROP DATABASE innodb_memcache; |
| 160 |
DROP USER mysqltest1@localhost; |
| 161 |
|
| 162 |
SET @@global.transaction_isolation= @transaction_isolation; |
| 163 |
SET @@global.autocommit=@auto_commit; |
| 164 |
SET @@global.innodb_lock_wait_timeout=@innodb_lock_wait_timeout_old; |
| 165 |
SET @@global.lock_wait_timeout=@lock_wait_timeout_old; |