20 #include <glog/logging.h>
38 pimpl_ =
new ThreadPimpl(engine,
this,
id, global_ordinal);
152 for (uint32_t i = 0; i < count; ++i) {
154 if (offsets_[i] == 0) {
155 for (uint32_t j = 0; j < i; ++j) {
167 for (uint32_t i = 0; i < count_; ++i) {
168 if (offsets_[i] != 0) {
void collect_retired_volatile_page(storage::VolatilePagePointer ptr)
Keeps the specified volatile page as retired as of the current epoch.
const memory::GlobalVolatilePageResolver & get_global_volatile_page_resolver() const
Returns the page resolver to convert page ID to page pointer.
xct::Xct & get_current_xct()
Returns the transaction that is currently running on this thread.
ErrorCode find_or_read_a_snapshot_page(storage::SnapshotPagePointer page_id, storage::Page **out)
Find the given page in snapshot cache, reading it if not found.
ErrorStack initialize() override
Acquires resources in this object, usually called right after constructor.
ThreadGlobalOrdinal get_thread_global_ordinal() const
ErrorCode install_a_volatile_page(storage::DualPagePointer *pointer, storage::Page **installed_page)
Installs a volatile page to the given dual pointer as a copy of the snapshot page.
ErrorCode install_a_volatile_page(storage::DualPagePointer *pointer, storage::Page **installed_page)
Installs a volatile page to the given dual pointer as a copy of the snapshot page.
void release_free_volatile_page(PagePoolOffset offset)
Returns one free volatile page to local page pool.
Represents a pointer to another page (usually a child page).
ErrorCode find_or_read_snapshot_pages_batch(uint16_t batch_size, const storage::SnapshotPagePointer *page_ids, storage::Page **out)
Batched version of find_or_read_a_snapshot_page().
memory::NumaCoreMemory * get_thread_memory() const
Returns the private memory repository of this thread.
PagePoolOffset grab_free_volatile_page()
Acquires one free volatile page from local page pool.
uint64_t get_snapshot_cache_misses() const
[statistics] count of cache misses in snapshot caches
A thread-local log buffer.
uint64_t stat_snapshot_cache_hits_
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Represents one thread running on one NUMA core.
uint32_t PagePoolOffset
Offset in PagePool that compactly represents the page address (unlike 8 bytes pointer).
memory::GlobalVolatilePageResolver global_volatile_page_resolver_
Page resolver to convert all page ID to page pointer.
void collect_retired_volatile_page(storage::VolatilePagePointer ptr)
Keeps the specified volatile page as retired as of the current epoch.
bool is_initialized() const override
Returns whether the object has been already initialized or not.
memory::NumaNodeMemory * get_node_memory() const
Returns the node-shared memory repository of the NUMA node this thread belongs to.
ThreadId get_thread_id() const
Represents a pointer to a volatile page with modification count for preventing ABA.
uint8_t value_
Log arithmic counter of aborts.
Represents a user transaction.
ErrorCode read_a_snapshot_page(storage::SnapshotPagePointer page_id, storage::Page *buffer) __attribute__((always_inline))
Read a snapshot page using the thread-local file descriptor set.
const ThreadGlobalOrdinal global_ordinal_
globally and contiguously numbered ID of thread
ErrorStack uninitialize() override final
Typical implementation of Initializable::uninitialize() that provides uninitialize-once semantics...
Brings error stacktrace information as return value of functions.
bool is_active() const
Returns whether the object is an active transaction.
Engine * get_engine() const
storage::Page * resolve_newpage(storage::VolatilePagePointer ptr) const
Shorthand for get_global_volatile_page_resolver.resolve_offset_newpage()
Epoch * get_in_commit_epoch_address()
Currently we don't have sysxct_release_locks() etc.
Repository of memories dynamically acquired within one CPU core (thread).
ErrorCode grab(uint32_t count)
If this thread doesn't have enough free pages, no page is obtained, returning kErrorCodeMemoryNoFreeP...
storage::Page * resolve(storage::VolatilePagePointer ptr) const
Shorthand for get_global_volatile_page_resolver.resolve_offset()
log::ThreadLogBuffer & get_thread_log_buffer()
Returns the private log buffer for this thread.
ErrorCode find_or_read_snapshot_pages_batch(uint16_t batch_size, const storage::SnapshotPagePointer *page_ids, storage::Page **out)
Batched version of find_or_read_a_snapshot_page().
bool is_running_xct() const
Returns if this thread is running an active transaction.
Engine *const engine_
MCS locks methods.
NumaNodeMemory * get_node_memory() const
Returns the parent memory repository.
uint64_t SnapshotPagePointer
Page ID of a snapshot page.
uint16_t get_hot_threshold_for_this_xct() const
ErrorStack initialize() override final
Typical implementation of Initializable::initialize() that provides initialize-once semantics...
Database engine object that holds all resources and provides APIs.
Repository of memories dynamically acquired and shared within one NUMA node (socket).
log::ThreadLogBuffer log_buffer_
Thread-private log buffer.
Just a marker to denote that the memory region represents a data page.
void reset_snapshot_cache_counts() const
[statistics] resets the above two
memory::LocalPageResolver local_volatile_page_resolver_
Page resolver to convert only local page ID to page pointer.
bool is_hot_page(const storage::Page *page) const
const memory::LocalPageResolver & get_local_volatile_page_resolver() const
Returns page resolver to convert only local page ID to page pointer.
0x0301 : "MEMORY : Not enough free volatile pages. Check the config of MemoryOptions" ...
uint64_t get_snapshot_cache_hits() const
[statistics] count of cache hits in snapshot caches
const ThreadId id_
Unique ID of this thread.
xct::Xct current_xct_
Current transaction this thread is conveying.
void release()
Idempotent.
uint16_t ThreadGlobalOrdinal
Typedef for a globally and contiguously numbered ID of thread.
ErrorCode find_or_read_a_snapshot_page(storage::SnapshotPagePointer page_id, storage::Page **out)
Find the given page in snapshot cache, reading it if not found.
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
uint16_t ThreadId
Typedef for a global ID of Thread (core), which is unique across NUMA nodes.
uint64_t stat_snapshot_cache_misses_
ThreadStatus status_
Impersonation status of this thread.
const ErrorStack kRetOk
Normal return value for no-error case.
std::ostream & operator<<(std::ostream &o, const ImpersonateSession &v)
PageHeader & get_header()
At least the basic header exists in all pages.
ErrorStack uninitialize() override
An idempotent method to release all resources of this object, if any.
memory::NumaCoreMemory * core_memory_
Private memory repository of this thread.
ErrorCode
Enum of error codes defined in error_code.xmacro.
ErrorCode read_snapshot_pages(storage::SnapshotPagePointer page_id_begin, uint32_t page_count, storage::Page *buffer)
Read contiguous pages in one shot.
bool is_initialized() const override final
Returns whether the object has been already initialized or not.
ErrorCode read_snapshot_pages(storage::SnapshotPagePointer page_id_begin, uint32_t page_count, storage::Page *buffer) __attribute__((always_inline))
Read contiguous pages in one shot.
ErrorCode read_a_snapshot_page(storage::SnapshotPagePointer page_id, storage::Page *buffer)
Read a snapshot page using the thread-local file descriptor set.
ThreadControlBlock * control_block_