Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-21745 Make HBCK2 be able to fix issues other than region assignment
  3. HBASE-22865

[HBCK2] shows the whole help/usage message after the error message

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • hbase-operator-tools-1.0.0
    • hbck2
    • None

    Description

      hbck2 shows the whole help/usage message after the error message. Operators/users need to scroll all the way up to find the error message. With the increasing client side support from hbck2 side, I reckon the usage message is only going to get bigger & bigger.

      See an example here:

      $ HBASE_CLASSPATH_PREFIX=~/dev/hbase-operator-tools/hbase-hbck2/target/hbase-hbck2-1.0.0-SNAPSHOT.jar ./bin/hbase org.apache.hbase.HBCK2 scheduleRecoveries
      ERROR: scheduleRecoveries takes one or more serverNames
      usage: HBCK2 [OPTIONS] COMMAND <ARGS>
      Options:
       -d,--debug                                       run with debug output
       -h,--help                                        output this help message
       -p,--hbase.zookeeper.property.clientPort <arg>   port of hbase ensemble
       -q,--hbase.zookeeper.quorum <arg>                hbase ensemble
       -s,--skip                                        skip hbase version check
                                                        (PleaseHoldException)
       -v,--version                                     this hbck2 version
       -z,--zookeeper.znode.parent <arg>                parent znode of hbase
                                                        ensemble
      Command:
       assigns [OPTIONS] <ENCODED_REGIONNAME>...
         Options:
          -o,--override  override ownership by another procedure
         A 'raw' assign that can be used even during Master initialization (if
         the -skip flag is specified). Skirts Coprocessors. Pass one or more
         encoded region names. 1588230740 is the hard-coded name for the
         hbase:meta region and de00010733901a05f5a2a3a382e27dd4 is an example of
         what a user-space encoded region name looks like. For example:
           $ HBCK2 assign 1588230740 de00010733901a05f5a2a3a382e27dd4
         Returns the pid(s) of the created AssignProcedure(s) or -1 if none.
      
       bypass [OPTIONS] <PID>...
         Options:
          -o,--override   override if procedure is running/stuck
          -r,--recursive  bypass parent and its children. SLOW! EXPENSIVE!
          -w,--lockWait   milliseconds to wait before giving up; default=1
         Pass one (or more) procedure 'pid's to skip to procedure finish. Parent
         of bypassed procedure will also be skipped to the finish. Entities will
         be left in an inconsistent state and will require manual fixup. May
         need Master restart to clear locks still held. Bypass fails if
         procedure has children. Add 'recursive' if all you have is a parent pid
         to finish parent and children. This is SLOW, and dangerous so use
         selectively. Does not always work.
      
       filesystem [OPTIONS] [<TABLENAME>...]
         Options:
          -f, --fix    sideline corrupt hfiles, bad links, and references.
         Report on corrupt hfiles, references, broken links, and integrity.
         Pass '--fix' to sideline corrupt files and links. '--fix' does NOT
         fix integrity issues; i.e. 'holes' or 'orphan' regions. Pass one or
         more tablenames to narrow checkup. Default checks all tables and
         restores 'hbase.version' if missing. Interacts with the filesystem
      only!
         Modified regions need to be reopened to pick-up changes.
      
       replication [OPTIONS] [<TABLENAME>...]
         Options:
          -f, --fix    fix any replication issues found.
         Looks for undeleted replication queues and deletes them if passed the
         '--fix' option. Pass a table name to check for replication barrier and
         purge if '--fix'.
      
       setRegionState <ENCODED_REGIONNAME> <STATE>
         Possible region states:
          OFFLINE, OPENING, OPEN, CLOSING, CLOSED, SPLITTING, SPLIT,
          FAILED_OPEN, FAILED_CLOSE, MERGING, MERGED, SPLITTING_NEW,
          MERGING_NEW, ABNORMALLY_CLOSED
         WARNING: This is a very risky option intended for use as last resort.
         Example scenarios include unassigns/assigns that can't move forward
         because region is in an inconsistent state in 'hbase:meta'. For
         example, the 'unassigns' command can only proceed if passed a region
         in one of the following states: SPLITTING|SPLIT|MERGING|OPEN|CLOSING
         Before manually setting a region state with this command, please
         certify that this region is not being handled by a running procedure,
         such as 'assign' or 'split'. You can get a view of running procedures
         in the hbase shell using the 'list_procedures' command. An example
         setting region 'de00010733901a05f5a2a3a382e27dd4' to CLOSING:
           $ HBCK2 setRegionState de00010733901a05f5a2a3a382e27dd4 CLOSING
         Returns "0" if region state changed and "1" otherwise.
      
       setTableState <TABLENAME> <STATE>
         Possible table states: ENABLED, DISABLED, DISABLING, ENABLING
         To read current table state, in the hbase shell run:
           hbase> get 'hbase:meta', '<TABLENAME>', 'table:state'
         A value of \x08\x00 == ENABLED, \x08\x01 == DISABLED, etc.
         Can also run a 'describe "<TABLENAME>"' at the shell prompt.
         An example making table name 'user' ENABLED:
           $ HBCK2 setTableState users ENABLED
         Returns whatever the previous table state was.
      
       scheduleRecoveries <SERVERNAME>...
         Schedule ServerCrashProcedure(SCP) for list of RegionServers. Format
         server name as '<HOSTNAME>,<PORT>,<STARTCODE>' (See HBase UI/logs).
         Example using RegionServer 'a.example.org,29100,1540348649479':
           $ HBCK2 scheduleRecoveries a.example.org,29100,1540348649479
         Returns the pid(s) of the created ServerCrashProcedure(s) or -1 if
         no procedure created (see master logs for why not).
         Command support added in hbase versions 2.0.3, 2.1.2, 2.2.0 or newer.
      
       unassigns <ENCODED_REGIONNAME>...
         Options:
          -o,--override  override ownership by another procedure
         A 'raw' unassign that can be used even during Master initialization
         (if the -skip flag is specified). Skirts Coprocessors. Pass one or
         more encoded region names. 1588230740 is the hard-coded name for the
         hbase:meta region and de00010733901a05f5a2a3a382e27dd4 is an example
         of what a userspace encoded region name looks like. For example:
           $ HBCK2 unassign 1588230740 de00010733901a05f5a2a3a382e27dd4
         Returns the pid(s) of the created UnassignProcedure(s) or -1 if none.
      
         SEE ALSO, org.apache.hbase.hbck1.OfflineMetaRepair, the offline
         hbase:meta tool. See the HBCK2 README for how to use.
      

      My suggestion:

      $ HBASE_CLASSPATH_PREFIX=~/dev/hbase-operator-tools/hbase-hbck2/target/hbase-hbck2-1.0.0-SNAPSHOT.jar ./bin/hbase org.apache.hbase.HBCK2 scheduleRecoveries
      ERROR: scheduleRecoveries takes one or more serverNames
      FOR USAGE, use the -h or --help option
      

      Or better, show the help message for each command separately on need basis like how we do for our shell. But we can start with the previous suggestion as of now.

      Attachments

        Issue Links

          Activity

            People

              sakthi Sakthi
              sakthi Sakthi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: