enh: rsma fs restore procedure optimization
This commit is contained in:
parent
18c3f19b6b
commit
54562e2426
|
@ -34,6 +34,8 @@ int32_t tdRSmaFSOpen(SSma *pSma, int64_t version) {
|
||||||
SRSmaStat *pStat = NULL;
|
SRSmaStat *pStat = NULL;
|
||||||
SArray *output = NULL;
|
SArray *output = NULL;
|
||||||
|
|
||||||
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
if (!pEnv) {
|
if (!pEnv) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +64,7 @@ _end:
|
||||||
}
|
}
|
||||||
taosArrayDestroy(output);
|
taosArrayDestroy(output);
|
||||||
|
|
||||||
if (terrno != 0) {
|
if (terrno != TSDB_CODE_SUCCESS) {
|
||||||
smaError("vgId:%d, open rsma fs failed since %s", TD_VID(pVnode), terrstr());
|
smaError("vgId:%d, open rsma fs failed since %s", TD_VID(pVnode), terrstr());
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -138,6 +140,11 @@ static int32_t tdFetchQTaskInfoFiles(SSma *pSma, int64_t version, SArray **outpu
|
||||||
|
|
||||||
tdGetVndDirName(TD_VID(pVnode), tfsGetPrimaryPath(pVnode->pTfs), VNODE_RSMA_DIR, true, dir);
|
tdGetVndDirName(TD_VID(pVnode), tfsGetPrimaryPath(pVnode->pTfs), VNODE_RSMA_DIR, true, dir);
|
||||||
|
|
||||||
|
if (!taosCheckExistFile(dir)) {
|
||||||
|
smaDebug("vgId:%d, fetch qtask files, no need as dir %s not exist", TD_VID(pVnode), dir);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// Resource allocation and init
|
// Resource allocation and init
|
||||||
if ((code = regcomp(®ex, pattern, REG_EXTENDED)) != 0) {
|
if ((code = regcomp(®ex, pattern, REG_EXTENDED)) != 0) {
|
||||||
terrno = TSDB_CODE_RSMA_REGEX_MATCH;
|
terrno = TSDB_CODE_RSMA_REGEX_MATCH;
|
||||||
|
@ -150,7 +157,7 @@ static int32_t tdFetchQTaskInfoFiles(SSma *pSma, int64_t version, SArray **outpu
|
||||||
if (!(pDir = taosOpenDir(dir))) {
|
if (!(pDir = taosOpenDir(dir))) {
|
||||||
regfree(®ex);
|
regfree(®ex);
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
smaDebug("vgId:%d, fetch qtask files, open dir %s failed since %s", TD_VID(pVnode), dir, terrstr());
|
smaError("vgId:%d, fetch qtask files, open dir %s failed since %s", TD_VID(pVnode), dir, terrstr());
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1635,7 +1635,7 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) {
|
||||||
atomic_val_compare_exchange_8(&pItem->triggerStat, TASK_TRIGGER_STAT_ACTIVE, TASK_TRIGGER_STAT_INACTIVE);
|
atomic_val_compare_exchange_8(&pItem->triggerStat, TASK_TRIGGER_STAT_ACTIVE, TASK_TRIGGER_STAT_INACTIVE);
|
||||||
switch (fetchTriggerStat) {
|
switch (fetchTriggerStat) {
|
||||||
case TASK_TRIGGER_STAT_ACTIVE: {
|
case TASK_TRIGGER_STAT_ACTIVE: {
|
||||||
smaInfo("vgId:%d, rsma fetch task planned for level:%" PRIi8 " suid:%" PRIi64 " since stat is active",
|
smaDebug("vgId:%d, rsma fetch task planned for level:%" PRIi8 " suid:%" PRIi64 " since stat is active",
|
||||||
SMA_VID(pSma), pItem->level, pRSmaInfo->suid);
|
SMA_VID(pSma), pItem->level, pRSmaInfo->suid);
|
||||||
// async process
|
// async process
|
||||||
pItem->fetchLevel = pItem->level;
|
pItem->fetchLevel = pItem->level;
|
||||||
|
@ -1704,7 +1704,7 @@ static int32_t tdRSmaFetchAllResult(SSma *pSma, SRSmaInfo *pInfo) {
|
||||||
SMA_VID(pSma), pInfo->suid, i, pItem->nSkipped, pItem->maxDelay);
|
SMA_VID(pSma), pInfo->suid, i, pItem->nSkipped, pItem->maxDelay);
|
||||||
} else if (((curMs - pInfo->lastRecv) < RSMA_FETCH_ACTIVE_MAX)) {
|
} else if (((curMs - pInfo->lastRecv) < RSMA_FETCH_ACTIVE_MAX)) {
|
||||||
++pItem->nSkipped;
|
++pItem->nSkipped;
|
||||||
smaInfo("vgId:%d, suid:%" PRIi64 " level:%" PRIi8 " curMs:%" PRIi64 " lastRecv:%" PRIi64 ", fetch skipped ",
|
smaDebug("vgId:%d, suid:%" PRIi64 " level:%" PRIi8 " curMs:%" PRIi64 " lastRecv:%" PRIi64 ", fetch skipped ",
|
||||||
SMA_VID(pSma), pInfo->suid, i, curMs, pInfo->lastRecv);
|
SMA_VID(pSma), pInfo->suid, i, curMs, pInfo->lastRecv);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue