chore: add additional error logging when deleting shard (#24038)

* chore: add additional error logging when deleting shard

* chore: better logging message
test/monitor-ci-415
Jeffrey Smith II 2023-02-09 09:10:25 -05:00 committed by GitHub
parent 06a59020d0
commit 8ad6e17265
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -803,7 +803,7 @@ func (s *Store) DeleteShard(shardID uint64) error {
ss := index.SeriesIDSet()
s.walkShards(shards, func(sh *Shard) error {
err = s.walkShards(shards, func(sh *Shard) error {
index, err := sh.Index()
if err != nil {
return err
@ -813,13 +813,20 @@ func (s *Store) DeleteShard(shardID uint64) error {
return nil
})
if err != nil {
s.Logger.Error("error walking shards during DeleteShard operation", zap.Error(err))
}
// Remove any remaining series in the set from the series file, as they don't
// exist in any of the database's remaining shards.
if ss.Cardinality() > 0 {
sfile := s.seriesFile(db)
if sfile != nil {
ss.ForEach(func(id uint64) {
sfile.DeleteSeriesID(id)
err = sfile.DeleteSeriesID(id)
if err != nil {
s.Logger.Error("error deleting series id during DeleteShard operation", zap.Uint64("id", id), zap.Error(err))
}
})
}