Exemple #1
0
 /** Thread specific initialization */
 void initialize() {
   if (m_backend == BackendTarget.HSQLDB_BACKEND) {
     m_hsql = HsqlBackend.initializeHSQLBackend(m_siteId, m_context);
   } else {
     m_hsql = null;
   }
 }
Exemple #2
0
 public static void shutdownInstance() {
   synchronized (backendLock) {
     if (m_backend != null) {
       m_backend.shutdown();
       m_backend = null;
     }
   }
 }
Exemple #3
0
  /** Thread specific initialization */
  void initialize(String serializedCatalog, long timestamp) {
    if (m_backend == BackendTarget.NONE) {
      m_hsql = null;
      m_ee = new MockExecutionEngine();
    } else if (m_backend == BackendTarget.HSQLDB_BACKEND) {
      m_hsql = HsqlBackend.initializeHSQLBackend(m_siteId, m_context);
      m_ee = new MockExecutionEngine();
    } else {
      m_hsql = null;
      m_ee = initializeEE(serializedCatalog, timestamp);
    }

    m_snapshotter =
        new SnapshotSiteProcessor(
            new Runnable() {
              @Override
              public void run() {
                m_scheduler.offer(new SnapshotTask());
              }
            },
            m_snapshotPriority,
            new SnapshotSiteProcessor.IdlePredicate() {
              @Override
              public boolean idle(long now) {
                return (now - 5) > m_lastTxnTime;
              }
            });

    if (m_startAction == VoltDB.START_ACTION.LIVE_REJOIN) {
      initializeForLiveRejoin();
    }

    if (m_rejoinTaskLog == null) {
      m_rejoinTaskLog =
          new TaskLog() {
            @Override
            public void logTask(TransactionInfoBaseMessage message) throws IOException {}

            @Override
            public TransactionInfoBaseMessage getNextMessage() throws IOException {
              return null;
            }

            @Override
            public void setEarliestTxnId(long txnId) {}

            @Override
            public boolean isEmpty() throws IOException {
              return true;
            }

            @Override
            public void close() throws IOException {}
          };
    }
  }
Exemple #4
0
 void shutdown() {
   try {
     if (m_hsql != null) {
       HsqlBackend.shutdownInstance();
     }
     if (m_ee != null) {
       m_ee.release();
     }
     if (m_snapshotter != null) {
       m_snapshotter.shutdown();
     }
   } catch (InterruptedException e) {
     hostLog.warn("Interrupted shutdown execution site.", e);
   }
 }
Exemple #5
0
 public static HsqlBackend initializeHSQLBackend(long siteId, CatalogContext context) {
   synchronized (backendLock) {
     if (m_backend == null) {
       try {
         m_backend = new HsqlBackend(siteId);
         final String binDDL = context.database.getSchema();
         final String ddl = Encoder.decodeBase64AndDecompress(binDDL);
         final String[] commands = ddl.split("\n");
         for (String command : commands) {
           String decoded_cmd = Encoder.hexDecodeToString(command);
           decoded_cmd = decoded_cmd.trim();
           if (decoded_cmd.length() == 0) {
             continue;
           }
           m_backend.runDDL(decoded_cmd);
         }
       } catch (final Exception ex) {
         hostLog.fatal("Unable to construct HSQL backend");
         VoltDB.crashLocalVoltDB(ex.getMessage(), true, ex);
       }
     }
     return m_backend;
   }
 }
Exemple #6
0
 void shutdown() {
   if (m_hsql != null) {
     HsqlBackend.shutdownInstance();
   }
 }