All closes are now fast

pull/9316/head
Edd Robinson 2018-01-15 15:06:14 +00:00
parent d890f29fcb
commit e902998f4e
2 changed files with 5 additions and 16 deletions

View File

@ -336,7 +336,7 @@ func (s *Shard) Open() error {
return nil
}(); err != nil {
s.close(true)
s.close()
return NewShardError(s.id, err)
}
@ -352,23 +352,12 @@ func (s *Shard) Open() error {
func (s *Shard) Close() error {
s.mu.Lock()
defer s.mu.Unlock()
return s.close(true)
}
// CloseFast closes the shard without cleaning up the shard ID or any of the
// shard's series keys from the index it belongs to.
//
// CloseFast can be called when the entire index is being removed, e.g., when
// the database the shard belongs to is being dropped.
func (s *Shard) CloseFast() error {
s.mu.Lock()
defer s.mu.Unlock()
return s.close(false)
return s.close()
}
// close closes the shard an removes reference to the shard from associated
// indexes, unless clean is false.
func (s *Shard) close(_ bool) error {
func (s *Shard) close() error {
if s._engine == nil {
return nil
}

View File

@ -335,7 +335,7 @@ func (s *Store) Close() error {
// Close all the shards in parallel.
if err := s.walkShards(s.shardsSlice(), func(sh *Shard) error {
return sh.CloseFast()
return sh.Close()
}); err != nil {
return err
}
@ -576,7 +576,7 @@ func (s *Store) DeleteDatabase(name string) error {
return nil
}
return sh.CloseFast()
return sh.Close()
}); err != nil {
return err
}