Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 d1110364c -> 94a602ef6
PHOENIX-1873 Fix compilation errors in Pherf (Cody Marcel, James Taylor) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/94a602ef Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/94a602ef Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/94a602ef Branch: refs/heads/4.x-HBase-0.98 Commit: 94a602ef68050ae45ba7331553ddecf50e788c85 Parents: d111036 Author: James Taylor <[email protected]> Authored: Tue Apr 21 16:21:17 2015 -0700 Committer: James Taylor <[email protected]> Committed: Tue Apr 21 16:22:42 2015 -0700 ---------------------------------------------------------------------- .../phoenix/pherf/configuration/DataModel.java | 11 ++- .../pherf/configuration/DataOverride.java | 3 +- .../pherf/configuration/DataTypeMapping.java | 5 +- .../phoenix/pherf/configuration/QuerySet.java | 14 +++- .../phoenix/pherf/configuration/Scenario.java | 13 ++++ .../pherf/configuration/XMLConfigParser.java | 1 + .../pherf/exception/FileLoaderException.java | 4 +- .../exception/FileLoaderRuntimeException.java | 1 + .../phoenix/pherf/jmx/MonitorManager.java | 1 + .../pherf/jmx/monitors/ExampleMonitor.java | 33 --------- .../phoenix/pherf/loaddata/DataLoader.java | 37 ---------- .../pherf/result/DataLoadThreadTime.java | 19 +----- .../pherf/result/DataLoadTimeSummary.java | 17 ----- .../phoenix/pherf/result/DataModelResult.java | 1 + .../phoenix/pherf/result/QueryResult.java | 2 + .../phoenix/pherf/result/QuerySetResult.java | 3 +- .../org/apache/phoenix/pherf/result/Result.java | 10 ++- .../apache/phoenix/pherf/result/ResultUtil.java | 71 -------------------- .../apache/phoenix/pherf/result/RunTime.java | 23 ++++--- .../phoenix/pherf/result/ScenarioResult.java | 1 + .../apache/phoenix/pherf/result/ThreadTime.java | 1 + .../pherf/result/impl/CSVResultHandler.java | 21 +++--- .../apache/phoenix/pherf/util/PhoenixUtil.java | 4 +- .../apache/phoenix/pherf/util/ResourceList.java | 13 ---- .../phoenix/pherf/workload/QueryExecutor.java | 2 - .../phoenix/pherf/BaseTestWithCluster.java | 22 ------ .../phoenix/pherf/ConfigurationParserTest.java | 8 ++- .../apache/phoenix/pherf/DataLoaderTest.java | 14 ---- 28 files changed, 96 insertions(+), 259 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataModel.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataModel.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataModel.java index d60fd9c..25c0df1 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataModel.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataModel.java @@ -71,5 +71,14 @@ public class DataModel { public void setName(String name) { this.name = name; } -} + @Override + public String toString() { + StringBuilder stringBuilder = new StringBuilder(); + for (Scenario scenario : getScenarios()) { + stringBuilder.append("Scenario: " + scenario.getName()); + stringBuilder.append("[" + scenario + "]"); + } + return stringBuilder.toString(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataOverride.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataOverride.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataOverride.java index 91d2dc2..47faa62 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataOverride.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataOverride.java @@ -30,7 +30,8 @@ public class DataOverride { return column; } - public void setColumn(List<Column> column) { + @SuppressWarnings("unused") + public void setColumn(List<Column> column) { this.column = column; } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataTypeMapping.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataTypeMapping.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataTypeMapping.java index 99d765c..c266a57 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataTypeMapping.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/DataTypeMapping.java @@ -28,6 +28,7 @@ public enum DataTypeMapping { DATE("DATE", Types.DATE); private final String sType; + private final int dType; private DataTypeMapping(String sType, int dType) { @@ -40,7 +41,7 @@ public enum DataTypeMapping { return this.sType; } - public int getType() { - return this.dType; + public int getdType() { + return dType; } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/QuerySet.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/QuerySet.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/QuerySet.java index 3ab300c..17d4153 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/QuerySet.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/QuerySet.java @@ -40,7 +40,8 @@ public class QuerySet { return query; } - public void setQuery(List<Query> query) { + @SuppressWarnings("unused") + public void setQuery(List<Query> query) { this.query = query; } @@ -126,5 +127,14 @@ public class QuerySet { public void setExecutionDurationInMs(long executionDurationInMs) { this.executionDurationInMs = executionDurationInMs; - } + } + + @Override + public String toString() { + StringBuilder stringBuilder = new StringBuilder(); + for (Query q : query) { + stringBuilder.append(q.getStatement() + ","); + } + return stringBuilder.toString(); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/Scenario.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/Scenario.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/Scenario.java index f75e528..d2f113a 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/Scenario.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/Scenario.java @@ -124,6 +124,7 @@ public class Scenario { return querySet; } + @SuppressWarnings("unused") public void setQuerySet(List<QuerySet> querySet) { this.querySet = querySet; } @@ -160,4 +161,16 @@ public class Scenario { this.name = name; } + @Override + public String toString() { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("Name:" + name); + stringBuilder.append("Table Name:" + tableName); + stringBuilder.append("Row Count:" + rowCount); + stringBuilder.append("Data Override:" + dataOverride); + for (QuerySet query : querySet) { + stringBuilder.append(query + ";"); + } + return stringBuilder.toString(); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java index a288e1b..9b5a9e9 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java @@ -119,6 +119,7 @@ public class XMLConfigParser { } // TODO Remove static calls + @SuppressWarnings("unused") public static void writeDataModel(DataModel data, OutputStream output) throws JAXBException { // create JAXB context and initializing Marshaller JAXBContext jaxbContext = JAXBContext.newInstance(DataModel.class); http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/exception/FileLoaderException.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/exception/FileLoaderException.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/exception/FileLoaderException.java index 63784eb..99bbb0d 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/exception/FileLoaderException.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/exception/FileLoaderException.java @@ -22,7 +22,9 @@ public class FileLoaderException extends PherfException { public FileLoaderException(String message) throws Exception { super(message); } + + @SuppressWarnings("unused") public FileLoaderException(String message, Exception e) { super(message, e); } -} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/exception/FileLoaderRuntimeException.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/exception/FileLoaderRuntimeException.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/exception/FileLoaderRuntimeException.java index 4ab751b..e82e885 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/exception/FileLoaderRuntimeException.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/exception/FileLoaderRuntimeException.java @@ -19,6 +19,7 @@ package org.apache.phoenix.pherf.exception; public class FileLoaderRuntimeException extends PherfRuntimeException { + @SuppressWarnings("unused") public FileLoaderRuntimeException(String message) throws Exception { super(message); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java index 391db58..9f46cf7 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java @@ -51,6 +51,7 @@ public class MonitorManager implements Runnable { private volatile boolean shouldStop = false; private volatile boolean isRunning = false; + @SuppressWarnings("unused") public MonitorManager() throws Exception { this(PherfConstants.MONITOR_FREQUENCY); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/monitors/ExampleMonitor.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/monitors/ExampleMonitor.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/monitors/ExampleMonitor.java deleted file mode 100644 index 1dd72e7..0000000 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/monitors/ExampleMonitor.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.phoenix.pherf.jmx.monitors; - -import org.apache.phoenix.pherf.jmx.Stat; - -import java.util.concurrent.atomic.AtomicLong; - -public class ExampleMonitor implements Monitor { - private final AtomicLong counter = new AtomicLong(); - - @Override - public Stat getStat() { - Stat<Long> stat = new Stat(new Long(counter.getAndIncrement())); - return stat; - } -} http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/loaddata/DataLoader.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/loaddata/DataLoader.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/loaddata/DataLoader.java index 8ddce34..bb7a929 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/loaddata/DataLoader.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/loaddata/DataLoader.java @@ -58,7 +58,6 @@ public class DataLoader { private final RulesApplier rulesApplier; private final ResultUtil resultUtil; private final ExecutorService pool; - private final Properties properties; private final int threadPoolSize; private final int batchSize; @@ -75,7 +74,6 @@ public class DataLoader { */ public DataLoader(Properties properties, XMLConfigParser parser) throws Exception { this.parser = parser; - this.properties = properties; this.rulesApplier = new RulesApplier(this.parser); this.resultUtil = new ResultUtil(); int size = Integer.parseInt(properties.getProperty("pherf.default.dataloader.threadpool")); @@ -154,41 +152,6 @@ public class DataLoader { pUtil.executeStatement("UPDATE STATISTICS " + tableName); } - public void printTableColumns(Scenario scenario) throws Exception { - Connection connection = null; - try { - connection = pUtil.getConnection(); - List<Column> columnList = pUtil.getColumnsFromPhoenix( - scenario.getSchemaName(), - scenario.getTableNameWithoutSchemaName(), connection); - - logger.debug("\n\nColumns from metadata:"); - for (Column column : columnList) { - logger.debug("\nColumn name: [" + column.getName() - + "]; type: [" + column.getType() + "]; length: [" - + column.getLength() + "]"); - } - - if (null != scenario.getDataOverride()) { - logger.debug("\n\nColumns from override:"); - for (Column column : scenario.getDataOverride().getColumn()) { - logger.debug("\nColumn name: [" + column.getName() + "]; DataSequence: [" + column.getDataSequence() - + "]; length: [" + column.getLength() + "]"); - } - } - - } finally { - if (connection != null) { - try { - connection.close(); - } catch (SQLException e) { - // Swallow since we are closing anyway - e.printStackTrace(); - } - } - } - } - public Future<Info> upsertData(final Scenario scenario, final List<Column> columns, final String tableName, final int rowCount, final DataLoadThreadTime dataLoadThreadTime) { http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataLoadThreadTime.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataLoadThreadTime.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataLoadThreadTime.java index 47aa2bc..23dcdd5 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataLoadThreadTime.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataLoadThreadTime.java @@ -30,10 +30,6 @@ public class DataLoadThreadTime { return threadTime; } - public void setThreadTime(List<WriteThreadTime> threadTime) { - this.threadTime = threadTime; - } - public void add(String tableName, String threadName, int rowsUpserted, long timeInMsPerMillionRows) { threadTime.add(new WriteThreadTime(tableName, threadName, rowsUpserted, timeInMsPerMillionRows)); } @@ -59,22 +55,13 @@ class WriteThreadTime { public String getTableName() { return tableName; } - public void setTableName(String tableName) { - this.tableName = tableName; - } public String getThreadName() { return threadName; } - public void setThreadName(String threadName) { - this.threadName = threadName; - } public long getTimeInMsPerMillionRows() { return timeInMsPerMillionRows; } - public void setTimeInMsPerMillionRows(long timeInMsPerMillionRows) { - this.timeInMsPerMillionRows = timeInMsPerMillionRows; - } - + public List<ResultValue> getCsvRepresentation(ResultUtil util) { List<ResultValue> rowValues = new ArrayList<>(); rowValues.add(new ResultValue(util.convertNull(getTableName()))); @@ -88,8 +75,4 @@ class WriteThreadTime { public int getRowsUpserted() { return rowsUpserted; } - - public void setRowsUpserted(int rowsUpserted) { - this.rowsUpserted = rowsUpserted; - } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataLoadTimeSummary.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataLoadTimeSummary.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataLoadTimeSummary.java index ae4838b..bb23f16 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataLoadTimeSummary.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataLoadTimeSummary.java @@ -31,11 +31,6 @@ public class DataLoadTimeSummary { public void add(String tableName, int rowCount, int durationInMs) { tableLoadTime.add(new TableLoadTime(tableName, rowCount, durationInMs)); } - - public void setTableLoadTime(List<TableLoadTime> tableLoadTime) { - this.tableLoadTime = tableLoadTime; - } - } class TableLoadTime { @@ -62,23 +57,11 @@ class TableLoadTime { return durationInMs; } - public void setDurationInMs(int durationInMs) { - this.durationInMs = durationInMs; - } - public String getTableName() { return tableName; } - public void setTableName(String tableName) { - this.tableName = tableName; - } - public int getRowCount() { return rowCount; } - - public void setRowCount(int rowCount) { - this.rowCount = rowCount; - } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataModelResult.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataModelResult.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataModelResult.java index 71ffeaf..72920fa 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataModelResult.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/DataModelResult.java @@ -35,6 +35,7 @@ public class DataModelResult extends DataModel { return scenarioResult; } + @SuppressWarnings("unused") public void setScenarioResult(List<ScenarioResult> scenarioResult) { this.scenarioResult = scenarioResult; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/QueryResult.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/QueryResult.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/QueryResult.java index ac50301..b5fd082 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/QueryResult.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/QueryResult.java @@ -33,6 +33,7 @@ public class QueryResult extends Query { return this.threadTimes; } + @SuppressWarnings("unused") public synchronized void setThreadTimes(List<ThreadTime> threadTimes) { this.threadTimes = threadTimes; } @@ -46,6 +47,7 @@ public class QueryResult extends Query { this.setId(query.getId()); } + @SuppressWarnings("unused") public QueryResult() { } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/QuerySetResult.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/QuerySetResult.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/QuerySetResult.java index c76c2e5..9010c21 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/QuerySetResult.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/QuerySetResult.java @@ -41,7 +41,8 @@ public class QuerySetResult extends QuerySet { return queryResults; } - public void setQueryResults(List<QueryResult> queryResults) { + @SuppressWarnings("unused") + public void setQueryResults(List<QueryResult> queryResults) { this.queryResults = queryResults; } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/Result.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/Result.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/Result.java index 104e388..4ccdd2b 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/Result.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/Result.java @@ -18,15 +18,17 @@ package org.apache.phoenix.pherf.result; -import org.apache.phoenix.pherf.result.file.ResultFileDetails; - import java.util.List; +import org.apache.phoenix.pherf.result.file.ResultFileDetails; + /** * Common container for Pherf results. */ public class Result { private final List<ResultValue> resultValues; + + // Placeholder for future work private final ResultFileDetails type; private final String header; @@ -51,4 +53,8 @@ public class Result { public String getHeader() { return header; } + + public ResultFileDetails getType() { + return type; + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ResultUtil.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ResultUtil.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ResultUtil.java index a2660a0..360cb49 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ResultUtil.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ResultUtil.java @@ -38,59 +38,6 @@ public class ResultUtil { private static String FILE_SUFFIX = null; /** - * Overload for write all results type to file - * <p/> - * TODO Remove when we are sure results are stable. Currently there are no more references to this. - * - * @param dataModelResult - * @param fileName - * @throws javax.xml.bind.JAXBException - * @throws IOException - */ - public synchronized void writeResultToFile(DataModelResult dataModelResult, String fileName, RunMode runMode) throws Exception { - - ResultHandler detailsCSVHandler; - ResultHandler aggregateCSVHandler; - ResultHandler xmlResultHandler; - ResultHandler imageResultHandler; - List<ResultHandler> handlers = new ArrayList<>(); - try { - ensureBaseResultDirExists(); - final DataModelResult dataModelResultCopy = new DataModelResult(dataModelResult); - - detailsCSVHandler = new CSVResultHandler(fileName, ResultFileDetails.CSV_DETAILED_PERFORMANCE); - handlers.add(detailsCSVHandler); - xmlResultHandler = new XMLResultHandler(fileName, ResultFileDetails.XML); - handlers.add(xmlResultHandler); - aggregateCSVHandler = new CSVResultHandler(fileName, ResultFileDetails.CSV_AGGREGATE_PERFORMANCE); - handlers.add(aggregateCSVHandler); - imageResultHandler = new ImageResultHandler(fileName, ResultFileDetails.IMAGE); - handlers.add(imageResultHandler); - - // XML results - write(xmlResultHandler, dataModelResultCopy, runMode); - // JPG result visualization - write(imageResultHandler, dataModelResultCopy, runMode); - // CSV results - write(aggregateCSVHandler, dataModelResultCopy, runMode); - // CSV results details - write(detailsCSVHandler, dataModelResultCopy, runMode); - - } finally { - for (ResultHandler handler : handlers) { - try { - if (handler != null) { - handler.flush(); - handler.close(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } - } - - /** * Write data load time details * * @param dataLoadThreadTime {@link DataLoadThreadTime} @@ -147,24 +94,6 @@ public class ResultUtil { } } - // TODO remove when stable. There are no more references to this method. - public synchronized void write(List<DataModelResult> dataModelResults, RunMode runMode) throws Exception { - ensureBaseResultDirExists(); - - CSVResultHandler detailsCSVWriter = null; - try { - detailsCSVWriter = new CSVResultHandler(PherfConstants.COMBINED_FILE_NAME, ResultFileDetails.CSV_DETAILED_PERFORMANCE); - for (DataModelResult dataModelResult : dataModelResults) { - write(detailsCSVWriter, dataModelResult, runMode); - } - } finally { - if (detailsCSVWriter != null) { - detailsCSVWriter.flush(); - detailsCSVWriter.close(); - } - } - } - public synchronized void write(ResultHandler resultHandler, DataModelResult dataModelResult, RunMode runMode) throws Exception { ResultFileDetails resultFileDetails = resultHandler.getResultFileDetails(); switch (resultFileDetails) { http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/RunTime.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/RunTime.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/RunTime.java index 3a9f40c..690f7e6 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/RunTime.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/RunTime.java @@ -30,7 +30,12 @@ public class RunTime implements Comparator<RunTime>, Comparable<RunTime> { private Long resultRowCount; private String explainPlan; - public RunTime(Integer elapsedDurationInMs) { + @SuppressWarnings("unused") + public RunTime() { + } + + @SuppressWarnings("unused") + public RunTime(Integer elapsedDurationInMs) { this(null, elapsedDurationInMs); } @@ -53,15 +58,13 @@ public class RunTime implements Comparator<RunTime>, Comparable<RunTime> { this.message = message; this.explainPlan = explainPlan; } - - public RunTime() { - } - + @XmlAttribute() public Date getStartTime() { return startTime; } + @SuppressWarnings("unused") public void setStartTime(Date startTime) { this.startTime = startTime; } @@ -71,7 +74,8 @@ public class RunTime implements Comparator<RunTime>, Comparable<RunTime> { return elapsedDurationInMs; } - public void setElapsedDurationInMs(Integer elapsedDurationInMs) { + @SuppressWarnings("unused") + public void setElapsedDurationInMs(Integer elapsedDurationInMs) { this.elapsedDurationInMs = elapsedDurationInMs; } @@ -90,7 +94,8 @@ public class RunTime implements Comparator<RunTime>, Comparable<RunTime> { return message; } - public void setMessage(String message) { + @SuppressWarnings("unused") + public void setMessage(String message) { this.message = message; } @@ -99,7 +104,8 @@ public class RunTime implements Comparator<RunTime>, Comparable<RunTime> { return explainPlan; } - public void setExplainPlan(String explainPlan) { + @SuppressWarnings("unused") + public void setExplainPlan(String explainPlan) { this.explainPlan = explainPlan; } @@ -108,6 +114,7 @@ public class RunTime implements Comparator<RunTime>, Comparable<RunTime> { return resultRowCount; } + @SuppressWarnings("unused") public void setResultRowCount(Long resultRowCount) { this.resultRowCount = resultRowCount; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ScenarioResult.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ScenarioResult.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ScenarioResult.java index 900860a..b57e424 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ScenarioResult.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ScenarioResult.java @@ -30,6 +30,7 @@ public class ScenarioResult extends Scenario { return querySetResult; } + @SuppressWarnings("unused") public void setQuerySetResult(List<QuerySetResult> querySetResult) { this.querySetResult = querySetResult; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ThreadTime.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ThreadTime.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ThreadTime.java index 89e4aa6..f043bec 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ThreadTime.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ThreadTime.java @@ -33,6 +33,7 @@ public class ThreadTime { return this.runTimesInMs; } + @SuppressWarnings("unused") public synchronized void setRunTimesInMs(List<RunTime> runTimesInMs) { this.runTimesInMs = runTimesInMs; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/CSVResultHandler.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/CSVResultHandler.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/CSVResultHandler.java index d7248fa..ca470de 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/CSVResultHandler.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/CSVResultHandler.java @@ -18,23 +18,23 @@ package org.apache.phoenix.pherf.result.impl; -import org.apache.phoenix.pherf.PherfConstants; -import org.apache.phoenix.pherf.result.file.ResultFileDetails; +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; + import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVPrinter; import org.apache.commons.csv.CSVRecord; +import org.apache.phoenix.pherf.PherfConstants; import org.apache.phoenix.pherf.result.Result; import org.apache.phoenix.pherf.result.ResultHandler; import org.apache.phoenix.pherf.result.ResultUtil; import org.apache.phoenix.pherf.result.ResultValue; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; +import org.apache.phoenix.pherf.result.file.ResultFileDetails; /** * TODO Doc this class. Note that each instance that has a non unique file name will overwrite the last @@ -123,7 +123,8 @@ public class CSVResultHandler implements ResultHandler { return; } csvPrinter = new CSVPrinter(new PrintWriter(resultFileName), CSVFormat.DEFAULT); - csvPrinter.printRecord(result.getHeader().split(PherfConstants.RESULT_FILE_DELIMETER)); + Object[] records = result.getHeader().split(PherfConstants.RESULT_FILE_DELIMETER); + csvPrinter.printRecord(records); isClosed = false; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/PhoenixUtil.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/PhoenixUtil.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/PhoenixUtil.java index 7836ea3..0959700 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/PhoenixUtil.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/PhoenixUtil.java @@ -100,7 +100,8 @@ public class PhoenixUtil { } return result; } - + + @SuppressWarnings("unused") public boolean executeStatement(PreparedStatement preparedStatement, Connection connection) { boolean result = false; try { @@ -112,6 +113,7 @@ public class PhoenixUtil { return result; } + @SuppressWarnings("unused") public ResultSet executeQuery(PreparedStatement preparedStatement, Connection connection) { ResultSet resultSet = null; try { http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java index 2d6e77d..0677dae 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java @@ -130,19 +130,6 @@ public class ResourceList { return pherfProps; } - /** - * Utility method to check if base result dir exists - */ - public void ensureBaseDirExists(String directory) { - File baseDir = new File(directory); - if (!baseDir.exists()) { - boolean made = baseDir.mkdir(); - if (!made) { - logger.error("Could not make directory:" + directory); - } - } - } - private Collection<String> getResources( final String element, final Pattern pattern) { http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/workload/QueryExecutor.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/workload/QueryExecutor.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/workload/QueryExecutor.java index 5be5fc0..6f6e000 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/workload/QueryExecutor.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/workload/QueryExecutor.java @@ -44,11 +44,9 @@ public class QueryExecutor { private List<DataModel> dataModels; private String queryHint; private RunMode runMode; - private final ResultUtil resultUtil; public QueryExecutor(XMLConfigParser parser) { this.dataModels = parser.getDataModels(); - this.resultUtil = new ResultUtil(); } /** http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/BaseTestWithCluster.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/BaseTestWithCluster.java b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/BaseTestWithCluster.java index d4f3633..8e33a15 100644 --- a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/BaseTestWithCluster.java +++ b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/BaseTestWithCluster.java @@ -42,26 +42,4 @@ public class BaseTestWithCluster { PhoenixUtil.setZookeeper(zookeeper); logger.info("Using quorum:" + zookeeper); } - - /** - * Get the configuration for what scenarios will run and how. - * - * @return {@link java.nio.file.Path} - */ - public Path getTestConfiguration() { - URL resourceUrl = getUrl(); - assertNotNull("Test data XML file is missing", resourceUrl); - Path resourcePath = null; - try { - resourcePath = Paths.get(resourceUrl.toURI()); - } catch (URISyntaxException e) { - e.printStackTrace(); - } - return resourcePath; - } - - public URL getUrl() { - return getClass().getResource("/scenario/test_scenario.xml"); - } - } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ConfigurationParserTest.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ConfigurationParserTest.java b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ConfigurationParserTest.java index 769bdc0..080c0f3 100644 --- a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ConfigurationParserTest.java +++ b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ConfigurationParserTest.java @@ -62,7 +62,8 @@ public class ConfigurationParserTest { assertNotNull("Test data XML file is missing", resourceUrl); try { -// writeXML(); + + logger.debug("DataModel: " + writeXML()); Path resourcePath = Paths.get(resourceUrl.toURI()); DataModel data = XMLConfigParser.readDataModel(resourcePath); List<Scenario> scenarioList = data.getScenarios(); @@ -138,7 +139,8 @@ public class ConfigurationParserTest { /* Used for debugging to dump out a simple xml filed based on the bound objects. */ - private void writeXML() { + private String writeXML() { + DataModel data = new DataModel(); try { DataValue dataValue = new DataValue(); dataValue.setDistribution(20); @@ -154,7 +156,6 @@ public class ConfigurationParserTest { List<Column> columnList = new ArrayList<>(); columnList.add(column); - DataModel data = new DataModel(); data.setRelease("192"); data.setDataMappingColumns(columnList); @@ -196,5 +197,6 @@ public class ConfigurationParserTest { // some exception occured e.printStackTrace(); } + return data.toString(); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a602ef/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/DataLoaderTest.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/DataLoaderTest.java b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/DataLoaderTest.java index b3d3946..f4d676e 100644 --- a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/DataLoaderTest.java +++ b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/DataLoaderTest.java @@ -29,20 +29,6 @@ import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.fail; public class DataLoaderTest extends BaseTestWithCluster { - private static XMLConfigParser parser = null; - private static DataModel model = null; - private DataLoader loader = null; - - @BeforeClass - public static void init() { - - try { - parser = new XMLConfigParser(matcherScenario); - model = parser.getDataModels().get(0); - } catch (Exception e) { - fail("Failed to initialize test: " + e.getMessage()); - } - } /** * Test rows divide evenly with large rows and small threadpool
