libfoedus-core
FOEDUS Core Library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
foedus::storage::masstree::MasstreeMetadata Struct Referencefinal

Metadata of a masstree storage. More...

Detailed Description

Metadata of a masstree storage.

Definition at line 41 of file masstree_metadata.hpp.

#include <masstree_metadata.hpp>

Inheritance diagram for foedus::storage::masstree::MasstreeMetadata:
Collaboration diagram for foedus::storage::masstree::MasstreeMetadata:

Public Types

enum  Constants { kDefaultDropVolatilePagesBtreeLevels = 3 }
 

Public Member Functions

 MasstreeMetadata ()
 
 MasstreeMetadata (StorageId id, const StorageName &name, uint16_t border_early_split_threshold=0, uint16_t snapshot_drop_volatile_pages_layer_threshold=0, uint16_t snapshot_drop_volatile_pages_btree_levels=kDefaultDropVolatilePagesBtreeLevels, Layer min_layer_hint=0)
 
 MasstreeMetadata (const StorageName &name, uint16_t border_early_split_threshold=0, uint16_t snapshot_drop_volatile_pages_layer_threshold=0, uint16_t snapshot_drop_volatile_pages_btree_levels=kDefaultDropVolatilePagesBtreeLevels, Layer min_layer_hint=0)
 This one is for newly creating a storage. More...
 
std::string describe () const
 
bool should_aggresively_create_next_layer (Layer cur_layer, KeyLength remainder) const
 

Public Attributes

uint16_t border_early_split_threshold_
 Kind of fill factor for border pages, bit different from usual B-tree. More...
 
uint16_t snapshot_drop_volatile_pages_layer_threshold_
 Number of B-trie layers of volatile pages to keep after each snapshotting. More...
 
uint16_t snapshot_drop_volatile_pages_btree_levels_
 Volatile pages of this B-tree level or higher are always kept after each snapshotting. More...
 
Layer min_layer_hint_
 Hints how many layers this storage will create for most of records. More...
 
uint8_t pad1_
 

Friends

std::ostream & operator<< (std::ostream &o, const MasstreeMetadata &v)
 

Additional Inherited Members

Member Enumeration Documentation

Constructor & Destructor Documentation

foedus::storage::masstree::MasstreeMetadata::MasstreeMetadata ( )
inline

Definition at line 45 of file masstree_metadata.hpp.

45  :
46  Metadata(0, kMasstreeStorage, ""),
50  min_layer_hint_(0),
51  pad1_(0) {}
uint16_t snapshot_drop_volatile_pages_layer_threshold_
Number of B-trie layers of volatile pages to keep after each snapshotting.
uint16_t border_early_split_threshold_
Kind of fill factor for border pages, bit different from usual B-tree.
Layer min_layer_hint_
Hints how many layers this storage will create for most of records.
uint16_t snapshot_drop_volatile_pages_btree_levels_
Volatile pages of this B-tree level or higher are always kept after each snapshotting.
foedus::storage::masstree::MasstreeMetadata::MasstreeMetadata ( StorageId  id,
const StorageName name,
uint16_t  border_early_split_threshold = 0,
uint16_t  snapshot_drop_volatile_pages_layer_threshold = 0,
uint16_t  snapshot_drop_volatile_pages_btree_levels = kDefaultDropVolatilePagesBtreeLevels,
Layer  min_layer_hint = 0 
)
inline

Definition at line 52 of file masstree_metadata.hpp.

59  : Metadata(id, kMasstreeStorage, name),
60  border_early_split_threshold_(border_early_split_threshold),
61  snapshot_drop_volatile_pages_layer_threshold_(snapshot_drop_volatile_pages_layer_threshold),
62  snapshot_drop_volatile_pages_btree_levels_(snapshot_drop_volatile_pages_btree_levels),
63  min_layer_hint_(min_layer_hint),
64  pad1_(0) {
65  }
uint16_t snapshot_drop_volatile_pages_layer_threshold_
Number of B-trie layers of volatile pages to keep after each snapshotting.
uint16_t border_early_split_threshold_
Kind of fill factor for border pages, bit different from usual B-tree.
Layer min_layer_hint_
Hints how many layers this storage will create for most of records.
uint16_t snapshot_drop_volatile_pages_btree_levels_
Volatile pages of this B-tree level or higher are always kept after each snapshotting.
foedus::storage::masstree::MasstreeMetadata::MasstreeMetadata ( const StorageName name,
uint16_t  border_early_split_threshold = 0,
uint16_t  snapshot_drop_volatile_pages_layer_threshold = 0,
uint16_t  snapshot_drop_volatile_pages_btree_levels = kDefaultDropVolatilePagesBtreeLevels,
Layer  min_layer_hint = 0 
)
inline

This one is for newly creating a storage.

Definition at line 67 of file masstree_metadata.hpp.

73  : Metadata(0, kMasstreeStorage, name),
74  border_early_split_threshold_(border_early_split_threshold),
75  snapshot_drop_volatile_pages_layer_threshold_(snapshot_drop_volatile_pages_layer_threshold),
76  snapshot_drop_volatile_pages_btree_levels_(snapshot_drop_volatile_pages_btree_levels),
77  min_layer_hint_(min_layer_hint),
78  pad1_(0) {
79  }
uint16_t snapshot_drop_volatile_pages_layer_threshold_
Number of B-trie layers of volatile pages to keep after each snapshotting.
uint16_t border_early_split_threshold_
Kind of fill factor for border pages, bit different from usual B-tree.
Layer min_layer_hint_
Hints how many layers this storage will create for most of records.
uint16_t snapshot_drop_volatile_pages_btree_levels_
Volatile pages of this B-tree level or higher are always kept after each snapshotting.

Member Function Documentation

std::string foedus::storage::masstree::MasstreeMetadata::describe ( ) const

Definition at line 29 of file masstree_metadata.cpp.

29  {
30  std::stringstream o;
31  o << MasstreeMetadataSerializer(const_cast<MasstreeMetadata*>(this));
32  return o.str();
33 }
bool foedus::storage::masstree::MasstreeMetadata::should_aggresively_create_next_layer ( Layer  cur_layer,
KeyLength  remainder 
) const
inline
Returns
whether we should create a next layer based on min_layer_hint_

Definition at line 132 of file masstree_metadata.hpp.

132  {
133  if (remainder <= sizeof(KeySlice)) {
134  return false; // anyway can't create a next layer.
135  }
136  return min_layer_hint_ > cur_layer;
137  }
uint64_t KeySlice
Each key slice is an 8-byte integer.
Layer min_layer_hint_
Hints how many layers this storage will create for most of records.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const MasstreeMetadata v 
)
friend

Definition at line 34 of file masstree_metadata.cpp.

34  {
35  o << MasstreeMetadataSerializer(const_cast<MasstreeMetadata*>(&v));
36  return o;
37 }

Member Data Documentation

uint16_t foedus::storage::masstree::MasstreeMetadata::border_early_split_threshold_

Kind of fill factor for border pages, bit different from usual B-tree.

Border pages split without being full when a border page seems to receive sequential inserts and the physical key count will exactly hit this value. Once it passes this value, it goes on until it really becomes full (otherwise there is no point.. the border pages keep splitting without necessity). When the page is not receiving sequential inserts, there are also no points to split early. The default is 0, which means we never consider early split.

Definition at line 94 of file masstree_metadata.hpp.

Referenced by foedus::storage::masstree::MasstreeMetadataSerializer::load(), and foedus::storage::masstree::MasstreeMetadataSerializer::save().

Layer foedus::storage::masstree::MasstreeMetadata::min_layer_hint_

Hints how many layers this storage will create for most of records.

0 is the default, which does nothing. n (n>0) hints that most records in this storage will be stored in layer-n or deeper, thus we should blindly create an initially next-layer record in layer-(n-1) and above as far as the length of the key allows.

If appropriately specified, this reduces contention and wasted space in layer-(n-1) and above. If you specify too large min_layer_hint_, it might slow down searches because the record could otherwise fit in layer-(n-1) or above.

Definition at line 126 of file masstree_metadata.hpp.

Referenced by foedus::storage::masstree::MasstreeMetadataSerializer::load(), and foedus::storage::masstree::MasstreeMetadataSerializer::save().

uint8_t foedus::storage::masstree::MasstreeMetadata::pad1_

Definition at line 129 of file masstree_metadata.hpp.

uint16_t foedus::storage::masstree::MasstreeMetadata::snapshot_drop_volatile_pages_btree_levels_

Volatile pages of this B-tree level or higher are always kept after each snapshotting.

0 means we don't drop any volatile pages. 1 means we drop only border pages. Note that this and snapshot_drop_volatile_pages_layer_threshold_ are AND conditions, meaning we drop volatile pages that meet both conditions. Further, we anyway don't drop volatile pages that have modifications after the snapshot epoch. The default is kDefaultDropVolatilePagesBtreeLevels.

Definition at line 112 of file masstree_metadata.hpp.

Referenced by foedus::storage::masstree::MasstreeMetadataSerializer::load(), and foedus::storage::masstree::MasstreeMetadataSerializer::save().

uint16_t foedus::storage::masstree::MasstreeMetadata::snapshot_drop_volatile_pages_layer_threshold_

Number of B-trie layers of volatile pages to keep after each snapshotting.

0 means this storage drops volatile pages even if it's in the first layer. 1 means it keeps all pages in first layer. The default is 0.

Definition at line 102 of file masstree_metadata.hpp.

Referenced by foedus::storage::masstree::MasstreeMetadataSerializer::load(), and foedus::storage::masstree::MasstreeMetadataSerializer::save().


The documentation for this struct was generated from the following files: