Skip to content

Commit

Permalink
Merge branch 'master' into anticache
Browse files Browse the repository at this point in the history
  • Loading branch information
apavlo committed Oct 14, 2013
2 parents ce6b43e + 51e81d1 commit 1c51980
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 12 deletions.
Expand Up @@ -19,7 +19,7 @@

public class TestSingleSitedCostModelInvalidateCache extends BaseTestCase {

private static final int WORKLOAD_LIMIT = 500;
private static final int WORKLOAD_LIMIT = 250;
private static final int NUM_PARTITIONS = 32;

// Reading the workload takes a long time, so we only want to do it once
Expand All @@ -31,14 +31,13 @@ protected void setUp() throws Exception {
super.setUp(ProjectType.TPCC);
this.addPartitions(NUM_PARTITIONS);

// Super hack! Walk back the directories and find out workload directory
if (workload == null) {
File workload_file = this.getWorkloadFile(ProjectType.TPCC);
workload = new Workload(catalog);
workload = new Workload(catalogContext.catalog);

workload.load(workload_file, catalogContext.database, new ProcedureLimitFilter(WORKLOAD_LIMIT));
assertEquals(WORKLOAD_LIMIT, workload.getTransactionCount());
System.err.println(workload.getProcedureHistogram());
// System.err.println(workload.getProcedureHistogram());
}
}

Expand All @@ -53,10 +52,7 @@ private void validateCosts(SingleSitedCostModel cost_model, double expected, Col

// We now want to do the reverse
// We'll invalidate the cache for every element *but* one
List<CatalogType> single = new ArrayList<CatalogType>(1);
for (CatalogType catalog_item : items) {
single.clear();
single.add(catalog_item);
for (CatalogType catalog_item2 : items) {
if (catalog_item.equals(catalog_item2)) continue;
cost_model.invalidateCache(catalog_item2);
Expand Down
10 changes: 9 additions & 1 deletion tests/frontend/org/voltdb/ServerThread.java
Expand Up @@ -29,6 +29,7 @@
import edu.brown.hstore.HStore;
import edu.brown.hstore.HStoreSite;
import edu.brown.hstore.conf.HStoreConf;
import edu.brown.utils.ThreadUtil;

/**
* Wraps VoltDB in a Thread
Expand Down Expand Up @@ -63,8 +64,15 @@ public void run() {

public void waitForInitialization() {
// Wait until the server has actually started running.
int counter = 100;
while (this.hstore_site == null || this.hstore_site.isRunning() == false) {
Thread.yield();
ThreadUtil.sleep(100);
if (counter-- == 0) {
break;
}
} // WHILE
if (counter == 0) {
throw new RuntimeException("Failed to start server thread!");
}
}

Expand Down
21 changes: 18 additions & 3 deletions tests/frontend/org/voltdb/regressionsuites/LocalCluster.java
Expand Up @@ -39,6 +39,7 @@
import org.voltdb.catalog.Site;
import org.voltdb.compiler.VoltProjectBuilder;

import edu.brown.catalog.CatalogInfo;
import edu.brown.catalog.CatalogUtil;
import edu.brown.catalog.ClusterConfiguration;
import edu.brown.catalog.FixCatalog;
Expand Down Expand Up @@ -208,10 +209,14 @@ public LocalCluster(String prefix, int siteCount,
@Override
public boolean compile(VoltProjectBuilder builder) {
if (m_compiled) {
LOG.info("ALREADY COMPILED");
return true;
}
m_compiled = builder.compile(m_jarFileName.getAbsolutePath(), m_partitionPerSite, m_siteCount,
m_replication, "localhost");
m_compiled = builder.compile(m_jarFileName.getAbsolutePath(),
m_partitionPerSite,
m_siteCount,
m_replication,
"localhost");

// (1) Load catalog from Jar
Catalog tmpCatalog = CatalogUtil.loadCatalogFromJar(m_jarFileName);
Expand All @@ -238,7 +243,8 @@ public boolean compile(VoltProjectBuilder builder) {
assert(this.catalogContext != null);

// tmpCatalog = CatalogUtil.loadCatalogFromJar(m_jarFileName);
// System.err.println(CatalogInfo.getInfo(this.catalog, new File(m_jarFileName)));
System.err.println(CatalogInfo.getInfo(this.catalogContext));
System.err.flush();

return m_compiled;
}
Expand All @@ -247,6 +253,7 @@ public boolean compile(VoltProjectBuilder builder) {
public void startUp() {
assert (!m_running);
if (m_running) {
LOG.info("ALREADY RUNNING");
return;
}

Expand Down Expand Up @@ -288,6 +295,10 @@ public void startUp() {
if (site_id == 0) {
m_localServer = new ServerThread(this.catalogContext, hstore_conf, site_id);
m_localServer.start();
if (logtime) {
System.out.println("********** Started in-process HStoreSite [siteId=" + site_id + "]");
System.out.flush();
}
}
// Otherwise, fork a new JVM that will run our other HStoreSites.
// Remember that it is one JVM per HStoreSite
Expand Down Expand Up @@ -319,6 +330,10 @@ public void startUp() {
Thread t = new Thread(ptf);
t.setName("ClusterPipe:" + String.valueOf(site_id));
t.start();
if (logtime) {
System.out.println("********** Started separate HStoreSite process [siteId=" + site_id + "]");
System.out.flush();
}
}
catch (IOException ex) {
LOG.fatal("Failed to start cluster process", ex);
Expand Down
Expand Up @@ -27,6 +27,7 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
import org.voltdb.BackendTarget;
import org.voltdb.CatalogContext;
import org.voltdb.ServerThread;
Expand All @@ -43,6 +44,7 @@
*
*/
public class LocalSingleProcessServer extends VoltServerConfig {
private static final Logger LOG = Logger.getLogger(LocalSingleProcessServer.class);

public final File m_jarFileName;
public final int m_partitionCount;
Expand Down Expand Up @@ -77,8 +79,10 @@ public LocalSingleProcessServer(String jarFileName, int partitionCount,

@Override
public boolean compile(VoltProjectBuilder builder) {
if (m_compiled == true)
if (m_compiled == true) {
LOG.info("ALREADY COMPILED");
return true;
}
builder.clearPartitions();
for (int partition = 0; partition < m_partitionCount; ++partition) {
builder.addPartition("localhost", 0, partition);
Expand Down

0 comments on commit 1c51980

Please sign in to comment.