📄 dbtc.hpp
字号:
struct TcConnectRecord { //--------------------------------------------------- // First 16 byte cache line. Those variables are only // used in error cases. //--------------------------------------------------- UintR tcOprec; /* TC OPREC of operation being taken over */ Uint16 failData[4]; /* Failed nodes when taking over an operation */ UintR nextTcFailHash; //--------------------------------------------------- // Second 16 byte cache line. Those variables are used // from LQHKEYCONF to sending COMMIT and COMPLETED. //--------------------------------------------------- UintR lastLqhCon; /* Connect record in last replicas Lqh record */ Uint16 lastLqhNodeId; /* Node id of last replicas Lqh */ Uint16 m_execAbortOption;/* TcKeyReq::ExecuteAbortOption */ UintR commitAckMarker; /* CommitMarker I value */ //--------------------------------------------------- // Third 16 byte cache line. The hottest variables. //--------------------------------------------------- OperationState tcConnectstate; /* THE STATE OF THE CONNECT*/ UintR apiConnect; /* POINTER TO API CONNECT RECORD */ UintR nextTcConnect; /* NEXT TC RECORD*/ Uint8 dirtyOp; Uint8 lastReplicaNo; /* NUMBER OF THE LAST REPLICA IN THE OPERATION */ Uint8 noOfNodes; /* TOTAL NUMBER OF NODES IN OPERATION */ Uint8 operation; /* OPERATION TYPE */ /* 0 = READ REQUEST */ /* 1 = UPDATE REQUEST */ /* 2 = INSERT REQUEST */ /* 3 = DELETE REQUEST */ //--------------------------------------------------- // Fourth 16 byte cache line. The mildly hot variables. // tcNodedata expands 4 Bytes into the next cache line // with indexes almost never used. //--------------------------------------------------- UintR clientData; /* SENDERS OPERATION POINTER */ UintR dihConnectptr; /* CONNECTION TO DIH BLOCK ON THIS NODE */ UintR prevTcConnect; /* DOUBLY LINKED LIST OF TC CONNECT RECORDS*/ UintR savePointId; Uint16 tcNodedata[4]; // Trigger data FiredTriggerPtr accumulatingTriggerData; UintR noFiredTriggers; UintR noReceivedTriggers; UintR triggerExecutionCount; UintR triggeringOperation; UintR savedState[LqhKeyConf::SignalLength]; // Index data bool isIndexOp; // Used to mark on-going TcKeyReq as index table access UintR indexOp; UintR currentIndexId; UintR attrInfoLen; }; friend struct TcConnectRecord; typedef Ptr<TcConnectRecord> TcConnectRecordPtr; // ********************** CACHE RECORD ************************************** //--------------------------------------------------------------------------- // This record is used between reception of TCKEYREQ and sending of LQHKEYREQ // It is separatedso as to improve the cache hit rate and also to minimise // the necessary memory storage in NDB Cluster. //--------------------------------------------------------------------------- struct CacheRecord { //--------------------------------------------------- // First 16 byte cache line. Variables used by // ATTRINFO processing. //--------------------------------------------------- UintR firstAttrbuf; /* POINTER TO LINKED LIST OF ATTRIBUTE BUFFERS */ UintR lastAttrbuf; /* POINTER TO LINKED LIST OF ATTRIBUTE BUFFERS */ UintR currReclenAi; Uint16 attrlength; /* ATTRIBUTE INFORMATION LENGTH */ Uint16 save1; //--------------------------------------------------- // Second 16 byte cache line. Variables initiated by // TCKEYREQ and used in LQHKEYREQ. //--------------------------------------------------- UintR attrinfo15[4]; //--------------------------------------------------- // Third 16 byte cache line. Variables initiated by // TCKEYREQ and used in LQHKEYREQ. //--------------------------------------------------- UintR attrinfo0; UintR schemaVersion;/* SCHEMA VERSION USED IN TRANSACTION */ UintR tableref; /* POINTER TO THE TABLE IN WHICH THE FRAGMENT EXISTS*/ Uint16 apiVersionNo; Uint16 keylen; /* KEY LENGTH SENT BY REQUEST SIGNAL */ //--------------------------------------------------- // Fourth 16 byte cache line. Variables initiated by // TCKEYREQ and used in LQHKEYREQ. //--------------------------------------------------- UintR keydata[4]; /* RECEIVES FIRST 16 BYTES OF TUPLE KEY */ //--------------------------------------------------- // First 16 byte cache line in second 64 byte cache // line. Diverse use. //--------------------------------------------------- UintR fragmentid; /* THE COMPUTED FRAGMENT ID */ UintR hashValue; /* THE HASH VALUE USED TO LOCATE FRAGMENT */ Uint8 distributionKeyIndicator; Uint8 m_special_hash; // collation or distribution key Uint8 unused2; Uint8 lenAiInTckeyreq; /* LENGTH OF ATTRIBUTE INFORMATION IN TCKEYREQ */ Uint8 fragmentDistributionKey; /* DIH generation no */ /** * EXECUTION MODE OF OPERATION * 0 = NORMAL EXECUTION, 1 = INTERPRETED EXECUTION */ Uint8 opExec; /** * LOCK TYPE OF OPERATION IF READ OPERATION * 0 = READ LOCK, 1 = WRITE LOCK */ Uint8 opLock; /** * IS THE OPERATION A SIMPLE TRANSACTION * 0 = NO, 1 = YES */ Uint8 opSimple; //--------------------------------------------------- // Second 16 byte cache line in second 64 byte cache // line. Diverse use. //--------------------------------------------------- UintR distributionKey; UintR nextCacheRec; UintR unused3; Uint32 scanInfo; //--------------------------------------------------- // Third 16 byte cache line in second 64 // byte cache line. Diverse use. //--------------------------------------------------- Uint32 unused4; Uint32 scanTakeOverInd; UintR firstKeybuf; /* POINTER THE LINKED LIST OF KEY BUFFERS */ UintR lastKeybuf; /* VARIABLE POINTING TO THE LAST KEY BUFFER */ //--------------------------------------------------- // Fourth 16 byte cache line in second 64 // byte cache line. Not used currently. //--------------------------------------------------- UintR packedCacheVar[4]; }; typedef Ptr<CacheRecord> CacheRecordPtr; /* ************************ HOST RECORD ********************************** */ /********************************************************/ /* THIS RECORD CONTAINS ALIVE-STATUS ON ALL NODES IN THE*/ /* SYSTEM */ /********************************************************/ /* THIS RECORD IS ALIGNED TO BE 128 BYTES. */ /********************************************************/ struct HostRecord { HostState hostStatus; LqhTransState lqhTransStatus; bool inPackedList; UintR noOfPackedWordsLqh; UintR packedWordsLqh[26]; UintR noOfWordsTCKEYCONF; UintR packedWordsTCKEYCONF[30]; UintR noOfWordsTCINDXCONF; UintR packedWordsTCINDXCONF[30]; BlockReference hostLqhBlockRef; enum NodeFailBits { NF_TAKEOVER = 0x1, NF_CHECK_SCAN = 0x2, NF_CHECK_TRANSACTION = 0x4, NF_CHECK_DROP_TAB = 0x8, NF_NODE_FAIL_BITS = 0xF // All bits... }; Uint32 m_nf_bits; NdbNodeBitmask m_lqh_trans_conf; }; /* p2c: size = 128 bytes */ typedef Ptr<HostRecord> HostRecordPtr; /* *********** TABLE RECORD ********************************************* */ /********************************************************/ /* THIS RECORD CONTAINS THE CURRENT SCHEMA VERSION OF */ /* ALL TABLES IN THE SYSTEM. */ /********************************************************/ struct TableRecord { Uint32 currentSchemaVersion; Uint8 enabled; Uint8 dropping; Uint8 tableType; Uint8 storedTable; Uint8 noOfKeyAttr; Uint8 hasCharAttr; Uint8 noOfDistrKeys; bool checkTable(Uint32 schemaVersion) const { return enabled && !dropping && (table_version_major(schemaVersion) == table_version_major(currentSchemaVersion)); } Uint32 getErrorCode(Uint32 schemaVersion) const; struct DropTable { Uint32 senderRef; Uint32 senderData; SignalCounter waitDropTabCount; } dropTable; }; typedef Ptr<TableRecord> TableRecordPtr; /** * There is max 16 ScanFragRec's for * each scan started in TC. Each ScanFragRec is used by * a scan fragment "process" that scans one fragment at a time. * It will receive max 16 tuples in each request */ struct ScanFragRec { ScanFragRec(){ stopFragTimer(); lqhBlockref = 0; scanFragState = IDLE; scanRec = RNIL; } /** * ScanFragState * WAIT_GET_PRIMCONF : Waiting for DIGETPRIMCONF when starting a new * fragment scan * LQH_ACTIVE : The scan process has sent a command to LQH and is * waiting for the response * LQH_ACTIVE_CLOSE : The scan process has sent close to LQH and is * waiting for the response * DELIVERED : The result have been delivered, this scan frag process * are waiting for a SCAN_NEXTREQ to tell us to continue scanning * RETURNING_FROM_DELIVERY : SCAN_NEXTREQ received and continuing scan * soon * QUEUED_FOR_DELIVERY : Result queued in TC and waiting for delivery * to API * COMPLETED : The fragment scan processes has completed and finally * sent a SCAN_PROCCONF */ enum ScanFragState { IDLE = 0, WAIT_GET_PRIMCONF = 1, LQH_ACTIVE = 2, DELIVERED = 4, QUEUED_FOR_DELIVERY = 6, COMPLETED = 7 }; // Timer for checking timeout of this fragment scan Uint32 scanFragTimer; // Id of the current scanned fragment Uint32 scanFragId; // Blockreference of LQH BlockReference lqhBlockref; // getNodeInfo.m_connectCount, set at seize used so that // I don't accidently kill a starting node Uint32 m_connectCount; // State of this fragment scan ScanFragState scanFragState; // Id of the ScanRecord this fragment scan belongs to Uint32 scanRec; // The value of fragmentCompleted in the last received SCAN_FRAGCONF Uint8 m_scan_frag_conf_status; inline void startFragTimer(Uint32 timeVal){ scanFragTimer = timeVal; } inline void stopFragTimer(void){ scanFragTimer = 0; } Uint32 m_ops; Uint32 m_chksum; Uint32 m_apiPtr; Uint32 m_totalLen; union { Uint32 nextPool; Uint32 nextList; }; Uint32 prevList; }; typedef Ptr<ScanFragRec> ScanFragRecPtr; typedef LocalDLList<ScanFragRec> ScanFragList; /** * Each scan allocates one ScanRecord to store information * about the current scan * */ struct ScanRecord { ScanRecord() {} /** NOTE! This is the old comment for ScanState. - MASV * STATE TRANSITIONS OF SCAN_STATE. SCAN_STATE IS THE STATE * VARIABLE OF THE RECEIVE AND DELIVERY PROCESS. * THE PROCESS HAS THREE STEPS IT GOES THROUGH. * 1) THE INITIAL STATES WHEN RECEIVING DATA FOR THE SCAN. * - WAIT_SCAN_TAB_INFO * - WAIT_AI * - WAIT_FRAGMENT_COUNT * 2) THE EXECUTION STATES WHEN THE SCAN IS PERFORMED. * - SCAN_NEXT_ORDERED * - DELIVERED * - QUEUED_DELIVERED * 3) THE CLOSING STATE WHEN THE SCAN PROCESS IS CLOSING UP * EVERYTHING. * - CLOSING_SCAN * INITIAL START WHEN SCAN_TABREQ RECEIVED * -> WAIT_SCAN_TAB_INFO (IF ANY SCAN_TABINFO TO BE RECEIVED) * -> WAIT_AI (IF NO SCAN_TAB_INFO BUT ATTRINFO IS RECEIVED) * -> WAIT_FRAGMENT_COUNT (IF NEITHER SCAN_TABINFO OR ATTRINFO * RECEIVED) * * WAIT_SCAN_TAB_INFO TRANSITIONS: * -> WAIT_SCAN_TABINFO (WHEN MORE SCAN_TABINFO RECEIVED) * -> WAIT_AI (WHEN ATTRINFO RECEIVED AFTER RECEIVING ALL * SCAN_TABINFO) * -> WAIT_FRAGMENT_COUNT (WHEN NO ATTRINFO RECEIVED AFTER * RECEIVING ALL SCAN_TABINFO ) * WAIT_AI TRANSITIONS: * -> WAIT_AI (WHEN MORE ATTRINFO RECEIVED) * -> WAIT_FRAGMENT_COUNT (WHEN ALL ATTRINFO RECEIVED) * * WAIT_FRAGMENT_COUNT TRANSITIONS: * -> SCAN_NEXT_ORDERED * * SCAN_NEXT_ORDERED TRANSITIONS: * -> DELIVERED (WHEN FIRST SCAN_FRAGCONF ARRIVES WITH OPERATIONS * TO REPORT IN IT) * -> CLOSING_SCAN (WHEN SCAN IS CLOSED BY SCAN_NEXTREQ OR BY SOME * ERROR) * * DELIVERED TRANSITIONS: * -> SCAN_NEXT_ORDERED (IF SCAN_NEXTREQ ARRIVES BEFORE ANY NEW * OPERATIONS TO REPORT ARRIVES) * -> QUEUED_DELIVERED (IF NEW OPERATION TO REPORT ARRIVES BEFORE * SCAN_NEXTREQ) * -> CLOSING_SCAN (WHEN SCAN IS CLOSED BY SCAN_NEXTREQ OR BY SOME * ERROR) * * QUEUED_DELIVERED TRANSITIONS: * -> DELIVERED (WHEN SCAN_NEXTREQ ARRIVES AND QUEUED OPERATIONS * TO REPORT ARE SENT TO THE APPLICATION) * -> CLOSING_SCAN (WHEN SCAN IS CLOSED BY SCAN_NEXTREQ OR BY * SOME ERROR) */ enum ScanState { IDLE = 0, WAIT_SCAN_TAB_INFO = 1, WAIT_AI = 2, WAIT_FRAGMENT_COUNT = 3, RUNNING = 4, CLOSING_SCAN = 5 };
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -