Пример #1
0
RC TxnManager::commit() {
  DEBUG("Commit %ld\n",get_txn_id());
  release_locks(RCOK);
#if CC_ALG == MAAT
  time_table.release(get_thd_id(),get_txn_id());
#endif
  commit_stats();
#if LOGGING
    LogRecord * record = logger.createRecord(get_txn_id(),L_NOTIFY,0,0);
    if(g_repl_cnt > 0) {
      msg_queue.enqueue(get_thd_id(),Message::create_message(record,LOG_MSG),g_node_id + g_node_cnt + g_client_node_cnt); 
    }
  logger.enqueueRecord(record);
  return WAIT;
#endif
  return Commit;
}
Пример #2
0
RC TxnManager::abort() {
  if(aborted)
    return Abort;
  DEBUG("Abort %ld\n",get_txn_id());
  txn->rc = Abort;
  INC_STATS(get_thd_id(),total_txn_abort_cnt,1);
  txn_stats.abort_cnt++;
  if(IS_LOCAL(get_txn_id())) {
    INC_STATS(get_thd_id(), local_txn_abort_cnt, 1);
  } else {
    INC_STATS(get_thd_id(), remote_txn_abort_cnt, 1);
    txn_stats.abort_stats(get_thd_id());
  }

  aborted = true;
  release_locks(Abort);
#if CC_ALG == MAAT
  //assert(time_table.get_state(get_txn_id()) == MAAT_ABORTED);
  time_table.release(get_thd_id(),get_txn_id());
#endif

  uint64_t timespan = get_sys_clock() - txn_stats.restart_starttime;
  if (IS_LOCAL(get_txn_id()) && warmup_done) {
      INC_STATS_ARR(get_thd_id(),start_abort_commit_latency, timespan);
  }
  /*
  // latency from most recent start or restart of transaction
  PRINT_LATENCY("lat_s %ld %ld 0 %f %f %f %f %f %f 0.0\n"
          , get_txn_id()
          , txn_stats.work_queue_cnt
          , (double) timespan / BILLION
          , (double) txn_stats.work_queue_time / BILLION
          , (double) txn_stats.msg_queue_time / BILLION
          , (double) txn_stats.cc_block_time / BILLION
          , (double) txn_stats.cc_time / BILLION
          , (double) txn_stats.process_time / BILLION
          );
          */
  //commit_stats();
  return Abort;
}
Пример #3
0
void config_shutdown(void) {
    config_get_config();
    config_clear(&_current_configuration);
    config_release_config();
    release_locks();
}