📄 dbacc.hpp
字号:
SCAN_ACTIVE = 36, SCAN_WAIT_IN_QUEUE = 37, IDLE = 39, ACTIVE = 40, WAIT_COMMIT_ABORT = 41, ABORT = 42, ABORTADDFRAG = 43, REFUSEADDFRAG = 44, DELETEFRAG = 45, DELETETABLE = 46, UNDEFINEDROOT = 47, ADDFIRSTFRAG = 48, ADDSECONDFRAG = 49, DELETEFIRSTFRAG = 50, DELETESECONDFRAG = 51, ACTIVEROOT = 52, LCP_CREATION = 53};// Records/* --------------------------------------------------------------------------------- *//* UNDO HEADER RECORD *//* --------------------------------------------------------------------------------- */ struct UndoHeader { enum UndoHeaderType{ ZPAGE_INFO = 0, ZOVER_PAGE_INFO = 1, ZOP_INFO = 2, ZNO_UNDORECORD_TYPES = 3 }; UintR tableId; UintR rootFragId; UintR localFragId; UintR variousInfo; UintR logicalPageId; UintR prevUndoAddressForThisFrag; UintR prevUndoAddress; };/* --------------------------------------------------------------------------------- *//* DIRECTORY RANGE *//* --------------------------------------------------------------------------------- */ struct DirRange { Uint32 dirArray[256]; }; /* p2c: size = 1024 bytes */ typedef Ptr<DirRange> DirRangePtr;/* --------------------------------------------------------------------------------- *//* DIRECTORYARRAY *//* --------------------------------------------------------------------------------- */struct Directoryarray { Uint32 pagep[256];}; /* p2c: size = 1024 bytes */ typedef Ptr<Directoryarray> DirectoryarrayPtr;/* --------------------------------------------------------------------------------- *//* FRAGMENTREC. ALL INFORMATION ABOUT FRAMENT AND HASH TABLE IS SAVED IN FRAGMENT *//* REC A POINTER TO FRAGMENT RECORD IS SAVED IN ROOTFRAGMENTREC FRAGMENT *//* --------------------------------------------------------------------------------- */struct Fragmentrec {//-----------------------------------------------------------------------------// References to long key pages with free area. Some type of buddy structure// where references in higher index have more free space.//----------------------------------------------------------------------------- Uint32 longKeyPageArray[4];//-----------------------------------------------------------------------------// These variables keep track of allocated pages, the number of them and the// start file page of them. Used during local checkpoints.//----------------------------------------------------------------------------- Uint32 datapages[8]; Uint32 activeDataPage; Uint32 activeDataFilePage;//-----------------------------------------------------------------------------// Temporary variables used during shrink and expand process.//----------------------------------------------------------------------------- Uint32 expReceivePageptr; Uint32 expReceiveIndex; Uint32 expReceiveForward; Uint32 expSenderDirIndex; Uint32 expSenderDirptr; Uint32 expSenderIndex; Uint32 expSenderPageptr;//-----------------------------------------------------------------------------// List of lock owners and list of lock waiters to support LCP handling//----------------------------------------------------------------------------- Uint32 lockOwnersList; Uint32 firstWaitInQueOp; Uint32 lastWaitInQueOp; Uint32 sentWaitInQueOp;//-----------------------------------------------------------------------------// References to Directory Ranges (which in turn references directories, which// in its turn references the pages) for the bucket pages and the overflow// bucket pages.//----------------------------------------------------------------------------- Uint32 directory; Uint32 dirsize; Uint32 overflowdir; Uint32 lastOverIndex;//-----------------------------------------------------------------------------// These variables are used to support LCP and Restore from disk.// lcpDirIndex: used during LCP as the frag page id currently stored.// lcpMaxDirIndex: The dirsize at start of LCP.// lcpMaxOverDirIndex: The xx at start of LCP// During a LCP one writes the minimum of the number of pages in the directory// and the number of pages at the start of the LCP.// noStoredPages: Number of bucket pages written in LCP used at restore// noOfOverStoredPages: Number of overflow pages written in LCP used at restore// This variable is also used during LCP to calculate this number.//----------------------------------------------------------------------------- Uint32 lcpDirIndex; Uint32 lcpMaxDirIndex; Uint32 lcpMaxOverDirIndex; Uint32 noStoredPages; Uint32 noOfStoredOverPages;//-----------------------------------------------------------------------------// We have a list of overflow pages with free areas. We have a special record,// the overflow record representing these pages. The reason is that the// same record is also used to represent pages in the directory array that have// been released since they were empty (there were however higher indexes with// data in them). These are put in the firstFreeDirIndexRec-list.// An overflow record representing a page can only be in one of these lists.//----------------------------------------------------------------------------- Uint32 firstOverflowRec; Uint32 lastOverflowRec; Uint32 firstFreeDirindexRec;//-----------------------------------------------------------------------------// localCheckpId is used during execution of UNDO log to ensure that we only// apply UNDO log records from the restored LCP of the fragment.// lcpLqhPtr keeps track of LQH record for this fragment to checkpoint//----------------------------------------------------------------------------- Uint32 localCheckpId; Uint32 lcpLqhPtr;//-----------------------------------------------------------------------------// Counter keeping track of how many times we have expanded. We need to ensure// that we do not shrink so many times that this variable becomes negative.//----------------------------------------------------------------------------- Uint32 expandCounter;//-----------------------------------------------------------------------------// Reference to record for open file at LCP and restore//----------------------------------------------------------------------------- Uint32 fsConnPtr;//-----------------------------------------------------------------------------// These variables are important for the linear hashing algorithm.// localkeylen is the size of the local key (1 and 2 is currently supported)// maxloadfactor is the factor specifying when to expand// minloadfactor is the factor specifying when to shrink (hysteresis model)// maxp and p// maxp and p is the variables most central to linear hashing. p + maxp + 1 is the// current number of buckets. maxp is the largest value of the type 2**n - 1// which is smaller than the number of buckets. These values are used to find// correct bucket with the aid of the hash value.//// slack is the variable keeping track of whether we have inserted more than// the current size is suitable for or less. Slack together with the boundaries// set by maxloadfactor and minloadfactor decides when to expand/shrink// slackCheck When slack goes over this value it is time to expand.// slackCheck = (maxp + p + 1)*(maxloadfactor - minloadfactor) or // bucketSize * hysteresis//----------------------------------------------------------------------------- Uint32 localkeylen; Uint32 maxp; Uint32 maxloadfactor; Uint32 minloadfactor; Uint32 p; Uint32 slack; Uint32 slackCheck;//-----------------------------------------------------------------------------// myfid is the fragment id of the fragment// myroot is the reference to the root fragment record// nextfreefrag is the next free fragment if linked into a free list//----------------------------------------------------------------------------- Uint32 myfid; Uint32 myroot; Uint32 myTableId; Uint32 nextfreefrag;//-----------------------------------------------------------------------------// This variable is used during restore to keep track of page id of read pages.// During read of bucket pages this is used to calculate the page id and also// to verify that the page id of the read page is correct. During read of over-// flow pages it is only used to keep track of the number of pages read.//----------------------------------------------------------------------------- Uint32 nextAllocPage;//-----------------------------------------------------------------------------// Keeps track of undo position for fragment during LCP and restore.//----------------------------------------------------------------------------- Uint32 prevUndoposition;//-----------------------------------------------------------------------------// Page reference during LCP and restore of page zero where fragment data is// saved//----------------------------------------------------------------------------- Uint32 zeroPagePtr;//-----------------------------------------------------------------------------// Number of pages read from file during restore//----------------------------------------------------------------------------- Uint32 noOfExpectedPages;//-----------------------------------------------------------------------------// Fragment State, mostly applicable during LCP and restore//----------------------------------------------------------------------------- State fragState;//-----------------------------------------------------------------------------// Keep track of number of outstanding writes of UNDO log records to ensure that// we have saved all UNDO info before concluding local checkpoint.//----------------------------------------------------------------------------- Uint32 nrWaitWriteUndoExit;//-----------------------------------------------------------------------------// lastUndoIsStored is used to handle parallel writes of UNDO log and pages to// know when LCP is completed//----------------------------------------------------------------------------- Uint8 lastUndoIsStored;//-----------------------------------------------------------------------------// Set to ZTRUE when local checkpoint freeze occurs and set to ZFALSE when// local checkpoint concludes.//----------------------------------------------------------------------------- Uint8 createLcp;//-----------------------------------------------------------------------------// Flag indicating whether we are in the load phase of restore still.//----------------------------------------------------------------------------- Uint8 loadingFlag;//-----------------------------------------------------------------------------// elementLength: Length of element in bucket and overflow pages// keyLength: Length of key//----------------------------------------------------------------------------- Uint8 elementLength; Uint16 keyLength;//-----------------------------------------------------------------------------// This flag is used to avoid sending a big number of expand or shrink signals// when simultaneously committing many inserts or deletes.//----------------------------------------------------------------------------- Uint8 expandFlag;//-----------------------------------------------------------------------------// hashcheckbit is the bit to check whether to send element to split bucket or not// k (== 6) is the number of buckets per page// lhfragbits is the number of bits used to calculate the fragment id// lhdirbits is the number of bits used to calculate the page id//----------------------------------------------------------------------------- Uint8 hashcheckbit; Uint8 k; Uint8 lhfragbits; Uint8 lhdirbits;//-----------------------------------------------------------------------------// nodetype can only be STORED in this release. Is currently only set, never read// stopQueOp is indicator that locked operations will not start until LCP have// released the lock on the fragment//----------------------------------------------------------------------------- Uint8 nodetype; Uint8 stopQueOp;//-----------------------------------------------------------------------------// flag to avoid accessing table record if no char attributes//----------------------------------------------------------------------------- Uint8 hasCharAttr;}; typedef Ptr<Fragmentrec> FragmentrecPtr;/* --------------------------------------------------------------------------------- *//* FS_CONNECTREC *//* --------------------------------------------------------------------------------- */struct FsConnectrec { Uint32 fsNext; Uint32 fsPrev; Uint32 fragrecPtr; Uint32 fsPtr; State fsState; Uint8 activeFragId; Uint8 fsPart;}; /* p2c: size = 24 bytes */ typedef Ptr<FsConnectrec> FsConnectrecPtr;/* --------------------------------------------------------------------------------- *//* FS_OPREC *//* --------------------------------------------------------------------------------- */struct FsOprec { Uint32 fsOpnext; Uint32 fsOpfragrecPtr; Uint32 fsConptr; State fsOpstate; Uint16 fsOpMemPage;}; /* p2c: size = 20 bytes */ typedef Ptr<FsOprec> FsOprecPtr;/* --------------------------------------------------------------------------------- *//* LCP_CONNECTREC *//* --------------------------------------------------------------------------------- */struct LcpConnectrec { Uint32 nextLcpConn; Uint32 lcpUserptr; Uint32 rootrecptr; State syncUndopageState; State lcpstate; Uint32 lcpUserblockref; Uint16 localCheckPid; Uint8 noOfLcpConf;}; typedef Ptr<LcpConnectrec> LcpConnectrecPtr;/* --------------------------------------------------------------------------------- *//* OPERATIONREC *//* --------------------------------------------------------------------------------- */struct Operationrec { Uint32 keydata[8]; Uint32 localdata[2]; Uint32 elementIsforward; Uint32 elementPage; Uint32 elementPointer; Uint32 fid; Uint32 fragptr; Uint32 hashvaluePart; Uint32 hashValue; Uint32 insertDeleteLen; Uint32 keyinfoPage; Uint32 nextLockOwnerOp; Uint32 nextOp; Uint32 nextParallelQue; Uint32 nextQueOp; Uint32 nextSerialQue; Uint32 prevOp; Uint32 prevLockOwnerOp; Uint32 prevParallelQue; Uint32 prevQueOp; Uint32 prevSerialQue; Uint32 scanRecPtr; Uint32 transId1; Uint32 transId2; Uint32 longPagePtr; Uint32 longKeyPageIndex; State opState; Uint32 userptr; State transactionstate; Uint16 elementContainer; Uint16 tupkeylen; Uint32 xfrmtupkeylen; Uint32 userblockref; Uint32 scanBits; Uint8 elementIsDisappeared; Uint8 insertIsDone;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -