Fix the issue #99, when the http request is broken, the query does not end normally

This commit is contained in:
slguan 2019-07-18 11:44:12 +08:00
parent d63f0e7fd9
commit d3329e487c
3 changed files with 19 additions and 3 deletions

View File

@ -110,6 +110,7 @@ extern int tsMgmtEqualVnodeNum;
extern int tsEnableHttpModule;
extern int tsEnableMonitorModule;
extern int tsRestRowLimit;
extern int tsTimePrecision;
extern int tsMinSlidingTime;

View File

@ -148,9 +148,23 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result,
httpJsonToken(jsonBuf, JsonArrEnd);
}
httpTrace("context:%p, fd:%d, ip:%s, user:%s, total rows:%lld retrieved", pContext, pContext->fd, pContext->ipstr,
pContext->user, cmd->numOfRows);
return true;
if (cmd->numOfRows >= tsRestRowLimit) {
httpTrace("context:%p, fd:%d, ip:%s, user:%s, retrieve rows:%lld larger than limit:%d, abort retrieve", pContext,
pContext->fd, pContext->ipstr, pContext->user, cmd->numOfRows, tsRestRowLimit);
return false;
}
else {
if (pContext->fd <= 0) {
httpError("context:%p, fd:%d, ip:%s, user:%s, connection is closed, abort retrieve", pContext, pContext->fd,
pContext->ipstr, pContext->user);
return false;
}
else {
httpTrace("context:%p, fd:%d, ip:%s, user:%s, total rows:%lld retrieved", pContext, pContext->fd, pContext->ipstr,
pContext->user, cmd->numOfRows);
return true;
}
}
}
bool restBuildSqlTimeJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, int numOfRows) {

View File

@ -98,6 +98,7 @@ int tsMaxVnodeConnections = 10000;
int tsEnableHttpModule = 1;
int tsEnableMonitorModule = 1;
int tsRestRowLimit = 10240;
int tsTimePrecision = TSDB_TIME_PRECISION_MILLI; // time precision, millisecond by default
int tsMinSlidingTime = 10; // 10 ms for sliding time, the value will changed in