A platform for high-performance distributed tool and library development written in C++. It can be deployed in two different cluster modes: standalone or distributed. API for v0.5.0, released on June 13, 2018.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
PDBPage Class Reference

#include <PDBPage.h>

+ Collaboration diagram for PDBPage:

Public Member Functions

 PDBPage (char *dataIn, NodeID dataNodeID, DatabaseID dataDbID, UserTypeID dataTypeID, SetID setID, PageID pageID, size_t dataSize, size_t offset, int internalOffset=0, int numObjects=0)
 
 PDBPage (char *dataIn, size_t offset, int internalOffset=0)
 
 ~PDBPage ()
 
void freePage ()
 
void preparePage ()
 
void incRefCount ()
 
void decRefCount ()
 
void freeContent ()
 
int incEmbeddedNumObjects ()
 
int getEmbeddedNumObjects ()
 
void setNumObjects (int numObjects)
 
int getNumObjects ()
 
void * addVariableBytes (size_t size)
 
void * getBytes ()
 
size_t getSize ()
 
void unpin ()
 
void readLock ()
 
void readUnlock ()
 
void writeLock ()
 
void writeUnlock ()
 
NodeID getNodeID () const
 
DatabaseID getDbID () const
 
UserTypeID getTypeID () const
 
SetID getSetID () const
 
PageID getPageID () const
 
char * getRawBytes () const
 
size_t getRawSize () const
 
size_t getOffset () const
 
int getNumHeadMiniPages () const
 
int getNumMiniPages () const
 
size_t getMiniPageSize () const
 
size_t getHeadSize () const
 
long getAccessSequenceId () const
 
int getRefCount ()
 
void resetRefCount ()
 
bool isPinned ()
 
bool isDirty ()
 
bool isInFlush ()
 
bool isInEviction ()
 
unsigned int getPageSeqInPartition () const
 
FilePartitionID getPartitionId () const
 
void setNodeID (NodeID nodeID)
 
void setDbID (DatabaseID dbID)
 
void setTypeID (UserTypeID typeID)
 
void setSetID (SetID setID)
 
void setPageID (PageID pageID)
 
void setRawBytes (char *rawBytes)
 
void setSize (size_t size)
 
void setOffset (size_t offset)
 
void setNumHeadMiniPages (int numHeadMiniPages)
 
void setNumMiniPages (int numMiniPages)
 
void setMiniPageSize (size_t miniPageSize)
 
void setHeadSize (size_t headSize)
 
void setAccessSequenceId (long accessSequenceId)
 
void setPinned (bool isPinned)
 
void setDirty (bool dirty)
 
void setInFlush (bool inFlush)
 
void setInEviction (bool inEviction)
 
void setPageSeqInPartition (unsigned int pageSeqInPartition)
 
void setPartitionId (FilePartitionID partitionId)
 
void setInternalOffset (int offset)
 
int getInternalOffset ()
 

Private Attributes

char * rawBytes
 
size_t offset
 
int numHeadMiniPages
 
int numMiniPages
 
int numObjects = 0
 
size_t miniPageSize
 
size_t headSize
 
NodeID nodeID
 
DatabaseID dbID
 
UserTypeID typeID
 
SetID setID
 
PageID pageID
 
size_t size
 
int refCount
 
bool pinned
 
bool dirty
 
pthread_mutex_t refCountMutex
 
pthread_rwlock_t flushLock
 
long accessSequenceId
 
bool inFlush
 
bool inEviction
 
FilePartitionID partitionId
 
unsigned int pageSeqInPartition
 
size_t curAppendOffset
 
int internalOffset
 

Detailed Description

This class implements PDBPage that is a fixed size (e.g. 64MB) piece of data allocated in shared memory. A PDBPage usually consists of two parts: 1) A page header that often consists of following fields:

  • NodeID
  • DatabaseID
  • UserTypeID
  • PageID
  • reference count for on-page reference count 2) A page body that consists of a series of <object raw data size, object raw data> pairs , with each pair aligned with miniPage size (often set to be cacheline size).

A page at frontend will be setup by the PageCache instance. A page at backend will be setup by the DataProxy instance and used via PageHandle instance.

Definition at line 52 of file PDBPage.h.

Constructor & Destructor Documentation

PDBPage::PDBPage ( char *  dataIn,
NodeID  dataNodeID,
DatabaseID  dataDbID,
UserTypeID  dataTypeID,
SetID  setID,
PageID  pageID,
size_t  dataSize,
size_t  offset,
int  internalOffset = 0,
int  numObjects = 0 
)

Create a PDBPage instance from an empty page.

Definition at line 27 of file PDBPage.cc.

PDBPage::PDBPage ( char *  dataIn,
size_t  offset,
int  internalOffset = 0 
)

Create a PDBPage instance from a non-empty page.

Definition at line 66 of file PDBPage.cc.

PDBPage::~PDBPage ( )

Definition at line 97 of file PDBPage.cc.

+ Here is the call graph for this function:

Member Function Documentation

void* PDBPage::addVariableBytes ( size_t  size)
inline

Allocate an empty memory area with variable size from the current offset as a special object, that can be used to implement variable-size small pages.

Definition at line 146 of file PDBPage.h.

void PDBPage::decRefCount ( )
inline

Definition at line 93 of file PDBPage.h.

+ Here is the caller graph for this function:

void PDBPage::freeContent ( )
inline

Definition at line 107 of file PDBPage.h.

void PDBPage::freePage ( )

Free page data from shared memory.

Definition at line 161 of file PDBPage.cc.

+ Here is the caller graph for this function:

long PDBPage::getAccessSequenceId ( ) const
inline

Definition at line 255 of file PDBPage.h.

void * PDBPage::getBytes ( )

Definition at line 144 of file PDBPage.cc.

DatabaseID PDBPage::getDbID ( ) const
inline

Definition at line 198 of file PDBPage.h.

int PDBPage::getEmbeddedNumObjects ( )
inline

Definition at line 127 of file PDBPage.h.

size_t PDBPage::getHeadSize ( ) const
inline

Definition at line 250 of file PDBPage.h.

int PDBPage::getInternalOffset ( )
inline

Definition at line 400 of file PDBPage.h.

size_t PDBPage::getMiniPageSize ( ) const
inline

Definition at line 244 of file PDBPage.h.

NodeID PDBPage::getNodeID ( ) const
inline

Definition at line 193 of file PDBPage.h.

int PDBPage::getNumHeadMiniPages ( ) const
inline

Definition at line 233 of file PDBPage.h.

int PDBPage::getNumMiniPages ( ) const
inline

Definition at line 238 of file PDBPage.h.

int PDBPage::getNumObjects ( )
inline

Definition at line 138 of file PDBPage.h.

size_t PDBPage::getOffset ( ) const
inline

Definition at line 228 of file PDBPage.h.

PageID PDBPage::getPageID ( ) const
inline

Definition at line 213 of file PDBPage.h.

unsigned int PDBPage::getPageSeqInPartition ( ) const
inline

Definition at line 293 of file PDBPage.h.

FilePartitionID PDBPage::getPartitionId ( ) const
inline

Definition at line 297 of file PDBPage.h.

char* PDBPage::getRawBytes ( ) const
inline

Definition at line 218 of file PDBPage.h.

size_t PDBPage::getRawSize ( ) const
inline

Definition at line 223 of file PDBPage.h.

int PDBPage::getRefCount ( )
inline

Definition at line 260 of file PDBPage.h.

SetID PDBPage::getSetID ( ) const
inline

Definition at line 208 of file PDBPage.h.

size_t PDBPage::getSize ( )

Definition at line 150 of file PDBPage.cc.

UserTypeID PDBPage::getTypeID ( ) const
inline

Definition at line 203 of file PDBPage.h.

int PDBPage::incEmbeddedNumObjects ( )
inline

Definition at line 117 of file PDBPage.h.

void PDBPage::incRefCount ( )
inline

Definition at line 86 of file PDBPage.h.

bool PDBPage::isDirty ( )
inline

Definition at line 278 of file PDBPage.h.

bool PDBPage::isInEviction ( )
inline

Definition at line 289 of file PDBPage.h.

bool PDBPage::isInFlush ( )
inline

Definition at line 284 of file PDBPage.h.

bool PDBPage::isPinned ( )
inline

Definition at line 273 of file PDBPage.h.

void PDBPage::preparePage ( )

Prepare page head.

Definition at line 107 of file PDBPage.cc.

void PDBPage::readLock ( )

Definition at line 128 of file PDBPage.cc.

void PDBPage::readUnlock ( )

Definition at line 132 of file PDBPage.cc.

void PDBPage::resetRefCount ( )
inline

Definition at line 265 of file PDBPage.h.

void PDBPage::setAccessSequenceId ( long  accessSequenceId)
inline

Definition at line 364 of file PDBPage.h.

void PDBPage::setDbID ( DatabaseID  dbID)
inline

Definition at line 307 of file PDBPage.h.

void PDBPage::setDirty ( bool  dirty)
inline

Definition at line 374 of file PDBPage.h.

void PDBPage::setHeadSize ( size_t  headSize)
inline

Definition at line 359 of file PDBPage.h.

void PDBPage::setInEviction ( bool  inEviction)
inline

Definition at line 384 of file PDBPage.h.

void PDBPage::setInFlush ( bool  inFlush)
inline

Definition at line 379 of file PDBPage.h.

void PDBPage::setInternalOffset ( int  offset)
inline

Definition at line 396 of file PDBPage.h.

void PDBPage::setMiniPageSize ( size_t  miniPageSize)
inline

Definition at line 354 of file PDBPage.h.

void PDBPage::setNodeID ( NodeID  nodeID)
inline

Definition at line 302 of file PDBPage.h.

void PDBPage::setNumHeadMiniPages ( int  numHeadMiniPages)
inline

Definition at line 343 of file PDBPage.h.

void PDBPage::setNumMiniPages ( int  numMiniPages)
inline

Definition at line 348 of file PDBPage.h.

void PDBPage::setNumObjects ( int  numObjects)
inline

Definition at line 134 of file PDBPage.h.

void PDBPage::setOffset ( size_t  offset)
inline

Definition at line 337 of file PDBPage.h.

void PDBPage::setPageID ( PageID  pageID)
inline

Definition at line 322 of file PDBPage.h.

void PDBPage::setPageSeqInPartition ( unsigned int  pageSeqInPartition)
inline

Definition at line 388 of file PDBPage.h.

void PDBPage::setPartitionId ( FilePartitionID  partitionId)
inline

Definition at line 392 of file PDBPage.h.

void PDBPage::setPinned ( bool  isPinned)
inline

Definition at line 369 of file PDBPage.h.

void PDBPage::setRawBytes ( char *  rawBytes)
inline

Definition at line 327 of file PDBPage.h.

void PDBPage::setSetID ( SetID  setID)
inline

Definition at line 317 of file PDBPage.h.

void PDBPage::setSize ( size_t  size)
inline

Definition at line 332 of file PDBPage.h.

void PDBPage::setTypeID ( UserTypeID  typeID)
inline

Definition at line 312 of file PDBPage.h.

void PDBPage::unpin ( )

Definition at line 156 of file PDBPage.cc.

+ Here is the call graph for this function:

void PDBPage::writeLock ( )

Definition at line 136 of file PDBPage.cc.

void PDBPage::writeUnlock ( )

Definition at line 140 of file PDBPage.cc.

Member Data Documentation

long PDBPage::accessSequenceId
private

Definition at line 423 of file PDBPage.h.

size_t PDBPage::curAppendOffset
private

Definition at line 438 of file PDBPage.h.

DatabaseID PDBPage::dbID
private

Definition at line 413 of file PDBPage.h.

bool PDBPage::dirty
private

Definition at line 420 of file PDBPage.h.

pthread_rwlock_t PDBPage::flushLock
private

Definition at line 422 of file PDBPage.h.

size_t PDBPage::headSize
private

Definition at line 411 of file PDBPage.h.

bool PDBPage::inEviction
private

Definition at line 425 of file PDBPage.h.

bool PDBPage::inFlush
private

Definition at line 424 of file PDBPage.h.

int PDBPage::internalOffset
private

Definition at line 439 of file PDBPage.h.

size_t PDBPage::miniPageSize
private

Definition at line 410 of file PDBPage.h.

NodeID PDBPage::nodeID
private

Definition at line 412 of file PDBPage.h.

int PDBPage::numHeadMiniPages
private

Definition at line 407 of file PDBPage.h.

int PDBPage::numMiniPages
private

Definition at line 408 of file PDBPage.h.

int PDBPage::numObjects = 0
private

Definition at line 409 of file PDBPage.h.

size_t PDBPage::offset
private

Definition at line 406 of file PDBPage.h.

PageID PDBPage::pageID
private

Definition at line 416 of file PDBPage.h.

unsigned int PDBPage::pageSeqInPartition
private

Definition at line 435 of file PDBPage.h.

FilePartitionID PDBPage::partitionId
private

Definition at line 434 of file PDBPage.h.

bool PDBPage::pinned
private

Definition at line 419 of file PDBPage.h.

char* PDBPage::rawBytes
private

Definition at line 405 of file PDBPage.h.

int PDBPage::refCount
private

Definition at line 418 of file PDBPage.h.

pthread_mutex_t PDBPage::refCountMutex
private

Definition at line 421 of file PDBPage.h.

SetID PDBPage::setID
private

Definition at line 415 of file PDBPage.h.

size_t PDBPage::size
private

Definition at line 417 of file PDBPage.h.

UserTypeID PDBPage::typeID
private

Definition at line 414 of file PDBPage.h.


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