Browse Source

If both -readOnly and -writeOnly are specified, the current logic silently allows it with -writeOnly taking precedence. This is confusing and could lead to unexpected behavior.

pull/7418/head
chrislu 1 month ago
parent
commit
1a46f55786
  1. 11
      weed/command/benchmark.go

11
weed/command/benchmark.go

@ -137,15 +137,16 @@ func runBenchmark(cmd *Command, args []string) bool {
// Default: both write and read // Default: both write and read
// -readOnly: only read // -readOnly: only read
// -writeOnly: only write // -writeOnly: only write
if *b.readOnly && *b.writeOnly {
fmt.Fprintln(os.Stderr, "Error: -readOnly and -writeOnly are mutually exclusive.")
return false
}
doWrite := true doWrite := true
doRead := true doRead := true
if *b.readOnly { if *b.readOnly {
doWrite = false doWrite = false
doRead = true
}
if *b.writeOnly {
doWrite = true
} else if *b.writeOnly {
doRead = false doRead = false
} }

Loading…
Cancel
Save