Skip to content

Commit

Permalink
fix bug that suppressed failed commits
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Sep 8, 2016
1 parent 7e7cfe6 commit 591de57
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Generating and loading TPC-C data
Data can be loaded directly into a MySQL instance and can also be generated to CSV files that
can be loaded into MySQL later using LOAD DATA INFILE.

In tpcc.properties set the MODE to either CSV or JDBC.
In `tpcc.properties` set the MODE to either CSV or JDBC.

To run the load process:

Expand All @@ -56,7 +56,7 @@ dbShards (http://www.dbshards.com).
Running the TPC-C Benchmark
===========================

To run the tpcc benchmarks:
Review the TPC-C settings in `tpcc.properties`, then run this command To run the tpcc benchmarks:

```
java -classpath target/tpcc-1.0.0-SNAPSHOT-jar-with-dependencies.jar com.codefutures.tpcc.Tpcc
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/codefutures/tpcc/Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public Object call() throws Exception {

}

private void doNextTransaction(int t_num, int sequence) {
private void doNextTransaction(int t_num, int sequence) throws SQLException {
if (sequence == 0) {
doNeword(t_num);
} else if (sequence == 1) {
Expand All @@ -192,7 +192,7 @@ private void doNextTransaction(int t_num, int sequence) {
* prepare data and execute the new order transaction for one order
* officially, this is supposed to be simulated terminal I/O
*/
private int doNeword(int t_num) {
private int doNeword(int t_num) throws SQLException {
int c_num = 0;
int i = 0;
int ret = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/codefutures/tpcc/NewOrder.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public int neword(int t_num, /* thread number (not used) */
int itemid[], /* ids of items to be ordered */
int supware[], /* warehouses supplying items */
int qty[]
) {
) throws SQLException {

try {

Expand Down
16 changes: 4 additions & 12 deletions src/main/java/com/codefutures/tpcc/TpccStatements.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,16 @@ public void setAutoCommit(boolean b) throws SQLException {
/**
* Commit a transaction.
*/
public void commit() {
public void commit() throws SQLException {
logger.trace("COMMIT");
try {
conn.commit();
} catch (SQLException e) {
logger.error("COMMIT FAILED", e);
}
conn.commit();
}

/**
* Rollback a transaction.
*/
public void rollback() {
public void rollback() throws SQLException {
logger.trace("ROLLBACK");
try {
conn.rollback();
} catch (SQLException e) {
logger.error("ROLLBACK FAILED", e);
}
conn.rollback();
}
}
2 changes: 1 addition & 1 deletion tpcc.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SHARDCOUNT=1

# MySQL
DRIVER=com.mysql.jdbc.Driver
JDBCURL=jdbc:mysql://localhost:3306/tpcc
JDBCURL=jdbc:mysql://127.0.0.1:3306/tpcc?useSSL=false&serverTimezone=UTC
JDBCFETCHSIZE=-2147483648

# dbShards
Expand Down

0 comments on commit 591de57

Please sign in to comment.