📄 ndb.hpp
字号:
* which has to wake up before the poll-call will return. * If minNoOfEventsToWakeup is * set to a value larger than 1 then this is the minimum * number of transactions that need to complete before the * poll will return. * Setting it to zero means that one should wait for all * outstanding transactions to return before waking up. * @return Number of transactions polled. */ int pollNdb(int aMillisecondNumber = WAITFOR_RESPONSE_TIMEOUT, int minNoOfEventsToWakeup = 1); /** * This send method will send all prepared database operations. * The default method is to do it non-force and instead * use the adaptive algorithm. (See Section @ref secAdapt.) * The second option is to force the sending and * finally there is the third alternative which is * also non-force but also making sure that the * adaptive algorithm do not notice the send. * In this case the sending will be performed on a * cyclical 10 millisecond event. * * @param forceSend When operations should be sent to NDB Kernel. * (See @ref secAdapt.) * - 0: non-force, adaptive algorithm notices it (default); * - 1: force send, adaptive algorithm notices it; * - 2: non-force, adaptive algorithm do not notice the send. */ void sendPreparedTransactions(int forceSend = 0); /** * This is a send-poll variant that first calls * Ndb::sendPreparedTransactions and then Ndb::pollNdb. * It is however somewhat faster than calling the methods * separately, since some mutex-operations are avoided. * See documentation of Ndb::pollNdb and Ndb::sendPreparedTransactions * for more details. * * @param aMillisecondNumber Timeout specifier * Polling without wait is achieved by setting the * millisecond timer to zero. * @param minNoOfEventsToWakeup Minimum number of transactions * which has to wake up before the poll-call will return. * If minNoOfEventsToWakeup is * set to a value larger than 1 then this is the minimum * number of transactions that need to complete before the * poll-call will return. * Setting it to zero means that one should wait for all * outstanding transactions to return before waking up. * @param forceSend When operations should be sent to NDB Kernel. * (See @ref secAdapt.) * - 0: non-force, adaptive algorithm notices it (default); * - 1: force send, adaptive algorithm notices it; * - 2: non-force, adaptive algorithm does not notice the send. * @return Number of transactions polled. */ int sendPollNdb(int aMillisecondNumber = WAITFOR_RESPONSE_TIMEOUT, int minNoOfEventsToWakeup = 1, int forceSend = 0); /** @} *********************************************************************/#endif /** * @name Error Handling * @{ */ /** * Get the NdbError object * * @note The NdbError object is valid until a new NDB API method is called. */ const NdbError & getNdbError() const; /** * Get a NdbError object for a specific error code * * The NdbError object is valid until you call a new NDB API method. */ const NdbError & getNdbError(int errorCode); /** @} *********************************************************************/#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL /** * Get the application node identity. * * @return Node id of this application. */ int getNodeId(); bool usingFullyQualifiedNames(); /** * Different types of tampering with the NDB Cluster. * <b>Only for debugging purposes only.</b> */ enum TamperType { LockGlbChp = 1, ///< Lock GCP UnlockGlbChp, ///< Unlock GCP CrashNode, ///< Crash an NDB node ReadRestartGCI, ///< Request the restart GCI id from NDB Cluster InsertError ///< Execute an error in NDB Cluster ///< (may crash system) }; /** * For testing purposes it is possible to tamper with the NDB Cluster * (i.e. send a special signal to DBDIH, the NDB distribution handler). * <b>This feature should only used for debugging purposes.</b> * In a release versions of NDB Cluster, * this call always return -1 and does nothing. * * @param aAction Action to be taken according to TamperType above * * @param aNode Which node the action will be taken * -1: Master DIH. * 0-16: Nodnumber. * @return -1 indicates error, other values have meaning dependent * on type of tampering. */ int NdbTamper(TamperType aAction, int aNode); /** * Return a unique tuple id for a table. The id sequence is * ascending but may contain gaps. * * @param aTableName table name * * @param cacheSize number of values to cache in this Ndb object * * @return tuple id or 0 on error */ Uint64 getAutoIncrementValue(const char* aTableName, Uint32 cacheSize = 1); Uint64 getAutoIncrementValue(const NdbDictionary::Table * aTable, Uint32 cacheSize = 1); Uint64 readAutoIncrementValue(const char* aTableName); Uint64 readAutoIncrementValue(const NdbDictionary::Table * aTable); bool setAutoIncrementValue(const char* aTableName, Uint64 val, bool increase = false); bool setAutoIncrementValue(const NdbDictionary::Table * aTable, Uint64 val, bool increase = false); Uint64 getTupleIdFromNdb(const char* aTableName, Uint32 cacheSize = 1000); Uint64 getTupleIdFromNdb(Uint32 aTableId, Uint32 cacheSize = 1000); Uint64 readTupleIdFromNdb(Uint32 aTableId); bool setTupleIdInNdb(const char* aTableName, Uint64 val, bool increase); bool setTupleIdInNdb(Uint32 aTableId, Uint64 val, bool increase); Uint64 opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op); /** */ NdbTransaction* hupp( NdbTransaction* ); Uint32 getReference() const { return theMyRef;} struct Free_list_usage { const char * m_name; Uint32 m_created; Uint32 m_free; Uint32 m_sizeof; }; Free_list_usage * get_free_list_usage(Free_list_usage*);#endif /***************************************************************************** * These are service routines used by the other classes in the NDBAPI. ****************************************************************************/private: void setup(Ndb_cluster_connection *ndb_cluster_connection, const char* aCatalogName, const char* aSchemaName); void connected(Uint32 block_reference); NdbTransaction* startTransactionLocal(Uint32 aPrio, Uint32 aFragmentId); // Connect the connection object to the Database. int NDB_connect(Uint32 tNode); NdbTransaction* doConnect(Uint32 nodeId); void doDisconnect(); NdbReceiver* getNdbScanRec();// Get a NdbScanReceiver from idle list NdbLabel* getNdbLabel(); // Get a NdbLabel from idle list NdbBranch* getNdbBranch(); // Get a NdbBranch from idle list NdbSubroutine* getNdbSubroutine();// Get a NdbSubroutine from idle NdbCall* getNdbCall(); // Get a NdbCall from idle list NdbApiSignal* getSignal(); // Get an operation from idle list NdbRecAttr* getRecAttr(); // Get a receeive attribute object from // idle list of the Ndb object. NdbOperation* getOperation(); // Get an operation from idle list NdbIndexScanOperation* getScanOperation(); // Get a scan operation from idle NdbIndexOperation* getIndexOperation();// Get an index operation from idle class NdbGlobalEventBufferHandle* getGlobalEventBufferHandle(); NdbBlob* getNdbBlob();// Get a blob handle etc void releaseSignal(NdbApiSignal* anApiSignal); void releaseSignalsInList(NdbApiSignal** pList); void releaseNdbScanRec(NdbReceiver* aNdbScanRec); void releaseNdbLabel(NdbLabel* anNdbLabel); void releaseNdbBranch(NdbBranch* anNdbBranch); void releaseNdbSubroutine(NdbSubroutine* anNdbSubroutine); void releaseNdbCall(NdbCall* anNdbCall); void releaseRecAttr (NdbRecAttr* aRecAttr); void releaseOperation(NdbOperation* anOperation); void releaseScanOperation(NdbIndexScanOperation*); void releaseNdbBlob(NdbBlob* aBlob); void check_send_timeout(); void remove_sent_list(Uint32); Uint32 insert_completed_list(NdbTransaction*); Uint32 insert_sent_list(NdbTransaction*); // Handle a received signal. Used by both // synchronous and asynchronous interface void handleReceivedSignal(NdbApiSignal* anApiSignal, struct LinearSectionPtr ptr[3]); // Receive response signals int receiveResponse(int waitTime = WAITFOR_RESPONSE_TIMEOUT); int sendRecSignal(Uint16 aNodeId, Uint32 aWaitState, NdbApiSignal* aSignal, Uint32 nodeSequence); // Sets Restart GCI in Ndb object void RestartGCI(int aRestartGCI); // Get block number of this NDBAPI object int getBlockNumber(); /**************************************************************************** * These are local service routines used by this class. ***************************************************************************/ int createConIdleList(int aNrOfCon); int createOpIdleList( int nrOfOp ); void freeOperation(); // Free the first idle operation. void freeScanOperation(); // Free the first idle scan operation. void freeIndexOperation(); // Free the first idle index operation. void freeNdbCon(); // Free the first idle connection. void freeSignal(); // Free the first idle signal void freeRecAttr(); // Free the first idle receive attr obj void freeNdbLabel(); // Free the first idle NdbLabel obj void freeNdbBranch();// Free the first idle NdbBranch obj void freeNdbSubroutine();// Free the first idle NdbSubroutine obj void freeNdbCall(); // Free the first idle NdbCall obj void freeNdbScanRec(); // Free the first idle NdbScanRec obj void freeNdbBlob(); // Free the first etc NdbTransaction* getNdbCon(); // Get a connection from idle list /** * Get a connected NdbTransaction to nodeId * Returns NULL if none found */ NdbTransaction* getConnectedNdbTransaction(Uint32 nodeId); // Release and disconnect from DBTC a connection // and seize it to theConIdleList void releaseConnectToNdb (NdbTransaction*); // Release a connection to idle list void releaseNdbCon (NdbTransaction*); int checkInitState(); // Check that we are initialized void report_node_failure(Uint32 node_id); // Report Failed node void report_node_failure_completed(Uint32 node_id); // Report Failed node(NF comp.) void checkFailedNode(); // Check for failed nodes int NDB_connect(); // Perform connect towards NDB Kernel // Release arrays of NdbTransaction pointers void releaseTransactionArrays(); Uint32 pollCompleted(NdbTransaction** aCopyArray); void sendPrepTrans(int forceSend); void reportCallback(NdbTransaction** aCopyArray, Uint32 aNoOfComplTrans); void waitCompletedTransactions(int milliSecs, int noOfEventsToWaitFor); void completedTransaction(NdbTransaction* aTransaction); void completedScanTransaction(NdbTransaction* aTransaction); void abortTransactionsAfterNodeFailure(Uint16 aNodeId); static const char * externalizeTableName(const char * internalTableName, bool fullyQualifiedNames); const char * externalizeTableName(const char * internalTableName); const BaseString internalize_table_name(const char * external_name) const; static const char * externalizeIndexName(const char * internalIndexName, bool fullyQualifiedNames); const char * externalizeIndexName(const char * internalIndexName); const BaseString internalize_index_name(const NdbTableImpl * table, const char * external_name) const; static const BaseString getDatabaseFromInternalName(const char * internalName); static const BaseString getSchemaFromInternalName(const char * internalName); void* int2void (Uint32 val); NdbReceiver* void2rec (void* val); NdbTransaction* void2con (void* val); NdbOperation* void2rec_op (void* val); NdbIndexOperation* void2rec_iop (void* val);/****************************************************************************** * These are the private variables in this class. *****************************************************************************/ NdbTransaction** thePreparedTransactionsArray; NdbTr
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -