@@ -360,11 +360,14 @@ static boolean checkTable(Admin admin, TestOptions opts) throws IOException {
360360 // recreate the table when user has requested presplit or when existing
361361 // {RegionSplitPolicy,replica count} does not match requested, or when the
362362 // number of column families does not match requested.
363- if ((exists && opts .presplitRegions != DEFAULT_OPTS .presplitRegions
363+ if (
364+ (exists && opts .presplitRegions != DEFAULT_OPTS .presplitRegions
364365 && opts .presplitRegions != admin .getRegions (tableName ).size ())
365- || (!isReadCmd && desc != null && !StringUtils .equals (desc .getRegionSplitPolicyClassName (), opts .splitPolicy ))
366+ || (!isReadCmd && desc != null
367+ && !StringUtils .equals (desc .getRegionSplitPolicyClassName (), opts .splitPolicy ))
366368 || (!isReadCmd && desc != null && desc .getRegionReplication () != opts .replicas )
367- || (desc != null && desc .getColumnFamilyCount () != opts .families )) {
369+ || (desc != null && desc .getColumnFamilyCount () != opts .families )
370+ ) {
368371 needsDelete = true ;
369372 // wait, why did it delete my table?!?
370373 LOG .debug (MoreObjects .toStringHelper ("needsDelete" ).add ("needsDelete" , needsDelete )
@@ -786,11 +789,11 @@ public TestOptions(TestOptions that) {
786789 this .bufferSize = that .bufferSize ;
787790 this .commandProperties = that .commandProperties ;
788791 }
789-
792+
790793 public Properties getCommandProperties () {
791794 return commandProperties ;
792795 }
793-
796+
794797 public int getCaching () {
795798 return this .caching ;
796799 }
@@ -2586,7 +2589,7 @@ protected static void printUsage(final String shortName, final String message) {
25862589 System .err .println (message );
25872590 }
25882591 System .err .print ("Usage: hbase " + shortName );
2589- System .err .println (" <OPTIONS> [-D<property=value>]* <command> <nclients>" );
2592+ System .err .println (" <OPTIONS> [-D<property=value>]* <command|class > <nclients>" );
25902593 System .err .println ();
25912594 System .err .println ("General Options:" );
25922595 System .err .println (
@@ -2686,7 +2689,10 @@ protected static void printUsage(final String shortName, final String message) {
26862689 for (CmdDescriptor command : COMMANDS .values ()) {
26872690 System .err .println (String .format (" %-20s %s" , command .getName (), command .getDescription ()));
26882691 }
2689- System .err .println (String .format (" %-20s %s" , "? extends Test" , "Run custom implementation of provided Test present in classpath" ));
2692+ System .err .println ();
2693+ System .err .println ("Class:" );
2694+ System .err .println ("To run any custom implementation of PerformanceEvaluation.Test, provide the classname of the implementaion class in place of command name and it will be loaded at runtime from classpath.:" );
2695+ System .err .println ("Please consider to contribute back this custom test impl into a builtin PE command for the benefit of the community" );
26902696 System .err .println ();
26912697 System .err .println ("Args:" );
26922698 System .err .println (" nclients Integer. Required. Total number of clients "
@@ -2987,14 +2993,15 @@ static TestOptions parseOpts(Queue<String> args) {
29872993 String fileName = String .valueOf (cmd .substring (commandPropertiesFile .length ()));
29882994 Properties properties = new Properties ();
29892995 try {
2990- properties .load (PerformanceEvaluation .class .getClassLoader ().getResourceAsStream (fileName ));
2996+ properties
2997+ .load (PerformanceEvaluation .class .getClassLoader ().getResourceAsStream (fileName ));
29912998 opts .commandProperties = properties ;
29922999 } catch (IOException e ) {
29933000 LOG .error ("Failed to load metricIds from properties file" , e );
29943001 }
29953002 continue ;
29963003 }
2997-
3004+
29983005 validateParsedOpts (opts );
29993006
30003007 if (isCommandClass (cmd )) {
@@ -3114,15 +3121,16 @@ private static boolean isCommandClass(String cmd) {
31143121 private static boolean isCustomTestClass (String cmd ) {
31153122 Class <? extends Test > cmdClass ;
31163123 try {
3117- cmdClass = (Class <? extends Test >) PerformanceEvaluation .class .getClassLoader ().loadClass (cmd );
3124+ cmdClass =
3125+ (Class <? extends Test >) PerformanceEvaluation .class .getClassLoader ().loadClass (cmd );
31183126 addCommandDescriptor (cmdClass , cmd , "custom command" );
31193127 return true ;
31203128 } catch (Throwable th ) {
31213129 LOG .info ("No class found for command: " + cmd , th );
31223130 return false ;
31233131 }
31243132 }
3125-
3133+
31263134 private static Class <? extends TestBase > determineCommandClass (String cmd ) {
31273135 CmdDescriptor descriptor = COMMANDS .get (cmd );
31283136 return descriptor != null ? descriptor .getCmdClass () : null ;
0 commit comments