Zero  0.1.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
xct_t Class Reference

A transaction. Internal to the storage manager.This class may be used in a limited way for the handling of out-of-log-space conditions. More...

#include <xct.h>

Inheritance diagram for xct_t:

Public Types

enum  elr_mode_t { elr_none, elr_s, elr_sx, elr_clv }
 

Public Member Functions

const lsn_tlast_lsn () const
 
const lsn_tfirst_lsn () const
 
const lsn_tundo_nxt () const
 
const logrec_tlast_log () const
 
void log_warn_disable ()
 
void log_warn_resume ()
 
bool log_warn_is_on () const
 
rc_t update_last_logrec (logrec_t *l, lsn_t lsn)
 
void AddStoreToFree (const StoreID &stid)
 
void AddLoadStore (const StoreID &stid)
 
void set_alloced ()
 
xct_lock_info_tlock_info () const
 
lil_private_tablelil_lock_info () const
 
RawXctraw_lock_xct () const
 
void force_nonblocking ()
 
bool is_piggy_backed_single_log_sys_xct () const
 
void set_piggy_backed_single_log_sys_xct (bool enabled)
 
bool is_sys_xct () const
 
bool is_single_log_sys_xct () const
 
void set_inquery_verify (bool enabled)
 
bool is_inquery_verify () const
 
void set_inquery_verify_keyorder (bool enabled)
 
bool is_inquery_verify_keyorder () const
 
void set_inquery_verify_space (bool enabled)
 
bool is_inquery_verify_space () const
 
const inquery_verify_context_tinquery_verify_context () const
 
inquery_verify_context_tinquery_verify_context ()
 
concurrency_t get_query_concurrency () const
 
void set_query_concurrency (concurrency_t mode)
 
bool get_query_exlock_for_select () const
 
void set_query_exlock_for_select (bool mode)
 
bool is_loser_xct () const
 
bool is_loser_xct_in_undo () const
 
void set_loser_xct_in_undo ()
 
ostream & dump_locks (ostream &) const
 
bool rolling_back () const
 
void set_error_encountered ()
 
bool error_encountered () const
 
tid_t tid () const
 
uint32_t get_xct_chain_len () const
 
uint32_t & ssx_chain_len ()
 
const lsn_tget_read_watermark () const
 
void update_read_watermark (const lsn_t &tag)
 
elr_mode_t get_elr_mode () const
 
void set_elr_mode (elr_mode_t mode)
 
latch_tlatchp () const
 
latch_tlatch ()
 

Static Public Member Functions

static xct_tlook_up (const tid_t &tid)
 
static tid_t oldest_tid ()
 
static tid_t youngest_tid ()
 
static uint32_t num_active_xcts ()
 
static size_t get_loser_count ()
 
static void fuzzy_checkpoint (chkpt_t &chkpt)
 
static w_rc_t acquire_xlist_mutex ()
 
static void release_xlist_mutex ()
 
static void assert_xlist_mutex_not_mine ()
 
static void assert_xlist_mutex_is_mine ()
 
static bool xlist_mutex_is_mine ()
 

Protected Member Functions

void put_in_order ()
 
rc_t _abort ()
 
rc_t _commit (uint32_t flags, lsn_t *plastlsn=nullptr)
 
rc_t _commit_read_only (uint32_t flags, lsn_t &inherited_read_watermark)
 
rc_t _pre_commit (uint32_t flags)
 
rc_t _pre_abort ()
 
bool should_consume_rollback_resv (int t) const
 
bool should_reserve_for_rollback (int t) const
 

Static Protected Member Functions

static lockid_tnew_lock_hierarchy ()
 

Protected Attributes

w_link_t _xlink
 
lsn_t _first_lsn
 
lsn_t _last_lsn
 
lsn_t _undo_nxt
 
lsn_t _read_watermark
 
elr_mode_t _elr_mode
 
std::chrono::high_resolution_clock::time_point _begin_tstamp
 
bool _rolling_back
 

Static Protected Attributes

static w_descend_list_t< xct_t, queue_based_lock_t, tid_t_xlist
 
static std::atomic< tid_t_nxt_tid {0}
 
static tid_t _oldest_tid = 0
 

Private Member Functions

bool one_thread_attached () const
 
void _compensate (const lsn_t &, bool undoable=false)
 
w_rc_t _sync_logbuf (bool block=true, bool signal=true)
 
void _teardown (bool is_chaining)
 

Static Private Member Functions

static void xct_stats (u_long &begins, u_long &commits, u_long &aborts, bool reset)
 

Private Attributes

sm_stats_t__stats
 
lockid_t__saved_lockid_t
 
tid_t _tid
 
uint32_t _xct_chain_len
 
uint32_t _ssx_chain_len
 The count of consecutive SSXs conveyed by this transaction object. More...
 
concurrency_t _query_concurrency
 
bool _query_exlock_for_select
 
bool _piggy_backed_single_log_sys_xct
 
bool _sys_xct
 
bool _single_log_sys_xct
 
bool _deferred_ssx
 
bool _inquery_verify
 
bool _inquery_verify_keyorder
 
bool _inquery_verify_space
 
inquery_verify_context_t _inquery_verify_context
 
loser_xct_state_t _loser_xct
 
latch_t _latch
 
lintel::Atomic< int > _in_compensated_op
 
lsn_t _anchor
 

Static Private Attributes

static queue_based_lock_t _xlist_mutex
 

Detailed Description

A transaction. Internal to the storage manager.

This class may be used in a limited way for the handling of out-of-log-space conditions.

skip

Member Enumeration Documentation

§ elr_mode_t

Early Lock Release mode. This is a totally separated implementation from Quarks.

See also
_read_watermark
Enumerator
elr_none 

ELR is disabled.

elr_s 

ELR releases only S, U, and intent locks (same as Quarks?).

elr_sx 

ELR releases all locks. When this mode is on, even read-only transactions do an additional check to maintain serializability. So, do NOT forget to set this mode to ALL transactions if you are using it for any of your transactions.

elr_clv 

ELR releases no locks but gives permissions for its locks to be violated. When this mode is on, even read-only transactions do an additional check to maintain serializability. So, do NOT forget to set this mode to ALL transactions if you are using it for any of your transactions.

Member Function Documentation

§ _abort()

rc_t xct_t::_abort ( )
protected

§ _commit()

rc_t xct_t::_commit ( uint32_t  flags,
lsn_t plastlsn = nullptr 
)
protected

§ _commit_read_only()

rc_t xct_t::_commit_read_only ( uint32_t  flags,
lsn_t inherited_read_watermark 
)
protected

§ _compensate()

void xct_t::_compensate ( const lsn_t lsn,
bool  undoable = false 
)
private

§ _pre_abort()

rc_t xct_t::_pre_abort ( )
protected

§ _pre_commit()

rc_t xct_t::_pre_commit ( uint32_t  flags)
protected

§ _sync_logbuf()

w_rc_t xct_t::_sync_logbuf ( bool  block = true,
bool  signal = true 
)
private

§ _teardown()

void xct_t::_teardown ( bool  is_chaining)
private

§ acquire_xlist_mutex()

w_rc_t xct_t::acquire_xlist_mutex ( )
static

§ AddLoadStore()

void xct_t::AddLoadStore ( const StoreID stid)

§ AddStoreToFree()

void xct_t::AddStoreToFree ( const StoreID stid)

§ assert_xlist_mutex_is_mine()

void xct_t::assert_xlist_mutex_is_mine ( )
static

§ assert_xlist_mutex_not_mine()

void xct_t::assert_xlist_mutex_not_mine ( )
static

§ dump_locks()

ostream & xct_t::dump_locks ( ostream &  out) const

§ error_encountered()

bool xct_t::error_encountered ( ) const
inline

§ first_lsn()

const lsn_t& xct_t::first_lsn ( ) const

§ force_nonblocking()

void xct_t::force_nonblocking ( )

§ fuzzy_checkpoint()

void xct_t::fuzzy_checkpoint ( chkpt_t chkpt)
static

§ get_elr_mode()

elr_mode_t xct_t::get_elr_mode ( ) const
inline

§ get_loser_count()

size_t xct_t::get_loser_count ( )
static

§ get_query_concurrency()

concurrency_t xct_t::get_query_concurrency ( ) const
inline

§ get_query_exlock_for_select()

bool xct_t::get_query_exlock_for_select ( ) const
inline

§ get_read_watermark()

const lsn_t& xct_t::get_read_watermark ( ) const
inline

§ get_xct_chain_len()

uint32_t xct_t::get_xct_chain_len ( ) const
inline

§ inquery_verify_context() [1/2]

const inquery_verify_context_t& xct_t::inquery_verify_context ( ) const
inline

§ inquery_verify_context() [2/2]

inquery_verify_context_t& xct_t::inquery_verify_context ( )
inline

§ is_inquery_verify()

bool xct_t::is_inquery_verify ( ) const
inline

§ is_inquery_verify_keyorder()

bool xct_t::is_inquery_verify_keyorder ( ) const
inline

§ is_inquery_verify_space()

bool xct_t::is_inquery_verify_space ( ) const
inline

§ is_loser_xct()

bool xct_t::is_loser_xct ( ) const
inline

§ is_loser_xct_in_undo()

bool xct_t::is_loser_xct_in_undo ( ) const
inline

§ is_piggy_backed_single_log_sys_xct()

bool xct_t::is_piggy_backed_single_log_sys_xct ( ) const
inline

§ is_single_log_sys_xct()

bool xct_t::is_single_log_sys_xct ( ) const
inline

§ is_sys_xct()

bool xct_t::is_sys_xct ( ) const
inline

§ last_log()

const logrec_t* xct_t::last_log ( ) const

§ last_lsn()

const lsn_t& xct_t::last_lsn ( ) const

skip skip

§ latch()

latch_t& xct_t::latch ( )
inline

§ latchp()

latch_t* xct_t::latchp ( ) const
inline

§ lil_lock_info()

lil_private_table * xct_t::lil_lock_info ( ) const

§ lock_info()

xct_lock_info_t * xct_t::lock_info ( ) const

§ log_warn_disable()

void xct_t::log_warn_disable ( )

skip

Todo:
Figure out how log space warnings will interact with mtxct

§ log_warn_is_on()

bool xct_t::log_warn_is_on ( ) const

§ log_warn_resume()

void xct_t::log_warn_resume ( )

§ look_up()

xct_t * xct_t::look_up ( const tid_t tid)
static

§ new_lock_hierarchy()

static lockid_t* xct_t::new_lock_hierarchy ( )
staticprotected

§ num_active_xcts()

uint32_t xct_t::num_active_xcts ( )
static

skip

§ oldest_tid()

tid_t xct_t::oldest_tid ( )
static

§ one_thread_attached()

bool xct_t::one_thread_attached ( ) const
private

§ put_in_order()

void xct_t::put_in_order ( )
protected

§ raw_lock_xct()

RawXct * xct_t::raw_lock_xct ( ) const

§ release_xlist_mutex()

void xct_t::release_xlist_mutex ( )
static

§ rolling_back()

bool xct_t::rolling_back ( ) const
inline

§ set_alloced()

void xct_t::set_alloced ( )
inline

§ set_elr_mode()

void xct_t::set_elr_mode ( elr_mode_t  mode)
inline

§ set_error_encountered()

void xct_t::set_error_encountered ( )
inline

§ set_inquery_verify()

void xct_t::set_inquery_verify ( bool  enabled)
inline

§ set_inquery_verify_keyorder()

void xct_t::set_inquery_verify_keyorder ( bool  enabled)
inline

§ set_inquery_verify_space()

void xct_t::set_inquery_verify_space ( bool  enabled)
inline

§ set_loser_xct_in_undo()

void xct_t::set_loser_xct_in_undo ( )
inline

§ set_piggy_backed_single_log_sys_xct()

void xct_t::set_piggy_backed_single_log_sys_xct ( bool  enabled)
inline

§ set_query_concurrency()

void xct_t::set_query_concurrency ( concurrency_t  mode)
inline

§ set_query_exlock_for_select()

void xct_t::set_query_exlock_for_select ( bool  mode)
inline

§ should_consume_rollback_resv()

bool xct_t::should_consume_rollback_resv ( int  t) const
inlineprotected

§ should_reserve_for_rollback()

bool xct_t::should_reserve_for_rollback ( int  t) const
inlineprotected

§ ssx_chain_len()

uint32_t& xct_t::ssx_chain_len ( )
inline

§ tid()

tid_t xct_t::tid ( ) const
inline

§ undo_nxt()

const lsn_t& xct_t::undo_nxt ( ) const

§ update_last_logrec()

rc_t xct_t::update_last_logrec ( logrec_t l,
lsn_t  lsn 
)

§ update_read_watermark()

void xct_t::update_read_watermark ( const lsn_t tag)
inline

§ xct_stats()

static void xct_t::xct_stats ( u_long &  begins,
u_long &  commits,
u_long &  aborts,
bool  reset 
)
staticprivate

§ xlist_mutex_is_mine()

bool xct_t::xlist_mutex_is_mine ( )
static

§ youngest_tid()

tid_t xct_t::youngest_tid ( )
static

Member Data Documentation

§ __saved_lockid_t

lockid_t* xct_t::__saved_lockid_t
private

§ __stats

sm_stats_t* xct_t::__stats
private

§ _anchor

lsn_t xct_t::_anchor
private

§ _begin_tstamp

std::chrono::high_resolution_clock::time_point xct_t::_begin_tstamp
protected

§ _deferred_ssx

bool xct_t::_deferred_ssx
private

whether to defer the logging and applying of the change made by single-log system transaxction (SSX). Experimental.

§ _elr_mode

elr_mode_t xct_t::_elr_mode
protected

§ _first_lsn

lsn_t xct_t::_first_lsn
protected

§ _in_compensated_op

lintel::Atomic<int> xct_t::_in_compensated_op
private

§ _inquery_verify

bool xct_t::_inquery_verify
private

whether in-query verification is on.

§ _inquery_verify_context

inquery_verify_context_t xct_t::_inquery_verify_context
private

result and context of in-query verification.

§ _inquery_verify_keyorder

bool xct_t::_inquery_verify_keyorder
private

whether to additionally check the sortedness and uniqueness of keys.

§ _inquery_verify_space

bool xct_t::_inquery_verify_space
private

whether to check any overlaps of records and integrity of space offset.

§ _last_lsn

lsn_t xct_t::_last_lsn
protected

§ _latch

latch_t xct_t::_latch
private

§ _loser_xct

loser_xct_state_t xct_t::_loser_xct
private

§ _nxt_tid

std::atomic< tid_t > xct_t::_nxt_tid {0}
staticprotected

§ _oldest_tid

tid_t xct_t::_oldest_tid = 0
staticprotected

§ _piggy_backed_single_log_sys_xct

bool xct_t::_piggy_backed_single_log_sys_xct
private

true if this transaction is now conveying a single-log system transaction.

§ _query_concurrency

concurrency_t xct_t::_query_concurrency
private

concurrency mode of this transaction.

§ _query_exlock_for_select

bool xct_t::_query_exlock_for_select
private

whether to take X lock for lookup/cursor.

§ _read_watermark

lsn_t xct_t::_read_watermark
protected

Whenever a transaction acquires some lock, this value is updated as _read_watermark=max(_read_watermark, lock_bucket.tag) so that we maintain a maximum commit LSN of transactions it depends on. This value is used to commit a read-only transaction with Safe SX-ELR to block until the log manager flushed the log buffer at least to this value. Assuming this protocol, we can do ELR for x-locks. See jira ticket:99 "ELR for X-lock" (originally trac ticket:101).

§ _rolling_back

bool xct_t::_rolling_back
protected

As SSX log must be separated from outer transaction's logs, we maintain another buffer. This buffer is only used during one get/give_logbuf() call because it's SSX. Also, again because it's SSX, it can contain only one log.

§ _single_log_sys_xct

bool xct_t::_single_log_sys_xct
private

whether this transaction will have at most one xlog entry

§ _ssx_chain_len

uint32_t xct_t::_ssx_chain_len
private

The count of consecutive SSXs conveyed by this transaction object.

SSX can't nest SSX. However, as SSX doesn't care what the transaction object is, SSX can chain an arbitraly number of SSXs as far as they are consecutive SSXs, no multi-log system transactions or user-transactions in-between. In that case, we simply increment/decrement this counter when we start/end SSX. Chaining is useful when SSX operation might cause another SSX operation, eg ghost-reservation causes page-split which causes page-evict etc etc.

§ _sys_xct

bool xct_t::_sys_xct
private

whether this transaction is a system transaction.

§ _tid

tid_t xct_t::_tid
private

§ _undo_nxt

lsn_t xct_t::_undo_nxt
protected

§ _xct_chain_len

uint32_t xct_t::_xct_chain_len
private

number of previously committed xcts on this thread as a chain. If 0, there is no chained previous xct.

§ _xlink

w_link_t xct_t::_xlink
protected

§ _xlist

w_descend_list_t< xct_t, queue_based_lock_t, tid_t > xct_t::_xlist
staticprotected

§ _xlist_mutex

queue_based_lock_t xct_t::_xlist_mutex
staticprivate

The documentation for this class was generated from the following files: