Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
tbg committed Jul 5, 2016
1 parent 04ca485 commit 019826c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions storage/replica_raftstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,9 @@ func (r *Replica) applySnapshot(snap raftpb.Snapshot, hs raftpb.HardState) (uint
if raft.IsEmptyHardState(hs) {
return 0, errors.Errorf("cannot apply empty HardState on non-preemptive snapshot")
}
if err := setHardState(batch, desc.RangeID, hs); err != nil {
return 0, errors.Wrap(err, "unable to write HardState")
}
}

if err := batch.Commit(); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions storage/replica_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/cockroachdb/cockroach/storage/engine/enginepb"
"github.com/cockroachdb/cockroach/storage/storagebase"
"github.com/cockroachdb/cockroach/util/hlc"
"github.com/cockroachdb/cockroach/util/log"
"github.com/cockroachdb/cockroach/util/protoutil"
"github.com/coreos/etcd/raft"
"github.com/coreos/etcd/raft/raftpb"
Expand Down Expand Up @@ -347,6 +348,7 @@ func updateHardState(eng engine.ReadWriter, s storagebase.ReplicaState) error {
newHS.Vote = oldHS.Vote
}

log.Warningf("SHS %+v", newHS)
return setHardState(eng, rangeID, newHS)
}

Expand Down

0 comments on commit 019826c

Please sign in to comment.