Merge lp:~linuxjedi/libdrizzle/5.1-bug-1094417 into lp:libdrizzle

Proposed by Andrew Hutchings
Status: Merged
Approved by: Andrew Hutchings
Approved revision: 68
Merged at revision: 68
Proposed branch: lp:~linuxjedi/libdrizzle/5.1-bug-1094417
Merge into: lp:libdrizzle
Diff against target: 58 lines (+35/-1)
2 files modified
libdrizzle/binlog.cc (+27/-0)
tests/unit/binlog.c (+8/-1)
To merge this branch: bzr merge lp:~linuxjedi/libdrizzle/5.1-bug-1094417
Reviewer Review Type Date Requested Status
Drizzle Trunk Pending
Review via email: mp+141451@code.launchpad.net

Description of the change

MySQL 5.6 sends an error when an older binlog client connects. This wasn't handled (and neither was any other binlog error), it now is.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdrizzle/binlog.cc'
2--- libdrizzle/binlog.cc 2012-12-22 08:54:15 +0000
3+++ libdrizzle/binlog.cc 2012-12-29 09:00:30 +0000
4@@ -231,6 +231,33 @@
5 drizzle_state_pop(con);
6 return DRIZZLE_RETURN_EOF;
7 }
8+ else if (con->buffer_ptr[0] == 255)
9+ {
10+ con->result->error_code= drizzle_get_byte2(con->buffer_ptr + 1);
11+ con->error_code= con->result->error_code;
12+ /* Byte 3 is always a '#' character, skip it. */
13+ memcpy(con->result->sqlstate, con->buffer_ptr + 4,
14+ DRIZZLE_MAX_SQLSTATE_SIZE);
15+ con->result->sqlstate[DRIZZLE_MAX_SQLSTATE_SIZE]= 0;
16+ memcpy(con->sqlstate, con->result->sqlstate,
17+ DRIZZLE_MAX_SQLSTATE_SIZE + 1);
18+ con->buffer_ptr+= 9;
19+ con->buffer_size-= 9;
20+ con->packet_size-= 9;
21+
22+ snprintf(con->last_error, DRIZZLE_MAX_ERROR_SIZE, "%.*s",
23+ (int32_t)con->packet_size, con->buffer_ptr);
24+ con->last_error[DRIZZLE_MAX_ERROR_SIZE-1]= 0;
25+ snprintf(con->result->info, DRIZZLE_MAX_INFO_SIZE, "%.*s",
26+ (int32_t)con->packet_size, con->buffer_ptr);
27+ con->result->info[DRIZZLE_MAX_INFO_SIZE-1]= 0;
28+ con->buffer_ptr+= con->packet_size;
29+ con->buffer_size-= con->packet_size;
30+ con->packet_size= 0;
31+
32+ drizzle_state_pop(con);
33+ return DRIZZLE_RETURN_ERROR_CODE;
34+ }
35 else
36 {
37 con->buffer_ptr++;
38
39=== modified file 'tests/unit/binlog.c'
40--- tests/unit/binlog.c 2012-12-27 22:20:37 +0000
41+++ tests/unit/binlog.c 2012-12-29 09:00:30 +0000
42@@ -79,8 +79,15 @@
43 {
44 uint32_t timestamp;
45 ret= drizzle_binlog_get_next_event(result);
46- if (ret != DRIZZLE_RETURN_OK)
47+ if (ret == DRIZZLE_RETURN_EOF)
48+ {
49 break;
50+ }
51+ else if (ret != DRIZZLE_RETURN_OK)
52+ {
53+ printf("Binlog error %s\n", drizzle_error(con));
54+ return EXIT_FAILURE;
55+ }
56 timestamp= drizzle_binlog_event_timestamp(result);
57 /* Test to see if timestamp is greater than 2012-01-01 00:00:00, corrupted
58 * timestamps will have weird values that shoud fail this after several

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: