Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1k
merging latest avatica#157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
3f786f0e16a23b26ead8d1a4277bfefad56a61f324a2959dc3d3a22c231fd934c2c056cdcff31476ee0b522e306ad5e36c7d55a53b9b2f08731351e0728f929d0f422413aa954c2631a2babed536aae6ecf0fced01c5e13d2b08fb49ba0fb95369c2d0d8ed940cf0c0a5fcecc3b92cf2ed5f257File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -25,7 +25,8 @@ public enum DataTypeMapping { | ||
| CHAR("CHAR", Types.CHAR), | ||
| DECIMAL("DECIMAL", Types.DECIMAL), | ||
| INTEGER("INTEGER", Types.INTEGER), | ||
| DATE("DATE", Types.DATE); | ||
| DATE("DATE", Types.DATE), | ||
| YCSBKEY("YCSBKEY", Types.VARCHAR); | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: formatting | ||
| private final String sType; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -31,7 +31,24 @@ public class QuerySet { | ||
| private long numberOfExecutions = PherfConstants.DEFAULT_NUMBER_OF_EXECUTIONS; | ||
| private long executionDurationInMs = PherfConstants.DEFAULT_THREAD_DURATION_IN_MS; | ||
| private ExecutionType executionType = ExecutionType.SERIAL; | ||
| private boolean randomPointRead = false; | ||
| private String primaryKey = PherfConstants.DEFAULT_PRIMARY_KEY; | ||
| @XmlAttribute | ||
| public String getPrimaryKey() { | ||
| return primaryKey; | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: more formatting. Make sure you import the code stye preferences into your project. | ||
| } | ||
| public void setPrimaryKey(String pk){ | ||
| primaryKey=pk; | ||
| } | ||
| @XmlAttribute | ||
| public boolean isRandomPointRead() { | ||
| return randomPointRead; | ||
| } | ||
| public void setRandomPointRead(boolean value) { | ||
| randomPointRead = value; | ||
| } | ||
| /** | ||
| * List of queries in each query set | ||
| * @return | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -23,6 +23,7 @@ | ||
| import java.sql.Date; | ||
| import java.sql.PreparedStatement; | ||
| import java.sql.SQLException; | ||
| import java.sql.Statement; | ||
| import java.sql.Types; | ||
| import java.text.SimpleDateFormat; | ||
| import java.util.ArrayList; | ||
| @@ -242,6 +243,7 @@ public Future<Info> upsertData(final Scenario scenario, final List<Column> colum | ||
| SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| Connection connection = null; | ||
| PreparedStatement stmt = null; | ||
| try { | ||
| connection = pUtil.getConnection(scenario.getTenantId()); | ||
| long logStartTime = System.currentTimeMillis(); | ||
| @@ -253,13 +255,22 @@ public Future<Info> upsertData(final Scenario scenario, final List<Column> colum | ||
| last = start = System.currentTimeMillis(); | ||
| String sql = buildSql(columns, tableName); | ||
| //System.out.print("going to create statement"); | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove commented out code. | ||
| //System.out.print("statement created"); | ||
| stmt = connection.prepareStatement(sql); | ||
| for (long i = rowCount; (i > 0) && ((System.currentTimeMillis() - logStartTime) | ||
| < maxDuration); i--) { | ||
| stmt = buildStatement(scenario, columns, stmt, simpleDateFormat); | ||
| rowsCreated += stmt.executeUpdate(); | ||
| stmt = buildStatement(scenario, columns, stmt, simpleDateFormat); | ||
| //System.out.print(stmt); | ||
| stmt.addBatch(); | ||
| //rowsCreated += stmt.executeUpdate(); | ||
| if ((i % getBatchSize()) == 0) { | ||
| //System.out.print("Executing batch"); | ||
| stmt.executeBatch(); | ||
| connection.commit(); | ||
| //stmt.clearBatch(); | ||
| duration = System.currentTimeMillis() - last; | ||
| logger.info("Writer (" + Thread.currentThread().getName() | ||
| + ") committed Batch. Total " + getBatchSize() | ||
| @@ -281,6 +292,8 @@ public Future<Info> upsertData(final Scenario scenario, final List<Column> colum | ||
| } | ||
| } finally { | ||
| if (stmt != null) { | ||
| System.out.print("Executing batch"); | ||
| stmt.executeBatch(); | ||
| stmt.close(); | ||
| } | ||
| if (connection != null) { | ||
| @@ -307,7 +320,7 @@ private PreparedStatement buildStatement(Scenario scenario, List<Column> columns | ||
| PreparedStatement statement, SimpleDateFormat simpleDateFormat) throws Exception { | ||
| int count = 1; | ||
| for (Column column : columns) { | ||
| //System.out.print("Column is " + column.getName()); | ||
| DataValue dataValue = getRulesApplier().getDataForRule(scenario, column); | ||
| switch (column.getType()) { | ||
| case VARCHAR: | ||
| @@ -318,6 +331,7 @@ private PreparedStatement buildStatement(Scenario scenario, List<Column> columns | ||
| } | ||
| break; | ||
| case CHAR: | ||
| //System.out.print("Data value "+ dataValue.getValue()); | ||
| if (dataValue.getValue().equals("")) { | ||
| statement.setNull(count, Types.CHAR); | ||
| } else { | ||
| @@ -354,6 +368,7 @@ private PreparedStatement buildStatement(Scenario scenario, List<Column> columns | ||
| } | ||
| count++; | ||
| } | ||
| //System.out.print("Returning statement " + statement.toString()); | ||
| return statement; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be able to use the logger config for stdout instead.