libfoedus-core
FOEDUS Core Library
|
Represents a key-value store based on a dense and regular hash. More...
Represents a key-value store based on a dense and regular hash.
Definition at line 43 of file hash_storage.hpp.
#include <hash_storage.hpp>
Public Types | |
typedef HashStoragePimpl | ThisPimpl |
typedef HashCreateLogType | ThisCreateLogType |
typedef HashMetadata | ThisMetadata |
Public Member Functions | |
HashStorage () | |
HashStorage (Engine *engine, HashStorageControlBlock *control_block) | |
HashStorage (Engine *engine, StorageControlBlock *control_block) | |
HashStorage (Engine *engine, StorageId id) | |
HashStorage (Engine *engine, const StorageName &name) | |
HashStorage (const HashStorage &other) | |
HashStorage & | operator= (const HashStorage &other) |
const HashMetadata * | get_hash_metadata () const |
uint8_t | get_levels () const |
HashBin | get_bin_count () const |
uint8_t | get_bin_bits () const |
uint8_t | get_bin_shifts () const |
uint16_t | get_root_children () const |
ErrorStack | create (const Metadata &metadata) |
ErrorStack | load (const StorageControlBlock &snapshot_block) |
ErrorStack | drop () |
xct::TrackMovedRecordResult | track_moved_record (xct::RwLockableXctId *old_address, xct::WriteXctAccess *write_set) |
Resolves a "moved" record. More... | |
ErrorStack | verify_single_thread (Engine *engine) |
ErrorStack | verify_single_thread (thread::Thread *context) |
ErrorStack | hcc_reset_all_temperature_stat () |
Resets all volatile pages' temperature stat to be zero in this storage. More... | |
ErrorStack | debugout_single_thread (Engine *engine, bool volatile_only=false, bool intermediate_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 hash storage in details. More... | |
HashCombo | combo (const void *key, uint16_t key_length) const |
Prepares a set of information that are used in many places, extracted from the given key. More... | |
template<typename KEY > | |
HashCombo | combo (KEY *key) const |
Overlord to receive key as a primitive type. More... | |
ErrorCode | get_record (thread::Thread *context, const void *key, uint16_t key_length, void *payload, uint16_t *payload_capacity, bool read_only) |
Retrieves an entire payload of the given key in this hash storage. More... | |
template<typename KEY > | |
ErrorCode | get_record (thread::Thread *context, KEY key, void *payload, uint16_t *payload_capacity, bool read_only) |
Overlord to receive key as a primitive type. More... | |
ErrorCode | get_record (thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, void *payload, uint16_t *payload_capacity, bool read_only) |
If you have already computed HashCombo, use this. More... | |
ErrorCode | get_record_part (thread::Thread *context, const void *key, uint16_t key_length, void *payload, uint16_t payload_offset, uint16_t payload_count, bool read_only) |
Retrieves a part of the given key in this hash storage. More... | |
template<typename KEY > | |
ErrorCode | get_record_part (thread::Thread *context, KEY key, void *payload, uint16_t payload_offset, uint16_t payload_count, bool read_only) |
Overlord to receive key as a primitive type. More... | |
ErrorCode | get_record_part (thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, void *payload, uint16_t payload_offset, uint16_t payload_count, bool read_only) |
If you have already computed HashCombo, use this. More... | |
template<typename PAYLOAD > | |
ErrorCode | get_record_primitive (thread::Thread *context, const void *key, uint16_t key_length, PAYLOAD *payload, uint16_t payload_offset, bool read_only) |
Retrieves a part of the given key in this storage as a primitive value. More... | |
template<typename KEY , typename PAYLOAD > | |
ErrorCode | get_record_primitive (thread::Thread *context, KEY key, PAYLOAD *payload, uint16_t payload_offset, bool read_only) |
Overlord to receive key as a primitive type. More... | |
template<typename PAYLOAD > | |
ErrorCode | get_record_primitive (thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, PAYLOAD *payload, uint16_t payload_offset, bool read_only) |
If you have already computed HashCombo, use this. More... | |
ErrorCode | insert_record (thread::Thread *context, const void *key, uint16_t key_length, const void *payload, uint16_t payload_count) |
Inserts a new record of the given key in this hash storage. More... | |
template<typename KEY > | |
ErrorCode | insert_record (thread::Thread *context, KEY key, const void *payload, uint16_t payload_count) |
Overlord to receive key as a primitive type. More... | |
ErrorCode | insert_record (thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, const void *payload, uint16_t payload_count, uint16_t physical_payload_hint) |
If you have already computed HashCombo, use this. More... | |
ErrorCode | delete_record (thread::Thread *context, const void *key, uint16_t key_length) |
Deletes a record of the given key from this hash storage. More... | |
template<typename KEY > | |
ErrorCode | delete_record (thread::Thread *context, KEY key) |
Overlord to receive key as a primitive type. More... | |
ErrorCode | delete_record (thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo) |
If you have already computed HashCombo, use this. More... | |
ErrorCode | upsert_record (thread::Thread *context, const void *key, uint16_t key_length, const void *payload, uint16_t payload_count) |
Inserts a new record of the given key or replaces the existing one in this hash storage, or so-called upsert. More... | |
template<typename KEY > | |
ErrorCode | upsert_record (thread::Thread *context, KEY key, const void *payload, uint16_t payload_count) |
Overlord to receive key as a primitive type. More... | |
ErrorCode | upsert_record (thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, const void *payload, uint16_t payload_count, uint16_t physical_payload_hint) |
If you have already computed HashCombo, use this. More... | |
ErrorCode | overwrite_record (thread::Thread *context, const void *key, uint16_t key_length, const void *payload, uint16_t payload_offset, uint16_t payload_count) |
Overwrites a part of one record of the given key in this hash storage. More... | |
template<typename KEY > | |
ErrorCode | overwrite_record (thread::Thread *context, KEY key, const void *payload, uint16_t payload_offset, uint16_t payload_count) |
Overlord to receive key as a primitive type. More... | |
ErrorCode | overwrite_record (thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, const void *payload, uint16_t payload_offset, uint16_t payload_count) |
If you have already computed HashCombo, use this. More... | |
template<typename PAYLOAD > | |
ErrorCode | overwrite_record_primitive (thread::Thread *context, const void *key, uint16_t key_length, PAYLOAD payload, uint16_t payload_offset) |
Overwrites a part of one record of the given key in this storage as a primitive value. More... | |
template<typename KEY , typename PAYLOAD > | |
ErrorCode | overwrite_record_primitive (thread::Thread *context, KEY key, PAYLOAD payload, uint16_t payload_offset) |
Overlord to receive key as a primitive type. More... | |
template<typename PAYLOAD > | |
ErrorCode | overwrite_record_primitive (thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, PAYLOAD payload, uint16_t payload_offset) |
If you have already computed HashCombo, use this. More... | |
template<typename PAYLOAD > | |
ErrorCode | increment_record (thread::Thread *context, const void *key, uint16_t key_length, PAYLOAD *value, uint16_t payload_offset) |
This one further optimizes overwrite methods for the frequent use case of incrementing some data in primitive type. More... | |
template<typename KEY , typename PAYLOAD > | |
ErrorCode | increment_record (thread::Thread *context, KEY key, PAYLOAD *value, uint16_t payload_offset) |
Overlord to receive key as a primitive type. More... | |
template<typename PAYLOAD > | |
ErrorCode | increment_record (thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, PAYLOAD *value, uint16_t payload_offset) |
If you have already computed HashCombo, use this. More... | |
![]() | |
Storage () | |
Storage (Engine *engine, HashStorageControlBlock *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, HashStorageControlBlock *control_block) | |
Attachable (HashStorageControlBlock *control_block) | |
Attachable (const Attachable &other) | |
virtual | ~Attachable () |
Attachable & | operator= (const Attachable &other) |
virtual void | attach (HashStorageControlBlock *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... | |
HashStorageControlBlock * | get_control_block () const |
Engine * | get_engine () const |
void | set_engine (Engine *engine) |
Friends | |
std::ostream & | operator<< (std::ostream &o, const HashStorage &v) |
Additional Inherited Members | |
![]() | |
Engine * | engine_ |
Most attachable object stores an engine pointer (local engine), so we define it here. More... | |
HashStorageControlBlock * | 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 hash_storage.hpp.
Definition at line 47 of file hash_storage.hpp.
Definition at line 45 of file hash_storage.hpp.
foedus::storage::hash::HashStorage::HashStorage | ( | ) |
Definition at line 37 of file hash_storage.cpp.
foedus::storage::hash::HashStorage::HashStorage | ( | Engine * | engine, |
HashStorageControlBlock * | control_block | ||
) |
Definition at line 38 of file hash_storage.cpp.
References ASSERT_ND, foedus::storage::Storage< HashStorageControlBlock >::exists(), foedus::storage::Storage< HashStorageControlBlock >::get_type(), and foedus::storage::kHashStorage.
foedus::storage::hash::HashStorage::HashStorage | ( | Engine * | engine, |
StorageControlBlock * | control_block | ||
) |
Definition at line 42 of file hash_storage.cpp.
References ASSERT_ND, foedus::storage::Storage< HashStorageControlBlock >::exists(), foedus::storage::Storage< HashStorageControlBlock >::get_type(), and foedus::storage::kHashStorage.
Definition at line 46 of file hash_storage.cpp.
foedus::storage::hash::HashStorage::HashStorage | ( | Engine * | engine, |
const StorageName & | name | ||
) |
Definition at line 48 of file hash_storage.cpp.
foedus::storage::hash::HashStorage::HashStorage | ( | const HashStorage & | other | ) |
Definition at line 50 of file hash_storage.cpp.
|
inline |
Prepares a set of information that are used in many places, extracted from the given key.
Definition at line 120 of file hash_storage.hpp.
References get_hash_metadata().
Referenced by delete_record(), get_record(), get_record_part(), get_record_primitive(), increment_record(), insert_record(), overwrite_record(), overwrite_record_primitive(), and upsert_record().
|
inline |
Overlord to receive key as a primitive type.
Definition at line 130 of file hash_storage.hpp.
References get_hash_metadata().
ErrorStack foedus::storage::hash::HashStorage::create | ( | const Metadata & | metadata | ) |
Definition at line 65 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::create().
ErrorStack foedus::storage::hash::HashStorage::debugout_single_thread | ( | Engine * | engine, |
bool | volatile_only = false , |
||
bool | intermediate_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 hash storage in details.
Do not invoke this method for more than 100 pages, or in production use. This is for debugging.
Definition at line 279 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::debugout_single_thread().
|
inline |
Deletes a record of the given key from this hash storage.
[in] | context | Thread context |
[in] | key | Arbitrary length of key. |
[in] | key_length | Byte size of key. |
When the key does not exist, it returns kErrorCodeStrKeyNotFound and we add an appropriate page-version set because it is part of a transactional information.
Definition at line 375 of file hash_storage.hpp.
References combo().
Referenced by delete_record().
|
inline |
Overlord to receive key as a primitive type.
Definition at line 382 of file hash_storage.hpp.
References delete_record().
ErrorCode foedus::storage::hash::HashStorage::delete_record | ( | thread::Thread * | context, |
const void * | key, | ||
uint16_t | key_length, | ||
const HashCombo & | combo | ||
) |
If you have already computed HashCombo, use this.
Definition at line 179 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::delete_record().
ErrorStack foedus::storage::hash::HashStorage::drop | ( | ) |
Definition at line 73 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::drop().
uint8_t foedus::storage::hash::HashStorage::get_bin_bits | ( | ) | const |
Definition at line 61 of file hash_storage.cpp.
References foedus::Attachable< HashStorageControlBlock >::control_block_.
Referenced by foedus::storage::hash::HashPartitioner::design_partition().
HashBin foedus::storage::hash::HashStorage::get_bin_count | ( | ) | const |
Definition at line 60 of file hash_storage.cpp.
References foedus::Attachable< HashStorageControlBlock >::control_block_.
Referenced by foedus::storage::hash::HashPartitioner::design_partition(), foedus::storage::hash::HashComposeContext::execute(), and foedus::storage::hash::HashPartitioner::partition_batch().
uint8_t foedus::storage::hash::HashStorage::get_bin_shifts | ( | ) | const |
Definition at line 62 of file hash_storage.cpp.
References foedus::Attachable< HashStorageControlBlock >::control_block_.
Referenced by foedus::storage::hash::HashPartitioner::design_partition(), foedus::storage::hash::hash_data_volatile_page_init(), and foedus::storage::hash::HashPartitioner::partition_batch().
const HashMetadata * foedus::storage::hash::HashStorage::get_hash_metadata | ( | ) | const |
Definition at line 78 of file hash_storage.cpp.
References foedus::Attachable< HashStorageControlBlock >::control_block_.
Referenced by combo(), foedus::storage::hash::HashComposer::drop_root_volatile(), and foedus::storage::hash::HashComposer::drop_volatiles().
uint8_t foedus::storage::hash::HashStorage::get_levels | ( | ) | const |
Definition at line 59 of file hash_storage.cpp.
References foedus::Attachable< HashStorageControlBlock >::control_block_.
Referenced by foedus::storage::hash::HashComposer::construct_root(), foedus::storage::hash::HashPartitioner::design_partition(), foedus::storage::hash::HashPartitioner::design_partition_task(), foedus::storage::hash::HashComposer::drop_root_volatile(), and foedus::storage::hash::HashComposer::drop_volatiles().
|
inline |
Retrieves an entire payload of the given key in this hash storage.
[in] | context | Thread context |
[in] | key | Arbitrary length of key. |
[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 add an appropriate page-version set because it is part of a transactional information.
Definition at line 154 of file hash_storage.hpp.
References combo().
Referenced by get_record().
|
inline |
Overlord to receive key as a primitive type.
Definition at line 167 of file hash_storage.hpp.
References get_record().
ErrorCode foedus::storage::hash::HashStorage::get_record | ( | thread::Thread * | context, |
const void * | key, | ||
uint16_t | key_length, | ||
const HashCombo & | combo, | ||
void * | payload, | ||
uint16_t * | payload_capacity, | ||
bool | read_only | ||
) |
If you have already computed HashCombo, use this.
Definition at line 80 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::get_record().
|
inline |
Retrieves a part of the given key in this hash storage.
[in] | context | Thread context |
[in] | key | Arbitrary length of key. |
[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 200 of file hash_storage.hpp.
References combo().
Referenced by get_record_part().
|
inline |
Overlord to receive key as a primitive type.
Definition at line 222 of file hash_storage.hpp.
References get_record_part().
ErrorCode foedus::storage::hash::HashStorage::get_record_part | ( | thread::Thread * | context, |
const void * | key, | ||
uint16_t | key_length, | ||
const HashCombo & | combo, | ||
void * | payload, | ||
uint16_t | payload_offset, | ||
uint16_t | payload_count, | ||
bool | read_only | ||
) |
If you have already computed HashCombo, use this.
Definition at line 99 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::get_record_part().
|
inline |
Retrieves a part of the given key in this storage as a primitive value.
[in] | context | Thread context |
[in] | key | Arbitrary length of key. |
[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 266 of file hash_storage.hpp.
References combo().
|
inline |
Overlord to receive key as a primitive type.
Definition at line 286 of file hash_storage.hpp.
ErrorCode foedus::storage::hash::HashStorage::get_record_primitive | ( | thread::Thread * | context, |
const void * | key, | ||
uint16_t | key_length, | ||
const HashCombo & | combo, | ||
PAYLOAD * | payload, | ||
uint16_t | payload_offset, | ||
bool | read_only | ||
) |
If you have already computed HashCombo, use this.
Definition at line 121 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::get_record_primitive().
uint16_t foedus::storage::hash::HashStorage::get_root_children | ( | ) | const |
Definition at line 63 of file hash_storage.cpp.
References foedus::Attachable< HashStorageControlBlock >::control_block_.
Referenced by foedus::storage::hash::HashComposer::drop_volatiles().
ErrorStack foedus::storage::hash::HashStorage::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 273 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::hcc_reset_all_temperature_stat().
|
inline |
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. |
[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 557 of file hash_storage.hpp.
References combo().
Referenced by increment_record().
|
inline |
Overlord to receive key as a primitive type.
Definition at line 569 of file hash_storage.hpp.
References increment_record().
ErrorCode foedus::storage::hash::HashStorage::increment_record | ( | thread::Thread * | context, |
const void * | key, | ||
uint16_t | key_length, | ||
const HashCombo & | combo, | ||
PAYLOAD * | value, | ||
uint16_t | payload_offset | ||
) |
If you have already computed HashCombo, use this.
Definition at line 230 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::increment_record().
|
inline |
Inserts a new record of the given key in this hash storage.
[in] | context | Thread context |
[in] | key | Arbitrary length of key. |
[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 we add an appropriate page-version set because it is part of a transactional information.
Definition at line 327 of file hash_storage.hpp.
References combo().
Referenced by insert_record().
|
inline |
Overlord to receive key as a primitive type.
Definition at line 339 of file hash_storage.hpp.
References insert_record().
ErrorCode foedus::storage::hash::HashStorage::insert_record | ( | thread::Thread * | context, |
const void * | key, | ||
uint16_t | key_length, | ||
const HashCombo & | combo, | ||
const void * | payload, | ||
uint16_t | payload_count, | ||
uint16_t | physical_payload_hint | ||
) |
If you have already computed HashCombo, use this.
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 140 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::insert_record().
ErrorStack foedus::storage::hash::HashStorage::load | ( | const StorageControlBlock & | snapshot_block | ) |
Definition at line 69 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::load().
HashStorage & foedus::storage::hash::HashStorage::operator= | ( | const HashStorage & | other | ) |
Definition at line 53 of file hash_storage.cpp.
References foedus::Attachable< HashStorageControlBlock >::control_block_, foedus::Attachable< CONTROL_BLOCK >::control_block_, foedus::Attachable< HashStorageControlBlock >::engine_, and foedus::Attachable< CONTROL_BLOCK >::engine_.
|
inline |
Overwrites a part of one record of the given key in this hash storage.
[in] | context | Thread context |
[in] | key | Arbitrary length of key. |
[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 others, when the key does not exist, it returns kErrorCodeStrKeyNotFound and we add an appropriate page-version set because it is part of a transactional information.
Definition at line 459 of file hash_storage.hpp.
References combo().
Referenced by overwrite_record().
|
inline |
Overlord to receive key as a primitive type.
Definition at line 479 of file hash_storage.hpp.
References overwrite_record().
ErrorCode foedus::storage::hash::HashStorage::overwrite_record | ( | thread::Thread * | context, |
const void * | key, | ||
uint16_t | key_length, | ||
const HashCombo & | combo, | ||
const void * | payload, | ||
uint16_t | payload_offset, | ||
uint16_t | payload_count | ||
) |
If you have already computed HashCombo, use this.
Definition at line 192 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::overwrite_record().
|
inline |
Overwrites a part of one record of the given key in this storage as a primitive value.
[in] | context | Thread context |
[in] | key | Arbitrary length of key. |
[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 511 of file hash_storage.hpp.
References combo().
Referenced by overwrite_record_primitive().
|
inline |
Overlord to receive key as a primitive type.
Definition at line 523 of file hash_storage.hpp.
References overwrite_record_primitive().
ErrorCode foedus::storage::hash::HashStorage::overwrite_record_primitive | ( | thread::Thread * | context, |
const void * | key, | ||
uint16_t | key_length, | ||
const HashCombo & | combo, | ||
PAYLOAD | payload, | ||
uint16_t | payload_offset | ||
) |
If you have already computed HashCombo, use this.
Definition at line 212 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::overwrite_record_primitive().
xct::TrackMovedRecordResult foedus::storage::hash::HashStorage::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.
When we migrate records for expansion, we only move it to a later position, either a larger slot index in the same page or somewhere in next-page linked-list. Further, we keep the full key in the original place. So, tracking the moved record is fairly simple and efficient. Also, no chance of cannot-track case.
Definition at line 256 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::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 in this hash storage, or so-called upsert.
[in] | context | Thread context |
[in] | key | Arbitrary length of key. |
[in] | key_length | Byte size of key. |
[in] | payload | Value to insert. |
[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 412 of file hash_storage.hpp.
References combo().
Referenced by upsert_record().
|
inline |
Overlord to receive key as a primitive type.
Definition at line 424 of file hash_storage.hpp.
References upsert_record().
ErrorCode foedus::storage::hash::HashStorage::upsert_record | ( | thread::Thread * | context, |
const void * | key, | ||
uint16_t | key_length, | ||
const HashCombo & | combo, | ||
const void * | payload, | ||
uint16_t | payload_count, | ||
uint16_t | physical_payload_hint | ||
) |
If you have already computed HashCombo, use this.
Definition at line 159 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::upsert_record().
ErrorStack foedus::storage::hash::HashStorage::verify_single_thread | ( | Engine * | engine | ) |
Definition at line 263 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::verify_single_thread().
ErrorStack foedus::storage::hash::HashStorage::verify_single_thread | ( | thread::Thread * | context | ) |
Definition at line 268 of file hash_storage.cpp.
References foedus::storage::hash::HashStoragePimpl::verify_single_thread().
|
friend |
Definition at line 247 of file hash_storage.cpp.