18 #ifndef FOEDUS_STORAGE_MASSTREE_MASSTREE_PARTITIONER_IMPL_HPP_
19 #define FOEDUS_STORAGE_MASSTREE_MASSTREE_PARTITIONER_IMPL_HPP_
144 uint16_t
find_partition(
const char* key, uint16_t key_length)
const;
158 std::memset(
occurrences_, 0,
sizeof(uint32_t) * nodes * subtrees);
160 std::memset(
assignments_, 0,
sizeof(uint32_t) * subtrees);
181 ++occurrences_[subtree_id * nodes_ + node];
183 uint32_t
at(uint32_t node, uint32_t subtree_id)
const {
186 return occurrences_[subtree_id * nodes_ + node];
189 uint32_t
get_assignment(uint32_t subtree_id)
const {
return assignments_[subtree_id]; }
205 uint16_t left_length,
207 uint16_t right_length) {
208 uint16_t cmp_length = std::min(left_length, right_length);
209 int result = std::memcmp(left, right, cmp_length);
212 }
else if (left_length < right_length) {
214 }
else if (left_length > right_length) {
236 #endif // FOEDUS_STORAGE_MASSTREE_MASSTREE_PARTITIONER_IMPL_HPP_
Packages handling of 4-bytes representation of position in log buffers.
0x0033 : foedus::storage::masstree::MasstreeInsertLogType .
uint16_t partitions_[kMaxIntermediatePointers]
uint16_t find_partition(const char *key, uint16_t key_length) const
Returns the partition (node ID) that should contain the key.
Definitions of IDs in this package and a few related constant values.
uint16_t partition_count_
uint32_t StorageId
Unique ID for storage.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
uint32_t at(uint32_t node, uint32_t subtree_id) const
uint32_t BufferPosition
Represents a position in some buffer.
Declares all log types used in this storage type.
uint32_t * assignments_
node_id to be the owner of the subtree
Forward declarations of classes in root package.
Brings error stacktrace information as return value of functions.
uint64_t KeySlice
Each key slice is an 8-byte integer.
A base class for MasstreeInsertLogType/MasstreeDeleteLogType/MasstreeOverwriteLogType.
MasstreePartitioner(Partitioner *parent)
MasstreePartitioner methods.
Definitions of IDs in this package and a few related constant values.
Common base of MasstreeIntermediatePage and MasstreeBorderPage.
const uint32_t nodes_
number of nodes
Number of vol pages in each node sampled per pointer in the root page.
KeySlice low_keys_[kMaxIntermediatePointers]
0x0032 : foedus::storage::masstree::MasstreeOverwriteLogType .
Dynamic information of one partitioner.
void sort_batch(const Partitioner::SortBatchArguments &args) const
Database engine object that holds all resources and provides APIs.
void assign_owners()
Determine assignments based on the samples.
uint32_t get_assignment(uint32_t subtree_id) const
const MasstreeCommonLogType * resolve_log(const snapshot::LogBuffer &log_buffer, snapshot::BufferPosition pos)
friend std::ostream & operator<<(std::ostream &o, const OwnerSamples &v)
uint32_t * occurrences_
number of occurences of a volatile page in the node.
MasstreePartitionerData()=delete
Forward declarations of classes in memory package.
0x0034 : foedus::storage::masstree::MasstreeDeleteLogType .
void increment(uint32_t node, uint32_t subtree_id)
0x0035 : foedus::storage::masstree::MasstreeUpdateLogType .
Partitioner for a masstree storage.
Partitioning and sorting logic for one storage.
const uint32_t kMaxIntermediatePointers
Max number of pointers (if completely filled) stored in an intermediate pages.
Arguments for sort_batch()
const uint32_t subtrees_
number of pointers to children in the root page
Represents one intermediate page in Masstree Storage.
~MasstreePartitionerData()=delete
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
OwnerSamples(uint32_t nodes, uint32_t subtrees)
bool is_partitionable() const
ErrorStack design_partition(const Partitioner::DesignPartitionArguments &args)
log::RecordLogType * resolve(BufferPosition position) const
Arguments for design_partition()
void partition_batch(const Partitioner::PartitionBatchArguments &args) const
friend std::ostream & operator<<(std::ostream &o, const MasstreePartitioner &v)
int compare_keys(const char *left, uint16_t left_length, const char *right, uint16_t right_length)
Local utility functions.
Arguments for partition_batch()