Skip to content

Commit

Permalink
storage: stringer for snapshotType
Browse files Browse the repository at this point in the history
  • Loading branch information
tbg committed Jul 6, 2016
1 parent 857633c commit 6312a3c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
11 changes: 6 additions & 5 deletions storage/replica_raftstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ func (r *Replica) updateRangeInfo(desc *roachpb.RangeDescriptor) error {
return nil
}

//go:generate stringer -type snapshotType
type snapshotType int

const (
Expand Down Expand Up @@ -542,13 +543,13 @@ func (r *Replica) applySnapshot(snap raftpb.Snapshot, typ snapshotType) (uint64,
replicaID := r.mu.replicaID
r.mu.Unlock()

log.Infof("replica %d received snapshot for range %d at index %d. "+
"encoded size=%d, %d KV pairs, %d log entries",
replicaID, desc.RangeID, snap.Metadata.Index,
log.Infof("replica %d applying %s for range %d at index %d "+
"(encoded size=%d, %d KV pairs, %d log entries)",
replicaID, typ, desc.RangeID, snap.Metadata.Index,
len(snap.Data), len(snapData.KV), len(snapData.LogEntries))
defer func(start time.Time) {
log.Infof("replica %d applied snapshot for range %d in %s",
replicaID, desc.RangeID, timeutil.Since(start))
log.Infof("replica %d applied %s for range %d in %s",
replicaID, typ, desc.RangeID, timeutil.Since(start))
}(timeutil.Now())

// Delete everything in the range and recreate it from the snapshot.
Expand Down
16 changes: 16 additions & 0 deletions storage/snapshottype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6312a3c

Please sign in to comment.