enh: fetch cluster info for grant periodically
This commit is contained in:
parent
0a099eb6a9
commit
53ed71959b
|
@ -198,6 +198,7 @@ extern int32_t tsTtlPushIntervalSec;
|
|||
extern int32_t tsTtlBatchDropNum;
|
||||
extern int32_t tsTrimVDbIntervalSec;
|
||||
extern int32_t tsGrantHBInterval;
|
||||
extern int32_t tsGrantFetchInterval;
|
||||
extern int32_t tsUptimeInterval;
|
||||
|
||||
extern int32_t tsRpcRetryLimit;
|
||||
|
|
|
@ -177,6 +177,7 @@ enum { // WARN: new msg should be appended to segment tail
|
|||
TD_DEF_MSG_TYPE(TDMT_MND_UPTIME_TIMER, "uptime-timer", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_LOST_CONSUMER_CLEAR, "lost-consumer-clear", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_STREAM_HEARTBEAT, "stream-heartbeat", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_GRANT_FETCH_TIMER, "grant-fetch-tmr", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL)
|
||||
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_BALANCE_VGROUP_LEADER, "balance-vgroup-leader", NULL, NULL)
|
||||
|
|
|
@ -247,6 +247,7 @@ int32_t tsTtlUnit = 86400;
|
|||
int32_t tsTtlPushIntervalSec = 10;
|
||||
int32_t tsTrimVDbIntervalSec = 60 * 60; // interval of trimming db in all vgroups
|
||||
int32_t tsGrantHBInterval = 60;
|
||||
int32_t tsGrantFetchInterval = 2;
|
||||
int32_t tsUptimeInterval = 300; // seconds
|
||||
char tsUdfdResFuncs[512] = ""; // udfd resident funcs that teardown when udfd exits
|
||||
char tsUdfdLdLibPath[512] = "";
|
||||
|
|
|
@ -117,10 +117,12 @@ static int32_t mndRetrieveGrant(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
|||
}
|
||||
|
||||
static int32_t mndProcessGrantHB(SRpcMsg *pReq) { return TSDB_CODE_SUCCESS; }
|
||||
static int32_t mndProcessGrantFetch(SRpcMsg *pReq) { return TSDB_CODE_SUCCESS; }
|
||||
|
||||
int32_t mndInitGrant(SMnode *pMnode) {
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_GRANTS, mndRetrieveGrant);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_GRANT_HB_TIMER, mndProcessGrantHB);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_GRANT_FETCH_TIMER, mndProcessGrantFetch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -175,6 +175,17 @@ static void mndPullupGrant(SMnode *pMnode) {
|
|||
}
|
||||
}
|
||||
|
||||
static void mndFetchGrant(SMnode *pMnode) {
|
||||
mTrace("fetch grant msg");
|
||||
int32_t contLen = 0;
|
||||
void *pReq = mndBuildTimerMsg(&contLen);
|
||||
if (pReq != NULL) {
|
||||
SRpcMsg rpcMsg = {
|
||||
.msgType = TDMT_MND_GRANT_FETCH_TIMER, .pCont = pReq, .contLen = contLen, .info.ahandle = (void *)0x9529};
|
||||
tmsgPutToQueue(&pMnode->msgCb, READ_QUEUE, &rpcMsg);
|
||||
}
|
||||
}
|
||||
|
||||
static void mndIncreaseUpTime(SMnode *pMnode) {
|
||||
mTrace("increate uptime");
|
||||
int32_t contLen = 0;
|
||||
|
@ -293,6 +304,10 @@ static void *mndThreadFp(void *param) {
|
|||
mndPullupTelem(pMnode);
|
||||
}
|
||||
|
||||
if (sec % tsGrantFetchInterval == 0) {
|
||||
mndFetchGrant(pMnode);
|
||||
}
|
||||
|
||||
if (sec % tsGrantHBInterval == 0) {
|
||||
mndPullupGrant(pMnode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue