mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/logstorage: make sure that the number of output (bloom, values) shards is bigger than zero.
If the number of output (bloom, values) shards is zero, then this may lead to panic as shown at https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7391 . This panic may happen when parts with only constant fields with distinct values are merged into output part with non-constant fields, which should be written to (bloom, values) shards.
This commit is contained in:
parent
258ee93fd1
commit
102e9d4f4e
2 changed files with 6 additions and 1 deletions
|
@ -15,6 +15,8 @@ according to [these docs](https://docs.victoriametrics.com/victorialogs/quicksta
|
||||||
|
|
||||||
## tip
|
## tip
|
||||||
|
|
||||||
|
* BUGFIX: fix `runtime error: index out of range [0] with length 0` panic during low-rate data ingestion. The panic has been introduced in [v0.38.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v0.38.0-victorialogs). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7391).
|
||||||
|
|
||||||
## [v0.38.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v0.38.0-victorialogs)
|
## [v0.38.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v0.38.0-victorialogs)
|
||||||
|
|
||||||
Released at 2024-10-29
|
Released at 2024-10-29
|
||||||
|
|
|
@ -312,7 +312,10 @@ func (bsw *blockStreamWriter) MustInitForFilePart(path string, nocache bool, blo
|
||||||
|
|
||||||
func adjustBloomValuesShardsCount(n uint64) uint64 {
|
func adjustBloomValuesShardsCount(n uint64) uint64 {
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
return n
|
// At least a single shard is needed for writing potential non-const fields,
|
||||||
|
// which can appear after merging of const fields.
|
||||||
|
// This fixes https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7391
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
n = 1 << bits.Len64(n-1)
|
n = 1 << bits.Len64(n-1)
|
||||||
|
|
Loading…
Reference in a new issue