提交 d1d988a7 编写于 作者: S slzhou

Merge branch '2.6' of github.com:taosdata/TDengine into szhou/2.6/fixbugs

...@@ -283,18 +283,8 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) { ...@@ -283,18 +283,8 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
// } // }
pthread_mutex_lock(&pSql->subState.mutex); pthread_mutex_lock(&pSql->subState.mutex);
if (pSql->pSubs != NULL && pSql->subState.states != NULL) { if (pSql->pSubs != NULL && pSql->subState.states != NULL) {
for (int32_t i = 0; i < pQdesc->numOfSub; ++i) { for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
// because subState maybe free on anytime by any thread, check validate from here // because subState maybe free on anytime by any thread, check validate from here
if(pSql->subState.numOfSub != pQdesc->numOfSub ||
pSql->pSubs == NULL ||
pSql->subState.states == NULL) {
tscError(" QUERY-HEART STscObj=%p subState maybe free. numOfSub=%d pSubs=%p states=%p",
pObj, pSql->subState.numOfSub, pSql->pSubs, pSql->subState.states);
pQdesc->numOfSub = 0;
// break for
break;
}
SSqlObj *psub = pSql->pSubs[i]; SSqlObj *psub = pSql->pSubs[i];
int64_t self = (psub != NULL)? psub->self : 0; int64_t self = (psub != NULL)? psub->self : 0;
...@@ -307,6 +297,7 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) { ...@@ -307,6 +297,7 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
p += len; p += len;
} }
} }
pQdesc->numOfSub = pSql->subState.numOfSub;
pthread_mutex_unlock(&pSql->subState.mutex); pthread_mutex_unlock(&pSql->subState.mutex);
} }
......
...@@ -8481,7 +8481,15 @@ static bool check_expr_in_groupby_colum(SGroupbyExpr* pGroupbyExpr, SExprInfo* p ...@@ -8481,7 +8481,15 @@ static bool check_expr_in_groupby_colum(SGroupbyExpr* pGroupbyExpr, SExprInfo* p
return false; return false;
for (int32_t k = 0; k < pGroupbyExpr->numOfGroupCols ; ++k) { for (int32_t k = 0; k < pGroupbyExpr->numOfGroupCols ; ++k) {
pIndex = taosArrayGet(pGroupbyExpr->columnInfo, k); pIndex = taosArrayGet(pGroupbyExpr->columnInfo, k);
if (!strcmp(pIndex->name,&pExpr->base.colInfo.name[1])){ // notes:first char is dot, skip one char.
// find last dot
char * name = strrchr(pExpr->base.colInfo.name, '.');
if(name)
name += 1;
else
name = pExpr->base.colInfo.name;
if (!strcmp(pIndex->name, name)){
return true; return true;
} }
} }
......
...@@ -357,7 +357,7 @@ void checkBrokenQueries(STscObj *pTscObj) { ...@@ -357,7 +357,7 @@ void checkBrokenQueries(STscObj *pTscObj) {
pthread_mutex_lock(&pSql->subState.mutex); pthread_mutex_lock(&pSql->subState.mutex);
if (pSql->pSubs) { if (pSql->pSubs) {
// have sub sql // have sub sql
for (int i = 0; i < numOfSub; i++) { for (int i = 0; i < pSql->subState.numOfSub; i++) {
SSqlObj *pSubSql = pSql->pSubs[i]; SSqlObj *pSubSql = pSql->pSubs[i];
if(pSubSql) { if(pSubSql) {
tscInfo("PROBE 0x%" PRIx64 " sub sql app is 0x%" PRIx64, pSql->self, pSubSql->self); tscInfo("PROBE 0x%" PRIx64 " sub sql app is 0x%" PRIx64, pSql->self, pSubSql->self);
......
...@@ -101,13 +101,12 @@ static bool allSubqueryDone(SSqlObj *pParentSql) { ...@@ -101,13 +101,12 @@ static bool allSubqueryDone(SSqlObj *pParentSql) {
bool subAndCheckDone(SSqlObj *pSql, SSqlObj *pParentSql, int idx) { bool subAndCheckDone(SSqlObj *pSql, SSqlObj *pParentSql, int idx) {
SSubqueryState *subState = &pParentSql->subState; SSubqueryState *subState = &pParentSql->subState;
assert(idx < subState->numOfSub);
pthread_mutex_lock(&subState->mutex); pthread_mutex_lock(&subState->mutex);
if (idx < subState->numOfSub) {
tscDebug("0x%"PRIx64" subquery:0x%"PRIx64", idx:%d state set to 1", pParentSql->self, pSql->self, idx); tscDebug("0x%"PRIx64" subquery:0x%"PRIx64", index:%d state set to 1", pParentSql->self, pSql->self, idx);
subState->states[idx] = 1; subState->states[idx] = 1;
}
bool done = allSubqueryDone(pParentSql); bool done = allSubqueryDone(pParentSql);
if (!done) { if (!done) {
tscDebug("0x%"PRIx64" sub:%p,%d completed, total:%d", pParentSql->self, pSql, idx, pParentSql->subState.numOfSub); tscDebug("0x%"PRIx64" sub:%p,%d completed, total:%d", pParentSql->self, pSql, idx, pParentSql->subState.numOfSub);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册