提交 ef00464f 编写于 作者: S Shengliang Guan

fix: retry 12 seconds if lock file failed

上级 725baf4a
...@@ -127,14 +127,24 @@ TdFilePtr dmCheckRunning(const char *dataDir) { ...@@ -127,14 +127,24 @@ TdFilePtr dmCheckRunning(const char *dataDir) {
return NULL; return NULL;
} }
int32_t ret = taosLockFile(pFile); int32_t retryTimes = 0;
if (ret != 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); terrno = TAOS_SYSTEM_ERROR(errno);
dError("failed to lock file:%s since %s", filepath, terrstr());
taosCloseFile(&pFile); taosCloseFile(&pFile);
return NULL; return NULL;
} }
terrno = 0;
dDebug("lock file:%s to prevent repeated starts", filepath); dDebug("lock file:%s to prevent repeated starts", filepath);
return pFile; return pFile;
} }
......
...@@ -233,7 +233,6 @@ if $data(1)[3] != dropping then ...@@ -233,7 +233,6 @@ if $data(1)[3] != dropping then
endi endi
print =============== step9: start mnode1 and wait it dropped print =============== step9: start mnode1 and wait it dropped
sleep 3000
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
$x = 0 $x = 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册