Make shard is ready before returning index type

Shard can be created before they are opened and not have an index
setup yet.  This can cause a panic if IndexType is called.
pull/8370/head
Jason Wilder 2017-05-08 12:48:35 -06:00
parent 041262af0e
commit 00bdf62b83
1 changed files with 4 additions and 0 deletions

View File

@ -347,6 +347,10 @@ func (s *Shard) close(clean bool) error {
}
func (s *Shard) IndexType() string {
if err := s.ready(); err != nil {
return ""
}
s.mu.RLock()
defer s.mu.RUnlock()
return s.index.Type()