libfoedus-core
FOEDUS Core Library
|
Defines the content and apply logic of transactional operatrions. More...
Defines the content and apply logic of transactional operatrions.
Each loggable operation defines a struct XxxLogType that has the following methods:
For non-applicable apply-type, the implmentation class should abort. Remember that these are all non-virtual methods. See the next section for more details.
![]() |
Classes | |
struct | foedus::log::LogHeader |
A common header part for all log types. More... | |
struct | foedus::log::BaseLogType |
Base class for log type. More... | |
struct | foedus::log::EngineLogType |
Base class for log type of engine-wide operation. More... | |
struct | foedus::log::StorageLogType |
Base class for log type of storage-wide operation. More... | |
struct | foedus::log::RecordLogType |
Base class for log type of record-wise operation. More... | |
struct | foedus::log::FillerLogType |
A dummy log type to fill up a sector in log files. More... | |
struct | foedus::log::EpochMarkerLogType |
A log type to declare a switch of epoch in a logger or the engine. More... | |
struct | foedus::storage::array::ArrayCreateLogType |
Log type of CREATE ARRAY STORAGE operation. More... | |
struct | foedus::storage::array::ArrayCommonUpdateLogType |
A base class for ArrayOverwriteLogType/ArrayIncrementLogType. More... | |
struct | foedus::storage::array::ArrayOverwriteLogType |
Log type of array-storage's overwrite operation. More... | |
struct | foedus::storage::array::ArrayIncrementLogType |
Log type of array-storage's increment operation. More... | |
struct | foedus::storage::hash::HashCreateLogType |
Log type of CREATE HASH STORAGE operation. More... | |
struct | foedus::storage::hash::HashCommonLogType |
A base class for HashInsertLogType/HashDeleteLogType/HashOverwriteLogType. More... | |
struct | foedus::storage::hash::HashInsertLogType |
Log type of hash-storage's insert operation. More... | |
struct | foedus::storage::hash::HashDeleteLogType |
Log type of hash-storage's delete operation. More... | |
struct | foedus::storage::hash::HashUpdateLogType |
Log type of hash-storage's update operation. More... | |
struct | foedus::storage::hash::HashOverwriteLogType |
Log type of hash-storage's overwrite operation. More... | |
struct | foedus::storage::masstree::MasstreeCreateLogType |
Log type of CREATE MASSTREE STORAGE operation. More... | |
struct | foedus::storage::masstree::MasstreeCommonLogType::RecordAddresses |
struct | foedus::storage::masstree::MasstreeCommonLogType |
A base class for MasstreeInsertLogType/MasstreeDeleteLogType/MasstreeOverwriteLogType. More... | |
struct | foedus::storage::masstree::MasstreeInsertLogType |
Log type of masstree-storage's insert operation. More... | |
struct | foedus::storage::masstree::MasstreeDeleteLogType |
Log type of masstree-storage's delete operation. More... | |
struct | foedus::storage::masstree::MasstreeUpdateLogType |
Log type of masstree-storage's update operation. More... | |
struct | foedus::storage::masstree::MasstreeOverwriteLogType |
Log type of masstree-storage's overwrite operation. More... | |
struct | foedus::storage::sequential::SequentialCreateLogType |
Log type of CREATE SEQUENTIAL STORAGE operation. More... | |
struct | foedus::storage::sequential::SequentialTruncateLogType |
Log type of TRUNCATE SEQUENTIAL STORAGE operation. More... | |
struct | foedus::storage::sequential::SequentialAppendLogType |
Log type of sequential-storage's append operation. More... | |
struct | foedus::storage::DropLogType |
Log type of DROP STORAGE operation. More... | |
struct | foedus::storage::CreateLogType |
Base type for CREATE STORAGE operation. More... | |
Macros | |
#define | LOG_TYPE_NO_CONSTRUCT(clazz) |
Macro to delete all constructors/destructors to prevent misuse for log type classes. More... | |
Functions | |
LogCodeKind | foedus::log::get_log_code_kind (LogCode code) |
Returns the kind of the given log code. More... | |
bool | foedus::log::is_valid_log_type (LogCode code) |
Returns if the LogCode value exists. More... | |
const char * | foedus::log::get_log_type_name (LogCode code) |
Returns the names of LogCode enum defined in log_type.xmacro. More... | |
template<typename LOG_TYPE > | |
constexpr LogCode | foedus::log::get_log_code () |
Returns LogCode for the log type defined in log_type.xmacro. More... | |
void | foedus::log::invoke_apply_engine (void *log_buffer, thread::Thread *context) |
Invokes the apply logic for an engine-wide log type. More... | |
void | foedus::log::invoke_apply_storage (void *log_buffer, Engine *engine, storage::StorageId id) |
Invokes the apply logic for a storage-wide log type. More... | |
void | foedus::log::invoke_apply_record (void *log_buffer, thread::Thread *context, storage::StorageId storage_id, xct::RwLockableXctId *owner_id_address, char *payload_address) |
Invokes the apply logic for a record-wise log type. More... | |
void | foedus::log::invoke_assert_valid (void *log_buffer) |
Invokes the assertion logic of each log type. More... | |
void | foedus::log::invoke_ostream (const void *buffer, std::ostream *ptr) |
Invokes the ostream operator for the given log type defined in log_type.xmacro. More... | |
struct foedus::storage::masstree::MasstreeCommonLogType::RecordAddresses |
Definition at line 211 of file masstree_log_types.hpp.
Class Members | ||
---|---|---|
char * | record_payload_ | |
PayloadLength * | record_payload_count_ |
#define LOG_TYPE_NO_CONSTRUCT | ( | clazz | ) |
Macro to delete all constructors/destructors to prevent misuse for log type classes.
Definition at line 103 of file common_log_types.hpp.
enum foedus::log::LogCode |
A unique identifier of all log types.
Log code values must follow the convention. Most significant 4 bits are used to denote the kind of the log:
Enumerator | |
---|---|
kLogCodeInvalid |
0 is reserved as a non-existing log type. |
kLogCodeFiller |
0x3001 : foedus::log::FillerLogType . A dummy log type to fill up a sector in log files. As we do direct I/O, we must do file I/O in multiply of 4kb. We pad the log buffer we are about to write with this log type. Log gleaner simply skips this log. This is the only log type whose size might be smaller than sizeof(FillerLogType). This happens because the common log header is 16 bytes but we have to make this log type 8 bytes able to fill every gap. For this reason, the xct_id_ property of this log must not be used. |
kLogCodeEpochMarker |
0x3002 : foedus::log::EpochMarkerLogType . A log type to declare a switch of epoch in a logger or the engine. Each logger puts this marker when it switches epoch. When applied, this just adds epoch switch history which is maintained until related logs are gleaned and garbage collected. The epoch switch history is used to efficiently identify the beginning of each epoch in each logger. This is useful for example when we take samples from each epoch. Now that we contain XctId in every log, it's not necessary to put this marker. However, having this log makes a few things easier; the epoch history management for seeking to beginning of a specific epoch and several sanity checks. So, we still keep this log. It's anyway only occadionally written, so no harm. Every log file starts with an epoch mark for this reason, too. |
kLogCodeDropLogType |
0x1011 : foedus::storage::DropLogType . Log type of DROP STORAGE operation. This log corresponds to StorageManager::drop_storage() opereation. DROP STORAGE has no in-epoch transaction order. It is always processed in a separate epoch from operations for the storage. Thus, we advance epoch before and after dropping a storage. |
kLogCodeArrayCreate |
0x1021 : foedus::storage::array::ArrayCreateLogType . Log type of CREATE ARRAY STORAGE operation. This log corresponds to StorageManager::create_array() opereation. CREATE ARRAY STORAGE has no in-epoch transaction order. It is always processed in a separate epoch from operations for the storage. Thus, we advance epoch right after creating a storage (before following operations). This log type is infrequently triggered, so no optimization. All methods defined in cpp. |
kLogCodeArrayOverwrite |
0x0022 : foedus::storage::array::ArrayOverwriteLogType . Log type of array-storage's overwrite operation. This is a modification operation in array. It simply invokes memcpy to the payload. |
kLogCodeArrayIncrement |
0x0023 : foedus::storage::array::ArrayIncrementLogType . Log type of array-storage's increment operation. This is similar to overwrite, but different in a sense that this can do value-increment without relying on the current value. For that, we remember the addendum in primitive format. |
kLogCodeSequentialTruncate |
0x1024 : foedus::storage::sequential::SequentialTruncateLogType . Log type of TRUNCATE SEQUENTIAL STORAGE operation. This log corresponds to SequentialStorage::truncate() operation. Like SequentialCreateLogType, this is a metadata operation. This log type is infrequently triggered, so no optimization. All methods defined in cpp. |
kLogCodeSequentialCreate |
0x1025 : foedus::storage::sequential::SequentialCreateLogType . Log type of CREATE SEQUENTIAL STORAGE operation. This log corresponds to StorageManager::create_sequential() operation. CREATE STORAGE has no in-epoch transaction order. It is always processed in a separate epoch from operations for the storage. Thus, we advance epoch right after creating a storage (before following operations). This log type is infrequently triggered, so no optimization. All methods defined in cpp. |
kLogCodeSequentialAppend |
0x0026 : foedus::storage::sequential::SequentialAppendLogType . Log type of sequential-storage's append operation. This is the only record-level operation in sequential storage. It simply appends the the end with an atomic operation. |
kLogCodeHashCreate |
0x1027 : foedus::storage::hash::HashCreateLogType . Log type of CREATE HASH STORAGE operation. This log corresponds to StorageManager::create_hash() opereation. CREATE HASH STORAGE has no in-epoch transaction order. It is always processed in a separate epoch from operations for the storage. Thus, we advance epoch right after creating a storage (before following operations). This log type is infrequently triggered, so no optimization. All methods defined in cpp. |
kLogCodeHashOverwrite |
0x0028 : foedus::storage::hash::HashOverwriteLogType . Log type of hash-storage's overwrite operation. This is one of the modification operations in hash. It simply invokes memcpy to the payload. |
kLogCodeHashInsert |
0x0029 : foedus::storage::hash::HashInsertLogType . Log type of hash-storage's insert operation. Applying this log just flips the delete flag and installs the payload. Allocating the slot and modifying the bloom filter is already done by a system transaction. |
kLogCodeHashDelete |
0x002A : foedus::storage::hash::HashDeleteLogType . Log type of hash-storage's delete operation. This one does nothing but flipping delete bit. |
kLogCodeHashUpdate |
0x002B : foedus::storage::hash::HashUpdateLogType . Log type of hash-storage's update operation. Applying this log changes the logical payload size and installs the payload, keeping the delete flag (which must be false). Allocating the slot and modifying the bloom filter is already done by a system transaction. Also, the record's physical size must be guaranteed to be enough spacious. |
kLogCodeMasstreeCreate |
0x1031 : foedus::storage::masstree::MasstreeCreateLogType . Log type of CREATE MASSTREE STORAGE operation. This log corresponds to StorageManager::create_masstree() opereation. CREATE STORAGE has no in-epoch transaction order. It is always processed in a separate epoch from operations for the storage. Thus, we advance epoch right after creating a storage (before following operations). This log type is infrequently triggered, so no optimization. All methods defined in cpp. |
kLogCodeMasstreeOverwrite |
0x0032 : foedus::storage::masstree::MasstreeOverwriteLogType . Log type of masstree-storage's overwrite operation. Same as insert log. |
kLogCodeMasstreeInsert |
0x0033 : foedus::storage::masstree::MasstreeInsertLogType . Log type of masstree-storage's insert operation. This is different from hash. In MasstreeBorderPage, we atomically increment the physical record count, set the key, set slot, leaves it as deleted, then unlock the page lock. When we get to here, the record already has key set and has reserved slot. |
kLogCodeMasstreeDelete |
0x0034 : foedus::storage::masstree::MasstreeDeleteLogType . Log type of masstree-storage's delete operation. This one does nothing but flipping delete bit. |
kLogCodeMasstreeUpdate |
0x0035 : foedus::storage::masstree::MasstreeUpdateLogType . Log type of masstree-storage's update operation. Almost same as insert except this keeps the delete-flag, which must be off. |
Definition at line 87 of file log_type.hpp.
Represents the kind of log types.
This is the most significant 4 bits of LogCode.
Enumerator | |
---|---|
kRecordLogs |
record targetted logs |
kStorageLogs |
storage targetted logs |
kEngineLogs |
engine targetted logs |
kMarkerLogs |
markers/fillers |
Definition at line 101 of file log_type.hpp.
constexpr LogCode foedus::log::get_log_code | ( | ) |
Returns LogCode for the log type defined in log_type.xmacro.
This is inlined below because it's called VERY frequently. This method is declared as constexpr if C++11 is enabled, in which case there should be really no overheads to call this method.
|
inline |
Returns the kind of the given log code.
This is inlined here because it's called frequently.
Definition at line 118 of file log_type.hpp.
Referenced by foedus::log::LogHeader::get_kind().
const char * foedus::log::get_log_type_name | ( | LogCode | code | ) |
Returns the names of LogCode enum defined in log_type.xmacro.
This is NOT inlined because this is used only in debugging situation.
Definition at line 28 of file log_type.cpp.
References foedus::log::kLogCodeInvalid.
Referenced by foedus::log::operator<<().
void foedus::log::invoke_apply_engine | ( | void * | log_buffer, |
thread::Thread * | context | ||
) |
Invokes the apply logic for an engine-wide log type.
This is not inlined because this log kind appears much more infrequently.
Definition at line 26 of file log_type_invoke.cpp.
References ASSERT_ND, foedus::log::LogHeader::get_type(), and foedus::log::invoke_assert_valid().
|
inline |
Invokes the apply logic for a record-wise log type.
This is inlined because this is invoked for every single record type log.
Definition at line 89 of file log_type_invoke.hpp.
References ASSERT_ND, foedus::log::LogHeader::get_type(), and foedus::log::invoke_assert_valid().
Referenced by foedus::xct::XctManagerPimpl::precommit_xct_apply().
void foedus::log::invoke_apply_storage | ( | void * | log_buffer, |
Engine * | engine, | ||
storage::StorageId | id | ||
) |
Invokes the apply logic for a storage-wide log type.
This is not inlined because this log kind appears much more infrequently.
Definition at line 41 of file log_type_invoke.cpp.
References ASSERT_ND, foedus::log::LogHeader::get_type(), and foedus::log::invoke_assert_valid().
|
inline |
Invokes the assertion logic of each log type.
This is inlined because this is invoked for every single record type log. In non-debug mode, this is anyway empty.
Definition at line 111 of file log_type_invoke.hpp.
References ASSERT_ND, and foedus::log::LogHeader::get_type().
Referenced by foedus::xct::Xct::add_related_write_set(), foedus::xct::Xct::add_to_lock_free_write_set(), foedus::xct::Xct::add_to_read_and_write_set(), foedus::xct::Xct::add_to_write_set(), foedus::log::invoke_apply_engine(), foedus::log::invoke_apply_record(), and foedus::log::invoke_apply_storage().
void foedus::log::invoke_ostream | ( | const void * | buffer, |
std::ostream * | ptr | ||
) |
Invokes the ostream operator for the given log type defined in log_type.xmacro.
This is only for debugging and analysis use, so does not have to be optimized. Thus not inlined here. This writes out an XML representation of the log entry.
Definition at line 56 of file log_type_invoke.cpp.
References foedus::log::LogHeader::get_type(), and foedus::log::kLogCodeInvalid.
Referenced by foedus::log::on_non_durable_meta_log_found(), and foedus::xct::operator<<().
|
inline |
Returns if the LogCode value exists.
This is inlined here because it's called frequently.
Definition at line 128 of file log_type.hpp.
Referenced by foedus::log::LogHeader::is_valid_type().