aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2024-09-29 10:51:17 -0700
committerchrislu <chris.lu@gmail.com>2024-09-29 10:51:17 -0700
commit6564ceda915a67d5b2ded9b18a9e5be2abe3a4aa (patch)
treebabe0fe15cabf6fe7c4c7662ce1770d0f14b2539
parentec30a504bae6cad75f859964e14c60d39cc43709 (diff)
downloadseaweedfs-6564ceda915a67d5b2ded9b18a9e5be2abe3a4aa.tar.xz
seaweedfs-6564ceda915a67d5b2ded9b18a9e5be2abe3a4aa.zip
skip resource heavy commands from running on master nodes
-rw-r--r--weed/server/master_server.go4
-rw-r--r--weed/shell/command_volume_check_disk.go4
-rw-r--r--weed/shell/command_volume_fix_replication.go4
-rw-r--r--weed/shell/command_volume_fsck.go4
4 files changed, 10 insertions, 6 deletions
diff --git a/weed/server/master_server.go b/weed/server/master_server.go
index aefae7126..9b7150d83 100644
--- a/weed/server/master_server.go
+++ b/weed/server/master_server.go
@@ -314,6 +314,10 @@ func processEachCmd(reg *regexp.Regexp, line string, commandEnv *shell.CommandEn
for _, c := range shell.Commands {
if c.Name() == cmd {
+ if c.HasTag(shell.ResourceHeavy) {
+ glog.Warningf("%s is resource heavy and should not run on master", cmd)
+ continue
+ }
glog.V(0).Infof("executing: %s %v", cmd, args)
if err := c.Do(args, commandEnv, os.Stdout); err != nil {
glog.V(0).Infof("error: %v", err)
diff --git a/weed/shell/command_volume_check_disk.go b/weed/shell/command_volume_check_disk.go
index f1f3a0728..f72dff243 100644
--- a/weed/shell/command_volume_check_disk.go
+++ b/weed/shell/command_volume_check_disk.go
@@ -48,8 +48,8 @@ func (c *commandVolumeCheckDisk) Help() string {
`
}
-func (c *commandVolumeCheckDisk) HasTag(CommandTag) bool {
- return false
+func (c *commandVolumeCheckDisk) HasTag(tag CommandTag) bool {
+ return tag == ResourceHeavy
}
func (c *commandVolumeCheckDisk) getVolumeStatusFileCount(vid uint32, dn *master_pb.DataNodeInfo) (totalFileCount, deletedFileCount uint64) {
diff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.go
index 8337f5368..55c801284 100644
--- a/weed/shell/command_volume_fix_replication.go
+++ b/weed/shell/command_volume_fix_replication.go
@@ -55,8 +55,8 @@ func (c *commandVolumeFixReplication) Help() string {
`
}
-func (c *commandVolumeFixReplication) HasTag(CommandTag) bool {
- return false
+func (c *commandVolumeFixReplication) HasTag(tag CommandTag) bool {
+ return tag == ResourceHeavy
}
func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
diff --git a/weed/shell/command_volume_fsck.go b/weed/shell/command_volume_fsck.go
index 89c15a8af..d68ec8de5 100644
--- a/weed/shell/command_volume_fsck.go
+++ b/weed/shell/command_volume_fsck.go
@@ -79,8 +79,8 @@ func (c *commandVolumeFsck) Help() string {
`
}
-func (c *commandVolumeFsck) HasTag(CommandTag) bool {
- return false
+func (c *commandVolumeFsck) HasTag(tag CommandTag) bool {
+ return tag == ResourceHeavy
}
func (c *commandVolumeFsck) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {