Rename MAX_BUFFER_SIZE

MAX_BUFFER_SIZE, which is used for limiting the amount of the data
read from a socket renamed to MXS_MAX_NW_READ_BUFFER_SIZE and moved
from gw.h to limits.h.

Consider removing altogether. Difficult to justify since non-blocking
reads are used and the amount of available data is known.
This commit is contained in:
Johan Wikman
2016-10-17 10:24:32 +03:00
parent 8aafa34d66
commit b27774e674
4 changed files with 15 additions and 8 deletions

View File

@ -38,9 +38,6 @@
MXS_BEGIN_DECLS MXS_BEGIN_DECLS
// network buffer is 32K
#define MAX_BUFFER_SIZE 32768
#define GW_NOINTR_CALL(A) do { errno = 0; A; } while (errno == EINTR) #define GW_NOINTR_CALL(A) do { errno = 0; A; } while (errno == EINTR)
bool gw_daemonize(void); bool gw_daemonize(void);

View File

@ -33,7 +33,7 @@ MXS_BEGIN_DECLS
#define MXS_BACKEND_SO_RCVBUF (128 * 1024) #define MXS_BACKEND_SO_RCVBUF (128 * 1024)
/** /**
* MSX_BACKEND_SO_SNDBUF * MXS_BACKEND_SO_SNDBUF
* *
* The value used when setting SO_SNDBUF of backend sockets. * The value used when setting SO_SNDBUF of backend sockets.
*/ */
@ -53,6 +53,16 @@ MXS_BEGIN_DECLS
*/ */
#define MXS_CLIENT_SO_SNDBUF (128 * 1024) #define MXS_CLIENT_SO_SNDBUF (128 * 1024)
/**
* MXS_MAX_NW_READ_BUFFER_SIZE
*
* The maximum amount of data read in one gofrom a client DCB.
*
* TODO: Consider removing altogether so that we always read
* whatever is available in the socket.
*/
#define MXS_MAX_NW_READ_BUFFER_SIZE (32 * 1024)
/** /**
* MXS_MAX_THREADS * MXS_MAX_THREADS
* *

View File

@ -1069,7 +1069,7 @@ dcb_basic_read(DCB *dcb, int bytesavailable, int maxbytes, int nreadtotal, int *
{ {
GWBUF *buffer; GWBUF *buffer;
int bufsize = MXS_MIN(bytesavailable, MAX_BUFFER_SIZE); int bufsize = MXS_MIN(bytesavailable, MXS_MAX_NW_READ_BUFFER_SIZE);
if (maxbytes) if (maxbytes)
{ {
bufsize = MXS_MIN(bufsize, maxbytes - nreadtotal); bufsize = MXS_MIN(bufsize, maxbytes - nreadtotal);
@ -1187,10 +1187,10 @@ dcb_read_SSL(DCB *dcb, GWBUF **head)
static GWBUF * static GWBUF *
dcb_basic_read_SSL(DCB *dcb, int *nsingleread) dcb_basic_read_SSL(DCB *dcb, int *nsingleread)
{ {
unsigned char temp_buffer[MAX_BUFFER_SIZE]; unsigned char temp_buffer[MXS_MAX_NW_READ_BUFFER_SIZE];
GWBUF *buffer = NULL; GWBUF *buffer = NULL;
*nsingleread = SSL_read(dcb->ssl, (void *)temp_buffer, MAX_BUFFER_SIZE); *nsingleread = SSL_read(dcb->ssl, (void *)temp_buffer, MXS_MAX_NW_READ_BUFFER_SIZE);
dcb->stats.n_reads++; dcb->stats.n_reads++;
switch (SSL_get_error(dcb->ssl, *nsingleread)) switch (SSL_get_error(dcb->ssl, *nsingleread))

View File

@ -108,7 +108,7 @@ typedef enum avro_binlog_end
#define TABLE_MAP_MAX_NAME_LEN 64 #define TABLE_MAP_MAX_NAME_LEN 64
/** How many bytes each thread tries to send */ /** How many bytes each thread tries to send */
#define AVRO_DATA_BURST_SIZE MAX_BUFFER_SIZE #define AVRO_DATA_BURST_SIZE (32 * 1024)
/** A CREATE TABLE abstraction */ /** A CREATE TABLE abstraction */
typedef struct table_create typedef struct table_create