fix: retry 12 seconds if lock file failed

This commit is contained in:
Shengliang Guan 2022-06-23 16:35:05 +08:00
parent 725baf4a7c
commit ef00464f9c
2 changed files with 13 additions and 4 deletions

View File

@ -127,14 +127,24 @@ TdFilePtr dmCheckRunning(const char *dataDir) {
return NULL;
}
int32_t ret = taosLockFile(pFile);
if (ret != 0) {
int32_t retryTimes = 0;
int32_t ret = 0;
do {
ret = taosLockFile(pFile);
if (ret == 0) break;
terrno = TAOS_SYSTEM_ERROR(errno);
taosMsleep(100);
retryTimes++;
dError("failed to lock file:%s since %s, retryTimes:%d", filepath, terrstr(), retryTimes);
} while (retryTimes < 120);
if (ret < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
dError("failed to lock file:%s since %s", filepath, terrstr());
taosCloseFile(&pFile);
return NULL;
}
terrno = 0;
dDebug("lock file:%s to prevent repeated starts", filepath);
return pFile;
}

View File

@ -233,7 +233,6 @@ if $data(1)[3] != dropping then
endi
print =============== step9: start mnode1 and wait it dropped
sleep 3000
system sh/exec.sh -n dnode1 -s start
$x = 0