Skip to content

Commit

Permalink
Delivery transaction must use all the districts (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
eivanov89 committed Sep 26, 2023
1 parent 50d3389 commit 14d4428
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected List<TPCCWorker> createTerminals() throws SQLException {
}
lowerDistrictId += 1;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ public class TPCCWorker extends Worker<TPCCBenchmark> {
private final Random gen = new Random();

private final int numWarehouses;
private final int distPerWhse;

public TPCCWorker(TPCCBenchmark benchmarkModule, int id,
int terminalWarehouseID, int terminalDistrictLowerID,
int terminalDistrictUpperID, int numWarehouses) {
int terminalDistrictUpperID, int numWarehouses, int distPerWhse) {
super(benchmarkModule, id);

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


this.numWarehouses = numWarehouses;
this.distPerWhse = distPerWhse;
}

public int getDistPerWhse() {
return distPerWhse;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void run(Connection conn, Random gen, int w_id, int numWarehouses, int te

int[] orderIDs = new int[10];

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

if (no_o_id == null) {
Expand Down

0 comments on commit 14d4428

Please sign in to comment.