提交 2d8ed7a9 编写于 作者: S Shengliang Guan

fix: monitor in multi-process mode

上级 fefc2dad
...@@ -57,78 +57,78 @@ static void dmGetDmMonitorInfo(SDnode *pDnode) { ...@@ -57,78 +57,78 @@ static void dmGetDmMonitorInfo(SDnode *pDnode) {
} }
static void dmGetMmMonitorInfo(SDnode *pDnode) { static void dmGetMmMonitorInfo(SDnode *pDnode) {
SMonMmInfo mmInfo = {0}; SMgmtWrapper *pWrapper = &pDnode->wrappers[MNODE];
SMgmtWrapper *pWrapper = dmAcquireWrapper(pDnode, MNODE); if (dmMarkWrapper(pWrapper) == 0) {
if (pWrapper != NULL && pWrapper->required) { SMonMmInfo mmInfo = {0};
if (tsMultiProcess) { if (tsMultiProcess) {
dmSendLocalRecv(pDnode, TDMT_MON_MM_INFO, tDeserializeSMonMmInfo, &mmInfo); dmSendLocalRecv(pDnode, TDMT_MON_MM_INFO, tDeserializeSMonMmInfo, &mmInfo);
} else if (pWrapper->pMgmt != NULL) { } else if (pWrapper->pMgmt != NULL) {
mmGetMonitorInfo(pWrapper->pMgmt, &mmInfo); mmGetMonitorInfo(pWrapper->pMgmt, &mmInfo);
} }
dmReleaseWrapper(pWrapper);
monSetMmInfo(&mmInfo);
tFreeSMonMmInfo(&mmInfo);
} }
dmReleaseWrapper(pWrapper);
monSetMmInfo(&mmInfo);
tFreeSMonMmInfo(&mmInfo);
} }
static void dmGetVmMonitorInfo(SDnode *pDnode) { static void dmGetVmMonitorInfo(SDnode *pDnode) {
SMonVmInfo vmInfo = {0}; SMgmtWrapper *pWrapper = &pDnode->wrappers[VNODE];
SMgmtWrapper *pWrapper = dmAcquireWrapper(pDnode, VNODE); if (dmMarkWrapper(pWrapper) == 0) {
if (pWrapper != NULL && pWrapper->required) { SMonVmInfo vmInfo = {0};
if (tsMultiProcess) { if (tsMultiProcess) {
dmSendLocalRecv(pDnode, TDMT_MON_VM_INFO, tDeserializeSMonVmInfo, &vmInfo); dmSendLocalRecv(pDnode, TDMT_MON_VM_INFO, tDeserializeSMonVmInfo, &vmInfo);
} else if (pWrapper->pMgmt != NULL) { } else if (pWrapper->pMgmt != NULL) {
vmGetMonitorInfo(pWrapper->pMgmt, &vmInfo); vmGetMonitorInfo(pWrapper->pMgmt, &vmInfo);
} }
dmReleaseWrapper(pWrapper);
monSetVmInfo(&vmInfo);
tFreeSMonVmInfo(&vmInfo);
} }
dmReleaseWrapper(pWrapper);
monSetVmInfo(&vmInfo);
tFreeSMonVmInfo(&vmInfo);
} }
static void dmGetQmMonitorInfo(SDnode *pDnode) { static void dmGetQmMonitorInfo(SDnode *pDnode) {
SMonQmInfo qmInfo = {0}; SMgmtWrapper *pWrapper = &pDnode->wrappers[QNODE];
SMgmtWrapper *pWrapper = dmAcquireWrapper(pDnode, VNODE); if (dmMarkWrapper(pWrapper) == 0) {
if (pWrapper != NULL && pWrapper->required) { SMonQmInfo qmInfo = {0};
if (tsMultiProcess) { if (tsMultiProcess) {
dmSendLocalRecv(pDnode, TDMT_MON_QM_INFO, tDeserializeSMonQmInfo, &qmInfo); dmSendLocalRecv(pDnode, TDMT_MON_QM_INFO, tDeserializeSMonQmInfo, &qmInfo);
} else if (pWrapper->pMgmt != NULL) { } else if (pWrapper->pMgmt != NULL) {
qmGetMonitorInfo(pWrapper->pMgmt, &qmInfo); qmGetMonitorInfo(pWrapper->pMgmt, &qmInfo);
} }
dmReleaseWrapper(pWrapper);
monSetQmInfo(&qmInfo);
tFreeSMonQmInfo(&qmInfo);
} }
dmReleaseWrapper(pWrapper);
monSetQmInfo(&qmInfo);
tFreeSMonQmInfo(&qmInfo);
} }
static void dmGetSmMonitorInfo(SDnode *pDnode) { static void dmGetSmMonitorInfo(SDnode *pDnode) {
SMonSmInfo smInfo = {0}; SMgmtWrapper *pWrapper = &pDnode->wrappers[SNODE];
SMgmtWrapper *pWrapper = dmAcquireWrapper(pDnode, VNODE); if (dmMarkWrapper(pWrapper) == 0) {
if (pWrapper != NULL && pWrapper->required) { SMonSmInfo smInfo = {0};
if (tsMultiProcess) { if (tsMultiProcess) {
dmSendLocalRecv(pDnode, TDMT_MON_SM_INFO, tDeserializeSMonSmInfo, &smInfo); dmSendLocalRecv(pDnode, TDMT_MON_SM_INFO, tDeserializeSMonSmInfo, &smInfo);
} else if (pWrapper->pMgmt != NULL) { } else if (pWrapper->pMgmt != NULL) {
smGetMonitorInfo(pWrapper->pMgmt, &smInfo); smGetMonitorInfo(pWrapper->pMgmt, &smInfo);
} }
dmReleaseWrapper(pWrapper);
monSetSmInfo(&smInfo);
tFreeSMonSmInfo(&smInfo);
} }
dmReleaseWrapper(pWrapper);
monSetSmInfo(&smInfo);
tFreeSMonSmInfo(&smInfo);
} }
static void dmGetBmMonitorInfo(SDnode *pDnode) { static void dmGetBmMonitorInfo(SDnode *pDnode) {
SMonBmInfo bmInfo = {0}; SMgmtWrapper *pWrapper = &pDnode->wrappers[BNODE];
SMgmtWrapper *pWrapper = dmAcquireWrapper(pDnode, VNODE); if (dmMarkWrapper(pWrapper) == 0) {
if (pWrapper != NULL && pWrapper->required) { SMonBmInfo bmInfo = {0};
if (tsMultiProcess) { if (tsMultiProcess) {
dmSendLocalRecv(pDnode, TDMT_MON_BM_INFO, tDeserializeSMonBmInfo, &bmInfo); dmSendLocalRecv(pDnode, TDMT_MON_BM_INFO, tDeserializeSMonBmInfo, &bmInfo);
} else if (pWrapper->pMgmt != NULL) { } else if (pWrapper->pMgmt != NULL) {
bmGetMonitorInfo(pWrapper->pMgmt, &bmInfo); bmGetMonitorInfo(pWrapper->pMgmt, &bmInfo);
} }
dmReleaseWrapper(pWrapper);
monSetBmInfo(&bmInfo);
tFreeSMonBmInfo(&bmInfo);
} }
dmReleaseWrapper(pWrapper);
monSetBmInfo(&bmInfo);
tFreeSMonBmInfo(&bmInfo);
} }
void dmSendMonitorReport() { void dmSendMonitorReport() {
...@@ -147,26 +147,24 @@ void dmSendMonitorReport() { ...@@ -147,26 +147,24 @@ void dmSendMonitorReport() {
void dmGetVnodeLoads(SMonVloadInfo *pInfo) { void dmGetVnodeLoads(SMonVloadInfo *pInfo) {
SDnode *pDnode = dmInstance(); SDnode *pDnode = dmInstance();
SMgmtWrapper *pWrapper = dmAcquireWrapper(pDnode, VNODE); SMgmtWrapper *pWrapper = &pDnode->wrappers[VNODE];
if (pWrapper != NULL && pWrapper->required) { if (dmMarkWrapper(pWrapper) == 0) {
if (tsMultiProcess) { if (tsMultiProcess) {
dmSendLocalRecv(pDnode, TDMT_MON_VM_LOAD, tDeserializeSMonVloadInfo, pInfo); dmSendLocalRecv(pDnode, TDMT_MON_VM_LOAD, tDeserializeSMonVloadInfo, pInfo);
} else if (pWrapper->pMgmt != NULL) { } else if (pWrapper->pMgmt != NULL) {
vmGetVnodeLoads(pWrapper->pMgmt, pInfo); vmGetVnodeLoads(pWrapper->pMgmt, pInfo);
} }
dmReleaseWrapper(pWrapper);
} }
dmReleaseWrapper(pWrapper);
} }
void dmGetMnodeLoads(SMonMloadInfo *pInfo) { void dmGetMnodeLoads(SMonMloadInfo *pInfo) {
SDnode *pDnode = dmInstance(); SDnode *pDnode = dmInstance();
SMgmtWrapper *pWrapper = dmAcquireWrapper(pDnode, MNODE); SMgmtWrapper *pWrapper = &pDnode->wrappers[MNODE];
if (pWrapper != NULL && pWrapper->required) { if (tsMultiProcess) {
if (tsMultiProcess) { dmSendLocalRecv(pDnode, TDMT_MON_MM_LOAD, tDeserializeSMonMloadInfo, pInfo);
dmSendLocalRecv(pDnode, TDMT_MON_MM_LOAD, tDeserializeSMonMloadInfo, pInfo); } else if (pWrapper->pMgmt != NULL) {
} else if (pWrapper->pMgmt != NULL) { mmGetMnodeLoads(pWrapper->pMgmt, pInfo);
mmGetMnodeLoads(pWrapper->pMgmt, pInfo);
}
} }
dmReleaseWrapper(pWrapper); dmReleaseWrapper(pWrapper);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册