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

bug fix

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