chore: fix logging issues in Store.loadShards
Fix reporting shards not opening correctly when they actually did. Fix race condition with logging in loadShards.gw_fix_load_log
parent
0bc167bbd7
commit
aed9e976ed
|
@ -567,14 +567,13 @@ func (s *Store) loadShards() error {
|
|||
loader := s.newShardLoader(sh.id, sh.db, sh.rp, false, withIndexVersion(indexVersion))
|
||||
|
||||
// Now perform the actual loading in parallel in separate goroutines.
|
||||
go func() {
|
||||
go func(log *zap.Logger) {
|
||||
t.Take()
|
||||
defer t.Release()
|
||||
|
||||
log := log.With(logger.Shard(sh.id), zap.String("path", loader.path))
|
||||
start := time.Now()
|
||||
res := loader.Load()
|
||||
if res.err != nil {
|
||||
if res.err == nil {
|
||||
log.Info("Opened shard", zap.String("index_version", res.s.IndexType()), zap.Duration("duration", time.Since(start)))
|
||||
} else {
|
||||
log.Error("Failed to open shard", zap.Error(res.err))
|
||||
|
@ -584,7 +583,7 @@ func (s *Store) loadShards() error {
|
|||
if s.startupProgressMetrics != nil {
|
||||
s.startupProgressMetrics.CompletedShard()
|
||||
}
|
||||
}()
|
||||
}(log.With(logger.Shard(sh.id), zap.String("path", loader.path)))
|
||||
}
|
||||
|
||||
// Register shards serially as the parallel goroutines finish opening them.
|
||||
|
|
Loading…
Reference in New Issue