Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lintanghui committed Feb 20, 2025
1 parent 727d213 commit 6d6662d
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 22 deletions.
4 changes: 0 additions & 4 deletions src/braft/fsm_caller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,6 @@ void FSMCaller::do_stop_following(const LeaderChangeContext& stop_following_cont
_fsm->on_stop_following(stop_following_context);
}

void FSMCaller::on_pre_send_snapshot(const PeerId& peer_id) {
_fsm->on_pre_send_snapshot(peer_id);
}

void FSMCaller::describe(std::ostream &os, bool use_html) {
const char* newline = (use_html) ? "<br>" : "\n";
TaskType cur_task = _cur_task;
Expand Down
1 change: 0 additions & 1 deletion src/braft/fsm_caller.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class BAIDU_CACHELINE_ALIGNMENT FSMCaller {
int on_leader_start(int64_t term, int64_t lease_epoch);
int on_start_following(const LeaderChangeContext& start_following_context);
int on_stop_following(const LeaderChangeContext& stop_following_context);
void on_pre_send_snapshot(const PeerId& peer_id);
BRAFT_MOCK int on_error(const Error& e);
int64_t last_applied_index() const {
return _last_applied_index.load(butil::memory_order_relaxed);
Expand Down
5 changes: 0 additions & 5 deletions src/braft/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1367,11 +1367,6 @@ void NodeImpl::on_error(const Error& e) {
lck.unlock();
}

void NodeImpl::pre_send_snapshot(const PeerId& peer_id) {
_fsm_caller->on_pre_send_snapshot(peer_id);
}


void NodeImpl::handle_vote_timeout() {
std::unique_lock<raft_mutex_t> lck(_mutex);

Expand Down
3 changes: 0 additions & 3 deletions src/braft/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ friend class VoteBallotCtx;

bool disable_cli() const { return _options.disable_cli; }
bool is_witness() const { return _options.witness; }

// Called when leader start to send snapshot to remote peer
void pre_send_snapshot(const PeerId& peer_id);
private:
friend class butil::RefCountedThreadSafe<NodeImpl>;

Expand Down
1 change: 0 additions & 1 deletion src/braft/raft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ void StateMachine::on_configuration_committed(const Configuration& conf, int64_t

void StateMachine::on_stop_following(const LeaderChangeContext&) {}
void StateMachine::on_start_following(const LeaderChangeContext&) {}
void StateMachine::on_pre_send_snapshot(const PeerId& peer_id) {}

BootstrapOptions::BootstrapOptions()
: last_log_index(0)
Expand Down
5 changes: 0 additions & 5 deletions src/braft/raft.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,6 @@ class StateMachine {
// the very leader whom the follower starts to follow.
// User can reset the node's information as it starts to follow some leader.
virtual void on_start_following(const ::braft::LeaderChangeContext& ctx);

// Invoked when the leader start to send snapshot to |peer_id|
// Default: Do nothing
virtual void on_pre_send_snapshot(const PeerId& peer_id);

};

enum State {
Expand Down
4 changes: 1 addition & 3 deletions src/braft/replicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ int Replicator::_prepare_entry(int offset, EntryMeta* em, butil::IOBuf *data) {
} else {
CHECK(entry->type != ENTRY_TYPE_CONFIGURATION) << "log_index=" << log_index;
}
// 优先使用group级别的配置
// use group-level configuration preferentially
if (is_witness() && !_options.send_data_to_witness) {
entry->Release();
return 0;
Expand Down Expand Up @@ -800,8 +800,6 @@ void Replicator::_install_snapshot() {
add_one_more_task(true)) {
return _block(butil::gettimeofday_us(), EBUSY);
}

node_impl->pre_send_snapshot(_options.peer_id);

// pre-set replicator state to INSTALLING_SNAPSHOT, so replicator could be
// blocked if something is wrong, such as throttled for a period of time
Expand Down

0 comments on commit 6d6662d

Please sign in to comment.