mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-16 11:04:42 -07:00
Undo bad commit for raft.go
Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -25,7 +25,6 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@@ -952,12 +951,6 @@ func (n *raft) InstallSnapshot(data []byte) error {
|
||||
return errCatchupsRunning
|
||||
}
|
||||
|
||||
// We don't store snapshotsnfor memory based WALs.
|
||||
if _, ok := n.wal.(*memStore); ok {
|
||||
n.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
var state StreamState
|
||||
n.wal.FastState(&state)
|
||||
|
||||
@@ -966,20 +959,6 @@ func (n *raft) InstallSnapshot(data []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(data) == 0 {
|
||||
if strings.HasPrefix(n.group, "C-") {
|
||||
fmt.Printf("\n\n%v state is %+v, n.applied is %d, n.snapfile is %q\n", n.group, state, n.applied, n.snapfile)
|
||||
for index := state.FirstSeq; index <= state.LastSeq; index++ {
|
||||
ae, _ := n.loadEntry(index)
|
||||
for _, e := range ae.entries {
|
||||
fmt.Printf("Entry %+v\n", e)
|
||||
}
|
||||
}
|
||||
n.Unlock()
|
||||
panic("XXX")
|
||||
}
|
||||
}
|
||||
|
||||
n.debug("Installing snapshot of %d bytes", len(data))
|
||||
|
||||
var term uint64
|
||||
@@ -1102,10 +1081,8 @@ func (n *raft) setupLastSnapshot() {
|
||||
n.snapfile = latest
|
||||
snap, err := n.loadLastSnapshot()
|
||||
if err != nil {
|
||||
if n.snapfile != _EMPTY_ {
|
||||
os.Remove(n.snapfile)
|
||||
n.snapfile = _EMPTY_
|
||||
}
|
||||
os.Remove(n.snapfile)
|
||||
n.snapfile = _EMPTY_
|
||||
} else {
|
||||
n.pindex = snap.lastIndex
|
||||
n.pterm = snap.lastTerm
|
||||
|
||||
Reference in New Issue
Block a user