chore: more code

This commit is contained in:
kailixu 2023-07-20 10:56:08 +08:00
parent a04ba65817
commit 7ff25d6895
5 changed files with 7 additions and 7 deletions

View File

@ -81,6 +81,7 @@ bool tsMndSkipGrant = false;
// dnode // dnode
int64_t tsDndStart = 0; int64_t tsDndStart = 0;
int64_t tsDndStartOsUptime = 0;
int64_t tsDndUpTime = 0; int64_t tsDndUpTime = 0;
// monitor // monitor

View File

@ -42,7 +42,7 @@ static void *dmStatusThreadFp(void *param) {
cost = taosGetTimestampMs() - curTime; cost = taosGetTimestampMs() - curTime;
} }
tsDndUpTime += 200; 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; return NULL;

View File

@ -27,7 +27,7 @@ void mndCleanupCluster(SMnode *pMnode);
int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len); int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len);
int64_t mndGetClusterId(SMnode *pMnode); int64_t mndGetClusterId(SMnode *pMnode);
int64_t mndGetClusterCreateTime(SMnode *pMnode); int64_t mndGetClusterCreateTime(SMnode *pMnode);
float mndGetClusterUpTime(SMnode *pMnode); int64_t mndGetClusterUpTime(SMnode *pMnode);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -123,7 +123,7 @@ static int32_t mndGetClusterUpTimeImp(SClusterObj *pCluster) {
#endif #endif
} }
float mndGetClusterUpTime(SMnode *pMnode) { int64_t mndGetClusterUpTime(SMnode *pMnode) {
int64_t upTime = 0; int64_t upTime = 0;
void *pIter = NULL; void *pIter = NULL;
SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter); SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter);
@ -132,7 +132,7 @@ float mndGetClusterUpTime(SMnode *pMnode) {
mndReleaseCluster(pMnode, pCluster, pIter); mndReleaseCluster(pMnode, pCluster, pIter);
} }
return (float)upTime; return upTime;
} }
static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) { static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) {

View File

@ -249,9 +249,8 @@ static void *mndThreadFp(void *param) {
setThreadName("mnode-timer"); setThreadName("mnode-timer");
while (1) { while (1) {
printf("%s:%d =========== mndThreadFp =========== %d\n", __func__, __LINE__, taosGetTimestampSec());
lastTime++; lastTime++;
taosMsleep(300); taosMsleep(100);
if (mndGetStop(pMnode)) break; if (mndGetStop(pMnode)) break;
if (lastTime % 10 != 0) continue; if (lastTime % 10 != 0) continue;
@ -806,7 +805,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
if (pObj->id == pMnode->selfDnodeId) { if (pObj->id == pMnode->selfDnodeId) {
pClusterInfo->first_ep_dnode_id = pObj->id; pClusterInfo->first_ep_dnode_id = pObj->id;
tstrncpy(pClusterInfo->first_ep, pObj->pDnode->ep, sizeof(pClusterInfo->first_ep)); 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); // pClusterInfo->master_uptime = (ms - pObj->stateStartTime) / (86400000.0f);
tstrncpy(desc.role, syncStr(TAOS_SYNC_STATE_LEADER), sizeof(desc.role)); tstrncpy(desc.role, syncStr(TAOS_SYNC_STATE_LEADER), sizeof(desc.role));
} else { } else {