@ SuppressWarnings ( "unchecked" ) public static void executeCommand ( String [ ] args ) throws IOException { OptionParser parser = getParser ( ) ; // declare parameters List < String > metaKeys = null ; String url = null ; // parse command-line input args = AdminToolUtils . copyArrayAddFirst ( args , "--" + OPT_HEAD_META_CHECK ) ; OptionSet options = parser . parse ( args ) ; if ( options . has ( AdminParserUtils . OPT_HELP ) ) { printHelp ( System . out ) ; return ; } // check required options and/or conflicting options AdminParserUtils . checkRequired ( options , OPT_HEAD_META_CHECK ) ; AdminParserUtils . checkRequired ( options , AdminParserUtils . OPT_URL ) ; // load parameters metaKeys = ( List < String > ) options . valuesOf ( OPT_HEAD_META_CHECK ) ; url = ( String ) options . valueOf ( AdminParserUtils . OPT_URL ) ; // execute command if ( metaKeys . size ( ) == 0 || ( metaKeys . size ( ) == 1 && metaKeys . get ( 0 ) . equals ( METAKEY_ALL ) ) ) { metaKeys = Lists . newArrayList ( ) ; metaKeys . add ( MetadataStore . CLUSTER_KEY ) ; metaKeys . add ( MetadataStore . STORES_KEY ) ; metaKeys . add ( MetadataStore . SERVER_STATE_KEY ) ; } AdminClient adminClient = AdminToolUtils . getAdminClient ( url ) ; doMetaCheck ( adminClient , metaKeys ) ; }
Parses command - line and checks if metadata is consistent across all nodes .