Skip to content

Commit

Permalink
Doc: FAQ: use Unreachable to alleviate error log flooding
Browse files Browse the repository at this point in the history
  • Loading branch information
drmingdrmer committed Dec 15, 2023
1 parent 54b4825 commit ca55cef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openraft/src/docs/faq/faq-toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* [What are the differences between Openraft and standard Raft?](#what-are-the-differences-between-openraft-and-standard-raft)
- [Data structure](#data-structure)
* [Why is log id a tuple of `(term, node_id, log_index)`?](#why-is-log-id-a-tuple-of-term-node_id-log_index)
- [Replication](#replication)
* [How to minimize error logging when a follower is offline](#how-to-minimize-error-logging-when-a-follower-is-offline)
- [Cluster management](#cluster-management)
* [How to initialize a cluster?](#how-to-initialize-a-cluster)
* [Are there any issues with running a single node service?](#are-there-any-issues-with-running-a-single-node-service)
Expand Down
14 changes: 14 additions & 0 deletions openraft/src/docs/faq/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ This way in every term there could be more than one leaders elected, and the las
See: [`leader-id`](`crate::docs::data::leader_id`) for details.


## Replication


### How to minimize error logging when a follower is offline

Excessive error logging, like `ERROR openraft::replication: 248: RPCError err=NetworkError: ...`, occurs when a follower node becomes unresponsive. To alleviate this, implement a mechanism within [`RaftNetwork`][] that returns a [`Unreachable`][] error instead of a [`NetworkError`][] when immediate replication retries to the affected node are not advised.


## Cluster management

Expand Down Expand Up @@ -137,7 +144,14 @@ pub(crate) fn following_handler(&mut self) -> FollowingHandler<C> {

[`RaftLogStorage::save_committed()`]: `crate::storage::RaftLogStorage::save_committed`

[`RaftNetwork`]: `crate::network::RaftNetwork`

[`add_learner()`]: `crate::Raft::add_learner`
[`change_membership()`]: `crate::Raft::change_membership`

[`Membership`]: `crate::Membership`

[`Unreachable`]: `crate::error::Unreachable`
[`NetworkError`]: `crate::error::NetworkError`


0 comments on commit ca55cef

Please sign in to comment.