diff --git a/src/main/java/com/oltpbenchmark/api/BenchmarkModule.java b/src/main/java/com/oltpbenchmark/api/BenchmarkModule.java index d3fef30cc..65e350913 100644 --- a/src/main/java/com/oltpbenchmark/api/BenchmarkModule.java +++ b/src/main/java/com/oltpbenchmark/api/BenchmarkModule.java @@ -269,10 +269,10 @@ public final void createDatabase(DatabaseType dbType, Connection conn) { /** * Invoke this benchmark's database loader */ - public final void loadDatabase() { - + public final Loader loadDatabase() { + Loader loader; try { - Loader loader = this.makeLoaderImpl(); + loader = this.makeLoaderImpl(); if (loader != null) { @@ -303,6 +303,7 @@ public final void loadDatabase() { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Finished loading the %s database", this.getBenchmarkName().toUpperCase())); } + return loader; } public final void clearDatabase() { @@ -376,7 +377,7 @@ public final TransactionType initTransactionType(String procName, int id) { String fullName = pkg.getName() + "." + procName; Class procClass = (Class) ClassUtil.getClass(fullName); - return new TransactionType(procClass, id); + return new TransactionType(procClass, id, false); } public final WorkloadConfiguration getWorkloadConfiguration() { @@ -396,7 +397,7 @@ public Map getProcedures() { for (Class procClass : this.supplementalProcedures) { TransactionType txn = txns.getType(procClass); if (txn == null) { - txn = new TransactionType(procClass, procClass.hashCode()); + txn = new TransactionType(procClass, procClass.hashCode(), true); txns.add(txn); } } diff --git a/src/main/java/com/oltpbenchmark/api/TransactionType.java b/src/main/java/com/oltpbenchmark/api/TransactionType.java index e7d8a2368..be058fdad 100644 --- a/src/main/java/com/oltpbenchmark/api/TransactionType.java +++ b/src/main/java/com/oltpbenchmark/api/TransactionType.java @@ -26,14 +26,16 @@ public static class Invalid extends Procedure { } public static final int INVALID_ID = 0; - public static final TransactionType INVALID = new TransactionType(Invalid.class, INVALID_ID); + public static final TransactionType INVALID = new TransactionType(Invalid.class, INVALID_ID, false); private final Class procClass; private final int id; + private final boolean supplemental; - protected TransactionType(Class procClass, int id) { + protected TransactionType(Class procClass, int id, boolean supplemental) { this.procClass = procClass; this.id = id; + this.supplemental = supplemental; } public Class getProcedureClass() { @@ -48,6 +50,10 @@ public int getId() { return this.id; } + public boolean isSupplemental() { + return this.supplemental; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/auctionmark/AuctionMarkLoader.java b/src/main/java/com/oltpbenchmark/benchmarks/auctionmark/AuctionMarkLoader.java index 5a4e936af..381a30698 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/auctionmark/AuctionMarkLoader.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/auctionmark/AuctionMarkLoader.java @@ -212,7 +212,7 @@ protected AbstractTableGenerator getGenerator(String table_name) { * @param tableName */ protected void generateTableData(Connection conn, String tableName) throws SQLException { - LOG.info("*** START {}", tableName); + LOG.debug("*** START {}", tableName); final AbstractTableGenerator generator = this.generators.get(tableName); @@ -256,7 +256,7 @@ protected void generateTableData(Connection conn, String tableName) throws SQLEx generator.markAsFinished(); synchronized (this) { this.finished.add(tableName); - LOG.info(String.format("*** FINISH %s - %d tuples - [%d / %d]", tableName, this.tableSizes.get(tableName), this.finished.size(), this.generators.size())); + LOG.debug(String.format("*** FINISH %s - %d tuples - [%d / %d]", tableName, this.tableSizes.get(tableName), this.finished.size(), this.generators.size())); if (LOG.isDebugEnabled()) { LOG.debug("Remaining Tables: {}", CollectionUtils.subtract(this.generators.keySet(), this.finished)); } @@ -311,16 +311,16 @@ public AbstractTableGenerator(String tableName, String... dependencies) { this.batchSize = workConf.getBatchSize(); - boolean fixed_size = AuctionMarkConstants.FIXED_TABLES.contains(catalog_tbl.getUppercaseName()); - boolean dynamic_size = AuctionMarkConstants.DYNAMIC_TABLES.contains(catalog_tbl.getUppercaseName()); - boolean data_file = AuctionMarkConstants.DATAFILE_TABLES.contains(catalog_tbl.getUppercaseName()); + boolean fixed_size = AuctionMarkConstants.FIXED_TABLES.contains(catalog_tbl.getName().toLowerCase()); + boolean dynamic_size = AuctionMarkConstants.DYNAMIC_TABLES.contains(catalog_tbl.getName().toLowerCase()); + boolean data_file = AuctionMarkConstants.DATAFILE_TABLES.contains(catalog_tbl.getName().toLowerCase()); // Add the dependencies so that we know what we need to block on CollectionUtil.addAll(this.dependencyTables, dependencies); // Initialize dynamic parameters for tables that are not loaded from data files if (!data_file && !dynamic_size && !tableName.equalsIgnoreCase(AuctionMarkConstants.TABLENAME_ITEM)) { - String field_name = "TABLESIZE_" + StringUtils.upperCase(catalog_tbl.getUppercaseName()); + String field_name = "TABLESIZE_" + catalog_tbl.getName().toUpperCase(); try { Field field_handle = AuctionMarkConstants.class.getField(field_name); @@ -337,17 +337,17 @@ public AbstractTableGenerator(String tableName, String... dependencies) { } for (Column catalog_col : this.catalog_tbl.getColumns()) { - if (random_str_regex.matcher(catalog_col.getName()).matches()) { + if (random_str_regex.matcher(catalog_col.getName().toUpperCase()).matches()) { this.random_str_cols.add(catalog_col); if (LOG.isTraceEnabled()) { - LOG.trace("Random String Column: {}", catalog_col.getName()); + LOG.trace("Random String Column: {}", catalog_col.getName().toLowerCase()); } - } else if (random_int_regex.matcher(catalog_col.getName()).matches()) { + } else if (random_int_regex.matcher(catalog_col.getName().toUpperCase()).matches()) { this.random_int_cols.add(catalog_col); if (LOG.isTraceEnabled()) { - LOG.trace("Random Integer Column: {}", catalog_col.getName()); + LOG.trace("Random Integer Column: {}", catalog_col.getName().toLowerCase()); } } } @@ -440,7 +440,7 @@ public Collection> getSubTableGenerators() { public Collection getSubGeneratorTableNames() { List names = new ArrayList<>(); for (AbstractTableGenerator gen : this.sub_generators) { - names.add(gen.catalog_tbl.getName()); + names.add(gen.catalog_tbl.getName().toLowerCase()); } return (names); } @@ -759,7 +759,7 @@ protected int populateRow(Object[] row) { // C_ID row[col++] = category.getCategoryID(); // C_NAME - row[col++] = category.getName(); + row[col++] = category.getName().toLowerCase(); // C_PARENT_ID row[col++] = category.getParentCategoryID(); diff --git a/src/main/java/com/oltpbenchmark/benchmarks/seats/SEATSLoader.java b/src/main/java/com/oltpbenchmark/benchmarks/seats/SEATSLoader.java index 1a73dbe1d..464b9fbe1 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/seats/SEATSLoader.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/seats/SEATSLoader.java @@ -506,7 +506,7 @@ public void loadTable(Connection conn, Table catalog_tbl, Iterable ite final boolean is_airport = catalog_tbl.getName().equalsIgnoreCase(SEATSConstants.TABLENAME_AIRPORT); if (LOG.isDebugEnabled()) { - LOG.debug(String.format("Generating new records for table %s [batchSize=%d]", catalog_tbl.getName(), batch_size)); + LOG.debug(String.format("Generating new records for table %s [batchSize=%d]", catalog_tbl.getName().toLowerCase(), batch_size)); } final List columns = catalog_tbl.getColumns(); @@ -515,7 +515,7 @@ public void loadTable(Connection conn, Table catalog_tbl, Iterable ite Map> mapping_columns = new HashMap<>(); for (int col_code_idx = 0, cnt = columns.size(); col_code_idx < cnt; col_code_idx++) { Column catalog_col = columns.get(col_code_idx); - String col_name = catalog_col.getName(); + String col_name = catalog_col.getName().toLowerCase(); // Code Column -> Id Column Mapping // Check to see whether this table has columns that we need to map @@ -529,7 +529,7 @@ public void loadTable(Connection conn, Table catalog_tbl, Iterable ite code_2_id.put(col_code_idx, col_id_idx); } - + // Foreign Key Column to Code->Id Mapping // If this columns references a foreign key that is used in the // Code->Id mapping that we generating above, // then we need to know when we should change the @@ -592,15 +592,14 @@ public void loadTable(Connection conn, Table catalog_tbl, Iterable ite long id = (Long) tuple[code_2_id.get(col_code_idx)]; if (LOG.isTraceEnabled()) { - LOG.trace(String.format("Mapping %s '%s' -> %s '%d'", from_column.getName(), code, to_column.getName(), id)); + LOG.trace(String.format("Mapping %s '%s' -> %s '%d'", from_column.getName().toLowerCase(), code, to_column.getName().toLowerCase(), id)); } - this.profile.code_id_xref.get(to_column.getName()).put(code, id); + this.profile.code_id_xref.get(to_column.getName().toLowerCase()).put(code, id); } } - + // Foreign Key Code -> Foreign Key Id for (int col_code_idx : mapping_columns.keySet()) { - Column catalog_col = columns.get(col_code_idx); if (tuple[col_code_idx] != null) { String code = tuple[col_code_idx].toString(); tuple[col_code_idx] = mapping_columns.get(col_code_idx).get(code); @@ -615,15 +614,15 @@ public void loadTable(Connection conn, Table catalog_tbl, Iterable ite insert_stmt.setNull(i + 1, sqlTypes[i]); } } catch (SQLDataException ex) { - LOG.error("INVALID {} TUPLE: {}", catalog_tbl.getName(), Arrays.toString(tuple)); - throw new RuntimeException("Failed to set value for " + catalog_tbl.getColumn(i).getName(), ex); + LOG.error("INVALID {} TUPLE: {}", catalog_tbl.getName().toLowerCase(), Arrays.toString(tuple)); + throw new RuntimeException("Failed to set value for " + catalog_tbl.getColumn(i).getName().toLowerCase(), ex); } } insert_stmt.addBatch(); row_idx++; if (++row_batch >= batch_size) { - LOG.debug(String.format("Loading %s batch [total=%d]", catalog_tbl.getName(), row_idx)); + LOG.debug(String.format("Loading %s batch [total=%d]", catalog_tbl.getName().toLowerCase(), row_idx)); insert_stmt.executeBatch(); insert_stmt.clearBatch(); row_batch = 0; @@ -636,7 +635,7 @@ public void loadTable(Connection conn, Table catalog_tbl, Iterable ite } } catch (Exception ex) { - throw new RuntimeException("Failed to load table " + catalog_tbl.getName(), ex); + throw new RuntimeException("Failed to load table " + catalog_tbl.getName().toLowerCase(), ex); } // Record the number of tuples that we loaded for this table in the @@ -645,7 +644,7 @@ public void loadTable(Connection conn, Table catalog_tbl, Iterable ite this.profile.num_reservations = row_idx + 1; } - LOG.info(String.format("Finished loading all %d tuples for %s", row_idx, catalog_tbl.getName())); + LOG.debug(String.format("Finished loading all %d tuples for %s", row_idx, catalog_tbl.getName().toLowerCase())); } // ---------------------------------------------------------------- @@ -678,11 +677,11 @@ public FixedDataIterable(Table catalog_tbl, String filePath) throws Exception { // Figure out which columns are random integers and strings for (Column catalog_col : catalog_tbl.getColumns()) { int col_idx = catalog_col.getIndex(); - if (catalog_col.getUppercaseName().contains("_SATTR")) { + if (catalog_col.getName().toUpperCase().contains("_SATTR")) { this.rnd_string.add(col_idx); this.rnd_string_min.put(col_idx, SEATSLoader.this.rng.nextInt(catalog_col.getSize() - 1)); this.rnd_string_max.put(col_idx, catalog_col.getSize()); - } else if (catalog_col.getUppercaseName().contains("_IATTR")) { + } else if (catalog_col.getName().toUpperCase().contains("_IATTR")) { this.rnd_integer.add(catalog_col.getIndex()); } } @@ -724,7 +723,7 @@ public Object[] next() { * @param catalog_tbl the target table that we need an iterable for */ protected Iterable getScalingIterable(Table catalog_tbl) { - String name = catalog_tbl.getName(); + String name = catalog_tbl.getName().toLowerCase(); ScalingDataIterable it = null; double scaleFactor = this.workConf.getScaleFactor(); long num_customers = Math.round(SEATSConstants.CUSTOMERS_COUNT * scaleFactor); diff --git a/src/main/java/com/oltpbenchmark/benchmarks/seats/SEATSProfile.java b/src/main/java/com/oltpbenchmark/benchmarks/seats/SEATSProfile.java index 590cf8d32..d22bd35f2 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/seats/SEATSProfile.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/seats/SEATSProfile.java @@ -174,10 +174,10 @@ public SEATSProfile(SEATSBenchmark benchmark, RandomGenerator rng) { for (Table catalog_tbl : benchmark.getCatalog().getTables()) { for (Column catalog_col : catalog_tbl.getColumns()) { Column catalog_fkey_col = catalog_col.getForeignKey(); - if (catalog_fkey_col != null && this.code_id_xref.containsKey(catalog_fkey_col.getName())) { - this.fkey_value_xref.put(catalog_col.getName(), catalog_fkey_col.getName()); + if (catalog_fkey_col != null && this.code_id_xref.containsKey(catalog_fkey_col.getName().toLowerCase())) { + this.fkey_value_xref.put(catalog_col.getName().toLowerCase(), catalog_fkey_col.getName().toLowerCase()); if (LOG.isDebugEnabled()) { - LOG.debug(String.format("Added ForeignKey mapping from %s to %s", catalog_col.getName(), catalog_fkey_col.getName())); + LOG.debug(String.format("Added ForeignKey mapping from %s to %s", catalog_col.getName().toLowerCase(), catalog_fkey_col.getName().toLowerCase())); } } } @@ -297,20 +297,19 @@ protected final void loadProfile(SEATSWorker worker) throws SQLException { try (Connection conn = benchmark.getConnection()) { results = proc.run(conn); } - // CONFIG_PROFILE - this.loadConfigProfile(results.getConfigProfile()); + // CONFIG_PROFILE + this.loadConfigProfile(results.getConfigProfile()); - // CONFIG_HISTOGRAMS - this.loadConfigHistograms(results.getConfigHistogram()); + // CONFIG_HISTOGRAMS + this.loadConfigHistograms(results.getConfigHistogram()); - this.loadCodeXref(results.getCountryCodes(), SEATSConstants.COUNTRY_CODE, SEATSConstants.COUNTRY_ID); - this.loadCodeXref(results.getAirportCodes(), SEATSConstants.AIRPORT_CODE, SEATSConstants.AIRPORT_ID); - this.loadCodeXref(results.getAirlineCodes(), SEATSConstants.AIRLINE_IATA_CODE, SEATSConstants.AIRLINE_ID); - - // CACHED FLIGHT IDS - this.loadCachedFlights(results.getFlights()); + this.loadCodeXref(results.getCountryCodes(), SEATSConstants.COUNTRY_CODE, SEATSConstants.COUNTRY_ID); + this.loadCodeXref(results.getAirportCodes(), SEATSConstants.AIRPORT_CODE, SEATSConstants.AIRPORT_ID); + this.loadCodeXref(results.getAirlineCodes(), SEATSConstants.AIRLINE_IATA_CODE, SEATSConstants.AIRLINE_ID); + // CACHED FLIGHT IDS + this.loadCachedFlights(results.getFlights()); if (LOG.isDebugEnabled()) { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/tatp/TATPLoader.java b/src/main/java/com/oltpbenchmark/benchmarks/tatp/TATPLoader.java index 3ffb105f1..9fae4229e 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/tatp/TATPLoader.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/tatp/TATPLoader.java @@ -239,6 +239,7 @@ void genSpeAndCal(Connection conn) throws SQLException { try (PreparedStatement cal_pstmt = conn.prepareStatement(cal_sql); PreparedStatement spe_pstmt = conn.prepareStatement(spe_sql)) { + boolean cal_added = false; while (s_id++ < subscriberSize) { int[] sf_types = TATPUtil.subArr(spe_arr, 1, 4); for (int sf_type : sf_types) { @@ -263,6 +264,7 @@ void genSpeAndCal(Connection conn) throws SQLException { cal_pstmt.setByte(++cal_col, (byte) (start_time + TATPUtil.number(1, 8))); cal_pstmt.setString(++cal_col, TATPUtil.nstring(15, 15)); cal_pstmt.addBatch(); + cal_added = true; cal_total++; } } @@ -273,12 +275,13 @@ void genSpeAndCal(Connection conn) throws SQLException { } int[] results = spe_pstmt.executeBatch(); - - if (LOG.isDebugEnabled()) { - LOG.debug(String.format("%s: %d (%s %d / %d)", TATPConstants.TABLENAME_CALL_FORWARDING, cal_total, TATPConstants.TABLENAME_SUBSCRIBER, s_id, subscriberSize)); + if (cal_added) { + if (LOG.isDebugEnabled()) { + LOG.debug(String.format("%s: %d (%s %d / %d)", TATPConstants.TABLENAME_CALL_FORWARDING, cal_total, TATPConstants.TABLENAME_SUBSCRIBER, s_id, subscriberSize)); + } + results = cal_pstmt.executeBatch(); + cal_added = false; } - results = cal_pstmt.executeBatch(); - spe_batch = 0; } diff --git a/src/main/java/com/oltpbenchmark/catalog/AbstractCatalogObject.java b/src/main/java/com/oltpbenchmark/catalog/AbstractCatalogObject.java index 1f7a8c35b..b3b9820a3 100644 --- a/src/main/java/com/oltpbenchmark/catalog/AbstractCatalogObject.java +++ b/src/main/java/com/oltpbenchmark/catalog/AbstractCatalogObject.java @@ -29,19 +29,13 @@ public abstract class AbstractCatalogObject implements Serializable { static final long serialVersionUID = 0; protected final String name; - protected final String uppercaseName; protected final String separator; - public AbstractCatalogObject(String name, String uppercaseName, String separator) { + public AbstractCatalogObject(String name, String separator) { this.name = name; - this.uppercaseName = uppercaseName; this.separator = separator; } - public String getUppercaseName() { - return uppercaseName; - } - public String getName() { return name; } @@ -69,13 +63,12 @@ public boolean equals(Object o) { return false; } AbstractCatalogObject that = (AbstractCatalogObject) o; - return Objects.equals(uppercaseName, that.uppercaseName) && - Objects.equals(name, that.name) && + return Objects.equals(name, that.name) && Objects.equals(separator, that.separator); } @Override public int hashCode() { - return Objects.hash(uppercaseName, name, separator); + return Objects.hash(name, separator); } } diff --git a/src/main/java/com/oltpbenchmark/catalog/Column.java b/src/main/java/com/oltpbenchmark/catalog/Column.java index ad15b6639..5e58a1441 100644 --- a/src/main/java/com/oltpbenchmark/catalog/Column.java +++ b/src/main/java/com/oltpbenchmark/catalog/Column.java @@ -35,8 +35,8 @@ public class Column extends AbstractCatalogObject { private Column foreignKey = null; - public Column(String name, String uppercaseName, String separator, Table table, int type, Integer size, boolean nullable) { - super(name, uppercaseName, separator); + public Column(String name, String separator, Table table, int type, Integer size, boolean nullable) { + super(name, separator); this.table = table; this.type = type; this.size = size; diff --git a/src/main/java/com/oltpbenchmark/catalog/HSQLDBCatalog.java b/src/main/java/com/oltpbenchmark/catalog/HSQLDBCatalog.java index c84bf6561..bbede8a19 100644 --- a/src/main/java/com/oltpbenchmark/catalog/HSQLDBCatalog.java +++ b/src/main/java/com/oltpbenchmark/catalog/HSQLDBCatalog.java @@ -79,7 +79,7 @@ private void init() throws SQLException { String tableType = tableRS.getString(4); if (!tableType.equalsIgnoreCase("TABLE")) continue; - Table catalogTable = new Table(internalTableName, upperTableName, ""); + Table catalogTable = new Table(originalTableName, ""); // COLUMNS try (ResultSet colRS = md.getColumns(null, null, internalTableName, null)) { @@ -90,7 +90,7 @@ private void init() throws SQLException { Integer colSize = colRS.getInt(7); boolean colNullable = colRS.getString(18).equalsIgnoreCase("YES"); - Column catalogCol = new Column(colName, colName.toUpperCase(), "", catalogTable, colType, colSize, colNullable); + Column catalogCol = new Column(colName, "", catalogTable, colType, colSize, colNullable); // TODO(WAN): The following block of code was relevant for programmatic CreateDialect support. // i.e., using the HSQLDB catalog instance to automatically create dialects for other DBMSs. // Since we don't add new database support often, and can hand-write most of that, @@ -148,7 +148,7 @@ private void init() throws SQLException { Index catalogIdx = catalogTable.getIndex(idxName); if (catalogIdx == null) { - catalogIdx = new Index(idxName, idxName.toUpperCase(), "", catalogTable, idxType, idxUnique); + catalogIdx = new Index(idxName, "", catalogTable, idxType, idxUnique); catalogTable.addIndex(catalogIdx); } catalogIdx.addColumn(idxColName, idxDirection, idxColPos); @@ -172,9 +172,6 @@ private void init() throws SQLException { for (Table catalogTable : this.tables.values()) { Map> fk = foreignKeys.get(catalogTable.getName()); - if (fk == null) { - continue; - } fk.forEach((colName, fkey) -> { Column catalogCol = catalogTable.getColumnByName(colName); diff --git a/src/main/java/com/oltpbenchmark/catalog/Index.java b/src/main/java/com/oltpbenchmark/catalog/Index.java index ce22b19aa..6903540fa 100644 --- a/src/main/java/com/oltpbenchmark/catalog/Index.java +++ b/src/main/java/com/oltpbenchmark/catalog/Index.java @@ -49,8 +49,8 @@ public SortDirectionType getDir() { } } - public Index(String name, String uppercaseName, String separator, Table table, int type, boolean unique) { - super(name, uppercaseName, separator); + public Index(String name, String separator, Table table, int type, boolean unique) { + super(name, separator); this.table = table; this.type = type; this.unique = unique; diff --git a/src/main/java/com/oltpbenchmark/catalog/Table.java b/src/main/java/com/oltpbenchmark/catalog/Table.java index 9a530d540..b6ca8d38b 100644 --- a/src/main/java/com/oltpbenchmark/catalog/Table.java +++ b/src/main/java/com/oltpbenchmark/catalog/Table.java @@ -37,8 +37,8 @@ public class Table extends AbstractCatalogObject { private final List columns = new ArrayList<>(); private final List indexes = new ArrayList<>(); - public Table(String name, String uppercaseName, String separator) { - super(name, uppercaseName, separator); + public Table(String name, String separator) { + super(name, separator); } public void addColumn(Column col) { diff --git a/src/main/java/com/oltpbenchmark/util/SQLUtil.java b/src/main/java/com/oltpbenchmark/util/SQLUtil.java index 81637d6ac..36d95e818 100644 --- a/src/main/java/com/oltpbenchmark/util/SQLUtil.java +++ b/src/main/java/com/oltpbenchmark/util/SQLUtil.java @@ -448,7 +448,7 @@ private static AbstractCatalog getCatalogDirect(DatabaseType databaseType, Conne } String table_name = table_rs.getString("TABLE_NAME"); - Table catalog_tbl = new Table(table_name, StringUtils.upperCase(table_name), separator); + Table catalog_tbl = new Table(table_name, separator); try (ResultSet col_rs = md.getColumns(catalog, schema, table_name, null)) { while (col_rs.next()) { @@ -463,7 +463,7 @@ private static AbstractCatalog getCatalogDirect(DatabaseType databaseType, Conne Integer col_size = col_rs.getInt("COLUMN_SIZE"); boolean col_nullable = col_rs.getString("IS_NULLABLE").equalsIgnoreCase("YES"); - Column catalog_col = new Column(col_name, StringUtils.upperCase(col_name), separator, catalog_tbl, col_type, col_size, col_nullable); + Column catalog_col = new Column(col_name, separator, catalog_tbl, col_type, col_size, col_nullable); catalog_tbl.addColumn(catalog_col); } @@ -486,7 +486,7 @@ private static AbstractCatalog getCatalogDirect(DatabaseType databaseType, Conne Index catalog_idx = catalog_tbl.getIndex(idx_name); if (catalog_idx == null) { - catalog_idx = new Index(idx_name, StringUtils.upperCase(idx_name), separator, catalog_tbl, idx_type, idx_unique); + catalog_idx = new Index(idx_name, separator, catalog_tbl, idx_type, idx_unique); catalog_tbl.addIndex(catalog_idx); } diff --git a/src/main/java/com/oltpbenchmark/util/TableDataIterable.java b/src/main/java/com/oltpbenchmark/util/TableDataIterable.java index f7749bdcd..b9d081d81 100644 --- a/src/main/java/com/oltpbenchmark/util/TableDataIterable.java +++ b/src/main/java/com/oltpbenchmark/util/TableDataIterable.java @@ -120,18 +120,17 @@ public Object[] next() { row = this.next; this.next = null; } - Object[] tuple = new Object[types.length]; int row_idx = 0; for (int col_idx = 0; col_idx < types.length; col_idx++) { // Auto-generate first column if (col_idx == 0 && auto_generate_first_column) { tuple[col_idx] = (long) line_ctr; - } - // Null Values - else if (row_idx >= row.length) { + } else if (row_idx >= row.length) { + // Null values. tuple[col_idx] = null; } else if (fkeys[col_idx]) { + // Foreign keys. tuple[col_idx] = row[row_idx++]; } // Default: Cast the string into the proper type diff --git a/src/main/resources/benchmarks/seats/ddl-generic.sql b/src/main/resources/benchmarks/seats/ddl-generic.sql index 8b09304b9..c47988a9c 100644 --- a/src/main/resources/benchmarks/seats/ddl-generic.sql +++ b/src/main/resources/benchmarks/seats/ddl-generic.sql @@ -1,272 +1,283 @@ -- Drop Tables -DROP TABLE IF EXISTS RESERVATION; -DROP TABLE IF EXISTS FLIGHT; -DROP TABLE IF EXISTS FREQUENT_FLYER; -DROP TABLE IF EXISTS CUSTOMER; -DROP TABLE IF EXISTS AIRLINE; -DROP TABLE IF EXISTS AIRPORT_DISTANCE; -DROP TABLE IF EXISTS AIRPORT; -DROP TABLE IF EXISTS CONFIG_HISTOGRAMS; -DROP TABLE IF EXISTS CONFIG_PROFILE; -DROP TABLE IF EXISTS COUNTRY; +DROP TABLE IF EXISTS config_profile; +DROP TABLE IF EXISTS config_histograms; +DROP TABLE IF EXISTS reservation; +DROP TABLE IF EXISTS frequent_flyer; +DROP TABLE IF EXISTS customer; +DROP TABLE IF EXISTS flight; +DROP TABLE IF EXISTS airport_distance; +DROP TABLE IF EXISTS airport; +DROP TABLE IF EXISTS airline; +DROP TABLE IF EXISTS country; -- -- CONFIG_PROFILE -- -CREATE TABLE CONFIG_PROFILE ( - CFP_SCALE_FACTOR FLOAT NOT NULL, - CFP_AIPORT_MAX_CUSTOMER VARCHAR(10001) NOT NULL, - CFP_FLIGHT_START TIMESTAMP NOT NULL, - CFP_FLIGHT_UPCOMING TIMESTAMP NOT NULL, - CFP_FLIGHT_PAST_DAYS INT NOT NULL, - CFP_FLIGHT_FUTURE_DAYS INT NOT NULL, - CFP_FLIGHT_OFFSET INT, - CFP_RESERVATION_OFFSET INT, - CFP_NUM_RESERVATIONS BIGINT NOT NULL, - CFP_CODE_IDS_XREFS VARCHAR(16004) NOT NULL +CREATE TABLE config_profile ( + cfp_scale_factor float NOT NULL, + cfp_aiport_max_customer varchar(10001) NOT NULL, + cfp_flight_start timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, + cfp_flight_upcoming timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, + cfp_flight_past_days int NOT NULL, + cfp_flight_future_days int NOT NULL, + cfp_flight_offset int, + cfp_reservation_offset int, + cfp_num_reservations bigint NOT NULL, + cfp_code_ids_xrefs varchar(16004) NOT NULL ); -- -- CONFIG_HISTOGRAMS -- -CREATE TABLE CONFIG_HISTOGRAMS ( - CFH_NAME VARCHAR(128) NOT NULL, - CFH_DATA VARCHAR(10005) NOT NULL, - CFH_IS_AIRPORT TINYINT DEFAULT 0, - PRIMARY KEY (CFH_NAME) +CREATE TABLE config_histograms ( + cfh_name varchar(128) NOT NULL, + cfh_data varchar(10005) NOT NULL, + cfh_is_airport tinyint DEFAULT 0, + PRIMARY KEY (cfh_name) ); -- -- COUNTRY -- -CREATE TABLE COUNTRY ( - CO_ID BIGINT NOT NULL, - CO_NAME VARCHAR(64) NOT NULL, - CO_CODE_2 VARCHAR(2) NOT NULL, - CO_CODE_3 VARCHAR(3) NOT NULL, - PRIMARY KEY (CO_ID) +CREATE TABLE country ( + co_id bigint NOT NULL, + co_name varchar(64) NOT NULL, + co_code_2 varchar(2) NOT NULL, + co_code_3 varchar(3) NOT NULL, + PRIMARY KEY (co_id) ); -- -- AIRPORT -- -CREATE TABLE AIRPORT ( - AP_ID BIGINT NOT NULL, - AP_CODE VARCHAR(3) NOT NULL, - AP_NAME VARCHAR(128) NOT NULL, - AP_CITY VARCHAR(64) NOT NULL, - AP_POSTAL_CODE VARCHAR(12), - AP_CO_ID BIGINT NOT NULL REFERENCES COUNTRY (CO_ID), - AP_LONGITUDE FLOAT, - AP_LATITUDE FLOAT, - AP_GMT_OFFSET FLOAT, - AP_WAC BIGINT, - AP_IATTR00 BIGINT, - AP_IATTR01 BIGINT, - AP_IATTR02 BIGINT, - AP_IATTR03 BIGINT, - AP_IATTR04 BIGINT, - AP_IATTR05 BIGINT, - AP_IATTR06 BIGINT, - AP_IATTR07 BIGINT, - AP_IATTR08 BIGINT, - AP_IATTR09 BIGINT, - AP_IATTR10 BIGINT, - AP_IATTR11 BIGINT, - AP_IATTR12 BIGINT, - AP_IATTR13 BIGINT, - AP_IATTR14 BIGINT, - AP_IATTR15 BIGINT, - PRIMARY KEY (AP_ID) +CREATE TABLE airport ( + ap_id bigint NOT NULL, + ap_code varchar(3) NOT NULL, + ap_name varchar(128) NOT NULL, + ap_city varchar(64) NOT NULL, + ap_postal_code varchar(12), + ap_co_id bigint NOT NULL, + ap_longitude float, + ap_latitude float, + ap_gmt_offset float, + ap_wac bigint, + ap_iattr00 bigint, + ap_iattr01 bigint, + ap_iattr02 bigint, + ap_iattr03 bigint, + ap_iattr04 bigint, + ap_iattr05 bigint, + ap_iattr06 bigint, + ap_iattr07 bigint, + ap_iattr08 bigint, + ap_iattr09 bigint, + ap_iattr10 bigint, + ap_iattr11 bigint, + ap_iattr12 bigint, + ap_iattr13 bigint, + ap_iattr14 bigint, + ap_iattr15 bigint, + PRIMARY KEY (ap_id), + FOREIGN KEY (ap_co_id) REFERENCES country (co_id) ); -- -- AIRPORT_DISTANCE -- -CREATE TABLE AIRPORT_DISTANCE ( - D_AP_ID0 BIGINT NOT NULL REFERENCES AIRPORT (AP_ID), - D_AP_ID1 BIGINT NOT NULL REFERENCES AIRPORT (AP_ID), - D_DISTANCE FLOAT NOT NULL, - PRIMARY KEY (D_AP_ID0, D_AP_ID1) +CREATE TABLE airport_distance ( + d_ap_id0 bigint NOT NULL, + d_ap_id1 bigint NOT NULL, + d_distance float NOT NULL, + PRIMARY KEY (d_ap_id0, d_ap_id1), + FOREIGN KEY (d_ap_id0) REFERENCES airport (ap_id), + FOREIGN KEY (d_ap_id1) REFERENCES airport (ap_id) ); -- -- AIRLINE -- -CREATE TABLE AIRLINE ( - AL_ID BIGINT NOT NULL, - AL_IATA_CODE VARCHAR(3), - AL_ICAO_CODE VARCHAR(3), - AL_CALL_SIGN VARCHAR(32), - AL_NAME VARCHAR(128) NOT NULL, - AL_CO_ID BIGINT NOT NULL REFERENCES COUNTRY (CO_ID), - AL_IATTR00 BIGINT, - AL_IATTR01 BIGINT, - AL_IATTR02 BIGINT, - AL_IATTR03 BIGINT, - AL_IATTR04 BIGINT, - AL_IATTR05 BIGINT, - AL_IATTR06 BIGINT, - AL_IATTR07 BIGINT, - AL_IATTR08 BIGINT, - AL_IATTR09 BIGINT, - AL_IATTR10 BIGINT, - AL_IATTR11 BIGINT, - AL_IATTR12 BIGINT, - AL_IATTR13 BIGINT, - AL_IATTR14 BIGINT, - AL_IATTR15 BIGINT, - PRIMARY KEY (AL_ID) +CREATE TABLE airline ( + al_id bigint NOT NULL, + al_iata_code varchar(3), + al_icao_code varchar(3), + al_call_sign varchar(32), + al_name varchar(128) NOT NULL, + al_co_id bigint NOT NULL REFERENCES country (co_id), + al_iattr00 bigint, + al_iattr01 bigint, + al_iattr02 bigint, + al_iattr03 bigint, + al_iattr04 bigint, + al_iattr05 bigint, + al_iattr06 bigint, + al_iattr07 bigint, + al_iattr08 bigint, + al_iattr09 bigint, + al_iattr10 bigint, + al_iattr11 bigint, + al_iattr12 bigint, + al_iattr13 bigint, + al_iattr14 bigint, + al_iattr15 bigint, + PRIMARY KEY (al_id) ); -- -- CUSTOMER -- -CREATE TABLE CUSTOMER ( - C_ID BIGINT NOT NULL, - C_ID_STR VARCHAR(64) UNIQUE NOT NULL, - C_BASE_AP_ID BIGINT REFERENCES AIRPORT (AP_ID), - C_BALANCE FLOAT NOT NULL, - C_SATTR00 VARCHAR(32), - C_SATTR01 VARCHAR(8), - C_SATTR02 VARCHAR(8), - C_SATTR03 VARCHAR(8), - C_SATTR04 VARCHAR(8), - C_SATTR05 VARCHAR(8), - C_SATTR06 VARCHAR(8), - C_SATTR07 VARCHAR(8), - C_SATTR08 VARCHAR(8), - C_SATTR09 VARCHAR(8), - C_SATTR10 VARCHAR(8), - C_SATTR11 VARCHAR(8), - C_SATTR12 VARCHAR(8), - C_SATTR13 VARCHAR(8), - C_SATTR14 VARCHAR(8), - C_SATTR15 VARCHAR(8), - C_SATTR16 VARCHAR(8), - C_SATTR17 VARCHAR(8), - C_SATTR18 VARCHAR(8), - C_SATTR19 VARCHAR(8), - C_IATTR00 BIGINT, - C_IATTR01 BIGINT, - C_IATTR02 BIGINT, - C_IATTR03 BIGINT, - C_IATTR04 BIGINT, - C_IATTR05 BIGINT, - C_IATTR06 BIGINT, - C_IATTR07 BIGINT, - C_IATTR08 BIGINT, - C_IATTR09 BIGINT, - C_IATTR10 BIGINT, - C_IATTR11 BIGINT, - C_IATTR12 BIGINT, - C_IATTR13 BIGINT, - C_IATTR14 BIGINT, - C_IATTR15 BIGINT, - C_IATTR16 BIGINT, - C_IATTR17 BIGINT, - C_IATTR18 BIGINT, - C_IATTR19 BIGINT, - PRIMARY KEY (C_ID) +CREATE TABLE customer ( + c_id bigint NOT NULL, + c_id_str varchar(64) UNIQUE NOT NULL, + c_base_ap_id bigint, + c_balance float NOT NULL, + c_sattr00 varchar(32), + c_sattr01 varchar(8), + c_sattr02 varchar(8), + c_sattr03 varchar(8), + c_sattr04 varchar(8), + c_sattr05 varchar(8), + c_sattr06 varchar(8), + c_sattr07 varchar(8), + c_sattr08 varchar(8), + c_sattr09 varchar(8), + c_sattr10 varchar(8), + c_sattr11 varchar(8), + c_sattr12 varchar(8), + c_sattr13 varchar(8), + c_sattr14 varchar(8), + c_sattr15 varchar(8), + c_sattr16 varchar(8), + c_sattr17 varchar(8), + c_sattr18 varchar(8), + c_sattr19 varchar(8), + c_iattr00 bigint, + c_iattr01 bigint, + c_iattr02 bigint, + c_iattr03 bigint, + c_iattr04 bigint, + c_iattr05 bigint, + c_iattr06 bigint, + c_iattr07 bigint, + c_iattr08 bigint, + c_iattr09 bigint, + c_iattr10 bigint, + c_iattr11 bigint, + c_iattr12 bigint, + c_iattr13 bigint, + c_iattr14 bigint, + c_iattr15 bigint, + c_iattr16 bigint, + c_iattr17 bigint, + c_iattr18 bigint, + c_iattr19 bigint, + PRIMARY KEY (c_id), + FOREIGN KEY (c_base_ap_id) REFERENCES airport (ap_id) ); -- -- FREQUENT_FLYER -- -CREATE TABLE FREQUENT_FLYER ( - FF_C_ID BIGINT NOT NULL REFERENCES CUSTOMER (C_ID), - FF_AL_ID BIGINT NOT NULL REFERENCES AIRLINE (AL_ID), - FF_C_ID_STR VARCHAR(64) NOT NULL, - FF_SATTR00 VARCHAR(32), - FF_SATTR01 VARCHAR(32), - FF_SATTR02 VARCHAR(32), - FF_SATTR03 VARCHAR(32), - FF_IATTR00 BIGINT, - FF_IATTR01 BIGINT, - FF_IATTR02 BIGINT, - FF_IATTR03 BIGINT, - FF_IATTR04 BIGINT, - FF_IATTR05 BIGINT, - FF_IATTR06 BIGINT, - FF_IATTR07 BIGINT, - FF_IATTR08 BIGINT, - FF_IATTR09 BIGINT, - FF_IATTR10 BIGINT, - FF_IATTR11 BIGINT, - FF_IATTR12 BIGINT, - FF_IATTR13 BIGINT, - FF_IATTR14 BIGINT, - FF_IATTR15 BIGINT, - PRIMARY KEY (FF_C_ID, FF_AL_ID) +CREATE TABLE frequent_flyer ( + ff_c_id bigint NOT NULL, + ff_al_id bigint NOT NULL, + ff_c_id_str varchar(64) NOT NULL, + ff_sattr00 varchar(32), + ff_sattr01 varchar(32), + ff_sattr02 varchar(32), + ff_sattr03 varchar(32), + ff_iattr00 bigint, + ff_iattr01 bigint, + ff_iattr02 bigint, + ff_iattr03 bigint, + ff_iattr04 bigint, + ff_iattr05 bigint, + ff_iattr06 bigint, + ff_iattr07 bigint, + ff_iattr08 bigint, + ff_iattr09 bigint, + ff_iattr10 bigint, + ff_iattr11 bigint, + ff_iattr12 bigint, + ff_iattr13 bigint, + ff_iattr14 bigint, + ff_iattr15 bigint, + PRIMARY KEY (ff_c_id, ff_al_id), + FOREIGN KEY (ff_c_id) REFERENCES customer (c_id), + FOREIGN KEY (ff_al_id) REFERENCES airline (al_id) ); -CREATE INDEX IDX_FF_CUSTOMER_ID ON FREQUENT_FLYER (FF_C_ID_STR); +CREATE INDEX idx_ff_customer_id ON frequent_flyer (ff_c_id_str); -- -- FLIGHT -- -CREATE TABLE FLIGHT ( - F_ID BIGINT NOT NULL, - F_AL_ID BIGINT NOT NULL REFERENCES AIRLINE (AL_ID), - F_DEPART_AP_ID BIGINT NOT NULL REFERENCES AIRPORT (AP_ID), - F_DEPART_TIME TIMESTAMP NOT NULL, - F_ARRIVE_AP_ID BIGINT NOT NULL REFERENCES AIRPORT (AP_ID), - F_ARRIVE_TIME TIMESTAMP NOT NULL, - F_STATUS BIGINT NOT NULL, - F_BASE_PRICE FLOAT NOT NULL, - F_SEATS_TOTAL BIGINT NOT NULL, - F_SEATS_LEFT BIGINT NOT NULL, - F_IATTR00 BIGINT, - F_IATTR01 BIGINT, - F_IATTR02 BIGINT, - F_IATTR03 BIGINT, - F_IATTR04 BIGINT, - F_IATTR05 BIGINT, - F_IATTR06 BIGINT, - F_IATTR07 BIGINT, - F_IATTR08 BIGINT, - F_IATTR09 BIGINT, - F_IATTR10 BIGINT, - F_IATTR11 BIGINT, - F_IATTR12 BIGINT, - F_IATTR13 BIGINT, - F_IATTR14 BIGINT, - F_IATTR15 BIGINT, - F_IATTR16 BIGINT, - F_IATTR17 BIGINT, - F_IATTR18 BIGINT, - F_IATTR19 BIGINT, - F_IATTR20 BIGINT, - F_IATTR21 BIGINT, - F_IATTR22 BIGINT, - F_IATTR23 BIGINT, - F_IATTR24 BIGINT, - F_IATTR25 BIGINT, - F_IATTR26 BIGINT, - F_IATTR27 BIGINT, - F_IATTR28 BIGINT, - F_IATTR29 BIGINT, - PRIMARY KEY (F_ID) +CREATE TABLE flight ( + f_id bigint NOT NULL, + f_al_id bigint NOT NULL, + f_depart_ap_id bigint NOT NULL, + f_depart_time timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, + f_arrive_ap_id bigint NOT NULL, + f_arrive_time timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, + f_status bigint NOT NULL, + f_base_price float NOT NULL, + f_seats_total bigint NOT NULL, + f_seats_left bigint NOT NULL, + f_iattr00 bigint, + f_iattr01 bigint, + f_iattr02 bigint, + f_iattr03 bigint, + f_iattr04 bigint, + f_iattr05 bigint, + f_iattr06 bigint, + f_iattr07 bigint, + f_iattr08 bigint, + f_iattr09 bigint, + f_iattr10 bigint, + f_iattr11 bigint, + f_iattr12 bigint, + f_iattr13 bigint, + f_iattr14 bigint, + f_iattr15 bigint, + f_iattr16 bigint, + f_iattr17 bigint, + f_iattr18 bigint, + f_iattr19 bigint, + f_iattr20 bigint, + f_iattr21 bigint, + f_iattr22 bigint, + f_iattr23 bigint, + f_iattr24 bigint, + f_iattr25 bigint, + f_iattr26 bigint, + f_iattr27 bigint, + f_iattr28 bigint, + f_iattr29 bigint, + PRIMARY KEY (f_id), + FOREIGN KEY (f_al_id) REFERENCES airline (al_id), + FOREIGN KEY (f_depart_ap_id) REFERENCES airport (ap_id), + FOREIGN KEY (f_arrive_ap_id) REFERENCES airport (ap_id) ); -create index F_DEPART_TIME_IDX on FLIGHT (F_DEPART_TIME); +CREATE INDEX f_depart_time_idx ON flight (f_depart_time); -- -- RESERVATION -- -CREATE TABLE RESERVATION ( - R_ID BIGINT NOT NULL, - R_C_ID BIGINT NOT NULL REFERENCES CUSTOMER (C_ID), - R_F_ID BIGINT NOT NULL REFERENCES FLIGHT (F_ID), - R_SEAT BIGINT NOT NULL, - R_PRICE FLOAT NOT NULL, - R_IATTR00 BIGINT, - R_IATTR01 BIGINT, - R_IATTR02 BIGINT, - R_IATTR03 BIGINT, - R_IATTR04 BIGINT, - R_IATTR05 BIGINT, - R_IATTR06 BIGINT, - R_IATTR07 BIGINT, - R_IATTR08 BIGINT, - UNIQUE (R_F_ID, R_SEAT), - PRIMARY KEY (R_ID, R_C_ID, R_F_ID) +CREATE TABLE reservation ( + r_id bigint NOT NULL, + r_c_id bigint NOT NULL, + r_f_id bigint NOT NULL, + r_seat bigint NOT NULL, + r_price float NOT NULL, + r_iattr00 bigint, + r_iattr01 bigint, + r_iattr02 bigint, + r_iattr03 bigint, + r_iattr04 bigint, + r_iattr05 bigint, + r_iattr06 bigint, + r_iattr07 bigint, + r_iattr08 bigint, + UNIQUE (r_f_id, r_seat), + PRIMARY KEY (r_id, r_c_id, r_f_id), + FOREIGN KEY (r_c_id) REFERENCES customer (c_id), + FOREIGN KEY (r_f_id) REFERENCES flight (f_id) ); \ No newline at end of file diff --git a/src/test/java/com/oltpbenchmark/api/AbstractTestCase.java b/src/test/java/com/oltpbenchmark/api/AbstractTestCase.java index 3c2ff03fb..10a687d17 100644 --- a/src/test/java/com/oltpbenchmark/api/AbstractTestCase.java +++ b/src/test/java/com/oltpbenchmark/api/AbstractTestCase.java @@ -77,7 +77,7 @@ protected void setUp(Class clazz, Class... procClasses) throws Exception { assertFalse("Duplicate Procedure '" + procClasses[i] + "'", this.procClasses.contains(procClasses[i])); this.procClasses.add(procClasses[i]); - TransactionType tt = new TransactionType(procClasses[i], i); + TransactionType tt = new TransactionType(procClasses[i], i, false); txnTypes.add(tt); } // FOR diff --git a/src/test/java/com/oltpbenchmark/api/AbstractTestWorker.java b/src/test/java/com/oltpbenchmark/api/AbstractTestWorker.java index df22e8fc5..801ae99fb 100644 --- a/src/test/java/com/oltpbenchmark/api/AbstractTestWorker.java +++ b/src/test/java/com/oltpbenchmark/api/AbstractTestWorker.java @@ -80,6 +80,7 @@ public void testExecuteWork() throws Exception { w.initialize(); assertFalse(this.conn.isReadOnly()); for (TransactionType txnType : this.workConf.getTransTypes()) { + if (txnType.isSupplemental()) { continue; } try { // Bombs away! // System.err.println("Executing " + txnType); diff --git a/src/test/java/com/oltpbenchmark/benchmarks/auctionmark/util/TestUserIdGenerator.java b/src/test/java/com/oltpbenchmark/benchmarks/auctionmark/util/TestUserIdGenerator.java index e2e84c68c..cbef7c719 100644 --- a/src/test/java/com/oltpbenchmark/benchmarks/auctionmark/util/TestUserIdGenerator.java +++ b/src/test/java/com/oltpbenchmark/benchmarks/auctionmark/util/TestUserIdGenerator.java @@ -1,280 +1,280 @@ -///****************************************************************************** -// * Copyright 2015 by OLTPBenchmark Project * -// * * -// * Licensed under the Apache License, Version 2.0 (the "License"); * -// * you may not use this file except in compliance with the License. * -// * You may obtain a copy of the License at * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software * -// * distributed under the License is distributed on an "AS IS" BASIS, * -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * -// * See the License for the specific language governing permissions and * -// * limitations under the License. * -// ******************************************************************************/ -// -// -//package com.oltpbenchmark.benchmarks.auctionmark.util; -// -//import static org.hamcrest.CoreMatchers.equalTo; -//import static org.hamcrest.CoreMatchers.not; -//import static org.junit.Assert.assertThat; -// -//import java.util.Collection; -//import java.util.HashMap; -//import java.util.HashSet; -//import java.util.Map; -//import java.util.Random; -//import java.util.Set; -//import java.util.TreeMap; -// -//import junit.framework.TestCase; -// -//import org.junit.Before; -// -//import com.oltpbenchmark.benchmarks.auctionmark.AuctionMarkConstants; -//import com.oltpbenchmark.util.CollectionUtil; -//import com.oltpbenchmark.util.Histogram; -//import com.oltpbenchmark.util.RandomDistribution.Zipf; -//import com.oltpbenchmark.util.RandomGenerator; -// -///** -// * -// * @author pavlo -// */ -//public class TestUserIdGenerator extends TestCase { -// -// private static final int NUM_CLIENTS = 10; -// private static final int NUM_USERS = 1000; -// private static final RandomGenerator rand = new RandomGenerator(0); // (int)System.currentTimeMillis()); -// -// private static final Zipf randomNumItems = new Zipf(rand, -// AuctionMarkConstants.ITEM_ITEMS_PER_SELLER_MIN, -// AuctionMarkConstants.ITEM_ITEMS_PER_SELLER_MAX, -// 1.0001); -// -// private final Histogram users_per_item_count = new Histogram(); -// -// -// @Before -// public void setUp() throws Exception { -// for (long i = 0; i < NUM_USERS; i++) { -// this.users_per_item_count.put((long)randomNumItems.nextInt()); -// } // FOR -// assertEquals(NUM_USERS, this.users_per_item_count.getSampleCount()); -// } -// -// /** -// * testCheckClient -// */ -// public void testCheckClient() throws Exception { -// int num_clients = 10; -// UserIdGenerator generator; -// -// // Create a mapping from each Client Id -> UserIds -// Map> clientIds = new HashMap>(); -// Map clientGenerators = new HashMap(); -// for (int client = 0; client < num_clients; client++) { -// generator = new UserIdGenerator(users_per_item_count, num_clients, client); -// Collection users = CollectionUtil.addAll(new HashSet(), CollectionUtil.iterable(generator)); -// assertFalse(users.isEmpty()); -// clientIds.put(client, users); -// clientGenerators.put(client, generator); -// } // FOR -// -// // Then loop back through all of the User Ids and make sure that each UserId -// // is mappable to the expected client -// generator = new UserIdGenerator(users_per_item_count, num_clients); -// int ctr = 0; -// for (UserId user_id : CollectionUtil.iterable(generator)) { -// assertNotNull(user_id); -// boolean found = false; -// for (int client = 0; client < num_clients; client++) { -// boolean expected = clientIds.get(client).contains(user_id); -// if (expected) assertFalse(found); -// boolean actual = clientGenerators.get(client).checkClient(user_id); -// assertEquals(String.format("[%03d] %d / %s", ctr, client, user_id), expected, actual); -// found = (found || expected); -// ctr++; -// } // FOR -// assertTrue(user_id.toString(), found); -// } // FOR -// } -// -// /** -// * testSeekToPosition -// */ -// public void testSeekToPosition() throws Exception { -// UserIdGenerator generator = new UserIdGenerator(users_per_item_count, 1); -// final int num_users = (int)(generator.getTotalUsers()-1); -// -// int itemCount = rand.nextInt(users_per_item_count.getMaxValue().intValue()-1); -// generator.setCurrentItemCount(itemCount); +/****************************************************************************** + * Copyright 2015 by OLTPBenchmark Project * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + ******************************************************************************/ + + +package com.oltpbenchmark.benchmarks.auctionmark.util; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.assertThat; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.TreeMap; + +import junit.framework.TestCase; + +import org.junit.Before; + +import com.oltpbenchmark.benchmarks.auctionmark.AuctionMarkConstants; +import com.oltpbenchmark.util.CollectionUtil; +import com.oltpbenchmark.util.Histogram; +import com.oltpbenchmark.util.RandomDistribution.Zipf; +import com.oltpbenchmark.util.RandomGenerator; + +/** + * + * @author pavlo + */ +public class TestUserIdGenerator extends TestCase { + + private static final int NUM_CLIENTS = 10; + private static final int NUM_USERS = 1000; + private static final RandomGenerator rand = new RandomGenerator(0); // (int)System.currentTimeMillis()); + + private static final Zipf randomNumItems = new Zipf(rand, + AuctionMarkConstants.ITEM_ITEMS_PER_SELLER_MIN, + AuctionMarkConstants.ITEM_ITEMS_PER_SELLER_MAX, + 1.0001); + + private final Histogram users_per_item_count = new Histogram(); + + + @Before + public void setUp() throws Exception { + for (long i = 0; i < NUM_USERS; i++) { + this.users_per_item_count.put((long)randomNumItems.nextInt()); + } // FOR + assertEquals(NUM_USERS, this.users_per_item_count.getSampleCount()); + } + + /** + * testCheckClient + */ + public void testCheckClient() throws Exception { + int num_clients = 10; + UserIdGenerator generator; + + // Create a mapping from each Client Id -> UserIds + Map> clientIds = new HashMap<>(); + Map clientGenerators = new HashMap<>(); + for (int client = 0; client < num_clients; client++) { + generator = new UserIdGenerator(users_per_item_count, num_clients, client); + Collection users = CollectionUtil.addAll(new HashSet<>(), CollectionUtil.iterable(generator).iterator()); + assertFalse(users.isEmpty()); + clientIds.put(client, users); + clientGenerators.put(client, generator); + } // FOR + + // Then loop back through all of the User Ids and make sure that each UserId + // is mappable to the expected client + generator = new UserIdGenerator(users_per_item_count, num_clients); + int ctr = 0; + for (UserId user_id : CollectionUtil.iterable(generator)) { + assertNotNull(user_id); + boolean found = false; + for (int client = 0; client < num_clients; client++) { + boolean expected = clientIds.get(client).contains(user_id); + if (expected) assertFalse(found); + boolean actual = clientGenerators.get(client).checkClient(user_id); + assertEquals(String.format("[%03d] %d / %s", ctr, client, user_id), expected, actual); + found = (found || expected); + ctr++; + } // FOR + assertTrue(user_id.toString(), found); + } // FOR + } + + /** + * testSeekToPosition + */ + public void testSeekToPosition() throws Exception { + UserIdGenerator generator = new UserIdGenerator(users_per_item_count, 1); + final int num_users = (int)(generator.getTotalUsers()-1); + + int itemCount = rand.nextInt(users_per_item_count.getMaxValue().intValue()-1); + generator.setCurrentItemCount(itemCount); // System.err.println("itemCount = " + itemCount); -// -// int cur_position = generator.getCurrentPosition(); -// int new_position = rand.number(cur_position, num_users); -//// System.err.println(users_per_item_count); + + int cur_position = generator.getCurrentPosition(); + int new_position = rand.number(cur_position, num_users); +// System.err.println(users_per_item_count); // System.err.println("cur_position = " + cur_position); // System.err.println("new_position = " + new_position); -// generator.setCurrentItemCount(0); -// UserId expected = null; -// for (int i = 0; i <= new_position; i++) { -// assertTrue(generator.hasNext()); -// expected = generator.next(); -// assertNotNull(expected); -// } // FOR -// -// generator.setCurrentItemCount(0); -// UserId user_id = generator.seekToPosition(new_position); -// assertNotNull(user_id); + generator.setCurrentItemCount(0); + UserId expected = null; + for (int i = 0; i <= new_position; i++) { + assertTrue(generator.hasNext()); + expected = generator.next(); + assertNotNull(expected); + } // FOR + + generator.setCurrentItemCount(0); + UserId user_id = generator.seekToPosition(new_position); + assertNotNull(user_id); // System.err.println(user_id); -// assertEquals(expected, user_id); -// } -// -// /** -// * testSeekToPositionSameUserId -// */ -// public void testSeekToPositionClientId() throws Exception { -// int num_clients = 10; -// UserIdGenerator generator = new UserIdGenerator(users_per_item_count, num_clients); -// final int num_users = (int)(generator.getTotalUsers()-1); -// -// Map expectedIds = new TreeMap(); -// while (generator.hasNext()) { -// int position = generator.getCurrentPosition(); -// UserId user_id = generator.next(); -// assertNotNull(user_id); -// expectedIds.put(position, user_id); -// } // WHILE -//// System.err.println(StringUtil.formatMaps(expectedIds)); -// -// for (int client = 0; client < num_clients; client++) { -// generator = new UserIdGenerator(users_per_item_count, num_clients, client); -// -// // Randomly jump around and make sure that we get the same UserId per position -// for (int i = 0; i < NUM_USERS; i++) { -// // This could be null because there were no more UserIds for this -// // client beyond the given position -// int position = rand.nextInt(num_users); -// UserId user_id = generator.seekToPosition(position); -// if (user_id == null) continue; -// -// // We have to go back and get our position since we used a client id, -// // which means that the generator could skip ahead even more -// position = generator.getCurrentPosition(); -// UserId expected = expectedIds.get(position); -// assertNotNull(expected); -// -// assertEquals("Position: " + position, expected, user_id); -// } // FOR -// } // FOR -// -// } -// -// /** -// * testAllUsers -// */ -// public void testAllUsers() throws Exception { -// UserIdGenerator generator = new UserIdGenerator(users_per_item_count, NUM_CLIENTS); -// Set seen = new HashSet(); -// assert(generator.hasNext()); -// for (UserId u_id : CollectionUtil.iterable(generator)) { -// assertNotNull(u_id); -// assert(seen.contains(u_id) == false) : "Duplicate " + u_id; -// seen.add(u_id); -//// System.err.println(u_id); -// } // FOR -// assertEquals(NUM_USERS, seen.size()); -// } -// -// /** -// * testPerClient -// */ -// public void testPerClient() throws Exception { -// Histogram clients_h = new Histogram(); -// Set all_seen = new HashSet(); -// for (int client = 0; client < NUM_CLIENTS; client++) { -// UserIdGenerator generator = new UserIdGenerator(users_per_item_count, NUM_CLIENTS, client); -// Set seen = new HashSet(); -// assert(generator.hasNext()); -// for (UserId u_id : CollectionUtil.iterable(generator)) { -// assertNotNull(u_id); -// assert(seen.contains(u_id) == false) : "Duplicate " + u_id; -// assert(all_seen.contains(u_id) == false) : "Duplicate " + u_id; -// seen.add(u_id); -// all_seen.add(u_id); -// } // FOR -// assertThat(Integer.toString(client), NUM_USERS, not(equalTo(seen.size()))); -// assertFalse(Integer.toString(client), seen.isEmpty()); -// clients_h.put(client, seen.size()); -// } // FOR -// assertEquals(NUM_USERS, all_seen.size()); -// -// // Make sure that they all have the same number of UserIds -// Integer last_cnt = null; -// for (Integer client : clients_h.values()) { -// if (last_cnt != null) { -// assertEquals(client.toString(), last_cnt, clients_h.get(client)); -// } -// last_cnt = clients_h.get(client); -// } // FOR + assertEquals(expected, user_id); + } + + /** + * testSeekToPositionSameUserId + */ + public void testSeekToPositionClientId() throws Exception { + int num_clients = 10; + UserIdGenerator generator = new UserIdGenerator(users_per_item_count, num_clients); + final int num_users = (int)(generator.getTotalUsers()-1); + + Map expectedIds = new TreeMap(); + while (generator.hasNext()) { + int position = generator.getCurrentPosition(); + UserId user_id = generator.next(); + assertNotNull(user_id); + expectedIds.put(position, user_id); + } // WHILE +// System.err.println(StringUtil.formatMaps(expectedIds)); + + for (int client = 0; client < num_clients; client++) { + generator = new UserIdGenerator(users_per_item_count, num_clients, client); + + // Randomly jump around and make sure that we get the same UserId per position + for (int i = 0; i < NUM_USERS; i++) { + // This could be null because there were no more UserIds for this + // client beyond the given position + int position = rand.nextInt(num_users); + UserId user_id = generator.seekToPosition(position); + if (user_id == null) continue; + + // We have to go back and get our position since we used a client id, + // which means that the generator could skip ahead even more + position = generator.getCurrentPosition(); + UserId expected = expectedIds.get(position); + assertNotNull(expected); + + assertEquals("Position: " + position, expected, user_id); + } // FOR + } // FOR + + } + + /** + * testAllUsers + */ + public void testAllUsers() throws Exception { + UserIdGenerator generator = new UserIdGenerator(users_per_item_count, NUM_CLIENTS); + Set seen = new HashSet(); + assert(generator.hasNext()); + for (UserId u_id : CollectionUtil.iterable(generator)) { + assertNotNull(u_id); + assert(seen.contains(u_id) == false) : "Duplicate " + u_id; + seen.add(u_id); +// System.err.println(u_id); + } // FOR + assertEquals(NUM_USERS, seen.size()); + } + + /** + * testPerClient + */ + public void testPerClient() throws Exception { + Histogram clients_h = new Histogram(); + Set all_seen = new HashSet(); + for (int client = 0; client < NUM_CLIENTS; client++) { + UserIdGenerator generator = new UserIdGenerator(users_per_item_count, NUM_CLIENTS, client); + Set seen = new HashSet(); + assert(generator.hasNext()); + for (UserId u_id : CollectionUtil.iterable(generator)) { + assertNotNull(u_id); + assert(seen.contains(u_id) == false) : "Duplicate " + u_id; + assert(all_seen.contains(u_id) == false) : "Duplicate " + u_id; + seen.add(u_id); + all_seen.add(u_id); + } // FOR + assertThat(Integer.toString(client), NUM_USERS, not(equalTo(seen.size()))); + assertFalse(Integer.toString(client), seen.isEmpty()); + clients_h.put(client, seen.size()); + } // FOR + assertEquals(NUM_USERS, all_seen.size()); + + // Make sure that they all have the same number of UserIds + Integer last_cnt = null; + for (Integer client : clients_h.values()) { + if (last_cnt != null) { + assertEquals(client.toString(), last_cnt, clients_h.get(client)); + } + last_cnt = clients_h.get(client); + } // FOR // System.err.println(clients_h); -// } -// -// /** -// * testSingleClient -// */ -// public void testSingleClient() throws Exception { -// // First create a UserIdGenerator for all clients and get -// // the set of all the UserIds that we expect -// UserIdGenerator generator = new UserIdGenerator(users_per_item_count, 1); -// Set expected = new HashSet(); -// for (UserId u_id : CollectionUtil.iterable(generator)) { -// assertNotNull(u_id); -// assert(expected.contains(u_id) == false) : "Duplicate " + u_id; -// expected.add(u_id); -// } // FOR -// -// // Now create a new generator that only has one client. That means that we should -// // get back all the same UserIds -// Set actual = new HashSet(); -// generator = new UserIdGenerator(users_per_item_count, 1, 0); -// for (UserId u_id : CollectionUtil.iterable(generator)) { -// assertNotNull(u_id); -// assert(actual.contains(u_id) == false) : "Duplicate " + u_id; -// assert(expected.contains(u_id)) : "Unexpected " + u_id; -// actual.add(u_id); -// } // FOR -// assertEquals(expected.size(), actual.size()); -// } -// -// /** -// * testSetCurrentSize -// */ -// public void testSetCurrentSize() throws Exception { -// // First create a UserIdGenerator for a random ClientId and populate -// // the set of all the UserIds that we expect for this client -// Random rand = new Random(); -// int client = rand.nextInt(NUM_CLIENTS); -// UserIdGenerator generator = new UserIdGenerator(users_per_item_count, NUM_CLIENTS, client); -// Set seen = new HashSet(); -// for (UserId u_id : CollectionUtil.iterable(generator)) { -// assertNotNull(u_id); -// assert(seen.contains(u_id) == false) : "Duplicate " + u_id; -// seen.add(u_id); -// } // FOR -// -// // Now make sure that we always get back the same UserIds regardless of where -// // we jump around with using setCurrentSize() -// for (int i = 0; i < 10; i++) { -// int size = rand.nextInt((int)(users_per_item_count.getMaxValue()+1)); -// generator.setCurrentItemCount(size); -// for (UserId u_id : CollectionUtil.iterable(generator)) { -// assertNotNull(u_id); -// assert(seen.contains(u_id)) : "Unexpected " + u_id; -// } // FOR -// } // FOR -// } -//} + } + + /** + * testSingleClient + */ + public void testSingleClient() throws Exception { + // First create a UserIdGenerator for all clients and get + // the set of all the UserIds that we expect + UserIdGenerator generator = new UserIdGenerator(users_per_item_count, 1); + Set expected = new HashSet(); + for (UserId u_id : CollectionUtil.iterable(generator)) { + assertNotNull(u_id); + assert(expected.contains(u_id) == false) : "Duplicate " + u_id; + expected.add(u_id); + } // FOR + + // Now create a new generator that only has one client. That means that we should + // get back all the same UserIds + Set actual = new HashSet(); + generator = new UserIdGenerator(users_per_item_count, 1, 0); + for (UserId u_id : CollectionUtil.iterable(generator)) { + assertNotNull(u_id); + assert(actual.contains(u_id) == false) : "Duplicate " + u_id; + assert(expected.contains(u_id)) : "Unexpected " + u_id; + actual.add(u_id); + } // FOR + assertEquals(expected.size(), actual.size()); + } + + /** + * testSetCurrentSize + */ + public void testSetCurrentSize() throws Exception { + // First create a UserIdGenerator for a random ClientId and populate + // the set of all the UserIds that we expect for this client + Random rand = new Random(); + int client = rand.nextInt(NUM_CLIENTS); + UserIdGenerator generator = new UserIdGenerator(users_per_item_count, NUM_CLIENTS, client); + Set seen = new HashSet(); + for (UserId u_id : CollectionUtil.iterable(generator)) { + assertNotNull(u_id); + assert(seen.contains(u_id) == false) : "Duplicate " + u_id; + seen.add(u_id); + } // FOR + + // Now make sure that we always get back the same UserIds regardless of where + // we jump around with using setCurrentSize() + for (int i = 0; i < 10; i++) { + int size = rand.nextInt((int)(users_per_item_count.getMaxValue()+1)); + generator.setCurrentItemCount(size); + for (UserId u_id : CollectionUtil.iterable(generator)) { + assertNotNull(u_id); + assert(seen.contains(u_id)) : "Unexpected " + u_id; + } // FOR + } // FOR + } +} diff --git a/src/test/java/com/oltpbenchmark/benchmarks/seats/TestSEATSLoader.java b/src/test/java/com/oltpbenchmark/benchmarks/seats/TestSEATSLoader.java index 29c02d95a..34fd2665a 100644 --- a/src/test/java/com/oltpbenchmark/benchmarks/seats/TestSEATSLoader.java +++ b/src/test/java/com/oltpbenchmark/benchmarks/seats/TestSEATSLoader.java @@ -1,68 +1,70 @@ -///****************************************************************************** -// * Copyright 2015 by OLTPBenchmark Project * -// * * -// * Licensed under the Apache License, Version 2.0 (the "License"); * -// * you may not use this file except in compliance with the License. * -// * You may obtain a copy of the License at * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software * -// * distributed under the License is distributed on an "AS IS" BASIS, * -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * -// * See the License for the specific language governing permissions and * -// * limitations under the License. * -// ******************************************************************************/ -// -//package com.oltpbenchmark.benchmarks.seats; -// -//import java.util.List; -// -//import com.oltpbenchmark.api.AbstractTestLoader; -//import com.oltpbenchmark.api.Worker; -//import com.oltpbenchmark.util.RandomGenerator; -// -//public class TestSEATSLoader extends AbstractTestLoader { -// -// @Override -// protected void setUp() throws Exception { -// super.setUp(SEATSBenchmark.class, null, TestSEATSBenchmark.PROC_CLASSES); -// SEATSProfile.clearCachedProfile(); -// } -// -// /** -// * testSaveLoadProfile -// */ -// public void testSaveLoadProfile() throws Exception { -// this.benchmark.createDatabase(); -// SEATSLoader loader = (SEATSLoader)this.benchmark.loadDatabase(); -// assertNotNull(loader); -// -// SEATSProfile orig = loader.profile; -// assertNotNull(orig); -// -// // Make sure there is something in our profile after loading the database -// assertFalse("Empty Profile: airport_max_customer_id", orig.airport_max_customer_id.isEmpty()); -// -// SEATSProfile copy = new SEATSProfile(this.benchmark, new RandomGenerator(0)); -// assert(copy.airport_histograms.isEmpty()); -// -// List> workers = this.benchmark.makeWorkers(false); -// SEATSWorker worker = (SEATSWorker)workers.get(0); -// copy.loadProfile(worker); -// -// assertEquals(orig.scale_factor, copy.scale_factor); -// assertEquals(orig.airport_max_customer_id, copy.airport_max_customer_id); -// assertEquals(orig.flight_start_date.toString(), copy.flight_start_date.toString()); -// assertEquals(orig.flight_upcoming_date.toString(), copy.flight_upcoming_date.toString()); -// assertEquals(orig.flight_past_days, copy.flight_past_days); -// assertEquals(orig.flight_future_days, copy.flight_future_days); -// assertEquals(orig.flight_upcoming_offset, copy.flight_upcoming_offset); -// assertEquals(orig.reservation_upcoming_offset, copy.reservation_upcoming_offset); -// assertEquals(orig.num_reservations, copy.num_reservations); -// assertEquals(orig.histograms, copy.histograms); -// assertEquals(orig.airport_histograms, copy.airport_histograms); -//// assertEquals(orig.code_id_xref, copy.code_id_xref); -// } -// -//} +/****************************************************************************** + * Copyright 2015 by OLTPBenchmark Project * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + ******************************************************************************/ + +package com.oltpbenchmark.benchmarks.seats; + +import com.oltpbenchmark.api.AbstractTestLoader; +import com.oltpbenchmark.api.Worker; +import com.oltpbenchmark.util.RandomGenerator; + +import java.util.List; + +public class TestSEATSLoader extends AbstractTestLoader { + + @Override + protected void setUp() throws Exception { + super.setUp(SEATSBenchmark.class, null, TestSEATSBenchmark.PROC_CLASSES); + SEATSProfile.clearCachedProfile(); + } + + /** + * testSaveLoadProfile + */ + public void testSaveLoadProfile() throws Exception { + this.benchmark.createDatabase(); + SEATSLoader loader = (SEATSLoader) this.benchmark.loadDatabase(); + assertNotNull(loader); + + SEATSProfile orig = loader.profile; + assertNotNull(orig); + + // Make sure there is something in our profile after loading the database + assertFalse("Empty Profile: airport_max_customer_id", orig.airport_max_customer_id.isEmpty()); + + SEATSProfile copy = new SEATSProfile(this.benchmark, new RandomGenerator(0)); + assert (copy.airport_histograms.isEmpty()); + + List> workers = this.benchmark.makeWorkers(); + SEATSWorker worker = (SEATSWorker) workers.get(0); + copy.loadProfile(worker); + + assertEquals(orig.scale_factor, copy.scale_factor); + assertEquals(orig.airport_max_customer_id, copy.airport_max_customer_id); + assertEquals(orig.flight_start_date.toString(), copy.flight_start_date.toString()); + assertEquals(orig.flight_upcoming_date.toString(), copy.flight_upcoming_date.toString()); + assertEquals(orig.flight_past_days, copy.flight_past_days); + assertEquals(orig.flight_future_days, copy.flight_future_days); + assertEquals(orig.flight_upcoming_offset, copy.flight_upcoming_offset); + assertEquals(orig.reservation_upcoming_offset, copy.reservation_upcoming_offset); + assertEquals(orig.num_reservations, copy.num_reservations); + assertEquals(orig.histograms, copy.histograms); + assertEquals(orig.airport_histograms, copy.airport_histograms); + // TODO(WAN): This was commented out before and so it is still commented out now, but we should probably dig + // into why it is not the same. + // assertEquals(orig.code_id_xref, copy.code_id_xref); + } + +} diff --git a/src/test/java/com/oltpbenchmark/benchmarks/seats/TestSEATSWorker.java b/src/test/java/com/oltpbenchmark/benchmarks/seats/TestSEATSWorker.java index 55f275dc3..18bbbee63 100644 --- a/src/test/java/com/oltpbenchmark/benchmarks/seats/TestSEATSWorker.java +++ b/src/test/java/com/oltpbenchmark/benchmarks/seats/TestSEATSWorker.java @@ -1,34 +1,30 @@ -///****************************************************************************** -// * Copyright 2015 by OLTPBenchmark Project * -// * * -// * Licensed under the Apache License, Version 2.0 (the "License"); * -// * you may not use this file except in compliance with the License. * -// * You may obtain a copy of the License at * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software * -// * distributed under the License is distributed on an "AS IS" BASIS, * -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * -// * See the License for the specific language governing permissions and * -// * limitations under the License. * -// ******************************************************************************/ -// -//package com.oltpbenchmark.benchmarks.seats; -// -//import com.oltpbenchmark.api.AbstractTestWorker; -// -//public class TestSEATSWorker extends AbstractTestWorker { -// -// static { -// org.apache.log4j.PropertyConfigurator.configure("log4j.properties"); -// } -// -// @Override -// protected void setUp() throws Exception { -// super.setUp(SEATSBenchmark.class, TestSEATSBenchmark.PROC_CLASSES); -// this.workConf.setScaleFactor(0.01); -// SEATSProfile.clearCachedProfile(); -// } -// -//} +/****************************************************************************** + * Copyright 2015 by OLTPBenchmark Project * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + ******************************************************************************/ + +package com.oltpbenchmark.benchmarks.seats; + +import com.oltpbenchmark.api.AbstractTestWorker; + +public class TestSEATSWorker extends AbstractTestWorker { + + @Override + protected void setUp() throws Exception { + super.setUp(SEATSBenchmark.class, TestSEATSBenchmark.PROC_CLASSES); + this.workConf.setScaleFactor(0.01); + SEATSProfile.clearCachedProfile(); + } + +} diff --git a/src/test/java/com/oltpbenchmark/benchmarks/tatp/TestTATPWorker.java b/src/test/java/com/oltpbenchmark/benchmarks/tatp/TestTATPWorker.java index c39b53c6a..f680a3a01 100644 --- a/src/test/java/com/oltpbenchmark/benchmarks/tatp/TestTATPWorker.java +++ b/src/test/java/com/oltpbenchmark/benchmarks/tatp/TestTATPWorker.java @@ -1,27 +1,27 @@ -///****************************************************************************** -// * Copyright 2015 by OLTPBenchmark Project * -// * * -// * Licensed under the Apache License, Version 2.0 (the "License"); * -// * you may not use this file except in compliance with the License. * -// * You may obtain a copy of the License at * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software * -// * distributed under the License is distributed on an "AS IS" BASIS, * -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * -// * See the License for the specific language governing permissions and * -// * limitations under the License. * -// ******************************************************************************/ -// -//package com.oltpbenchmark.benchmarks.tatp; -// -//import com.oltpbenchmark.api.AbstractTestWorker; -// -//public class TestTATPWorker extends AbstractTestWorker { -// -// @Override -// protected void setUp() throws Exception { -// super.setUp(TATPBenchmark.class, TestTATPBenchmark.PROC_CLASSES); -// } -//} +/****************************************************************************** + * Copyright 2015 by OLTPBenchmark Project * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + ******************************************************************************/ + +package com.oltpbenchmark.benchmarks.tatp; + +import com.oltpbenchmark.api.AbstractTestWorker; + +public class TestTATPWorker extends AbstractTestWorker { + + @Override + protected void setUp() throws Exception { + super.setUp(TATPBenchmark.class, TestTATPBenchmark.PROC_CLASSES); + } +}