Skip to content

Commit 14d4428

Browse files
committed
Delivery transaction must use all the districts (#360)
1 parent 50d3389 commit 14d4428

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Diff for: src/main/java/com/oltpbenchmark/benchmarks/tpcc/TPCCBenchmark.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ protected List<TPCCWorker> createTerminals() throws SQLException {
104104
}
105105
lowerDistrictId += 1;
106106

107-
TPCCWorker terminal = new TPCCWorker(this, workerId++, w_id, lowerDistrictId, upperDistrictId, numWarehouses);
107+
TPCCWorker terminal = new TPCCWorker(this, workerId++, w_id, lowerDistrictId, upperDistrictId, numWarehouses, TPCCConfig.configDistPerWhse);
108108
terminals[lowerTerminalId + terminalId] = terminal;
109109
}
110110

Diff for: src/main/java/com/oltpbenchmark/benchmarks/tpcc/TPCCWorker.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ public class TPCCWorker extends Worker<TPCCBenchmark> {
4343
private final Random gen = new Random();
4444

4545
private final int numWarehouses;
46+
private final int distPerWhse;
4647

4748
public TPCCWorker(TPCCBenchmark benchmarkModule, int id,
4849
int terminalWarehouseID, int terminalDistrictLowerID,
49-
int terminalDistrictUpperID, int numWarehouses) {
50+
int terminalDistrictUpperID, int numWarehouses, int distPerWhse) {
5051
super(benchmarkModule, id);
5152

5253
this.terminalWarehouseID = terminalWarehouseID;
@@ -55,6 +56,11 @@ public TPCCWorker(TPCCBenchmark benchmarkModule, int id,
5556

5657

5758
this.numWarehouses = numWarehouses;
59+
this.distPerWhse = distPerWhse;
60+
}
61+
62+
public int getDistPerWhse() {
63+
return distPerWhse;
5864
}
5965

6066
/**

Diff for: src/main/java/com/oltpbenchmark/benchmarks/tpcc/procedures/Delivery.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void run(Connection conn, Random gen, int w_id, int numWarehouses, int te
104104

105105
int[] orderIDs = new int[10];
106106

107-
for (d_id = 1; d_id <= terminalDistrictUpperID; d_id++) {
107+
for (d_id = 1; d_id <= w.getDistPerWhse(); d_id++) {
108108
Integer no_o_id = getOrderId(conn, w_id, d_id);
109109

110110
if (no_o_id == null) {

0 commit comments

Comments
 (0)