← Back to team overview

mysql-proxy-discuss team mailing list archive

>16Mbyte packets aka #35202 and API changes

 

Hi,

http://bugs.mysql.com/35202 is about packets larger than 16MByte which can happen on the client side of for a huge INSERT or SELECT and for resultsets when you have rows larger than 16MByte.

We had a regression in the handling of those packets for a few releases (all 0.7.x at least). A fix will land in the 0.8 release which is just around the corner.

The patchset also allows to handle and generate large packets from within the proxy (take a look at the test-suite and the "overlong" tests)

  http://bazaar.launchpad.net/~mysql-proxy-developers/mysql-proxy/trunk/files/head%3A/tests/suite/base/t/

Copying from the overlong.test:

# all the tests are about handling >16M packets and their packet-ids
# as there is a proxy in between the client's packet-id sequence might
# be different than the servers:
# - client sends a >16M query (2 packets), proxy replaces it by a small
#   query (1 packet), the server will reply with packet-id 1 which has
#   to be mapped to packet-id 2 when it hits the client (see 3.)
# - the same the other way around (see 4.)

To handle this nice and transparently all references to the sock- >packet_id are removed. Instead you get 3 new functions and 1 is changed:

(from src/network-mysqld.h)
NETWORK_API int network_mysqld_queue_append(network_socket *sock, network_queue *queue, const char *data, size_t len); NETWORK_API int network_mysqld_queue_append_raw(network_socket *sock, network_queue *queue, GString *data);
NETWORK_API int network_mysqld_queue_reset(network_socket *sock);
NETWORK_API int network_mysqld_queue_sync(network_socket *dst, network_socket *src);

1) network_mysqld_queue_append() got changed to take the socket instead of the packet-id. We track the packet-ids now internally, no need to pass it in anymore and increment it by hand. 2) network_mysqld_queue_append_raw() is used in places where network_queue_append() was used directly. It is aware of packet-ids and patches them if necessary while network_queue_append is the low- level io-queue 3) network_mysqld_queue_reset() resets the packet-id counter and disables the checks that are enforced by the above _append() functions 4) network_mysqld_queue_sync() copies the packet-id to another queue to make sure it starts at the right id. This is only used on one place right now: proxy-plugin.c -> read_auth() to make sure the generated server-side packet has the same packet-id is the client-side packet.

If you have a plugin that tweaks the ->packet_id directly, just ping me and I'll help you to update the code to this API. Usually all you need to do is remove the ->packet_id lines and perhaps call the _reset() function in the right place.

Jan