libfoedus-core
FOEDUS Core Library
|
Pimpl object of StorageManager. More...
Pimpl object of StorageManager.
A private pimpl object for StorageManager. Do not include this header from a client program unless you know what you are doing.
Definition at line 73 of file storage_manager_pimpl.hpp.
#include <storage_manager_pimpl.hpp>
Public Attributes | |
Engine *const | engine_ |
StorageManagerControlBlock * | control_block_ |
StorageControlBlock * | storages_ |
Storage instances (pimpl objects) are allocated in this shared memory. More... | |
storage::StorageId * | storage_name_sort_ |
This shared memory stores the ID of storages sorted by their names. More... | |
|
delete |
|
inlineexplicit |
Definition at line 76 of file storage_manager_pimpl.hpp.
ErrorStack foedus::storage::StorageManagerPimpl::clone_all_storage_metadata | ( | snapshot::SnapshotMetadata * | metadata | ) |
Definition at line 470 of file storage_manager_pimpl.cpp.
References foedus::memory::AlignedMemory::alloc(), foedus::debugging::StopWatch::elapsed_ms(), foedus::memory::AlignedMemory::get_block(), foedus::memory::AlignedMemory::kNumaAllocOnnode, foedus::kRetOk, foedus::soc::GlobalMemoryAnchors::kStorageMemorySize, foedus::snapshot::SnapshotMetadata::largest_storage_id_, foedus::assorted::memory_fence_acq_rel(), foedus::debugging::StopWatch::stop(), foedus::snapshot::SnapshotMetadata::storage_control_blocks_, foedus::snapshot::SnapshotMetadata::storage_control_blocks_memory_, and storages_.
Referenced by foedus::storage::StorageManager::clone_all_storage_metadata().
ErrorStack foedus::storage::StorageManagerPimpl::create_storage | ( | Metadata * | metadata, |
Epoch * | commit_epoch | ||
) |
Definition at line 352 of file storage_manager_pimpl.cpp.
References ASSERT_ND, CHECK_ERROR, foedus::assorted::FixedString< MAXLEN, CHAR >::empty(), ERROR_STACK, exists(), get_max_storages(), get_storage(), foedus::storage::Metadata::id_, foedus::storage::StorageControlBlock::initialize(), foedus::INVALID_EPOCH, foedus::Epoch::is_valid(), issue_next_storage_id(), foedus::storage::kArrayStorage, foedus::kErrorCodeStrDuplicateStrname, foedus::kErrorCodeStrEmptyName, foedus::kErrorCodeStrTooManyStorages, foedus::storage::kHashStorage, foedus::storage::kMasstreeStorage, foedus::kRetOk, foedus::storage::kSequentialStorage, foedus::storage::StorageControlBlock::meta_, foedus::storage::Metadata::name_, storages_, foedus::storage::Metadata::type_, and foedus::assorted::FixedString< MAXLEN, CHAR >::zero_fill_remaining().
Referenced by foedus::storage::StorageManager::create_storage().
ErrorStack foedus::storage::StorageManagerPimpl::create_storage_and_log | ( | const Metadata * | meta, |
Epoch * | commit_epoch | ||
) |
Definition at line 321 of file storage_manager_pimpl.cpp.
References ASSERT_ND, CHECK_ERROR, foedus::log::MetaLogBuffer::commit(), engine_, foedus::storage::StorageControlBlock::exists(), foedus::Engine::get_log_manager(), foedus::log::LogManager::get_meta_buffer(), foedus::storage::Metadata::id_, foedus::kRetOk, foedus::storage::Metadata::name_, storages_, and foedus::storage::Metadata::type_.
void foedus::storage::StorageManagerPimpl::create_storage_apply | ( | const Metadata & | metadata | ) |
Definition at line 393 of file storage_manager_pimpl.cpp.
References ASSERT_ND, control_block_, foedus::assorted::FixedString< MAXLEN, CHAR >::empty(), exists(), get_storage(), foedus::storage::Metadata::id_, foedus::storage::StorageControlBlock::initialize(), foedus::ErrorStack::is_error(), foedus::storage::kArrayStorage, foedus::storage::kHashStorage, foedus::storage::kMasstreeStorage, foedus::storage::kSequentialStorage, foedus::storage::StorageManagerControlBlock::largest_storage_id_, foedus::storage::StorageControlBlock::meta_, foedus::storage::Metadata::name_, storages_, and foedus::storage::Metadata::type_.
Referenced by foedus::storage::StorageManager::create_storage_apply().
ErrorStack foedus::storage::StorageManagerPimpl::drop_storage | ( | StorageId | id, |
Epoch * | commit_epoch | ||
) |
Definition at line 264 of file storage_manager_pimpl.cpp.
References ASSERT_ND, CHECK_ERROR, foedus::log::MetaLogBuffer::commit(), engine_, ERROR_STACK, foedus::storage::StorageControlBlock::exists(), foedus::Engine::get_log_manager(), foedus::log::LogManager::get_meta_buffer(), foedus::Epoch::is_valid(), foedus::storage::kArrayStorage, foedus::kErrorCodeStrAlreadyDropped, foedus::storage::kHashStorage, foedus::storage::kMarkedForDeath, foedus::storage::kMasstreeStorage, foedus::kRetOk, foedus::storage::kSequentialStorage, foedus::storage::StorageControlBlock::meta_, foedus::storage::Metadata::name_, foedus::storage::DropLogType::populate(), foedus::storage::StorageControlBlock::status_, storages_, foedus::storage::Metadata::type_, and foedus::storage::StorageControlBlock::uninitialize().
Referenced by foedus::storage::StorageManager::drop_storage().
void foedus::storage::StorageManagerPimpl::drop_storage_apply | ( | StorageId | id | ) |
Definition at line 300 of file storage_manager_pimpl.cpp.
References ASSERT_ND, COERCE_ERROR, engine_, foedus::storage::StorageControlBlock::exists(), foedus::storage::kArrayStorage, foedus::storage::kHashStorage, foedus::storage::kMarkedForDeath, foedus::storage::kMasstreeStorage, foedus::storage::kSequentialStorage, foedus::storage::StorageControlBlock::meta_, foedus::storage::StorageControlBlock::status_, storages_, foedus::storage::Metadata::type_, and foedus::storage::StorageControlBlock::uninitialize().
Referenced by foedus::storage::StorageManager::drop_storage_apply(), and uninitialize_once().
bool foedus::storage::StorageManagerPimpl::exists | ( | const StorageName & | name | ) |
Definition at line 253 of file storage_manager_pimpl.cpp.
References control_block_, foedus::storage::StorageManagerControlBlock::largest_storage_id_, foedus::storage::StorageManagerControlBlock::mod_lock_, and storages_.
Referenced by create_storage(), create_storage_apply(), initialize_read_latest_snapshot(), and uninitialize_once().
uint32_t foedus::storage::StorageManagerPimpl::get_max_storages | ( | ) | const |
Definition at line 65 of file storage_manager_pimpl.cpp.
References engine_, foedus::Engine::get_options(), foedus::storage::StorageOptions::max_storages_, and foedus::EngineOptions::storage_.
Referenced by create_storage().
|
inline |
Definition at line 93 of file storage_manager_pimpl.hpp.
References storages_.
Referenced by create_storage(), create_storage_apply(), foedus::storage::StorageManager::get_storage(), and initialize_read_latest_snapshot().
StorageControlBlock * foedus::storage::StorageManagerPimpl::get_storage | ( | const StorageName & | name | ) |
Definition at line 242 of file storage_manager_pimpl.cpp.
References control_block_, foedus::storage::StorageManagerControlBlock::largest_storage_id_, foedus::storage::StorageManagerControlBlock::mod_lock_, and storages_.
ErrorStack foedus::storage::StorageManagerPimpl::hcc_reset_all_temperature_stat | ( | StorageId | storage_id | ) |
Resets all volatile pages' temperature stat to be zero in the specified storage.
Used only in HCC-branch.
Definition at line 427 of file storage_manager_pimpl.cpp.
References ASSERT_ND, CHECK_ERROR, engine_, foedus::storage::StorageControlBlock::exists(), foedus::storage::kArrayStorage, foedus::storage::kHashStorage, foedus::storage::kMasstreeStorage, foedus::kRetOk, foedus::storage::StorageControlBlock::meta_, storages_, and foedus::storage::Metadata::type_.
|
overridevirtual |
Implements foedus::DefaultInitializable.
Definition at line 69 of file storage_manager_pimpl.cpp.
References CHECK_ERROR, control_block_, engine_, ERROR_STACK, foedus::soc::SharedMemoryRepo::get_global_memory_anchors(), foedus::Engine::get_log_manager(), foedus::soc::SocManager::get_shared_memory_repo(), foedus::Engine::get_soc_manager(), foedus::Engine::get_thread_pool(), foedus::storage::StorageManagerControlBlock::initialize(), initialize_read_latest_snapshot(), foedus::log::LogManager::is_initialized(), foedus::thread::ThreadPool::is_initialized(), foedus::Engine::is_master(), foedus::kErrorCodeDepedentModuleUnavailableInit, foedus::kRetOk, foedus::storage::StorageManagerControlBlock::largest_storage_id_, foedus::soc::GlobalMemoryAnchors::storage_manager_memory_, foedus::soc::GlobalMemoryAnchors::storage_memories_, storage_name_sort_, foedus::soc::GlobalMemoryAnchors::storage_name_sort_memory_, and storages_.
ErrorStack foedus::storage::StorageManagerPimpl::initialize_read_latest_snapshot | ( | ) |
Definition at line 94 of file storage_manager_pimpl.cpp.
References ASSERT_ND, CHECK_ERROR, foedus::storage::VolatilePagePointer::clear(), control_block_, foedus::debugging::StopWatch::elapsed_ms(), foedus::assorted::FixedString< MAXLEN, CHAR >::empty(), engine_, ERROR_STACK, exists(), foedus::savepoint::SavepointManager::get_latest_snapshot_id(), foedus::Engine::get_savepoint_manager(), foedus::Engine::get_snapshot_manager(), get_storage(), foedus::storage::Metadata::id_, foedus::storage::StorageControlBlock::initialize(), foedus::Engine::is_master(), foedus::storage::kArrayStorage, foedus::kErrorCodeStrUnsupportedMetadata, foedus::storage::kExists, foedus::storage::kHashStorage, foedus::storage::kMasstreeStorage, foedus::storage::kNotExists, foedus::snapshot::kNullSnapshotId, foedus::kRetOk, foedus::storage::kSequentialStorage, foedus::storage::StorageManagerControlBlock::largest_storage_id_, foedus::snapshot::SnapshotMetadata::largest_storage_id_, foedus::storage::StorageControlBlock::meta_, foedus::storage::Metadata::name_, foedus::snapshot::SnapshotManager::read_snapshot_metadata(), foedus::storage::StorageControlBlock::root_page_pointer_, foedus::storage::Metadata::root_snapshot_page_id_, foedus::storage::DualPagePointer::snapshot_pointer_, foedus::storage::StorageControlBlock::status_, foedus::debugging::StopWatch::stop(), foedus::snapshot::SnapshotMetadata::storage_control_blocks_, storages_, foedus::storage::Metadata::type_, and foedus::storage::DualPagePointer::volatile_pointer_.
Referenced by initialize_once().
StorageId foedus::storage::StorageManagerPimpl::issue_next_storage_id | ( | ) |
Definition at line 235 of file storage_manager_pimpl.cpp.
References control_block_, foedus::storage::StorageManagerControlBlock::largest_storage_id_, and foedus::storage::StorageManagerControlBlock::mod_lock_.
Referenced by create_storage(), and foedus::storage::StorageManager::issue_next_storage_id().
ErrorStack foedus::storage::StorageManagerPimpl::reinitialize_for_recovered_snapshot | ( | ) |
Special method called only from recovery manager.
1) initialize_once(), which calls initialize_read_latest_snapshot(). 2) if there are non-snapshotted and durable logs, recovery manager triggers snapshotting 3) then, reinitialize only root pages with this method.
Unlike usual snapshot, we can assume that there is no concurrent worker, so we can safely drop volatile root pages and re-create them with the new snapshot pages.
Definition at line 157 of file storage_manager_pimpl.cpp.
References ASSERT_ND, CHECK_ERROR, control_block_, foedus::debugging::StopWatch::elapsed_ms(), engine_, foedus::storage::StorageControlBlock::exists(), foedus::memory::EngineMemory::get_global_volatile_page_resolver(), foedus::storage::Page::get_header(), foedus::Engine::get_memory_manager(), foedus::storage::Page::get_snapshot_page_id(), foedus::storage::Page::get_volatile_page_id(), foedus::DefaultInitializable::initialize(), foedus::storage::VolatilePagePointer::is_null(), foedus::kRetOk, foedus::UninitializeGuard::kWarnIfUninitializeError, foedus::storage::StorageManagerControlBlock::largest_storage_id_, foedus::storage::PageHeader::page_id_, foedus::cache::SnapshotFileSet::read_page(), foedus::storage::StorageControlBlock::root_page_pointer_, foedus::storage::PageHeader::snapshot_, foedus::storage::DualPagePointer::snapshot_pointer_, foedus::debugging::StopWatch::stop(), foedus::storage::PageHeader::storage_id_, storages_, foedus::DefaultInitializable::uninitialize(), foedus::storage::DualPagePointer::volatile_pointer_, foedus::storage::VolatilePagePointer::word, and WRAP_ERROR_CODE.
Referenced by foedus::storage::StorageManager::reinitialize_for_recovered_snapshot().
xct::TrackMovedRecordResult foedus::storage::StorageManagerPimpl::track_moved_record | ( | StorageId | storage_id, |
xct::RwLockableXctId * | old_address, | ||
xct::WriteXctAccess * | write | ||
) |
Definition at line 452 of file storage_manager_pimpl.cpp.
References ASSERT_ND, engine_, foedus::storage::StorageControlBlock::exists(), foedus::storage::kHashStorage, foedus::storage::kMasstreeStorage, foedus::storage::StorageControlBlock::meta_, storages_, foedus::storage::hash::HashStorage::track_moved_record(), foedus::storage::masstree::MasstreeStorage::track_moved_record(), and foedus::storage::Metadata::type_.
Referenced by foedus::storage::StorageManager::track_moved_record().
|
overridevirtual |
Implements foedus::DefaultInitializable.
Definition at line 208 of file storage_manager_pimpl.cpp.
References ASSERT_ND, control_block_, drop_storage_apply(), foedus::ErrorStackBatch::emprace_back(), engine_, ERROR_STACK, exists(), foedus::Engine::get_log_manager(), foedus::Engine::get_thread_pool(), foedus::log::LogManager::is_initialized(), foedus::thread::ThreadPool::is_initialized(), foedus::Engine::is_master(), foedus::kErrorCodeDepedentModuleUnavailableUninit, foedus::storage::StorageManagerControlBlock::largest_storage_id_, storages_, SUMMARIZE_ERROR_BATCH, and foedus::storage::StorageManagerControlBlock::uninitialize().
StorageManagerControlBlock* foedus::storage::StorageManagerPimpl::control_block_ |
Definition at line 120 of file storage_manager_pimpl.hpp.
Referenced by create_storage_apply(), exists(), foedus::storage::StorageManager::get_largest_storage_id(), get_storage(), initialize_once(), initialize_read_latest_snapshot(), issue_next_storage_id(), reinitialize_for_recovered_snapshot(), and uninitialize_once().
Engine* const foedus::storage::StorageManagerPimpl::engine_ |
Definition at line 118 of file storage_manager_pimpl.hpp.
Referenced by create_storage_and_log(), drop_storage(), drop_storage_apply(), foedus::storage::StorageManager::get_engine(), get_max_storages(), hcc_reset_all_temperature_stat(), initialize_once(), initialize_read_latest_snapshot(), reinitialize_for_recovered_snapshot(), track_moved_record(), and uninitialize_once().
storage::StorageId* foedus::storage::StorageManagerPimpl::storage_name_sort_ |
This shared memory stores the ID of storages sorted by their names.
Accessing this, either read or write, must take mod_lock_. This is why get_storage(string) is more expensive.
Definition at line 135 of file storage_manager_pimpl.hpp.
Referenced by initialize_once().
StorageControlBlock* foedus::storage::StorageManagerPimpl::storages_ |
Storage instances (pimpl objects) are allocated in this shared memory.
Each storage instance must be within 4kb. If the storage type requires more than 4kb, just grab a page from volatile page pools and point to it from the storage object. Remember that all pages in volatile page pools are shared.
Definition at line 128 of file storage_manager_pimpl.hpp.
Referenced by clone_all_storage_metadata(), create_storage(), create_storage_and_log(), create_storage_apply(), drop_storage(), drop_storage_apply(), exists(), get_storage(), hcc_reset_all_temperature_stat(), initialize_once(), initialize_read_latest_snapshot(), reinitialize_for_recovered_snapshot(), track_moved_record(), and uninitialize_once().