20 #include <glog/logging.h>
43 if (next_pointer.is_null()) {
57 if (examined_records == count) {
72 if (!next_pointer.is_null()) {
111 if (record->is_moved()) {
116 LOG(INFO) <<
"Rare. The record turns out to be moved after locking. Retry the sysxct";
135 record->xct_id_.set_moved();
154 LOG(INFO) <<
"Rare. Someone has just made a next page";
159 const uint16_t required_space
161 if (available_space >= required_space) {
180 reinterpret_cast<Page*>(new_tail)));
191 DVLOG(2) <<
"Volatile HashDataPage is full. Adding a next page..";
202 reinterpret_cast<Page*
>(cur_tail),
214 const uint16_t required_space
221 if (available_space < required_space) {
272 slot.payload_length_ = 0;
279 slot.tid_.xct_id_ = initial_xid;
HashDataPage *const target_
The data page to install a new physical record.
uint8_t get_bin_shifts() const
T align8(T value)
8-alignment.
memory::NumaCoreMemory * get_thread_memory() const
Returns the private memory repository of this thread.
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))
ErrorCode find_and_lock_spacious_tail(xct::SysxctWorkspace *sysxct_workspace, HashDataPage *from_page, HashDataPage **tail)
xct::RwLockableXctId tid_
TID of the record.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
ErrorCode sysxct_record_lock(xct::SysxctWorkspace *sysxct_workspace, storage::VolatilePagePointer page_id, xct::RwLockableXctId *lock)
Takes a lock for a sysxct running under this thread.
DataPageSlotIndex out_slot_
[Out] The slot of the record that is found or created.
const PayloadLength payload_count_
Minimal required length of the payload.
const DataPageSlotIndex kSlotNotFound
Represents a pointer to a volatile page with modification count for preventing ABA.
Persistent status part of Transaction ID.
ErrorCode find_or_create_or_expand(xct::SysxctWorkspace *sysxct_workspace, HashDataPage *page, DataPageSlotIndex examined_records)
The main loop (well, recursion actually).
HashDataPage * out_page_
[Out] The page that contains the found/created record.
storage::VolatilePagePointer grab_free_volatile_page_pointer()
Wrapper for grab_free_volatile_page().
const Slot & get_slot(DataPageSlotIndex record) const __attribute__((always_inline))
const void *const key_
The key of the new record.
void set(Epoch::EpochInteger epoch_int, uint32_t ordinal)
void set_has_next_page() __attribute__((always_inline))
const KeyLength key_length_
Byte length of the key.
VolatilePagePointer volatile_pointer_
P * resolve_newpage_cast(storage::VolatilePagePointer ptr) const
memory::PagePoolOffset get_offset() const
ErrorCode sysxct_page_lock(xct::SysxctWorkspace *sysxct_workspace, storage::Page *page)
Takes a page lock in the same page for a sysxct running under this thread.
ErrorCode create_new_tail_page(HashDataPage *cur_tail, HashDataPage **new_tail)
ErrorCode create_new_record_in_tail_page(HashDataPage *tail)
Installs it as a fresh-new physical record, assuming the given page is the tail and already locked...
virtual ErrorCode run(xct::SysxctWorkspace *sysxct_workspace) override
Execute the system transaction.
Just a marker to denote that the memory region represents a data page.
uint16_t DataPageSlotIndex
const DataPageSlotIndex hint_check_from_
The in-page location from which this sysxct will look for matching records.
P * resolve_cast(storage::VolatilePagePointer ptr) const
resolve() plus reinterpret_cast
0x0301 : "MEMORY : Not enough free volatile pages. Check the config of MemoryOptions" ...
Slot & get_new_slot(DataPageSlotIndex record) __attribute__((always_inline))
BloomFilterFingerprint fingerprint_
thread::Thread *const context_
Thread context.
ErrorCode expand_record(xct::SysxctWorkspace *sysxct_workspace, HashDataPage *page, DataPageSlotIndex index)
static uint16_t required_space(uint16_t key_length, uint16_t payload_length)
returns physical_record_length_ for a new record
uint16_t get_max_payload() const
VolatilePagePointer get_volatile_page_id() const
char * record_from_offset(uint16_t offset)
#define CHECK_ERROR_CODE(x)
This macro calls x and checks its returned error code.
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.
const DualPagePointer & next_page() const __attribute__((always_inline))
void initialize_volatile_page(StorageId storage_id, VolatilePagePointer page_id, const Page *parent, HashBin bin, uint8_t bin_shifts)
const PayloadLength aggressive_payload_count_hint_
When we expand the record or allocate a new record, we might allocate a larger-than-necessary space g...
DataPageSlotIndex append_record_to_page(HashDataPage *page, xct::XctId initial_xid) const
Appends a new physical record to the page.
void memory_fence_acquire()
Equivalent to std::atomic_thread_fence(std::memory_order_acquire).
DataPageSlotIndex search_within_page(const HashDataPage *page, DataPageSlotIndex key_count, DataPageSlotIndex examined_records) const
uint16_t get_record_count() const __attribute__((always_inline))
#define UNLIKELY(x)
Hints that x is highly likely false.
0x0A05 : "XCTION : Aborted a transaction because of a race condition. This is an expected error in hi...
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
bool is_locked() const __attribute__((always_inline))
void memory_fence_release()
Equivalent to std::atomic_thread_fence(std::memory_order_release).
ErrorCode
Enum of error codes defined in error_code.xmacro.
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.
Per-thread reused work memory for system transactions.
uint16_t offset_
Byte offset in data_ where this record starts.
const HashCombo & combo_
Hash info of the key.