Skip to content

Commit 75b79d4

Browse files
committed
Only have auto consume limit on server
Signed-off-by: Salil Chandra <schandra107@bloomberg.net>
1 parent 7f6d0fc commit 75b79d4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

cdb2api/cdb2api.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ static int MIN_RETRIES = 16;
116116
static int CDB2_CONNECT_TIMEOUT = 100;
117117
static int cdb2_connect_timeout_set_from_env = 0;
118118

119+
#ifdef CDB2API_SERVER
119120
static int CDB2_MAX_AUTO_CONSUME_ROWS = 10;
121+
#endif
120122

121123
static int COMDB2DB_TIMEOUT = 2000;
122124
static int cdb2_comdb2db_timeout_set_from_env = 0;
@@ -1941,10 +1943,12 @@ static void read_comdb2db_cfg(cdb2_hndl_tp *hndl, COMDB2BUF *s, const char *comd
19411943
} else if (!cdb2_api_call_timeout_set_from_env && (strcasecmp("enforce_api_call_timeout", tok) == 0)) {
19421944
tok = strtok_r(NULL, " :,", &last);
19431945
CDB2_ENFORCE_API_CALL_TIMEOUT = value_on_off(tok, &err);
1946+
#ifdef CDB2API_SERVER
19441947
} else if (strcasecmp("max_auto_consume_rows", tok) == 0) {
19451948
tok = strtok_r(NULL, " :,", &last);
19461949
if (tok)
19471950
CDB2_MAX_AUTO_CONSUME_ROWS = atoi(tok);
1951+
#endif
19481952
} else if (!cdb2_comdb2db_timeout_set_from_env && strcasecmp("comdb2db_timeout", tok) == 0) {
19491953
tok = strtok_r(NULL, " :,", &last);
19501954
if (hndl && tok)
@@ -2207,8 +2211,10 @@ static void set_cdb2_timeouts(cdb2_hndl_tp *hndl)
22072211
hndl->sockpool_recv_timeoutms = CDB2_SOCKPOOL_RECV_TIMEOUTMS;
22082212
if (!hndl->sockpool_send_timeoutms)
22092213
hndl->sockpool_send_timeoutms = CDB2_SOCKPOOL_SEND_TIMEOUTMS;
2214+
#ifdef CDB2API_SERVER
22102215
if (!hndl->max_auto_consume_rows)
22112216
hndl->max_auto_consume_rows = CDB2_MAX_AUTO_CONSUME_ROWS;
2217+
#endif
22122218
if (!hndl->api_call_timeout)
22132219
hndl->api_call_timeout = CDB2_API_CALL_TIMEOUT;
22142220

@@ -5872,17 +5878,18 @@ static int process_set_command(cdb2_hndl_tp *hndl, const char *sql)
58725878

58735879
static inline void consume_previous_query(cdb2_hndl_tp *hndl)
58745880
{
5881+
#ifdef CDB2API_SERVER
58755882
int hardbound = 0;
5883+
#endif
58765884
while (cdb2_next_record_int(hndl, 0) == CDB2_OK) {
5885+
#ifdef CDB2API_SERVER
58775886
hardbound++;
58785887
if (hardbound > hndl->max_auto_consume_rows) {
58795888
newsql_disconnect(hndl, hndl->sb, __LINE__);
58805889
break;
58815890
}
5891+
#endif
58825892
}
5883-
5884-
clear_responses(hndl);
5885-
hndl->rows_read = 0;
58865893
}
58875894

58885895
#define GOTO_RETRY_QUERIES() \

0 commit comments

Comments
 (0)