Avoid panicking when mapping points to a shard group
that has no shards. This does not address the root problem,
how the shard group ended up with no shards.
helps: https://github.com/influxdata/influxdb/issues/25715
(cherry picked from commit 5b364b51c8
)
closes: https://github.com/influxdata/influxdb/issues/25718
master-1.x
parent
db523227a2
commit
694607a22c
|
@ -255,6 +255,9 @@ func (w *PointsWriter) MapShards(wp *WritePointsRequest) (*ShardMapping, error)
|
||||||
mapping.Dropped = append(mapping.Dropped, p)
|
mapping.Dropped = append(mapping.Dropped, p)
|
||||||
atomic.AddInt64(&w.stats.WriteDropped, 1)
|
atomic.AddInt64(&w.stats.WriteDropped, 1)
|
||||||
continue
|
continue
|
||||||
|
} else if len(sg.Shards) <= 0 {
|
||||||
|
// Shard groups should have at least one shard.
|
||||||
|
return nil, fmt.Errorf("shard group %d covering %s to %s has no shards", sg.ID, sg.StartTime, sg.EndTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
sh := sg.ShardFor(p)
|
sh := sg.ShardFor(p)
|
||||||
|
|
Loading…
Reference in New Issue