feat: support get cluster create time
This commit is contained in:
parent
cc488bdc07
commit
762ffd9cf3
|
@ -26,6 +26,7 @@ int32_t mndInitCluster(SMnode *pMnode);
|
|||
void mndCleanupCluster(SMnode *pMnode);
|
||||
int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len);
|
||||
int64_t mndGetClusterId(SMnode *pMnode);
|
||||
int64_t mndGetClusterCreateTime(SMnode *pMnode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -38,11 +38,11 @@ typedef enum {
|
|||
TSDB_GRANT_CPU_CORES,
|
||||
} EGrantType;
|
||||
|
||||
int32_t mndInitGrant();
|
||||
int32_t mndInitGrant(SMnode *pMnode);
|
||||
void mndCleanupGrant();
|
||||
void grantParseParameter();
|
||||
int32_t grantCheck(EGrantType grant);
|
||||
void grantReset(EGrantType grant, uint64_t value);
|
||||
void grantReset(SMnode *pMnode, EGrantType grant, uint64_t value);
|
||||
void grantAdd(EGrantType grant, uint64_t value);
|
||||
void grantRestore(EGrantType grant, uint64_t value);
|
||||
|
||||
|
|
|
@ -79,6 +79,23 @@ int64_t mndGetClusterId(SMnode *pMnode) {
|
|||
return clusterId;
|
||||
}
|
||||
|
||||
int64_t mndGetClusterCreateTime(SMnode *pMnode) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
void *pIter = NULL;
|
||||
int64_t createTime = INT64_MAX;
|
||||
|
||||
while (1) {
|
||||
SClusterObj *pCluster = NULL;
|
||||
pIter = sdbFetch(pSdb, SDB_CLUSTER, pIter, (void **)&pCluster);
|
||||
if (pIter == NULL) break;
|
||||
|
||||
createTime = pCluster->createdTime;
|
||||
sdbRelease(pSdb, pCluster);
|
||||
}
|
||||
|
||||
return createTime;
|
||||
}
|
||||
|
||||
static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ int32_t mndInitGrant(SMnode *pMnode) {
|
|||
void mndCleanupGrant() {}
|
||||
void grantParseParameter() { mError("can't parsed parameter k"); }
|
||||
int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; }
|
||||
void grantReset(EGrantType grant, uint64_t value) {}
|
||||
void grantReset(SMnode *pMnode, EGrantType grant, uint64_t value) {}
|
||||
void grantAdd(EGrantType grant, uint64_t value) {}
|
||||
void grantRestore(EGrantType grant, uint64_t value) {}
|
||||
int32_t dmProcessGrantReq(SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; }
|
||||
|
|
|
@ -399,6 +399,9 @@ int32_t mndStart(SMnode *pMnode) {
|
|||
}
|
||||
mndSetRestore(pMnode, true);
|
||||
}
|
||||
|
||||
grantReset(pMnode, TSDB_GRANT_ALL, 0);
|
||||
|
||||
return mndInitTimer(pMnode);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue