apache/hadoop · error · ParseException

May not pass both geteditsize and checkpoint

Error message

May not pass both geteditsize and checkpoint

What it means

CLI validation in CommandLineOpts.parse: both -geteditsize and -checkpoint were passed, but the secondary performs one action per invocation, so the mutually exclusive options are rejected.

Solutions

  1. Choose only one action: run the SecondaryNameNode with either -checkpoint or -geteditsize, not both.
Defensive patterns

Strategy: validation

When it happens

Trigger: The SecondaryNameNode command line includes mutually exclusive options.

Common situations: Running 'hdfs secondarynamenode -checkpoint -geteditsize' together.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/0cea6176f57aeea6. Report an issue: GitHub.

Appendix: source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java:838

    public boolean shouldPrintHelp() {
      return shouldPrintHelp;
    }
    
    public void parse(String ... argv) throws ParseException {
      CommandLineParser parser = new PosixParser();
      CommandLine cmdLine = parser.parse(options, argv);
      
      if (cmdLine.hasOption(helpOpt.getOpt())
          || cmdLine.hasOption(helpOpt.getLongOpt())) {
        shouldPrintHelp = true;
        return;
      }
      
      boolean hasGetEdit = cmdLine.hasOption(geteditsizeOpt.getOpt());
      boolean hasCheckpoint = cmdLine.hasOption(checkpointOpt.getOpt()); 
      if (hasGetEdit && hasCheckpoint) {
        throw new ParseException("May not pass both "
            + geteditsizeOpt.getOpt() + " and "
            + checkpointOpt.getOpt());
      }
      
      if (hasGetEdit) {
        cmd = Command.GETEDITSIZE;
      } else if (hasCheckpoint) {
        cmd = Command.CHECKPOINT;
        
        String arg = cmdLine.getOptionValue(checkpointOpt.getOpt());
        if ("force".equals(arg)) {
          shouldForce = true;
        } else if (arg != null) {
          throw new ParseException("-checkpoint may only take 'force' as an "
              + "argument");
        }
      }
      

View on GitHub (pinned to 2add963021)