[TD-674] defect found in coverity scan
This commit is contained in:
parent
855036fc1f
commit
a05a0806a4
|
@ -405,6 +405,7 @@ void tscKillSTableQuery(SSqlObj *pSql);
|
||||||
void tscInitResObjForLocalQuery(SSqlObj *pObj, int32_t numOfRes, int32_t rowLen);
|
void tscInitResObjForLocalQuery(SSqlObj *pObj, int32_t numOfRes, int32_t rowLen);
|
||||||
bool tscIsUpdateQuery(SSqlObj* pSql);
|
bool tscIsUpdateQuery(SSqlObj* pSql);
|
||||||
bool tscHasReachLimitation(SQueryInfo *pQueryInfo, SSqlRes *pRes);
|
bool tscHasReachLimitation(SQueryInfo *pQueryInfo, SSqlRes *pRes);
|
||||||
|
bool tscResultsetFetchCompleted(TAOS_RES *result);
|
||||||
|
|
||||||
char *tscGetErrorMsgPayload(SSqlCmd *pCmd);
|
char *tscGetErrorMsgPayload(SSqlCmd *pCmd);
|
||||||
|
|
||||||
|
|
|
@ -1942,6 +1942,11 @@ bool tscHasReachLimitation(SQueryInfo* pQueryInfo, SSqlRes* pRes) {
|
||||||
return (pQueryInfo->clauseLimit > 0 && pRes->numOfClauseTotal >= pQueryInfo->clauseLimit);
|
return (pQueryInfo->clauseLimit > 0 && pRes->numOfClauseTotal >= pQueryInfo->clauseLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool tscResultsetFetchCompleted(TAOS_RES *result) {
|
||||||
|
SSqlRes* pRes = result;
|
||||||
|
return pRes->completed;
|
||||||
|
}
|
||||||
|
|
||||||
char* tscGetErrorMsgPayload(SSqlCmd* pCmd) { return pCmd->payload; }
|
char* tscGetErrorMsgPayload(SSqlCmd* pCmd) { return pCmd->payload; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -65,7 +65,7 @@ int32_t mnodeInitShow() {
|
||||||
mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_CONNECT, mnodeProcessConnectMsg);
|
mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_CONNECT, mnodeProcessConnectMsg);
|
||||||
mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_USE_DB, mnodeProcessUseMsg);
|
mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_USE_DB, mnodeProcessUseMsg);
|
||||||
|
|
||||||
tsMnodeShowCache = taosCacheInitWithCb(10, mnodeFreeShowObj);
|
tsMnodeShowCache = taosCacheInitWithCb(5, mnodeFreeShowObj);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
|
||||||
pShowRsp->qhandle = htobe64((uint64_t) pShow);
|
pShowRsp->qhandle = htobe64((uint64_t) pShow);
|
||||||
|
|
||||||
int32_t code = (*tsMnodeShowMetaFp[pShowMsg->type])(&pShowRsp->tableMeta, pShow, pMsg->rpcMsg.handle);
|
int32_t code = (*tsMnodeShowMetaFp[pShowMsg->type])(&pShowRsp->tableMeta, pShow, pMsg->rpcMsg.handle);
|
||||||
mTrace("%p, show type:%s index:%d, get meta finished, rows:%d cols:%d result:%s", pShow,
|
mTrace("%p, show type:%s index:%d, get meta finished, numOfRows:%d cols:%d result:%s", pShow,
|
||||||
mnodeGetShowType(pShowMsg->type), pShow->index, pShow->numOfRows, pShow->numOfColumns, tstrerror(code));
|
mnodeGetShowType(pShowMsg->type), pShow->index, pShow->numOfRows, pShow->numOfColumns, tstrerror(code));
|
||||||
|
|
||||||
if (code == TSDB_CODE_SUCCESS) {
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
@ -219,8 +219,10 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) {
|
||||||
|
|
||||||
if (rowsToRead == 0 || (rowsRead == rowsToRead && pShow->numOfRows == pShow->numOfReads)) {
|
if (rowsToRead == 0 || (rowsRead == rowsToRead && pShow->numOfRows == pShow->numOfReads)) {
|
||||||
pRsp->completed = 1;
|
pRsp->completed = 1;
|
||||||
|
mTrace("%p, retrieve completed", pShow);
|
||||||
mnodeReleaseShowObj(pShow, true);
|
mnodeReleaseShowObj(pShow, true);
|
||||||
} else {
|
} else {
|
||||||
|
mTrace("%p, retrieve not completed yet", pShow);
|
||||||
mnodeReleaseShowObj(pShow, false);
|
mnodeReleaseShowObj(pShow, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,10 +381,10 @@ static void *mnodePutShowObj(SShowObj *pShow, int32_t size) {
|
||||||
pShow->index = atomic_add_fetch_32(&tsShowObjIndex, 1);
|
pShow->index = atomic_add_fetch_32(&tsShowObjIndex, 1);
|
||||||
sprintf(key, "%d", pShow->index);
|
sprintf(key, "%d", pShow->index);
|
||||||
|
|
||||||
SShowObj *newQhandle = taosCachePut(tsMnodeShowCache, key, pShow, size, 60);
|
SShowObj *newQhandle = taosCachePut(tsMnodeShowCache, key, pShow, size, 6);
|
||||||
free(pShow);
|
free(pShow);
|
||||||
|
|
||||||
mTrace("%p, show is put into cache", newQhandle);
|
mTrace("%p, show is put into cache, index:%s", newQhandle, key);
|
||||||
return newQhandle;
|
return newQhandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,10 @@ void httpProcessSingleSqlRetrieveCallBack(void *param, TAOS_RES *result, int num
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tscResultsetFetchCompleted(result)) {
|
||||||
|
isContinue = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (isContinue) {
|
if (isContinue) {
|
||||||
// retrieve next batch of rows
|
// retrieve next batch of rows
|
||||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, continue retrieve, numOfRows:%d", pContext, pContext->fd,
|
httpTrace("context:%p, fd:%d, ip:%s, user:%s, continue retrieve, numOfRows:%d", pContext, pContext->fd,
|
||||||
|
|
|
@ -269,14 +269,20 @@ int tgReadSchema(char *fileName) {
|
||||||
httpPrint("open telegraf schema file:%s success", fileName);
|
httpPrint("open telegraf schema file:%s success", fileName);
|
||||||
fseek(fp, 0, SEEK_END);
|
fseek(fp, 0, SEEK_END);
|
||||||
int32_t contentSize = (int32_t)ftell(fp);
|
int32_t contentSize = (int32_t)ftell(fp);
|
||||||
|
if (contentSize <= 0) {
|
||||||
|
fclose(fp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
rewind(fp);
|
rewind(fp);
|
||||||
char * content = (char *)calloc(contentSize + 1, 1);
|
char * content = (char *)calloc(contentSize + 1, 1);
|
||||||
int32_t result = fread(content, 1, contentSize, fp);
|
int32_t result = fread(content, 1, contentSize, fp);
|
||||||
|
|
||||||
if (result != contentSize) {
|
if (result != contentSize) {
|
||||||
httpError("failed to read telegraf schema file:%s", fileName);
|
httpError("failed to read telegraf schema file:%s", fileName);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
free(content);
|
free(content);
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
content[contentSize] = 0;
|
content[contentSize] = 0;
|
||||||
|
|
|
@ -69,8 +69,6 @@ print ====== tables created
|
||||||
|
|
||||||
print ================== restart server to commit data into disk
|
print ================== restart server to commit data into disk
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
|
||||||
return
|
|
||||||
sleep 5000
|
sleep 5000
|
||||||
system sh/exec.sh -n dnode1 -s start
|
system sh/exec.sh -n dnode1 -s start
|
||||||
print ================== server restart completed
|
print ================== server restart completed
|
||||||
|
|
|
@ -652,6 +652,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
|
||||||
|
|
||||||
if (line->errorJump == SQL_JUMP_TRUE) {
|
if (line->errorJump == SQL_JUMP_TRUE) {
|
||||||
script->linePos = line->jump;
|
script->linePos = line->jump;
|
||||||
|
taos_free_result(pSql);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
taosMsleep(1000);
|
taosMsleep(1000);
|
||||||
|
|
Loading…
Reference in New Issue