📄 dbtup.hpp
字号:
struct { Uint32 tabUserPtr; Uint32 tabUserRef; } m_dropTable; State tableStatus;};typedef Ptr<Tablerec> TablerecPtr;struct storedProc { Uint32 storedLinkFirst; Uint32 storedLinkLast; Uint32 storedCounter; Uint32 nextPool; Uint16 storedCode; Uint16 storedProcLength;};typedef Ptr<storedProc> StoredProcPtr;ArrayPool<storedProc> c_storedProcPool;/* **************************** TABLE_DESCRIPTOR RECORD ******************************** *//* THIS VARIABLE IS USED TO STORE TABLE DESCRIPTIONS. A TABLE DESCRIPTION IS STORED AS A *//* CONTIGUOS ARRAY IN THIS VARIABLE. WHEN A NEW TABLE IS ADDED A CHUNK IS ALLOCATED IN *//* THIS RECORD. WHEN ATTRIBUTES ARE ADDED TO THE TABLE, A NEW CHUNK OF PROPER SIZE IS *//* ALLOCATED AND ALL DATA IS COPIED TO THIS NEW CHUNK AND THEN THE OLD CHUNK IS PUT IN *//* THE FREE LIST. EACH TABLE IS DESCRIBED BY A NUMBER OF TABLE DESCRIPTIVE ATTRIBUTES *//* AND A NUMBER OF ATTRIBUTE DESCRIPTORS AS SHOWN IN FIGURE BELOW *//* *//* WHEN ALLOCATING A TABLE DESCRIPTOR THE SIZE IS ALWAYS A MULTIPLE OF 16 WORDS. *//* *//* ---------------------------------------------- *//* | TRAILER USED FOR ALLOC/DEALLOC | *//* ---------------------------------------------- *//* | TABLE DESCRIPTIVE ATTRIBUTES | *//* ---------------------------------------------- *//* | ATTRIBUTE DESCRIPTION 1 | *//* ---------------------------------------------- *//* | ATTRIBUTE DESCRIPTION 2 | *//* ---------------------------------------------- *//* | | *//* | | *//* | | *//* ---------------------------------------------- *//* | ATTRIBUTE DESCRIPTION N | *//* ---------------------------------------------- *//* *//* THE TABLE DESCRIPTIVE ATTRIBUTES CONTAINS THE FOLLOWING ATTRIBUTES: *//* *//* ---------------------------------------------- *//* | HEADER (TYPE OF INFO) | *//* ---------------------------------------------- *//* | SIZE OF WHOLE CHUNK (INCL. TRAILER) | *//* ---------------------------------------------- *//* | TABLE IDENTITY | *//* ---------------------------------------------- *//* | FRAGMENT IDENTITY | *//* ---------------------------------------------- *//* | NUMBER OF ATTRIBUTES | *//* ---------------------------------------------- *//* | SIZE OF FIXED ATTRIBUTES | *//* ---------------------------------------------- *//* | NUMBER OF NULL FIELDS | *//* ---------------------------------------------- *//* | NOT USED | *//* ---------------------------------------------- *//* *//* THESE ATTRIBUTES ARE ALL ONE R-VARIABLE IN THE RECORD. *//* NORMALLY ONLY ONE TABLE DESCRIPTOR IS USED. DURING SCHEMA CHANGES THERE COULD *//* HOWEVER EXIST MORE THAN ONE TABLE DESCRIPTION SINCE THE SCHEMA CHANGE OF VARIOUS *//* FRAGMENTS ARE NOT SYNCHRONISED. THIS MEANS THAT ALTHOUGH THE SCHEMA HAS CHANGED *//* IN ALL FRAGMENTS, BUT THE FRAGMENTS HAVE NOT REMOVED THE ATTRIBUTES IN THE SAME *//* TIME-FRAME. THEREBY SOME ATTRIBUTE INFORMATION MIGHT DIFFER BETWEEN FRAGMENTS. *//* EXAMPLES OF ATTRIBUTES THAT MIGHT DIFFER ARE SIZE OF FIXED ATTRIBUTES, NUMBER OF *//* ATTRIBUTES, FIELD START WORD, START BIT. *//* *//* AN ATTRIBUTE DESCRIPTION CONTAINS THE FOLLOWING ATTRIBUTES: *//* *//* ---------------------------------------------- *//* | Field Type, 4 bits (LSB Bits) | *//* ---------------------------------------------- *//* | Attribute Size, 4 bits | *//* ---------------------------------------------- *//* | NULL indicator 1 bit | *//* ---------------------------------------------- *//* | Indicator if TUP stores attr. 1 bit | *//* ---------------------------------------------- *//* | Not used 6 bits | *//* ---------------------------------------------- *//* | No. of elements in fixed array 16 bits | *//* ---------------------------------------------- *//* ---------------------------------------------- *//* | Field Start Word, 21 bits (LSB Bits) | *//* ---------------------------------------------- *//* | NULL Bit, 11 bits | *//* ---------------------------------------------- *//* *//* THE ATTRIBUTE SIZE CAN BE 1,2,4,8,16,32,64 AND 128 BITS. *//* *//* THE UNUSED PARTS OF THE RECORDS ARE PUT IN A LINKED LIST OF FREE PARTS. EACH OF *//* THOSE FREE PARTS HAVE THREE RECORDS ASSIGNED AS SHOWN IN THIS STRUCTURE *//* ALL FREE PARTS ARE SET INTO A CHUNK LIST WHERE EACH CHUNK IS AT LEAST 16 WORDS *//* *//* ---------------------------------------------- *//* | HEADER = RNIL | *//* ---------------------------------------------- *//* | SIZE OF FREE AREA | *//* ---------------------------------------------- *//* | POINTER TO PREVIOUS FREE AREA | *//* ---------------------------------------------- *//* | POINTER TO NEXT FREE AREA | *//* ---------------------------------------------- *//* *//* IF THE POINTER TO THE NEXT AREA IS RNIL THEN THIS IS THE LAST FREE AREA. *//* *//*****************************************************************************************/struct TableDescriptor { Uint32 tabDescr;};typedef Ptr<TableDescriptor> TableDescriptorPtr;struct HostBuffer { bool inPackedList; Uint32 packetLenTA; Uint32 noOfPacketsTA; Uint32 packetBufferTA[30];};typedef Ptr<HostBuffer> HostBufferPtr; /* **************** UNDO PAGE RECORD ******************* */ /* THIS RECORD FORMS AN UNDO PAGE CONTAINING A NUMBER OF */ /* DATA WORDS. CURRENTLY THERE ARE 2048 WORDS ON A PAGE */ /* EACH OF 32 BITS (4 BYTES) WHICH FORMS AN UNDO PAGE */ /* WITH A TOTAL OF 8192 BYTES */ /* ***************************************************** */struct UndoPage { Uint32 undoPageWord[ZWORDS_ON_PAGE]; /* 32 KB */};typedef Ptr<UndoPage> UndoPagePtr; /* * Build index operation record. */ struct BuildIndexRec { // request cannot use signal class due to extra members Uint32 m_request[BuildIndxReq::SignalLength]; Uint32 m_triggerPtrI; // the index trigger Uint32 m_fragNo; // fragment number under Tablerec Uint32 m_pageId; // logical fragment page id Uint32 m_tupleNo; // tuple number on page (pageIndex >> 1) BuildIndxRef::ErrorCode m_errorCode; union { Uint32 nextPool; Uint32 nextList; }; Uint32 prevList; }; typedef Ptr<BuildIndexRec> BuildIndexPtr; ArrayPool<BuildIndexRec> c_buildIndexPool; ArrayList<BuildIndexRec> c_buildIndexList; Uint32 c_noOfBuildIndexRec;public: Dbtup(const class Configuration &); virtual ~Dbtup(); /* * TUX uses logical tuple address when talking to ACC and LQH. */ void tuxGetTupAddr(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32& tupAddr); /* * TUX index in TUP has single Uint32 array attribute which stores an * index node. TUX reads and writes the node directly via pointer. */ int tuxAllocNode(Signal* signal, Uint32 fragPtrI, Uint32& pageId, Uint32& pageOffset, Uint32*& node); void tuxFreeNode(Signal* signal, Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32* node); void tuxGetNode(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32*& node); /* * TUX reads primary table attributes for index keys. Tuple is * specified by location of original tuple and version number. Input * is attribute ids in AttributeHeader format. Output is attribute * data with headers. Uses readAttributes with xfrm option set. * Returns number of words or negative (-terrorCode) on error. */ int tuxReadAttrs(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32 tupVersion, const Uint32* attrIds, Uint32 numAttrs, Uint32* dataOut); /* * TUX reads primary key without headers into an array of words. Used * for md5 summing and when returning keyinfo. Returns number of * words or negative (-terrorCode) on error. */ int tuxReadPk(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32* dataOut, bool xfrmFlag); /* * ACC reads primary key without headers into an array of words. At * this point in ACC deconstruction, ACC still uses logical references * to fragment and tuple. */ int accReadPk(Uint32 tableId, Uint32 fragId, Uint32 fragPageId, Uint32 pageIndex, Uint32* dataOut, bool xfrmFlag); /* * TUX checks if tuple is visible to scan. */ bool tuxQueryTh(Uint32 fragPtrI, Uint32 tupAddr, Uint32 tupVersion, Uint32 transId1, Uint32 transId2, Uint32 savePointId);private: BLOCK_DEFINES(Dbtup); // Transit signals void execDEBUG_SIG(Signal* signal); void execCONTINUEB(Signal* signal); // Received signals void execDUMP_STATE_ORD(Signal* signal); void execSEND_PACKED(Signal* signal); void execSTTOR(Signal* signal); void execTUP_LCPREQ(Signal* signal); void execEND_LCPREQ(Signal* signal); void execSTART_RECREQ(Signal* signal); void execMEMCHECKREQ(Signal* signal); void execTUPSEIZEREQ(Signal* signal); void execTUPRELEASEREQ(Signal* signal); void execSTORED_PROCREQ(Signal* signal); void execTUPFRAGREQ(Signal* signal); void execTUP_ADD_ATTRREQ(Signal* signal); void execTUP_COMMITREQ(Signal* signal); void execTUP_ABORTREQ(Signal* signal); void execTUP_SRREQ(Signal* signal); void execTUP_PREPLCPREQ(Signal* signal); void execFSOPENCONF(Signal* signal); void execFSCLOSECONF(Signal* signal); void execFSWRITECONF(Signal* signal); void execFSREADCONF(Signal* signal); void execNDB_STTOR(Signal* signal); void execREAD_CONFIG_REQ(Signal* signal); void execSET_VAR_REQ(Signal* signal); void execDROP_TAB_REQ(Signal* signal); void execALTER_TAB_REQ(Signal* signal); void execFSREMOVECONF(Signal* signal); void execTUP_ALLOCREQ(Signal* signal); void execTUP_DEALLOCREQ(Signal* signal); void execTUP_WRITELOG_REQ(Signal* signal); // Ordered index related void execBUILDINDXREQ(Signal* signal); void buildIndex(Signal* signal, Uint32 buildPtrI); void buildIndexReply(Signal* signal, const BuildIndexRec* buildRec); // Tup scan void execACC_SCANREQ(Signal* signal); void execNEXT_SCANREQ(Signal* signal); void execACC_CHECK_SCAN(Signal* signal);//------------------------------------------------------------------//------------------------------------------------------------------// Methods to handle execution of TUPKEYREQ + ATTRINFO.//// Module Execution Manager//// The TUPKEYREQ signal is central to this block. This signal is used// by everybody that needs to read data residing in DBTUP. The data is// read using an interpreter approach.//// Operations only needing to read execute a simplified version of the// interpreter where the only instruction is read Attribute to send.// Operations only needing to update the record (insert or update)// execute a simplified version of the interpreter where the only// instruction is write Attribute.//// Currently TUPKEYREQ is used in the following situations.// 1) Normal transaction execution. Can be any of the types described// below.// 2) Execution of fragment redo log during system restart.// In this situation there will only be normal updates, inserts// and deletes performed.// 3) A special type of normal transaction execution is to write the// records arriving from the primary replica in the node restart// processing. This will always be normal write operations which// are translated to inserts or updates before arriving to TUP.// 4) Scan processing. The scan processing will use normal reads or// interpreted reads in their execution. There will be one TUPKEYREQ// signal for each record processed.// 5) Copy fragment processing. This is a special type of scan used in the// primary replica at system restart. It reads the entire reads and// converts those to writes to the starting node. In this special case// LQH acts as an API node and receives also the ATTRINFO sent in the// TRANSID_AI signals.//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -