提交 16b2d793 编写于 作者: C Cary Xu

refactor: rsma restore

上级 e2ec8b57
......@@ -217,7 +217,7 @@ static void tdDestroyRSmaStat(SRSmaStat *pStat) {
}
}
// step 6: free the timer handle
// step 6: cleanup the timer handle
if (RSMA_TMR_HANDLE(pStat)) {
taosTmrCleanUp(RSMA_TMR_HANDLE(pStat));
}
......
......@@ -18,7 +18,7 @@
static int32_t smaEvalDays(SRetention *r, int8_t precision);
static int32_t smaSetKeepCfg(STsdbKeepCfg *pKeepCfg, STsdbCfg *pCfg, int type);
static int32_t smaRestore(SSma *pSma);
static int32_t rsmaRestore(SSma *pSma);
#define SMA_SET_KEEP_CFG(l) \
do { \
......@@ -101,6 +101,9 @@ int32_t smaOpen(SVnode *pVnode) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
}
pVnode->pSma = pSma;
pSma->pVnode = pVnode;
taosThreadMutexInit(&pSma->mutex, NULL);
pSma->locked = false;
......@@ -118,14 +121,12 @@ int32_t smaOpen(SVnode *pVnode) {
ASSERT(0);
}
}
}
pVnode->pSma = pSma;
// restore the sma
if (smaRestore(pSma) < 0) {
// restore the rsma
if (rsmaRestore(pSma) < 0) {
goto _err;
}
}
return 0;
_err:
......@@ -164,7 +165,9 @@ int32_t smaClose(SSma *pSma) {
* @param pSma
* @return int32_t
*/
static int32_t smaRestore(SSma *pSma) {
static int32_t rsmaRestore(SSma *pSma) {
ASSERT(VND_IS_RSMA(pSma->pVnode));
// iterate all stables to restore the rsma env
SArray *suidList = taosArrayInit(1, sizeof(tb_uid_t));
if (tsdbGetStbIdList(SMA_META(pSma), 0, suidList) < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册