예제 #1
0
  @Test
  public void testLoader() {
    VoltDB.Configuration configuration = new VoltDB.Configuration();
    configuration.m_noLoadLibVOLTDB = true;
    MockVoltDB mockvolt = new MockVoltDB();
    VoltDB.ignoreCrash = true;
    VoltDB.replaceVoltDBInstanceForTest(mockvolt);
    mockvolt.m_noLoadLib = true;
    assertFalse(EELibraryLoader.loadExecutionEngineLibrary(false));
    assertFalse(VoltDB.wasCrashCalled);
    boolean threw = false;
    try {
      assertFalse(EELibraryLoader.loadExecutionEngineLibrary(true));
    } catch (AssertionError ae) {
      threw = true;
    }
    assertTrue(threw);
    assertTrue(VoltDB.wasCrashCalled);
    VoltDB.wasCrashCalled = false;
    VoltDB.initialize(configuration);
    assertFalse(EELibraryLoader.loadExecutionEngineLibrary(true));
    assertFalse(VoltDB.wasCrashCalled);

    // Now test SUCCESS case
    configuration = new VoltDB.Configuration();
    VoltDBInterface mockitovolt = mock(VoltDBInterface.class);
    VoltDBInterface realvolt = new RealVoltDB();
    when(mockitovolt.getEELibraryVersionString()).thenReturn(realvolt.getEELibraryVersionString());
    CatalogContext catContext = mock(CatalogContext.class);
    Cluster cluster = mock(Cluster.class);
    when(cluster.getVoltroot()).thenReturn(System.getProperty("java.io.tmpdir"));
    when(catContext.getCluster()).thenReturn(cluster);
    when(mockitovolt.getCatalogContext()).thenReturn(catContext);

    VoltDB.replaceVoltDBInstanceForTest(mockitovolt);
    VoltDB.initialize(configuration);
    assertTrue(EELibraryLoader.loadExecutionEngineLibrary(true));
  }
예제 #2
0
  @Override
  public void prepareImpl(final CatalogContext catalogContext) {
    this.all_partitions = catalogContext.getAllPartitionIds();
    assert (this.all_partitions.isEmpty() == false) : "No partitions???";

    for (int i = 0; i < num_intervals; i++) {
      this.cost_models[i].prepare(catalogContext);
      if (!this.use_caching) {
        this.cost_models[i].clear(true);
        assert (this.cost_models[i].getTxnPartitionAccessHistogram().isEmpty());
        assert (this.cost_models[i].getQueryPartitionAccessHistogram().isEmpty());
      }
    } // FOR

    // Note that we want to clear our counters but not our internal cost
    // model data structures
    this.clear();
  }
예제 #3
0
 @Override
 public byte[] getCatalogHash() {
   // AdHoc invocations need to be able to check the hash of the current catalog
   // against the hash of the catalog they were planned against.
   return m_context.getCatalogHash();
 }
예제 #4
0
파일: Site.java 프로젝트: sumitk1/voltdb
 @Override
 public long getCatalogCRC() {
   return m_context.getCatalogCRC();
 }