mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vminsert/netstorage: evenly distribute rerouted rows among all the availalbe storage nodes
Previously such rows were distributed to the original storage node or to the next storage node. This may result to uneven load among the remaining storage nodes.
This commit is contained in:
parent
02b2064d8e
commit
f41a01332a
1 changed files with 4 additions and 2 deletions
|
@ -18,7 +18,6 @@ import (
|
|||
"github.com/VictoriaMetrics/VictoriaMetrics/lib/storage"
|
||||
"github.com/VictoriaMetrics/metrics"
|
||||
xxhash "github.com/cespare/xxhash/v2"
|
||||
jump "github.com/lithammer/go-jump-consistent-hash"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -530,7 +529,10 @@ func spreadReroutedBufToStorageNodes(sns []*storageNode, br *bufRows) {
|
|||
idx := uint64(0)
|
||||
if len(sns) > 1 {
|
||||
h := xxhash.Sum64(mr.MetricNameRaw)
|
||||
idx = uint64(jump.Hash(h, int32(len(sns))))
|
||||
// Do not use jump.Hash(h, int32(len(sns))) here,
|
||||
// since this leads to uneven distribution of rerouted rows among sns -
|
||||
// they all go to the original or to the next sn.
|
||||
idx = h % uint64(len(sns))
|
||||
}
|
||||
attempts := 0
|
||||
for {
|
||||
|
|
Loading…
Reference in a new issue