libfoedus-core
FOEDUS Core Library
|
Tiny metadata of partitioner for every storage used while log gleaning. More...
Tiny metadata of partitioner for every storage used while log gleaning.
The metadata is tiny because it just points to a data block in a separate partitioner data block, which is variable-sized. Think of Masstree's partitioning information for example. we have to store keys, so we can't statically determine the size. We allocate an array of this object on shared memory so that all mappers/reducers can access the partitioner information.
Definition at line 209 of file partitioner.hpp.
#include <partitioner.hpp>
Public Member Functions | |
PartitionerMetadata ()=delete | |
~PartitionerMetadata ()=delete | |
void | initialize () |
void | uninitialize () |
void | clear_counts () |
void * | locate_data (Engine *engine) |
Returns the partitioner data pointed from this metadata. More... | |
ErrorCode | allocate_data (Engine *engine, soc::SharedMutexScope *locked, uint32_t data_size) |
Allocates a patitioner data in shared memory of the given size. More... | |
Static Public Member Functions | |
static PartitionerMetadata * | get_metadata (Engine *engine, StorageId id) |
Returns the shared memory for the given storage ID. More... | |
static PartitionerMetadata * | get_index0_metadata (Engine *engine) |
Returns the special index-0 entry that manages data block allocation for partitioners. More... | |
Public Attributes | |
soc::SharedMutex | mutex_ |
Serialize concurrent initialization of this partitioner. More... | |
bool | valid_ |
Whether this partitioner information (metadata+data) has been constructed. More... | |
uint32_t | data_offset_ |
Relative offset from the beginning of partitioner data block that points to variable-sized partitioner data. More... | |
uint32_t | data_size_ |
The size of the partitioner data. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const PartitionerMetadata &v) |
|
delete |
|
delete |
ErrorCode foedus::storage::PartitionerMetadata::allocate_data | ( | Engine * | engine, |
soc::SharedMutexScope * | locked, | ||
uint32_t | data_size | ||
) |
Allocates a patitioner data in shared memory of the given size.
Definition at line 61 of file partitioner.cpp.
References ASSERT_ND, data_offset_, data_size_, get_index0_metadata(), foedus::soc::SharedMutexScope::get_mutex(), foedus::soc::SharedMutexScope::is_locked_by_me(), foedus::kErrorCodeOk, foedus::kErrorCodeStrPartitionerDataMemoryTooSmall, mutex_, and valid_.
Referenced by foedus::storage::hash::HashPartitioner::design_partition(), foedus::storage::array::ArrayPartitioner::design_partition(), and foedus::storage::masstree::MasstreePartitioner::design_partition().
|
inline |
Definition at line 221 of file partitioner.hpp.
References data_offset_, data_size_, and valid_.
Referenced by initialize().
|
static |
Returns the special index-0 entry that manages data block allocation for partitioners.
Definition at line 45 of file partitioner.cpp.
References foedus::soc::SharedMemoryRepo::get_global_memory_anchors(), foedus::soc::SocManager::get_shared_memory_repo(), foedus::Engine::get_soc_manager(), and foedus::soc::GlobalMemoryAnchors::partitioner_metadata_.
Referenced by allocate_data().
|
static |
Returns the shared memory for the given storage ID.
Definition at line 38 of file partitioner.cpp.
References ASSERT_ND, foedus::soc::SharedMemoryRepo::get_global_memory_anchors(), foedus::soc::SocManager::get_shared_memory_repo(), foedus::Engine::get_soc_manager(), and foedus::soc::GlobalMemoryAnchors::partitioner_metadata_.
Referenced by foedus::storage::array::ArrayComposeContext::ArrayComposeContext(), and foedus::storage::masstree::MasstreeComposer::drop_volatiles().
|
inline |
Definition at line 214 of file partitioner.hpp.
References clear_counts(), foedus::soc::SharedMutex::initialize(), and mutex_.
Referenced by foedus::snapshot::SnapshotManagerPimpl::initialize_once().
void * foedus::storage::PartitionerMetadata::locate_data | ( | Engine * | engine | ) |
Returns the partitioner data pointed from this metadata.
Definition at line 51 of file partitioner.cpp.
References ASSERT_ND, data_offset_, data_size_, foedus::soc::SharedMemoryRepo::get_global_memory_anchors(), foedus::Engine::get_options(), foedus::soc::SocManager::get_shared_memory_repo(), foedus::Engine::get_soc_manager(), foedus::soc::GlobalMemoryAnchors::partitioner_data_, foedus::storage::StorageOptions::partitioner_data_memory_mb_, and foedus::EngineOptions::storage_.
Referenced by foedus::storage::array::ArrayComposeContext::ArrayComposeContext(), foedus::storage::array::ArrayPartitioner::ArrayPartitioner(), foedus::storage::hash::HashPartitioner::design_partition(), foedus::storage::array::ArrayPartitioner::design_partition(), foedus::storage::masstree::MasstreePartitioner::design_partition(), foedus::storage::masstree::MasstreeComposer::drop_volatiles(), foedus::storage::hash::HashPartitioner::HashPartitioner(), and foedus::storage::masstree::MasstreePartitioner::MasstreePartitioner().
|
inline |
Definition at line 218 of file partitioner.hpp.
References mutex_, and foedus::soc::SharedMutex::uninitialize().
Referenced by foedus::snapshot::SnapshotManagerPimpl::uninitialize_once().
|
friend |
Definition at line 148 of file partitioner.cpp.
uint32_t foedus::storage::PartitionerMetadata::data_offset_ |
Relative offset from the beginning of partitioner data block that points to variable-sized partitioner data.
Definition at line 242 of file partitioner.hpp.
Referenced by allocate_data(), clear_counts(), foedus::storage::sequential::SequentialPartitioner::design_partition(), locate_data(), and foedus::storage::operator<<().
uint32_t foedus::storage::PartitionerMetadata::data_size_ |
The size of the partitioner data.
Definition at line 246 of file partitioner.hpp.
Referenced by allocate_data(), clear_counts(), foedus::storage::sequential::SequentialPartitioner::design_partition(), foedus::snapshot::SnapshotManagerPimpl::initialize_once(), locate_data(), and foedus::storage::operator<<().
soc::SharedMutex foedus::storage::PartitionerMetadata::mutex_ |
Serialize concurrent initialization of this partitioner.
This is taken only when valid_ is false or might be false. As far as one observes valid_==true, he doesn't have to take mutex.
Definition at line 232 of file partitioner.hpp.
Referenced by allocate_data(), foedus::storage::array::ArrayPartitioner::ArrayPartitioner(), foedus::storage::hash::HashPartitioner::design_partition(), foedus::storage::array::ArrayPartitioner::design_partition(), foedus::storage::masstree::MasstreePartitioner::design_partition(), foedus::storage::hash::HashPartitioner::HashPartitioner(), initialize(), foedus::snapshot::SnapshotManagerPimpl::initialize_once(), uninitialize(), and foedus::snapshot::SnapshotManagerPimpl::uninitialize_once().
bool foedus::storage::PartitionerMetadata::valid_ |
Whether this partitioner information (metadata+data) has been constructed.
When this is false, only valid_ and mutex_ can be safely accessed.
Definition at line 237 of file partitioner.hpp.
Referenced by allocate_data(), foedus::storage::array::ArrayComposeContext::ArrayComposeContext(), foedus::storage::array::ArrayPartitioner::ArrayPartitioner(), clear_counts(), foedus::storage::sequential::SequentialPartitioner::design_partition(), foedus::storage::hash::HashPartitioner::design_partition(), foedus::storage::array::ArrayPartitioner::design_partition(), foedus::storage::masstree::MasstreePartitioner::design_partition(), foedus::storage::masstree::MasstreeComposer::drop_volatiles(), foedus::storage::hash::HashPartitioner::HashPartitioner(), foedus::storage::masstree::MasstreePartitioner::MasstreePartitioner(), and foedus::storage::operator<<().