提交 7c588cc0 编写于 作者: S Shengliang Guan

feat: report startup steps

上级 7d658025
...@@ -44,6 +44,7 @@ typedef int32_t (*SendMnodeReqFp)(SMgmtWrapper* pWrapper, SRpcMsg* pReq); ...@@ -44,6 +44,7 @@ typedef int32_t (*SendMnodeReqFp)(SMgmtWrapper* pWrapper, SRpcMsg* pReq);
typedef void (*SendRspFp)(SMgmtWrapper* pWrapper, const SRpcMsg* pRsp); typedef void (*SendRspFp)(SMgmtWrapper* pWrapper, const SRpcMsg* pRsp);
typedef void (*RegisterBrokenLinkArgFp)(SMgmtWrapper* pWrapper, SRpcMsg* pMsg); typedef void (*RegisterBrokenLinkArgFp)(SMgmtWrapper* pWrapper, SRpcMsg* pMsg);
typedef void (*ReleaseHandleFp)(SMgmtWrapper* pWrapper, void* handle, int8_t type); typedef void (*ReleaseHandleFp)(SMgmtWrapper* pWrapper, void* handle, int8_t type);
typedef void (*ReportStartup)(SMgmtWrapper* pWrapper, const char* name, const char* desc);
typedef struct { typedef struct {
SMgmtWrapper* pWrapper; SMgmtWrapper* pWrapper;
...@@ -53,6 +54,7 @@ typedef struct { ...@@ -53,6 +54,7 @@ typedef struct {
SendRspFp sendRspFp; SendRspFp sendRspFp;
RegisterBrokenLinkArgFp registerBrokenLinkArgFp; RegisterBrokenLinkArgFp registerBrokenLinkArgFp;
ReleaseHandleFp releaseHandleFp; ReleaseHandleFp releaseHandleFp;
ReportStartup reportStartupFp;
} SMsgCb; } SMsgCb;
void tmsgSetDefaultMsgCb(const SMsgCb* pMsgCb); void tmsgSetDefaultMsgCb(const SMsgCb* pMsgCb);
...@@ -62,6 +64,7 @@ int32_t tmsgSendReq(const SMsgCb* pMsgCb, const SEpSet* epSet, SRpcMsg* pReq); ...@@ -62,6 +64,7 @@ int32_t tmsgSendReq(const SMsgCb* pMsgCb, const SEpSet* epSet, SRpcMsg* pReq);
void tmsgSendRsp(const SRpcMsg* pRsp); void tmsgSendRsp(const SRpcMsg* pRsp);
void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg); void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg);
void tmsgReleaseHandle(void* handle, int8_t type); void tmsgReleaseHandle(void* handle, int8_t type);
void tmsgReportStartup(const char* name, const char* desc);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -40,4 +40,8 @@ void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg) { ...@@ -40,4 +40,8 @@ void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg) {
void tmsgReleaseHandle(void* handle, int8_t type) { void tmsgReleaseHandle(void* handle, int8_t type) {
(*tsDefaultMsgCb.releaseHandleFp)(tsDefaultMsgCb.pWrapper, handle, type); (*tsDefaultMsgCb.releaseHandleFp)(tsDefaultMsgCb.pWrapper, handle, type);
}
void tmsgReportStartup(const char* name, const char* desc) {
(*tsDefaultMsgCb.reportStartupFp)(tsDefaultMsgCb.pWrapper, name, desc);
} }
\ No newline at end of file
...@@ -140,6 +140,7 @@ int32_t dmOpenNode(SMgmtWrapper *pWrapper) { ...@@ -140,6 +140,7 @@ int32_t dmOpenNode(SMgmtWrapper *pWrapper) {
if (dmRunParentProc(pWrapper) != 0) return -1; if (dmRunParentProc(pWrapper) != 0) return -1;
} }
dmReportStartup(pWrapper->pDnode, pWrapper->name, "openned");
return 0; return 0;
} }
...@@ -161,6 +162,7 @@ int32_t dmStartNode(SMgmtWrapper *pWrapper) { ...@@ -161,6 +162,7 @@ int32_t dmStartNode(SMgmtWrapper *pWrapper) {
} }
} }
dmReportStartup(pWrapper->pDnode, pWrapper->name, "started");
return 0; return 0;
} }
......
...@@ -36,7 +36,8 @@ static int32_t dmProcessStatusRsp(SDnode *pDnode, SRpcMsg *pRsp) { ...@@ -36,7 +36,8 @@ static int32_t dmProcessStatusRsp(SDnode *pDnode, SRpcMsg *pRsp) {
} }
} else { } else {
SStatusRsp statusRsp = {0}; SStatusRsp statusRsp = {0};
if (pRsp->pCont != NULL && pRsp->contLen > 0 && tDeserializeSStatusRsp(pRsp->pCont, pRsp->contLen, &statusRsp) == 0) { if (pRsp->pCont != NULL && pRsp->contLen > 0 &&
tDeserializeSStatusRsp(pRsp->pCont, pRsp->contLen, &statusRsp) == 0) {
pDnode->data.dnodeVer = statusRsp.dnodeVer; pDnode->data.dnodeVer = statusRsp.dnodeVer;
dmUpdateDnodeCfg(pDnode, &statusRsp.dnodeCfg); dmUpdateDnodeCfg(pDnode, &statusRsp.dnodeCfg);
dmUpdateEps(pDnode, statusRsp.pDnodeEps); dmUpdateEps(pDnode, statusRsp.pDnodeEps);
...@@ -76,7 +77,7 @@ void dmSendStatusReq(SDnode *pDnode) { ...@@ -76,7 +77,7 @@ void dmSendStatusReq(SDnode *pDnode) {
req.pVloads = info.pVloads; req.pVloads = info.pVloads;
int32_t contLen = tSerializeSStatusReq(NULL, 0, &req); int32_t contLen = tSerializeSStatusReq(NULL, 0, &req);
void * pHead = rpcMallocCont(contLen); void *pHead = rpcMallocCont(contLen);
tSerializeSStatusReq(pHead, contLen, &req); tSerializeSStatusReq(pHead, contLen, &req);
tFreeSStatusReq(&req); tFreeSStatusReq(&req);
...@@ -101,7 +102,7 @@ int32_t dmProcessGrantRsp(SDnode *pDnode, SNodeMsg *pMsg) { ...@@ -101,7 +102,7 @@ int32_t dmProcessGrantRsp(SDnode *pDnode, SNodeMsg *pMsg) {
} }
int32_t dmProcessConfigReq(SDnode *pDnode, SNodeMsg *pMsg) { int32_t dmProcessConfigReq(SDnode *pDnode, SNodeMsg *pMsg) {
SRpcMsg * pReq = &pMsg->rpcMsg; SRpcMsg *pReq = &pMsg->rpcMsg;
SDCfgDnodeReq *pCfg = pReq->pCont; SDCfgDnodeReq *pCfg = pReq->pCont;
dError("config req is received, but not supported yet"); dError("config req is received, but not supported yet");
return TSDB_CODE_OPS_NOT_SUPPORT; return TSDB_CODE_OPS_NOT_SUPPORT;
...@@ -230,6 +231,7 @@ static int32_t dmInitMgmt(SMgmtWrapper *pWrapper) { ...@@ -230,6 +231,7 @@ static int32_t dmInitMgmt(SMgmtWrapper *pWrapper) {
dError("failed to init transport since %s", terrstr()); dError("failed to init transport since %s", terrstr());
return -1; return -1;
} }
dmReportStartup(pDnode, "dnode-transport", "initialized");
dInfo("dnode-mgmt is initialized"); dInfo("dnode-mgmt is initialized");
return 0; return 0;
......
...@@ -505,7 +505,6 @@ static void dmCleanupServer(SDnode *pDnode) { ...@@ -505,7 +505,6 @@ static void dmCleanupServer(SDnode *pDnode) {
int32_t dmInitTrans(SDnode *pDnode) { int32_t dmInitTrans(SDnode *pDnode) {
if (dmInitServer(pDnode) != 0) return -1; if (dmInitServer(pDnode) != 0) return -1;
if (dmInitClient(pDnode) != 0) return -1; if (dmInitClient(pDnode) != 0) return -1;
dmReportStartup(pDnode, "transport", "initialized");
return 0; return 0;
} }
...@@ -520,6 +519,7 @@ SMsgCb dmGetMsgcb(SMgmtWrapper *pWrapper) { ...@@ -520,6 +519,7 @@ SMsgCb dmGetMsgcb(SMgmtWrapper *pWrapper) {
.sendRspFp = dmSendRsp, .sendRspFp = dmSendRsp,
.registerBrokenLinkArgFp = dmRegisterBrokenLinkArg, .registerBrokenLinkArgFp = dmRegisterBrokenLinkArg,
.releaseHandleFp = dmReleaseHandle, .releaseHandleFp = dmReleaseHandle,
.reportStartupFp = dmReportStartupByWrapper,
.pWrapper = pWrapper, .pWrapper = pWrapper,
}; };
return msgCb; return msgCb;
......
...@@ -74,6 +74,7 @@ int32_t dmStartStatusThread(SDnode *pDnode) { ...@@ -74,6 +74,7 @@ int32_t dmStartStatusThread(SDnode *pDnode) {
return -1; return -1;
} }
dmReportStartup(pDnode, "dnode-status", "initialized");
return 0; return 0;
} }
...@@ -92,6 +93,7 @@ int32_t dmStartMonitorThread(SDnode *pDnode) { ...@@ -92,6 +93,7 @@ int32_t dmStartMonitorThread(SDnode *pDnode) {
return -1; return -1;
} }
dmReportStartup(pDnode, "dnode-monitor", "initialized");
return 0; return 0;
} }
......
...@@ -35,6 +35,7 @@ void dmSetStatus(SDnode *pDnode, EDndRunStatus stat); ...@@ -35,6 +35,7 @@ void dmSetStatus(SDnode *pDnode, EDndRunStatus stat);
void dmSetEvent(SDnode *pDnode, EDndEvent event); void dmSetEvent(SDnode *pDnode, EDndEvent event);
void dmSetMsgHandle(SMgmtWrapper *pWrapper, tmsg_t msgType, NodeMsgFp nodeMsgFp, int8_t vgId); void dmSetMsgHandle(SMgmtWrapper *pWrapper, tmsg_t msgType, NodeMsgFp nodeMsgFp, int8_t vgId);
void dmReportStartup(SDnode *pDnode, const char *pName, const char *pDesc); void dmReportStartup(SDnode *pDnode, const char *pName, const char *pDesc);
void dmReportStartupByWrapper(SMgmtWrapper *pWrapper, const char *pName, const char *pDesc);
void dmProcessServerStatusReq(SDnode *pDnode, SRpcMsg *pMsg); void dmProcessServerStatusReq(SDnode *pDnode, SRpcMsg *pMsg);
void dmGetMonitorSysInfo(SMonSysInfo *pInfo); void dmGetMonitorSysInfo(SMonSysInfo *pInfo);
......
...@@ -140,6 +140,12 @@ void dmReportStartup(SDnode *pDnode, const char *pName, const char *pDesc) { ...@@ -140,6 +140,12 @@ void dmReportStartup(SDnode *pDnode, const char *pName, const char *pDesc) {
SStartupInfo *pStartup = &pDnode->startup; SStartupInfo *pStartup = &pDnode->startup;
tstrncpy(pStartup->name, pName, TSDB_STEP_NAME_LEN); tstrncpy(pStartup->name, pName, TSDB_STEP_NAME_LEN);
tstrncpy(pStartup->desc, pDesc, TSDB_STEP_DESC_LEN); tstrncpy(pStartup->desc, pDesc, TSDB_STEP_DESC_LEN);
dInfo("step:%s, %s", pStartup->name, pStartup->desc);
taosMsleep(300);
}
void dmReportStartupByWrapper(SMgmtWrapper *pWrapper, const char *pName, const char *pDesc) {
dmReportStartup(pWrapper->pDnode, pName, pDesc);
} }
static void dmGetServerStatus(SDnode *pDnode, SServerStatusRsp *pStatus) { static void dmGetServerStatus(SDnode *pDnode, SServerStatusRsp *pStatus) {
......
...@@ -61,12 +61,14 @@ int32_t bmOpen(SMgmtWrapper *pWrapper) { ...@@ -61,12 +61,14 @@ int32_t bmOpen(SMgmtWrapper *pWrapper) {
bmClose(pWrapper); bmClose(pWrapper);
return -1; return -1;
} }
dmReportStartup(pWrapper->pDnode, "bnode-impl", "initialized");
if (bmStartWorker(pMgmt) != 0) { if (bmStartWorker(pMgmt) != 0) {
dError("failed to start bnode worker since %s", terrstr()); dError("failed to start bnode worker since %s", terrstr());
bmClose(pWrapper); bmClose(pWrapper);
return -1; return -1;
} }
dmReportStartup(pWrapper->pDnode, "bnode-worker", "initialized");
return 0; return 0;
} }
......
...@@ -176,12 +176,14 @@ static int32_t mmOpen(SMgmtWrapper *pWrapper) { ...@@ -176,12 +176,14 @@ static int32_t mmOpen(SMgmtWrapper *pWrapper) {
mmClose(pWrapper); mmClose(pWrapper);
return -1; return -1;
} }
dmReportStartup(pWrapper->pDnode, "mnode-impl", "initialized");
if (mmStartWorker(pMgmt) != 0) { if (mmStartWorker(pMgmt) != 0) {
dError("failed to start mnode worker since %s", terrstr()); dError("failed to start mnode worker since %s", terrstr());
mmClose(pWrapper); mmClose(pWrapper);
return -1; return -1;
} }
dmReportStartup(pWrapper->pDnode, "mnode-worker", "initialized");
if (!deployed) { if (!deployed) {
deployed = true; deployed = true;
......
...@@ -64,12 +64,14 @@ static int32_t qmOpen(SMgmtWrapper *pWrapper) { ...@@ -64,12 +64,14 @@ static int32_t qmOpen(SMgmtWrapper *pWrapper) {
qmClose(pWrapper); qmClose(pWrapper);
return -1; return -1;
} }
dmReportStartup(pWrapper->pDnode, "qnode-impl", "initialized");
if (qmStartWorker(pMgmt) != 0) { if (qmStartWorker(pMgmt) != 0) {
dError("failed to start qnode worker since %s", terrstr()); dError("failed to start qnode worker since %s", terrstr());
qmClose(pWrapper); qmClose(pWrapper);
return -1; return -1;
} }
dmReportStartup(pWrapper->pDnode, "qnode-worker", "initialized");
dInfo("qnode-mgmt is initialized"); dInfo("qnode-mgmt is initialized");
return 0; return 0;
......
...@@ -60,11 +60,13 @@ int32_t smOpen(SMgmtWrapper *pWrapper) { ...@@ -60,11 +60,13 @@ int32_t smOpen(SMgmtWrapper *pWrapper) {
dError("failed to open snode since %s", terrstr()); dError("failed to open snode since %s", terrstr());
return -1; return -1;
} }
dmReportStartup(pWrapper->pDnode, "snode-impl", "initialized");
if (smStartWorker(pMgmt) != 0) { if (smStartWorker(pMgmt) != 0) {
dError("failed to start snode worker since %s", terrstr()); dError("failed to start snode worker since %s", terrstr());
return -1; return -1;
} }
dmReportStartup(pWrapper->pDnode, "snode-worker", "initialized");
return 0; return 0;
} }
......
...@@ -130,7 +130,7 @@ static void *vmOpenVnodeFunc(void *param) { ...@@ -130,7 +130,7 @@ static void *vmOpenVnodeFunc(void *param) {
char stepDesc[TSDB_STEP_DESC_LEN] = {0}; char stepDesc[TSDB_STEP_DESC_LEN] = {0};
snprintf(stepDesc, TSDB_STEP_DESC_LEN, "vgId:%d, start to restore, %d of %d have been opened", pCfg->vgId, snprintf(stepDesc, TSDB_STEP_DESC_LEN, "vgId:%d, start to restore, %d of %d have been opened", pCfg->vgId,
pMgmt->state.openVnodes, pMgmt->state.totalVnodes); pMgmt->state.openVnodes, pMgmt->state.totalVnodes);
dmReportStartup(pDnode, "open-vnodes", stepDesc); dmReportStartup(pDnode, "vnode-open", stepDesc);
SMsgCb msgCb = pMgmt->pDnode->data.msgCb; SMsgCb msgCb = pMgmt->pDnode->data.msgCb;
msgCb.pWrapper = pMgmt->pWrapper; msgCb.pWrapper = pMgmt->pWrapper;
...@@ -298,25 +298,30 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) { ...@@ -298,25 +298,30 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) {
dError("failed to init tfs since %s", terrstr()); dError("failed to init tfs since %s", terrstr());
goto _OVER; goto _OVER;
} }
dmReportStartup(pDnode, "vnode-tfs", "initialized");
if (walInit() != 0) { if (walInit() != 0) {
dError("failed to init wal since %s", terrstr()); dError("failed to init wal since %s", terrstr());
goto _OVER; goto _OVER;
} }
dmReportStartup(pDnode, "vnode-wal", "initialized");
if (vnodeInit(tsNumOfCommitThreads) != 0) { if (vnodeInit(tsNumOfCommitThreads) != 0) {
dError("failed to init vnode since %s", terrstr()); dError("failed to init vnode since %s", terrstr());
goto _OVER; goto _OVER;
} }
dmReportStartup(pDnode, "vnode-commit", "initialized");
if (vmStartWorker(pMgmt) != 0) { if (vmStartWorker(pMgmt) != 0) {
dError("failed to init workers since %s", terrstr()) goto _OVER; dError("failed to init workers since %s", terrstr()) goto _OVER;
} }
dmReportStartup(pDnode, "vnode-worker", "initialized");
if (vmOpenVnodes(pMgmt) != 0) { if (vmOpenVnodes(pMgmt) != 0) {
dError("failed to open vnode since %s", terrstr()); dError("failed to open vnode since %s", terrstr());
return -1; return -1;
} }
dmReportStartup(pDnode, "vnode-vnodes", "initialized");
code = 0; code = 0;
......
...@@ -262,6 +262,7 @@ static int32_t mndExecSteps(SMnode *pMnode) { ...@@ -262,6 +262,7 @@ static int32_t mndExecSteps(SMnode *pMnode) {
return -1; return -1;
} else { } else {
mDebug("%s is initialized", pStep->name); mDebug("%s is initialized", pStep->name);
tmsgReportStartup(pStep->name, "initialized");
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册