From 591de575069e4f692ab7e3e2cfc0f05dd248b885 Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Thu, 8 Sep 2016 11:47:32 -0600 Subject: [PATCH] fix bug that suppressed failed commits --- README.md | 4 ++-- src/main/java/com/codefutures/tpcc/Driver.java | 4 ++-- src/main/java/com/codefutures/tpcc/NewOrder.java | 2 +- .../com/codefutures/tpcc/TpccStatements.java | 16 ++++------------ tpcc.properties | 2 +- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index bae2ad1..15a8fa9 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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 diff --git a/src/main/java/com/codefutures/tpcc/Driver.java b/src/main/java/com/codefutures/tpcc/Driver.java index 28b860a..11dcb06 100644 --- a/src/main/java/com/codefutures/tpcc/Driver.java +++ b/src/main/java/com/codefutures/tpcc/Driver.java @@ -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) { @@ -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; diff --git a/src/main/java/com/codefutures/tpcc/NewOrder.java b/src/main/java/com/codefutures/tpcc/NewOrder.java index 7ce9397..d97b8e2 100644 --- a/src/main/java/com/codefutures/tpcc/NewOrder.java +++ b/src/main/java/com/codefutures/tpcc/NewOrder.java @@ -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 { diff --git a/src/main/java/com/codefutures/tpcc/TpccStatements.java b/src/main/java/com/codefutures/tpcc/TpccStatements.java index 98fa3ca..3790d90 100644 --- a/src/main/java/com/codefutures/tpcc/TpccStatements.java +++ b/src/main/java/com/codefutures/tpcc/TpccStatements.java @@ -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(); } } diff --git a/tpcc.properties b/tpcc.properties index 2f3ce2a..1e1a6a7 100644 --- a/tpcc.properties +++ b/tpcc.properties @@ -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