Skip to content

Commit

Permalink
Merge f6278ef into 6ea81c1
Browse files Browse the repository at this point in the history
  • Loading branch information
redwrasse committed Sep 20, 2024
2 parents 6ea81c1 + f6278ef commit 75879c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion contrib/raftexample/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"bytes"
"encoding/gob"
"encoding/json"
"errors"
"log"
"strings"
"sync"
Expand Down Expand Up @@ -113,7 +114,7 @@ func (s *kvstore) getSnapshot() ([]byte, error) {

func (s *kvstore) loadSnapshot() (*raftpb.Snapshot, error) {
snapshot, err := s.snapshotter.Load()
if err == snap.ErrNoSnapshot {
if errors.Is(err, snap.ErrNoSnapshot) {
return nil, nil
}
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion contrib/raftexample/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package main

import (
"context"
"errors"
"fmt"
"log"
"net/http"
Expand Down Expand Up @@ -392,7 +393,7 @@ func (rc *raftNode) maybeTriggerSnapshot(applyDoneC <-chan struct{}) {
compactIndex = rc.appliedIndex - snapshotCatchUpEntriesN
}
if err := rc.raftStorage.Compact(compactIndex); err != nil {
if err != raft.ErrCompacted {
if !errors.Is(err, raft.ErrCompacted) {
panic(err)
}
} else {
Expand Down

0 comments on commit 75879c1

Please sign in to comment.