18 #ifndef FOEDUS_STORAGE_HASH_HASH_STORAGE_PIMPL_HPP_
19 #define FOEDUS_STORAGE_HASH_HASH_STORAGE_PIMPL_HPP_
140 bool intermediate_only,
146 bool follow_volatile,
147 bool intermediate_only,
148 uint32_t* remaining_pages);
153 bool follow_volatile,
154 uint32_t* remaining_pages);
176 uint16_t* payload_capacity,
180 template <
typename PAYLOAD>
187 uint16_t payload_offset,
209 uint16_t payload_offset,
210 uint16_t payload_count,
227 uint16_t payload_count,
228 uint16_t physical_payload_hint);
244 uint16_t payload_count,
245 uint16_t physical_payload_hint);
254 uint16_t payload_offset,
255 uint16_t payload_count);
258 template <
typename PAYLOAD>
265 uint16_t payload_offset) {
278 template <
typename PAYLOAD>
285 uint16_t payload_offset);
299 uint16_t index_in_parent,
306 uint16_t index_in_parent,
368 bool create_if_notfound,
369 uint16_t create_payload_length,
380 bool create_if_notfound,
381 uint16_t create_payload_length,
392 create_payload_length,
403 bool create_if_notfound,
404 uint16_t create_payload_length,
415 create_payload_length,
453 uint16_t payload_length,
455 uint16_t examined_records,
458 static_assert(
sizeof(HashStoragePimpl) <=
kPageSize,
"HashStoragePimpl is too large");
461 "HashStorageControlBlock is too large.");
465 #endif // FOEDUS_STORAGE_HASH_HASH_STORAGE_PIMPL_HPP_
ErrorCode increment_record(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, PAYLOAD *value, uint16_t payload_offset)
ErrorCode locate_record_physical_only(thread::Thread *context, bool for_write, bool create_if_notfound, uint16_t create_payload_length, const void *key, uint16_t key_length, const HashCombo &combo, HashDataPage *bin_head, RecordLocation *result)
locate_record()'s physical_only version.
uint8_t levels_
Number of levels of pages.
Represents a pointer to another page (usually a child page).
ErrorStack debugout_single_thread(Engine *engine, bool volatile_only, bool intermediate_only, uint32_t max_pages)
These are defined in hash_storage_debug.cpp.
The storage has been marked for drop and can't be used.
Definitions of IDs in this package and a few related constant values.
StorageStatus status_
Status of the storage.
uint32_t StorageId
Unique ID for storage.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Represents a record of write-access during a transaction.
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)
Represents one thread running on one NUMA core.
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)
uint8_t get_bin_shifts() const
HashStoragePimpl(HashStorage *storage)
ErrorCode locate_record_logical(thread::Thread *context, bool for_write, bool create_if_notfound, uint16_t create_payload_length, const void *key, uint16_t key_length, const HashCombo &combo, HashDataPage *bin_head, RecordLocation *result)
locate_record()'s logical+physical version.
Forward declarations of classes in transaction package.
Result of track_moved_record().
Represents a pointer to a volatile page with modification count for preventing ABA.
ErrorCode follow_page_bin_head(thread::Thread *context, bool for_write, HashIntermediatePage *parent, uint16_t index_in_parent, Page **page)
subroutine to follow a pointer to head of bin from a volatile parent
ErrorCode get_root_page(thread::Thread *context, bool for_write, HashIntermediatePage **root)
Retrieves the root page of this storage.
Forward declarations of classes in root package.
ErrorCode follow_page(thread::Thread *context, bool for_write, HashIntermediatePage *parent, uint16_t index_in_parent, Page **page)
for non-root
Brings error stacktrace information as return value of functions.
ErrorStack hcc_reset_all_temperature_stat()
For stupid reasons (I'm lazy!) these are defined in _debug.cpp.
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)
HashStorageControlBlock()=delete
The storage has been created and ready for use.
Holds a set of read-only file objects for snapshot files.
ErrorCode locate_record_reserve_physical(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, uint16_t payload_length, HashDataPage **page_in_out, uint16_t examined_records, DataPageSlotIndex *new_location)
Subroutine of locate_record() to create/migrate a physical record of the given key in the page or its...
const StorageName & get_name() const
void release_pages_recursive_data(memory::PageReleaseBatch *batch, HashDataPage *page, VolatilePagePointer volatile_page_id)
Forward declarations of classes in cache package.
soc::SharedMutex status_mutex_
HashBin get_bin_count() const
A mutex that can be placed in shared memory and used from multiple processes.
ErrorStack hcc_reset_all_temperature_stat_intermediate(VolatilePagePointer intermediate_page_id)
ErrorStack create(const HashMetadata &metadata)
The MCS reader-writer lock variant of LockableXctId.
uint8_t get_levels() const
const HashMetadata & get_meta() const
Pimpl object of HashStorage.
ErrorStack verify_single_thread(Engine *engine)
These are defined in hash_storage_verify.cpp.
ErrorStack debugout_single_thread_data(Engine *engine, cache::SnapshotFileSet *fileset, HashDataPage *head, bool follow_volatile, uint32_t *remaining_pages)
Forward declarations of classes in storage package.
HashStorageControlBlock * control_block_
The shared data on shared memory that has been initialized in some SOC or master engine.
Database engine object that holds all resources and provides APIs.
ErrorStack verify_single_thread_data(Engine *engine, HashDataPage *head)
~HashStorageControlBlock()=delete
ErrorStack load(const StorageControlBlock &snapshot_block)
Just a marker to denote that the memory region represents a data page.
Engine * get_engine() const
Shared data of this storage type.
ErrorCode locate_bin(thread::Thread *context, bool for_write, const HashCombo &combo, HashDataPage **bin_head)
Find a pointer to the bin that contains records for the hash.
uint16_t DataPageSlotIndex
xct::TrackMovedRecordResult track_moved_record(xct::RwLockableXctId *old_address, xct::WriteXctAccess *write_set)
uint8_t get_bin_bits() const
A set of information that are used in many places, extracted from the given key.
void release_pages_recursive_root(memory::PageReleaseBatch *batch, HashIntermediatePage *page, VolatilePagePointer volatile_page_id)
Used only from uninitialize()
Attachable Resources on Shared Memory.
ErrorStack hcc_reset_all_temperature_stat_data(VolatilePagePointer head_page_id)
Represents a key-value store based on a dense and regular hash.
Forward declarations of classes in memory package.
ErrorCode locate_record(thread::Thread *context, bool for_write, bool physical_only, bool create_if_notfound, uint16_t create_payload_length, const void *key, uint16_t key_length, const HashCombo &combo, HashDataPage *bin_head, RecordLocation *result)
Usually follows locate_bin to locate the exact physical record for the key, or create a new one if no...
ErrorStack debugout_single_thread_intermediate(Engine *engine, cache::SnapshotFileSet *fileset, HashIntermediatePage *parent, bool follow_volatile, bool intermediate_only, uint32_t *remaining_pages)
Represents an intermediate page in Hashtable Storage.
ErrorCode register_record_write_log(thread::Thread *context, const RecordLocation &location, log::RecordLogType *log_entry)
Used in the following methods.
ErrorStack verify_single_thread_intermediate(Engine *engine, HashIntermediatePage *page)
void release_pages_recursive_intermediate(memory::PageReleaseBatch *batch, HashIntermediatePage *page, VolatilePagePointer volatile_page_id)
DualPagePointer root_page_pointer_
Points to the root page (or something equivalent).
uint64_t HashBin
Represents a bin of a hash value.
Represents an individual data page in Hashtable Storage.
uint64_t bin_count_
How many hash bins this storage has.
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)
return value of locate_record().
int64_t int_div_ceil(int64_t dividee, int64_t dividor)
Efficient ceil(dividee/dividor) for integer.
HashMetadata meta_
metadata of this storage.
const uint64_t kHashMaxBins[]
kHashTotalBins[n] gives the maximum number of hash bins n-level hash can hold.
Base class for log type of record-wise operation.
Definitions of IDs in this package and a few related constant values.
Forward declarations of classes in thread package.
A base layout of shared data for all storage types.
HashStorageControlBlock * get_control_block() const
const uint16_t kPageSize
A constant defining the page size (in bytes) of both snapshot pages and volatile pages.
ErrorCode delete_record(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo)
ErrorCode
Enum of error codes defined in error_code.xmacro.
ErrorCode overwrite_record_primitive(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, PAYLOAD payload, uint16_t payload_offset)
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)
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)
Forward declarations of classes in hash storage package.
uint16_t get_root_children() const
ErrorCode locate_record_in_snapshot(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, HashDataPage *bin_head, RecordLocation *result)
Simpler version of locate_record for when we are in snapshot world.
StorageStatus
Status of a storage.
xct::TrackMovedRecordResult track_moved_record_search(HashDataPage *page, const void *key, uint16_t key_length, const HashCombo &combo)