From 0002773a494f2dc7a1c9b380693b76fc827a207f Mon Sep 17 00:00:00 2001 From: obdev Date: Mon, 12 Dec 2022 12:37:58 +0000 Subject: [PATCH] BUGFIX: break deadlock at rebuild and gc --- src/storage/ls/ob_ls.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/storage/ls/ob_ls.cpp b/src/storage/ls/ob_ls.cpp index 6c4eeb987..789bacdc6 100644 --- a/src/storage/ls/ob_ls.cpp +++ b/src/storage/ls/ob_ls.cpp @@ -1612,9 +1612,13 @@ int ObLS::set_ls_rebuild() int ret = OB_SUCCESS; int64_t read_lock = LSLOCKLS; int64_t write_lock = LSLOCKLOGMETA; - ObLSLockGuard lock_myself(lock_, read_lock, write_lock); + const bool try_lock = true; // the upper layer should deal with try lock fail. + ObLSLockGuard lock_myself(lock_, read_lock, write_lock, try_lock); - if (IS_NOT_INIT) { + if (!lock_myself.locked()) { + ret = OB_EAGAIN; + LOG_WARN("try lock failed, please retry later", K(ret), K(ls_meta_)); + } else if (IS_NOT_INIT) { ret = OB_NOT_INIT; STORAGE_LOG(WARN, "ls is not inited", K(ret), K(ls_meta_)); } else if (OB_UNLIKELY(is_stopped_)) {