aboutsummaryrefslogtreecommitdiff
path: root/weed/topology/node.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2022-06-10 06:44:16 -0700
committerGitHub <noreply@github.com>2022-06-10 06:44:16 -0700
commit36757d28a8552c02187409c6d25e2c20f4a32b58 (patch)
tree3e7a8219fb6e3e10bf4c52ed742d9b24bdf2535f /weed/topology/node.go
parent9f8b72a54d8c97db5963f5204e2857e93bf22612 (diff)
parentfb57aa431c52b7b5575e2eadd52ed3045d6c6c51 (diff)
downloadseaweedfs-36757d28a8552c02187409c6d25e2c20f4a32b58.tar.xz
seaweedfs-36757d28a8552c02187409c6d25e2c20f4a32b58.zip
Merge pull request #3163 from kmlebedev/metric_replica_placement_mismatch
stats master_replica_placement_mismatch
Diffstat (limited to 'weed/topology/node.go')
-rw-r--r--weed/topology/node.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/weed/topology/node.go b/weed/topology/node.go
index 4772cb411..c5956177a 100644
--- a/weed/topology/node.go
+++ b/weed/topology/node.go
@@ -3,6 +3,7 @@ package topology
import (
"errors"
"github.com/chrislusf/seaweedfs/weed/glog"
+ "github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/weed/storage/erasure_coding"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
"github.com/chrislusf/seaweedfs/weed/storage/types"
@@ -246,6 +247,14 @@ func (n *NodeImpl) CollectDeadNodeAndFullVolumes(freshThreshHold int64, volumeSi
} else if float64(v.Size) > float64(volumeSizeLimit)*growThreshold {
n.GetTopology().chanCrowdedVolumes <- v
}
+ copyCount := v.ReplicaPlacement.GetCopyCount()
+ if copyCount > 1 {
+ if copyCount > len(n.GetTopology().Lookup(v.Collection, v.Id)) {
+ stats.MasterReplicaPlacementMismatch.WithLabelValues(v.Collection, v.Id.String()).Set(1)
+ } else {
+ stats.MasterReplicaPlacementMismatch.WithLabelValues(v.Collection, v.Id.String()).Set(0)
+ }
+ }
}
}
} else {