mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-09 15:27:11 +00:00
app/vmselect: send static empty node ID for multi-level setup
Multi-level vmselect setup is not intended to use storage node IDs, so it is safe to return 0 here. Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
This commit is contained in:
parent
842bf78cb1
commit
2b39ee785c
1 changed files with 3 additions and 23 deletions
|
@ -9,7 +9,6 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"slices"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -2958,29 +2957,10 @@ func getStorageNodes() []*storageNode {
|
||||||
return snb.sns
|
return snb.sns
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
// GetNodeID returns unique identifier of vmselect
|
||||||
nodeID uint64
|
|
||||||
nodeIDOnce sync.Once
|
|
||||||
)
|
|
||||||
|
|
||||||
// GetNodeID returns unique identifier for underlying storage nodes.
|
|
||||||
func GetNodeID() uint64 {
|
func GetNodeID() uint64 {
|
||||||
nodeIDOnce.Do(func() {
|
// Returns a 0 as persistent IDs are not intended to use with multi-level setup
|
||||||
snb := getStorageNodesBucket()
|
return 0
|
||||||
snIDs := make([]uint64, 0, len(snb.sns))
|
|
||||||
for _, sn := range snb.sns {
|
|
||||||
snIDs = append(snIDs, sn.id)
|
|
||||||
}
|
|
||||||
slices.Sort(snIDs)
|
|
||||||
idsM := make([]byte, 0)
|
|
||||||
for _, id := range snIDs {
|
|
||||||
idsM = encoding.MarshalUint64(idsM, id)
|
|
||||||
}
|
|
||||||
|
|
||||||
nodeID = xxhash.Sum64(idsM)
|
|
||||||
})
|
|
||||||
|
|
||||||
return nodeID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init initializes storage nodes' connections to the given addrs.
|
// Init initializes storage nodes' connections to the given addrs.
|
||||||
|
|
Loading…
Reference in a new issue