@After
  public void tearDown() throws IOException {
    m_coordinator.close();
    VoltFile.recursivelyDelete(m_overflow);

    m_coordinator = null;
    reset(m_volt);
    VoltDB.wasCrashCalled = false;
  }
Beispiel #2
0
 protected static void clearOverflowDir(String voltroot) {
   // clear overflow dir in case there are files left from previous runs
   try {
     File overflowDir = new File(voltroot, "join_overflow");
     if (overflowDir.exists()) {
       VoltFile.recursivelyDelete(overflowDir);
     }
   } catch (Exception e) {
     VoltDB.crashLocalVoltDB("Fail to clear join overflow directory", false, e);
   }
 }
 public void closeAndDelete() throws IOException {
   List<ListenableFuture<?>> tasks = new ArrayList<ListenableFuture<?>>();
   for (HashMap<String, ExportDataSource> map : m_dataSourcesByPartition.values()) {
     for (ExportDataSource source : map.values()) {
       tasks.add(source.closeAndDelete());
     }
   }
   try {
     Futures.allAsList(tasks).get();
   } catch (Exception e) {
     Throwables.propagateIfPossible(e, IOException.class);
   }
   shutdown = true;
   VoltFile.recursivelyDelete(m_directory);
 }
  public void testRejoinPropogateAdminMode() throws Exception {
    // Reset the VoltFile prefix that may have been set by previous tests in this suite
    org.voltdb.utils.VoltFile.resetSubrootForThisProcess();
    VoltProjectBuilder builder = getBuilderForTest();
    builder.setSecurityEnabled(true);

    LocalCluster cluster =
        new LocalCluster("rejoin.jar", 2, 3, 1, BackendTarget.NATIVE_EE_JNI, true);
    boolean success = cluster.compileWithAdminMode(builder, 9998, false);
    assertTrue(success);
    MiscUtils.copyFile(
        builder.getPathToDeployment(), Configuration.getPathToCatalogForTest("rejoin.xml"));
    cluster.setHasLocalServer(false);

    cluster.startUp();

    ClientResponse response;
    Client client;

    client = ClientFactory.createClient(m_cconfig);
    client.createConnection("localhost", 9997);

    response = client.callProcedure("@Pause");
    assertEquals(ClientResponse.SUCCESS, response.getStatus());
    client.close();

    cluster.shutDownSingleHost(0);
    Thread.sleep(100);

    VoltDB.Configuration config = new VoltDB.Configuration();
    config.m_pathToCatalog = Configuration.getPathToCatalogForTest("rejoin.jar");
    config.m_pathToDeployment = Configuration.getPathToCatalogForTest("rejoin.xml");
    config.m_rejoinToHostAndPort = m_username + ":" + m_password + "@localhost:9996";
    config.m_isRejoinTest = true;
    ServerThread localServer = new ServerThread(config);

    localServer.start();
    localServer.waitForInitialization();

    Thread.sleep(1000);

    assertTrue(VoltDB.instance().getMode() == OperationMode.PAUSED);

    localServer.shutdown();
    cluster.shutDown();
  }