libfoedus-core
FOEDUS Core Library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
foedus Namespace Reference

Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services). More...

Detailed Description

Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).

See Main Page for installation/quick-start/project overview.

Namespaces

 assorted
 Assorted Methods/Classes that are too subtle to have their own packages.
 
 cache
 Snapshot Cache Manager, which caches data pages retrieved from snapshot files.
 
 debugging
 Debug-Support functionalities.
 
 externalize
 Object Externalization.
 
 fs
 Filesystem wrapper, an analogue of boost::filesystem.
 
 log
 Log Manager, which writes out transactional logs.
 
 memory
 Memory Manager, which controls memory allocations, deallocations, and sharing.
 
 proc
 System and User Procedures.
 
 restart
 Restart Manager, which recovers the state of database by re-playing transaction logs at start-up.
 
 savepoint
 Savepoint Manager, which durably and atomically remembers what happened in the engine occasionally (eg.
 
 snapshot
 Snapshot Manager, which manages snapshot files of the database.
 
 soc
 System On Chip (SOC) and interprocess communication (IPC).
 
 storage
 Storage Manager, which implements a couple of key/value stores.
 
 thread
 Thread and Thread-Group, which abstracts NUMA-core/node and provides API to attach/detach tasks to pooled threads.
 
 xct
 Transaction Manager, which provides APIs to begin/commit/abort transactions.
 

Classes

class  Attachable
 Attachable Resources on Shared Memory. More...
 
class  DefaultInitializable
 Typical implementation of Initializable as a skeleton base class. More...
 
class  Engine
 Database engine object that holds all resources and provides APIs. More...
 
struct  EngineOptions
 Set of option values given to the engine at start-up. More...
 
class  EnginePimpl
 Pimpl object of Engine. More...
 
class  Epoch
 Represents a time epoch. More...
 
class  ErrorStack
 Brings error stacktrace information as return value of functions. More...
 
class  ErrorStackBatch
 Batches zero or more ErrorStack objects to represent in one ErrorStack. More...
 
class  FixedErrorStack
 Representation of ErrorStack that can be copied to other processes and even serialized to files. More...
 
class  Initializable
 The pure-virtual interface to initialize/uninitialize non-trivial resources. More...
 
class  UninitializeGuard
 Calls Initializable::uninitialize() automatically when it gets out of scope. More...
 

Typedefs

typedef uint64_t Eid
 An Engine ID to differentiate two Engine objects instantiated in the same process. More...
 

Enumerations

enum  EngineType {
  kMaster, kChildEmulated, kChildForked, kChildLocalSpawned,
  kChildRemoteSpawned
}
 Type of an engine instance of how to launch it. More...
 
enum  ErrorCode {
  kErrorCodeOk = 0, kErrorCodeOutofmemory = 0x0001, kErrorCodeInvalidParameter = 0x0002, kErrorCodeAlreadyInitialized = 0x0003,
  kErrorCodeBatchedError = 0x0004, kErrorCodeDepedentModuleUnavailableInit = 0x0005, kErrorCodeDepedentModuleUnavailableUninit = 0x0006, kErrorCodeBeingShutdown = 0x0007,
  kErrorCodeTimeout = 0x0008, kErrorCodeNotimplemented = 0x0009, kErrorCodeSessionExpired = 0x000A, kErrorCodeUserDefined = 0x000B,
  kErrorCodeInternalError = 0x000C, kErrorCodeOsMProtectFailed = 0x000D, kErrorCodeEnvPrescreenFailed = 0x000E, kErrorCodeEngineInvalidOption = 0x0101,
  kErrorCodeFsAlreadyOpened = 0x0201, kErrorCodeFsFailedToOpen = 0x0202, kErrorCodeFsBadSeekInput = 0x0203, kErrorCodeFsSeekFailed = 0x0204,
  kErrorCodeFsBufferTooSmall = 0x0205, kErrorCodeFsBufferNotAligned = 0x0206, kErrorCodeFsTooShortRead = 0x0207, kErrorCodeFsExcessRead = 0x0208,
  kErrorCodeFsWriteFail = 0x0209, kErrorCodeFsExcessWrite = 0x020A, kErrorCodeFsNotOpened = 0x020B, kErrorCodeFsSyncFailed = 0x020C,
  kErrorCodeFsMkdirFailed = 0x020D, kErrorCodeFsTruncateFailed = 0x020E, kErrorCodeFsResultNotAligned = 0x020F, kErrorCodeMemoryNoFreePages = 0x0301,
  kErrorCodeMemoryDuplicatePage = 0x0302, kErrorCodeMemoryPagePoolTooSmall = 0x0303, kErrorCodeMemoryNumaUnavailable = 0x0304, kErrorCodeConfParseFailed = 0x0401,
  kErrorCodeConfValueOutofrange = 0x0402, kErrorCodeConfMissingElement = 0x0403, kErrorCodeConfInvalidElement = 0x0404, kErrorCodeConfEmptyXml = 0x0405,
  kErrorCodeConfFileNotFount = 0x0406, kErrorCodeConfCouldNotWrite = 0x0407, kErrorCodeConfCouldNotRename = 0x0408, kErrorCodeConfMkdirsFailed = 0x0409,
  kErrorCodeLogInvalidLoggerCount = 0x0501, kErrorCodeLogInvalidApplyType = 0x0502, kErrorCodeLogInvalidLogType = 0x0503, kErrorCodeSnapshotInvalidLogEnd = 0x0601,
  kErrorCodeSnapshotCancelled = 0x0602, kErrorCodeSnapshotExitTimeout = 0x0603, kErrorCodeSpInconsistentSavepoint = 0x0701, kErrorCodeStrDuplicateStrid = 0x0801,
  kErrorCodeStrAlreadyExists = 0x0802, kErrorCodeStrDuplicateStrname = 0x0803, kErrorCodeStrMustSeparateXct = 0x0804, kErrorCodeStrArrayInvalidOption = 0x0805,
  kErrorCodeStrWrongMetadataType = 0x0806, kErrorCodeStrUnsupportedMetadata = 0x0807, kErrorCodeStrTooLongPayload = 0x0808, kErrorCodeStrTooSmallPayloadBuffer = 0x0809,
  kErrorCodeStrTooShortPayload = 0x080A, kErrorCodeStrKeyAlreadyExists = 0x080B, kErrorCodeStrKeyNotFound = 0x080C, kErrorCodeStrHashBinsTooMany = 0x080D,
  kErrorCodeStrMasstreeRetry = 0x0811, kErrorCodeStrMasstreeTooManyRetries = 0x0812, kErrorCodeStrMasstreeFailedVerification = 0x0813, kErrorCodeStrMasstreeCursorTooDeep = 0x0814,
  kErrorCodeStrArrayFailedVerification = 0x0821, kErrorCodeStrTooManyStorages = 0x0822, kErrorCodeStrAlreadyDropped = 0x0823, kErrorCodeStrEmptyName = 0x0824,
  kErrorCodeStrPartitionerDataMemoryTooSmall = 0x0825, kErrorCodeStrTooLargeArray = 0x0826, kErrorCodeStrHashFailedVerification = 0x0827, kErrorCodeCacheNoFreePages = 0x0901,
  kErrorCodeCacheTableFull = 0x0902, kErrorCodeCacheTooManyOverflow = 0x0903, kErrorCodeXctReadSetOverflow = 0x0A01, kErrorCodeXctWriteSetOverflow = 0x0A02,
  kErrorCodeXctAlreadyRunning = 0x0A03, kErrorCodeXctNoXct = 0x0A04, kErrorCodeXctRaceAbort = 0x0A05, kErrorCodeXctPageVersionSetOverflow = 0x0A06,
  kErrorCodeXctPointerSetOverflow = 0x0A07, kErrorCodeXctUserAbort = 0x0A08, kErrorCodeXctNoMoreLocalWorkMemory = 0x0A09, kErrorCodeRecordTemperatureChange = 0x0AA0,
  kErrorCodeXctLockAbort = 0x0AA1, kErrorCodeLockCancelled = 0x0AA2, kErrorCodeLockRequested = 0x0AA3, kErrorCodeXctTwoSysXcts = 0x0AA4,
  kErrorCodeXctMustBeInSysXcts = 0x0AA5, kErrorCodeDbgGperftools = 0x0B01, kErrorCodeSocShmAllocFailed = 0x0C01, kErrorCodeSocShmAttachFailed = 0x0C02,
  kErrorCodeSocForkFailed = 0x0C03, kErrorCodeSocSpawnFailed = 0x0C04, kErrorCodeSocEmulateFailed = 0x0C05, kErrorCodeSocLaunchTimeout = 0x0C06,
  kErrorCodeSocMasterDied = 0x0C07, kErrorCodeSocMasterUnexpectedState = 0x0C08, kErrorCodeSocTerminateTimeout = 0x0C09, kErrorCodeSocTerminateFailed = 0x0C0A,
  kErrorCodeSocChildInitFailed = 0x0C0B, kErrorCodeSocChildUninitFailed = 0x0C0C, kErrorCodeProcPreRegisterTooLate = 0x0D01, kErrorCodeProcRegisterTooEarly = 0x0D02,
  kErrorCodeProcRegisterUnsupportedSocType = 0x0D03, kErrorCodeProcRegisterMasterOnly = 0x0D04, kErrorCodeProcRegisterChildOnly = 0x0D05, kErrorCodeProcNotFound = 0x0D06,
  kErrorCodeProcProcAlreadyExists = 0x0D07, kErrorCodeThrNoThreadAvailable = 0x0E01
}
 Enum of error codes defined in error_code.xmacro. More...
 
enum  ModuleType {
  kInvalid = 0, kSoc, kDebug, kProc,
  kMemory, kSavepoint, kThread, kLog,
  kSnapshot, kCache, kStorage, kXct,
  kRestart, kDummyTail
}
 Enumerates modules in FOEDUS engine. More...
 

Functions

std::string print_assert (const char *file, const char *func, int line, const char *description)
 Helper function to report what assertion failed. More...
 
std::string print_backtrace ()
 Prints out backtrace. More...
 
void print_assert_backtrace (const char *file, const char *func, int line, const char *description)
 print_assert() + print_backtrace(). More...
 
std::string get_recent_assert_backtrace ()
 Retrieves the info left by print_assert_backtrace(). More...
 
const char * get_error_name (ErrorCode code)
 Returns the names of ErrorCode enum defined in error_code.xmacro. More...
 
const char * get_error_message (ErrorCode code)
 Returns the error messages corresponding to ErrorCode enum defined in error_code.xmacro. More...
 
template<typename ENGINE_OPTION_PTR , typename CHILD_PTR >
std::vector< CHILD_PTR > get_children_impl (ENGINE_OPTION_PTR option)
 
std::vector< externalize::Externalizable * > get_children (EngineOptions *option)
 
std::vector< const externalize::Externalizable * > get_children (const EngineOptions *option)
 
std::ostream & operator<< (std::ostream &o, const Epoch &v)
 
std::ostream & operator<< (std::ostream &o, const ErrorStack &obj)
 
std::ostream & operator<< (std::ostream &o, const ErrorStackBatch &obj)
 
std::ostream & operator<< (std::ostream &o, const FixedErrorStack &obj)
 

Variables

const Epoch INVALID_EPOCH
 A constant epoch object that represents an invalid epoch. More...
 
const ErrorStack kRetOk
 Normal return value for no-error case. More...
 
std::string static_recent_assert_backtrace
 Leaves recent crash information in a static global variable so that a signal handler can pick it. More...
 
std::string static_recent_dump_and_abort
 Leaves recent dump information in a static global variable so that a signal handler can pick it. More...
 

Typedef Documentation

typedef uint64_t foedus::Eid

An Engine ID to differentiate two Engine objects instantiated in the same process.

This and soc::Upid uniquely identify an Engine instance.

Definition at line 29 of file engine_type.hpp.

Function Documentation

std::vector< externalize::Externalizable* > foedus::get_children ( EngineOptions option)

Definition at line 62 of file engine_options.cpp.

Referenced by foedus::EngineOptions::load(), foedus::EngineOptions::operator=(), and foedus::EngineOptions::save().

62  {
63  return get_children_impl<EngineOptions*, externalize::Externalizable*>(option);
64 }

Here is the caller graph for this function:

std::vector< const externalize::Externalizable* > foedus::get_children ( const EngineOptions option)

Definition at line 65 of file engine_options.cpp.

65  {
66  return get_children_impl<const EngineOptions*, const externalize::Externalizable*>(option);
67 }
template<typename ENGINE_OPTION_PTR , typename CHILD_PTR >
std::vector< CHILD_PTR > foedus::get_children_impl ( ENGINE_OPTION_PTR  option)

Definition at line 46 of file engine_options.cpp.

46  {
47  std::vector< CHILD_PTR > children;
48  children.push_back(&option->cache_);
49  children.push_back(&option->debugging_);
50  children.push_back(&option->log_);
51  children.push_back(&option->memory_);
52  children.push_back(&option->proc_);
53  children.push_back(&option->restart_);
54  children.push_back(&option->savepoint_);
55  children.push_back(&option->snapshot_);
56  children.push_back(&option->soc_);
57  children.push_back(&option->storage_);
58  children.push_back(&option->thread_);
59  children.push_back(&option->xct_);
60  return children;
61 }
std::string foedus::get_recent_assert_backtrace ( )

Retrieves the info left by print_assert_backtrace().

Called by signal handler

Definition at line 60 of file assert_nd.cpp.

References static_recent_assert_backtrace.

60  {
62 }
std::string static_recent_assert_backtrace
Leaves recent crash information in a static global variable so that a signal handler can pick it...
Definition: assert_nd.cpp:50
std::ostream& foedus::operator<< ( std::ostream &  o,
const Epoch v 
)

Definition at line 23 of file epoch.cpp.

References foedus::Epoch::is_valid(), and foedus::Epoch::value().

23  {
24  if (v.is_valid()) {
25  o << v.value();
26  } else {
27  o << "<INVALID>";
28  }
29  return o;
30 }

Here is the call graph for this function:

std::ostream& foedus::operator<< ( std::ostream &  o,
const ErrorStackBatch obj 
)

Definition at line 43 of file error_stack_batch.cpp.

References SUMMARIZE_ERROR_BATCH.

43  {
44  o << SUMMARIZE_ERROR_BATCH(obj);
45  return o;
46 }
#define SUMMARIZE_ERROR_BATCH(x)
This macro calls ErrorStackBatch::summarize() with automatically provided parameters.
std::ostream& foedus::operator<< ( std::ostream &  o,
const ErrorStack obj 
)

Definition at line 78 of file error_stack.cpp.

References foedus::ErrorStack::output().

78  {
79  obj.output(&o);
80  return o;
81 }

Here is the call graph for this function:

std::ostream& foedus::operator<< ( std::ostream &  o,
const FixedErrorStack obj 
)

Definition at line 106 of file fixed_error_stack.cpp.

References foedus::FixedErrorStack::output().

106  {
107  obj.output(&o);
108  return o;
109 }

Here is the call graph for this function:

std::string foedus::print_assert ( const char *  file,
const char *  func,
int  line,
const char *  description 
)

Helper function to report what assertion failed.

Definition at line 28 of file assert_nd.cpp.

Referenced by print_assert_backtrace().

28  {
29  std::stringstream str;
30  str << "***************************************************************************" << std::endl;
31  str << "**** Assertion failed! \"" << description
32  << "\" did not hold in " << func << "(): " << file << ":" << line << std::endl;
33  str << "***************************************************************************" << std::endl;
34  return str.str();
35 }

Here is the caller graph for this function:

void foedus::print_assert_backtrace ( const char *  file,
const char *  func,
int  line,
const char *  description 
)

print_assert() + print_backtrace().

It also leaves the info in a global variable so that signal handler can show that later.

Definition at line 52 of file assert_nd.cpp.

References print_assert(), and print_backtrace().

52  {
53  std::string message = print_assert(file, func, line, description);
54  message += print_backtrace();
56  std::cerr << message;
57 }
std::string print_assert(const char *file, const char *func, int line, const char *description)
Helper function to report what assertion failed.
Definition: assert_nd.cpp:28
std::string static_recent_assert_backtrace
Leaves recent crash information in a static global variable so that a signal handler can pick it...
Definition: assert_nd.cpp:50
std::string print_backtrace()
Prints out backtrace.
Definition: assert_nd.cpp:37

Here is the call graph for this function:

std::string foedus::print_backtrace ( )

Prints out backtrace.

This method is best-effort, maybe do nothing in some compiler/OS.

Definition at line 37 of file assert_nd.cpp.

References foedus::assorted::get_backtrace().

Referenced by foedus::ErrorStack::dump_and_abort(), foedus::memory::RoundRobinPageGrabBatch::grab(), print_assert_backtrace(), and foedus::UninitializeGuard::~UninitializeGuard().

37  {
38  std::vector<std::string> traces = assorted::get_backtrace(true);
39  std::stringstream str;
40  str << "=== Stack frame (length=" << traces.size() << ")" << std::endl;
41  for (uint16_t i = 0; i < traces.size(); ++i) {
42  str << "- [" << i << "/" << traces.size() << "] " << traces[i] << std::endl;
43  }
44  return str.str();
45 }
std::vector< std::string > get_backtrace(bool rich=true)
Returns the backtrace information of the current stack.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

std::string foedus::static_recent_assert_backtrace

Leaves recent crash information in a static global variable so that a signal handler can pick it.

Definition at line 50 of file assert_nd.cpp.

Referenced by get_recent_assert_backtrace().

std::string foedus::static_recent_dump_and_abort

Leaves recent dump information in a static global variable so that a signal handler can pick it.

Definition at line 59 of file error_stack.cpp.

Referenced by foedus::ErrorStack::get_recent_dump_and_abort().