Merge lp:~linuxjedi/drizzle/trunk-bug-656577 into lp:drizzle/7.0

Proposed by Andrew Hutchings
Status: Merged
Approved by: Brian Aker
Approved revision: 1881
Merged at revision: 1884
Proposed branch: lp:~linuxjedi/drizzle/trunk-bug-656577
Merge into: lp:drizzle/7.0
Diff against target: 407 lines (+51/-37)
10 files modified
client/drizzle.cc (+2/-2)
drizzled/drizzled.cc (+3/-3)
libdrizzle/common.h (+1/-0)
libdrizzle/conn.c (+1/-1)
libdrizzle/drizzle.c (+5/-0)
plugin/mysql_protocol/mysql_protocol.cc (+2/-2)
plugin/mysql_protocol/net_serv.cc (+10/-2)
tests/r/func_compress.result (+1/-1)
tests/r/func_str.result (+25/-25)
tests/r/union.result (+1/-1)
To merge this branch: bzr merge lp:~linuxjedi/drizzle/trunk-bug-656577
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+39408@code.launchpad.net

Description of the change

1. Don't SIGPIPE on send() in libdrizzle, client's don't know how to catch it and the code is written to handle this as an error instead of a signal
2. Clear send/recv so that max_packet_size error (and others) can be sent back to client
3. Make default max_packet_size 64M, the old 1M is far too small for things like blob/text
4. Fix test case results after point 3

To post a comment you must log in.
Revision history for this message
Lee Bieber (kalebral-deactivatedaccount) wrote :
1882. By Andrew Hutchings

Fix min() usage for 32bit
Fix Solaris doesn't follow POSIX standard for send()

Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

Both the Solaris and 32bit build failures are now fixed

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client/drizzle.cc'
2--- client/drizzle.cc 2010-10-06 17:34:30 +0000
3+++ client/drizzle.cc 2010-10-27 06:51:48 +0000
4@@ -340,7 +340,7 @@
5 static uint32_t delimiter_length= 1;
6 unsigned short terminal_width= 80;
7
8-int drizzleclient_real_query_for_lazy(const char *buf, int length,
9+int drizzleclient_real_query_for_lazy(const char *buf, size_t length,
10 drizzle_result_st *result,
11 uint32_t *error_code);
12 int drizzleclient_store_result_for_lazy(drizzle_result_st *result);
13@@ -2669,7 +2669,7 @@
14 The different commands
15 ***************************************************************************/
16
17-int drizzleclient_real_query_for_lazy(const char *buf, int length,
18+int drizzleclient_real_query_for_lazy(const char *buf, size_t length,
19 drizzle_result_st *result,
20 uint32_t *error_code)
21 {
22
23=== modified file 'drizzled/drizzled.cc'
24--- drizzled/drizzled.cc 2010-10-26 19:14:30 +0000
25+++ drizzled/drizzled.cc 2010-10-27 06:51:48 +0000
26@@ -787,7 +787,7 @@
27
28 static void check_limits_map(uint32_t in_max_allowed_packet)
29 {
30- global_system_variables.max_allowed_packet= (1024*1024L);
31+ global_system_variables.max_allowed_packet= (64*1024*1024L);
32 if (in_max_allowed_packet < 1024 || in_max_allowed_packet > 1024*1024L*1024L)
33 {
34 cout << N_("Error: Invalid Value for max_allowed_packet");
35@@ -1291,7 +1291,7 @@
36 N_("The maximum length of the result of function group_concat."))
37 ("join-buffer-size", po::value<uint64_t>(&global_system_variables.join_buff_size)->default_value(128*1024L)->notifier(&check_limits_join_buffer_size),
38 N_("The size of the buffer that is used for full joins."))
39- ("max-allowed-packet", po::value<uint32_t>(&global_system_variables.max_allowed_packet)->default_value(1024*1024L)->notifier(&check_limits_map),
40+ ("max-allowed-packet", po::value<uint32_t>(&global_system_variables.max_allowed_packet)->default_value(64*1024*1024L)->notifier(&check_limits_map),
41 N_("Max packetlength to send/receive from to server."))
42 ("max-connect-errors", po::value<uint64_t>(&max_connect_errors)->default_value(MAX_CONNECT_ERRORS)->notifier(&check_limits_mce),
43 N_("If there is more than this number of interrupted connections from a "
44@@ -1899,7 +1899,7 @@
45 N_("Max packetlength to send/receive from to server."),
46 (char**) &global_system_variables.max_allowed_packet,
47 (char**) &max_system_variables.max_allowed_packet, 0, GET_UINT32,
48- REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
49+ REQUIRED_ARG, 64*1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
50 {"max_connect_errors", OPT_MAX_CONNECT_ERRORS,
51 N_("If there is more than this number of interrupted connections from a "
52 "host this host will be blocked from further connections."),
53
54=== modified file 'libdrizzle/common.h'
55--- libdrizzle/common.h 2010-09-28 07:47:48 +0000
56+++ libdrizzle/common.h 2010-10-27 06:51:48 +0000
57@@ -33,6 +33,7 @@
58 #include <string.h>
59 #include <sys/uio.h>
60 #include <unistd.h>
61+#include <signal.h>
62
63 #include "drizzle_local.h"
64 #include "conn_local.h"
65
66=== modified file 'libdrizzle/conn.c'
67--- libdrizzle/conn.c 2010-09-28 07:47:48 +0000
68+++ libdrizzle/conn.c 2010-10-27 06:51:48 +0000
69@@ -1007,7 +1007,7 @@
70 while (con->buffer_size != 0)
71 {
72
73- write_size = send(con->fd,(char *) con->buffer_ptr, con->buffer_size,0);
74+ write_size = send(con->fd,(char *) con->buffer_ptr, con->buffer_size, 0);
75
76 drizzle_log_crazy(con->drizzle, "write fd=%d return=%zd errno=%d", con->fd,
77 write_size, errno);
78
79=== modified file 'libdrizzle/drizzle.c'
80--- libdrizzle/drizzle.c 2010-09-28 07:47:48 +0000
81+++ libdrizzle/drizzle.c 2010-10-27 06:51:48 +0000
82@@ -67,6 +67,11 @@
83 if ( WSAStartup( MAKEWORD(2,2), &wsaData ) != 0 )
84 printf("Error at WSAStartup()\n");
85 #endif
86+ struct sigaction act;
87+
88+ act.sa_handler = SIG_IGN;
89+ sigaction(SIGPIPE, &act, NULL);
90+
91 if (drizzle == NULL)
92 {
93 drizzle= malloc(sizeof(drizzle_st));
94
95=== modified file 'plugin/mysql_protocol/mysql_protocol.cc'
96--- plugin/mysql_protocol/mysql_protocol.cc 2010-10-25 20:36:07 +0000
97+++ plugin/mysql_protocol/mysql_protocol.cc 2010-10-27 06:51:48 +0000
98@@ -206,8 +206,6 @@
99 return false; // We have to close it.
100
101 net.error= 0;
102- *packet_length= 0;
103- return true;
104 }
105
106 *l_packet= (char*) net.read_pos;
107@@ -420,6 +418,8 @@
108
109 drizzleclient_net_write_command(&net,(unsigned char) 255, (unsigned char*) "", 0, (unsigned char*) err, length);
110
111+ drizzleclient_net_flush(&net);
112+
113 session->main_da.can_overwrite_status= false;
114 }
115
116
117=== modified file 'plugin/mysql_protocol/net_serv.cc'
118--- plugin/mysql_protocol/net_serv.cc 2010-05-19 01:22:29 +0000
119+++ plugin/mysql_protocol/net_serv.cc 2010-10-27 06:51:48 +0000
120@@ -158,7 +158,7 @@
121 if (length >= net->max_packet_size)
122 {
123 /* @todo: 1 and 2 codes are identical. */
124- net->error= 1;
125+ net->error= 3;
126 net->last_errno= ER_NET_PACKET_TOO_LARGE;
127 my_error(ER_NET_PACKET_TOO_LARGE, MYF(0));
128 return(1);
129@@ -599,7 +599,7 @@
130 my_real_read(NET *net, size_t *complen)
131 {
132 unsigned char *pos;
133- size_t length;
134+ size_t length= 0;
135 uint32_t i,retry_count=0;
136 size_t len=packet_error;
137 uint32_t remain= (net->compress ? NET_HEADER_SIZE+COMP_HEADER_SIZE :
138@@ -674,6 +674,14 @@
139 {
140 if (drizzleclient_net_realloc(net,helping))
141 {
142+ /* Clear the buffer so libdrizzle doesn't keep retrying */
143+ while (len > 0)
144+ {
145+ length= read(net->vio->sd, net->buff, min((size_t)net->max_packet, len));
146+ assert((long)length > 0L);
147+ len-= length;
148+ }
149+
150 len= packet_error; /* Return error and close connection */
151 goto end;
152 }
153
154=== modified file 'tests/r/func_compress.result'
155--- tests/r/func_compress.result 2010-05-27 19:36:37 +0000
156+++ tests/r/func_compress.result 2010-10-27 06:51:48 +0000
157@@ -66,7 +66,7 @@
158 NULL
159 Warnings:
160 Error 1259 ZLIB: Input data corrupted
161-Error 1256 Uncompressed data size too large; the maximum size is 1048576 (based on max_allowed_packet). The length of uncompressed data may also be corrupted.
162+Error 1256 Uncompressed data size too large; the maximum size is 67108864 (based on max_allowed_packet). The length of uncompressed data may also be corrupted.
163 drop table t1;
164 set @@max_allowed_packet=1048576*100;
165 select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
166
167=== modified file 'tests/r/func_str.result'
168--- tests/r/func_str.result 2010-10-14 18:58:48 +0000
169+++ tests/r/func_str.result 2010-10-27 06:51:48 +0000
170@@ -287,7 +287,7 @@
171 length(repeat("a",100000000)) length(repeat("a",1000*64))
172 NULL 64000
173 Warnings:
174-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
175+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
176 select position("0" in "baaa" in (1)),position("0" in "1" in (1,2,3)),position("sql" in ("mysql"));
177 position("0" in "baaa" in (1)) position("0" in "1" in (1,2,3)) position("sql" in ("mysql"))
178 1 0 3
179@@ -1374,7 +1374,7 @@
180 repeat('hello', 4294967295)
181 NULL
182 Warnings:
183-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
184+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
185 select repeat('hello', -4294967296);
186 repeat('hello', -4294967296)
187
188@@ -1382,7 +1382,7 @@
189 repeat('hello', 4294967296)
190 NULL
191 Warnings:
192-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
193+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
194 select repeat('hello', -4294967297);
195 repeat('hello', -4294967297)
196
197@@ -1390,7 +1390,7 @@
198 repeat('hello', 4294967297)
199 NULL
200 Warnings:
201-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
202+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
203 select repeat('hello', -18446744073709551615);
204 repeat('hello', -18446744073709551615)
205
206@@ -1401,7 +1401,7 @@
207 repeat('hello', 18446744073709551615)
208 NULL
209 Warnings:
210-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
211+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
212 select repeat('hello', -18446744073709551616);
213 repeat('hello', -18446744073709551616)
214
215@@ -1414,7 +1414,7 @@
216 Warnings:
217 Error 1292 Truncated incorrect DECIMAL value: ''
218 Error 1292 Truncated incorrect DECIMAL value: ''
219-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
220+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
221 select repeat('hello', -18446744073709551617);
222 repeat('hello', -18446744073709551617)
223
224@@ -1427,7 +1427,7 @@
225 Warnings:
226 Error 1292 Truncated incorrect DECIMAL value: ''
227 Error 1292 Truncated incorrect DECIMAL value: ''
228-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
229+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
230 select space(-1);
231 space(-1)
232
233@@ -1438,7 +1438,7 @@
234 space(4294967295)
235 NULL
236 Warnings:
237-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
238+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
239 select space(-4294967296);
240 space(-4294967296)
241
242@@ -1446,7 +1446,7 @@
243 space(4294967296)
244 NULL
245 Warnings:
246-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
247+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
248 select space(-4294967297);
249 space(-4294967297)
250
251@@ -1454,7 +1454,7 @@
252 space(4294967297)
253 NULL
254 Warnings:
255-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
256+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
257 select space(-18446744073709551615);
258 space(-18446744073709551615)
259
260@@ -1465,7 +1465,7 @@
261 space(18446744073709551615)
262 NULL
263 Warnings:
264-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
265+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
266 select space(-18446744073709551616);
267 space(-18446744073709551616)
268
269@@ -1478,7 +1478,7 @@
270 Warnings:
271 Error 1292 Truncated incorrect DECIMAL value: ''
272 Error 1292 Truncated incorrect DECIMAL value: ''
273-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
274+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
275 select space(-18446744073709551617);
276 space(-18446744073709551617)
277
278@@ -1491,7 +1491,7 @@
279 Warnings:
280 Error 1292 Truncated incorrect DECIMAL value: ''
281 Error 1292 Truncated incorrect DECIMAL value: ''
282-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
283+Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
284 select rpad('hello', -1, '1');
285 rpad('hello', -1, '1')
286 NULL
287@@ -1502,7 +1502,7 @@
288 rpad('hello', 4294967295, '1')
289 NULL
290 Warnings:
291-Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
292+Warning 1301 Result of rpad() was larger than max_allowed_packet (67108864) - truncated
293 select rpad('hello', -4294967296, '1');
294 rpad('hello', -4294967296, '1')
295 NULL
296@@ -1510,7 +1510,7 @@
297 rpad('hello', 4294967296, '1')
298 NULL
299 Warnings:
300-Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
301+Warning 1301 Result of rpad() was larger than max_allowed_packet (67108864) - truncated
302 select rpad('hello', -4294967297, '1');
303 rpad('hello', -4294967297, '1')
304 NULL
305@@ -1518,7 +1518,7 @@
306 rpad('hello', 4294967297, '1')
307 NULL
308 Warnings:
309-Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
310+Warning 1301 Result of rpad() was larger than max_allowed_packet (67108864) - truncated
311 select rpad('hello', -18446744073709551615, '1');
312 rpad('hello', -18446744073709551615, '1')
313 NULL
314@@ -1529,7 +1529,7 @@
315 rpad('hello', 18446744073709551615, '1')
316 NULL
317 Warnings:
318-Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
319+Warning 1301 Result of rpad() was larger than max_allowed_packet (67108864) - truncated
320 select rpad('hello', -18446744073709551616, '1');
321 rpad('hello', -18446744073709551616, '1')
322 NULL
323@@ -1542,7 +1542,7 @@
324 Warnings:
325 Error 1292 Truncated incorrect DECIMAL value: ''
326 Error 1292 Truncated incorrect DECIMAL value: ''
327-Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
328+Warning 1301 Result of rpad() was larger than max_allowed_packet (67108864) - truncated
329 select rpad('hello', -18446744073709551617, '1');
330 rpad('hello', -18446744073709551617, '1')
331 NULL
332@@ -1555,7 +1555,7 @@
333 Warnings:
334 Error 1292 Truncated incorrect DECIMAL value: ''
335 Error 1292 Truncated incorrect DECIMAL value: ''
336-Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
337+Warning 1301 Result of rpad() was larger than max_allowed_packet (67108864) - truncated
338 select lpad('hello', -1, '1');
339 lpad('hello', -1, '1')
340 NULL
341@@ -1566,7 +1566,7 @@
342 lpad('hello', 4294967295, '1')
343 NULL
344 Warnings:
345-Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
346+Warning 1301 Result of lpad() was larger than max_allowed_packet (67108864) - truncated
347 select lpad('hello', -4294967296, '1');
348 lpad('hello', -4294967296, '1')
349 NULL
350@@ -1574,7 +1574,7 @@
351 lpad('hello', 4294967296, '1')
352 NULL
353 Warnings:
354-Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
355+Warning 1301 Result of lpad() was larger than max_allowed_packet (67108864) - truncated
356 select lpad('hello', -4294967297, '1');
357 lpad('hello', -4294967297, '1')
358 NULL
359@@ -1582,7 +1582,7 @@
360 lpad('hello', 4294967297, '1')
361 NULL
362 Warnings:
363-Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
364+Warning 1301 Result of lpad() was larger than max_allowed_packet (67108864) - truncated
365 select lpad('hello', -18446744073709551615, '1');
366 lpad('hello', -18446744073709551615, '1')
367 NULL
368@@ -1593,7 +1593,7 @@
369 lpad('hello', 18446744073709551615, '1')
370 NULL
371 Warnings:
372-Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
373+Warning 1301 Result of lpad() was larger than max_allowed_packet (67108864) - truncated
374 select lpad('hello', -18446744073709551616, '1');
375 lpad('hello', -18446744073709551616, '1')
376 NULL
377@@ -1606,7 +1606,7 @@
378 Warnings:
379 Error 1292 Truncated incorrect DECIMAL value: ''
380 Error 1292 Truncated incorrect DECIMAL value: ''
381-Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
382+Warning 1301 Result of lpad() was larger than max_allowed_packet (67108864) - truncated
383 select lpad('hello', -18446744073709551617, '1');
384 lpad('hello', -18446744073709551617, '1')
385 NULL
386@@ -1619,7 +1619,7 @@
387 Warnings:
388 Error 1292 Truncated incorrect DECIMAL value: ''
389 Error 1292 Truncated incorrect DECIMAL value: ''
390-Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
391+Warning 1301 Result of lpad() was larger than max_allowed_packet (67108864) - truncated
392 SELECT CHAR(0xff,0x8f);
393 CHAR(0xff,0x8f)
394 ÿ�
395
396=== modified file 'tests/r/union.result'
397--- tests/r/union.result 2010-09-10 10:05:56 +0000
398+++ tests/r/union.result 2010-10-27 06:51:48 +0000
399@@ -1236,7 +1236,7 @@
400 drop tables t1,t2,t3;
401 SELECT @tmp_max:= @@max_allowed_packet;
402 @tmp_max:= @@max_allowed_packet
403-1048576
404+67108864
405 SET max_allowed_packet=25000000;
406 CREATE TABLE t1 (a mediumtext);
407 CREATE TABLE t2 (b varchar(20));

Subscribers

People subscribed via source and target branches