提交 58a75927 编写于 作者: Y yihaoDeng

bug fix

上级 901f62ec
......@@ -371,7 +371,6 @@ typedef struct SSqlObj {
SSubqueryState subState;
struct SSqlObj **pSubs;
int global;
struct SSqlObj *prev, *next;
int64_t self;
} SSqlObj;
......
......@@ -480,6 +480,10 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
tscResetSqlCmdObj(pCmd, false);
code = tsParseSql(pSql, true);
if (pCmd->command == TSDB_SQL_INSERT) {
pSql->fp = pSql->fetchFp; // restore the fp
}
if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) {
return;
} else if (code != TSDB_CODE_SUCCESS) {
......
......@@ -39,6 +39,7 @@ void tscInitConnCb(void *param, TAOS_RES *result, int code) {
tscSlowQueryConnInitialized = true;
tscSaveSlowQueryFp(sql, NULL);
}
taos_free_result(result);
}
void tscAddIntoSqlList(SSqlObj *pSql) {
......@@ -69,6 +70,7 @@ void tscSaveSlowQueryFpCb(void *param, TAOS_RES *result, int code) {
} else {
tscDebug("success to save slow query, code:%d", code);
}
taos_free_result(result);
}
void tscSaveSlowQueryFp(void *handle, void *tmrId) {
......
......@@ -154,6 +154,7 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size
assert(pTableMetaMsg != NULL);
int32_t schemaSize = (pTableMetaMsg->numOfColumns + pTableMetaMsg->numOfTags) * sizeof(SSchema);
STableMeta* pTableMeta = calloc(1, sizeof(STableMeta) + schemaSize);
pTableMeta->tableType = pTableMetaMsg->tableType;
......
......@@ -43,8 +43,6 @@ static bool validImpl(const char* str, size_t maxsize) {
return true;
}
static int64_t queryIncr = 0;
//static int64_t queryDec = 0;
static bool validUserName(const char* user) {
return validImpl(user, TSDB_USER_LEN - 1);
......@@ -354,9 +352,7 @@ TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen, TAOS_RES
return NULL;
}
tscError("curre query count: %ld",atomic_add_fetch_64(&queryIncr, 1));
tsem_init(&pSql->rspSem, 0, 0);
pSql->global = 100;
doAsyncQuery(pObj, pSql, waitForQueryRsp, taos, sqlstr, sqlLen);
if (res != NULL) {
......@@ -622,7 +618,7 @@ int taos_select_db(TAOS *taos, const char *db) {
}
// send free message to vnode to free qhandle and corresponding resources in vnode
static UNUSED_FUNC bool tscKillQueryInDnode(SSqlObj* pSql) {
static bool tscKillQueryInDnode(SSqlObj* pSql) {
SSqlCmd* pCmd = &pSql->cmd;
SSqlRes* pRes = &pSql->res;
......@@ -662,9 +658,6 @@ void taos_free_result(TAOS_RES *res) {
tscError("%p already released sqlObj", res);
return;
}
if (100 == pSql->global) {
tscError("current query count: %ld", atomic_sub_fetch_64(&queryIncr, 1));
}
bool freeNow = tscKillQueryInDnode(pSql);
if (freeNow) {
......
......@@ -750,14 +750,12 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql, SArray* pTableDataBlockList) {
dataBuf->size += (finalLen + sizeof(SSubmitBlk));
assert(dataBuf->size <= dataBuf->nAllocSize);
//char* p = realloc(dataBuf->pData, dataBuf->size);
//if (p != NULL) {
// dataBuf->pData = p;
//}
// the length does not include the SSubmitBlk structure
pBlocks->dataLen = htonl(finalLen);
dataBuf->numOfTables += 1;
tfree(pOneTableBlock->pData);
}
tscDestroyBlockArrayList(pTableDataBlockList);
......@@ -811,13 +809,11 @@ int tscAllocPayload(SSqlCmd* pCmd, int size) {
if (pCmd->payload == NULL) return TSDB_CODE_TSC_OUT_OF_MEMORY;
pCmd->allocSize = size;
} else {
if (pCmd->allocSize < (uint32_t)size) {
char* b = realloc(pCmd->payload, size);
if (b == NULL) return TSDB_CODE_TSC_OUT_OF_MEMORY;
pCmd->payload = b;
pCmd->allocSize = size;
pCmd->payload = realloc(pCmd->payload, size);
if (pCmd->payload == NULL) {
return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
pCmd->allocSize = size;
memset(pCmd->payload, 0, pCmd->allocSize);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册