Skip to content

Commit 299de8a

Browse files
committed
Fix typos in docs, comments, and tests
1 parent 341ea38 commit 299de8a

13 files changed

+27
-27
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ CHANGES
88

99
go-msgpack v2.1.1 is by default binary compatible with v0.5.5 ("non-builtin" encoding of `time.Time`), but can decode messages produced by v1.1.5 as well ("builtin" encoding of `time.Time`).
1010

11-
However, if users of this libary overrode the version of go-msgpack (especially to v1), this **could break** compatibility if raft nodes are running a mix of versions.
11+
However, if users of this library overrode the version of go-msgpack (especially to v1), this **could break** compatibility if raft nodes are running a mix of versions.
1212

1313
This compatibility can be configured at runtime in Raft using `NetworkTransportConfig.MsgpackUseNewTimeFormat` -- the default is `false`, which maintains compatibility with `go-msgpack` v0.5.5, but if set to `true`, will be compatible with `go-msgpack` v1.1.5.
1414

api.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var (
5959
ErrEnqueueTimeout = errors.New("timed out enqueuing operation")
6060

6161
// ErrNothingNewToSnapshot is returned when trying to create a snapshot
62-
// but there's nothing new commited to the FSM since we started.
62+
// but there's nothing new committed to the FSM since we started.
6363
ErrNothingNewToSnapshot = errors.New("nothing new to snapshot")
6464

6565
// ErrUnsupportedProtocol is returned when an operation is attempted
@@ -1090,12 +1090,12 @@ func (r *Raft) State() RaftState {
10901090
// lose it.
10911091
//
10921092
// Receivers can expect to receive a notification only if leadership
1093-
// transition has occured.
1093+
// transition has occurred.
10941094
//
10951095
// If receivers aren't ready for the signal, signals may drop and only the
10961096
// latest leadership transition. For example, if a receiver receives subsequent
10971097
// `true` values, they may deduce that leadership was lost and regained while
1098-
// the the receiver was processing first leadership transition.
1098+
// the receiver was processing first leadership transition.
10991099
func (r *Raft) LeaderCh() <-chan bool {
11001100
return r.leaderCh
11011101
}

bench/bench.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func StoreLogs(b *testing.B, store raft.LogStore) {
9999
func DeleteRange(b *testing.B, store raft.LogStore) {
100100
// Create some fake data. In this case, we create 3 new log entries for each
101101
// test case, and separate them by index in multiples of 10. This allows
102-
// some room so that we can test deleting ranges with "extra" logs to
102+
// some room so that we can test deleting ranges with "extra" logs
103103
// to ensure we stop going to the database once our max index is hit.
104104
var logs []*raft.Log
105105
for n := 0; n < b.N; n++ {

configuration.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func hasVote(configuration Configuration, id ServerID) bool {
180180
return false
181181
}
182182

183-
// inConfiguration returns true if the server identified by 'id' is in in the
183+
// inConfiguration returns true if the server identified by 'id' is in the
184184
// provided Configuration.
185185
func inConfiguration(configuration Configuration, id ServerID) bool {
186186
for _, server := range configuration.Servers {

docs/apply.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Raft Apply
22

33
Apply is the primary operation provided by raft. A client calls `raft.Apply` to apply
4-
a command to the FSM. A command will first be commited, i.e., durably stored on a
4+
a command to the FSM. A command will first be committed, i.e., durably stored on a
55
quorum of raft nodes. Then, the committed command is applied to fsm.
66

77
This sequence diagram shows the steps involved in a `raft.Apply` operation. Each box
@@ -63,7 +63,7 @@ leader's lastIndex). Another parameter to AppendEntries is the LeaderCommitIndex
6363
is some examples:
6464

6565
```
66-
AppenEntries(Log: 1..5, LeaderCommitIndex: 0) // Replicating log entries 1..5,
66+
AppendEntries(Log: 1..5, LeaderCommitIndex: 0) // Replicating log entries 1..5,
6767
// the leader hasn't committed any log entry;
6868
AppendEntries(Log: 6..8, LeaderCommitIndex: 4) // Replicating log entries 6..8,
6969
// log 0..4 are committed after the leader receives
@@ -92,7 +92,7 @@ Therefore, it's possible that a very small window of time exists when all follow
9292
committed the log to disk, the write has been realized in the FSM of the leader but the
9393
followers have not yet applied the log to their FSM.
9494

95-
7. The peer applies the commited entries to the FSM.
95+
7. The peer applies the committed entries to the FSM.
9696

9797
8. If all went well, the follower responds success (`resp.Success = true`) to the
9898
`appendEntries` RPC call.
@@ -108,9 +108,9 @@ grouping the entries that can be applied to the fsm.
108108

109109
11. `processLogs` applies all the committed entries that haven't been applied by batching the log entries and forwarding them through the `fsmMutateCh` channel to fsm.
110110

111-
12. The actual place applying the commited log entries is in the main loop of `runFSM()`.
111+
12. The actual place applying the committed log entries is in the main loop of `runFSM()`.
112112

113113
13. After the log entries that contains the client req are applied to the fsm, the fsm
114-
module will set the reponses to the client request (`req.future.respond(nil)`). From the
114+
module will set the responses to the client request (`req.future.respond(nil)`). From the
115115
client's point of view, the future returned by `raft.Apply` should now be unblocked and
116116
calls to `Error()` or `Response()` should return the data at this point.

fuzzy/cluster.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func (c *cluster) Stop(t *testing.T, maxWait time.Duration) {
184184
}
185185

186186
// WaitTilUptoDate blocks until all nodes in the cluster have gotten their
187-
// commitedIndex upto the Index from the last successful call to Apply
187+
// committedIndex upto the Index from the last successful call to Apply
188188
func (c *cluster) WaitTilUptoDate(t *testing.T, maxWait time.Duration) {
189189
idx := c.lastApplySuccess.Index()
190190
start := time.Now()

fuzzy/verifier.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (v *appendEntriesVerifier) PreAppendEntries(src, target string, req *raft.A
5858
if ldr != src {
5959
v.Lock()
6060
defer v.Unlock()
61-
v.errors = append(v.errors, fmt.Sprintf("Node %v sent an appendEnties request for term %d that said the leader was some other node %v", src, term, ldr))
61+
v.errors = append(v.errors, fmt.Sprintf("Node %v sent an appendEntries request for term %d that said the leader was some other node %v", src, term, ldr))
6262
}
6363
v.RLock()
6464
tl, exists := v.leaderForTerm[term]

log_cache.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func NewLogCache(capacity int, store LogStore) (*LogCache, error) {
3434
}
3535

3636
// IsMonotonic implements the MonotonicLogStore interface. This is a shim to
37-
// expose the underyling store as monotonically indexed or not.
37+
// expose the underlying store as monotonically indexed or not.
3838
func (c *LogCache) IsMonotonic() bool {
3939
if store, ok := c.store.(MonotonicLogStore); ok {
4040
return store.IsMonotonic()

net_transport_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ func TestNetworkTransport_AppendEntriesPipeline_MaxRPCsInFlight(t *testing.T) {
493493

494494
for i := 0; i < expectedMax-1; i++ {
495495
// We should be able to send `max - 1` rpcs before `AppendEntries`
496-
// blocks. It blocks on the `max` one because it it sends before pushing
496+
// blocks. It blocks on the `max` one because it sends before pushing
497497
// to the chan. It will block forever when it does because nothing is
498498
// responding yet.
499499
out := new(AppendEntriesResponse)

raft.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,9 @@ func (r *Raft) runCandidate() {
289289
voteCh := r.electSelf()
290290

291291
// Make sure the leadership transfer flag is reset after each run. Having this
292-
// flag will set the field LeadershipTransfer in a RequestVoteRequst to true,
292+
// flag will set the field LeadershipTransfer in a RequestVoteRequest to true,
293293
// which will make other servers vote even though they have a leader already.
294-
// It is important to reset that flag, because this priviledge could be abused
294+
// It is important to reset that flag, because this privilege could be abused
295295
// otherwise.
296296
defer func() { r.candidateFromLeadershipTransfer.Store(false) }()
297297

@@ -426,7 +426,7 @@ func (r *Raft) runLeader() {
426426

427427
// Store the notify chan. It's not reloadable so shouldn't change before the
428428
// defer below runs, but this makes sure we always notify the same chan if
429-
// ever for both gaining and loosing leadership.
429+
// ever for both gaining and losing leadership.
430430
notify := r.config().NotifyCh
431431

432432
// Push to the notify channel if given

raft_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ func TestRaft_AddKnownPeer(t *testing.T) {
907907
newConfig := configReq.configurations.committed
908908
newConfigIdx := configReq.configurations.committedIndex
909909
if newConfigIdx <= startingConfigIdx {
910-
t.Fatalf("AddVoter should have written a new config entry, but configurations.commitedIndex still %d", newConfigIdx)
910+
t.Fatalf("AddVoter should have written a new config entry, but configurations.committedIndex still %d", newConfigIdx)
911911
}
912912
if !reflect.DeepEqual(newConfig, startingConfig) {
913913
t.Fatalf("[ERR} AddVoter with existing peer shouldn't have changed config, was %#v, but now %#v", startingConfig, newConfig)
@@ -946,7 +946,7 @@ func TestRaft_RemoveUnknownPeer(t *testing.T) {
946946
newConfig := configReq.configurations.committed
947947
newConfigIdx := configReq.configurations.committedIndex
948948
if newConfigIdx <= startingConfigIdx {
949-
t.Fatalf("RemoveServer should have written a new config entry, but configurations.commitedIndex still %d", newConfigIdx)
949+
t.Fatalf("RemoveServer should have written a new config entry, but configurations.committedIndex still %d", newConfigIdx)
950950
}
951951
if !reflect.DeepEqual(newConfig, startingConfig) {
952952
t.Fatalf("[ERR} RemoveServer with unknown peer shouldn't of changed config, was %#v, but now %#v", startingConfig, newConfig)
@@ -1515,7 +1515,7 @@ func snapshotAndRestore(t *testing.T, offset uint64, monotonicLogStore bool, res
15151515
expected = preIndex + 2
15161516
} else {
15171517
// restoring onto a new cluster should always have a last index based
1518-
// off of the snaphsot meta index
1518+
// off of the snapshot meta index
15191519
expected = meta.Index + 2
15201520
}
15211521

@@ -1527,7 +1527,7 @@ func snapshotAndRestore(t *testing.T, offset uint64, monotonicLogStore bool, res
15271527
// Ensure raft logs are removed for monotonic log stores but remain
15281528
// untouched for non-monotic (BoltDB) logstores.
15291529
// When first index = 1, then logs have remained untouched.
1530-
// When first indext is set to the next commit index / last index, then
1530+
// When first index is set to the next commit index / last index, then
15311531
// it means logs have been removed.
15321532
raftNodes := make([]*Raft, 0, numPeers+1)
15331533
raftNodes = append(raftNodes, leader)
@@ -2685,7 +2685,7 @@ func TestRaft_CacheLogWithStoreError(t *testing.T) {
26852685

26862686
// Shutdown follower
26872687
if f := follower.Shutdown(); f.Error() != nil {
2688-
t.Fatalf("error shuting down follower: %v", f.Error())
2688+
t.Fatalf("error shutting down follower: %v", f.Error())
26892689
}
26902690

26912691
// Try to restart the follower and make sure it does not fail with a LogNotFound error
@@ -2860,7 +2860,7 @@ func TestRaft_VoteNotGranted_WhenNodeNotInCluster(t *testing.T) {
28602860
// a follower that thinks there's a leader should vote for that leader.
28612861
var resp RequestVoteResponse
28622862

2863-
// partiton the leader to simulate an unstable cluster
2863+
// partition the leader to simulate an unstable cluster
28642864
c.Partition([]ServerAddress{leader.localAddr})
28652865
time.Sleep(c.propagateTimeout)
28662866

@@ -3005,7 +3005,7 @@ func TestRaft_FollowerRemovalNoElection(t *testing.T) {
30053005
t.Logf("[INFO] restarting %v", follower)
30063006
// Shutdown follower
30073007
if f := follower.Shutdown(); f.Error() != nil {
3008-
t.Fatalf("error shuting down follower: %v", f.Error())
3008+
t.Fatalf("error shutting down follower: %v", f.Error())
30093009
}
30103010

30113011
_, trans := NewInmemTransport(follower.localAddr)

replication.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ type followerReplication struct {
6363
triggerCh chan struct{}
6464

6565
// triggerDeferErrorCh is used to provide a backchannel. By sending a
66-
// deferErr, the sender can be notifed when the replication is done.
66+
// deferErr, the sender can be notified when the replication is done.
6767
triggerDeferErrorCh chan *deferError
6868

6969
// lastContact is updated to the current time whenever any response is

snapshot.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func (r *Raft) takeSnapshot() (string, error) {
211211
}
212212

213213
// compactLogsWithTrailing takes the last inclusive index of a snapshot,
214-
// the lastLogIdx, and and the trailingLogs and trims the logs that
214+
// the lastLogIdx, and the trailingLogs and trims the logs that
215215
// are no longer needed.
216216
func (r *Raft) compactLogsWithTrailing(snapIdx uint64, lastLogIdx uint64, trailingLogs uint64) error {
217217
// Determine log ranges to compact

0 commit comments

Comments
 (0)