add self check

This commit is contained in:
Yihao Deng 2024-06-27 01:48:59 +00:00
parent 0a35d7ef6b
commit f2fc09cd02
2 changed files with 8 additions and 2 deletions

View File

@ -615,6 +615,10 @@ _EXIT:
bool streamBackendDataIsExist(const char* path, int64_t chkpId, int32_t vgId) {
bool exist = true;
char* state = taosMemoryCalloc(1, strlen(path) + 32);
if (state == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return false;
}
sprintf(state, "%s%s%s", path, TD_DIRSEP, "state");
if (!taosDirExist(state)) {
exist = false;

View File

@ -195,7 +195,8 @@ int32_t streamMetaCvtDbFormat(SStreamMeta* pMeta) {
bool exist = streamBackendDataIsExist(pMeta->path, chkpId, pMeta->vgId);
if (exist == false) {
return code;
stError("failed to check backend data exist, reason:%s", tstrerror(terrno));
return -1;
}
SBackendWrapper* pBackend = streamBackendInit(pMeta->path, chkpId, pMeta->vgId);
@ -319,7 +320,8 @@ SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTas
}
if (streamMetaMayCvtDbFormat(pMeta) < 0) {
stError("vgId:%d convert sub info format failed, open stream meta failed", pMeta->vgId);
stError("vgId:%d convert sub info format failed, open stream meta failed, reason: %s", pMeta->vgId,
tstrerror(terrno));
goto _err;
}