From 2b39ee785c5cb3eab2d520e472cb37fea4d23054 Mon Sep 17 00:00:00 2001 From: Zakhar Bessarab Date: Wed, 24 Jul 2024 18:18:48 +0400 Subject: [PATCH] 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 --- app/vmselect/netstorage/netstorage.go | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index 93e89e490c..00044b17bc 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -9,7 +9,6 @@ import ( "net" "net/http" "os" - "slices" "sort" "strings" "sync" @@ -2958,29 +2957,10 @@ func getStorageNodes() []*storageNode { return snb.sns } -var ( - nodeID uint64 - nodeIDOnce sync.Once -) - -// GetNodeID returns unique identifier for underlying storage nodes. +// GetNodeID returns unique identifier of vmselect func GetNodeID() uint64 { - nodeIDOnce.Do(func() { - snb := getStorageNodesBucket() - 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 + // Returns a 0 as persistent IDs are not intended to use with multi-level setup + return 0 } // Init initializes storage nodes' connections to the given addrs.