提交 1c14e570 编写于 作者: H hjxilinx

switch the sync query model to async query model

上级 cacd0b71
...@@ -783,7 +783,13 @@ void taos_free_result_imp(TAOS_RES *res, int keepCmd) { ...@@ -783,7 +783,13 @@ void taos_free_result_imp(TAOS_RES *res, int keepCmd) {
/* Query rsp is not received from vnode, so the qhandle is NULL */ /* Query rsp is not received from vnode, so the qhandle is NULL */
tscTrace("%p qhandle is null, abort free, fp:%p", pSql, pSql->fp); tscTrace("%p qhandle is null, abort free, fp:%p", pSql, pSql->fp);
if (pSql->fp != NULL) { if (pSql->fp != NULL) {
tscFreeSqlObj(pSql); STscObj* pObj = pSql->pTscObj;
if (pSql == pObj->pSql) {
pObj->pSql = NULL;
tscFreeSqlObj(pSql);
}
tscTrace("%p Async SqlObj is freed by app", pSql); tscTrace("%p Async SqlObj is freed by app", pSql);
} else if (keepCmd) { } else if (keepCmd) {
tscFreeSqlResult(pSql); tscFreeSqlResult(pSql);
...@@ -850,6 +856,11 @@ void taos_free_result_imp(TAOS_RES *res, int keepCmd) { ...@@ -850,6 +856,11 @@ void taos_free_result_imp(TAOS_RES *res, int keepCmd) {
tscFreeSqlObjPartial(pSql); tscFreeSqlObjPartial(pSql);
tscTrace("%p sql result is freed by app", pSql); tscTrace("%p sql result is freed by app", pSql);
} }
} else { // for async release, remove its link
STscObj* pObj = pSql->pTscObj;
if (pObj->pSql == pSql) {
pObj->pSql = NULL;
}
} }
} else { } else {
// if no free resource msg is sent to vnode, we free this object immediately. // if no free resource msg is sent to vnode, we free this object immediately.
......
...@@ -460,11 +460,16 @@ void tscFreeSqlObjPartial(SSqlObj* pSql) { ...@@ -460,11 +460,16 @@ void tscFreeSqlObjPartial(SSqlObj* pSql) {
pthread_mutex_lock(&pObj->mutex); pthread_mutex_lock(&pObj->mutex);
tfree(pSql->sqlstr); tfree(pSql->sqlstr);
pthread_mutex_unlock(&pObj->mutex); pthread_mutex_unlock(&pObj->mutex);
tscFreeSqlResult(pSql); tscFreeSqlResult(pSql);
tfree(pSql->pSubs); tfree(pSql->pSubs);
pSql->numOfSubs = 0; pSql->numOfSubs = 0;
pSql->freed = 0;
tscFreeSqlCmdData(pCmd);
tscTrace("%p free sqlObj partial completed", pSql);
tscFreeSqlCmdData(pCmd); tscFreeSqlCmdData(pCmd);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册