From 63e4e4c60fc3c639c6e0b8958ff6822a03d44b18 Mon Sep 17 00:00:00 2001 From: liuyu <52276794+liuyu85cn@users.noreply.github.com> Date: Thu, 11 Nov 2021 16:53:23 +0800 Subject: [PATCH 1/2] fix a bug may stuck --- .../transaction/ChainAddEdgesProcessorLocal.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/storage/transaction/ChainAddEdgesProcessorLocal.cpp b/src/storage/transaction/ChainAddEdgesProcessorLocal.cpp index 9d12904535d..0b4b56d53c3 100644 --- a/src/storage/transaction/ChainAddEdgesProcessorLocal.cpp +++ b/src/storage/transaction/ChainAddEdgesProcessorLocal.cpp @@ -172,8 +172,14 @@ folly::SemiFuture ChainAddEdgesProcessorLocal::forwardToDelegateProcessor( }; auto futProc = proc->getFuture(); auto [pro, fut] = folly::makePromiseContract(); - std::move(futProc).thenValue([&, p = std::move(pro)](auto&& resp) mutable { - auto rc = extractRpcError(resp); + std::move(futProc).thenTry([&, p = std::move(pro)](auto&& t) mutable { + auto rc = Code::SUCCEEDED; + if (!t.hasException()) { + LOG(INFO) << "catch ex: " << t.exception().what(); + rc = Code::E_UNKNOWN; + } + auto& resp = t.value(); + rc = extractRpcError(resp); if (rc == Code::SUCCEEDED) { if (FLAGS_trace_toss) { for (auto& k : kvErased_) { From 4fbd6b80e6398c19e3da3ec6d7e45832d7c17c97 Mon Sep 17 00:00:00 2001 From: liuyu <52276794+liuyu85cn@users.noreply.github.com> Date: Thu, 11 Nov 2021 17:08:43 +0800 Subject: [PATCH 2/2] update --- .../ChainAddEdgesProcessorLocal.cpp | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/storage/transaction/ChainAddEdgesProcessorLocal.cpp b/src/storage/transaction/ChainAddEdgesProcessorLocal.cpp index 0b4b56d53c3..8587d5021b8 100644 --- a/src/storage/transaction/ChainAddEdgesProcessorLocal.cpp +++ b/src/storage/transaction/ChainAddEdgesProcessorLocal.cpp @@ -174,22 +174,23 @@ folly::SemiFuture ChainAddEdgesProcessorLocal::forwardToDelegateProcessor( auto [pro, fut] = folly::makePromiseContract(); std::move(futProc).thenTry([&, p = std::move(pro)](auto&& t) mutable { auto rc = Code::SUCCEEDED; - if (!t.hasException()) { + if (t.hasException()) { LOG(INFO) << "catch ex: " << t.exception().what(); rc = Code::E_UNKNOWN; - } - auto& resp = t.value(); - rc = extractRpcError(resp); - if (rc == Code::SUCCEEDED) { - if (FLAGS_trace_toss) { - for (auto& k : kvErased_) { - VLOG(1) << uuid_ << " erase prime " << folly::hexlify(k); + } else { + auto& resp = t.value(); + rc = extractRpcError(resp); + if (rc == Code::SUCCEEDED) { + if (FLAGS_trace_toss) { + for (auto& k : kvErased_) { + VLOG(1) << uuid_ << " erase prime " << folly::hexlify(k); + } } + } else { + VLOG(1) << uuid_ << " forwardToDelegateProcessor(), code = " + << apache::thrift::util::enumNameSafe(rc); + addUnfinishedEdge(ResumeType::RESUME_CHAIN); } - } else { - VLOG(1) << uuid_ - << " forwardToDelegateProcessor(), code = " << apache::thrift::util::enumNameSafe(rc); - addUnfinishedEdge(ResumeType::RESUME_CHAIN); } p.setValue(rc); });