summaryrefslogtreecommitdiff
path: root/ndb/include/ndbapi/NdbConnection.hpp
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2004-05-27 11:36:10 +0200
committerunknown <joreland@mysql.com>2004-05-27 11:36:10 +0200
commitda2ae1899885b985b035a951a4a4278450c93c1c (patch)
tree7862a781e675e63710a9a14890d55b31d68af986 /ndb/include/ndbapi/NdbConnection.hpp
parent489aa9be1ce31a0b7f4e8901faa818b21a8f7c7a (diff)
parent910b86cdac28d2bed391298e67e4b22b6361ff80 (diff)
downloadmariadb-git-da2ae1899885b985b035a951a4a4278450c93c1c.tar.gz
Merge
ndb/include/ndbapi/Ndb.hpp: Auto merged ndb/include/ndbapi/NdbConnection.hpp: Auto merged ndb/include/ndbapi/NdbIndexOperation.hpp: Auto merged ndb/Epilogue.mk_old: Auto merged ndb/src/common/debugger/signaldata/Makefile_old: Auto merged ndb/src/common/mgmcommon/Makefile_old: Auto merged ndb/src/common/util/Makefile_old: Auto merged ndb/src/kernel/Makefile_old: Auto merged ndb/src/kernel/ndb-main/Main.cpp: Auto merged ndb/src/kernel/ndb-main/Makefile_old: Auto merged ndb/src/kernel/vm/Makefile_old: Auto merged ndb/src/mgmapi/Makefile_old: Auto merged ndb/src/mgmclient/Makefile_old: Auto merged ndb/src/mgmsrv/Makefile_old: Auto merged ndb/src/mgmsrv/MgmtSrvr.cpp: Auto merged ndb/src/ndbapi/ClusterMgr.cpp: Auto merged ndb/src/ndbapi/Makefile_old: Auto merged ndb/src/ndbapi/Ndb.cpp: Auto merged ndb/src/ndbapi/NdbApiSignal.cpp: Auto merged ndb/src/ndbapi/NdbConnection.cpp: Auto merged ndb/src/ndbapi/NdbDictionaryImpl.cpp: Auto merged ndb/src/ndbapi/NdbEventOperationImpl.cpp: Auto merged ndb/src/ndbapi/NdbIndexOperation.cpp: Auto merged ndb/src/ndbapi/NdbOperation.cpp: Auto merged ndb/src/ndbapi/NdbOperationDefine.cpp: Auto merged ndb/src/ndbapi/NdbOperationExec.cpp: Auto merged ndb/src/ndbapi/NdbOperationInt.cpp: Auto merged ndb/src/ndbapi/Ndbinit.cpp: Auto merged ndb/src/ndbapi/TransporterFacade.cpp: Auto merged ndb/src/ndbapi/TransporterFacade.hpp: Auto merged ndb/test/ndbapi/Makefile_old: Auto merged ndb/test/ndbapi/ScanFunctions.hpp: Auto merged ndb/test/ndbapi/ScanInterpretTest.hpp: Auto merged ndb/test/ndbapi/testDataBuffers.cpp: Auto merged ndb/test/ndbapi/old_dirs/testBackup/Makefile: Auto merged ndb/test/ndbapi/old_dirs/testGrep/Makefile: Auto merged ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile: Auto merged ndb/test/ndbapi/testDict.cpp: Auto merged ndb/test/ndbapi/testGrep.cpp: Auto merged ndb/test/ndbapi/testIndex.cpp: Auto merged ndb/test/ndbapi/testOIBasic.cpp: Auto merged ndb/test/ndbapi/testSystemRestart.cpp: Auto merged ndb/test/ndbapi/testTimeout.cpp: Auto merged ndb/test/src/Makefile_old: Auto merged ndb/test/src/UtilTransactions.cpp: Auto merged ndb/test/tools/create_index.cpp: Auto merged ndb/tools/select_all.cpp: Auto merged
Diffstat (limited to 'ndb/include/ndbapi/NdbConnection.hpp')
-rw-r--r--ndb/include/ndbapi/NdbConnection.hpp147
1 files changed, 26 insertions, 121 deletions
diff --git a/ndb/include/ndbapi/NdbConnection.hpp b/ndb/include/ndbapi/NdbConnection.hpp
index d8c395162f6..65f6bd2995f 100644
--- a/ndb/include/ndbapi/NdbConnection.hpp
+++ b/ndb/include/ndbapi/NdbConnection.hpp
@@ -22,12 +22,11 @@
class NdbConnection;
class NdbOperation;
-class NdbCursorOperation;
class NdbScanOperation;
+class NdbIndexScanOperation;
class NdbIndexOperation;
class NdbApiSignal;
class Ndb;
-class NdbScanReceiver;
/**
@@ -159,7 +158,7 @@ class NdbConnection
friend class NdbOperation;
friend class NdbScanOperation;
friend class NdbIndexOperation;
- friend class NdbScanReceiver;
+ friend class NdbIndexScanOperation;
public:
@@ -176,56 +175,31 @@ public:
NdbOperation* getNdbOperation(const char* aTableName);
/**
- * Get an NdbOperation for index scan of a table.
- * Note that the operation has to be defined before it is executed.
- *
- * @note All operations within the same transaction need to
- * be initialized with this method.
- *
- * @param anIndexName The index name.
- * @param aTableName The table name.
- * @return Pointer to an NdbOperation object if successful, otherwise NULL.
- */
- NdbOperation* getNdbOperation(const char* anIndexName,
- const char* aTableName);
-
-#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
- /**
* Get an operation from NdbScanOperation idlelist and
* get the NdbConnection object which
* was fetched by startTransaction pointing to this operation.
- * This operation will set the theTableId
- * in the NdbOperation object.synchronous.
*
* @param aTableName a table name.
* @return pointer to an NdbOperation object if successful, otherwise NULL
*/
NdbScanOperation* getNdbScanOperation(const char* aTableName);
-#endif
-#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/**
* Get an operation from NdbScanOperation idlelist and
* get the NdbConnection object which
* was fetched by startTransaction pointing to this operation.
- * This operation will set the theTableId
- * in the NdbOperation object.synchronous.
*
* @param anIndexName The index name.
* @param aTableName a table name.
* @return pointer to an NdbOperation object if successful, otherwise NULL
*/
- NdbScanOperation* getNdbScanOperation(const char* anIndexName,
- const char* aTableName);
-#endif
-
-
+ NdbIndexScanOperation* getNdbIndexScanOperation(const char* anIndexName,
+ const char* aTableName);
+
/**
* Get an operation from NdbIndexOperation idlelist and
* get the NdbConnection object that
* was fetched by startTransaction pointing to this operation.
- * This operation will set the theTableId
- * in the NdbOperation object. Synchronous.
*
* @param indexName An index name (as created by createIndex).
* @param tableName A table name.
@@ -338,75 +312,6 @@ public:
/** @} *********************************************************************/
/**
- * @name Scan Transactions
- * @{
- */
-
- /**
- * Execute a scan transaction. This will define
- * and start the scan transaction in the NDB kernel.
- *
- * @return 0 if successful otherwise -1.
- */
- int executeScan();
-
- /**
- * Get the next tuple in a scan transaction.
- *
- * After each call to NdbConnection::nextScanResult
- * the buffers and NdbRecAttr objects defined in
- * NdbOperation::getValue are updated with values
- * from the scanned tuple.
- *
- * @param fetchAllowed If set to false, then fetching is disabled
- *
- * The NDB API will contact the NDB Kernel for more tuples
- * when necessary to do so unless you set the fetchAllowed
- * to false.
- * This will force NDB to process any records it
- * already has in it's caches. When there are no more cached
- * records it will return 2. You must then call nextScanResult
- * with fetchAllowed = true in order to contact NDB for more
- * records.
- *
- * fetchAllowed = false is useful when you want to update or
- * delete all the records fetched in one transaction(This will save a
- * lot of round trip time and make updates or deletes of scanned
- * records a lot faster).
- * While nextScanResult(false)
- * returns 0 take over the record to another transaction. When
- * nextScanResult(false) returns 2 you must execute and commit the other
- * transaction. This will cause the locks to be transferred to the
- * other transaction, updates or deletes will be made and then the
- * locks will be released.
- * After that, call nextScanResult(true) which will fetch new records and
- * cache them in the NdbApi.
- *
- * @note If you don't take over the records to another transaction the
- * locks on those records will be released the next time NDB Kernel
- * is contacted for more records.
- *
- * @note Please contact for examples of efficient scan
- * updates and deletes.
- *
- * @return
- * - -1: if unsuccessful,<br>
- * - 0: if another tuple was received, and<br>
- * - 1: if there are no more tuples to scan.
- * - 2: if there are no more cached records in NdbApi
- */
- int nextScanResult(bool fetchAllowed = true);
-
- /**
- * Stops the scan. Used if no more tuples are wanted.
- * The transaction should still be closed with
- * Ndb::closeTransaction.
- *
- * @return 0 if successful otherwise -1.
- */
- int stopScan();
-
- /**
* @name Meta Information
* @{
*/
@@ -581,13 +486,7 @@ private:
int receiveTCINDXCONF(const class TcIndxConf *, Uint32 aDataLength);
int receiveTCINDXREF(NdbApiSignal*);
int receiveSCAN_TABREF(NdbApiSignal*);
- int receiveSCAN_TABCONF(NdbApiSignal*);
- int receiveSCAN_TABINFO(NdbApiSignal*);
-
- int checkNextScanResultComplete();
- int sendScanStart();
- int sendScanNext(bool stopScanFlag);
- int fetchNextScanResult();
+ int receiveSCAN_TABCONF(NdbApiSignal*, const Uint32*, Uint32 len);
int doSend(); // Send all operations
int sendROLLBACK(); // Send of an ROLLBACK
@@ -610,7 +509,7 @@ private:
// Release all cursor operations in connection
void releaseOps(NdbOperation*);
- void releaseCursorOperations(NdbCursorOperation*);
+ void releaseScanOperations(NdbIndexScanOperation*);
// Set the transaction identity of the transaction
void setTransactionId(Uint64 aTransactionId);
@@ -626,7 +525,7 @@ private:
int checkMagicNumber(); // Verify correct object
NdbOperation* getNdbOperation(class NdbTableImpl* aTable);
- NdbScanOperation* getNdbScanOperation(class NdbTableImpl* aTable);
+ NdbIndexScanOperation* getNdbScanOperation(class NdbTableImpl* aTable);
NdbIndexOperation* getNdbIndexOperation(class NdbIndexImpl* anIndex,
class NdbTableImpl* aTable);
@@ -679,7 +578,6 @@ private:
Uint32 theNoOfOpSent; // How many operations have been sent
Uint32 theNoOfOpCompleted; // How many operations have completed
Uint32 theNoOfOpFetched; // How many operations was actually fetched
- Uint32 theNoOfSCANTABCONFRecv; // How many SCAN_TABCONF have been received
Uint32 theMyRef; // Our block reference
Uint32 theTCConPtr; // Transaction Co-ordinator connection pointer.
Uint64 theTransactionId; // theTransactionId of the transaction
@@ -715,20 +613,16 @@ private:
Uint32 theNodeSequence; // The sequence no of the db node
bool theReleaseOnClose;
- // Cursor operations
+ // Scan operations
bool m_waitForReply;
- NdbCursorOperation* m_theFirstCursorOperation;
- NdbCursorOperation* m_theLastCursorOperation;
+ NdbIndexScanOperation* m_theFirstScanOperation;
+ NdbIndexScanOperation* m_theLastScanOperation;
- NdbCursorOperation* m_firstExecutedCursorOp;
- // Scan operations
- bool theScanFinished;
+ NdbIndexScanOperation* m_firstExecutedScanOp;
- NdbScanReceiver* theCurrentScanRec; // The current operation to
- // distribute to the app.
- NdbScanReceiver* thePreviousScanRec; // The previous operation read by
- // nextScanResult.
- NdbOperation* theScanningOp; // The operation actually performing the scan
+ // Scan operations
+ // The operation actually performing the scan
+ NdbScanOperation* theScanningOp;
Uint32 theBuddyConPtr;
static void sendTC_COMMIT_ACK(NdbApiSignal *,
@@ -739,6 +633,17 @@ private:
#ifdef VM_TRACE
void printState();
#endif
+
+ bool checkState_TransId(const Uint32 * transId) const {
+ const Uint32 tTmp1 = transId[0];
+ const Uint32 tTmp2 = transId[1];
+ Uint64 tRecTransId = (Uint64)tTmp1 + ((Uint64)tTmp2 << 32);
+ bool b = theStatus == Connected && theTransactionId == tRecTransId;
+#ifdef NDB_NO_DROPPED_SIGNAL
+ if(!b) abort();
+#endif
+ return b;
+ }
};
inline