chore: more code
This commit is contained in:
parent
a04ba65817
commit
7ff25d6895
|
@ -81,6 +81,7 @@ bool tsMndSkipGrant = false;
|
|||
|
||||
// dnode
|
||||
int64_t tsDndStart = 0;
|
||||
int64_t tsDndStartOsUptime = 0;
|
||||
int64_t tsDndUpTime = 0;
|
||||
|
||||
// monitor
|
||||
|
|
|
@ -42,7 +42,7 @@ static void *dmStatusThreadFp(void *param) {
|
|||
cost = taosGetTimestampMs() - curTime;
|
||||
}
|
||||
tsDndUpTime += 200;
|
||||
if (cost > 0) tsDndUpTime += cost;
|
||||
if (cost > 0) tsDndUpTime += cost; // TODO: use /proc/uptime to replace the upTime calculation for linux
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -27,7 +27,7 @@ void mndCleanupCluster(SMnode *pMnode);
|
|||
int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len);
|
||||
int64_t mndGetClusterId(SMnode *pMnode);
|
||||
int64_t mndGetClusterCreateTime(SMnode *pMnode);
|
||||
float mndGetClusterUpTime(SMnode *pMnode);
|
||||
int64_t mndGetClusterUpTime(SMnode *pMnode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ static int32_t mndGetClusterUpTimeImp(SClusterObj *pCluster) {
|
|||
#endif
|
||||
}
|
||||
|
||||
float mndGetClusterUpTime(SMnode *pMnode) {
|
||||
int64_t mndGetClusterUpTime(SMnode *pMnode) {
|
||||
int64_t upTime = 0;
|
||||
void *pIter = NULL;
|
||||
SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter);
|
||||
|
@ -132,7 +132,7 @@ float mndGetClusterUpTime(SMnode *pMnode) {
|
|||
mndReleaseCluster(pMnode, pCluster, pIter);
|
||||
}
|
||||
|
||||
return (float)upTime;
|
||||
return upTime;
|
||||
}
|
||||
|
||||
static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) {
|
||||
|
|
|
@ -249,9 +249,8 @@ static void *mndThreadFp(void *param) {
|
|||
setThreadName("mnode-timer");
|
||||
|
||||
while (1) {
|
||||
printf("%s:%d =========== mndThreadFp =========== %d\n", __func__, __LINE__, taosGetTimestampSec());
|
||||
lastTime++;
|
||||
taosMsleep(300);
|
||||
taosMsleep(100);
|
||||
if (mndGetStop(pMnode)) break;
|
||||
if (lastTime % 10 != 0) continue;
|
||||
|
||||
|
@ -806,7 +805,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
|||
if (pObj->id == pMnode->selfDnodeId) {
|
||||
pClusterInfo->first_ep_dnode_id = pObj->id;
|
||||
tstrncpy(pClusterInfo->first_ep, pObj->pDnode->ep, sizeof(pClusterInfo->first_ep));
|
||||
pClusterInfo->master_uptime = mndGetClusterUpTime(pMnode) / 86400.0f;
|
||||
pClusterInfo->master_uptime = (float)mndGetClusterUpTime(pMnode) / 86400.0f;
|
||||
// pClusterInfo->master_uptime = (ms - pObj->stateStartTime) / (86400000.0f);
|
||||
tstrncpy(desc.role, syncStr(TAOS_SYNC_STATE_LEADER), sizeof(desc.role));
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue