20 #include <glog/logging.h>
48 bin_range_.
begin_ = start_bin;
65 bin_range_.
begin_ = start_bin;
120 for (uint16_t i = 0; i < check_from; ++i) {
134 if (!bloom_filter_.
contains(fingerprint)) {
139 for (uint16_t i = check_from; i < record_count; ++i) {
150 DVLOG(1) <<
"Hash matched, but the record was moved";
155 if (s.
key_length_ == key_length && std::memcmp(data, key, key_length) == 0) {
159 DLOG(INFO) <<
"Hash matched, but key didn't match. interesting. hash="
166 DVLOG(0) <<
"Nope, bloom filter contained it, but key not found in this page. false positive";
175 uint16_t payload_length) {
186 std::memcpy(record, key, key_length);
187 if (key_length % 8 != 0) {
188 std::memset(record + key_length, 0, 8 - (key_length % 8));
202 bloom_filter_.
add(fingerprint);
224 parent->assert_range();
226 HashBin parent_begin = parent->get_bin_range().begin_;
228 uint8_t level = parent->get_level() - 1U;
268 release_batch.release_all();
282 std::vector<std::thread> threads;
290 for (
auto& t : threads) {
uint8_t get_bin_shifts() const
T align8(T value)
8-alignment.
The first epoch (before wrap-around) that might have transactions is ep-3.
uint16_t next_offset() const
Returns offset of a next record.
void set_deleted() __attribute__((always_inline))
Page pool for volatile read/write store (VolatilePage) and the read-only bufferpool (SnapshotPage)...
uint32_t StorageId
Unique ID for storage.
const HashBinRange & get_bin_range() const
xct::RwLockableXctId tid_
TID of the record.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
uint16_t payload_length_
Byte length of the payload.
const GlobalVolatilePageResolver & get_global_volatile_page_resolver() const
Returns the page resolver to convert volatile page ID to page pointer.
PageType
The following 1-byte value is stored in the common page header.
const DataPageSlotIndex kSlotNotFound
void release_one(PagePoolOffset offset)
Returns only one page.
Represents a pointer to a volatile page with modification count for preventing ABA.
bool contains(const BloomFilterFingerprint &fingerprint) const __attribute__((always_inline))
Persistent status part of Transaction ID.
XctId xct_id_
the second 64bit: Persistent status part of TID.
DataPageSlotIndex reserve_record(HashValue hash, const BloomFilterFingerprint &fingerprint, const void *key, uint16_t key_length, uint16_t payload_length)
A system transaction that creates a logically deleted record in this page for the given key...
void initialize_snapshot_page(StorageId storage_id, SnapshotPagePointer page_id, HashBin bin, uint8_t bin_bits, uint8_t bin_shifts)
#define LIKELY(x)
Hints that x is highly likely true.
Engine * get_engine() const
const Slot & get_slot(DataPageSlotIndex record) const __attribute__((always_inline))
uint16_t key_length_
Byte length of key of the record.
uint16_t index_in_parent_
[IN] Some index (meaning depends on page type) of pointer in parent page to the new page...
bool contains(HashBin hash) const
HashValue hash_
Full hash of the key of the record.
void set(Epoch::EpochInteger epoch_int, uint32_t ordinal)
Page * page_
[IN, OUT] The new page to initialize.
VolatilePagePointer volatile_pointer_
thread::Thread * context_
[IN] Thread on which the procedure is running
HashValue hashinate(const void *key, uint16_t key_length)
Calculates hash value for general input.
void protected_set_bin_shifts(uint8_t bin_shifts)
this method should be called only in page creation.
memory::PagePoolOffset get_offset() const
uint64_t SnapshotPagePointer
Page ID of a snapshot page.
Database engine object that holds all resources and provides APIs.
void reset() __attribute__((always_inline))
used only while page initialization
NumaNodeMemoryRef * get_node_memory(foedus::thread::ThreadGroupId group) const
void release_parallel(Engine *engine, VolatilePagePointer pointer)
const Page * parent_
[IN] Parent of the new page.
Fix-sized slot for each record, which is placed at the end of data region.
Set of arguments, both inputs and outputs, given to each volatile page initializer.
Just a marker to denote that the memory region represents a data page.
HashBin begin_
Inclusive beginning of the range.
uint16_t DataPageSlotIndex
void release_pages_recursive_parallel(Engine *engine)
Equivalent to std::hex in case the stream doesn't support it.
HashBin end_
Exclusive end of the range.
uint16_t physical_record_length_
Byte count this record occupies.
void release_pages_recursive(const memory::GlobalVolatilePageResolver &page_resolver, memory::PageReleaseBatch *batch)
void initialize_volatile_page(StorageId storage_id, VolatilePagePointer page_id, const HashIntermediatePage *parent, uint8_t level, HashBin start_bin)
Called only when this page is initialized.
Represents a key-value store based on a dense and regular hash.
Represents an intermediate page in Hashtable Storage.
uint8_t get_bin_shifts() const
void initialize_snapshot_page(StorageId storage_id, SnapshotPagePointer page_id, uint8_t level, HashBin start_bin)
static uint16_t required_space(uint16_t key_length, uint16_t payload_length)
returns physical_record_length_ for a new record
static BloomFilterFingerprint extract_fingerprint(HashValue fullhash)
void hash_intermediate_volatile_page_init(const VolatilePageInitArguments &args)
volatile page initialize callback for HashIntermediatePage.
VolatilePagePointer page_id
[IN] New page ID
char * record_from_offset(uint16_t offset)
uint64_t HashBin
Represents a bin of a hash value.
void add(const BloomFilterFingerprint &fingerprint) __attribute__((always_inline))
Adds the fingerprint to this bloom filter.
Represents an individual data page in Hashtable Storage.
uint16_t available_space() const
Returns usable space in bytes.
void hash_data_volatile_page_init(const VolatilePageInitArguments &args)
volatile page initialize callback for HashDataPage.
A fingerprint for bloom filter in each HashDataPage.
void initialize_volatile_page(StorageId storage_id, VolatilePagePointer page_id, const Page *parent, HashBin bin, uint8_t bin_shifts)
uint16_t KeyLength
Represents a byte-length of a key in this package.
Convenient way of writing hex integers to stream.
uint8_t get_level() const
PageHeader & get_header()
At least the basic header exists in all pages.
const uint8_t kHashIntermediatePageFanout
Number of pointers in an intermediate page of hash storage.
const uint64_t kHashMaxBins[]
kHashTotalBins[n] gives the maximum number of hash bins n-level hash can hold.
uint16_t get_record_count() const __attribute__((always_inline))
bool is_moved() const __attribute__((always_inline))
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
uint8_t get_numa_node() const
bool is_locked() const __attribute__((always_inline))
void memory_fence_release()
Equivalent to std::atomic_thread_fence(std::memory_order_release).
void release_pages_recursive(const memory::GlobalVolatilePageResolver &page_resolver, memory::PageReleaseBatch *batch)
memory::EngineMemory * get_memory_manager() const
See Memory Manager.
const uint16_t kPageSize
A constant defining the page size (in bytes) of both snapshot pages and volatile pages.
DataPageSlotIndex search_key_physical(HashValue hash, const BloomFilterFingerprint &fingerprint, const void *key, KeyLength key_length, DataPageSlotIndex record_count, DataPageSlotIndex check_from=0) const
Search for a physical slot that exactly contains the given key.
uint16_t offset_
Byte offset in data_ where this record starts.
uint64_t HashValue
Represents a full 64-bit hash value calculated from a key.