app/vminsert/netstorage: update storageNode.lastRerouteTime before the rerouting

This is needed for reliable detection of storage nodes with recent rerouting
This commit is contained in:
Aliaksandr Valialkin 2021-06-08 11:01:12 +03:00
parent 0d067eb112
commit 2c6b917749

View file

@ -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 {