MXS-2259: Limit size of client reads

Given the assumption that queries are rarely 16MB long and that
realistically the only time that happens is during a large dump of data,
we can limit the size of a single read to at most one MariaDB/MySQL packet
at a time. This change allows the network throttling to engage a lot
sooner and reduces the maximum overshoot of throtting to 16MB.
This commit is contained in:
Markus Mäkelä
2019-04-05 11:04:04 +03:00
parent aad29404c6
commit 05515cca16
3 changed files with 14 additions and 3 deletions

View File

@ -100,7 +100,6 @@ static inline DCB* dcb_find_in_list(DCB* dcb);
static void dcb_stop_polling_and_shutdown(DCB* dcb);
static bool dcb_maybe_add_persistent(DCB*);
static inline bool dcb_write_parameter_check(DCB* dcb, GWBUF* queue);
static int dcb_bytes_readable(DCB* dcb);
static int dcb_read_no_bytes_available(DCB* dcb, int nreadtotal);
static int dcb_create_SSL(DCB* dcb, SSL_LISTENER* ssl);
static int dcb_read_SSL(DCB* dcb, GWBUF** head);
@ -638,9 +637,10 @@ int dcb_read(DCB* dcb,
* Find the number of bytes available for the DCB's socket
*
* @param dcb The DCB to read from
*
* @return -1 on error, otherwise the total number of bytes available
*/
static int dcb_bytes_readable(DCB* dcb)
int dcb_bytes_readable(DCB* dcb)
{
int bytesavailable;