提交 8b6b45de authored 作者: Andrei Tokar's avatar Andrei Tokar

eliminate commit of empty batch

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