mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-02-09 09:17:28 +08:00
skip resource heavy commands from running on master nodes
This commit is contained in:
@@ -314,6 +314,10 @@ func processEachCmd(reg *regexp.Regexp, line string, commandEnv *shell.CommandEn
|
|||||||
|
|
||||||
for _, c := range shell.Commands {
|
for _, c := range shell.Commands {
|
||||||
if c.Name() == cmd {
|
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)
|
glog.V(0).Infof("executing: %s %v", cmd, args)
|
||||||
if err := c.Do(args, commandEnv, os.Stdout); err != nil {
|
if err := c.Do(args, commandEnv, os.Stdout); err != nil {
|
||||||
glog.V(0).Infof("error: %v", err)
|
glog.V(0).Infof("error: %v", err)
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ func (c *commandVolumeCheckDisk) Help() string {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *commandVolumeCheckDisk) HasTag(CommandTag) bool {
|
func (c *commandVolumeCheckDisk) HasTag(tag CommandTag) bool {
|
||||||
return false
|
return tag == ResourceHeavy
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *commandVolumeCheckDisk) getVolumeStatusFileCount(vid uint32, dn *master_pb.DataNodeInfo) (totalFileCount, deletedFileCount uint64) {
|
func (c *commandVolumeCheckDisk) getVolumeStatusFileCount(vid uint32, dn *master_pb.DataNodeInfo) (totalFileCount, deletedFileCount uint64) {
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ func (c *commandVolumeFixReplication) Help() string {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *commandVolumeFixReplication) HasTag(CommandTag) bool {
|
func (c *commandVolumeFixReplication) HasTag(tag CommandTag) bool {
|
||||||
return false
|
return tag == ResourceHeavy
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
|
func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ func (c *commandVolumeFsck) Help() string {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *commandVolumeFsck) HasTag(CommandTag) bool {
|
func (c *commandVolumeFsck) HasTag(tag CommandTag) bool {
|
||||||
return false
|
return tag == ResourceHeavy
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *commandVolumeFsck) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
|
func (c *commandVolumeFsck) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user