Skip to content

Commit

Permalink
storage: check that sideloaded storage is present
Browse files Browse the repository at this point in the history
If this were passed as nil, we'd be returning "thin" (i.e. with
sideloading payloads not inlined) Entries. This isn't supposed
to happen, but check it.

See:
cockroachdb#31618 (comment).

Release note: None
  • Loading branch information
tbg committed Oct 19, 2018
1 parent 57ed401 commit e5df97a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/storage/replica_raftstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ func (r *replicaRaftStorage) Entries(lo, hi, maxBytes uint64) ([]raftpb.Entry, e
readonly := r.store.Engine().NewReadOnly()
defer readonly.Close()
ctx := r.AnnotateCtx(context.TODO())
if r.raftMu.sideloaded == nil {
return nil, errors.New("sideloaded storage is uninitialized")
}
return entries(ctx, r.mu.stateLoader, readonly, r.RangeID, r.store.raftEntryCache,
r.raftMu.sideloaded, lo, hi, maxBytes)
}
Expand Down

0 comments on commit e5df97a

Please sign in to comment.