SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
fix debug message displaying
Chris Lu921f1c626a2e
diff --git a/weed-fs/src/cmd/weed/command.go b/weed-fs/src/cmd/weed/command.goindex 4d68ff1511..c8d86ca66a 100644--- a/weed-fs/src/cmd/weed/command.go+++ b/weed-fs/src/cmd/weed/command.go@@ -24,6 +24,8 @@ type Command struct {// Flag is a set of flags specific to this command.Flag flag.FlagSet++ IsDebug *bool}// Name returns the command's name: the first word in the usage line.diff --git a/weed-fs/src/cmd/weed/fix.go b/weed-fs/src/cmd/weed/fix.goindex 7bed70edda..d794374cb4 100644--- a/weed-fs/src/cmd/weed/fix.go+++ b/weed-fs/src/cmd/weed/fix.go@@ -10,11 +10,11 @@ import (func init() {cmdFix.Run = runFix // break init cycle- IsDebug = cmdFix.Flag.Bool("debug", false, "enable debug mode")+ cmdFix.IsDebug = cmdFix.Flag.Bool("debug", false, "enable debug mode")}var cmdFix = &Command{- UsageLine: "fix -dir=/tmp -volumeId=234 -debug=1",+ UsageLine: "fix -dir=/tmp -volumeId=234",Short: "run weed tool fix on index file if corrupted",Long: `Fix runs the WeedFS fix command to re-create the index .idx file.@@ -22,23 +22,23 @@ var cmdFix = &Command{}var (- dir = cmdFix.Flag.String("dir", "/tmp", "data directory to store files")- volumeId = cmdFix.Flag.Int("volumeId", -1, "a non-negative volume id. The volume should already exist in the dir. The volume index file should not exist.")+ fixVolumePath = cmdFix.Flag.String("dir", "/tmp", "data directory to store files")+ fixVolumeId = cmdFix.Flag.Int("volumeId", -1, "a volume id. The volume should already exist in the dir. The volume index file should not exist."))func runFix(cmd *Command, args []string) bool {- if *volumeId == -1 {+ if *fixVolumeId == -1 {return false}- fileName := strconv.Itoa(*volumeId)- dataFile, e := os.OpenFile(path.Join(*dir, fileName+".dat"), os.O_RDONLY, 0644)+ fileName := strconv.Itoa(*fixVolumeId)+ dataFile, e := os.OpenFile(path.Join(*fixVolumePath, fileName+".dat"), os.O_RDONLY, 0644)if e != nil {log.Fatalf("Read Volume [ERROR] %s\n", e)}defer dataFile.Close()- indexFile, ie := os.OpenFile(path.Join(*dir, fileName+".idx"), os.O_WRONLY|os.O_CREATE, 0644)+ indexFile, ie := os.OpenFile(path.Join(*fixVolumePath, fileName+".idx"), os.O_WRONLY|os.O_CREATE, 0644)if ie != nil {log.Fatalf("Create Volume Index [ERROR] %s\n", ie)}diff --git a/weed-fs/src/cmd/weed/master.go b/weed-fs/src/cmd/weed/master.goindex c60974a673..07abcf0dc7 100644--- a/weed-fs/src/cmd/weed/master.go+++ b/weed-fs/src/cmd/weed/master.go@@ -16,7 +16,7 @@ import (func init() {cmdMaster.Run = runMaster // break init cycle- IsDebug = cmdMaster.Flag.Bool("debug", false, "enable debug mode")+ cmdMaster.IsDebug = cmdMaster.Flag.Bool("debug", false, "enable debug mode")}var cmdMaster = &Command{diff --git a/weed-fs/src/cmd/weed/upload.go b/weed-fs/src/cmd/weed/upload.goindex 5707fda566..8ce0674f41 100644--- a/weed-fs/src/cmd/weed/upload.go+++ b/weed-fs/src/cmd/weed/upload.go@@ -15,7 +15,7 @@ var uploadReplication *stringfunc init() {cmdUpload.Run = runUpload // break init cycle- IsDebug = cmdUpload.Flag.Bool("debug", false, "verbose debug information")+ cmdUpload.IsDebug = cmdUpload.Flag.Bool("debug", false, "verbose debug information")server = cmdUpload.Flag.String("server", "localhost:9333", "weedfs master location")uploadReplication = cmdUpload.Flag.String("replication", "000", "replication type(000,001,010,100,110,200)")}diff --git a/weed-fs/src/cmd/weed/volume.go b/weed-fs/src/cmd/weed/volume.goindex 576096dbbc..4ee8c31a50 100644--- a/weed-fs/src/cmd/weed/volume.go+++ b/weed-fs/src/cmd/weed/volume.go@@ -17,7 +17,7 @@ import (func init() {cmdVolume.Run = runVolume // break init cycle- IsDebug = cmdVolume.Flag.Bool("debug", false, "enable debug mode")+ cmdVolume.IsDebug = cmdVolume.Flag.Bool("debug", false, "enable debug mode")}var cmdVolume = &Command{diff --git a/weed-fs/src/cmd/weed/weed.go b/weed-fs/src/cmd/weed/weed.goindex e2eb41ced7..e3ffc013be 100644--- a/weed-fs/src/cmd/weed/weed.go+++ b/weed-fs/src/cmd/weed/weed.go@@ -65,6 +65,7 @@ func main() {cmd.Flag.Usage = func() { cmd.Usage() }cmd.Flag.Parse(args[1:])args = cmd.Flag.Args()+ *IsDebug = *cmd.IsDebugif !cmd.Run(cmd, args) {fmt.Fprintf(os.Stderr, "\n")cmd.Flag.Usage()