Zero  0.1.0
Classes | Macros | Enumerations | Variables
shore_env.h File Reference

: Definition of a Shore environment (database) More...

#include "sm_vas.h"
#include "log_core.h"
#include <map>
#include "skewer.h"
#include "reqs.h"
#include "table_desc.h"
#include <boost/program_options.hpp>
#include "restart.h"

Go to the source code of this file.

Classes

struct  env_stats_t
 
class  db_iface
 
class  ShoreEnv
 

Macros

#define SHORE_TABLE_DATA_DIR   "databases"
 
#define DECLARE_TRX(trxlid)
 
#define DECLARE_TABLE(table, manimpl, abbrv)
 
#define DEFINE_RUN_WITH_INPUT_TRX_WRAPPER(cname, trxlid, trximpl)
 
#define DEFINE_RUN_WITHOUT_INPUT_TRX_WRAPPER(cname, trxlid, trximpl)
 
#define DEFINE_TRX_STATS(cname, trxlid)
 
#define DEFINE_TRX(cname, trx)
 
#define CHECK_XCT_RETURN(rc, retry, ENV)
 

Enumerations

enum  eDBControl { DBC_UNDEF = 0x1, DBC_PAUSED = 0x2, DBC_ACTIVE = 0x4, DBC_STOPPED = 0x8 }
 
enum  MeasurementState {
  MST_UNDEF = 0x0, MST_WARMUP = 0x1, MST_MEASURE = 0x2, MST_DONE = 0x4,
  MST_PAUSE = 0x8
}
 

Variables

const int SHORE_NUM_OF_RETRIES = 3
 
ShoreEnv_g_shore_env
 
int ssm_max_small_rec
 

Detailed Description

: Definition of a Shore environment (database)

Author
: Ippokratis Pandis (ipandis)

Macro Definition Documentation

§ CHECK_XCT_RETURN

#define CHECK_XCT_RETURN (   rc,
  retry,
  ENV 
)
Value:
if (rc.is_error()) { \
TRACE( TRACE_ALWAYS, "Error %x\n", rc.err_num()); \
W_COERCE(ENV->db()->abort_xct()); \
switch(rc.err_num()) { \
case eDEADLOCK: \
goto retry; \
default: \
stringstream os; os << rc << ends; \
string str = os.str(); \
TRACE( TRACE_ALWAYS, \
"Eek! Unable to populate db due to: \n%s\n", \
str.c_str()); \
W_FATAL(rc.err_num()); \
} \
}
#define TRACE_ALWAYS
Definition: trace_types.h:41

§ DECLARE_TABLE

#define DECLARE_TABLE (   table,
  manimpl,
  abbrv 
)
Value:
guard<manimpl> _p##abbrv##_man; \
inline manimpl* abbrv##_man() { return (_p##abbrv##_man); } \
guard<table> _p##abbrv##_desc; \
inline table* abbrv##_desc() { return (_p##abbrv##_desc.get()); }
A generic RAII guard class.
Definition: guard.h:94

§ DECLARE_TRX

#define DECLARE_TRX (   trxlid)
Value:
w_rc_t run_##trxlid(Request* prequest, trxlid##_input_t& in); \
w_rc_t run_##trxlid(Request* prequest); \
w_rc_t xct_##trxlid(const int xct_id, trxlid##_input_t& in); \
void _inc_##trxlid##_att(); \
void _inc_##trxlid##_failed(); \
void _inc_##trxlid##_dld()
Return code for most functions and methods.
Definition: w_rc.h:87

§ DEFINE_RUN_WITH_INPUT_TRX_WRAPPER

#define DEFINE_RUN_WITH_INPUT_TRX_WRAPPER (   cname,
  trxlid,
  trximpl 
)
Value:
w_rc_t cname::run_##trximpl(Request* prequest, trxlid##_input_t& in) { \
int xct_id = prequest->xct_id(); \
/* TRACE( TRACE_TRX_FLOW, "%d. %s ...\n", xct_id, #trximpl); */ \
_inc_##trxlid##_att(); \
w_rc_t e = xct_##trximpl(xct_id, in); \
if (!e.is_error()) { \
if (isAsynchCommit()) e = _pssm->commit_xct(true); \
else e = _pssm->commit_xct(); } \
if (e.is_error()) { \
if (e.err_num() != eDEADLOCK) \
_inc_##trxlid##_failed(); \
else _inc_##trxlid##_dld(); \
/*TRACE( TRACE_TRX_FLOW, "Xct (%d) aborted [0x%x]\n", xct_id, e.err_num());*/ \
w_rc_t e2 = _pssm->abort_xct(); \
if(e2.is_error()) TRACE( TRACE_ALWAYS, "Xct (%d) abort failed [0x%x]\n", xct_id, e2.err_num()); \
prequest->notify_client(); \
if ((*&_measure)!=MST_MEASURE) return (e); \
_env_stats.inc_trx_att(); \
return (e); } \
/* TRACE( TRACE_TRX_FLOW, "Xct (%d) completed\n", xct_id); */ \
prequest->notify_client(); \
if ((*&_measure)!=MST_MEASURE) return (RCOK); \
_env_stats.inc_trx_com(); \
return (RCOK); }
const w_rc_t RCOK
Definition: w_rc.h:239
if(!called)
Definition: w_base.cpp:238
Definition: shore_env.h:335
Return code for most functions and methods.
Definition: w_rc.h:87
#define TRACE
Other modules in our program use this macro for reporting. We can use preprocessor macros like FILE a...
Definition: trace.h:91
#define TRACE_ALWAYS
Definition: trace_types.h:41

§ DEFINE_RUN_WITHOUT_INPUT_TRX_WRAPPER

#define DEFINE_RUN_WITHOUT_INPUT_TRX_WRAPPER (   cname,
  trxlid,
  trximpl 
)
Value:
w_rc_t cname::run_##trximpl(Request* prequest) { \
trxlid##_input_t in = create_##trxlid##_input(_queried_factor, \
prequest->selectedID(), prequest->tspread()); \
return (run_##trximpl(prequest, in)); }
Return code for most functions and methods.
Definition: w_rc.h:87

§ DEFINE_TRX

#define DEFINE_TRX (   cname,
  trx 
)
Value:
DEFINE_RUN_WITH_INPUT_TRX_WRAPPER(cname,trx,trx); \
DEFINE_TRX_STATS(cname,trx)
#define DEFINE_RUN_WITHOUT_INPUT_TRX_WRAPPER(cname, trxlid, trximpl)
Definition: shore_env.h:149

§ DEFINE_TRX_STATS

#define DEFINE_TRX_STATS (   cname,
  trxlid 
)
Value:
void cname::_inc_##trxlid##_att() { ++my_stats.attempted.trxlid; } \
void cname::_inc_##trxlid##_failed() { ++my_stats.failed.trxlid; } \
void cname::_inc_##trxlid##_dld() { ++my_stats.deadlocked.trxlid; }
ShoreTPCBTrxCount failed
Definition: tpcb_env.h:117
ShoreTPCBTrxCount attempted
Definition: tpcb_env.h:115
ShoreTPCBTrxCount deadlocked
Definition: tpcb_env.h:119
static __thread ShoreTPCBTrxStats my_stats
Definition: tpcb_xct.cpp:47

§ SHORE_TABLE_DATA_DIR

#define SHORE_TABLE_DATA_DIR   "databases"

Enumeration Type Documentation

§ eDBControl

enum eDBControl
Enumerator
DBC_UNDEF 
DBC_PAUSED 
DBC_ACTIVE 
DBC_STOPPED 

§ MeasurementState

Enumerator
MST_UNDEF 
MST_WARMUP 
MST_MEASURE 
MST_DONE 
MST_PAUSE 

Variable Documentation

§ _g_shore_env

ShoreEnv* _g_shore_env

§ SHORE_NUM_OF_RETRIES

const int SHORE_NUM_OF_RETRIES = 3

§ ssm_max_small_rec

int ssm_max_small_rec