rollback change name
This commit is contained in:
parent
cee2e18bb2
commit
582e6ed6a5
|
@ -209,16 +209,16 @@ void tscKillStream(STscObj *pObj, uint32_t killId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char *tscBuildQueryStreamDesc(char *pMsg, STscObj *pObj) {
|
char *tscBuildQueryStreamDesc(char *pMsg, STscObj *pObj) {
|
||||||
SQqueryList *pQList = (SQqueryList *)pMsg;
|
SCMQqueryList *pQList = (SCMQqueryList *)pMsg;
|
||||||
char * pMax = pMsg + TSDB_PAYLOAD_SIZE - 256;
|
char * pMax = pMsg + TSDB_PAYLOAD_SIZE - 256;
|
||||||
|
|
||||||
SQueryDesc *pQdesc = pQList->qdesc;
|
SCMQueryDesc *pQdesc = pQList->qdesc;
|
||||||
pQList->numOfQueries = 0;
|
pQList->numOfQueries = 0;
|
||||||
|
|
||||||
// We extract the lock to tscBuildHeartBeatMsg function.
|
// We extract the lock to tscBuildHeartBeatMsg function.
|
||||||
/* pthread_mutex_lock (&pObj->mutex); */
|
/* pthread_mutex_lock (&pObj->mutex); */
|
||||||
|
|
||||||
pMsg += sizeof(SQqueryList);
|
pMsg += sizeof(SCMQqueryList);
|
||||||
SSqlObj *pSql = pObj->sqlList;
|
SSqlObj *pSql = pObj->sqlList;
|
||||||
while (pSql) {
|
while (pSql) {
|
||||||
/*
|
/*
|
||||||
|
@ -239,15 +239,15 @@ char *tscBuildQueryStreamDesc(char *pMsg, STscObj *pObj) {
|
||||||
pQList->numOfQueries++;
|
pQList->numOfQueries++;
|
||||||
pQdesc++;
|
pQdesc++;
|
||||||
pSql = pSql->next;
|
pSql = pSql->next;
|
||||||
pMsg += sizeof(SQueryDesc);
|
pMsg += sizeof(SCMQueryDesc);
|
||||||
if (pMsg > pMax) break;
|
if (pMsg > pMax) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SStreamList *pSList = (SStreamList *)pMsg;
|
SCMStreamList *pSList = (SCMStreamList *)pMsg;
|
||||||
SStreamDesc *pSdesc = pSList->sdesc;
|
SCMStreamDesc *pSdesc = pSList->sdesc;
|
||||||
pSList->numOfStreams = 0;
|
pSList->numOfStreams = 0;
|
||||||
|
|
||||||
pMsg += sizeof(SStreamList);
|
pMsg += sizeof(SCMStreamList);
|
||||||
SSqlStream *pStream = pObj->streamList;
|
SSqlStream *pStream = pObj->streamList;
|
||||||
while (pStream) {
|
while (pStream) {
|
||||||
strncpy(pSdesc->sql, pStream->pSql->sqlstr, TSDB_SHOW_SQL_LEN - 1);
|
strncpy(pSdesc->sql, pStream->pSql->sqlstr, TSDB_SHOW_SQL_LEN - 1);
|
||||||
|
@ -265,7 +265,7 @@ char *tscBuildQueryStreamDesc(char *pMsg, STscObj *pObj) {
|
||||||
pSList->numOfStreams++;
|
pSList->numOfStreams++;
|
||||||
pSdesc++;
|
pSdesc++;
|
||||||
pStream = pStream->next;
|
pStream = pStream->next;
|
||||||
pMsg += sizeof(SStreamDesc);
|
pMsg += sizeof(SCMStreamDesc);
|
||||||
if (pMsg > pMax) break;
|
if (pMsg > pMax) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
|
||||||
SSqlRes *pRes = &pSql->res;
|
SSqlRes *pRes = &pSql->res;
|
||||||
|
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
SHeartBeatRsp *pRsp = (SHeartBeatRsp *)pRes->pRsp;
|
SCMHeartBeatRsp *pRsp = (SCMHeartBeatRsp *)pRes->pRsp;
|
||||||
SRpcIpSet * pIpList = &pRsp->ipList;
|
SRpcIpSet * pIpList = &pRsp->ipList;
|
||||||
tscSetMgmtIpList(pIpList);
|
tscSetMgmtIpList(pIpList);
|
||||||
|
|
||||||
|
@ -1693,13 +1693,13 @@ int32_t tscBuildCreateDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
|
|
||||||
int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
SSqlCmd *pCmd = &pSql->cmd;
|
SSqlCmd *pCmd = &pSql->cmd;
|
||||||
pCmd->payloadLen = sizeof(SCreateAcctMsg);
|
pCmd->payloadLen = sizeof(SCMCreateAcctMsg);
|
||||||
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) {
|
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) {
|
||||||
tscError("%p failed to malloc for query msg", pSql);
|
tscError("%p failed to malloc for query msg", pSql);
|
||||||
return TSDB_CODE_CLI_OUT_OF_MEMORY;
|
return TSDB_CODE_CLI_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCreateAcctMsg *pAlterMsg = (SCreateAcctMsg *)pCmd->payload;
|
SCMCreateAcctMsg *pAlterMsg = (SCMCreateAcctMsg *)pCmd->payload;
|
||||||
|
|
||||||
SSQLToken *pName = &pInfo->pDCLInfo->user.user;
|
SSQLToken *pName = &pInfo->pDCLInfo->user.user;
|
||||||
SSQLToken *pPwd = &pInfo->pDCLInfo->user.passwd;
|
SSQLToken *pPwd = &pInfo->pDCLInfo->user.passwd;
|
||||||
|
@ -1737,13 +1737,13 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
SCreateUserMsg *pAlterMsg;
|
SCMCreateUserMsg *pAlterMsg;
|
||||||
char * pMsg, *pStart;
|
char * pMsg, *pStart;
|
||||||
|
|
||||||
SSqlCmd *pCmd = &pSql->cmd;
|
SSqlCmd *pCmd = &pSql->cmd;
|
||||||
|
|
||||||
pMsg = doBuildMsgHeader(pSql, &pStart);
|
pMsg = doBuildMsgHeader(pSql, &pStart);
|
||||||
pAlterMsg = (SCreateUserMsg *)pMsg;
|
pAlterMsg = (SCMCreateUserMsg *)pMsg;
|
||||||
|
|
||||||
SUserInfo *pUser = &pInfo->pDCLInfo->user;
|
SUserInfo *pUser = &pInfo->pDCLInfo->user;
|
||||||
strncpy(pAlterMsg->user, pUser->user.z, pUser->user.n);
|
strncpy(pAlterMsg->user, pUser->user.z, pUser->user.n);
|
||||||
|
@ -1758,7 +1758,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
strncpy(pAlterMsg->pass, pUser->passwd.z, pUser->passwd.n);
|
strncpy(pAlterMsg->pass, pUser->passwd.z, pUser->passwd.n);
|
||||||
}
|
}
|
||||||
|
|
||||||
pMsg += sizeof(SCreateUserMsg);
|
pMsg += sizeof(SCMCreateUserMsg);
|
||||||
pCmd->payloadLen = pMsg - pStart;
|
pCmd->payloadLen = pMsg - pStart;
|
||||||
|
|
||||||
if (pUser->type == TSDB_ALTER_USER_PASSWD || pUser->type == TSDB_ALTER_USER_PRIVILEGES) {
|
if (pUser->type == TSDB_ALTER_USER_PASSWD || pUser->type == TSDB_ALTER_USER_PRIVILEGES) {
|
||||||
|
@ -1871,18 +1871,18 @@ int32_t tscBuildDropDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
SDropUserMsg *pDropMsg;
|
SCMDropUserMsg *pDropMsg;
|
||||||
char * pMsg, *pStart;
|
char * pMsg, *pStart;
|
||||||
|
|
||||||
SSqlCmd *pCmd = &pSql->cmd;
|
SSqlCmd *pCmd = &pSql->cmd;
|
||||||
|
|
||||||
pMsg = doBuildMsgHeader(pSql, &pStart);
|
pMsg = doBuildMsgHeader(pSql, &pStart);
|
||||||
pDropMsg = (SDropUserMsg *)pMsg;
|
pDropMsg = (SCMDropUserMsg *)pMsg;
|
||||||
|
|
||||||
SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, pCmd->clauseIndex, 0);
|
SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, pCmd->clauseIndex, 0);
|
||||||
strcpy(pDropMsg->user, pMeterMetaInfo->name);
|
strcpy(pDropMsg->user, pMeterMetaInfo->name);
|
||||||
|
|
||||||
pMsg += sizeof(SDropUserMsg);
|
pMsg += sizeof(SCMDropUserMsg);
|
||||||
|
|
||||||
pCmd->payloadLen = pMsg - pStart;
|
pCmd->payloadLen = pMsg - pStart;
|
||||||
pCmd->msgType = TSDB_MSG_TYPE_DROP_USER;
|
pCmd->msgType = TSDB_MSG_TYPE_DROP_USER;
|
||||||
|
@ -2334,14 +2334,14 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
STscObj *pObj = pSql->pTscObj;
|
STscObj *pObj = pSql->pTscObj;
|
||||||
SSqlCmd *pCmd = &pSql->cmd;
|
SSqlCmd *pCmd = &pSql->cmd;
|
||||||
pCmd->msgType = TSDB_MSG_TYPE_CONNECT;
|
pCmd->msgType = TSDB_MSG_TYPE_CONNECT;
|
||||||
pCmd->payloadLen = sizeof(SConnectMsg);
|
pCmd->payloadLen = sizeof(SCMConnectMsg);
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) {
|
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) {
|
||||||
tscError("%p failed to malloc for query msg", pSql);
|
tscError("%p failed to malloc for query msg", pSql);
|
||||||
return TSDB_CODE_CLI_OUT_OF_MEMORY;
|
return TSDB_CODE_CLI_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
SConnectMsg *pConnect = (SConnectMsg*)pCmd->payload;
|
SCMConnectMsg *pConnect = (SCMConnectMsg*)pCmd->payload;
|
||||||
|
|
||||||
char *db; // ugly code to move the space
|
char *db; // ugly code to move the space
|
||||||
db = strstr(pObj->db, TS_PATH_DELIMITER);
|
db = strstr(pObj->db, TS_PATH_DELIMITER);
|
||||||
|
@ -2611,18 +2611,18 @@ int tscEstimateHeartBeatMsgLength(SSqlObj *pSql) {
|
||||||
STscObj *pObj = pSql->pTscObj;
|
STscObj *pObj = pSql->pTscObj;
|
||||||
|
|
||||||
size += tsRpcHeadSize + sizeof(SMgmtHead);
|
size += tsRpcHeadSize + sizeof(SMgmtHead);
|
||||||
size += sizeof(SQqueryList);
|
size += sizeof(SCMQqueryList);
|
||||||
|
|
||||||
SSqlObj *tpSql = pObj->sqlList;
|
SSqlObj *tpSql = pObj->sqlList;
|
||||||
while (tpSql) {
|
while (tpSql) {
|
||||||
size += sizeof(SQueryDesc);
|
size += sizeof(SCMQueryDesc);
|
||||||
tpSql = tpSql->next;
|
tpSql = tpSql->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
size += sizeof(SStreamList);
|
size += sizeof(SCMStreamList);
|
||||||
SSqlStream *pStream = pObj->streamList;
|
SSqlStream *pStream = pObj->streamList;
|
||||||
while (pStream) {
|
while (pStream) {
|
||||||
size += sizeof(SStreamDesc);
|
size += sizeof(SCMStreamDesc);
|
||||||
pStream = pStream->next;
|
pStream = pStream->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3043,7 +3043,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
|
||||||
STscObj *pObj = pSql->pTscObj;
|
STscObj *pObj = pSql->pTscObj;
|
||||||
SSqlRes *pRes = &pSql->res;
|
SSqlRes *pRes = &pSql->res;
|
||||||
|
|
||||||
SConnectRsp *pConnect = (SConnectRsp *)pRes->pRsp;
|
SCMConnectRsp *pConnect = (SCMConnectRsp *)pRes->pRsp;
|
||||||
strcpy(pObj->acctId, pConnect->acctId); // copy acctId from response
|
strcpy(pObj->acctId, pConnect->acctId); // copy acctId from response
|
||||||
int32_t len = sprintf(temp, "%s%s%s", pObj->acctId, TS_PATH_DELIMITER, pObj->db);
|
int32_t len = sprintf(temp, "%s%s%s", pObj->acctId, TS_PATH_DELIMITER, pObj->db);
|
||||||
|
|
||||||
|
@ -3051,7 +3051,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
|
||||||
strncpy(pObj->db, temp, tListLen(pObj->db));
|
strncpy(pObj->db, temp, tListLen(pObj->db));
|
||||||
|
|
||||||
// SIpList * pIpList;
|
// SIpList * pIpList;
|
||||||
// char *rsp = pRes->pRsp + sizeof(SConnectRsp);
|
// char *rsp = pRes->pRsp + sizeof(SCMConnectRsp);
|
||||||
// pIpList = (SIpList *)rsp;
|
// pIpList = (SIpList *)rsp;
|
||||||
// tscSetMgmtIpList(pIpList);
|
// tscSetMgmtIpList(pIpList);
|
||||||
|
|
||||||
|
|
|
@ -257,8 +257,8 @@ typedef struct _user_obj {
|
||||||
char updateEnd[1];
|
char updateEnd[1];
|
||||||
struct _user_obj *prev, *next;
|
struct _user_obj *prev, *next;
|
||||||
struct _acctObj * pAcct;
|
struct _acctObj * pAcct;
|
||||||
SQqueryList * pQList; // query list
|
SCMQqueryList * pQList; // query list
|
||||||
SStreamList * pSList; // stream list
|
SCMStreamList * pSList; // stream list
|
||||||
} SUserObj;
|
} SUserObj;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -282,7 +282,7 @@ typedef struct {
|
||||||
typedef struct _acctObj {
|
typedef struct _acctObj {
|
||||||
char user[TSDB_USER_LEN];
|
char user[TSDB_USER_LEN];
|
||||||
char pass[TSDB_KEY_LEN];
|
char pass[TSDB_KEY_LEN];
|
||||||
SAcctCfg cfg;
|
SCMAcctCfg cfg;
|
||||||
int32_t acctId;
|
int32_t acctId;
|
||||||
int64_t createdTime;
|
int64_t createdTime;
|
||||||
int8_t reserved[15];
|
int8_t reserved[15];
|
||||||
|
|
|
@ -315,7 +315,7 @@ typedef struct {
|
||||||
char clientVersion[TSDB_VERSION_LEN];
|
char clientVersion[TSDB_VERSION_LEN];
|
||||||
char msgVersion[TSDB_VERSION_LEN];
|
char msgVersion[TSDB_VERSION_LEN];
|
||||||
char db[TSDB_TABLE_ID_LEN];
|
char db[TSDB_TABLE_ID_LEN];
|
||||||
} SConnectMsg;
|
} SCMConnectMsg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char acctId[TSDB_ACCT_LEN];
|
char acctId[TSDB_ACCT_LEN];
|
||||||
|
@ -323,7 +323,7 @@ typedef struct {
|
||||||
int8_t writeAuth;
|
int8_t writeAuth;
|
||||||
int8_t superAuth;
|
int8_t superAuth;
|
||||||
SRpcIpSet ipList;
|
SRpcIpSet ipList;
|
||||||
} SConnectRsp;
|
} SCMConnectRsp;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t maxUsers;
|
int32_t maxUsers;
|
||||||
|
@ -337,24 +337,24 @@ typedef struct {
|
||||||
int64_t maxInbound;
|
int64_t maxInbound;
|
||||||
int64_t maxOutbound;
|
int64_t maxOutbound;
|
||||||
int8_t accessState; // Configured only by command
|
int8_t accessState; // Configured only by command
|
||||||
} SAcctCfg;
|
} SCMAcctCfg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char user[TSDB_USER_LEN];
|
char user[TSDB_USER_LEN];
|
||||||
char pass[TSDB_KEY_LEN];
|
char pass[TSDB_KEY_LEN];
|
||||||
SAcctCfg cfg;
|
SCMAcctCfg cfg;
|
||||||
} SCreateAcctMsg, SAlterAcctMsg;
|
} SCMCreateAcctMsg, SCMAlterAcctMsg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char user[TSDB_USER_LEN];
|
char user[TSDB_USER_LEN];
|
||||||
} SDropUserMsg, SDropAcctMsg;
|
} SCMDropUserMsg, SCMDropAcctMsg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char user[TSDB_USER_LEN];
|
char user[TSDB_USER_LEN];
|
||||||
char pass[TSDB_KEY_LEN];
|
char pass[TSDB_KEY_LEN];
|
||||||
int8_t privilege;
|
int8_t privilege;
|
||||||
int8_t flag;
|
int8_t flag;
|
||||||
} SCreateUserMsg, SAlterUserMsg;
|
} SCMCreateUserMsg, SCMAlterUserMsg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char db[TSDB_TABLE_ID_LEN];
|
char db[TSDB_TABLE_ID_LEN];
|
||||||
|
@ -785,7 +785,7 @@ typedef struct {
|
||||||
uint32_t queryId;
|
uint32_t queryId;
|
||||||
int64_t useconds;
|
int64_t useconds;
|
||||||
int64_t stime;
|
int64_t stime;
|
||||||
} SQueryDesc;
|
} SCMQueryDesc;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char sql[TSDB_SHOW_SQL_LEN];
|
char sql[TSDB_SHOW_SQL_LEN];
|
||||||
|
@ -796,29 +796,29 @@ typedef struct {
|
||||||
int64_t stime;
|
int64_t stime;
|
||||||
int64_t slidingTime;
|
int64_t slidingTime;
|
||||||
int64_t interval;
|
int64_t interval;
|
||||||
} SStreamDesc;
|
} SCMStreamDesc;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t numOfQueries;
|
int32_t numOfQueries;
|
||||||
SQueryDesc qdesc[];
|
SCMQueryDesc qdesc[];
|
||||||
} SQqueryList;
|
} SCMQqueryList;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t numOfStreams;
|
int32_t numOfStreams;
|
||||||
SStreamDesc sdesc[];
|
SCMStreamDesc sdesc[];
|
||||||
} SStreamList;
|
} SCMStreamList;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SQqueryList qlist;
|
SCMQqueryList qlist;
|
||||||
SStreamList slist;
|
SCMStreamList slist;
|
||||||
} SHeartBeatMsg;
|
} SCMHeartBeatMsg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t queryId;
|
uint32_t queryId;
|
||||||
uint32_t streamId;
|
uint32_t streamId;
|
||||||
int8_t killConnection;
|
int8_t killConnection;
|
||||||
SRpcIpSet ipList;
|
SRpcIpSet ipList;
|
||||||
} SHeartBeatRsp;
|
} SCMHeartBeatRsp;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t handle;
|
uint64_t handle;
|
||||||
|
|
|
@ -30,7 +30,7 @@ int32_t mgmtRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, void *pCo
|
||||||
|
|
||||||
int32_t mgmtRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, void *pConn);
|
int32_t mgmtRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, void *pConn);
|
||||||
|
|
||||||
int32_t mgmtSaveQueryStreamList(SHeartBeatMsg *pHBMsg);
|
int32_t mgmtSaveQueryStreamList(SCMHeartBeatMsg *pHBMsg);
|
||||||
|
|
||||||
int32_t mgmtKillQuery(char *qidstr, void *pConn);
|
int32_t mgmtKillQuery(char *qidstr, void *pConn);
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ typedef struct {
|
||||||
int32_t numOfQueries;
|
int32_t numOfQueries;
|
||||||
SCDesc * connInfo;
|
SCDesc * connInfo;
|
||||||
SCDesc **cdesc;
|
SCDesc **cdesc;
|
||||||
SQueryDesc qdesc[];
|
SCMQueryDesc qdesc[];
|
||||||
} SQueryShow;
|
} SQueryShow;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -40,10 +40,10 @@ typedef struct {
|
||||||
int32_t numOfStreams;
|
int32_t numOfStreams;
|
||||||
SCDesc * connInfo;
|
SCDesc * connInfo;
|
||||||
SCDesc **cdesc;
|
SCDesc **cdesc;
|
||||||
SStreamDesc sdesc[];
|
SCMStreamDesc sdesc[];
|
||||||
} SStreamShow;
|
} SStreamShow;
|
||||||
|
|
||||||
int32_t mgmtSaveQueryStreamList(SHeartBeatMsg *pHBMsg) {
|
int32_t mgmtSaveQueryStreamList(SCMHeartBeatMsg *pHBMsg) {
|
||||||
// SAcctObj *pAcct = pConn->pAcct;
|
// SAcctObj *pAcct = pConn->pAcct;
|
||||||
//
|
//
|
||||||
// if (contLen <= 0 || pAcct == NULL) {
|
// if (contLen <= 0 || pAcct == NULL) {
|
||||||
|
@ -60,7 +60,7 @@ int32_t mgmtSaveQueryStreamList(SHeartBeatMsg *pHBMsg) {
|
||||||
// pConn->pQList = realloc(pConn->pQList, contLen);
|
// pConn->pQList = realloc(pConn->pQList, contLen);
|
||||||
// memcpy(pConn->pQList, cont, contLen);
|
// memcpy(pConn->pQList, cont, contLen);
|
||||||
//
|
//
|
||||||
// pConn->pSList = (SStreamList *)(((char *)pConn->pQList) + pConn->pQList->numOfQueries * sizeof(SQueryDesc) + sizeof(SQqueryList));
|
// pConn->pSList = (SCMStreamList *)(((char *)pConn->pQList) + pConn->pQList->numOfQueries * sizeof(SCMQueryDesc) + sizeof(SCMQqueryList));
|
||||||
//
|
//
|
||||||
// pAcct->acctInfo.numOfQueries += pConn->pQList->numOfQueries;
|
// pAcct->acctInfo.numOfQueries += pConn->pQList->numOfQueries;
|
||||||
// pAcct->acctInfo.numOfStreams += pConn->pSList->numOfStreams;
|
// pAcct->acctInfo.numOfStreams += pConn->pSList->numOfStreams;
|
||||||
|
@ -76,7 +76,7 @@ int32_t mgmtGetQueries(SShowObj *pShow, void *pConn) {
|
||||||
//
|
//
|
||||||
// pthread_mutex_lock(&pAcct->mutex);
|
// pthread_mutex_lock(&pAcct->mutex);
|
||||||
//
|
//
|
||||||
// pQueryShow = malloc(sizeof(SQueryDesc) * pAcct->acctInfo.numOfQueries + sizeof(SQueryShow));
|
// pQueryShow = malloc(sizeof(SCMQueryDesc) * pAcct->acctInfo.numOfQueries + sizeof(SQueryShow));
|
||||||
// pQueryShow->numOfQueries = 0;
|
// pQueryShow->numOfQueries = 0;
|
||||||
// pQueryShow->index = 0;
|
// pQueryShow->index = 0;
|
||||||
// pQueryShow->connInfo = NULL;
|
// pQueryShow->connInfo = NULL;
|
||||||
|
@ -87,7 +87,7 @@ int32_t mgmtGetQueries(SShowObj *pShow, void *pConn) {
|
||||||
// pQueryShow->cdesc = (SCDesc **)malloc(pAcct->acctInfo.numOfQueries * sizeof(SCDesc *));
|
// pQueryShow->cdesc = (SCDesc **)malloc(pAcct->acctInfo.numOfQueries * sizeof(SCDesc *));
|
||||||
//
|
//
|
||||||
// pConn = pAcct->pConn;
|
// pConn = pAcct->pConn;
|
||||||
// SQueryDesc * pQdesc = pQueryShow->qdesc;
|
// SCMQueryDesc * pQdesc = pQueryShow->qdesc;
|
||||||
// SCDesc * pCDesc = pQueryShow->connInfo;
|
// SCDesc * pCDesc = pQueryShow->connInfo;
|
||||||
// SCDesc **ppCDesc = pQueryShow->cdesc;
|
// SCDesc **ppCDesc = pQueryShow->cdesc;
|
||||||
//
|
//
|
||||||
|
@ -97,7 +97,7 @@ int32_t mgmtGetQueries(SShowObj *pShow, void *pConn) {
|
||||||
// pCDesc->port = pConn->port;
|
// pCDesc->port = pConn->port;
|
||||||
// strcpy(pCDesc->user, pConn->pUser->user);
|
// strcpy(pCDesc->user, pConn->pUser->user);
|
||||||
//
|
//
|
||||||
// memcpy(pQdesc, pConn->pQList->qdesc, sizeof(SQueryDesc) * pConn->pQList->numOfQueries);
|
// memcpy(pQdesc, pConn->pQList->qdesc, sizeof(SCMQueryDesc) * pConn->pQList->numOfQueries);
|
||||||
// pQdesc += pConn->pQList->numOfQueries;
|
// pQdesc += pConn->pQList->numOfQueries;
|
||||||
// pQueryShow->numOfQueries += pConn->pQList->numOfQueries;
|
// pQueryShow->numOfQueries += pConn->pQList->numOfQueries;
|
||||||
// for (int32_t i = 0; i < pConn->pQList->numOfQueries; ++i, ++ppCDesc) *ppCDesc = pCDesc;
|
// for (int32_t i = 0; i < pConn->pQList->numOfQueries; ++i, ++ppCDesc) *ppCDesc = pCDesc;
|
||||||
|
@ -193,7 +193,7 @@ int32_t mgmtKillQuery(char *qidstr, void *pConn) {
|
||||||
// while (pConn) {
|
// while (pConn) {
|
||||||
// if (pConn->ip == ip && pConn->port == port && pConn->pQList) {
|
// if (pConn->ip == ip && pConn->port == port && pConn->pQList) {
|
||||||
// int32_t i;
|
// int32_t i;
|
||||||
// SQueryDesc *pQDesc = pConn->pQList->qdesc;
|
// SCMQueryDesc *pQDesc = pConn->pQList->qdesc;
|
||||||
// for (i = 0; i < pConn->pQList->numOfQueries; ++i, ++pQDesc) {
|
// for (i = 0; i < pConn->pQList->numOfQueries; ++i, ++pQDesc) {
|
||||||
// if (pQDesc->queryId == queryId) break;
|
// if (pQDesc->queryId == queryId) break;
|
||||||
// }
|
// }
|
||||||
|
@ -229,7 +229,7 @@ int32_t mgmtRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, void *pCo
|
||||||
if (rows > pQueryShow->numOfQueries - pQueryShow->index) rows = pQueryShow->numOfQueries - pQueryShow->index;
|
if (rows > pQueryShow->numOfQueries - pQueryShow->index) rows = pQueryShow->numOfQueries - pQueryShow->index;
|
||||||
|
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
SQueryDesc *pNode = pQueryShow->qdesc + pQueryShow->index;
|
SCMQueryDesc *pNode = pQueryShow->qdesc + pQueryShow->index;
|
||||||
SCDesc *pCDesc = pQueryShow->cdesc[pQueryShow->index];
|
SCDesc *pCDesc = pQueryShow->cdesc[pQueryShow->index];
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ int32_t mgmtGetStreams(SShowObj *pShow, void *pConn) {
|
||||||
//
|
//
|
||||||
// pthread_mutex_lock(&pAcct->mutex);
|
// pthread_mutex_lock(&pAcct->mutex);
|
||||||
//
|
//
|
||||||
// pStreamShow = malloc(sizeof(SStreamDesc) * pAcct->acctInfo.numOfStreams + sizeof(SQueryShow));
|
// pStreamShow = malloc(sizeof(SCMStreamDesc) * pAcct->acctInfo.numOfStreams + sizeof(SQueryShow));
|
||||||
// pStreamShow->numOfStreams = 0;
|
// pStreamShow->numOfStreams = 0;
|
||||||
// pStreamShow->index = 0;
|
// pStreamShow->index = 0;
|
||||||
// pStreamShow->connInfo = NULL;
|
// pStreamShow->connInfo = NULL;
|
||||||
|
@ -286,7 +286,7 @@ int32_t mgmtGetStreams(SShowObj *pShow, void *pConn) {
|
||||||
// pStreamShow->cdesc = (SCDesc **)malloc(pAcct->acctInfo.numOfStreams * sizeof(SCDesc *));
|
// pStreamShow->cdesc = (SCDesc **)malloc(pAcct->acctInfo.numOfStreams * sizeof(SCDesc *));
|
||||||
//
|
//
|
||||||
// pConn = pAcct->pConn;
|
// pConn = pAcct->pConn;
|
||||||
// SStreamDesc * pSdesc = pStreamShow->sdesc;
|
// SCMStreamDesc * pSdesc = pStreamShow->sdesc;
|
||||||
// SCDesc * pCDesc = pStreamShow->connInfo;
|
// SCDesc * pCDesc = pStreamShow->connInfo;
|
||||||
// SCDesc **ppCDesc = pStreamShow->cdesc;
|
// SCDesc **ppCDesc = pStreamShow->cdesc;
|
||||||
//
|
//
|
||||||
|
@ -296,7 +296,7 @@ int32_t mgmtGetStreams(SShowObj *pShow, void *pConn) {
|
||||||
// pCDesc->port = pConn->port;
|
// pCDesc->port = pConn->port;
|
||||||
// strcpy(pCDesc->user, pConn->pUser->user);
|
// strcpy(pCDesc->user, pConn->pUser->user);
|
||||||
//
|
//
|
||||||
// memcpy(pSdesc, pConn->pSList->sdesc, sizeof(SStreamDesc) * pConn->pSList->numOfStreams);
|
// memcpy(pSdesc, pConn->pSList->sdesc, sizeof(SCMStreamDesc) * pConn->pSList->numOfStreams);
|
||||||
// pSdesc += pConn->pSList->numOfStreams;
|
// pSdesc += pConn->pSList->numOfStreams;
|
||||||
// pStreamShow->numOfStreams += pConn->pSList->numOfStreams;
|
// pStreamShow->numOfStreams += pConn->pSList->numOfStreams;
|
||||||
// for (int32_t i = 0; i < pConn->pSList->numOfStreams; ++i, ++ppCDesc) *ppCDesc = pCDesc;
|
// for (int32_t i = 0; i < pConn->pSList->numOfStreams; ++i, ++ppCDesc) *ppCDesc = pCDesc;
|
||||||
|
@ -386,7 +386,7 @@ int32_t mgmtRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, void *pCo
|
||||||
if (rows > pStreamShow->numOfStreams - pStreamShow->index) rows = pStreamShow->numOfStreams - pStreamShow->index;
|
if (rows > pStreamShow->numOfStreams - pStreamShow->index) rows = pStreamShow->numOfStreams - pStreamShow->index;
|
||||||
|
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
SStreamDesc *pNode = pStreamShow->sdesc + pStreamShow->index;
|
SCMStreamDesc *pNode = pStreamShow->sdesc + pStreamShow->index;
|
||||||
SCDesc *pCDesc = pStreamShow->cdesc[pStreamShow->index];
|
SCDesc *pCDesc = pStreamShow->cdesc[pStreamShow->index];
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ int32_t mgmtKillStream(char *qidstr, void *pConn) {
|
||||||
// while (pConn) {
|
// while (pConn) {
|
||||||
// if (pConn->ip == ip && pConn->port == port && pConn->pSList) {
|
// if (pConn->ip == ip && pConn->port == port && pConn->pSList) {
|
||||||
// int32_t i;
|
// int32_t i;
|
||||||
// SStreamDesc *pSDesc = pConn->pSList->sdesc;
|
// SCMStreamDesc *pSDesc = pConn->pSList->sdesc;
|
||||||
// for (i = 0; i < pConn->pSList->numOfStreams; ++i, ++pSDesc) {
|
// for (i = 0; i < pConn->pSList->numOfStreams; ++i, ++pSDesc) {
|
||||||
// if (pSDesc->streamId == streamId) break;
|
// if (pSDesc->streamId == streamId) break;
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -645,7 +645,7 @@ int32_t mgmtProcessCreateUserMsg(void *pCont, int32_t contLen, void *ahandle) {
|
||||||
|
|
||||||
int32_t code;
|
int32_t code;
|
||||||
if (pUser->superAuth) {
|
if (pUser->superAuth) {
|
||||||
SCreateUserMsg *pCreate = pCont;
|
SCMCreateUserMsg *pCreate = pCont;
|
||||||
code = mgmtCreateUser(pUser->pAcct, pCreate->user, pCreate->pass);
|
code = mgmtCreateUser(pUser->pAcct, pCreate->user, pCreate->pass);
|
||||||
if (code == TSDB_CODE_SUCCESS) {
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
mLPrint("user:%s is created by %s", pCreate->user, pUser->user);
|
mLPrint("user:%s is created by %s", pCreate->user, pUser->user);
|
||||||
|
@ -669,7 +669,7 @@ int32_t mgmtProcessAlterUserMsg(void *pCont, int32_t contLen, void *ahandle) {
|
||||||
return TSDB_CODE_INVALID_USER;
|
return TSDB_CODE_INVALID_USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
SAlterUserMsg *pAlter = pCont;
|
SCMAlterUserMsg *pAlter = pCont;
|
||||||
SUserObj *pUser = mgmtGetUser(pAlter->user);
|
SUserObj *pUser = mgmtGetUser(pAlter->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
rpcSendResponse(ahandle, TSDB_CODE_INVALID_USER, NULL, 0);
|
rpcSendResponse(ahandle, TSDB_CODE_INVALID_USER, NULL, 0);
|
||||||
|
@ -776,7 +776,7 @@ int32_t mgmtProcessDropUserMsg(void *pCont, int32_t contLen, void *ahandle) {
|
||||||
return TSDB_CODE_INVALID_USER;
|
return TSDB_CODE_INVALID_USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDropUserMsg *pDrop = pCont;
|
SCMDropUserMsg *pDrop = pCont;
|
||||||
SUserObj *pUser = mgmtGetUser(pDrop->user);
|
SUserObj *pUser = mgmtGetUser(pDrop->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
rpcSendResponse(ahandle, TSDB_CODE_INVALID_USER, NULL, 0);
|
rpcSendResponse(ahandle, TSDB_CODE_INVALID_USER, NULL, 0);
|
||||||
|
@ -1181,10 +1181,10 @@ int32_t mgmtProcessCfgDnodeMsg(void *pCont, int32_t contLen, void *ahandle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mgmtProcessHeartBeatMsg(void *pCont, int32_t contLen, void *ahandle) {
|
int32_t mgmtProcessHeartBeatMsg(void *pCont, int32_t contLen, void *ahandle) {
|
||||||
SHeartBeatMsg *pHBMsg = (SHeartBeatMsg *) pCont;
|
SCMHeartBeatMsg *pHBMsg = (SCMHeartBeatMsg *) pCont;
|
||||||
mgmtSaveQueryStreamList(pHBMsg);
|
mgmtSaveQueryStreamList(pHBMsg);
|
||||||
|
|
||||||
SHeartBeatRsp *pHBRsp = (SHeartBeatRsp *) rpcMallocCont(contLen);
|
SCMHeartBeatRsp *pHBRsp = (SCMHeartBeatRsp *) rpcMallocCont(contLen);
|
||||||
if (pHBRsp == NULL) {
|
if (pHBRsp == NULL) {
|
||||||
rpcSendResponse(ahandle, TSDB_CODE_SERV_OUT_OF_MEMORY, NULL, 0);
|
rpcSendResponse(ahandle, TSDB_CODE_SERV_OUT_OF_MEMORY, NULL, 0);
|
||||||
rpcFreeCont(pCont);
|
rpcFreeCont(pCont);
|
||||||
|
@ -1218,7 +1218,7 @@ int32_t mgmtProcessHeartBeatMsg(void *pCont, int32_t contLen, void *ahandle) {
|
||||||
pHBRsp->streamId = 0;
|
pHBRsp->streamId = 0;
|
||||||
pHBRsp->killConnection = 0;
|
pHBRsp->killConnection = 0;
|
||||||
|
|
||||||
rpcSendResponse(ahandle, TSDB_CODE_SUCCESS, pHBRsp, sizeof(SHeartBeatMsg));
|
rpcSendResponse(ahandle, TSDB_CODE_SUCCESS, pHBRsp, sizeof(SCMHeartBeatMsg));
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1238,7 +1238,7 @@ int32_t mgmtRetriveUserAuthInfo(char *user, char *spi, char *encrypt, char *secr
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mgmtProcessConnectMsg(void *pCont, int32_t contLen, void *thandle) {
|
static int32_t mgmtProcessConnectMsg(void *pCont, int32_t contLen, void *thandle) {
|
||||||
SConnectMsg *pConnectMsg = (SConnectMsg *) pCont;
|
SCMConnectMsg *pConnectMsg = (SCMConnectMsg *) pCont;
|
||||||
SRpcConnInfo connInfo;
|
SRpcConnInfo connInfo;
|
||||||
rpcGetConnInfo(thandle, &connInfo);
|
rpcGetConnInfo(thandle, &connInfo);
|
||||||
int32_t code;
|
int32_t code;
|
||||||
|
@ -1275,7 +1275,7 @@ static int32_t mgmtProcessConnectMsg(void *pCont, int32_t contLen, void *thandle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SConnectRsp *pConnectRsp = rpcMallocCont(sizeof(SConnectRsp));
|
SCMConnectRsp *pConnectRsp = rpcMallocCont(sizeof(SCMConnectRsp));
|
||||||
if (pConnectRsp == NULL) {
|
if (pConnectRsp == NULL) {
|
||||||
code = TSDB_CODE_SERV_OUT_OF_MEMORY;
|
code = TSDB_CODE_SERV_OUT_OF_MEMORY;
|
||||||
goto connect_over;
|
goto connect_over;
|
||||||
|
@ -1307,7 +1307,7 @@ connect_over:
|
||||||
rpcSendResponse(thandle, code, NULL, 0);
|
rpcSendResponse(thandle, code, NULL, 0);
|
||||||
} else {
|
} else {
|
||||||
mLPrint("user:%s login from %s, code:%d", connInfo.user, taosIpStr(connInfo.clientIp), code);
|
mLPrint("user:%s login from %s, code:%d", connInfo.user, taosIpStr(connInfo.clientIp), code);
|
||||||
rpcSendResponse(thandle, code, pConnectRsp, sizeof(SConnectRsp));
|
rpcSendResponse(thandle, code, pConnectRsp, sizeof(SCMConnectRsp));
|
||||||
}
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
|
Loading…
Reference in New Issue