refactor backend

This commit is contained in:
Yihao Deng 2024-07-05 06:51:13 +00:00
parent 52a8082622
commit 4ac897be44
2 changed files with 4 additions and 3 deletions

View File

@ -762,8 +762,8 @@ int32_t restoreCheckpointData(const char* path, const char* key, int64_t chkptId
} }
if (code != 0) { if (code != 0) {
stError("failed to start stream backend at %s, reason: %s, restart from default defaultPath:%s, reason:%s", stError("failed to start stream backend at %s, restart from default defaultPath:%s, reason:%s", checkpointPath,
checkpointPath, tstrerror(code), defaultPath, tstrerror(code)); defaultPath, tstrerror(code));
code = 0; // reset the error code code = 0; // reset the error code
} }
} else { // no valid checkpoint id } else { // no valid checkpoint id
@ -2528,6 +2528,7 @@ STaskDbWrapper* taskDbOpen(const char* path, const char* key, int64_t chkptId, i
char* statePath = NULL; char* statePath = NULL;
char* dbPath = NULL; char* dbPath = NULL;
int code = 0; int code = 0;
terrno = 0;
if ((code = restoreCheckpointData(path, key, chkptId, &statePath, &dbPath, processVer)) < 0) { if ((code = restoreCheckpointData(path, key, chkptId, &statePath, &dbPath, processVer)) < 0) {
terrno = code; terrno = code;
stError("failed to restore checkpoint data, path:%s, key:%s, checkpointId: %" PRId64 "reason:%s", path, key, stError("failed to restore checkpoint data, path:%s, key:%s, checkpointId: %" PRId64 "reason:%s", path, key,

View File

@ -182,7 +182,7 @@ int32_t streamMetaCheckBackendCompatible(SStreamMeta* pMeta) {
int32_t streamMetaCvtDbFormat(SStreamMeta* pMeta) { int32_t streamMetaCvtDbFormat(SStreamMeta* pMeta) {
int32_t code = 0; int32_t code = 0;
int64_t chkpId = streamMetaGetLatestCheckpointId(pMeta); int64_t chkpId = streamMetaGetLatestCheckpointId(pMeta);
terrno = 0;
bool exist = streamBackendDataIsExist(pMeta->path, chkpId); bool exist = streamBackendDataIsExist(pMeta->path, chkpId);
if (exist == false) { if (exist == false) {
if (terrno != 0) { if (terrno != 0) {