hints.enable_procparameter_search = false;
hints.max_memory_per_partition = Long.MAX_VALUE;
this.partitioner.init(this.hints);
this.partitioner.calculateInitialSolution(hints);
assert(this.partitioner.initial_cost > 0);
PartitionPlan orig_solution = new PartitionPlan(this.partitioner.initial_solution);
this.partitioner.best_solution = orig_solution;
this.partitioner.best_memory = this.partitioner.initial_memory;
this.partitioner.best_cost = this.partitioner.initial_cost;
// First check whether the cost is the same simply right after the first go
assertEquals(orig_solution, this.partitioner.best_solution);
double new_cost = info.getCostModel().estimateWorkloadCost(catalogContext, workload);
assert(new_cost > 0);
assertEquals(this.partitioner.initial_cost, new_cost);
// Genarate table+procedure attribute lists
List<Table> table_attributes = new ArrayList<Table>();
Table catalog_tbl = this.getTable(TM1Constants.TABLENAME_SUBSCRIBER);
table_attributes.add(catalog_tbl);
List<Procedure> proc_attributes = new ArrayList<Procedure>();
for (Procedure catalog_proc : catalog_db.getProcedures()) {
if (PartitionerUtil.isPartitionable(catalog_proc)) proc_attributes.add(catalog_proc);
} // FOR
// Now throw everything at the local search procedure. This should stop right away because the
// time limits will immediately be exceeded
this.partitioner.localSearch(hints, table_attributes, proc_attributes);
// System.err.println(this.partitioner.best_solution);
// Now check that the cost before and after are the same
if (orig_solution.equals(this.partitioner.best_solution) == false) {
System.err.println(orig_solution);
System.err.println(StringUtil.repeat("*", 100));
System.err.println(this.partitioner.best_solution);
}
for (Table tbl : catalog_db.getTables()) {
assertEquals(tbl.toString(), orig_solution.getTableEntry(tbl), this.partitioner.best_solution.getTableEntry(tbl));
}
// FIXME
// info.getCostModel().clear();
// new_cost = info.getCostModel().estimateWorkloadCost(catalog_db, workload);
// assert(new_cost > 0);