Skip to content

Commit

Permalink
Removed CUSTOMER_NAME from TPC-C benchmark. This wasn't actually used…
Browse files Browse the repository at this point in the history
… but I just want to make sure it doesn't cause any problems with Squall #158
  • Loading branch information
apavlo committed Jul 11, 2014
1 parent 71bb84a commit 8a65175
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 117 deletions.
5 changes: 0 additions & 5 deletions src/benchmarks/org/voltdb/benchmark/tpcc/TPCCClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,6 @@ protected void buildConstraints() {
c_id, c_d_id, c_w_id, c_discount, c_credit,
c_fk);

// CUSTOMER_NAME table
Expression customer_name = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
c_id, c_d_id, c_w_id);

// HISTORY table
Expression h_c_id = Verification.inRange("H_C_ID", 1,
m_scaleParams.customersPerDistrict);
Expand Down Expand Up @@ -533,7 +529,6 @@ protected void buildConstraints() {
addTableConstraint("WAREHOUSE", warehouse);
addTableConstraint("DISTRICT", district);
addTableConstraint("CUSTOMER", customer);
addTableConstraint("CUSTOMER_NAME", customer_name);
addTableConstraint("HISTORY", history);
addTableConstraint("ORDERS", orders);
addTableConstraint("NEW_ORDER", new_order);
Expand Down
2 changes: 0 additions & 2 deletions src/benchmarks/org/voltdb/benchmark/tpcc/TPCCConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public final class TPCCConstants {
public static final String TABLENAME_DISTRICT = "DISTRICT";
public static final String TABLENAME_ITEM = "ITEM";
public static final String TABLENAME_CUSTOMER = "CUSTOMER";
public static final String TABLENAME_CUSTOMER_NAME = "CUSTOMER_NAME";
public static final String TABLENAME_HISTORY = "HISTORY";
public static final String TABLENAME_STOCK = "STOCK";
public static final String TABLENAME_ORDERS = "ORDERS";
Expand Down Expand Up @@ -211,7 +210,6 @@ public final class TPCCConstants {
public static final String INSERT_WAREHOUSE = "InsertWarehouse";
public static final String INSERT_DISTRICT = "InsertDistrict";
public static final String INSERT_CUSTOMER = "InsertCustomer";
public static final String INSERT_CUSTOMER_NAME = "InsertCustomerName";
public static final String INSERT_ORDERS = "InsertOrders";
public static final String INSERT_ORDER_LINE = "InsertOrderLine";
public static final String INSERT_NEW_ORDER = "InsertNewOrder";
Expand Down
64 changes: 4 additions & 60 deletions src/benchmarks/org/voltdb/benchmark/tpcc/TPCCLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ public class TPCCLoader extends Loader {

private int MAX_BATCH_SIZE = 10000;

private static final VoltTable.ColumnInfo CUSTOMER_NAME_COLUMNS[] = new VoltTable.ColumnInfo[] {
new VoltTable.ColumnInfo("C_ID", VoltType.INTEGER),
new VoltTable.ColumnInfo("C_D_ID", VoltType.TINYINT),
new VoltTable.ColumnInfo("C_W_ID", VoltType.SMALLINT),
new VoltTable.ColumnInfo("C_FIRST", VoltType.STRING),
new VoltTable.ColumnInfo("C_LAST", VoltType.STRING)
};

public TPCCLoader(String args[]) {
super(args);

Expand Down Expand Up @@ -178,8 +170,6 @@ class LoadThread extends Thread {
private final VoltTable[] data_tables = new VoltTable[8]; // non
// replicated
// tables
private volatile boolean m_doMakeReplicated = false;

public LoadThread(RandomGenerator generator, TimestampType generationDateTime, ScaleParameters parameters, int threadIndex) {
super("Load Thread " + threadIndex);
m_generator = generator;
Expand Down Expand Up @@ -232,11 +222,6 @@ public void run() {
// System.err.println(ret);
}

public void start(boolean doMakeReplicated) {
m_doMakeReplicated = doMakeReplicated;
super.start();
}

private double makeTax() {
return m_generator.fixedPoint(TPCCConstants.TAX_DECIMALS, TPCCConstants.MIN_TAX, TPCCConstants.MAX_TAX);
}
Expand Down Expand Up @@ -318,7 +303,7 @@ public void generateDistrict(long d_w_id, long d_id) {

private final Object[] container_customer = new Object[6 + 5 + 10];

public void generateCustomer(long c_w_id, long c_d_id, long c_id, boolean badCredit, VoltTable customerNames) {
public void generateCustomer(long c_w_id, long c_d_id, long c_id, boolean badCredit) {
String c_first = m_generator.astring(TPCCConstants.MIN_FIRST, TPCCConstants.MAX_FIRST);
String c_middle = TPCCConstants.MIDDLE;

Expand Down Expand Up @@ -372,10 +357,6 @@ public void generateCustomer(long c_w_id, long c_d_id, long c_id, boolean badCre
container_customer[ind++] = c_delivery_cnt;
container_customer[ind++] = c_data;
data_tables[IDX_CUSTOMERS].addRow(container_customer);

if (customerNames != null) {
customerNames.addRow(c_id, c_d_id, c_w_id, c_first, c_last);
}
}

/**
Expand Down Expand Up @@ -531,8 +512,6 @@ public void makeWarehouse(long w_id) {
generateWarehouse(w_id);

// replicate name and id to every site
VoltTable customerNames = null;
if (m_doMakeReplicated) customerNames = new VoltTable(CUSTOMER_NAME_COLUMNS);

for (int d_id = 1; d_id <= m_parameters.districtsPerWarehouse; ++d_id) {
if (this.stop) return;
Expand All @@ -546,7 +525,7 @@ public void makeWarehouse(long w_id) {
// long[] c_ids = new long[customersPerDistrict];
for (int c_id = 1; c_id <= m_parameters.customersPerDistrict; ++c_id) {
boolean badCredit = selectedRows.contains(c_id);
generateCustomer(w_id, d_id, c_id, badCredit, customerNames);
generateCustomer(w_id, d_id, c_id, badCredit);
generateHistory(w_id, d_id, c_id);
}

Expand Down Expand Up @@ -580,17 +559,10 @@ public void makeWarehouse(long w_id) {
}
commitDataTables(w_id); // flushout current data to avoid
// outofmemory

if (customerNames != null && customerNames.getRowCount() > 32760) {
this.makeCustomerName(customerNames);
}
}
if (customerNames != null && customerNames.getRowCount() > 0) {
this.makeCustomerName(customerNames);
}
}

/** generate replicated tables, ITEM and CUSTOMER_NAME. */
/** generate replicated tables: ITEM */
public void makeItems(int itemStart, int itemFinish) {
// create ITEMS here to reduce memory consumption
VoltTable items = new VoltTable(new VoltTable.ColumnInfo("I_ID", VoltType.INTEGER),
Expand Down Expand Up @@ -636,34 +608,6 @@ public void makeItems(int itemStart, int itemFinish) {
items = null;
}

private void makeCustomerName(VoltTable table) {
// Customer Name! Booyah! Shaq Attaq!
VoltTable batch = new VoltTable(table);
if (debug.val)
LOG.debug(String.format("Loading replicated CUSTOMER_NAME table [tuples=%d]", table.getRowCount()));
try {
for (int i = 0, cnt = table.getRowCount(); i < cnt; i++) {
if (this.stop) return;
batch.add(table.fetchRow(i));
if (batch.getRowCount() == replicated_batch_size) {
if (debug.val)
LOG.debug(String.format("Loading replicated CUSTOMER_NAME table [tuples=%d/%d]", i, cnt));
loadVoltTable("CUSTOMER_NAME", batch);
batch.clearRowData();
}
} // FOR
if (batch.getRowCount() > 0) {
loadVoltTable("CUSTOMER_NAME", batch);
batch.clearRowData();
}
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
table.clearRowData();
}
}


/** Send to data to VoltDB and/or to the jdbc connection */
private void commitDataTables(long w_id) {
assert(getClientHandle() != null);
Expand Down Expand Up @@ -857,7 +801,7 @@ public void update(edu.brown.utils.EventObservable<Pair<Thread,Throwable>> o, Pa
if (debug.val) LOG.debug("Starting LoadThread...");
loadThread.setUncaughtExceptionHandler(handler);
// loadThread.start(true);
loadThread.start(false);
loadThread.start();
// doMakeReplicated = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public class LoadWarehouseReplicated extends VoltProcedure {

public final SQLStmt checkItemExists = new SQLStmt("SELECT * FROM ITEM LIMIT 1");

public VoltTable[] run(long w_id, VoltTable items, VoltTable customerNames)
throws VoltAbortException {
public VoltTable[] run(long w_id, VoltTable items) throws VoltAbortException {
int allowELT = 0;
if (items != null) {
// check if we've already set up this partition
Expand All @@ -52,7 +51,6 @@ public VoltTable[] run(long w_id, VoltTable items, VoltTable customerNames)
// now we know the partition is not loaded yet
voltLoadTable("cluster", "database", "ITEM", items, allowELT);
}
voltLoadTable("cluster", "database", "CUSTOMER_NAME", customerNames, allowELT);
return null;
}

Expand Down
10 changes: 0 additions & 10 deletions src/benchmarks/org/voltdb/benchmark/tpcc/tpcc-ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ CREATE TABLE CUSTOMER (
);
CREATE INDEX IDX_CUSTOMER ON CUSTOMER (C_W_ID,C_D_ID,C_LAST);

CREATE TABLE CUSTOMER_NAME (
C_ID INTEGER DEFAULT '0' NOT NULL,
C_D_ID TINYINT DEFAULT '0' NOT NULL,
C_W_ID SMALLINT DEFAULT '0' NOT NULL,
C_FIRST VARCHAR(32) DEFAULT NULL,
C_LAST VARCHAR(32) DEFAULT NULL,
CONSTRAINT CM_FKEY_C FOREIGN KEY (C_ID, C_D_ID, C_W_ID) REFERENCES CUSTOMER (C_ID, C_D_ID, C_W_ID)
);
CREATE INDEX IDX_CUSTOMER_NAME ON CUSTOMER_NAME (C_W_ID,C_D_ID,C_LAST);

CREATE TABLE HISTORY (
H_C_ID INTEGER DEFAULT NULL,
H_C_D_ID TINYINT DEFAULT NULL,
Expand Down
5 changes: 0 additions & 5 deletions src/frontend/edu/brown/catalog/ForeignKeysUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ public static class ForeignKeyMapping extends HashMap<String, String> {
TPCC_FOREIGN_KEYS.get("CUSTOMER").put("C_D_ID", "DISTRICT.D_ID");
TPCC_FOREIGN_KEYS.get("CUSTOMER").put("C_W_ID", "DISTRICT.D_W_ID");

TPCC_FOREIGN_KEYS.put("CUSTOMER_NAME", new ForeignKeyMapping());
TPCC_FOREIGN_KEYS.get("CUSTOMER_NAME").put("C_D_ID", "CUSTOMER.C_D_ID");
TPCC_FOREIGN_KEYS.get("CUSTOMER_NAME").put("C_W_ID", "CUSTOMER.C_W_ID");
TPCC_FOREIGN_KEYS.get("CUSTOMER_NAME").put("C_ID", "CUSTOMER.C_ID");

TPCC_FOREIGN_KEYS.put("HISTORY", new ForeignKeyMapping());
TPCC_FOREIGN_KEYS.get("HISTORY").put("H_D_ID", "DISTRICT.D_ID");
TPCC_FOREIGN_KEYS.get("HISTORY").put("H_W_ID", "DISTRICT.D_W_ID");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,9 @@ public void testConvertToSingleColumnEdges() throws Exception {
// single_agraph.setVerbose(true);
// System.err.println("Dumping AccessGraph to " + FileUtil.writeStringToFile("/tmp/single_tpcc.dot", GraphvizExport.export(single_agraph, "tpcc")));

// Make sure that it has all of our tables except CUSTOMER_NAME
// Make sure that it has all of our tables except HISTORY
for (Table catalog_tbl : catalogContext.getDataTables()) {
if (catalog_tbl.getName().equalsIgnoreCase("CUSTOMER_NAME") ||
catalog_tbl.getName().equalsIgnoreCase("HISTORY")) continue;
if (catalog_tbl.getName().equalsIgnoreCase("HISTORY")) continue;
DesignerVertex v = single_agraph.getVertex(catalog_tbl);
assertNotNull(catalog_tbl.getName(), v);
System.err.println(catalog_tbl + ": " + v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ public void testSimple() {
result = m_pt.planSql("select * from warehouse;");
System.out.println(result);

result = m_pt.planSql("select * from WAREHOUSE, DISTRICT, CUSTOMER, CUSTOMER_NAME, HISTORY, STOCK, ORDERS, NEW_ORDER, ORDER_LINE where " +
result = m_pt.planSql("select * from WAREHOUSE, DISTRICT, CUSTOMER, HISTORY, STOCK, ORDERS, NEW_ORDER, ORDER_LINE where " +
"WAREHOUSE.W_ID = DISTRICT.D_W_ID and " +
"WAREHOUSE.W_ID = CUSTOMER.C_W_ID and " +
"WAREHOUSE.W_ID = CUSTOMER_NAME.C_W_ID and " +
"WAREHOUSE.W_ID = HISTORY.H_W_ID and " +
"WAREHOUSE.W_ID = STOCK.S_W_ID and " +
"WAREHOUSE.W_ID = ORDERS.O_W_ID and " +
Expand Down
2 changes: 0 additions & 2 deletions tests/frontend/org/voltdb/planner/TestPlansTPCC.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public void testInserts() {
assertTrue(node != null);
node = compile("INSERT INTO CUSTOMER VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", 21);
assertTrue(node != null);
node = compile("INSERT INTO CUSTOMER_NAME VALUES (?, ?, ?, ?, ?);", 5);
assertTrue(node != null);
node = compile("INSERT INTO HISTORY VALUES (?, ?, ?, ?, ?, ?, ?, ?);", 8);
assertTrue(node != null);
node = compile("INSERT INTO STOCK VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", 17);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,9 @@ public void testTooFewParamsOnSQLStmt() throws IOException {
//
// try {
// client.callProcedure("@AdHoc",
// "select * from WAREHOUSE, DISTRICT, CUSTOMER, CUSTOMER_NAME, HISTORY, STOCK, ORDERS, NEW_ORDER, ORDER_LINE where " +
// "select * from WAREHOUSE, DISTRICT, CUSTOMER, HISTORY, STOCK, ORDERS, NEW_ORDER, ORDER_LINE where " +
// "WAREHOUSE.W_ID = DISTRICT.D_W_ID and " +
// "WAREHOUSE.W_ID = CUSTOMER.C_W_ID and " +
// "WAREHOUSE.W_ID = CUSTOMER_NAME.C_W_ID and " +
// "WAREHOUSE.W_ID = HISTORY.H_W_ID and " +
// "WAREHOUSE.W_ID = STOCK.S_W_ID and " +
// "WAREHOUSE.W_ID = ORDERS.O_W_ID and " +
Expand Down
5 changes: 0 additions & 5 deletions tests/frontend/org/voltdb/regressionsuites/TestTPCCSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,6 @@ public void testPAYMENTMultiPartition() throws IOException, ProcCallException {
"Some History").getResults()[0];
// check for successful insertion.
assertEquals(1L, customer1.asScalarLong());
client.callProcedure("InsertCustomerName", C_ID, D_ID, W_ID, "I", "lastname");

VoltTable customer2 = client.callProcedure("InsertCustomer", C_ID + 1,
D_ID, W_ID, "We", "R", "Customer", "Random Department",
Expand All @@ -578,7 +577,6 @@ public void testPAYMENTMultiPartition() throws IOException, ProcCallException {
1L, 15L, "Some History").getResults()[0];
// check for successful insertion.
assertEquals(1L, customer2.asScalarLong());
client.callProcedure("InsertCustomerName", C_ID + 1, D_ID, W_ID, "We", "Customer");

VoltTable customer3 = client.callProcedure("InsertCustomer", C_ID + 2,
D2_ID, W2_ID, "Who", "Is", "Customer", "Receiving",
Expand All @@ -587,7 +585,6 @@ public void testPAYMENTMultiPartition() throws IOException, ProcCallException {
initialBalance, initialYTD, 2L, 15L, "Some History").getResults()[0];
// check for successful insertion.
assertEquals(1L, customer3.asScalarLong());
client.callProcedure("InsertCustomerName", C_ID + 2, D2_ID, W2_ID, "Who", "Customer");

VoltTable customer4 = client.callProcedure("InsertCustomer", C_ID + 3,
D2_ID, W2_ID, "ICanBe", "", "Customer", "street", "place",
Expand All @@ -596,7 +593,6 @@ public void testPAYMENTMultiPartition() throws IOException, ProcCallException {
"Some History").getResults()[0];
// check for successful insertion.
assertEquals(1L, customer4.asScalarLong());
client.callProcedure("InsertCustomerName", C_ID + 3, D2_ID, W2_ID, "ICanBe", "Customer");

final double paymentAmount = 500.25;
// long d_id, long w_id, double h_amount, String c_last, long c_w_id,
Expand Down Expand Up @@ -828,7 +824,6 @@ static public Test suite() {
project.addStmtProcedure("InsertItem", "INSERT INTO ITEM VALUES (?, ?, ?, ?, ?);");
project.addStmtProcedure("InsertHistory", "INSERT INTO HISTORY VALUES (?, ?, ?, ?, ?, ?, ?, ?);", "HISTORY.H_W_ID: 4");
project.addStmtProcedure("InsertDistrict", "INSERT INTO DISTRICT VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", "DISTRICT.D_W_ID: 1");
project.addStmtProcedure("InsertCustomerName", "INSERT INTO CUSTOMER_NAME VALUES (?, ?, ?, ?, ?);");

// Remove any MapReduce and OLAP transactions
project.removeProcedures(Pattern.compile("^MR.*", Pattern.CASE_INSENSITIVE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,6 @@ CREATE TABLE CUSTOMER (
);
CREATE INDEX IDX_CUSTOMER ON CUSTOMER (C_W_ID,C_D_ID,C_LAST);

CREATE TABLE CUSTOMER_NAME (
C_ID INTEGER DEFAULT '0' NOT NULL,
C_D_ID TINYINT DEFAULT '0' NOT NULL,
C_W_ID SMALLINT DEFAULT '0' NOT NULL,
C_FIRST VARCHAR(32) DEFAULT NULL,
C_LAST VARCHAR(32) DEFAULT NULL
);
CREATE INDEX IDX_CUSTOMER_NAME ON CUSTOMER_NAME (C_W_ID,C_D_ID,C_LAST);

CREATE TABLE HISTORY (
H_C_ID INTEGER DEFAULT NULL,
H_C_D_ID TINYINT DEFAULT NULL,
Expand Down
9 changes: 0 additions & 9 deletions tests/hsqldb/org/hsqldb/hsqltest-ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ CREATE TABLE CUSTOMER (
);
CREATE INDEX IDX_CUSTOMER ON CUSTOMER (C_W_ID,C_D_ID,C_LAST);

CREATE TABLE CUSTOMER_NAME (
C_ID INTEGER DEFAULT '0' NOT NULL,
C_D_ID INTEGER DEFAULT '0' NOT NULL,
C_W_ID INTEGER DEFAULT '0' NOT NULL,
C_FIRST VARCHAR(32) DEFAULT NULL,
C_LAST VARCHAR(32) DEFAULT NULL
);
CREATE INDEX IDX_CUSTOMER_NAME ON CUSTOMER_NAME (C_W_ID,C_D_ID,C_LAST);

CREATE TABLE HISTORY (
H_C_ID INTEGER DEFAULT NULL,
H_C_D_ID INTEGER DEFAULT NULL,
Expand Down

0 comments on commit 8a65175

Please sign in to comment.