Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some issue of Optimize the write performance when host is down #5673

Merged
merged 13 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/kvstore/raftex/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,12 @@ folly::Future<cpp2::HeartbeatResponse> Host::sendHeartbeat(
if (t.hasException()) {
using TransportException = apache::thrift::transport::TTransportException;
auto exWrapper = std::move(t).exception();
VLOG(2) << self->idStr_ << "Heartbeat: " << exWrapper.what();
auto exception = exWrapper.get_exception<TransportException>();
VLOG(2) << self->idStr_ << "Heartbeat: " << exception->what();
// If we keeps receiving NOT_OPEN exception after some HB intervals,
// If we keeps receiving NOT_OPEN and TIMED_OUT exception after some HB intervals,
// we can assume that the peer is down so we mark paused_ as true
if (exception && exception->getType() == TransportException::NOT_OPEN) {
if (exception && (exception->getType() == TransportException::NOT_OPEN ||
exception->getType() == TransportException::TIMED_OUT)) {
if (!self->paused_) {
auto now = time::WallClock::fastNowInMilliSec();
if (now - self->lastHeartbeatTime_ >=
Expand Down
1 change: 1 addition & 0 deletions src/kvstore/raftex/Host.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class Host final : public std::enable_shared_from_this<Host> {
committedLogId_ = 0;
sendingSnapshot_ = false;
followerCommittedLogId_ = 0;
lastHeartbeatTime_ = 0;
}

/**
Expand Down
Loading