You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tablet replicas set could be changed in concurrent thread between GetRemoteTabletServers and MarkTServerAsLeader calls in TabletInvoker::SelectTabletServer:
if (!current_ts_) {
// Try to "guess" the next leader.
vector<RemoteTabletServer*> replicas;
tablet_->GetRemoteTabletServers(&replicas);
for (RemoteTabletServer* ts : replicas) {
if (!ContainsKey(followers_, ts)) {
current_ts_ = ts;
break;
}
}
if (current_ts_) {
// Mark this next replica "preemptively" as the leader in the meta cache,
// so we go to it first on the next write if writing was successful.
VLOG(1) << "Tablet " << tablet_id_ << ": Previous leader failed. "
<< "Preemptively marking tserver " << current_ts_->ToString()
<< " as leader in the meta cache.";
tablet_->MarkTServerAsLeader(current_ts_);
}
}
This will cause DCHECK in MarkTServerAsLeader to crash with FATAL in debug build:
void RemoteTablet::MarkTServerAsLeader(const RemoteTabletServer* server) {
bool found = false;
std::lock_guard<simple_spinlock> l(lock_);
for (RemoteReplica& replica : replicas_) {
if (replica.ts == server) {
replica.role = RaftPeerPB::LEADER;
found = true;
} else if (replica.role == RaftPeerPB::LEADER) {
replica.role = RaftPeerPB::FOLLOWER;
}
}
VLOG(3) << "Latest replicas: " << ReplicasAsStringUnlocked();
DCHECK(found) << "Tablet " << tablet_id_ << ": Specified server not found: "
<< server->ToString() << ". Replicas: " << ReplicasAsStringUnlocked();
}
The text was updated successfully, but these errors were encountered:
Summary:
Tablet replicas set could be changed in a concurrent thread between `GetRemoteTabletServers`
and `MarkTServerAsLeader` calls in `TabletInvoker::SelectTabletServer`. This will cause `DCHECK` in
`MarkTServerAsLeader` to crash with FATAL in debug build.
Test Plan: Added `TabletRpcTest` to catch the fixed bug.
Reviewers: mikhail, sergei
Reviewed By: sergei
Subscribers: ybase
Differential Revision: https://phabricator.dev.yugabyte.com/D6304
Tablet replicas set could be changed in concurrent thread between
GetRemoteTabletServers
andMarkTServerAsLeader
calls inTabletInvoker::SelectTabletServer
:This will cause
DCHECK
inMarkTServerAsLeader
to crash withFATAL
in debug build:The text was updated successfully, but these errors were encountered: