Debian Codegraph @

mysql-test/suite/memcached/t/memc241_replace.test

raw
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", "c3", "c4", "c5", "PRIMARY");
28
29 USE test;
30
31 --disable_warnings
32 DROP TABLE IF EXISTS t1;
33 --enable_warnings
34 CREATE TABLE t1 (c1 VARCHAR(32),
35 c2 VARCHAR(1024),
36 c3 INT, c4 BIGINT UNSIGNED, c5 INT, primary key(c1))
37 ENGINE = INNODB;
38
39 INSERT INTO t1 VALUES ('D', 'Darmstadt', 0, 0, 0);
40 INSERT INTO t1 VALUES ('B', 'Berlin', 0, 0, 0);
41 INSERT INTO t1 VALUES ('C', 'Cottbus', 0, 0 ,0);
42 INSERT INTO t1 VALUES ('H', 'Hamburg', 0, 0, 0);
43
44 # Tables must exist before plugin can be started!
45 --let $memcached_address=127.0.0.1:11241
46 --source ../include/load_daemon_memcached_expecting_success.inc
47
48 --sorted_result
49 SELECT c1,c2 FROM t1;
50
51 perl;
52 use DBI;
53 use Cache::Memcached;
54 my $memd = new Cache::Memcached {
55 'servers' => [ "127.0.0.1:11241" ],
56 'connect_timeout' => 20,
57 'select_timeout' => 20
58 };
59 print "Replace H|Hamburg by Hannover:\n";
60 if ($memd->replace("H","Hannover")) {
61 print "Ok.\n";
62 }
63 else {
64 print "Error: H cannot be replaced.\n";
65 }
66 $memd->disconnect_all;
67 EOF
68
69 perl;
70 use DBI;
71 use Cache::Memcached;
72 my $memd = new Cache::Memcached {
73 'servers' => [ "127.0.0.1:11241" ],
74 'connect_timeout' => 20,
75 'select_timeout' => 20
76 };
77 print "Replace H|Hamburg by Hannover:\n";
78 if ($memd->replace("H","Hannover")) {
79 print "Ok.\n";
80 }
81 else {
82 print "Error: H cannot be replaced.\n";
83 }
84 $memd->disconnect_all;
85 EOF
86
87 --sorted_result
88 SELECT c1,c2 FROM t1;
89
90 perl;
91 use DBI;
92 use Cache::Memcached;
93 my $memd = new Cache::Memcached {
94 'servers' => [ "127.0.0.1:11241" ],
95 'connect_timeout' => 20,
96 'select_timeout' => 20
97 };
98 print "Here are the memcached results with H:\n";
99 $val = $memd->get("H");
100 if ($val) { print "$val\n"; }
101 $memd->disconnect_all;
102 EOF
103
104 --sorted_result
105 SELECT c1,c2 FROM t1;
106
107 perl;
108 use DBI;
109 use Cache::Memcached;
110 my $memd = new Cache::Memcached {
111 'servers' => [ "127.0.0.1:11241" ],
112 'connect_timeout' => 20,
113 'select_timeout' => 20
114 };
115 print "Here are the memcached results with D,H:\n";
116 $val = $memd->get("D");
117 if ($val) { print "$val\n"; }
118 $val = $memd->get("H");
119 if ($val) { print "$val\n"; }
120 $memd->disconnect_all;
121 EOF
122
123 DROP TABLE t1;
124
125 UNINSTALL PLUGIN daemon_memcached;
126 DROP DATABASE innodb_memcache;
127
128 SET @@global.transaction_isolation= @transaction_isolation;