mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-02 00:45:30 +08:00
Fix 2495: Add more reason of creating lock file failed (#2496)
* Fix 2495: Add more reason of creating lock file failed Signed-off-by: jinhai <hai.jin@zilliz.com> * Fix 2495: Update changelog Signed-off-by: jinhai <hai.jin@zilliz.com> * Fix lint Signed-off-by: jinhai <hai.jin@zilliz.com> * Fix lint Signed-off-by: JinHai-CN <hai.jin@zilliz.com> * Fix compile error Signed-off-by: JinHai-CN <hai.jin@zilliz.com>
This commit is contained in:
parent
167743c993
commit
4b5eff3672
@ -16,6 +16,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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user