libfoedus-core
FOEDUS Core Library
foedus::xct::RecordXctAccess Struct Reference

Base of ReadXctAccess and WriteXctAccess. More...

Detailed Description

Base of ReadXctAccess and WriteXctAccess.

No virtual anything. POD.

Definition at line 83 of file xct_access.hpp.

#include <xct_access.hpp>

Inheritance diagram for foedus::xct::RecordXctAccess:
Collaboration diagram for foedus::xct::RecordXctAccess:

Public Member Functions

void set_owner_id_and_lock_id (RwLockableXctId *owner_id_address, UniversalLockId owner_lock_id)
 Setter for owner_id_address_/owner_lock_id_. More...
 
void set_owner_id_resolve_lock_id (const memory::GlobalVolatilePageResolver &resolver, RwLockableXctId *owner_id_address)
 Calculate owner_lock_id using the resolver. More...
 

Static Public Member Functions

static bool compare (const RecordXctAccess &left, const RecordXctAccess &right) __attribute__((always_inline))
 sort the write set in a unique order. More...
 

Public Attributes

storage::StorageId storage_id_
 The storage we accessed. More...
 
uint32_t ordinal_
 Indicates the ordinal among ReadXctAccess/WriteXctAccess of this transaction. More...
 
RwLockableXctIdowner_id_address_
 Pointer to the accessed record. More...
 
UniversalLockId owner_lock_id_
 Universal Lock ID of the lock in the record. More...
 

Member Function Documentation

bool foedus::xct::RecordXctAccess::compare ( const RecordXctAccess left,
const RecordXctAccess right 
)
inlinestatic

sort the write set in a unique order.

We use UniversalLockId which contains the records's NodeID and local VA offset. This is different from Silo [Tu '13] because we need global ordering across all processes. VA's might give different per-process results.

Definition at line 240 of file xct_access.hpp.

References ordinal_, and owner_lock_id_.

Referenced by foedus::xct::ReadXctAccess::compare(), and foedus::xct::WriteXctAccess::compare().

242  {
243  if (left.owner_lock_id_ != right.owner_lock_id_) {
244  return left.owner_lock_id_ < right.owner_lock_id_;
245  } else {
246  return left.ordinal_ < right.ordinal_;
247  }
248 }

Here is the caller graph for this function:

void foedus::xct::RecordXctAccess::set_owner_id_and_lock_id ( RwLockableXctId owner_id_address,
UniversalLockId  owner_lock_id 
)
inline

Setter for owner_id_address_/owner_lock_id_.

These two should be always set/updated together, so prefer this.

Definition at line 111 of file xct_access.hpp.

Referenced by set_owner_id_resolve_lock_id().

111  {
112  owner_id_address_ = owner_id_address;
113  owner_lock_id_ = owner_lock_id;
114  }
RwLockableXctId * owner_id_address_
Pointer to the accessed record.
Definition: xct_access.hpp:102
UniversalLockId owner_lock_id_
Universal Lock ID of the lock in the record.
Definition: xct_access.hpp:105

Here is the caller graph for this function:

void foedus::xct::RecordXctAccess::set_owner_id_resolve_lock_id ( const memory::GlobalVolatilePageResolver resolver,
RwLockableXctId owner_id_address 
)

Calculate owner_lock_id using the resolver.

This one can't be inlined, though. This is slightly wasteful if you already have lock_id calculated.

Definition at line 93 of file xct_access.cpp.

References set_owner_id_and_lock_id(), and foedus::xct::xct_id_to_universal_lock_id().

Referenced by foedus::xct::Xct::add_to_write_set(), foedus::xct::XctManagerPimpl::precommit_xct_lock_track_write(), and foedus::xct::XctManagerPimpl::precommit_xct_verify_track_read().

95  {
96  UniversalLockId owner_lock_id = xct_id_to_universal_lock_id(resolver, owner_id_address);
97  set_owner_id_and_lock_id(owner_id_address, owner_lock_id);
98 }
uintptr_t UniversalLockId
Universally ordered identifier of each lock.
Definition: xct_id.hpp:134
UniversalLockId xct_id_to_universal_lock_id(const memory::GlobalVolatilePageResolver &resolver, RwLockableXctId *lock)
Definition: xct_id.hpp:1226
void set_owner_id_and_lock_id(RwLockableXctId *owner_id_address, UniversalLockId owner_lock_id)
Setter for owner_id_address_/owner_lock_id_.
Definition: xct_access.hpp:111

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

uint32_t foedus::xct::RecordXctAccess::ordinal_

Indicates the ordinal among ReadXctAccess/WriteXctAccess of this transaction.

For example, first log record has 0, second 1,.. Next transaction of this thread resets it to 0 at begin_xct. This is an auxiliary field we can potentially re-calculate from lock_id_, but it's tedious (it's not address order when it wraps around in log buffer). So, we maintain it here for sanity checks. Also used for stable sorting (in case lock_id_ is same) of read/write-sets.

Definition at line 96 of file xct_access.hpp.

Referenced by foedus::xct::Xct::add_to_read_set(), foedus::xct::Xct::add_to_write_set(), foedus::xct::CurrentLockList::batch_insert_write_placeholders(), compare(), foedus::xct::operator<<(), and foedus::xct::XctManagerPimpl::precommit_xct_sort_access().

UniversalLockId foedus::xct::RecordXctAccess::owner_lock_id_

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