| 1 |
# Bug#20205934 - ENABLE VALGRIND FOR MEMCACHED TESTS |
| 2 |
source include/not_valgrind.inc; |
| 3 |
source include/have_memcached_plugin.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 |
# Create the memcached tables |
| 10 |
source include/memcache_config.inc; |
| 11 |
--enable_query_log |
| 12 |
|
| 13 |
INSERT INTO cache_policies VALUES('cache_policy', 'innodb_only', |
| 14 |
'innodb_only', 'innodb_only', 'innodb_only'); |
| 15 |
|
| 16 |
INSERT INTO config_options VALUES('separator', '|'); |
| 17 |
|
| 18 |
# describe table for memcache |
| 19 |
INSERT INTO containers VALUES ('desc_t1', 'test', 't1', |
| 20 |
'c1', 'c2', '0', '0', '0', 'PRIMARY'); |
| 21 |
|
| 22 |
USE test; |
| 23 |
let MEMCACHED_PORT=11290; |
| 24 |
|
| 25 |
CREATE TABLE t1 (c1 VARCHAR(32), |
| 26 |
c2 BLOB, |
| 27 |
primary key(c1)) |
| 28 |
ENGINE = INNODB; |
| 29 |
|
| 30 |
INSERT INTO t1 VALUES ('A', repeat('a',8000)); |
| 31 |
INSERT INTO t1 VALUES ('B', 'Berlin'); |
| 32 |
INSERT INTO t1 VALUES ('C', 'Cottbus'); |
| 33 |
INSERT INTO t1 VALUES ('D', 'Darmstadt'); |
| 34 |
INSERT INTO t1 VALUES ('H', 'Hamburg'); |
| 35 |
|
| 36 |
# Tables must exist before plugin can be started! |
| 37 |
--let $memcached_address=127.0.0.1:11290 |
| 38 |
--source ../include/load_daemon_memcached_expecting_success.inc |
| 39 |
|
| 40 |
SELECT @@innodb_api_trx_level; |
| 41 |
SELECT @@innodb_api_bk_commit_interval; |
| 42 |
SELECT @@daemon_memcached_r_batch_size; |
| 43 |
SELECT @@daemon_memcached_w_batch_size; |
| 44 |
|
| 45 |
--write_file $MYSQLTEST_VARDIR/tmp/read_committed.pl |
| 46 |
use DBI; |
| 47 |
use Cache::Memcached; |
| 48 |
my $memcached_port=$ENV{'MEMCACHED_PORT'}; |
| 49 |
|
| 50 |
if (!$memcached_port) { |
| 51 |
print "memcached port is Empty. The test should set ENV variable |
| 52 |
MEMCACHED_PORT\n"; |
| 53 |
exit; |
| 54 |
} |
| 55 |
|
| 56 |
my $memd2 = new Cache::Memcached { |
| 57 |
'servers' => [ "127.0.0.1:$memcached_port" ], |
| 58 |
'connect_timeout' => 2000, |
| 59 |
'select_timeout' => 2000 |
| 60 |
}; |
| 61 |
print "Here are the memcached results with A,B,C,D,E,H\n"; |
| 62 |
|
| 63 |
$val = $memd2->get("A"); |
| 64 |
if ($val) { print "$val\n"; } else { print "Couldn't get value for A\n"; } |
| 65 |
$val = $memd2->get("B"); |
| 66 |
if ($val) { print "$val\n"; } else { print "Couldn't get value for B\n"; } |
| 67 |
$val = $memd2->get("C"); |
| 68 |
if ($val) { print "$val\n"; } else { print "Couldn't get value for C\n"; } |
| 69 |
$val = $memd2->get("D"); |
| 70 |
if ($val) { print "$val\n"; } else { print "Couldn't get value for D\n"; } |
| 71 |
$val = $memd2->get("E"); |
| 72 |
if ($val) { print "$val\n"; } else { print "Couldn't get value for E\n"; } |
| 73 |
$val = $memd2->get("H"); |
| 74 |
if ($val) { print "$val\n"; } else { print "Couldn't get value for H\n"; } |
| 75 |
|
| 76 |
$val1 = "h" x 9907; |
| 77 |
$val = $memd2->add("W","W|$val1"); |
| 78 |
$val = $memd2->get("W"); |
| 79 |
if ($val) { print "$val\n"; } |
| 80 |
|
| 81 |
$memd2->disconnect_all; |
| 82 |
EOF |
| 83 |
|
| 84 |
let MYSQL_DESTDIR=$MYSQLTEST_VARDIR/tmp/; |
| 85 |
|
| 86 |
perl; |
| 87 |
use DBI; |
| 88 |
use Cache::Memcached; |
| 89 |
|
| 90 |
my $memcached_port=$ENV{'MEMCACHED_PORT'} or die; |
| 91 |
|
| 92 |
my $memd = new Cache::Memcached { |
| 93 |
'servers' => [ "127.0.0.1:$memcached_port" ], |
| 94 |
'connect_timeout' => 2000, |
| 95 |
'select_timeout' => 2000 |
| 96 |
}; |
| 97 |
|
| 98 |
if (!$memd->set("A","Ant")) { |
| 99 |
print "Error: A|Ant cannot be inserted.\n"; |
| 100 |
} |
| 101 |
if (!$memd->set("B","Buffalo")) { |
| 102 |
print "Error: B|Buffalo cannot be inserted.\n"; |
| 103 |
} |
| 104 |
if (!$memd->set("C","Cat")) { |
| 105 |
print "Error: C|Cat cannot be inserted.\n"; |
| 106 |
} |
| 107 |
if (!$memd->set("D","Dog")) { |
| 108 |
print "Error: D|Dog cannot be inserted.\n"; |
| 109 |
} |
| 110 |
if (!$memd->set("E","Elephant")) { |
| 111 |
print "Error: E|Elephant cannot be inserted.\n"; |
| 112 |
} |
| 113 |
if (!$memd->set("H","Hen")) { |
| 114 |
print "Error: H|Hen cannot be inserted.\n"; |
| 115 |
} |
| 116 |
print "Opening new connection and doing GET\n"; |
| 117 |
|
| 118 |
my $destdir = $ENV{'MYSQL_DESTDIR'}; |
| 119 |
print "We *shouldn't* see Animal names now\n"; |
| 120 |
system("perl $destdir/read_committed.pl"); |
| 121 |
$memd->disconnect_all; |
| 122 |
EOF |
| 123 |
|
| 124 |
# Now that the connection is closed & Committed, Read again |
| 125 |
# This time we should see Animal values |
| 126 |
perl; |
| 127 |
my $destdir = $ENV{'MYSQL_DESTDIR'}; |
| 128 |
|
| 129 |
print "Connection is closed and transaction is committed\n"; |
| 130 |
print "We *should* see Animal Names now\n"; |
| 131 |
system("perl $destdir/read_committed.pl"); |
| 132 |
EOF |
| 133 |
|
| 134 |
SELECT * FROM t1; |
| 135 |
|
| 136 |
DROP TABLE t1; |
| 137 |
|
| 138 |
# Stop plugin before innodb_memcached configuration |
| 139 |
UNINSTALL PLUGIN daemon_memcached; |
| 140 |
DROP DATABASE innodb_memcache; |
| 141 |
remove_file $MYSQL_DESTDIR/read_committed.pl; |