Skip to content

Commit 6db6b9e

Browse files
committed
Address PR comments
Change-Id: Iac0de197dde0bc4b392ebe839b4619bc5ba68383
1 parent 9c64cae commit 6db6b9e

1 file changed

Lines changed: 23 additions & 30 deletions

File tree

hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestBackupRestoreBase.java

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ public abstract class IntegrationTestBackupRestoreBase extends IntegrationTestBa
9696
protected static String DEFAULT_BACKUP_ROOT_DIR = "backupIT";
9797

9898
// These test parameters can be configured using a Configuration object or via the command line.
99-
protected static int rowsInIteration = -1;
100-
protected static int regionsCountPerServer = -1;
101-
protected static int regionServerCount = -1;
102-
protected static int numIterations = -1;
103-
protected static int numTables = -1;
104-
protected static long sleepTime = -1;
99+
protected int rowsInIteration;
100+
protected int regionsCountPerServer;
101+
protected int regionServerCount;
102+
protected int numIterations;
103+
protected int numTables;
104+
protected long sleepTime;
105105

106106
protected static TableName[] tableNames;
107107
protected FileSystem fs;
@@ -725,35 +725,28 @@ protected void initializeTestParameters() {
725725
util = new IntegrationTestingUtility();
726726
conf = util.getConfiguration();
727727

728-
if (regionsCountPerServer == -1) {
729-
regionsCountPerServer = conf.getInt(REGION_COUNT_KEY, DEFAULT_REGION_COUNT);
730-
}
731-
LOG.info("regionsCountPerServer is set to {}", regionsCountPerServer);
728+
regionsCountPerServer = conf.getInt(REGION_COUNT_KEY,
729+
regionsCountPerServer > 0 ? regionsCountPerServer : DEFAULT_REGION_COUNT);
730+
LOG.debug("regionsCountPerServer is set to {}", regionsCountPerServer);
732731

733-
if (regionServerCount == -1) {
734-
regionServerCount = conf.getInt(REGIONSERVER_COUNT_KEY, DEFAULT_REGIONSERVER_COUNT);
735-
}
736-
LOG.info("regionServerCount is set to {}", regionServerCount);
732+
regionServerCount = conf.getInt(REGIONSERVER_COUNT_KEY,
733+
regionServerCount > 0 ? regionServerCount : DEFAULT_REGIONSERVER_COUNT);
734+
LOG.debug("regionServerCount is set to {}", regionServerCount);
737735

738-
if (rowsInIteration == -1) {
739-
rowsInIteration = conf.getInt(ROWS_PER_ITERATION_KEY, DEFAULT_ROWS_IN_ITERATION);
740-
}
741-
LOG.info("rowsInIteration is set to {}", rowsInIteration);
736+
rowsInIteration = conf.getInt(ROWS_PER_ITERATION_KEY,
737+
rowsInIteration > 0 ? rowsInIteration : DEFAULT_ROWS_IN_ITERATION);
738+
LOG.debug("rowsInIteration is set to {}", rowsInIteration);
742739

743-
if (numIterations == -1) {
744-
numIterations = conf.getInt(NUM_ITERATIONS_KEY, DEFAULT_NUM_ITERATIONS);
745-
}
746-
LOG.info("numIterations is set to {}", numIterations);
740+
numIterations =
741+
conf.getInt(NUM_ITERATIONS_KEY, numIterations > 0 ? numIterations : DEFAULT_NUM_ITERATIONS);
742+
LOG.debug("numIterations is set to {}", numIterations);
747743

748-
if (numTables == -1) {
749-
numTables = conf.getInt(NUMBER_OF_TABLES_KEY, DEFAULT_NUMBER_OF_TABLES);
750-
}
751-
LOG.info("numTables is set to {}", numTables);
744+
numTables =
745+
conf.getInt(NUMBER_OF_TABLES_KEY, numTables > 0 ? numTables : DEFAULT_NUMBER_OF_TABLES);
746+
LOG.debug("numTables is set to {}", numTables);
752747

753-
if (sleepTime == -1) {
754-
sleepTime = conf.getLong(SLEEP_TIME_KEY, SLEEP_TIME_DEFAULT);
755-
}
756-
LOG.info("sleepTime is set to {}", sleepTime);
748+
sleepTime = conf.getLong(SLEEP_TIME_KEY, sleepTime > 0 ? sleepTime : SLEEP_TIME_DEFAULT);
749+
LOG.debug("sleepTime is set to {}", sleepTime);
757750
}
758751

759752
@Override

0 commit comments

Comments
 (0)