21189: Revert exit code 64 to 2 for invalid command line argument.
[arvados.git] / services / keep-balance / main.go
index b016db22ffe67f6316f1e4f537bfa680f135ecad..ec1cb18ee1087063a57d63f73c2c00b5a17eab33 100644 (file)
@@ -32,12 +32,14 @@ func (command) RunCommand(prog string, args []string, stdin io.Reader, stdout, s
        flags := flag.NewFlagSet(prog, flag.ContinueOnError)
        flags.BoolVar(&options.Once, "once", false,
                "balance once and then exit")
-       flags.BoolVar(&options.CommitPulls, "commit-pulls", false,
-               "send pull requests (make more replicas of blocks that are underreplicated or are not in optimal rendezvous probe order)")
-       flags.BoolVar(&options.CommitTrash, "commit-trash", false,
-               "send trash requests (delete unreferenced old blocks, and excess replicas of overreplicated blocks)")
+       deprCommitPulls := flags.Bool("commit-pulls", true,
+               "send pull requests (must be true -- configure Collections.BalancePullLimit = 0 to disable.)")
+       deprCommitTrash := flags.Bool("commit-trash", true,
+               "send trash requests (must be true -- configure Collections.BalanceTrashLimit = 0 to disable.)")
        flags.BoolVar(&options.CommitConfirmedFields, "commit-confirmed-fields", true,
                "update collection fields (replicas_confirmed, storage_classes_confirmed, etc.)")
+       flags.StringVar(&options.ChunkPrefix, "chunk-prefix", "",
+               "operate only on blocks with the given prefix (experimental, see https://dev.arvados.org/issues/19923)")
        // These options are implemented by service.Command, so we
        // don't need the vars here -- we just need the flags
        // to pass flags.Parse().
@@ -53,6 +55,13 @@ func (command) RunCommand(prog string, args []string, stdin io.Reader, stdout, s
                return code
        }
 
+       if !*deprCommitPulls || !*deprCommitTrash {
+               fmt.Fprint(stderr,
+                       "Usage error: the -commit-pulls or -commit-trash command line flags are no longer supported.\n",
+                       "Use Collections.BalancePullLimit and Collections.BalanceTrashLimit instead.\n")
+               return cmd.EXIT_INVALIDARGUMENT
+       }
+
        // Drop our custom args that would be rejected by the generic
        // service.Command
        args = nil