mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
Fix uninitialized replication stats (#20260)
Services are unfrozen before `initBackgroundReplication` is finished. This means that the globalReplicationStats write is racy. Switch to an atomic pointer. Provide the `ReplicationPool` with the stats, so it doesn't have to be grabbed from the atomic pointer on every use. All other loads and checks are nil, and calls return empty values when stats still haven't been initialized.
This commit is contained in:
@@ -69,11 +69,12 @@ var (
|
||||
// loadClusterReplicationMetrics - `MetricsLoaderFn` for cluster replication metrics
|
||||
// such as transfer rate and objects queued.
|
||||
func loadClusterReplicationMetrics(ctx context.Context, m MetricValues, c *metricsCache) error {
|
||||
if globalReplicationStats == nil {
|
||||
st := globalReplicationStats.Load()
|
||||
if st == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
qs := globalReplicationStats.getNodeQueueStatsSummary()
|
||||
qs := st.getNodeQueueStatsSummary()
|
||||
|
||||
qt := qs.QStats
|
||||
m.Set(replicationAverageQueuedBytes, float64(qt.Avg.Bytes))
|
||||
|
||||
Reference in New Issue
Block a user