libfoedus-core
FOEDUS Core Library
|
Represents a Masstree storage. More...
Represents a Masstree storage.
Definition at line 43 of file masstree_storage.hpp.
#include <masstree_storage.hpp>
Classes | |
struct | PeekBoundariesArguments |
Arguments for peek_volatile_page_boundaries() More... | |
Public Types | |
typedef MasstreeStoragePimpl | ThisPimpl |
typedef MasstreeCreateLogType | ThisCreateLogType |
typedef MasstreeMetadata | ThisMetadata |
Public Member Functions | |
MasstreeStorage () | |
MasstreeStorage (Engine *engine, MasstreeStorageControlBlock *control_block) | |
MasstreeStorage (Engine *engine, StorageControlBlock *control_block) | |
MasstreeStorage (Engine *engine, StorageId id) | |
MasstreeStorage (Engine *engine, const StorageName &name) | |
MasstreeStorage (const MasstreeStorage &other) | |
MasstreeStorage & | operator= (const MasstreeStorage &other) |
const MasstreeMetadata * | get_masstree_metadata () const |
ErrorStack | create (const Metadata &metadata) |
ErrorStack | load (const StorageControlBlock &snapshot_block) |
ErrorStack | drop () |
ErrorCode | prefetch_pages_normalized (thread::Thread *context, bool install_volatile, bool cache_snapshot, KeySlice from=kInfimumSlice, KeySlice to=kSupremumSlice) |
Prefetch data pages in this storage. More... | |
xct::TrackMovedRecordResult | track_moved_record (xct::RwLockableXctId *old_address, xct::WriteXctAccess *write_set) |
Resolves a "moved" record. More... | |
ErrorCode | get_record (thread::Thread *context, const void *key, KeyLength key_length, void *payload, PayloadLength *payload_capacity, bool read_only) |
Retrieves an entire record of the given key in this Masstree. More... | |
ErrorCode | get_record_part (thread::Thread *context, const void *key, KeyLength key_length, void *payload, PayloadLength payload_offset, PayloadLength payload_count, bool read_only) |
Retrieves a part of the given key in this Masstree. More... | |
template<typename PAYLOAD > | |
ErrorCode | get_record_primitive (thread::Thread *context, const void *key, KeyLength key_length, PAYLOAD *payload, PayloadLength payload_offset, bool read_only) |
Retrieves a part of the given key in this Masstree as a primitive value. More... | |
ErrorCode | get_record_normalized (thread::Thread *context, KeySlice key, void *payload, PayloadLength *payload_capacity, bool read_only) |
Retrieves an entire record of the given primitive key in this Masstree. More... | |
ErrorCode | get_record_part_normalized (thread::Thread *context, KeySlice key, void *payload, PayloadLength payload_offset, PayloadLength payload_count, bool read_only) |
Retrieves a part of the given primitive key in this Masstree. More... | |
template<typename PAYLOAD > | |
ErrorCode | get_record_primitive_normalized (thread::Thread *context, KeySlice key, PAYLOAD *payload, PayloadLength payload_offset, bool read_only) |
Retrieves a part of the given primitive key in this Masstree as a primitive value. More... | |
ErrorCode | insert_record (thread::Thread *context, const void *key, KeyLength key_length, const void *payload, PayloadLength payload_count) __attribute__((always_inline)) |
Inserts a new record of the given key in this Masstree. More... | |
ErrorCode | insert_record (thread::Thread *context, const void *key, KeyLength key_length, const void *payload, PayloadLength payload_count, PayloadLength physical_payload_hint) |
With this method, you can also specify physical_payload_hint, the physical size of the record's payload part. More... | |
ErrorCode | insert_record (thread::Thread *context, const void *key, KeyLength key_length) __attribute__((always_inline)) |
Inserts a new record without payload of the given key in this Masstree. More... | |
ErrorCode | insert_record_normalized (thread::Thread *context, KeySlice key, const void *payload, PayloadLength payload_count) __attribute__((always_inline)) |
Inserts a new record of the given primitive key in this Masstree. More... | |
ErrorCode | insert_record_normalized (thread::Thread *context, KeySlice key, const void *payload, PayloadLength payload_count, PayloadLength physical_payload_hint) |
With this method, you can also specify physical_payload_hint. More... | |
ErrorCode | insert_record_normalized (thread::Thread *context, KeySlice key) __attribute__((always_inline)) |
Inserts a new record without payload of the given primitive key in this Masstree. More... | |
ErrorCode | delete_record (thread::Thread *context, const void *key, KeyLength key_length) |
Deletes a record of the given key from this Masstree. More... | |
ErrorCode | delete_record_normalized (thread::Thread *context, KeySlice key) |
Deletes a record of the given primitive key from this Masstree. More... | |
ErrorCode | upsert_record (thread::Thread *context, const void *key, KeyLength key_length, const void *payload, PayloadLength payload_count) __attribute__((always_inline)) |
Inserts a new record of the given key or replaces the existing one, or so-called upsert. More... | |
ErrorCode | upsert_record (thread::Thread *context, const void *key, KeyLength key_length, const void *payload, PayloadLength payload_count, PayloadLength physical_payload_hint) |
With this method, you can also specify physical_payload_hint, the physical size of the record's payload part. More... | |
ErrorCode | upsert_record (thread::Thread *context, const void *key, KeyLength key_length) __attribute__((always_inline)) |
Upserts a new record without payload of the given key in this Masstree. More... | |
ErrorCode | upsert_record_normalized (thread::Thread *context, KeySlice key, const void *payload, PayloadLength payload_count) __attribute__((always_inline)) |
Upserts a new record of the given primitive key in this Masstree. More... | |
ErrorCode | upsert_record_normalized (thread::Thread *context, KeySlice key, const void *payload, PayloadLength payload_count, PayloadLength physical_payload_hint) |
With this method, you can also specify physical_payload_hint. More... | |
ErrorCode | upsert_record_normalized (thread::Thread *context, KeySlice key) __attribute__((always_inline)) |
Upserts a new record without payload of the given primitive key in this Masstree. More... | |
ErrorCode | overwrite_record (thread::Thread *context, const void *key, KeyLength key_length, const void *payload, PayloadLength payload_offset, PayloadLength payload_count) |
Overwrites a part of one record of the given key in this Masstree. More... | |
template<typename PAYLOAD > | |
ErrorCode | overwrite_record_primitive (thread::Thread *context, const void *key, KeyLength key_length, PAYLOAD payload, PayloadLength payload_offset) |
Overwrites a part of one record of the given key in this Masstree as a primitive value. More... | |
ErrorCode | overwrite_record_normalized (thread::Thread *context, KeySlice key, const void *payload, PayloadLength payload_offset, PayloadLength payload_count) |
Overwrites a part of one record of the given primitive key in this Masstree. More... | |
template<typename PAYLOAD > | |
ErrorCode | overwrite_record_primitive_normalized (thread::Thread *context, KeySlice key, PAYLOAD payload, PayloadLength payload_offset) |
Overwrites a part of one record of the given primitive key in this Masstree as a primitive value. More... | |
template<typename PAYLOAD > | |
ErrorCode | increment_record (thread::Thread *context, const void *key, KeyLength key_length, PAYLOAD *value, PayloadLength payload_offset) |
This one further optimizes overwrite methods for the frequent use case of incrementing some data in primitive type. More... | |
template<typename PAYLOAD > | |
ErrorCode | increment_record_normalized (thread::Thread *context, KeySlice key, PAYLOAD *value, PayloadLength payload_offset) |
For primitive key. More... | |
ErrorStack | verify_single_thread (thread::Thread *context) |
ErrorStack | debugout_single_thread (Engine *engine, bool volatile_only=false, uint32_t max_pages=1024U) |
A super-expensive and single-thread only debugging feature to write out gigantic human-readable texts to describe the Masstree in details. More... | |
ErrorStack | hcc_reset_all_temperature_stat () |
Resets all volatile pages' temperature stat to be zero in this storage. More... | |
ErrorCode | peek_volatile_page_boundaries (Engine *engine, const PeekBoundariesArguments &args) |
Checks the volatile pages of this storage to give hints to decide page boundary keys. More... | |
ErrorStack | fatify_first_root (thread::Thread *context, uint32_t desired_count, bool disable_no_record_split=true) |
Deliberately causes splits under the volatile root of first layer, or "fatify" it. More... | |
![]() | |
Storage () | |
Storage (Engine *engine, MasstreeStorageControlBlock *control_block) | |
Storage (Engine *engine, StorageControlBlock *control_block) | |
Storage (Engine *engine, StorageId id) | |
Shorthand for engine->get_storage_manager()->get_storage(id) More... | |
Storage (Engine *engine, const StorageName &name) | |
Shorthand for engine->get_storage_manager()->get_storage(name) More... | |
Storage (const Storage &other) | |
Storage & | operator= (const Storage &other) |
StorageId | get_id () const |
Returns the unique ID of this storage. More... | |
StorageType | get_type () const |
Returns the type of this storage. More... | |
const StorageName & | get_name () const |
Returns the unique name of this storage. More... | |
const Metadata * | get_metadata () const |
Returns the metadata of this storage. More... | |
bool | exists () const |
Returns whether this storage is already created. More... | |
![]() | |
Attachable () | |
Attachable (Engine *engine) | |
Attachable (Engine *engine, MasstreeStorageControlBlock *control_block) | |
Attachable (MasstreeStorageControlBlock *control_block) | |
Attachable (const Attachable &other) | |
virtual | ~Attachable () |
Attachable & | operator= (const Attachable &other) |
virtual void | attach (MasstreeStorageControlBlock *control_block) |
Attaches to the given shared memory. More... | |
bool | is_attached () const |
Returns whether the object has been already attached to some shared memory. More... | |
MasstreeStorageControlBlock * | get_control_block () const |
Engine * | get_engine () const |
void | set_engine (Engine *engine) |
Static Public Member Functions | |
static SlotIndex | estimate_records_per_page (Layer layer, KeyLength key_length, PayloadLength payload_length) |
Friends | |
std::ostream & | operator<< (std::ostream &o, const MasstreeStorage &v) |
Additional Inherited Members | |
![]() | |
Engine * | engine_ |
Most attachable object stores an engine pointer (local engine), so we define it here. More... | |
MasstreeStorageControlBlock * | control_block_ |
The shared data on shared memory that has been initialized in some SOC or master engine. More... | |
Definition at line 46 of file masstree_storage.hpp.
Definition at line 47 of file masstree_storage.hpp.
Definition at line 45 of file masstree_storage.hpp.
foedus::storage::masstree::MasstreeStorage::MasstreeStorage | ( | ) |
Definition at line 37 of file masstree_storage.cpp.
foedus::storage::masstree::MasstreeStorage::MasstreeStorage | ( | Engine * | engine, |
MasstreeStorageControlBlock * | control_block | ||
) |
Definition at line 38 of file masstree_storage.cpp.
References ASSERT_ND, foedus::storage::Storage< MasstreeStorageControlBlock >::exists(), foedus::storage::Storage< MasstreeStorageControlBlock >::get_type(), and foedus::storage::kMasstreeStorage.
foedus::storage::masstree::MasstreeStorage::MasstreeStorage | ( | Engine * | engine, |
StorageControlBlock * | control_block | ||
) |
Definition at line 42 of file masstree_storage.cpp.
References ASSERT_ND, foedus::storage::Storage< MasstreeStorageControlBlock >::exists(), foedus::storage::Storage< MasstreeStorageControlBlock >::get_type(), and foedus::storage::kMasstreeStorage.
Definition at line 46 of file masstree_storage.cpp.
foedus::storage::masstree::MasstreeStorage::MasstreeStorage | ( | Engine * | engine, |
const StorageName & | name | ||
) |
Definition at line 48 of file masstree_storage.cpp.
foedus::storage::masstree::MasstreeStorage::MasstreeStorage | ( | const MasstreeStorage & | other | ) |
Definition at line 50 of file masstree_storage.cpp.
ErrorStack foedus::storage::masstree::MasstreeStorage::create | ( | const Metadata & | metadata | ) |
Definition at line 63 of file masstree_storage.cpp.
References foedus::storage::masstree::MasstreeStoragePimpl::create().
ErrorStack foedus::storage::masstree::MasstreeStorage::debugout_single_thread | ( | Engine * | engine, |
bool | volatile_only = false , |
||
uint32_t | max_pages = 1024U |
||
) |
A super-expensive and single-thread only debugging feature to write out gigantic human-readable texts to describe the Masstree in details.
Do not invoke this method for more than 100 pages, or in production use. This is for debugging.
Definition at line 579 of file masstree_storage.cpp.
References foedus::storage::masstree::MasstreeStoragePimpl::debugout_single_thread().
ErrorCode foedus::storage::masstree::MasstreeStorage::delete_record | ( | thread::Thread * | context, |
const void * | key, | ||
KeyLength | key_length | ||
) |
Deletes a record of the given key from this Masstree.
[in] | context | Thread context |
[in] | key | Arbitrary length of key that is lexicographically (big-endian) evaluated. |
[in] | key_length | Byte size of key. |
When the key does not exist, it returns kErrorCodeStrKeyNotFound and also adds an appropriate record to range-lock read set because it is part of transactional information.
Definition at line 312 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, foedus::storage::masstree::MasstreeStoragePimpl::delete_general(), delete_record_normalized(), foedus::storage::masstree::MasstreeStoragePimpl::locate_record(), and foedus::storage::masstree::normalize_be_bytes_full().
ErrorCode foedus::storage::masstree::MasstreeStorage::delete_record_normalized | ( | thread::Thread * | context, |
KeySlice | key | ||
) |
Deletes a record of the given primitive key from this Masstree.
[in] | context | Thread context |
[in] | key | Primitive key that is evaluated in the primitive type's comparison rule. |
Definition at line 333 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, foedus::storage::masstree::MasstreeStoragePimpl::delete_general(), foedus::assorted::htobe< uint64_t >(), and foedus::storage::masstree::MasstreeStoragePimpl::locate_record_normalized().
Referenced by delete_record().
ErrorStack foedus::storage::masstree::MasstreeStorage::drop | ( | ) |
Definition at line 69 of file masstree_storage.cpp.
References foedus::storage::masstree::MasstreeStoragePimpl::drop().
|
static |
[in] | layer | B-trie layer most border pages would be in. |
[in] | key_length | estimated byte size of each key |
[in] | payload_length | estimated byte size of each payload |
Definition at line 612 of file masstree_storage.cpp.
References foedus::assorted::align8(), ASSERT_ND, foedus::storage::masstree::kBorderPageDataPartSize, foedus::storage::masstree::kBorderPageMaxSlots, and foedus::storage::masstree::kBorderPageSlotSize.
ErrorStack foedus::storage::masstree::MasstreeStorage::fatify_first_root | ( | thread::Thread * | context, |
uint32_t | desired_count, | ||
bool | disable_no_record_split = true |
||
) |
Deliberately causes splits under the volatile root of first layer, or "fatify" it.
[in] | context | Thread context |
[in] | desired_count | Does nothing if the root of first layer already has this many children. |
[in] | disable_no_record_split | when this method triggers page splits, whether to always split pages in half, ignoring chance for no-record-split. usually you should just leave the default value. |
This is a special-purpose, physical-only method that does nothing logically. It increases the number of direct children in first root, which is useful when we partition based on children in first root. Fatifying beforehand shouldn't have any significant drawback, but we so far restrict the use of this method to performance benchmarks.
Definition at line 604 of file masstree_storage.cpp.
References foedus::storage::masstree::MasstreeStoragePimpl::fatify_first_root().
const MasstreeMetadata * foedus::storage::masstree::MasstreeStorage::get_masstree_metadata | ( | ) | const |
Definition at line 59 of file masstree_storage.cpp.
References foedus::Attachable< MasstreeStorageControlBlock >::control_block_.
Referenced by foedus::storage::masstree::MasstreeComposer::drop_root_volatile(), and foedus::storage::masstree::MasstreeComposer::drop_volatiles().
ErrorCode foedus::storage::masstree::MasstreeStorage::get_record | ( | thread::Thread * | context, |
const void * | key, | ||
KeyLength | key_length, | ||
void * | payload, | ||
PayloadLength * | payload_capacity, | ||
bool | read_only | ||
) |
Retrieves an entire record of the given key in this Masstree.
[in] | context | Thread context |
[in] | key | Arbitrary length of key that is lexicographically (big-endian) evaluated. |
[in] | key_length | Byte size of key. |
[out] | payload | Buffer to receive the payload of the record. |
[in,out] | payload_capacity | [In] Byte size of the payload buffer, [Out] length of the payload. This is set whether the payload capacity was too small or not. |
[in] | read_only | Whether this read will not be followed by writes. When MOCC triggers pessimistic lock, this guides us to take either read- or write-lock. |
When payload_capacity is smaller than the actual payload, this method returns kErrorCodeStrTooSmallPayloadBuffer and payload_capacity is set to be the required length.
When the key is not found (kErrorCodeStrKeyNotFound), we also add an appropriate record to range-lock read set because it is part of a transactional information.
Definition at line 79 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, get_record_normalized(), foedus::storage::masstree::MasstreeStoragePimpl::locate_record(), foedus::storage::masstree::normalize_be_bytes_full(), and foedus::storage::masstree::MasstreeStoragePimpl::retrieve_general().
ErrorCode foedus::storage::masstree::MasstreeStorage::get_record_normalized | ( | thread::Thread * | context, |
KeySlice | key, | ||
void * | payload, | ||
PayloadLength * | payload_capacity, | ||
bool | read_only | ||
) |
Retrieves an entire record of the given primitive key in this Masstree.
[in] | context | Thread context |
[in] | key | Primitive key that is evaluated in the primitive type's comparison rule. |
[out] | payload | Buffer to receive the payload of the record. |
[in,out] | payload_capacity | [In] Byte size of the payload buffer, [Out] length of the payload. This is set whether the payload capacity was too small or not. |
[in] | read_only | Whether this read will not be followed by writes. When MOCC triggers pessimistic lock, this guides us to take either read- or write-lock. |
Definition at line 169 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, foedus::storage::masstree::MasstreeStoragePimpl::locate_record_normalized(), and foedus::storage::masstree::MasstreeStoragePimpl::retrieve_general().
Referenced by get_record().
ErrorCode foedus::storage::masstree::MasstreeStorage::get_record_part | ( | thread::Thread * | context, |
const void * | key, | ||
KeyLength | key_length, | ||
void * | payload, | ||
PayloadLength | payload_offset, | ||
PayloadLength | payload_count, | ||
bool | read_only | ||
) |
Retrieves a part of the given key in this Masstree.
[in] | context | Thread context |
[in] | key | Arbitrary length of key that is lexicographically (big-endian) evaluated. |
[in] | key_length | Byte size of key. |
[out] | payload | Buffer to receive the payload of the record. |
[in] | payload_offset | We copy from this byte position of the record. |
[in] | payload_count | How many bytes we copy. |
[in] | read_only | Whether this read will not be followed by writes. When MOCC triggers pessimistic lock, this guides us to take either read- or write-lock. |
Definition at line 107 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, get_record_part_normalized(), foedus::storage::masstree::MasstreeStoragePimpl::locate_record(), foedus::storage::masstree::normalize_be_bytes_full(), and foedus::storage::masstree::MasstreeStoragePimpl::retrieve_part_general().
ErrorCode foedus::storage::masstree::MasstreeStorage::get_record_part_normalized | ( | thread::Thread * | context, |
KeySlice | key, | ||
void * | payload, | ||
PayloadLength | payload_offset, | ||
PayloadLength | payload_count, | ||
bool | read_only | ||
) |
Retrieves a part of the given primitive key in this Masstree.
Definition at line 189 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, foedus::storage::masstree::MasstreeStoragePimpl::locate_record_normalized(), and foedus::storage::masstree::MasstreeStoragePimpl::retrieve_part_general().
Referenced by get_record_part().
ErrorCode foedus::storage::masstree::MasstreeStorage::get_record_primitive | ( | thread::Thread * | context, |
const void * | key, | ||
KeyLength | key_length, | ||
PAYLOAD * | payload, | ||
PayloadLength | payload_offset, | ||
bool | read_only | ||
) |
Retrieves a part of the given key in this Masstree as a primitive value.
[in] | context | Thread context |
[in] | key | Arbitrary length of key that is lexicographically (big-endian) evaluated. |
[in] | key_length | Byte size of key. |
[out] | payload | Receive the payload of the record. |
[in] | payload_offset | We copy from this byte position of the record. |
[in] | read_only | Whether this read will not be followed by writes. When MOCC triggers pessimistic lock, this guides us to take either read- or write-lock. |
PAYLOAD | primitive type of the payload. all integers and floats are allowed. |
Definition at line 139 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, foedus::storage::masstree::MasstreeStoragePimpl::locate_record(), foedus::storage::masstree::normalize_be_bytes_full(), and foedus::storage::masstree::MasstreeStoragePimpl::retrieve_part_general().
ErrorCode foedus::storage::masstree::MasstreeStorage::get_record_primitive_normalized | ( | thread::Thread * | context, |
KeySlice | key, | ||
PAYLOAD * | payload, | ||
PayloadLength | payload_offset, | ||
bool | read_only | ||
) |
Retrieves a part of the given primitive key in this Masstree as a primitive value.
Definition at line 212 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, foedus::storage::masstree::MasstreeStoragePimpl::locate_record_normalized(), and foedus::storage::masstree::MasstreeStoragePimpl::retrieve_part_general().
ErrorStack foedus::storage::masstree::MasstreeStorage::hcc_reset_all_temperature_stat | ( | ) |
Resets all volatile pages' temperature stat to be zero in this storage.
Used only in HCC-branch.
Definition at line 586 of file masstree_storage.cpp.
References foedus::storage::masstree::MasstreeStoragePimpl::hcc_reset_all_temperature_stat().
ErrorCode foedus::storage::masstree::MasstreeStorage::increment_record | ( | thread::Thread * | context, |
const void * | key, | ||
KeyLength | key_length, | ||
PAYLOAD * | value, | ||
PayloadLength | payload_offset | ||
) |
This one further optimizes overwrite methods for the frequent use case of incrementing some data in primitive type.
[in] | context | Thread context |
[in] | key | Arbitrary length of key that is lexicographically (big-endian) evaluated. |
[in] | key_length | Byte size of key. |
[in,out] | value | (in) addendum, (out) value after addition. |
[in] | payload_offset | We overwrite to this byte position of the record. |
PAYLOAD | primitive type of the payload. all integers and floats are allowed. |
Definition at line 523 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, foedus::storage::masstree::MasstreeStoragePimpl::increment_general(), foedus::storage::masstree::MasstreeStoragePimpl::locate_record(), and foedus::storage::masstree::normalize_be_bytes_full().
ErrorCode foedus::storage::masstree::MasstreeStorage::increment_record_normalized | ( | thread::Thread * | context, |
KeySlice | key, | ||
PAYLOAD * | value, | ||
PayloadLength | payload_offset | ||
) |
For primitive key.
Definition at line 553 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, foedus::assorted::htobe< uint64_t >(), foedus::storage::masstree::MasstreeStoragePimpl::increment_general(), and foedus::storage::masstree::MasstreeStoragePimpl::locate_record_normalized().
|
inline |
Inserts a new record of the given key in this Masstree.
[in] | context | Thread context |
[in] | key | Arbitrary length of key that is lexicographically (big-endian) evaluated. |
[in] | key_length | Byte size of key. |
[in] | payload | Value to insert. |
[in] | payload_count | Length of payload. |
If the key already exists, it returns kErrorCodeStrKeyAlreadyExists and also adds the found record to read set because it is part of transactional information.
Definition at line 252 of file masstree_storage.hpp.
Referenced by insert_record().
ErrorCode foedus::storage::masstree::MasstreeStorage::insert_record | ( | thread::Thread * | context, |
const void * | key, | ||
KeyLength | key_length, | ||
const void * | payload, | ||
PayloadLength | payload_count, | ||
PayloadLength | physical_payload_hint | ||
) |
With this method, you can also specify physical_payload_hint, the physical size of the record's payload part.
If you will later expand the payload of this record, giving a larger value will avoid record migration. Default value (and minimal value) is same as the initial payload_count.
Definition at line 247 of file masstree_storage.cpp.
References foedus::storage::masstree::adjust_payload_hint(), ASSERT_ND, CHECK_ERROR_CODE, foedus::storage::masstree::MasstreeStoragePimpl::insert_general(), insert_record_normalized(), foedus::storage::masstree::RecordLocation::is_found(), foedus::kErrorCodeStrTooLongPayload, foedus::storage::masstree::kMaxPayloadLength, foedus::storage::masstree::normalize_be_bytes_full(), foedus::storage::masstree::MasstreeStoragePimpl::reserve_record(), and UNLIKELY.
|
inline |
Inserts a new record without payload of the given key in this Masstree.
[in] | context | Thread context |
[in] | key | Arbitrary length of key that is lexicographically (big-endian) evaluated. |
[in] | key_length | Byte size of key. |
If the key already exists, it returns kErrorCodeStrKeyAlreadyExists and also adds the found record to read set because it is part of transactional information.
Definition at line 284 of file masstree_storage.hpp.
References CXX11_NULLPTR, and insert_record().
|
inline |
Inserts a new record of the given primitive key in this Masstree.
[in] | context | Thread context |
[in] | key | Primitive key that is evaluated in the primitive type's comparison rule. |
[in] | payload | Value to insert. |
[in] | payload_count | Length of payload. |
Definition at line 298 of file masstree_storage.hpp.
Referenced by insert_record(), and insert_record_normalized().
ErrorCode foedus::storage::masstree::MasstreeStorage::insert_record_normalized | ( | thread::Thread * | context, |
KeySlice | key, | ||
const void * | payload, | ||
PayloadLength | payload_count, | ||
PayloadLength | physical_payload_hint | ||
) |
With this method, you can also specify physical_payload_hint.
Definition at line 283 of file masstree_storage.cpp.
References foedus::storage::masstree::adjust_payload_hint(), ASSERT_ND, CHECK_ERROR_CODE, foedus::assorted::htobe< uint64_t >(), foedus::storage::masstree::MasstreeStoragePimpl::insert_general(), foedus::storage::masstree::RecordLocation::is_found(), foedus::kErrorCodeStrTooLongPayload, foedus::storage::masstree::kMaxPayloadLength, foedus::storage::masstree::MasstreeStoragePimpl::reserve_record_normalized(), and UNLIKELY.
|
inline |
Inserts a new record without payload of the given primitive key in this Masstree.
[in] | context | Thread context |
[in] | key | Primitive key that is evaluated in the primitive type's comparison rule. |
Definition at line 321 of file masstree_storage.hpp.
References CXX11_NULLPTR, and insert_record_normalized().
ErrorStack foedus::storage::masstree::MasstreeStorage::load | ( | const StorageControlBlock & | snapshot_block | ) |
Definition at line 66 of file masstree_storage.cpp.
References foedus::storage::masstree::MasstreeStoragePimpl::load().
MasstreeStorage & foedus::storage::masstree::MasstreeStorage::operator= | ( | const MasstreeStorage & | other | ) |
Definition at line 53 of file masstree_storage.cpp.
References foedus::Attachable< MasstreeStorageControlBlock >::control_block_, foedus::Attachable< CONTROL_BLOCK >::control_block_, foedus::Attachable< MasstreeStorageControlBlock >::engine_, and foedus::Attachable< CONTROL_BLOCK >::engine_.
ErrorCode foedus::storage::masstree::MasstreeStorage::overwrite_record | ( | thread::Thread * | context, |
const void * | key, | ||
KeyLength | key_length, | ||
const void * | payload, | ||
PayloadLength | payload_offset, | ||
PayloadLength | payload_count | ||
) |
Overwrites a part of one record of the given key in this Masstree.
[in] | context | Thread context |
[in] | key | Arbitrary length of key that is lexicographically (big-endian) evaluated. |
[in] | key_length | Byte size of key. |
[in] | payload | We copy from this buffer. Must be at least payload_count. |
[in] | payload_offset | We overwrite to this byte position of the record. |
[in] | payload_count | How many bytes we overwrite. |
When payload_offset+payload_count is larger than the actual payload, this method returns kErrorCodeStrTooShortPayload. Just like get_record(), this adds to range-lock read set even when key is not found.
Definition at line 412 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, foedus::storage::masstree::MasstreeStoragePimpl::locate_record(), foedus::storage::masstree::normalize_be_bytes_full(), foedus::storage::masstree::MasstreeStoragePimpl::overwrite_general(), and overwrite_record_normalized().
ErrorCode foedus::storage::masstree::MasstreeStorage::overwrite_record_normalized | ( | thread::Thread * | context, |
KeySlice | key, | ||
const void * | payload, | ||
PayloadLength | payload_offset, | ||
PayloadLength | payload_count | ||
) |
Overwrites a part of one record of the given primitive key in this Masstree.
[in] | context | Thread context |
[in] | key | Primitive key that is evaluated in the primitive type's comparison rule. |
[in] | payload | We copy from this buffer. Must be at least payload_count. |
[in] | payload_offset | We overwrite to this byte position of the record. |
[in] | payload_count | How many bytes we overwrite. |
Definition at line 474 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, foedus::assorted::htobe< uint64_t >(), foedus::storage::masstree::MasstreeStoragePimpl::locate_record_normalized(), and foedus::storage::masstree::MasstreeStoragePimpl::overwrite_general().
Referenced by overwrite_record().
ErrorCode foedus::storage::masstree::MasstreeStorage::overwrite_record_primitive | ( | thread::Thread * | context, |
const void * | key, | ||
KeyLength | key_length, | ||
PAYLOAD | payload, | ||
PayloadLength | payload_offset | ||
) |
Overwrites a part of one record of the given key in this Masstree as a primitive value.
[in] | context | Thread context |
[in] | key | Arbitrary length of key that is lexicographically (big-endian) evaluated. |
[in] | key_length | Byte size of key. |
[in] | payload | We copy this value. |
[in] | payload_offset | We overwrite to this byte position of the record. |
PAYLOAD | primitive type of the payload. all integers and floats are allowed. |
Definition at line 444 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, foedus::storage::masstree::MasstreeStoragePimpl::locate_record(), foedus::storage::masstree::normalize_be_bytes_full(), and foedus::storage::masstree::MasstreeStoragePimpl::overwrite_general().
ErrorCode foedus::storage::masstree::MasstreeStorage::overwrite_record_primitive_normalized | ( | thread::Thread * | context, |
KeySlice | key, | ||
PAYLOAD | payload, | ||
PayloadLength | payload_offset | ||
) |
Overwrites a part of one record of the given primitive key in this Masstree as a primitive value.
Definition at line 499 of file masstree_storage.cpp.
References CHECK_ERROR_CODE, foedus::assorted::htobe< uint64_t >(), foedus::storage::masstree::MasstreeStoragePimpl::locate_record_normalized(), and foedus::storage::masstree::MasstreeStoragePimpl::overwrite_general().
ErrorCode foedus::storage::masstree::MasstreeStorage::peek_volatile_page_boundaries | ( | Engine * | engine, |
const PeekBoundariesArguments & | args | ||
) |
Checks the volatile pages of this storage to give hints to decide page boundary keys.
This method is used from the composer to make page boundaries in snapshot pages better aligned with those of volatile pages so that we can drop more volatile pages at the end. This method is opportunistic, meaning the result is not guaranteed to be transactionally correct, but that's fine because these are just hints. If the page boundary is not aligned well with volatile pages, we just have to keep more volatile pages for a while. In fact, the composer might ignore these hints in some cases (eg. a page has too few tuples). Defined in masstree_storage_peek.cpp
Definition at line 31 of file masstree_storage_peek.cpp.
References foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries().
ErrorCode foedus::storage::masstree::MasstreeStorage::prefetch_pages_normalized | ( | thread::Thread * | context, |
bool | install_volatile, | ||
bool | cache_snapshot, | ||
KeySlice | from = kInfimumSlice , |
||
KeySlice | to = kSupremumSlice |
||
) |
Prefetch data pages in this storage.
Key Slice version (from/to are 8 bytes or less).
[in] | context | Thread context. |
[in] | install_volatile | Whether to install/prefetch volatile pages based on the recent snapshot page if there is none. |
[in] | cache_snapshot | Whether to cache/prefetch snapshot pages if exists. |
[in] | from | inclusive begin slice of records that are specifically prefetched even in data pages. |
[in] | to | inclusive end slice of records that are specifically prefetched even in data pages. |
This is to warmup the storage for the current core. Data pages are prefetched within from/to. So far prefetches only volatile pages, but it will also cache and prefetch snapshot pages.
Definition at line 590 of file masstree_storage.cpp.
References foedus::storage::masstree::MasstreeStoragePimpl::prefetch_pages_normalized().
xct::TrackMovedRecordResult foedus::storage::masstree::MasstreeStorage::track_moved_record | ( | xct::RwLockableXctId * | old_address, |
xct::WriteXctAccess * | write_set | ||
) |
Resolves a "moved" record.
This is the core of the moved-bit protocol. Receiving a xct_id address that points to a moved record, track the physical record in another page. This method does not take lock, so it is possible that concurrent threads again move the record after this. The only case it fails to track is the record moved to deeper layers. If the write-set is supplied, we use the key information in it to track even in that case.
In the new_mpage git branch, we significantly changed the page layout in this package. One purpose was to allow tracking the moved record in all circumstances.
When the record is moved within the same B-trie layer, it is anyway easy to track down the new location. When the record is moved to next layer, however, we have to know the entire key to track the record. Previous page layout didn't allow it unless we have the write_set. When there is a standalone read-access, we could not track to next layer.
The new page layout always leaves the original key of the record in page, thus the issue completely went away. This also simplified concurrency control in this package. See Remainder vs Remaining Key.
However, this came with the price of wasted space in page. To ameliorate it, we made a few improvements to reduce wasted space.
Thanks to these improvements, we now allow more records, not less, in a page. Previously it was 64, but now kBorderPageMaxSlots is 100 for 4kb pages.
Definition at line 842 of file masstree_storage_pimpl.cpp.
References foedus::storage::masstree::MasstreeStoragePimpl::track_moved_record().
Referenced by foedus::storage::StorageManagerPimpl::track_moved_record().
|
inline |
Inserts a new record of the given key or replaces the existing one, or so-called upsert.
[in] | context | Thread context |
[in] | key | Arbitrary length of key that is lexicographically (big-endian) evaluated. |
[in] | key_length | Byte size of key. |
[in] | payload | Value to upsert. |
[in] | payload_count | Length of payload. |
This method puts the record whether the key already exists or not, which is handy in many usecases. Internally, the Implementation comes with a bit of complexity. If there is an existing record of the key (whether logically deleted or not) that is spacious enough, then we simply replace the record. If the key doesn't exist or the existing record is no big enough, we create/migrate the record in a system transaction then install the record.
Definition at line 363 of file masstree_storage.hpp.
Referenced by upsert_record().
ErrorCode foedus::storage::masstree::MasstreeStorage::upsert_record | ( | thread::Thread * | context, |
const void * | key, | ||
KeyLength | key_length, | ||
const void * | payload, | ||
PayloadLength | payload_count, | ||
PayloadLength | physical_payload_hint | ||
) |
With this method, you can also specify physical_payload_hint, the physical size of the record's payload part.
If you will later expand the payload of this record, giving a larger value will avoid record migration. Default value (and minimal value) is same as the initial payload_count.
Definition at line 347 of file masstree_storage.cpp.
References foedus::storage::masstree::adjust_payload_hint(), ASSERT_ND, CHECK_ERROR_CODE, foedus::storage::masstree::RecordLocation::is_found(), foedus::kErrorCodeStrTooLongPayload, foedus::storage::masstree::kMaxPayloadLength, foedus::storage::masstree::normalize_be_bytes_full(), foedus::storage::masstree::MasstreeStoragePimpl::reserve_record(), UNLIKELY, foedus::storage::masstree::MasstreeStoragePimpl::upsert_general(), and upsert_record_normalized().
|
inline |
Upserts a new record without payload of the given key in this Masstree.
[in] | context | Thread context |
[in] | key | Arbitrary length of key that is lexicographically (big-endian) evaluated. |
[in] | key_length | Byte size of key. |
Definition at line 392 of file masstree_storage.hpp.
References CXX11_NULLPTR, and upsert_record().
|
inline |
Upserts a new record of the given primitive key in this Masstree.
[in] | context | Thread context |
[in] | key | Primitive key that is evaluated in the primitive type's comparison rule. |
[in] | payload | Value to upsert. |
[in] | payload_count | Length of payload. |
Definition at line 406 of file masstree_storage.hpp.
Referenced by upsert_record(), and upsert_record_normalized().
ErrorCode foedus::storage::masstree::MasstreeStorage::upsert_record_normalized | ( | thread::Thread * | context, |
KeySlice | key, | ||
const void * | payload, | ||
PayloadLength | payload_count, | ||
PayloadLength | physical_payload_hint | ||
) |
With this method, you can also specify physical_payload_hint.
Definition at line 383 of file masstree_storage.cpp.
References foedus::storage::masstree::adjust_payload_hint(), ASSERT_ND, CHECK_ERROR_CODE, foedus::assorted::htobe< uint64_t >(), foedus::storage::masstree::RecordLocation::is_found(), foedus::kErrorCodeStrTooLongPayload, foedus::storage::masstree::kMaxPayloadLength, foedus::storage::masstree::MasstreeStoragePimpl::reserve_record_normalized(), UNLIKELY, and foedus::storage::masstree::MasstreeStoragePimpl::upsert_general().
|
inline |
Upserts a new record without payload of the given primitive key in this Masstree.
[in] | context | Thread context |
[in] | key | Primitive key that is evaluated in the primitive type's comparison rule. |
Definition at line 429 of file masstree_storage.hpp.
References CXX11_NULLPTR, and upsert_record_normalized().
ErrorStack foedus::storage::masstree::MasstreeStorage::verify_single_thread | ( | thread::Thread * | context | ) |
Definition at line 575 of file masstree_storage.cpp.
References foedus::storage::masstree::MasstreeStoragePimpl::verify_single_thread().
|
friend |
Definition at line 71 of file masstree_storage.cpp.