📄 dbtup.hpp
字号:
// Signal Diagram://// In Signals:// -----------//// Logically there is one request TUPKEYREQ which requests to read/write data// of one tuple in the database. Since the definition of what to read and write// can be bigger than the maximum signal size we segment the signal. The definition// of what to read/write/interpreted program is sent before the TUPKEYREQ signal.//// ---> ATTRINFO// ...// ---> ATTRINFO// ---> TUPKEYREQ// The number of ATTRINFO signals can be anything between 0 and upwards.// The total size of the ATTRINFO is not allowed to be more than 16384 words.// There is always one and only one TUPKEYREQ.//// Response Signals (successful case)://// Simple/Dirty Read Operation// ---------------------------//// <---- TRANSID_AI (to API)// ...// <---- TRANSID_AI (to API)// <---- READCONF (to API)// <---- TUPKEYCONF (to LQH)// There is always exactly one READCONF25 sent last. The number of// TRANSID_AI is dependent on how much that was read. The maximum size// of the ATTRINFO sent back is 16384 words. The signals are sent// directly to the application with an address provided by the// TUPKEYREQ signal.// A positive response signal is also sent to LQH.//// Normal Read Operation// ---------------------//// <---- TRANSID_AI (to API)// ...// <---- TRANSID_AI (to API)// <---- TUPKEYCONF (to LQH)// The number of TRANSID_AI is dependent on how much that was read.// The maximum size of the ATTRINFO sent back is 16384 words. The// signals are sent directly to the application with an address// provided by the TUPKEYREQ signal.// A positive response signal is also sent to LQH.//// Normal update/insert/delete operation// -------------------------------------//// <---- TUPKEYCONF// After successful updating of the tuple LQH is informed of this.//// Delete with read// ----------------//// Will behave as a normal read although it also prepares the// deletion of the tuple.//// Interpreted Update// ------------------//// <---- TRANSID_AI (to API)// ...// <---- TRANSID_AI (to API)// <---- TUP_ATTRINFO (to LQH)// ...// <---- TUP_ATTRINFO (to LQH)// <---- TUPKEYCONF (to LQH)//// The interpreted Update contains five sections:// The first section performs read Attribute operations// that send results back to the API.//// The second section executes the interpreted program// where data from attributes can be updated and it// can also read attribute values into the registers.//// The third section performs unconditional updates of// attributes.//// The fourth section can read the attributes to be sent to the// API after updating the record.//// The fifth section contains subroutines used by the interpreter// in the second section.//// All types of interpreted programs contains the same five sections.// The only difference is that only interpreted updates can update// attributes. Interpreted inserts are not allowed.//// Interpreted Updates have to send back the information about the// attributes they have updated. This information will be shipped to// the log and also to any other replicas. Thus interpreted updates// are only performed in the primary replica. The fragment redo log// in LQH will contain information so that normal update/inserts/deletes// can be performed using TUPKEYREQ.//// Interpreted Read// ----------------//// From a signalling point of view the Interpreted Read behaves as// as a Normal Read. The interpreted Read is often used by Scan's.//// Interpreted Delete// ------------------//// <---- TUPKEYCONF// After successful prepartion to delete the tuple LQH is informed// of this.//// Interpreted Delete with Read// ----------------------------//// From a signalling point of view an interpreted delete with read// behaves as a normal read.//// Continuation after successful case://// After a read of any kind the operation record is ready to be used// again by a new operation.//// Any updates, inserts or deletes waits for either of two messages.// A commit specifying that the operation is to be performed for real// or an abort specifying that the operation is to be rolled back and// the record to be restored in its original format.// // This is handled by the module Transaction Manager.//// Response Signals (unsuccessful case)://// <---- TUPKEYREF (to LQH)// A signal is sent back to LQH informing about the unsuccessful// operation. In this case TUP waits for an abort signal to arrive// before the operation record is ready for the next operation.// This is handled by the Transaction Manager.//------------------------------------------------------------------//------------------------------------------------------------------// *****************************************************************// Signal Reception methods.// *****************************************************************//------------------------------------------------------------------//------------------------------------------------------------------ void execTUPKEYREQ(Signal* signal);//------------------------------------------------------------------//------------------------------------------------------------------ void execATTRINFO(Signal* signal);// Trigger signals//------------------------------------------------------------------//------------------------------------------------------------------ void execCREATE_TRIG_REQ(Signal* signal);//------------------------------------------------------------------//------------------------------------------------------------------ void execDROP_TRIG_REQ(Signal* signal);// *****************************************************************// Support methods for ATTRINFO.// *****************************************************************//------------------------------------------------------------------//------------------------------------------------------------------ void handleATTRINFOforTUPKEYREQ(Signal* signal, Uint32 length, Operationrec * const regOperPtr);// *****************************************************************// Setting up the environment for reads, inserts, updates and deletes.// *****************************************************************//------------------------------------------------------------------//------------------------------------------------------------------ int handleReadReq(Signal* signal, Operationrec* const regOperPtr, Tablerec* const regTabPtr, Page* pagePtr);//------------------------------------------------------------------//------------------------------------------------------------------ int handleUpdateReq(Signal* signal, Operationrec* const regOperPtr, Fragrecord* const regFragPtr, Tablerec* const regTabPtr, Page* const pagePtr);//------------------------------------------------------------------//------------------------------------------------------------------ int handleInsertReq(Signal* signal, Operationrec* const regOperPtr, Fragrecord* const regFragPtr, Tablerec* const regTabPtr, Page* const pagePtr);//------------------------------------------------------------------//------------------------------------------------------------------ int handleDeleteReq(Signal* signal, Operationrec* const regOperPtr, Fragrecord* const regFragPtr, Tablerec* const regTabPtr, Page* const pagePtr);//------------------------------------------------------------------//------------------------------------------------------------------ int updateStartLab(Signal* signal, Operationrec* const regOperPtr, Tablerec* const regTabPtr, Page* const pagePtr);// *****************************************************************// Interpreter Handling methods.// *****************************************************************//------------------------------------------------------------------//------------------------------------------------------------------ int interpreterStartLab(Signal* signal, Page* const pagePtr, Uint32 TupHeadOffset);//------------------------------------------------------------------//------------------------------------------------------------------ int interpreterNextLab(Signal* signal, Page* const pagePtr, Uint32 TupHeadOffset, Uint32* logMemory, Uint32* mainProgram, Uint32 TmainProgLen, Uint32* subroutineProg, Uint32 TsubroutineLen, Uint32 * tmpArea, Uint32 tmpAreaSz);// *****************************************************************// Signal Sending methods.// *****************************************************************//------------------------------------------------------------------//------------------------------------------------------------------ void sendReadAttrinfo(Signal* signal, Uint32 TnoOfData, const Operationrec * const regOperPtr);//------------------------------------------------------------------//------------------------------------------------------------------ void sendLogAttrinfo(Signal* signal, Uint32 TlogSize, Operationrec * const regOperPtr);//------------------------------------------------------------------//------------------------------------------------------------------ void sendTUPKEYCONF(Signal* signal, Operationrec * const regOperPtr, Uint32 TlogSize);//------------------------------------------------------------------//------------------------------------------------------------------// *****************************************************************// The methods that perform the actual read and update of attributes// in the tuple.// *****************************************************************//------------------------------------------------------------------//------------------------------------------------------------------ int readAttributes(Page* const pagePtr, Uint32 TupHeadOffset, const Uint32* inBuffer, Uint32 inBufLen, Uint32* outBuffer, Uint32 TmaxRead, bool xfrmFlag);//------------------------------------------------------------------//------------------------------------------------------------------ int readAttributesWithoutHeader(Page* const pagePtr, Uint32 TupHeadOffset, Uint32* inBuffer, Uint32 inBufLen, Uint32* outBuffer, Uint32* attrBuffer, Uint32 TmaxRead);//------------------------------------------------------------------//------------------------------------------------------------------ int updateAttributes(Page* const pagePtr, Uint32 TupHeadOffset, Uint32* inBuffer, Uint32 inBufLen);//------------------------------------------------------------------//------------------------------------------------------------------ bool readFixedSizeTHOneWordNotNULL(Uint32* outBuffer,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -