提交 63ae6199 编写于 作者: J Jin Hai 提交者: JinHai-CN

Fix 2495: Add more reason of creating lock file failed (#2496)

* Fix 2495: Add more reason of creating lock file failed
Signed-off-by: Njinhai <hai.jin@zilliz.com>

* Fix 2495: Update changelog
Signed-off-by: Njinhai <hai.jin@zilliz.com>

* Fix lint
Signed-off-by: Njinhai <hai.jin@zilliz.com>

* Fix lint
Signed-off-by: NJinHai-CN <hai.jin@zilliz.com>

* Fix compile error
Signed-off-by: NJinHai-CN <hai.jin@zilliz.com>
上级 2decf951
......@@ -28,6 +28,7 @@ Please mark all change in change log and use the issue from GitHub
- \#2381 Upgrade FAISS to 1.6.3
- \#2441 Improve Knowhere code coverage
- \#2466 optimize k-selection implemention of faiss gpu version
- \#2495 Add creating lock file failure reason.
## Task
......
......@@ -14,6 +14,7 @@
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
namespace milvus {
......@@ -29,7 +30,7 @@ InstanceLockCheck::Check(const std::string& path) {
// Not using locking for read-only lock file
msg += "Lock file is read-only.";
}
msg += "Could not open lock file.";
msg += "Could not open file: " + lock_path + ", " + strerror(errno);
return Status(SERVER_UNEXPECTED_ERROR, msg);
}
......@@ -41,15 +42,16 @@ InstanceLockCheck::Check(const std::string& path) {
fl.l_start = 0;
fl.l_len = 0;
if (fcntl(fd, F_SETLK, &fl) == -1) {
std::string msg;
std::string msg = "Can't lock file: " + lock_path + ", due to ";
if (errno == EACCES || errno == EAGAIN) {
msg += "Permission denied. ";
msg += "permission denied. ";
} else if (errno == ENOLCK) {
// Not using locking for nfs mounted lock file
msg += "Using nfs. ";
msg += "using nfs. ";
} else {
msg += std::string(strerror(errno)) + ". ";
}
close(fd);
msg += "Could not get lock.";
return Status(SERVER_UNEXPECTED_ERROR, msg);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册