logging tweaks
This commit is contained in:
parent
48f8ee1d11
commit
4fcdbb9dee
|
@ -15,7 +15,7 @@ import (
|
|||
func FSMState(p string, plastIdx int64) (interface{}, error) {
|
||||
store, firstIdx, lastIdx, err := RaftStateInfo(filepath.Join(p, "raft.db"))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open raft logs: %v", err)
|
||||
return nil, fmt.Errorf("failed to open raft database %v: %v", p, err)
|
||||
}
|
||||
defer store.Close()
|
||||
|
||||
|
@ -64,7 +64,7 @@ func FSMState(p string, plastIdx int64) (interface{}, error) {
|
|||
var e raft.Log
|
||||
err := store.GetLog(i, &e)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read log entry at index %d: %v", i, err)
|
||||
return nil, fmt.Errorf("failed to read log entry at index %d: %v, firstIdx: %d, lastIdx: %d", i, err, firstIdx, lastIdx)
|
||||
}
|
||||
|
||||
if e.Type == raft.LogCommand {
|
||||
|
@ -99,6 +99,7 @@ func FSMState(p string, plastIdx int64) (interface{}, error) {
|
|||
}
|
||||
|
||||
func restoreFromSnapshot(fsm raft.FSM, snaps raft.SnapshotStore, logger hclog.Logger) (uint64, error) {
|
||||
logger = logger.Named("restoreFromSnapshot")
|
||||
snapshots, err := snaps.List()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
|
|
|
@ -45,7 +45,7 @@ func LogEntries(p string) (logs []interface{}, warnings []error, err error) {
|
|||
var e raft.Log
|
||||
err := store.GetLog(i, &e)
|
||||
if err != nil {
|
||||
warnings = append(warnings, fmt.Errorf("failed to read log entry at index %d: %v", i, err))
|
||||
warnings = append(warnings, fmt.Errorf("failed to read log entry at index %d (firstIdx: %d, lastIdx: %d): %v", i, firstIdx, lastIdx, err))
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue