app/vminsert: disable usage of persistent storage node ID by default

This is needed in order to avoid complete data re-sharding after the upgrade to a new version.

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
This commit is contained in:
Zakhar Bessarab 2024-06-14 14:18:54 +04:00
parent 8729ec174b
commit 71e729f3f8
No known key found for this signature in database
GPG key ID: 932B34D6FE062023
2 changed files with 13 additions and 1 deletions

View file

@ -45,6 +45,9 @@ var (
"On the other side, disabled re-routing minimizes the number of active time series in the cluster "+ "On the other side, disabled re-routing minimizes the number of active time series in the cluster "+
"during rolling restarts and during spikes in series churn rate. "+ "during rolling restarts and during spikes in series churn rate. "+
"See also -disableRerouting") "See also -disableRerouting")
usePersistentStorageNodeID = flag.Bool("vmstorageUsePersistentID", false, "Whether to use persistent storage node ID for -storageNode instances. "+
"If set to false uses storage node address in order to generate an ID. "+
"Using persistent node ID is useful if vmstorage node address changes over time, e.g. due to dynamic IP addresses or DNS names. ")
) )
var errStorageReadOnly = errors.New("storage node is read only") var errStorageReadOnly = errors.New("storage node is read only")
@ -608,7 +611,14 @@ func initStorageNodes(addrs []string, hashSeed uint64) *storageNodesBucket {
} }
return 0 return 0
}) })
nodeIDs = append(nodeIDs, sn.getID()) var nodeID uint64
if *usePersistentStorageNodeID {
nodeID = sn.getID()
} else {
nodeID = xxhash.Sum64String(addr)
}
nodeIDs = append(nodeIDs, nodeID)
sns = append(sns, sn) sns = append(sns, sn)
} }
nodesHash := newConsistentHash(nodeIDs, hashSeed) nodesHash := newConsistentHash(nodeIDs, hashSeed)

View file

@ -1301,6 +1301,8 @@ Below is the output for `/path/to/vminsert -help`:
Show VictoriaMetrics version Show VictoriaMetrics version
-vmstorageDialTimeout duration -vmstorageDialTimeout duration
Timeout for establishing RPC connections from vminsert to vmstorage. See also -vmstorageUserTimeout (default 3s) Timeout for establishing RPC connections from vminsert to vmstorage. See also -vmstorageUserTimeout (default 3s)
-vmstorageUsePersistentID
Whether to use persistent storage node ID for -storageNode instances. If set to false uses storage node address in order to generate an ID. Using persistent node ID is useful if vmstorage node address changes over time, e.g. due to dynamic IP addresses or DNS names.
-vmstorageUserTimeout duration -vmstorageUserTimeout duration
Network timeout for RPC connections from vminsert to vmstorage (Linux only). Lower values speed up re-rerouting recovery when some of vmstorage nodes become unavailable because of networking issues. Read more about TCP_USER_TIMEOUT at https://blog.cloudflare.com/when-tcp-sockets-refuse-to-die/ . See also -vmstorageDialTimeout (default 3s) Network timeout for RPC connections from vminsert to vmstorage (Linux only). Lower values speed up re-rerouting recovery when some of vmstorage nodes become unavailable because of networking issues. Read more about TCP_USER_TIMEOUT at https://blog.cloudflare.com/when-tcp-sockets-refuse-to-die/ . See also -vmstorageDialTimeout (default 3s)
``` ```