#6156·nebula

Raft 发送心跳

作者: zhangshxiang创建于 2026年6月29日更新于 2026年6月29日
标签type/bugseverity/noneaffects/none

RaftPart::sendHeartbeat() { // If the leader has not committed any logs in this term, it must commit all logs in the previous term, so the heartbeat is sent by appending an empty log. if (!replicatingLogs_.load(std::memory_order_acquire)) { folly::via(executor_.get(), [this] { std::string log = ""; appendLogAsync(clusterId_, LogType::NORMAL, std::move(log)); }); } I think we should add a check for commitInThisTerm_, after the leader is elected, it should only append one no-op, even if the write rate is low or there is a long period of no writing, it should not keep writing empty logs. There is no problem, but it is not necessary.

内容来源: vesoft-inc/nebula