未验证 提交 31ea3524 编写于 作者: H haojun Liao 提交者: GitHub

Merge pull request #950 from taosdata/feature/#928

SQL statement `show connections` may cause crash
...@@ -1400,7 +1400,7 @@ void tscUpdateVnodeInSubmitMsg(SSqlObj *pSql, char *buf) { ...@@ -1400,7 +1400,7 @@ void tscUpdateVnodeInSubmitMsg(SSqlObj *pSql, char *buf) {
pShellMsg = (SShellSubmitMsg *)pMsg; pShellMsg = (SShellSubmitMsg *)pMsg;
pShellMsg->vnode = htons(pMeterMeta->vpeerDesc[pSql->index].vnode); pShellMsg->vnode = htons(pMeterMeta->vpeerDesc[pSql->index].vnode);
tscTrace("%p update submit msg vnode:%d", pSql, htons(pShellMsg->vnode)); tscTrace("%p update submit msg vnode:%s:%d", pSql, taosIpStr(pMeterMeta->vpeerDesc[pSql->index].ip), htons(pShellMsg->vnode));
} }
int tscBuildSubmitMsg(SSqlObj *pSql) { int tscBuildSubmitMsg(SSqlObj *pSql) {
...@@ -1421,7 +1421,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql) { ...@@ -1421,7 +1421,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql) {
// pSql->cmd.payloadLen is set during parse sql routine, so we do not use it here // pSql->cmd.payloadLen is set during parse sql routine, so we do not use it here
pSql->cmd.msgType = TSDB_MSG_TYPE_SUBMIT; pSql->cmd.msgType = TSDB_MSG_TYPE_SUBMIT;
tscTrace("%p update submit msg vnode:%d", pSql, htons(pShellMsg->vnode)); tscTrace("%p update submit msg vnode:%s:%d", pSql, taosIpStr(pMeterMeta->vpeerDesc[pMeterMeta->index].ip), htons(pShellMsg->vnode));
return msgLen; return msgLen;
} }
......
...@@ -48,7 +48,7 @@ int mgmtGetConns(SShowObj *pShow, SConnObj *pConn) { ...@@ -48,7 +48,7 @@ int mgmtGetConns(SShowObj *pShow, SConnObj *pConn) {
pConn = pAcct->pConn; pConn = pAcct->pConn;
SConnInfo *pConnInfo = pConnShow->connInfo; SConnInfo *pConnInfo = pConnShow->connInfo;
while (pConn) { while (pConn && pConn->pUser) {
strcpy(pConnInfo->user, pConn->pUser->user); strcpy(pConnInfo->user, pConn->pUser->user);
pConnInfo->ip = pConn->ip; pConnInfo->ip = pConn->ip;
pConnInfo->port = pConn->port; pConnInfo->port = pConn->port;
......
...@@ -40,6 +40,7 @@ void *mgmtVgroupActionAfterBatchUpdate(void *row, char *str, int size, int *ssiz ...@@ -40,6 +40,7 @@ void *mgmtVgroupActionAfterBatchUpdate(void *row, char *str, int size, int *ssiz
void *mgmtVgroupActionReset(void *row, char *str, int size, int *ssize); void *mgmtVgroupActionReset(void *row, char *str, int size, int *ssize);
void *mgmtVgroupActionDestroy(void *row, char *str, int size, int *ssize); void *mgmtVgroupActionDestroy(void *row, char *str, int size, int *ssize);
bool mgmtCheckVnodeReady(SDnodeObj *pDnode, SVgObj *pVgroup, SVnodeGid *pVnode); bool mgmtCheckVnodeReady(SDnodeObj *pDnode, SVgObj *pVgroup, SVnodeGid *pVnode);
char *mgmtGetVnodeStatus(SVgObj *pVgroup, SVnodeGid *pVnode);
void mgmtVgroupActionInit() { void mgmtVgroupActionInit() {
mgmtVgroupActionFp[SDB_TYPE_INSERT] = mgmtVgroupActionInsert; mgmtVgroupActionFp[SDB_TYPE_INSERT] = mgmtVgroupActionInsert;
...@@ -328,8 +329,8 @@ int mgmtRetrieveVgroups(SShowObj *pShow, char *data, int rows, SConnObj *pConn) ...@@ -328,8 +329,8 @@ int mgmtRetrieveVgroups(SShowObj *pShow, char *data, int rows, SConnObj *pConn)
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
if (pVgroup->vnodeGid[i].ip != 0) { if (pVgroup->vnodeGid[i].ip != 0) {
bool ready = mgmtCheckVnodeReady(NULL, pVgroup, pVgroup->vnodeGid + i); char *vnodeStatus = mgmtGetVnodeStatus(pVgroup, pVgroup->vnodeGid + i);
strcpy(pWrite, ready ? "ready" : "unsynced"); strcpy(pWrite, vnodeStatus);
} else { } else {
strcpy(pWrite, "null"); strcpy(pWrite, "null");
} }
......
...@@ -52,6 +52,8 @@ bool mgmtCheckModuleInDnode(SDnodeObj *pDnode, int moduleType) { ...@@ -52,6 +52,8 @@ bool mgmtCheckModuleInDnode(SDnodeObj *pDnode, int moduleType) {
return tsModule[moduleType].num != 0; return tsModule[moduleType].num != 0;
} }
char *mgmtGetVnodeStatus(SVgObj *pVgroup, SVnodeGid *pVnode) { return "master"; }
bool mgmtCheckVnodeReady(SDnodeObj *pDnode, SVgObj *pVgroup, SVnodeGid *pVnode) { return true; } bool mgmtCheckVnodeReady(SDnodeObj *pDnode, SVgObj *pVgroup, SVnodeGid *pVnode) { return true; }
void mgmtUpdateDnodeState(SDnodeObj *pDnode, int lbStatus) {} void mgmtUpdateDnodeState(SDnodeObj *pDnode, int lbStatus) {}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册