Unverified 提交 9203e7b8 authored 作者: Andrei Tokar's avatar Andrei Tokar 提交者: GitHub

Merge pull request #1269 from h2database/bench-tiny

Eliminate commit of empty batch in some tests
...@@ -71,7 +71,7 @@ public class BenchA implements Bench { ...@@ -71,7 +71,7 @@ public class BenchA implements Bench {
for (int i = 0; i < branches * scale; i++) { for (int i = 0; i < branches * scale; i++) {
prep.setInt(1, i); prep.setInt(1, i);
db.update(prep, "insertBranches"); db.update(prep, "insertBranches");
if (i % commitEvery == 0) { if ((i+1) % commitEvery == 0) {
db.commit(); db.commit();
} }
} }
...@@ -83,7 +83,7 @@ public class BenchA implements Bench { ...@@ -83,7 +83,7 @@ public class BenchA implements Bench {
prep.setInt(1, i); prep.setInt(1, i);
prep.setInt(2, i / tellers); prep.setInt(2, i / tellers);
db.update(prep, "insertTellers"); db.update(prep, "insertTellers");
if (i % commitEvery == 0) { if ((i+1) % commitEvery == 0) {
db.commit(); db.commit();
} }
} }
...@@ -96,7 +96,7 @@ public class BenchA implements Bench { ...@@ -96,7 +96,7 @@ public class BenchA implements Bench {
prep.setInt(1, i); prep.setInt(1, i);
prep.setInt(2, i / accounts); prep.setInt(2, i / accounts);
db.update(prep, "insertAccounts"); db.update(prep, "insertAccounts");
if (i % commitEvery == 0) { if ((i+1) % commitEvery == 0) {
db.commit(); db.commit();
} }
} }
......
...@@ -97,7 +97,7 @@ public class BenchB implements Bench, Runnable { ...@@ -97,7 +97,7 @@ public class BenchB implements Bench, Runnable {
for (int i = 0; i < BRANCHES * SCALE; i++) { for (int i = 0; i < BRANCHES * SCALE; i++) {
prep.setInt(1, i); prep.setInt(1, i);
db.update(prep, "insertBranches"); db.update(prep, "insertBranches");
if (i % commitEvery == 0) { if ((i+1) % commitEvery == 0) {
db.commit(); db.commit();
} }
} }
...@@ -108,7 +108,7 @@ public class BenchB implements Bench, Runnable { ...@@ -108,7 +108,7 @@ public class BenchB implements Bench, Runnable {
prep.setInt(1, i); prep.setInt(1, i);
prep.setInt(2, i / TELLERS); prep.setInt(2, i / TELLERS);
db.update(prep, "insertTellers"); db.update(prep, "insertTellers");
if (i % commitEvery == 0) { if ((i+1) % commitEvery == 0) {
db.commit(); db.commit();
} }
} }
...@@ -120,7 +120,7 @@ public class BenchB implements Bench, Runnable { ...@@ -120,7 +120,7 @@ public class BenchB implements Bench, Runnable {
prep.setInt(1, i); prep.setInt(1, i);
prep.setInt(2, i / ACCOUNTS); prep.setInt(2, i / ACCOUNTS);
db.update(prep, "insertAccounts"); db.update(prep, "insertAccounts");
if (i % commitEvery == 0) { if ((i+1) % commitEvery == 0) {
db.commit(); db.commit();
} }
} }
...@@ -171,7 +171,6 @@ public class BenchB implements Bench, Runnable { ...@@ -171,7 +171,6 @@ public class BenchB implements Bench, Runnable {
updateAccount.setInt(1, delta); updateAccount.setInt(1, delta);
updateAccount.setInt(2, account); updateAccount.setInt(2, account);
master.database.update(updateAccount, "UpdateAccounts"); master.database.update(updateAccount, "UpdateAccounts");
updateAccount.executeUpdate();
// SELECT ABALANCE FROM ACCOUNTS WHERE AID=? // SELECT ABALANCE FROM ACCOUNTS WHERE AID=?
selectAccount.setInt(1, account); selectAccount.setInt(1, account);
......
...@@ -36,7 +36,7 @@ public class BenchSimple implements Bench { ...@@ -36,7 +36,7 @@ public class BenchSimple implements Bench {
prep.setInt(1, i); prep.setInt(1, i);
prep.setString(2, "Hello World " + i); prep.setString(2, "Hello World " + i);
db.update(prep, "insertTest"); db.update(prep, "insertTest");
if (i % commitEvery == 0) { if ((i+1) % commitEvery == 0) {
db.commit(); db.commit();
} }
} }
...@@ -78,7 +78,7 @@ public class BenchSimple implements Bench { ...@@ -78,7 +78,7 @@ public class BenchSimple implements Bench {
db.start(this, "Update (sequential)"); db.start(this, "Update (sequential)");
prep = db.prepare("UPDATE TEST SET NAME=? WHERE ID=?"); prep = db.prepare("UPDATE TEST SET NAME=? WHERE ID=?");
for (int i = 0; i < records; i += 3) { for (int i = 0; i < records; i += 3) {
prep.setString(1, "Hallo Welt"); prep.setString(1, "Hallo Welt " + i);
prep.setInt(2, i); prep.setInt(2, i);
db.update(prep, "updateTest"); db.update(prep, "updateTest");
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论