~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# we are assuming the memcached binary is contained in PATH or
# common directories we might expect it to be in
--exec $DRIZZLE_TEST_DIR/../plugin/memcached_functions/tests/start_mc.sh stop
--exec $DRIZZLE_TEST_DIR/../plugin/memcached_functions/tests/start_mc.sh start

DROP TABLE IF EXISTS `t1`;
--replace_result $MC_PORT MC_A_PORT
--eval select memc_servers_set('127.0.0.1:$MC_PORT');

CREATE TABLE `t1` (id integer NOT NULL auto_increment primary key, bcol text);
INSERT INTO `t1` (bcol) values ('This documentation is NOT distributed under a GPL license. Use of this documentation is subject to the following terms: You may create a printed copy of this documentation solely for your own personal use. Conversion to other formats is allowed as long as the actual content is not altered or edited in any way. You shall not publish or distribute this documentation in any form or on any media, except if you distribute the documentation in a manner similar to how MySQL disseminates it (that is, electronically for download on a Web site with the software) or on a CD-ROM or similar medium, provided however that the documentation is disseminated together with the software on the same medium. Any other use, such as any dissemination of printed copies or use of this documentation, in whole or in part, in another publication, requires the prior written consent from an authorized representative of MySQL AB. MySQL AB reserves any and all rights to this documentation not expressly granted above.');
select memc_set('mysql:doc1', bcol) from t1;
select memc_get('mysql:doc1');

select memc_delete('mysql:doc1');
select memc_get('mysql:doc1');

select memc_set('spot:test', ' Spot ');
select memc_get('spot:test');
select memc_prepend('spot:test', 'See');
select memc_get('spot:test');
select memc_append('spot:test', 'run.');
select memc_get('spot:test');
select memc_delete('spot:test');

select memc_set('increment:test', 1);
select memc_get('increment:test');
select memc_increment('increment:test');
select memc_get('increment:test');
select memc_increment('increment:test', 5);
select memc_get('increment:test');
select memc_increment('increment:test', 20);
select memc_get('increment:test');
select memc_decrement('increment:test', 20);
select memc_get('increment:test');
select memc_decrement('increment:test');
select memc_get('increment:test');
select memc_delete('increment:test');

select memc_set('this_should_expire', '10 seconds', 10);
select memc_get('this_should_expire');
select sleep(5);
select memc_get('this_should_expire');
select sleep(6);
select memc_get('this_should_expire');

select memc_set('add:test', 'someval');
select memc_add('add:test', 'someval');
select memc_delete('add:test');
select memc_add('add:test', 'someval');
select memc_get('add:test');
select memc_delete('add:test');

select memc_add('add:test', 'someval');
select memc_get('add:test');
select memc_replace('replace:test', 'replaced');
select memc_set('replace:test', 'initial');
select memc_get('replace:test');
select memc_replace('replace:test', 'replaced');
select memc_get('replace:test');
select memc_replace('replace:test', 'replaced again');
select memc_get('replace:test');
select memc_delete('replace:test');

select memc_add_by_key('A', 'add:test', 'someval');
select memc_get_by_key('A', 'add:test');
select memc_set_by_key('A', 'replace:test', 'initial');
select memc_get_by_key('A', 'replace:test');
select memc_add_by_key('A', 'add:test', 'someotherval');
select memc_get_by_key('A', 'add:test');
select memc_replace_by_key('A', 'replace:test', 'replaced');
select memc_get_by_key('A', 'replace:test');
select memc_delete_by_key('A', 'replace:test');
select memc_get_by_key('A', 'replace:test');

set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_NO_BLOCK');
select @behavior;
select memc_behavior_set('MEMCACHED_BEHAVIOR_NO_BLOCK', '1');
select memc_behavior_get('MEMCACHED_BEHAVIOR_NO_BLOCK');
select memc_behavior_set('MEMCACHED_BEHAVIOR_NO_BLOCK', @behavior);

set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_SUPPORT_CAS');
select @behavior;
select memc_behavior_set('MEMCACHED_BEHAVIOR_SUPPORT_CAS', '1');
select memc_behavior_get('MEMCACHED_BEHAVIOR_SUPPORT_CAS');
select memc_behavior_set('MEMCACHED_BEHAVIOR_SUPPORT_CAS', @behavior);

set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_TCP_NODELAY');
select memc_behavior_set('MEMCACHED_BEHAVIOR_TCP_NODELAY', '1');
select memc_behavior_get('MEMCACHED_BEHAVIOR_TCP_NODELAY');
select memc_behavior_set('MEMCACHED_BEHAVIOR_TCP_NODELAY', @behavior);

set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS');
select memc_behavior_set('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS', '1');
select memc_behavior_get('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS');
select memc_behavior_set('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS', @behavior);

set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_USER_DATA');
select memc_behavior_set('MEMCACHED_BEHAVIOR_USER_DATA', '1');
select memc_behavior_get('MEMCACHED_BEHAVIOR_USER_DATA');
select memc_behavior_set('MEMCACHED_BEHAVIOR_USER_DATA', @behavior);

set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_SORT_HOSTS');
select memc_behavior_set('MEMCACHED_BEHAVIOR_SORT_HOSTS', '1');
select memc_behavior_get('MEMCACHED_BEHAVIOR_SORT_HOSTS');
select memc_behavior_set('MEMCACHED_BEHAVIOR_SORT_HOSTS', @behavior);

set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_VERIFY_KEY');
select memc_behavior_set('MEMCACHED_BEHAVIOR_VERIFY_KEY', '1');
select memc_behavior_get('MEMCACHED_BEHAVIOR_VERIFY_KEY');
select memc_behavior_set('MEMCACHED_BEHAVIOR_VERIFY_KEY', @behavior);

set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_KETAMA');
select memc_behavior_set('MEMCACHED_BEHAVIOR_KETAMA', '1');
select memc_behavior_get('MEMCACHED_BEHAVIOR_KETAMA');

set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_CACHE_LOOKUPS');
select memc_behavior_set('MEMCACHED_BEHAVIOR_CACHE_LOOKUPS', '1');
select memc_behavior_get('MEMCACHED_BEHAVIOR_CACHE_LOOKUPS');
select memc_behavior_set('MEMCACHED_BEHAVIOR_CACHE_LOOKUPS', @behavior);

set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS');
select memc_behavior_set('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS', '1');
select memc_behavior_get('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS');
select memc_behavior_set('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS', @behavior);

set @preserve_behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');
select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_DEFAULT' );
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');

select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_MD5' );
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');

select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_CRC' );
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');

select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_FNV1_64' );
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');

select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_FNV1A_64' );
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');

select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_FNV1_32' );
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');

select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_FNV1A_32' );
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');

select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_JENKINS' );
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');

select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_HSIEH' );
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');

select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_MURMUR' );
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');

select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH', @preserve_behavior);

set @preserve_dist= memc_behavior_get('MEMCACHED_BEHAVIOR_DISTRIBUTION');
select memc_behavior_set('MEMCACHED_BEHAVIOR_DISTRIBUTION', 'MEMCACHED_DISTRIBUTION_MODULA');
select memc_behavior_get('MEMCACHED_BEHAVIOR_DISTRIBUTION');

select memc_behavior_set('MEMCACHED_BEHAVIOR_DISTRIBUTION', 'MEMCACHED_DISTRIBUTION_CONSISTENT');
select memc_behavior_get('MEMCACHED_BEHAVIOR_DISTRIBUTION');

select memc_behavior_set('MEMCACHED_BEHAVIOR_DISTRIBUTION', 'MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA');
select memc_behavior_get('MEMCACHED_BEHAVIOR_DISTRIBUTION');
select memc_behavior_set('MEMCACHED_BEHAVIOR_DISTRIBUTION', @preserve_dist);

set @size = memc_behavior_get('MEMCACHED_BEHAVIOR_POLL_TIMEOUT');
select @size;
select memc_behavior_set('MEMCACHED_BEHAVIOR_POLL_TIMEOUT', 100);
select memc_behavior_get('MEMCACHED_BEHAVIOR_POLL_TIMEOUT');
select memc_behavior_set('MEMCACHED_BEHAVIOR_POLL_TIMEOUT', @size);


set @size = memc_behavior_get('MEMCACHED_BEHAVIOR_RETRY_TIMEOUT');
select @size;
select memc_behavior_set('MEMCACHED_BEHAVIOR_RETRY_TIMEOUT', 5);
select memc_behavior_get('MEMCACHED_BEHAVIOR_RETRY_TIMEOUT');
select memc_behavior_set('MEMCACHED_BEHAVIOR_RETRY_TIMEOUT', @size);

set @size = memc_behavior_get('MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK');
select @size;
select memc_behavior_set('MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK', 5);
select memc_behavior_get('MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK');
select memc_behavior_set('MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK', @size);

set @size = memc_behavior_get('MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK');
select @size;
select memc_behavior_set('MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK', 5);
select memc_behavior_get('MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK');
select memc_behavior_set('MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK', @size);

--exec $DRIZZLE_TEST_DIR/../plugin/memcached_functions/tests/start_mc.sh stop