未验证 提交 8b993116 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #2157 from taosdata/feature/query

[td-225] fix bugs in stable/metric.sim
...@@ -336,7 +336,6 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) { ...@@ -336,7 +336,6 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
if (rpcMsg->code != TSDB_CODE_ACTION_IN_PROGRESS) { if (rpcMsg->code != TSDB_CODE_ACTION_IN_PROGRESS) {
rpcMsg->code = (pRes->code == TSDB_CODE_SUCCESS) ? pRes->numOfRows: pRes->code; rpcMsg->code = (pRes->code == TSDB_CODE_SUCCESS) ? pRes->numOfRows: pRes->code;
tscTrace("%p SQL result:%s res:%p", pSql, tstrerror(pRes->code), pSql);
bool shouldFree = tscShouldBeFreed(pSql); bool shouldFree = tscShouldBeFreed(pSql);
(*pSql->fp)(pSql->param, pSql, rpcMsg->code); (*pSql->fp)(pSql->param, pSql, rpcMsg->code);
......
...@@ -404,8 +404,6 @@ void tscPartiallyFreeSqlObj(SSqlObj* pSql) { ...@@ -404,8 +404,6 @@ void tscPartiallyFreeSqlObj(SSqlObj* pSql) {
pSql->numOfSubs = 0; pSql->numOfSubs = 0;
tscResetSqlCmdObj(pCmd); tscResetSqlCmdObj(pCmd);
tscTrace("%p partially free sqlObj completed", pSql);
} }
void tscFreeSqlObj(SSqlObj* pSql) { void tscFreeSqlObj(SSqlObj* pSql) {
......
...@@ -1284,7 +1284,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) { ...@@ -1284,7 +1284,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
char *msg = (char *)pRsp + sizeof(SCMSTableVgroupRspMsg); char *msg = (char *)pRsp + sizeof(SCMSTableVgroupRspMsg);
for (int32_t i = 0; i < numOfTable; ++i) { for (int32_t i = 0; i < numOfTable; ++i) {
char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN) * i; char * stableName = (char *)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN)*i;
SSuperTableObj *pTable = mnodeGetSuperTable(stableName); SSuperTableObj *pTable = mnodeGetSuperTable(stableName);
if (pTable == NULL) { if (pTable == NULL) {
mError("stable:%s, not exist while get stable vgroup info", stableName); mError("stable:%s, not exist while get stable vgroup info", stableName);
...@@ -1294,41 +1294,48 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) { ...@@ -1294,41 +1294,48 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
if (pTable->vgHash == NULL) { if (pTable->vgHash == NULL) {
mError("stable:%s, not vgroup exist while get stable vgroup info", stableName); mError("stable:%s, not vgroup exist while get stable vgroup info", stableName);
mnodeDecTableRef(pTable); mnodeDecTableRef(pTable);
continue;
}
SVgroupsInfo *pVgroupInfo = (SVgroupsInfo *)msg; // even this super table has no corresponding table, still return
pRsp->numOfTables++;
SHashMutableIterator *pIter = taosHashCreateIter(pTable->vgHash); SVgroupsInfo *pVgroupInfo = (SVgroupsInfo *)msg;
int32_t vgSize = 0; pVgroupInfo->numOfVgroups = 0;
while (taosHashIterNext(pIter)) {
int32_t *pVgId = taosHashIterGet(pIter); msg += sizeof(SVgroupsInfo);
SVgObj * pVgroup = mnodeGetVgroup(*pVgId); } else {
if (pVgroup == NULL) continue; SVgroupsInfo *pVgroupInfo = (SVgroupsInfo *)msg;
pVgroupInfo->vgroups[vgSize].vgId = htonl(pVgroup->vgId); SHashMutableIterator *pIter = taosHashCreateIter(pTable->vgHash);
for (int32_t vn = 0; vn < pVgroup->numOfVnodes; ++vn) { int32_t vgSize = 0;
SDnodeObj *pDnode = pVgroup->vnodeGid[vn].pDnode; while (taosHashIterNext(pIter)) {
if (pDnode == NULL) break; int32_t *pVgId = taosHashIterGet(pIter);
SVgObj * pVgroup = mnodeGetVgroup(*pVgId);
if (pVgroup == NULL) continue;
strncpy(pVgroupInfo->vgroups[vgSize].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn)); pVgroupInfo->vgroups[vgSize].vgId = htonl(pVgroup->vgId);
pVgroupInfo->vgroups[vgSize].ipAddr[vn].port = htons(pDnode->dnodePort); for (int32_t vn = 0; vn < pVgroup->numOfVnodes; ++vn) {
SDnodeObj *pDnode = pVgroup->vnodeGid[vn].pDnode;
if (pDnode == NULL) break;
pVgroupInfo->vgroups[vgSize].numOfIps++; strncpy(pVgroupInfo->vgroups[vgSize].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn));
} pVgroupInfo->vgroups[vgSize].ipAddr[vn].port = htons(pDnode->dnodePort);
vgSize++; pVgroupInfo->vgroups[vgSize].numOfIps++;
mnodeDecVgroupRef(pVgroup); }
}
taosHashDestroyIter(pIter); vgSize++;
mnodeDecTableRef(pTable); mnodeDecVgroupRef(pVgroup);
}
taosHashDestroyIter(pIter);
mnodeDecTableRef(pTable);
pVgroupInfo->numOfVgroups = htonl(vgSize); pVgroupInfo->numOfVgroups = htonl(vgSize);
// one table is done, try the next table // one table is done, try the next table
msg += sizeof(SVgroupsInfo) + vgSize * sizeof(SCMVgroupInfo); msg += sizeof(SVgroupsInfo) + vgSize * sizeof(SCMVgroupInfo);
pRsp->numOfTables++; pRsp->numOfTables++;
}
} }
if (pRsp->numOfTables != numOfTable) { if (pRsp->numOfTables != numOfTable) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册