diff --git a/api.go b/api.go index 66107da2d..e024e58ba 100644 --- a/api.go +++ b/api.go @@ -642,7 +642,9 @@ func (r *Raft) config() Config { return r.conf.Load().(Config) } -// ReloadConfig updates the configuration of a running raft node. +// ReloadConfig updates the configuration of a running raft node. If the new +// configuration is invalid an error is returned and no changes made to the +// instance. func (r *Raft) ReloadConfig(rc *ReloadableConfig) error { r.confReloadMu.Lock() defer r.confReloadMu.Unlock() diff --git a/config.go b/config.go index 637b4def9..d0b6a5cf0 100644 --- a/config.go +++ b/config.go @@ -167,17 +167,20 @@ type Config struct { // TrailingLogs controls how many logs we leave after a snapshot. This is used // so that we can quickly replay logs on a follower instead of being forced to // send an entire snapshot. The value passed here is the initial setting used. - // This can be tuned during operation using + // This can be tuned during operation using ReloadConfig. TrailingLogs uint64 - // SnapshotInterval controls how often we check if we should perform a snapshot. - // We randomly stagger between this value and 2x this value to avoid the entire - // cluster from performing a snapshot at once. + // SnapshotInterval controls how often we check if we should perform a + // snapshot. We randomly stagger between this value and 2x this value to avoid + // the entire cluster from performing a snapshot at once. The value passed + // here is the initial setting used. This can be tuned during operation using + // ReloadConfig. SnapshotInterval time.Duration // SnapshotThreshold controls how many outstanding logs there must be before // we perform a snapshot. This is to prevent excessive snapshots when we can - // just replay a small set of logs. + // just replay a small set of logs. The value passed here is the initial + // setting used. This can be tuned during operation using ReloadConfig. SnapshotThreshold uint64 // LeaderLeaseTimeout is used to control how long the "lease" lasts