Beispiel #1
0
  @Override
  public void run() {
    initialize();

    try {
      while (m_shouldContinue) {
        // Normal operation blocks the site thread on the sitetasker queue.
        SiteTasker task = m_scheduler.take();
        task.run(getSiteProcedureConnection());
      }
    } catch (OutOfMemoryError e) {
      // Even though OOM should be caught by the Throwable section below,
      // it sadly needs to be handled seperately. The goal here is to make
      // sure VoltDB crashes.
      String errmsg =
          "Site: "
              + org.voltcore.utils.CoreUtils.hsIdToString(m_siteId)
              + " ran out of Java memory. "
              + "This node will shut down.";
      VoltDB.crashLocalVoltDB(errmsg, true, e);
    } catch (Throwable t) {
      String errmsg =
          "Site: "
              + org.voltcore.utils.CoreUtils.hsIdToString(m_siteId)
              + " encountered an "
              + "unexpected error and will die, taking this VoltDB node down.";
      VoltDB.crashLocalVoltDB(errmsg, true, t);
    }
    shutdown();
  }
Beispiel #2
0
  @Override
  public void run() {
    Thread.currentThread().setName("Iv2ExecutionSite: " + CoreUtils.hsIdToString(m_siteId));
    initialize(m_startupConfig.m_serializedCatalog, m_startupConfig.m_timestamp);
    m_startupConfig = null; // release the serializedCatalog bytes.

    try {
      while (m_shouldContinue) {
        if (m_rejoinState == kStateRunning) {
          // Normal operation blocks the site thread on the sitetasker queue.
          SiteTasker task = m_scheduler.take();
          if (task instanceof TransactionTask) {
            m_currentTxnId = ((TransactionTask) task).getTxnId();
            m_lastTxnTime = EstTime.currentTimeMillis();
          }
          task.run(getSiteProcedureConnection());
        } else {
          // Rejoin operation poll and try to do some catchup work. Tasks
          // are responsible for logging any rejoin work they might have.
          SiteTasker task = m_scheduler.poll();
          if (task != null) {
            task.runForRejoin(getSiteProcedureConnection(), m_rejoinTaskLog);
          }
          replayFromTaskLog();
        }
      }
    } catch (OutOfMemoryError e) {
      // Even though OOM should be caught by the Throwable section below,
      // it sadly needs to be handled seperately. The goal here is to make
      // sure VoltDB crashes.
      String errmsg =
          "Site: "
              + org.voltcore.utils.CoreUtils.hsIdToString(m_siteId)
              + " ran out of Java memory. "
              + "This node will shut down.";
      VoltDB.crashLocalVoltDB(errmsg, true, e);
    } catch (Throwable t) {
      String errmsg =
          "Site: "
              + org.voltcore.utils.CoreUtils.hsIdToString(m_siteId)
              + " encountered an "
              + "unexpected error and will die, taking this VoltDB node down.";
      VoltDB.crashLocalVoltDB(errmsg, true, t);
    }
    shutdown();
  }