From 2c6b917749e731a62f95c2ed4f3ff2cc67157577 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 8 Jun 2021 11:01:12 +0300 Subject: [PATCH] app/vminsert/netstorage: update storageNode.lastRerouteTime before the rerouting This is needed for reliable detection of storage nodes with recent rerouting --- app/vminsert/netstorage/netstorage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/vminsert/netstorage/netstorage.go b/app/vminsert/netstorage/netstorage.go index 964595c8e9..1fdf001093 100644 --- a/app/vminsert/netstorage/netstorage.go +++ b/app/vminsert/netstorage/netstorage.go @@ -470,6 +470,7 @@ func rerouteRowsMayBlock(snSource *storageNode, mayUseSNSource bool, buf []byte, logger.Panicf("BUG: re-routing can work only if at least 2 storage nodes are configured; got %d nodes", len(storageNodes)) } reroutesTotal.Inc() + atomic.StoreUint64(&snSource.lastRerouteTime, fasttime.UnixTimestamp()) sns := getStorageNodesMapForRerouting(snSource, mayUseSNSource) if areStorageNodesEqual(sns) { // Fast path - all the storage nodes are the same - send the buf to them. @@ -483,7 +484,6 @@ func rerouteRowsMayBlock(snSource *storageNode, mayUseSNSource bool, buf []byte, } return nil } - atomic.StoreUint64(&snSource.lastRerouteTime, fasttime.UnixTimestamp()) src := buf var mr storage.MetricRow for len(src) > 0 {