summaryrefslogtreecommitdiff
path: root/ndb/include
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
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')
-rw-r--r--ndb/include/kernel/BlockNumbers.h1
-rw-r--r--ndb/include/kernel/GlobalSignalNumbers.h84
-rw-r--r--ndb/include/kernel/LogLevel.hpp28
-rw-r--r--ndb/include/kernel/kernel_config_parameters.h56
-rw-r--r--ndb/include/kernel/signaldata/CheckNodeGroups.hpp12
-rw-r--r--ndb/include/kernel/signaldata/CntrStart.hpp69
-rw-r--r--ndb/include/kernel/signaldata/CreateFragmentation.hpp2
-rw-r--r--ndb/include/kernel/signaldata/DictTabInfo.hpp2
-rw-r--r--ndb/include/kernel/signaldata/DropTab.hpp3
-rw-r--r--ndb/include/kernel/signaldata/EventSubscribeReq.hpp6
-rw-r--r--ndb/include/kernel/signaldata/FsOpenReq.hpp1
-rw-r--r--ndb/include/kernel/signaldata/KeyInfo.hpp1
-rw-r--r--ndb/include/kernel/signaldata/PrepDropTab.hpp6
-rw-r--r--ndb/include/kernel/signaldata/ReadConfig.hpp24
-rw-r--r--ndb/include/kernel/signaldata/ReadNodesConf.hpp48
-rw-r--r--ndb/include/kernel/signaldata/ScanTab.hpp81
-rw-r--r--ndb/include/kernel/signaldata/SetLogLevelOrd.hpp1
-rw-r--r--ndb/include/kernel/signaldata/TcCommit.hpp1
-rw-r--r--ndb/include/kernel/signaldata/TcKeyReq.hpp1
-rw-r--r--ndb/include/kernel/signaldata/UpgradeStartup.hpp36
-rw-r--r--ndb/include/mgmapi/mgmapi.h35
-rw-r--r--ndb/include/mgmapi/mgmapi_config_parameters.h142
-rw-r--r--ndb/include/mgmapi/mgmapi_config_parameters_debug.h8
-rw-r--r--ndb/include/mgmcommon/ConfigRetriever.hpp32
-rw-r--r--ndb/include/mgmcommon/IPCConfig.hpp4
-rw-r--r--ndb/include/ndbapi/Ndb.hpp18
-rw-r--r--ndb/include/ndbapi/NdbApi.hpp4
-rw-r--r--ndb/include/ndbapi/NdbConnection.hpp147
-rw-r--r--ndb/include/ndbapi/NdbCursorOperation.hpp73
-rw-r--r--ndb/include/ndbapi/NdbIndexOperation.hpp2
-rw-r--r--ndb/include/ndbapi/NdbIndexScanOperation.hpp140
-rw-r--r--ndb/include/ndbapi/NdbOperation.hpp234
-rw-r--r--ndb/include/ndbapi/NdbRecAttr.hpp51
-rw-r--r--ndb/include/ndbapi/NdbReceiver.hpp69
-rw-r--r--ndb/include/ndbapi/NdbResultSet.hpp49
-rw-r--r--ndb/include/ndbapi/NdbScanOperation.hpp223
-rw-r--r--ndb/include/util/Base64.hpp5
-rw-r--r--ndb/include/util/Bitmask.hpp27
-rw-r--r--ndb/include/util/ConfigValues.hpp252
-rw-r--r--ndb/include/util/Properties.hpp17
-rw-r--r--ndb/include/util/UtilBuffer.hpp9
41 files changed, 1182 insertions, 822 deletions
diff --git a/ndb/include/kernel/BlockNumbers.h b/ndb/include/kernel/BlockNumbers.h
index 84c3fc656a9..e89a82ee0cb 100644
--- a/ndb/include/kernel/BlockNumbers.h
+++ b/ndb/include/kernel/BlockNumbers.h
@@ -37,6 +37,7 @@
#define DBTUP 0xF9
#define DBDICT 0xFA
#define NDBCNTR 0xFB
+#define CNTR 0xFB
#define QMGR 0xFC
#define NDBFS 0xFD
#define CMVMI 0xFE
diff --git a/ndb/include/kernel/GlobalSignalNumbers.h b/ndb/include/kernel/GlobalSignalNumbers.h
index 87385de1f14..7b70f4c3ac0 100644
--- a/ndb/include/kernel/GlobalSignalNumbers.h
+++ b/ndb/include/kernel/GlobalSignalNumbers.h
@@ -177,43 +177,43 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_API_FAILCONF 113
#define GSN_API_FAILREQ 114
-#define GSN_APPL_CHANGEREP 115
+#define GSN_CNTR_START_REQ 115
// 116 not unused
-#define GSN_APPL_HB 117
-#define GSN_APPL_HBREQ 118
-#define GSN_APPL_REGCONF 119
-#define GSN_APPL_REGREF 120
-#define GSN_APPL_REGREQ 121
-#define GSN_APPL_RUN 122
-#define GSN_APPL_STARTCONF 123
-#define GSN_APPL_STARTREG 124
+#define GSN_CNTR_START_REF 117
+#define GSN_CNTR_START_CONF 118
+#define GSN_CNTR_START_REP 119
+// 120 unused
+// 121 unused
+// 122 unused
+// 123 unused
+// 124 unused
#define GSN_CHECK_LCP_STOP 125
-#define GSN_CLOSE_COMCONF 126
-#define GSN_CLOSE_COMREQ 127
-#define GSN_CM_ACKADD 128
-#define GSN_CM_ACKALARM 129
-#define GSN_CM_ADD 130
-#define GSN_CM_APPCHG 131
+#define GSN_CLOSE_COMCONF 126 // local
+#define GSN_CLOSE_COMREQ 127 // local
+#define GSN_CM_ACKADD 128 // distr.
+// 129 unused
+#define GSN_CM_ADD 130 // distr.
+// 131 unused
// 132 not unused
// 133 not unused
-#define GSN_CM_HEARTBEAT 134
-#define GSN_CM_INFOCONF 135
-#define GSN_CM_INFOREQ 136
-#define GSN_CM_INIT 137
-#define GSN_CM_NODEINFOCONF 138
-#define GSN_CM_NODEINFOREF 139
-#define GSN_CM_NODEINFOREQ 140
-#define GSN_CM_REGCONF 141
-#define GSN_CM_REGREF 142
-#define GSN_CM_REGREQ 143
-#define GSN_CM_RUN 144
-#define GSN_CMVMI_CFGCONF 145
-#define GSN_CMVMI_CFGREQ 146
-#define GSN_CNTR_CHANGEREP 147
-#define GSN_CNTR_MASTERCONF 148
-#define GSN_CNTR_MASTERREF 149
-#define GSN_CNTR_MASTERREQ 150
-#define GSN_CNTR_WAITREP 151
+#define GSN_CM_HEARTBEAT 134 // distr.
+// 135 unused
+// 136 unused
+// 137 unused
+#define GSN_CM_NODEINFOCONF 138 // distr.
+#define GSN_CM_NODEINFOREF 139 // distr.
+#define GSN_CM_NODEINFOREQ 140 // distr.
+#define GSN_CM_REGCONF 141 // distr.
+#define GSN_CM_REGREF 142 // distr.
+#define GSN_CM_REGREQ 143 // distr.
+// 144 unused
+// 145 unused
+// 146 unused
+#define GSN_CM_ADD_REP 147 // local
+// 148 unused
+// 149 unused
+// 150 unused
+#define GSN_CNTR_WAITREP 151 // distr.
#define GSN_COMMIT 152
#define GSN_COMMIT_FAILCONF 153
#define GSN_COMMIT_FAILREQ 154
@@ -426,11 +426,13 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_NEXT_SCANREF 331
#define GSN_NEXT_SCANREQ 332
#define GSN_NEXTOPERATION 333
-#define GSN_SIZEALT_ACK 334
-#define GSN_SIZEALT_REP 335
-#define GSN_NODE_STATESCONF 336
-#define GSN_NODE_STATESREF 337
-#define GSN_NODE_STATESREQ 338
+
+#define GSN_READ_CONFIG_REQ 334 // new name for sizealt, local
+#define GSN_READ_CONFIG_CONF 335 // new name for sizealt, local
+
+// 336 unused
+// 337 unused
+// 338 unused
#define GSN_OPEN_COMCONF 339
#define GSN_OPEN_COMREF 340
#define GSN_OPEN_COMREQ 341
@@ -511,8 +513,8 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_TEST_ORD 407
#define GSN_TESTSIG 408
#define GSN_TIME_SIGNAL 409
-#define GSN_VOTE_MASTERORD 410
-// 411 unused
+// 410 unused
+// 411 unused
// 412 unused
#define GSN_TUP_ABORTREQ 414
#define GSN_TUP_ADD_ATTCONF 415
@@ -580,7 +582,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_CHECKNODEGROUPSREQ 471
#define GSN_CHECKNODEGROUPSCONF 472
-#define GSN_ARBIT_CFG 473
+// 473 unused
#define GSN_ARBIT_PREPREQ 474
#define GSN_ARBIT_PREPCONF 475
#define GSN_ARBIT_PREPREF 476
diff --git a/ndb/include/kernel/LogLevel.hpp b/ndb/include/kernel/LogLevel.hpp
index 3363dc2befd..10cd0d43bee 100644
--- a/ndb/include/kernel/LogLevel.hpp
+++ b/ndb/include/kernel/LogLevel.hpp
@@ -18,6 +18,7 @@
#define _LOG_LEVEL_HPP
#include <ndb_global.h>
+#include <mgmapi_config_parameters.h>
/**
*
@@ -45,53 +46,60 @@ public:
*/
LogLevel & operator= (const LogLevel &);
+ static const Uint32 MIN_LOGLEVEL_ID = CFG_LOGLEVEL_STARTUP;
+
enum EventCategory {
/**
* Events during all kind of startups
*/
- llStartUp = 0,
+ llStartUp = CFG_LOGLEVEL_STARTUP - MIN_LOGLEVEL_ID,
/**
* Events during shutdown
*/
- llShutdown = 1,
+ llShutdown = CFG_LOGLEVEL_SHUTDOWN - MIN_LOGLEVEL_ID,
/**
* Transaction statistics
* Job level
* TCP/IP speed
*/
- llStatistic = 2,
+ llStatistic = CFG_LOGLEVEL_STATISTICS - MIN_LOGLEVEL_ID,
/**
* Checkpoints
*/
- llCheckpoint = 3,
+ llCheckpoint = CFG_LOGLEVEL_CHECKPOINT - MIN_LOGLEVEL_ID,
/**
* Events during node restart
*/
- llNodeRestart = 4,
+ llNodeRestart = CFG_LOGLEVEL_NODERESTART - MIN_LOGLEVEL_ID,
/**
* Events related to connection / communication
*/
- llConnection = 5,
+ llConnection = CFG_LOGLEVEL_CONNECTION - MIN_LOGLEVEL_ID,
/**
* Assorted event w.r.t unexpected happenings
*/
- llError = 6,
+ llError = CFG_LOGLEVEL_ERROR - MIN_LOGLEVEL_ID,
+
+ /**
+ * Assorted event w.r.t warning
+ */
+ llWarning = CFG_LOGLEVEL_WARNING - MIN_LOGLEVEL_ID,
/**
* Assorted event w.r.t information
*/
- llInfo = 7,
+ llInfo = CFG_LOGLEVEL_INFO - MIN_LOGLEVEL_ID,
/**
* Events related to global replication
*/
- llGrep = 8
+ llGrep = CFG_LOGLEVEL_GREP - MIN_LOGLEVEL_ID
};
struct LogLevelCategoryName {
@@ -107,7 +115,7 @@ public:
/**
* No of categories
*/
-#define _LOGLEVEL_CATEGORIES 9
+#define _LOGLEVEL_CATEGORIES 10
static const Uint32 LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES;
void clear();
diff --git a/ndb/include/kernel/kernel_config_parameters.h b/ndb/include/kernel/kernel_config_parameters.h
new file mode 100644
index 00000000000..2f63efa4b6c
--- /dev/null
+++ b/ndb/include/kernel/kernel_config_parameters.h
@@ -0,0 +1,56 @@
+#ifndef DB_CONFIG_PARAMTERS_H
+#define DB_CONFIG_PARAMTERS_H
+
+#define PRIVATE_BASE 14000
+
+#define CFG_ACC_DIR_RANGE (PRIVATE_BASE + 1)
+#define CFG_ACC_DIR_ARRAY (PRIVATE_BASE + 2)
+#define CFG_ACC_FRAGMENT (PRIVATE_BASE + 3)
+#define CFG_ACC_OP_RECS (PRIVATE_BASE + 4)
+#define CFG_ACC_OVERFLOW_RECS (PRIVATE_BASE + 5)
+#define CFG_ACC_PAGE8 (PRIVATE_BASE + 6)
+#define CFG_ACC_ROOT_FRAG (PRIVATE_BASE + 7)
+#define CFG_ACC_TABLE (PRIVATE_BASE + 8)
+#define CFG_ACC_SCAN (PRIVATE_BASE + 9)
+
+#define CFG_DICT_ATTRIBUTE (PRIVATE_BASE + 10)
+#define CFG_DICT_CONNECT (PRIVATE_BASE + 11)
+#define CFG_DICT_FRAG_CONNECT (PRIVATE_BASE + 12)
+#define CFG_DICT_TABLE (PRIVATE_BASE + 13)
+#define CFG_DICT_TC_CONNECT (PRIVATE_BASE + 14)
+
+#define CFG_DIH_API_CONNECT (PRIVATE_BASE + 15)
+#define CFG_DIH_CONNECT (PRIVATE_BASE + 16)
+#define CFG_DIH_FRAG_CONNECT (PRIVATE_BASE + 17)
+#define CFG_DIH_MORE_NODES (PRIVATE_BASE + 18)
+#define CFG_DIH_REPLICAS (PRIVATE_BASE + 19)
+#define CFG_DIH_TABLE (PRIVATE_BASE + 20)
+
+#define CFG_LQH_FRAG (PRIVATE_BASE + 21)
+#define CFG_LQH_CONNECT (PRIVATE_BASE + 22)
+#define CFG_LQH_TABLE (PRIVATE_BASE + 23)
+#define CFG_LQH_TC_CONNECT (PRIVATE_BASE + 24)
+#define CFG_LQH_REPLICAS (PRIVATE_BASE + 25)
+#define CFG_LQH_LOG_FILES (PRIVATE_BASE + 26)
+#define CFG_LQH_SCAN (PRIVATE_BASE + 27)
+
+#define CFG_TC_API_CONNECT (PRIVATE_BASE + 28)
+#define CFG_TC_TC_CONNECT (PRIVATE_BASE + 29)
+#define CFG_TC_TABLE (PRIVATE_BASE + 30)
+#define CFG_TC_SCAN (PRIVATE_BASE + 31)
+#define CFG_TC_LOCAL_SCAN (PRIVATE_BASE + 32)
+
+#define CFG_TUP_FRAG (PRIVATE_BASE + 33)
+#define CFG_TUP_OP_RECS (PRIVATE_BASE + 34)
+#define CFG_TUP_PAGE (PRIVATE_BASE + 35)
+#define CFG_TUP_PAGE_RANGE (PRIVATE_BASE + 36)
+#define CFG_TUP_TABLE (PRIVATE_BASE + 37)
+#define CFG_TUP_TABLE_DESC (PRIVATE_BASE + 38)
+#define CFG_TUP_STORED_PROC (PRIVATE_BASE + 39)
+
+#define CFG_TUX_INDEX (PRIVATE_BASE + 40)
+#define CFG_TUX_FRAGMENT (PRIVATE_BASE + 41)
+#define CFG_TUX_ATTRIBUTE (PRIVATE_BASE + 42)
+#define CFG_TUX_SCAN_OP (PRIVATE_BASE + 43)
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CheckNodeGroups.hpp b/ndb/include/kernel/signaldata/CheckNodeGroups.hpp
index 9b2f847e128..b3e79949c68 100644
--- a/ndb/include/kernel/signaldata/CheckNodeGroups.hpp
+++ b/ndb/include/kernel/signaldata/CheckNodeGroups.hpp
@@ -37,13 +37,11 @@ public:
Uint32 requestType; // direct flag, output code
Uint32 output;
};
- union {
- Uint32 nodeId; // nodeId input for GetNodeGroupMembers
- NodeBitmask mask; /* set of NDB nodes, input for ArbitCheck,
- * output for GetNodeGroupMembers
- */
- };
+ Uint32 nodeId; // nodeId input for GetNodeGroupMembers
+ NodeBitmask mask; /* set of NDB nodes, input for ArbitCheck,
+ * output for GetNodeGroupMembers
+ */
enum RequestType {
Direct = 0x1,
ArbitCheck = 0x2,
@@ -57,7 +55,7 @@ public:
Partitioning = 3 // possible network partitioning
};
- STATIC_CONST( SignalLength = 2 + NodeBitmask::Size );
+ STATIC_CONST( SignalLength = 3 + NodeBitmask::Size );
};
#endif
diff --git a/ndb/include/kernel/signaldata/CntrStart.hpp b/ndb/include/kernel/signaldata/CntrStart.hpp
new file mode 100644
index 00000000000..abdd1003c0f
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CntrStart.hpp
@@ -0,0 +1,69 @@
+#ifndef CNTR_START_HPP
+#define CNTR_START_HPP
+
+#include <NodeBitmask.hpp>
+
+/**
+ *
+ */
+class CntrStartReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+
+ friend bool printCNTR_START_REQ(FILE*, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+private:
+
+ Uint32 nodeId;
+ Uint32 startType;
+ Uint32 lastGci;
+};
+
+class CntrStartRef {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+
+ friend bool printCNTR_START_REF(FILE*, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ enum ErrorCode {
+ OK = 0,
+ NotMaster = 1,
+ StopInProgress = 2
+ };
+private:
+
+ Uint32 errorCode;
+ Uint32 masterNodeId;
+};
+
+class CntrStartConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+ friend struct UpgradeStartup;
+
+ friend bool printCNTR_START_CONF(FILE*, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 4 + 2 * NdbNodeBitmask::Size );
+
+private:
+
+ Uint32 startType;
+ Uint32 startGci;
+ Uint32 masterNodeId;
+ Uint32 noStartNodes;
+ Uint32 startedNodes[NdbNodeBitmask::Size];
+ Uint32 startingNodes[NdbNodeBitmask::Size];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CreateFragmentation.hpp b/ndb/include/kernel/signaldata/CreateFragmentation.hpp
index a2f45a9580d..7d53dd91154 100644
--- a/ndb/include/kernel/signaldata/CreateFragmentation.hpp
+++ b/ndb/include/kernel/signaldata/CreateFragmentation.hpp
@@ -88,7 +88,7 @@ class CreateFragmentationConf {
friend bool printCREATE_FRAGMENTATION_CONF(FILE *,
const Uint32 *, Uint32, Uint16);
public:
- STATIC_CONST( SignalLength = 3 );
+ STATIC_CONST( SignalLength = 4 );
SECTION( FRAGMENTS = 0 );
private:
diff --git a/ndb/include/kernel/signaldata/DictTabInfo.hpp b/ndb/include/kernel/signaldata/DictTabInfo.hpp
index 791388d5df8..813b0063d35 100644
--- a/ndb/include/kernel/signaldata/DictTabInfo.hpp
+++ b/ndb/include/kernel/signaldata/DictTabInfo.hpp
@@ -100,6 +100,7 @@ public:
CustomTriggerId = 25,
FrmLen = 26,
FrmData = 27,
+ FragmentCount = 128, // No of fragments in table (!fragment replicas)
TableEnd = 999,
AttributeName = 1000, // String, Mandatory
@@ -277,6 +278,7 @@ public:
Uint32 CustomTriggerId;
Uint32 FrmLen;
char FrmData[MAX_FRM_DATA_SIZE];
+ Uint32 FragmentCount;
void init();
};
diff --git a/ndb/include/kernel/signaldata/DropTab.hpp b/ndb/include/kernel/signaldata/DropTab.hpp
index 906f952d852..dd3946d8cc0 100644
--- a/ndb/include/kernel/signaldata/DropTab.hpp
+++ b/ndb/include/kernel/signaldata/DropTab.hpp
@@ -101,7 +101,8 @@ public:
NoSuchTable = 1,
DropWoPrep = 2, // Calling Drop with first calling PrepDrop
PrepDropInProgress = 3,
- DropInProgress = 4
+ DropInProgress = 4,
+ NF_FakeErrorREF = 5
};
private:
diff --git a/ndb/include/kernel/signaldata/EventSubscribeReq.hpp b/ndb/include/kernel/signaldata/EventSubscribeReq.hpp
index 2ac62be19a3..fd2821ea31d 100644
--- a/ndb/include/kernel/signaldata/EventSubscribeReq.hpp
+++ b/ndb/include/kernel/signaldata/EventSubscribeReq.hpp
@@ -39,7 +39,7 @@ class EventSubscribeReq {
friend class MgmtSrvr;
public:
- STATIC_CONST( SignalLength = 14 );
+ STATIC_CONST( SignalLength = 22 );
private:
/**
* Note: If you use the same blockRef as you have used earlier,
@@ -53,8 +53,8 @@ private:
*/
Uint32 noOfEntries;
- Uint32 theCategories[6];
- Uint32 theLevels[6];
+ Uint32 theCategories[10];
+ Uint32 theLevels[10];
};
#endif
diff --git a/ndb/include/kernel/signaldata/FsOpenReq.hpp b/ndb/include/kernel/signaldata/FsOpenReq.hpp
index b84d78ba9dd..906bb947128 100644
--- a/ndb/include/kernel/signaldata/FsOpenReq.hpp
+++ b/ndb/include/kernel/signaldata/FsOpenReq.hpp
@@ -39,6 +39,7 @@ class FsOpenReq {
friend class Backup;
friend class Dbdict;
friend class Ndbcntr; // For initial start...
+ friend class Dbdih;
/**
* For printing
diff --git a/ndb/include/kernel/signaldata/KeyInfo.hpp b/ndb/include/kernel/signaldata/KeyInfo.hpp
index b839a2c2035..a4c698f89b2 100644
--- a/ndb/include/kernel/signaldata/KeyInfo.hpp
+++ b/ndb/include/kernel/signaldata/KeyInfo.hpp
@@ -25,6 +25,7 @@ class KeyInfo {
*/
friend class DbUtil;
friend class NdbOperation;
+ friend class NdbScanOperation;
/**
* Reciver(s)
diff --git a/ndb/include/kernel/signaldata/PrepDropTab.hpp b/ndb/include/kernel/signaldata/PrepDropTab.hpp
index e9cc28fed0c..c54b2474aa3 100644
--- a/ndb/include/kernel/signaldata/PrepDropTab.hpp
+++ b/ndb/include/kernel/signaldata/PrepDropTab.hpp
@@ -88,7 +88,8 @@ public:
NoSuchTable = 1,
PrepDropInProgress = 2,
DropInProgress = 3,
- InvalidTableState = 4
+ InvalidTableState = 4,
+ NF_FakeErrorREF = 5
};
private:
@@ -137,7 +138,8 @@ public:
enum ErrorCode {
NoSuchTable = 1,
IllegalTableState = 2,
- DropInProgress = 3
+ DropInProgress = 3,
+ NF_FakeErrorREF = 4
};
Uint32 tableId;
diff --git a/ndb/include/kernel/signaldata/ReadConfig.hpp b/ndb/include/kernel/signaldata/ReadConfig.hpp
new file mode 100644
index 00000000000..0835b252a32
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ReadConfig.hpp
@@ -0,0 +1,24 @@
+#ifndef READ_CONFIG_HPP
+#define READ_CONFIG_HPP
+
+/**
+ */
+class ReadConfigReq {
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 noOfParameters; // 0 Means read all relevant for block
+ Uint32 parameters[1]; // see mgmapi_config_parameters.h
+};
+
+class ReadConfigConf {
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/ReadNodesConf.hpp b/ndb/include/kernel/signaldata/ReadNodesConf.hpp
index f3176cbf0e8..0507007f71a 100644
--- a/ndb/include/kernel/signaldata/ReadNodesConf.hpp
+++ b/ndb/include/kernel/signaldata/ReadNodesConf.hpp
@@ -48,11 +48,13 @@ class ReadNodesConf {
friend class Suma;
friend class Grep;
+ friend bool printREAD_NODES_CONF(FILE*, const Uint32 *, Uint32, Uint16);
public:
- STATIC_CONST( SignalLength = 2 + 6*NodeBitmask::Size );
+ STATIC_CONST( SignalLength = 3 + 5*NdbNodeBitmask::Size );
private:
Uint32 noOfNodes;
+ Uint32 ndynamicId;
/**
*
@@ -63,47 +65,21 @@ private:
/**
* This array defines all the ndb nodes in the system
*/
- Uint32 allNodes[NodeBitmask::Size];
-
- /**
- * This array describes wheather the nodes are currently active
- *
- * NOTE Not valid when send from Qmgr
- */
- Uint32 inactiveNodes[NodeBitmask::Size];
+ union {
+ Uint32 allNodes[NdbNodeBitmask::Size];
+ Uint32 definedNodes[NdbNodeBitmask::Size];
+ };
/**
- * This array describes the version id of the nodes
- * The version id is a 4 bit number
+ * This array describes wheather the nodes are currently active
*
* NOTE Not valid when send from Qmgr
*/
- Uint32 theVersionIds[4*NodeBitmask::Size];
+ Uint32 inactiveNodes[NdbNodeBitmask::Size];
- static void setVersionId(NodeId, Uint8 versionId, Uint32 theVersionIds[]);
- static Uint8 getVersionId(NodeId, const Uint32 theVersionIds[]);
+ Uint32 clusterNodes[NdbNodeBitmask::Size]; // From Qmgr
+ Uint32 startingNodes[NdbNodeBitmask::Size]; // From Cntr
+ Uint32 startedNodes[NdbNodeBitmask::Size]; // From Cntr
};
-inline
-void
-ReadNodesConf::setVersionId(NodeId nodeId, Uint8 versionId,
- Uint32 theVersionIds[]){
- const int word = nodeId >> 3;
- const int shift = (nodeId & 7) << 2;
-
- const Uint32 mask = ~(((Uint32)15) << shift);
- const Uint32 tmp = theVersionIds[word];
-
- theVersionIds[word] = (tmp & mask) | ((((Uint32)versionId) & 15) << shift);
-}
-
-inline
-Uint8
-ReadNodesConf::getVersionId(NodeId nodeId, const Uint32 theVersionIds[]){
- const int word = nodeId >> 3;
- const int shift = (nodeId & 7) << 2;
-
- return (theVersionIds[word] >> shift) & 15;
-}
-
#endif
diff --git a/ndb/include/kernel/signaldata/ScanTab.hpp b/ndb/include/kernel/signaldata/ScanTab.hpp
index efd8a4918ab..6cef4381c07 100644
--- a/ndb/include/kernel/signaldata/ScanTab.hpp
+++ b/ndb/include/kernel/signaldata/ScanTab.hpp
@@ -33,8 +33,8 @@ class ScanTabReq {
/**
* Sender(s)
*/
- friend class NdbOperation;
friend class NdbConnection;
+ friend class NdbScanOperation;
/**
* For printing
@@ -73,6 +73,7 @@ private:
static Uint8 getHoldLockFlag(const UintR & requestInfo);
static Uint8 getReadCommittedFlag(const UintR & requestInfo);
static Uint8 getRangeScanFlag(const UintR & requestInfo);
+ static Uint8 getScanBatch(const UintR & requestInfo);
/**
* Set:ers for requestInfo
@@ -83,7 +84,7 @@ private:
static void setHoldLockFlag(UintR & requestInfo, Uint32 flag);
static void setReadCommittedFlag(UintR & requestInfo, Uint32 flag);
static void setRangeScanFlag(UintR & requestInfo, Uint32 flag);
-
+ static void setScanBatch(Uint32& requestInfo, Uint32 sz);
};
/**
@@ -94,10 +95,11 @@ private:
h = Hold lock mode - 1 Bit 10
c = Read Committed - 1 Bit 11
x = Range Scan (TUX) - 1 Bit 15
+ b = Scan batch - 5 Bit 16-19 (max 15)
1111111111222222222233
01234567890123456789012345678901
- ppppppppl hc x
+ ppppppppl hc xbbbbb
*/
#define PARALLELL_SHIFT (0)
@@ -115,6 +117,9 @@ private:
#define RANGE_SCAN_SHIFT (15)
#define RANGE_SCAN_MASK (1)
+#define SCAN_BATCH_SHIFT (16)
+#define SCAN_BATCH_MASK (31)
+
inline
Uint8
ScanTabReq::getParallelism(const UintR & requestInfo){
@@ -146,6 +151,12 @@ ScanTabReq::getRangeScanFlag(const UintR & requestInfo){
}
inline
+Uint8
+ScanTabReq::getScanBatch(const Uint32 & requestInfo){
+ return (Uint8)((requestInfo >> SCAN_BATCH_SHIFT) & SCAN_BATCH_MASK);
+}
+
+inline
void
ScanTabReq::clearRequestInfo(UintR & requestInfo){
requestInfo = 0;
@@ -186,6 +197,12 @@ ScanTabReq::setRangeScanFlag(UintR & requestInfo, Uint32 flag){
requestInfo |= (flag << RANGE_SCAN_SHIFT);
}
+inline
+void
+ScanTabReq::setScanBatch(Uint32 & requestInfo, Uint32 flag){
+ ASSERT_MAX(flag, SCAN_BATCH_MASK, "ScanTabReq::setScanBatch");
+ requestInfo |= (flag << SCAN_BATCH_SHIFT);
+}
/**
*
@@ -213,7 +230,8 @@ public:
* Length of signal
*/
STATIC_CONST( SignalLength = 4 );
-
+ static const Uint32 EndOfData = (1 << 31);
+
private:
// Type definitions
@@ -225,29 +243,15 @@ private:
UintR requestInfo; // DATA 1
UintR transId1; // DATA 2
UintR transId2; // DATA 3
-#if 0
- UintR operLenAndIdx[16]; // DATA 4-19
-
- /**
- * Get:ers for operLenAndIdx
- */
- static Uint32 getLen(const UintR & operLenAndIdx);
- static Uint8 getIdx(const UintR & operLenAndIdx);
-#endif
-
- /**
- * Get:ers for requestInfo
- */
- static Uint8 getOperations(const UintR & reqInfo);
- static Uint8 getScanStatus(const UintR & reqInfo);
-
- /**
- * Set:ers for requestInfo
- */
- static void setOperations(UintR & reqInfo, Uint32 ops);
- static void setScanStatus(UintR & reqInfo, Uint32 stat);
+ struct OpData {
+ Uint32 apiPtrI;
+ Uint32 tcPtrI;
+ Uint32 info;
+ };
+ static Uint32 getLength(Uint32 opDataInfo) { return opDataInfo >> 5; };
+ static Uint32 getRows(Uint32 opDataInfo) { return opDataInfo & 31;}
};
/**
@@ -267,33 +271,6 @@ private:
#define STATUS_SHIFT (8)
#define STATUS_MASK (0xFF)
-inline
-Uint8
-ScanTabConf::getOperations(const UintR & reqInfo){
- return (Uint8)((reqInfo >> OPERATIONS_SHIFT) & OPERATIONS_MASK);
-}
-
-inline
-void
-ScanTabConf::setOperations(UintR & requestInfo, Uint32 ops){
- ASSERT_MAX(ops, OPERATIONS_MASK, "ScanTabConf::setOperations");
- requestInfo |= (ops << OPERATIONS_SHIFT);
-}
-
-inline
-Uint8
-ScanTabConf::getScanStatus(const UintR & reqInfo){
- return (Uint8)((reqInfo >> STATUS_SHIFT) & STATUS_MASK);
-}
-
-inline
-void
-ScanTabConf::setScanStatus(UintR & requestInfo, Uint32 stat){
- ASSERT_MAX(stat, STATUS_MASK, "ScanTabConf::setScanStatus");
- requestInfo |= (stat << STATUS_SHIFT);
-}
-
-
/**
*
* SENDER: Dbtc, API
diff --git a/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp b/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp
index 680e9b25a49..c3be808cc41 100644
--- a/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp
+++ b/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp
@@ -18,6 +18,7 @@
#define SET_LOGLEVEL_ORD_HPP
#include <LogLevel.hpp>
+#include "SignalData.hpp"
/**
*
diff --git a/ndb/include/kernel/signaldata/TcCommit.hpp b/ndb/include/kernel/signaldata/TcCommit.hpp
index 43eb7be1c39..b7f3fbbb361 100644
--- a/ndb/include/kernel/signaldata/TcCommit.hpp
+++ b/ndb/include/kernel/signaldata/TcCommit.hpp
@@ -33,6 +33,7 @@ class TcCommitConf {
* Reciver(s)
*/
friend class Ndb;
+ friend class NdbConnection;
public:
STATIC_CONST( SignalLength = 3 );
diff --git a/ndb/include/kernel/signaldata/TcKeyReq.hpp b/ndb/include/kernel/signaldata/TcKeyReq.hpp
index df0a00da3e0..f7d3c2e3282 100644
--- a/ndb/include/kernel/signaldata/TcKeyReq.hpp
+++ b/ndb/include/kernel/signaldata/TcKeyReq.hpp
@@ -38,6 +38,7 @@ class TcKeyReq {
friend class Ndbcntr;
friend class NdbOperation;
friend class NdbIndexOperation;
+ friend class NdbScanOperation;
friend class DbUtil;
/**
diff --git a/ndb/include/kernel/signaldata/UpgradeStartup.hpp b/ndb/include/kernel/signaldata/UpgradeStartup.hpp
new file mode 100644
index 00000000000..badc7ca0e4d
--- /dev/null
+++ b/ndb/include/kernel/signaldata/UpgradeStartup.hpp
@@ -0,0 +1,36 @@
+#ifndef NDB_UPGRADE_STARTUP
+#define NDB_UPGRADE_STARTUP
+
+struct UpgradeStartup {
+
+ static void installEXEC(SimulatedBlock*);
+
+ static const Uint32 GSN_CM_APPCHG = 131;
+ static const Uint32 GSN_CNTR_MASTERCONF = 148;
+ static const Uint32 GSN_CNTR_MASTERREF = 149;
+ static const Uint32 GSN_CNTR_MASTERREQ = 150;
+
+ static void sendCmAppChg(Ndbcntr&, Signal *, Uint32 startLevel);
+ static void execCM_APPCHG(SimulatedBlock& block, Signal*);
+ static void sendCntrMasterReq(Ndbcntr& cntr, Signal* signal, Uint32 n);
+ static void execCNTR_MASTER_REPLY(SimulatedBlock & block, Signal* signal);
+
+ struct CntrMasterReq {
+ STATIC_CONST( SignalLength = 4 + NdbNodeBitmask::Size );
+
+ Uint32 userBlockRef;
+ Uint32 userNodeId;
+ Uint32 typeOfStart;
+ Uint32 noRestartNodes;
+ Uint32 theNodes[NdbNodeBitmask::Size];
+ };
+
+ struct CntrMasterConf {
+ STATIC_CONST( SignalLength = 1 + NdbNodeBitmask::Size );
+
+ Uint32 noStartNodes;
+ Uint32 theNodes[NdbNodeBitmask::Size];
+ };
+};
+
+#endif
diff --git a/ndb/include/mgmapi/mgmapi.h b/ndb/include/mgmapi/mgmapi.h
index 0ecb19eaa76..7b2f728bda8 100644
--- a/ndb/include/mgmapi/mgmapi.h
+++ b/ndb/include/mgmapi/mgmapi.h
@@ -84,9 +84,10 @@ extern "C" {
NDB_MGM_NODE_TYPE_API = 0, /*/< An application node (API)*/
NDB_MGM_NODE_TYPE_NDB = 1, /*/< A database node (DB)*/
NDB_MGM_NODE_TYPE_MGM = 2, /*/< A management server node (MGM)*/
+ NDB_MGM_NODE_TYPE_REP = 3, ///< A replication node
NDB_MGM_NODE_TYPE_MIN = 0, /*/< Min valid value*/
- NDB_MGM_NODE_TYPE_MAX = 2 /*/< Max valid value*/
+ NDB_MGM_NODE_TYPE_MAX = 3 /*/< Max valid value*/
};
/**
@@ -199,6 +200,8 @@ extern "C" {
int node_group; ///< Node group of node
///< (only valid for DB nodes)
int version; ///< Internal version number
+ int connect_count; ///< No of times node has connected
+ ///< or disconnected to the mgm srv
};
/**
@@ -654,6 +657,36 @@ extern "C" {
int ndb_mgm_exit_single_user(NdbMgmHandle handle,
struct ndb_mgm_reply* reply);
+ /**
+ * Get configuration
+ * @param handle NDB management handle.
+ * @param version Version of configuration, 0 means latest
+ * @see MAKE_VERSION
+ * @Note the caller must free the pointer returned.
+ */
+ struct ndb_mgm_configuration * ndb_mgm_get_configuration(NdbMgmHandle handle,
+ unsigned version);
+ /**
+ * Config iterator
+ */
+ typedef struct ndb_mgm_configuration_iterator ndb_mgm_configuration_iterator;
+
+ ndb_mgm_configuration_iterator* ndb_mgm_create_configuration_iterator
+ (struct ndb_mgm_configuration *, unsigned type_of_section);
+ void ndb_mgm_destroy_iterator(ndb_mgm_configuration_iterator*);
+
+ int ndb_mgm_first(ndb_mgm_configuration_iterator*);
+ int ndb_mgm_next(ndb_mgm_configuration_iterator*);
+ int ndb_mgm_valid(const ndb_mgm_configuration_iterator*);
+ int ndb_mgm_find(ndb_mgm_configuration_iterator*,
+ int param, unsigned value);
+
+ int ndb_mgm_get_int_parameter(const ndb_mgm_configuration_iterator*,
+ int param, unsigned * value);
+ int ndb_mgm_get_int64_parameter(const ndb_mgm_configuration_iterator*,
+ int param, unsigned long long * value);
+ int ndb_mgm_get_string_parameter(const ndb_mgm_configuration_iterator*,
+ int param, const char ** value);
#ifdef __cplusplus
}
#endif
diff --git a/ndb/include/mgmapi/mgmapi_config_parameters.h b/ndb/include/mgmapi/mgmapi_config_parameters.h
new file mode 100644
index 00000000000..9ad0967854f
--- /dev/null
+++ b/ndb/include/mgmapi/mgmapi_config_parameters.h
@@ -0,0 +1,142 @@
+#ifndef MGMAPI_CONFIG_PARAMTERS_H
+#define MGMAPI_CONFIG_PARAMTERS_H
+
+
+#define CFG_SYS_NAME 3
+#define CFG_SYS_PRIMARY_MGM_NODE 1
+#define CFG_SYS_CONFIG_GENERATION 2
+#define CFG_SYS_REPLICATION_ROLE 7
+
+#define CFG_NODE_ID 3
+#define CFG_NODE_BYTE_ORDER 4
+#define CFG_NODE_HOST 5
+#define CFG_NODE_SYSTEM 6
+
+/**
+ * DB config parameters
+ */
+#define CFG_DB_NO_SAVE_MSGS 100
+
+#define CFG_DB_NO_REPLICAS 101
+#define CFG_DB_NO_TABLES 102
+#define CFG_DB_NO_ATTRIBUTES 103
+#define CFG_DB_NO_INDEXES 104
+#define CFG_DB_NO_TRIGGERS 105
+
+#define CFG_DB_NO_TRANSACTIONS 106
+#define CFG_DB_NO_OPS 107
+#define CFG_DB_NO_SCANS 108
+#define CFG_DB_NO_TRIGGER_OPS 109
+#define CFG_DB_NO_INDEX_OPS 110
+
+#define CFG_DB_TRANS_BUFFER_MEM 111
+#define CFG_DB_DATA_MEM 112
+#define CFG_DB_INDEX_MEM 113
+#define CFG_DB_MEMLOCK 114
+
+#define CFG_DB_START_PARTIAL_TIMEOUT 115
+#define CFG_DB_START_PARTITION_TIMEOUT 116
+#define CFG_DB_START_FAILURE_TIMEOUT 117
+
+#define CFG_DB_HEARTBEAT_INTERVAL 118
+#define CFG_DB_API_HEARTBEAT_INTERVAL 119
+#define CFG_DB_LCP_INTERVAL 120
+#define CFG_DB_GCP_INTERVAL 121
+#define CFG_DB_ARBIT_TIMEOUT 122
+
+#define CFG_DB_WATCHDOG_INTERVAL 123
+#define CFG_DB_STOP_ON_ERROR 124
+
+#define CFG_DB_FILESYSTEM_PATH 125
+#define CFG_DB_NO_REDOLOG_FILES 126
+#define CFG_DB_DISC_BANDWIDTH 127
+#define CFG_DB_SR_DISC_BANDWITH 128
+
+#define CFG_DB_TRANSACTION_CHECK_INTERVAL 129
+#define CFG_DB_TRANSACTION_INACTIVE_TIMEOUT 130
+#define CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT 131
+
+#define CFG_DB_PARALLEL_BACKUPS 132
+#define CFG_DB_BACKUP_MEM 133
+#define CFG_DB_BACKUP_DATA_BUFFER_MEM 134
+#define CFG_DB_BACKUP_LOG_BUFFER_MEM 135
+#define CFG_DB_BACKUP_WRITE_SIZE 136
+
+#define CFG_LOGLEVEL_STARTUP 137
+#define CFG_LOGLEVEL_SHUTDOWN 138
+#define CFG_LOGLEVEL_STATISTICS 139
+#define CFG_LOGLEVEL_CHECKPOINT 140
+#define CFG_LOGLEVEL_NODERESTART 141
+#define CFG_LOGLEVEL_CONNECTION 142
+#define CFG_LOGLEVEL_INFO 143
+#define CFG_LOGLEVEL_WARNING 144
+#define CFG_LOGLEVEL_ERROR 145
+#define CFG_LOGLEVEL_GREP 146
+#define CFG_LOG_DESTINATION 147
+
+#define CFG_NODE_ARBIT_RANK 200
+#define CFG_NODE_ARBIT_DELAY 201
+
+#define CFG_MGM_PORT 300
+
+#define CFG_CONNECTION_NODE_1 400
+#define CFG_CONNECTION_NODE_2 401
+#define CFG_CONNECTION_SEND_SIGNAL_ID 402
+#define CFG_CONNECTION_CHECKSUM 403
+#define CFG_CONNECTION_NODE_1_SYSTEM 404
+#define CFG_CONNECTION_NODE_2_SYSTEM 405
+
+#define CFG_TCP_HOSTNAME_1 450
+#define CFG_TCP_HOSTNAME_2 451
+#define CFG_TCP_SERVER 452
+#define CFG_TCP_SERVER_PORT 453
+#define CFG_TCP_SEND_BUFFER_SIZE 454
+#define CFG_TCP_RECEIVE_BUFFER_SIZE 455
+#define CFG_TCP_PROXY 456
+
+#define CFG_SHM_SEND_SIGNAL_ID 500
+#define CFG_SHM_CHECKSUM 501
+#define CFG_SHM_KEY 502
+#define CFG_SHM_BUFFER_MEM 503
+
+#define CFG_SCI_ID_0 550
+#define CFG_SCI_ID_1 551
+#define CFG_SCI_SEND_LIMIT 552
+#define CFG_SCI_BUFFER_MEM 553
+#define CFG_SCI_NODE1_ADAPTERS 554
+#define CFG_SCI_NODE1_ADAPTER0 555
+#define CFG_SCI_NODE1_ADAPTER1 556
+#define CFG_SCI_NODE2_ADAPTERS 554
+#define CFG_SCI_NODE2_ADAPTER0 555
+#define CFG_SCI_NODE2_ADAPTER1 556
+
+#define CFG_OSE_HOSTNAME_1 600
+#define CFG_OSE_HOSTNAME_2 601
+#define CFG_OSE_PRIO_A_SIZE 602
+#define CFG_OSE_PRIO_B_SIZE 603
+#define CFG_OSE_RECEIVE_ARRAY_SIZE 604
+
+#define CFG_REP_HEARTBEAT_INTERVAL 700
+
+/**
+ * Internal
+ */
+#define CFG_DB_STOP_ON_ERROR_INSERT 1
+
+#define CFG_TYPE_OF_SECTION 999
+#define CFG_SECTION_SYSTEM 1000
+#define CFG_SECTION_NODE 2000
+#define CFG_SECTION_CONNECTION 3000
+
+#define NODE_TYPE_DB 0
+#define NODE_TYPE_API 1
+#define NODE_TYPE_MGM 2
+#define NODE_TYPE_REP 3
+#define NODE_TYPE_EXT_REP 4
+
+#define CONNECTION_TYPE_TCP 0
+#define CONNECTION_TYPE_SHM 1
+#define CONNECTION_TYPE_SCI 2
+#define CONNECTION_TYPE_OSE 3
+
+#endif
diff --git a/ndb/include/mgmapi/mgmapi_config_parameters_debug.h b/ndb/include/mgmapi/mgmapi_config_parameters_debug.h
new file mode 100644
index 00000000000..0241dca90ef
--- /dev/null
+++ b/ndb/include/mgmapi/mgmapi_config_parameters_debug.h
@@ -0,0 +1,8 @@
+#ifndef MGMAPI_CONFIG_PARAMTERS_DEBUG_H
+#define MGMAPI_CONFIG_PARAMTERS_DEBUG_H
+
+#include "mgmapi_config_parameters.h"
+
+#define CFG_DB_STOP_ON_ERROR_INSERT 1
+
+#endif
diff --git a/ndb/include/mgmcommon/ConfigRetriever.hpp b/ndb/include/mgmcommon/ConfigRetriever.hpp
index ff60e730d45..50d333b54dd 100644
--- a/ndb/include/mgmcommon/ConfigRetriever.hpp
+++ b/ndb/include/mgmcommon/ConfigRetriever.hpp
@@ -18,7 +18,7 @@
#define ConfigRetriever_H
#include <ndb_types.h>
-#include <Properties.hpp>
+#include <mgmapi.h>
/**
* @class ConfigRetriever
@@ -44,11 +44,11 @@ public:
* to establish a connection. This is repeated until a connection is
* established, so the function hangs until a connection is established.
*
- * @return Properties object if succeeded,
+ * @return ndb_mgm_configuration object if succeeded,
* NULL if erroneous local config file or configuration error.
*/
- class Properties * getConfig(const char * nodeType, int versionId);
-
+ struct ndb_mgm_configuration * getConfig(int versionId, int nodeType);
+
const char * getErrorString();
/**
@@ -71,22 +71,17 @@ public:
* @return Node id of this node (as stated in local config or connectString)
*/
inline Uint32 getOwnNodeId() { return _ownNodeId; }
-
- /**
- * Get configuration object
- */
- class Properties * getConfig(int versionId);
+
/**
* Get config using socket
*/
- class Properties * getConfig(const char * mgmhost, unsigned int port,
- Uint32 nodeId, int versionId);
+ struct ndb_mgm_configuration * getConfig(const char * mgmhost, short port,
+ int versionId);
/**
* Get config from file
*/
- class Properties * getConfig(const char * filename, Uint32 nodeId,
- int versionId);
+ struct ndb_mgm_configuration * getConfig(const char * file, int versionId);
private:
char * errorString;
enum ErrorType {
@@ -97,18 +92,17 @@ private:
void setError(ErrorType, const char * errorMsg);
- /**
- * Verifies that received configuration is correct
- */
- bool verifyProperties(const char* nodeType, Properties *p,
- Uint32 nodeId, int versionId);
-
char * _localConfigFileName;
struct LocalConfig * _localConfig;
int _ownNodeId;
char * m_connectString;
char * m_defaultConnectString;
+
+ /**
+ * Verify config
+ */
+ bool verifyConfig(const struct ndb_mgm_configuration *, int type);
};
#endif
diff --git a/ndb/include/mgmcommon/IPCConfig.hpp b/ndb/include/mgmcommon/IPCConfig.hpp
index 626242865cb..ebe65b53b59 100644
--- a/ndb/include/mgmcommon/IPCConfig.hpp
+++ b/ndb/include/mgmcommon/IPCConfig.hpp
@@ -58,6 +58,10 @@ public:
void print() const { props->print(); }
+ static Uint32 configureTransporters(Uint32 nodeId,
+ const class ndb_mgm_configuration &,
+ class TransporterRegistry &);
+
private:
NodeId the_ownId;
Properties * props;
diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp
index 3acfcd194e8..e903deef83b 100644
--- a/ndb/include/ndbapi/Ndb.hpp
+++ b/ndb/include/ndbapi/Ndb.hpp
@@ -867,6 +867,7 @@ class NdbObjectIdMap;
class NdbOperation;
class NdbEventOperationImpl;
class NdbScanOperation;
+class NdbIndexScanOperation;
class NdbIndexOperation;
class NdbConnection;
class NdbApiSignal;
@@ -875,7 +876,6 @@ class NdbLabel;
class NdbBranch;
class NdbSubroutine;
class NdbCall;
-class NdbScanReceiver;
class Table;
class BaseString;
class NdbEventOperation;
@@ -960,8 +960,9 @@ class Ndb
friend class NdbConnection;
friend class Table;
friend class NdbApiSignal;
- friend class NdbScanReceiver;
friend class NdbIndexOperation;
+ friend class NdbScanOperation;
+ friend class NdbIndexScanOperation;
friend class NdbDictionaryImpl;
friend class NdbDictInterface;
@@ -1439,7 +1440,7 @@ private:
NdbConnection* doConnect(Uint32 nodeId);
void doDisconnect();
- NdbScanReceiver* getNdbScanRec();// Get a NdbScanReceiver from idle list
+ 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
@@ -1448,21 +1449,21 @@ private:
NdbRecAttr* getRecAttr(); // Get a receeive attribute object from
// idle list of the Ndb object.
NdbOperation* getOperation(); // Get an operation from idle list
- NdbScanOperation* getScanOperation(); // Get a scan operation from idle
+ NdbIndexScanOperation* getScanOperation(); // Get a scan operation from idle
NdbIndexOperation* getIndexOperation();// Get an index operation from idle
class NdbGlobalEventBufferHandle* getGlobalEventBufferHandle();
void releaseSignal(NdbApiSignal* anApiSignal);
void releaseSignalsInList(NdbApiSignal** pList);
- void releaseNdbScanRec(NdbScanReceiver* aNdbScanRec);
+ 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(NdbScanOperation* aScanOperation);
+ void releaseScanOperation(NdbIndexScanOperation*);
void check_send_timeout();
void remove_sent_list(Uint32);
@@ -1558,7 +1559,6 @@ private:
void* int2void (Uint32 val);
NdbReceiver* void2rec (void* val);
NdbConnection* void2con (void* val);
- NdbScanReceiver* void2rec_srec(void* val);
NdbOperation* void2rec_op (void* val);
NdbIndexOperation* void2rec_iop (void* val);
@@ -1598,7 +1598,7 @@ private:
NdbOperation* theOpIdleList; // First operation in the idle list.
- NdbScanOperation* theScanOpIdleList; // First scan operation in the idle list.
+ NdbIndexScanOperation* theScanOpIdleList; // First scan operation in the idle list.
NdbIndexOperation* theIndexOpIdleList; // First index operation in the idle list.
NdbConnection* theTransactionList;
NdbConnection** theConnectionArray;
@@ -1608,7 +1608,7 @@ private:
NdbBranch* theBranchList; // First branch descriptor in list
NdbSubroutine* theSubroutineList; // First subroutine descriptor in
NdbCall* theCallList; // First call descriptor in list
- NdbScanReceiver* theScanList;
+ NdbReceiver* theScanList;
Uint32 theMyRef; // My block reference
Uint32 theNode; // The node number of our node
diff --git a/ndb/include/ndbapi/NdbApi.hpp b/ndb/include/ndbapi/NdbApi.hpp
index b9b52708789..5f55c8951ba 100644
--- a/ndb/include/ndbapi/NdbApi.hpp
+++ b/ndb/include/ndbapi/NdbApi.hpp
@@ -23,6 +23,10 @@
#include "NdbOperation.hpp"
#include "NdbScanOperation.hpp"
#include "NdbIndexOperation.hpp"
+#include "NdbIndexScanOperation.hpp"
+#include "NdbScanFilter.hpp"
+#include "NdbSchemaCon.hpp"
+#include "NdbSchemaOp.hpp"
#include "NdbRecAttr.hpp"
#include "NdbResultSet.hpp"
#include "NdbDictionary.hpp"
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
diff --git a/ndb/include/ndbapi/NdbCursorOperation.hpp b/ndb/include/ndbapi/NdbCursorOperation.hpp
index cd76b045ea2..e7eeb54ba2d 100644
--- a/ndb/include/ndbapi/NdbCursorOperation.hpp
+++ b/ndb/include/ndbapi/NdbCursorOperation.hpp
@@ -17,77 +17,4 @@
#ifndef NdbCursorOperation_H
#define NdbCursorOperation_H
-#include <NdbOperation.hpp>
-
-class NdbResultSet;
-
-/**
- * @class NdbCursorOperation
- * @brief Operation using cursors
- */
-class NdbCursorOperation : public NdbOperation
-{
- friend class NdbResultSet;
- friend class NdbConnection;
-
-public:
- /**
- * Type of cursor
- */
- enum CursorType {
- NoCursor = 0,
- ScanCursor = 1,
- IndexCursor = 2
- };
-
- /**
- * Lock when performing scan
- */
- enum LockMode {
- LM_Read = 0,
- LM_Exclusive = 1,
- LM_CommittedRead = 2,
-#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
- LM_Dirty = 2
-#endif
- };
-
- virtual CursorType cursorType() = 0;
-
- /**
- * readTuples returns a NdbResultSet where tuples are stored.
- * Tuples are not stored in NdbResultSet until execute(NoCommit)
- * has been executed and nextResult has been called.
- *
- * @param parallel Scan parallelism
- * @param LockMode Scan lock handling
- * @returns NdbResultSet.
- */
- virtual NdbResultSet* readTuples(unsigned parallel = 0,
- LockMode = LM_Read ) = 0;
-
- inline NdbResultSet* readTuplesExclusive(int parallell = 0){
- return readTuples(parallell, LM_Exclusive);
- }
-
-protected:
- NdbCursorOperation(Ndb* aNdb);
-
- ~NdbCursorOperation();
-
- void cursInit();
-
- virtual int executeCursor(int ProcessorId) = 0;
-
- NdbResultSet* getResultSet();
- NdbResultSet* m_resultSet;
-
-private:
-
- virtual int nextResult(bool fetchAllowed) = 0;
-
- virtual void closeScan() = 0;
-};
-
-
#endif
diff --git a/ndb/include/ndbapi/NdbIndexOperation.hpp b/ndb/include/ndbapi/NdbIndexOperation.hpp
index baf31dca0ee..2d873c52e56 100644
--- a/ndb/include/ndbapi/NdbIndexOperation.hpp
+++ b/ndb/include/ndbapi/NdbIndexOperation.hpp
@@ -29,7 +29,7 @@
#ifndef NdbIndexOperation_H
#define NdbIndexOperation_H
-#include <NdbCursorOperation.hpp>
+#include "NdbOperation.hpp"
class Index;
class NdbResultSet;
diff --git a/ndb/include/ndbapi/NdbIndexScanOperation.hpp b/ndb/include/ndbapi/NdbIndexScanOperation.hpp
new file mode 100644
index 00000000000..3f64880bbc0
--- /dev/null
+++ b/ndb/include/ndbapi/NdbIndexScanOperation.hpp
@@ -0,0 +1,140 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef NdbIndexScanOperation_H
+#define NdbIndexScanOperation_H
+
+#include <NdbScanOperation.hpp>
+
+/**
+ * @class NdbIndexScanOperation
+ * @brief Class of scan operations for use to scan ordered index
+ */
+class NdbIndexScanOperation : public NdbScanOperation {
+ friend class Ndb;
+ friend class NdbConnection;
+ friend class NdbResultSet;
+ friend class NdbOperation;
+ friend class NdbScanOperation;
+public:
+ /**
+ * readTuples returns a NdbResultSet where tuples are stored.
+ * Tuples are not stored in NdbResultSet until execute(NoCommit)
+ * has been executed and nextResult has been called.
+ *
+ * @param parallel Scan parallelism
+ * @param batch No of rows to fetch from each fragment at a time
+ * @param LockMode Scan lock handling
+ * @param order_by Order result set in index order
+ * @returns NdbResultSet.
+ * @see NdbScanOperation::readTuples
+ */
+ NdbResultSet* readTuples(LockMode = LM_Read,
+ Uint32 batch = 0,
+ Uint32 parallel = 0,
+ bool order_by = false);
+
+ inline NdbResultSet* readTuples(int parallell){
+ return readTuples(LM_Read, 0, parallell, false);
+ }
+
+ inline NdbResultSet* readTuplesExclusive(int parallell = 0){
+ return readTuples(LM_Exclusive, 0, parallell, false);
+ }
+
+ /**
+ * @name Define Range Scan
+ *
+ * A range scan is a scan on an ordered index. The operation is on
+ * the index table but tuples are returned from the primary table.
+ * The index contains all tuples where at least one index key has not
+ * null value.
+ *
+ * A range scan is currently opened via a normal open scan method.
+ * Bounds can be defined for each index key. After setting bounds,
+ * usual scan methods can be used (get value, interpreter, take over).
+ * These operate on the primary table.
+ *
+ * @{
+ */
+
+ /**
+ * Type of ordered index key bound. The values (0-4) will not change
+ * and can be used explicitly (e.g. they could be computed).
+ */
+ enum BoundType {
+ BoundLE = 0, ///< lower bound,
+ BoundLT = 1, ///< lower bound, strict
+ BoundGE = 2, ///< upper bound
+ BoundGT = 3, ///< upper bound, strict
+ BoundEQ = 4 ///< equality
+ };
+
+ /**
+ * Define bound on index key in range scan.
+ *
+ * Each index key can have not null lower and/or upper bound, or can
+ * be set equal to not null value. The bounds can be defined in any
+ * order but a duplicate definition is an error.
+ *
+ * The scan is most effective when bounds are given for an initial
+ * sequence of non-nullable index keys, and all but the last one is an
+ * equality. In this case the scan returns a contiguous range from
+ * each ordered index fragment.
+ *
+ * @note This release implements only the case described above,
+ * except for the non-nullable limitation. Other sets of
+ * bounds return error or empty result set.
+ *
+ * @note In this release a null key value satisfies any lower
+ * bound and no upper bound. This may change.
+ *
+ * @param attrName Attribute name, alternatively:
+ * @param anAttrId Index column id (starting from 0).
+ * @param type Type of bound
+ * @param value Pointer to bound value
+ * @param len Value length in bytes.
+ * Fixed per datatype and can be omitted
+ * @return 0 if successful otherwise -1
+ */
+ int setBound(const char* attr, int type, const void* aValue, Uint32 len = 0);
+
+ /**
+ * Define bound on index key in range scan using index column id.
+ * See the other setBound() method for details.
+ */
+ int setBound(Uint32 anAttrId, int type, const void* aValue, Uint32 len = 0);
+
+ /** @} *********************************************************************/
+
+private:
+ NdbIndexScanOperation(Ndb* aNdb);
+ virtual ~NdbIndexScanOperation();
+
+ int setBound(const NdbColumnImpl*, int type, const void* aValue, Uint32 len);
+
+ virtual int equal_impl(const NdbColumnImpl*, const char*, Uint32);
+ virtual NdbRecAttr* getValue_impl(const NdbColumnImpl*, char*);
+
+ void fix_get_values();
+ int next_result_ordered(bool fetchAllowed);
+ int send_next_scan_ordered(Uint32 idx);
+ int compare(Uint32 key, Uint32 cols, const NdbReceiver*, const NdbReceiver*);
+
+ Uint32 m_sort_columns;
+};
+
+#endif
diff --git a/ndb/include/ndbapi/NdbOperation.hpp b/ndb/include/ndbapi/NdbOperation.hpp
index 5fa903994b7..89f83f4ee4b 100644
--- a/ndb/include/ndbapi/NdbOperation.hpp
+++ b/ndb/include/ndbapi/NdbOperation.hpp
@@ -41,7 +41,8 @@ class NdbOperation
friend class NdbScanReceiver;
friend class NdbScanFilter;
friend class NdbScanFilterImpl;
-
+ friend class NdbReceiver;
+
public:
/**
* @name Define Standard Operation Type
@@ -194,196 +195,7 @@ public:
*/
virtual int interpretedDeleteTuple();
- /**
- * Scan a table to read tuples.
- *
- * The operation only sets a temporary read lock while
- * reading the tuple.
- * The tuple lock is released when the result of the read reaches the
- * application.
- *
- * @param Parallelism Number of parallel tuple reads are performed
- * in the scan.
- * Currently a maximum of 256 parallel tuple
- * reads are allowed.
- * The parallelism can in reality be lower
- * than specified
- * depending on the number of nodes
- * in the cluster
- * @return 0 if successful otherwise -1.
- */
- int openScanRead(Uint32 Parallelism = 16 );
-
- /**
- * Scan a table to write or update tuples.
- *
- * The operation sets an exclusive lock on the tuple and sends the result
- * to the application.
- * Thus when the application reads the data, the tuple is
- * still locked with an exclusive lock.
- *
- * @param parallelism Number of parallel tuple reads are performed
- * in the scan.
- * Currently a maximum of 256 parallel tuple
- * reads are allowed.
- * The parallelism can in reality be lower
- * than specified depending on the number
- * of nodes in the cluster
- * @return 0 if successful otherwise -1.
- *
- */
- int openScanExclusive(Uint32 parallelism = 16);
-
- /**
- * Scan a table to read tuples.
- *
- * The operation only sets a read lock while
- * reading the tuple.
- * Thus when the application reads the data, the tuple is
- * still locked with a read lock.
- *
- * @param parallelism Number of parallel tuple reads are performed
- * in the scan.
- * Currently a maximum of 256 parallel tuple
- * reads are allowed.
- * The parallelism can in reality be lower
- * than specified
- * depending on the number of nodes
- * in the cluster
- * @return 0 if successful otherwise -1.
- */
- int openScanReadHoldLock(Uint32 parallelism = 16);
-
- /**
- * Scan a table to read tuples.
- *
- * The operation does not wait for locks held by other transactions
- * but returns the latest committed tuple instead.
- *
- * @param parallelism Number of parallel tuple reads are performed
- * in the scan.
- * Currently a maximum of 256 parallel tuple
- * reads are allowed.
- * The parallelism can in reality be lower
- * than specified
- * depending on the number of nodes
- * in the cluster
- * @return 0 if successful otherwise -1.
- */
- int openScanReadCommitted(Uint32 parallelism = 16);
-
- /** @} *********************************************************************/
-
- /**
- * @name Define Range Scan
- *
- * A range scan is a scan on an ordered index. The operation is on
- * the index table but tuples are returned from the primary table.
- * The index contains all tuples where at least one index key has not
- * null value.
- *
- * A range scan is currently opened via a normal open scan method.
- * Bounds can be defined for each index key. After setting bounds,
- * usual scan methods can be used (get value, interpreter, take over).
- * These operate on the primary table.
- *
- * @{
- */
-
- /**
- * Type of ordered index key bound. The values (0-4) will not change
- * and can be used explicitly (e.g. they could be computed).
- */
- enum BoundType {
- BoundLE = 0, ///< lower bound,
- BoundLT = 1, ///< lower bound, strict
- BoundGE = 2, ///< upper bound
- BoundGT = 3, ///< upper bound, strict
- BoundEQ = 4 ///< equality
- };
-
- /**
- * Define bound on index key in range scan.
- *
- * Each index key can have not null lower and/or upper bound, or can
- * be set equal to not null value. The bounds can be defined in any
- * order but a duplicate definition is an error.
- *
- * The scan is most effective when bounds are given for an initial
- * sequence of non-nullable index keys, and all but the last one is an
- * equality. In this case the scan returns a contiguous range from
- * each ordered index fragment.
- *
- * @note This release implements only the case described above,
- * except for the non-nullable limitation. Other sets of
- * bounds return error or empty result set.
- *
- * @note In this release a null key value satisfies any lower
- * bound and no upper bound. This may change.
- *
- * @param attrName Attribute name, alternatively:
- * @param anAttrId Index column id (starting from 0).
- * @param type Type of bound
- * @param value Pointer to bound value
- * @param len Value length in bytes.
- * Fixed per datatype and can be omitted
- * @return 0 if successful otherwise -1
- */
- int setBound(const char* anAttrName, int type, const void* aValue, Uint32 len = 0);
-
- /**
- * Define bound on index key in range scan using index column id.
- * See the other setBound() method for details.
- */
- int setBound(Uint32 anAttrId, int type, const void* aValue, Uint32 len = 0);
-
/** @} *********************************************************************/
-
- /**
- * Validate parallelism parameter by checking the number
- * against number of executing Ndb nodes.
- *
- * @param Parallelism
- * @return 0 if correct parallelism value, otherwise -1.
- *
- */
- int checkParallelism(Uint32 Parallelism);
-
- /**
- * Transfer scan operation to an updating transaction. Use this function
- * when a scan has found a record that you want to update.
- * 1. Start a new transaction.
- * 2. Call the function takeOverForUpdate using your new transaction
- * as parameter, all the properties of the found record will be copied
- * to the new transaction.
- * 3. When you execute the new transaction, the lock held by the scan will
- * be transferred to the new transaction(it's taken over).
- *
- * @note You must have started the scan with openScanExclusive
- * to be able to update the found tuple.
- *
- * @param updateTrans the update transaction connection.
- * @return an NdbOperation or NULL.
- */
- NdbOperation* takeOverForUpdate(NdbConnection* updateTrans);
-
- /**
- * Transfer scan operation to a deleting transaction. Use this function
- * when a scan has found a record that you want to delete.
- * 1. Start a new transaction.
- * 2. Call the function takeOverForDelete using your new transaction
- * as parameter, all the properties of the found record will be copied
- * to the new transaction.
- * 3. When you execute the new transaction, the lock held by the scan will
- * be transferred to the new transaction(its taken over).
- *
- * @note You must have started the scan with openScanExclusive
- * to be able to delete the found tuple.
- *
- * @param deleteTrans the delete transaction connection.
- * @return an NdbOperation or NULL.
- */
- NdbOperation* takeOverForDelete(NdbConnection* deleteTrans);
/**
* @name Specify Search Conditions
@@ -865,16 +677,7 @@ protected:
// Initialise after allocating operation to a transaction
//--------------------------------------------------------------
int init(class NdbTableImpl*, NdbConnection* aCon);
-
- void initScan(); // Initialise after allocating operation
- // to a scan transaction
- virtual void releaseScan(); // Release scan parts of transaction
- void releaseSignals();
- void releaseScanSignals();
- void prepareNextScanResult();
-
- // Common part for Read and Exclusive
- int openScan(Uint32 aParallelism, bool, bool, bool);
+ void initInterpreter();
void next(NdbOperation*); // Set next pointer
@@ -920,11 +723,6 @@ protected:
*****************************************************************************/
int doSend(int ProcessorId, Uint32 lastFlag);
- int doSendScan(int ProcessorId);
-
- int prepareSendScan(Uint32 TC_ConnectPtr,
- Uint64 TransactionId);
-
virtual int prepareSend(Uint32 TC_ConnectPtr,
Uint64 TransactionId);
virtual void setLastFlag(NdbApiSignal* signal, Uint32 lastFlag);
@@ -951,7 +749,7 @@ protected:
virtual int equal_impl(const NdbColumnImpl* anAttrObject,
const char* aValue,
Uint32 len);
- NdbRecAttr* getValue(const NdbColumnImpl* anAttrObject, char* aValue = 0);
+ NdbRecAttr* getValue_impl(const NdbColumnImpl* anAttrObject, char* aValue = 0);
int setValue(const NdbColumnImpl* anAttrObject, const char* aValue, Uint32 len);
int incValue(const NdbColumnImpl* anAttrObject, Uint32 aValue);
int incValue(const NdbColumnImpl* anAttrObject, Uint64 aValue);
@@ -962,15 +760,12 @@ protected:
int branch_reg_reg(Uint32 type, Uint32, Uint32, Uint32);
int branch_col(Uint32 type, Uint32, const char *, Uint32, bool, Uint32 Label);
int branch_col_null(Uint32 type, Uint32 col, Uint32 Label);
- int setBound(const NdbColumnImpl* anAttrObject, int type, const void* aValue, Uint32 len);
// Handle ATTRINFO signals
int receiveREAD_AI(Uint32* aDataPtr, Uint32 aLength);
int insertATTRINFO(Uint32 aData);
int insertATTRINFOloop(const Uint32* aDataPtr, Uint32 aLength);
- int getFirstATTRINFOScan();
- int saveBoundATTRINFO();
int insertKEYINFO(const char* aValue,
Uint32 aStartPosition,
@@ -994,9 +789,6 @@ protected:
Uint32 ptr2int() { return theReceiver.getId(); };
- NdbOperation*
- takeOverScanOp(OperationType opType, NdbConnection* updateTrans);
-
/******************************************************************************
* These are the private variables that are defined in the operation objects.
*****************************************************************************/
@@ -1009,7 +801,6 @@ protected:
Ndb* theNdb; // Point back to the Ndb object.
NdbConnection* theNdbCon; // Point back to the connection object.
NdbOperation* theNext; // Next pointer to operation.
- NdbOperation* theNextScanOp;
NdbApiSignal* theTCREQ; // The TC[KEY/INDX]REQ signal object
NdbApiSignal* theFirstATTRINFO; // The first ATTRINFO signal object
NdbApiSignal* theCurrentATTRINFO; // The current ATTRINFO signal object
@@ -1020,9 +811,6 @@ protected:
NdbApiSignal* theFirstKEYINFO; // The first KEYINFO signal object
NdbApiSignal* theLastKEYINFO; // The first KEYINFO signal object
- NdbRecAttr* theFirstRecAttr; // The first receive attribute object
- NdbRecAttr* theCurrentRecAttr; // The current receive attribute object
-
class NdbLabel* theFirstLabel;
class NdbLabel* theLastLabel;
class NdbBranch* theFirstBranch;
@@ -1037,11 +825,6 @@ protected:
Uint32* theKEYINFOptr; // Pointer to where to write KEYINFO
Uint32* theATTRINFOptr; // Pointer to where to write ATTRINFO
- Uint32 theTotalRecAI_Len; // The total length received according
- // to the TCKEYCONF signal
- Uint32 theCurrRecAI_Len; // The currently received length
- Uint32 theAI_ElementLen; // How many words long is this element
- Uint32* theCurrElemPtr; // The current pointer to the element
class NdbTableImpl* m_currentTable; // The current table
class NdbTableImpl* m_accessTable;
@@ -1083,15 +866,6 @@ protected:
Uint16 m_keyInfoGSN;
Uint16 m_attrInfoGSN;
- // Scan related variables
- Uint32 theParallelism;
- NdbScanReceiver** theScanReceiversArray;
- NdbApiSignal* theSCAN_TABREQ;
- NdbApiSignal* theFirstSCAN_TABINFO_Send;
- NdbApiSignal* theLastSCAN_TABINFO_Send;
- NdbApiSignal* theFirstSCAN_TABINFO_Recv;
- NdbApiSignal* theLastSCAN_TABINFO_Recv;
- NdbApiSignal* theSCAN_TABCONF_Recv;
// saveBoundATTRINFO() moves ATTRINFO here when setBound() is ready
NdbApiSignal* theBoundATTRINFO;
Uint32 theTotalBoundAI_Len;
diff --git a/ndb/include/ndbapi/NdbRecAttr.hpp b/ndb/include/ndbapi/NdbRecAttr.hpp
index 0960c035abe..30bb7753413 100644
--- a/ndb/include/ndbapi/NdbRecAttr.hpp
+++ b/ndb/include/ndbapi/NdbRecAttr.hpp
@@ -74,8 +74,9 @@ class AttrInfo;
class NdbRecAttr
{
friend class NdbOperation;
+ friend class NdbIndexScanOperation;
friend class NdbEventOperationImpl;
- friend class NdbScanReceiver;
+ friend class NdbReceiver;
friend class Ndb;
public:
@@ -244,9 +245,8 @@ private:
NdbRecAttr();
Uint32 attrId() const; /* Get attribute id */
- void setNULL(); /* Set NULL indicator */
- void setNotNULL(); /* Set Not NULL indicator */
- void setUNDEFINED(); /* Set UNDEFINED indicator */
+ bool setNULL(); /* Set NULL indicator */
+ bool receive_data(const Uint32*, Uint32);
void release(); /* Release memory if allocated */
void init(); /* Initialise object when allocated */
@@ -254,6 +254,7 @@ private:
void next(NdbRecAttr* aRecAttr);
NdbRecAttr* next() const;
+
int setup(const class NdbColumnImpl* anAttrInfo, char* aValue);
/* Set up attributes and buffers */
bool copyoutRequired() const; /* Need to copy data to application */
@@ -268,6 +269,7 @@ private:
Uint32 theAttrId; /* The attribute id */
int theNULLind;
+ bool m_nullable;
Uint32 theAttrSize;
Uint32 theArraySize;
const NdbDictionary::Column* m_column;
@@ -288,29 +290,7 @@ NdbRecAttr::getColumn() const {
inline
Uint32
NdbRecAttr::attrSize() const {
-
- switch(getType()){
- case NdbDictionary::Column::Int:
- case NdbDictionary::Column::Unsigned:
- case NdbDictionary::Column::Float:
- return 4;
- case NdbDictionary::Column::Decimal:
- case NdbDictionary::Column::Char:
- case NdbDictionary::Column::Varchar:
- case NdbDictionary::Column::Binary:
- case NdbDictionary::Column::Varbinary:
- return 1;
- case NdbDictionary::Column::Bigint:
- case NdbDictionary::Column::Bigunsigned:
- case NdbDictionary::Column::Double:
- case NdbDictionary::Column::Datetime:
- return 8;
- case NdbDictionary::Column::Timespec:
- return 12;
- case NdbDictionary::Column::Undefined:
- default:
- return 0;
- }
+ return theAttrSize;
}
inline
@@ -448,24 +428,11 @@ NdbRecAttr::attrId() const
}
inline
-void
+bool
NdbRecAttr::setNULL()
{
theNULLind = 1;
-}
-
-inline
-void
-NdbRecAttr::setNotNULL()
-{
- theNULLind = 0;
-}
-
-inline
-void
-NdbRecAttr::setUNDEFINED()
-{
- theNULLind = -1;
+ return m_nullable;
}
inline
diff --git a/ndb/include/ndbapi/NdbReceiver.hpp b/ndb/include/ndbapi/NdbReceiver.hpp
index a1a08a9735a..5f69887f402 100644
--- a/ndb/include/ndbapi/NdbReceiver.hpp
+++ b/ndb/include/ndbapi/NdbReceiver.hpp
@@ -23,6 +23,12 @@
class Ndb;
class NdbReceiver
{
+ friend class Ndb;
+ friend class NdbOperation;
+ friend class NdbScanOperation;
+ friend class NdbIndexOperation;
+ friend class NdbIndexScanOperation;
+ friend class NdbConnection;
public:
enum ReceiverType { NDB_UNINITIALIZED,
NDB_OPERATION = 1,
@@ -31,7 +37,8 @@ public:
};
NdbReceiver(Ndb *aNdb);
- void init(ReceiverType type, void* owner);
+ void init(ReceiverType type, void* owner, bool keyInfo);
+ void release();
~NdbReceiver();
Uint32 getId(){
@@ -42,18 +49,51 @@ public:
return m_type;
}
+ inline NdbConnection * getTransaction();
void* getOwner(){
return m_owner;
}
bool checkMagicNumber() const;
+ inline void next(NdbReceiver* next) { m_next = next;}
+ inline NdbReceiver* next() { return m_next; }
+
private:
Uint32 theMagicNumber;
Ndb* m_ndb;
Uint32 m_id;
+ Uint32 m_tcPtrI;
+ Uint32 m_key_info;
ReceiverType m_type;
void* m_owner;
+ NdbReceiver* m_next;
+
+ /**
+ * At setup
+ */
+ class NdbRecAttr * getValue(const class NdbColumnImpl*, char * user_dst_ptr);
+ void do_get_value(NdbReceiver*, Uint32 rows, Uint32 key_size);
+ void prepareSend();
+
+ int execKEYINFO20(Uint32 info, const Uint32* ptr, Uint32 len);
+ int execTRANSID_AI(const Uint32* ptr, Uint32 len);
+ int execTCOPCONF(Uint32 len);
+ int execSCANOPCONF(Uint32 tcPtrI, Uint32 len, Uint32 rows);
+ class NdbRecAttr* theFirstRecAttr;
+ class NdbRecAttr* theCurrentRecAttr;
+ class NdbRecAttr** m_rows;
+
+ Uint32 m_list_index; // When using multiple
+ Uint32 m_current_row;
+ Uint32 m_result_rows;
+ Uint32 m_defined_rows;
+
+ Uint32 m_expected_result_length;
+ Uint32 m_received_result_length;
+
+ bool nextResult() const { return m_current_row < m_result_rows; }
+ void copyout(NdbReceiver&);
};
#ifdef NDB_NO_DROPPED_SIGNAL
@@ -72,5 +112,32 @@ NdbReceiver::checkMagicNumber() const {
return retVal;
}
+inline
+void
+NdbReceiver::prepareSend(){
+ m_current_row = 0;
+ m_received_result_length = 0;
+ m_expected_result_length = 0;
+ theCurrentRecAttr = theFirstRecAttr;
+}
+
+inline
+int
+NdbReceiver::execTCOPCONF(Uint32 len){
+ Uint32 tmp = m_received_result_length;
+ m_expected_result_length = len;
+ return (tmp == len ? 1 : 0);
+}
+
+inline
+int
+NdbReceiver::execSCANOPCONF(Uint32 tcPtrI, Uint32 len, Uint32 rows){
+ m_tcPtrI = tcPtrI;
+ m_result_rows = rows;
+ Uint32 tmp = m_received_result_length;
+ m_expected_result_length = len;
+ return (tmp == len ? 1 : 0);
+}
+
#endif
#endif
diff --git a/ndb/include/ndbapi/NdbResultSet.hpp b/ndb/include/ndbapi/NdbResultSet.hpp
index d48df01214e..7cf18a6685d 100644
--- a/ndb/include/ndbapi/NdbResultSet.hpp
+++ b/ndb/include/ndbapi/NdbResultSet.hpp
@@ -30,17 +30,15 @@
#define NdbResultSet_H
-#include <NdbCursorOperation.hpp>
-#include <NdbIndexOperation.hpp>
#include <NdbScanOperation.hpp>
/**
* @class NdbResultSet
- * @brief NdbResultSet contains a NdbCursorOperation.
+ * @brief NdbResultSet contains a NdbScanOperation.
*/
class NdbResultSet
{
- friend class NdbCursorOperation;
+ friend class NdbScanOperation;
public:
@@ -93,22 +91,57 @@ public:
*/
int nextResult(bool fetchAllowed = true);
+ /**
+ * Close result set (scan)
+ */
void close();
+ /**
+ * Transfer scan operation to an updating transaction. Use this function
+ * when a scan has found a record that you want to update.
+ * 1. Start a new transaction.
+ * 2. Call the function takeOverForUpdate using your new transaction
+ * as parameter, all the properties of the found record will be copied
+ * to the new transaction.
+ * 3. When you execute the new transaction, the lock held by the scan will
+ * be transferred to the new transaction(it's taken over).
+ *
+ * @note You must have started the scan with openScanExclusive
+ * to be able to update the found tuple.
+ *
+ * @param updateTrans the update transaction connection.
+ * @return an NdbOperation or NULL.
+ */
NdbOperation* updateTuple();
- NdbOperation* updateTuple(NdbConnection* takeOverTransaction);
-
+ NdbOperation* updateTuple(NdbConnection* updateTrans);
+
+ /**
+ * Transfer scan operation to a deleting transaction. Use this function
+ * when a scan has found a record that you want to delete.
+ * 1. Start a new transaction.
+ * 2. Call the function takeOverForDelete using your new transaction
+ * as parameter, all the properties of the found record will be copied
+ * to the new transaction.
+ * 3. When you execute the new transaction, the lock held by the scan will
+ * be transferred to the new transaction(its taken over).
+ *
+ * @note You must have started the scan with openScanExclusive
+ * to be able to delete the found tuple.
+ *
+ * @param deleteTrans the delete transaction connection.
+ * @return an NdbOperation or NULL.
+ */
int deleteTuple();
int deleteTuple(NdbConnection* takeOverTransaction);
private:
- NdbResultSet(NdbCursorOperation*);
+ NdbResultSet(NdbScanOperation*);
~NdbResultSet();
void init();
- NdbCursorOperation* m_operation;
+ NdbScanOperation* m_operation;
};
#endif
diff --git a/ndb/include/ndbapi/NdbScanOperation.hpp b/ndb/include/ndbapi/NdbScanOperation.hpp
index f83669fb616..8ff640dc6ec 100644
--- a/ndb/include/ndbapi/NdbScanOperation.hpp
+++ b/ndb/include/ndbapi/NdbScanOperation.hpp
@@ -29,16 +29,13 @@
#ifndef NdbScanOperation_H
#define NdbScanOperation_H
-
#include <NdbOperation.hpp>
-#include <NdbCursorOperation.hpp>
/**
* @class NdbScanOperation
* @brief Class of scan operations for use in transactions.
*/
-class NdbScanOperation : public NdbCursorOperation
-{
+class NdbScanOperation : public NdbOperation {
friend class Ndb;
friend class NdbConnection;
friend class NdbResultSet;
@@ -46,50 +43,60 @@ class NdbScanOperation : public NdbCursorOperation
public:
/**
+ * Type of cursor
+ */
+ enum CursorType {
+ NoCursor = 0,
+ ScanCursor = 1,
+ IndexCursor = 2
+ };
+
+ /**
+ * Lock when performing scan
+ */
+ enum LockMode {
+ LM_Read = 0,
+ LM_Exclusive = 1,
+ LM_CommittedRead = 2,
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ LM_Dirty = 2
+#endif
+ };
+
+ /**
+ * Type of cursor
+ */
+ CursorType get_cursor_type() const;
+
+ /**
* readTuples returns a NdbResultSet where tuples are stored.
* Tuples are not stored in NdbResultSet until execute(NoCommit)
* has been executed and nextResult has been called.
*
* @param parallel Scan parallelism
+ * @param batch No of rows to fetch from each fragment at a time
* @param LockMode Scan lock handling
* @returns NdbResultSet.
+ * @note specifying 0 for batch and parallall means max performance
*/
- virtual NdbResultSet* readTuples(unsigned parallel = 0,
- LockMode = LM_Read );
+ NdbResultSet* readTuples(LockMode = LM_Read,
+ Uint32 batch = 0, Uint32 parallel = 0);
-#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ inline NdbResultSet* readTuples(int parallell){
+ return readTuples(LM_Read, 0, parallell);
+ }
+
+ inline NdbResultSet* readTuplesExclusive(int parallell = 0){
+ return readTuples(LM_Exclusive, 0, parallell);
+ }
+
+protected:
+ CursorType m_cursor_type;
- int updateTuples();
- int updateTuples(Uint32 parallelism);
-
- int deleteTuples();
- int deleteTuples(Uint32 parallelism);
-
- // Overload setValue for updateTuples
- int setValue(const char* anAttrName, const char* aValue, Uint32 len = 0);
- int setValue(const char* anAttrName, Int32 aValue);
- int setValue(const char* anAttrName, Uint32 aValue);
- int setValue(const char* anAttrName, Int64 aValue);
- int setValue(const char* anAttrName, Uint64 aValue);
- int setValue(const char* anAttrName, float aValue);
- int setValue(const char* anAttrName, double aValue);
-
- int setValue(Uint32 anAttrId, const char* aValue, Uint32 len = 0);
- int setValue(Uint32 anAttrId, Int32 aValue);
- int setValue(Uint32 anAttrId, Uint32 aValue);
- int setValue(Uint32 anAttrId, Int64 aValue);
- int setValue(Uint32 anAttrId, Uint64 aValue);
- int setValue(Uint32 anAttrId, float aValue);
- int setValue(Uint32 anAttrId, double aValue);
-#endif
-private:
NdbScanOperation(Ndb* aNdb);
-
~NdbScanOperation();
- NdbCursorOperation::CursorType cursorType();
-
- virtual int nextResult(bool fetchAllowed = true);
+ int nextResult(bool fetchAllowed = true);
virtual void release();
void closeScan();
@@ -105,125 +112,51 @@ private:
virtual void setErrorCode(int aErrorCode);
virtual void setErrorCodeAbort(int aErrorCode);
- virtual int equal_impl(const NdbColumnImpl* anAttrObject,
- const char* aValue,
- Uint32 len);
-private:
+ NdbResultSet * m_resultSet;
+ NdbResultSet* getResultSet();
NdbConnection *m_transConnection;
- bool m_autoExecute;
- bool m_updateOp;
- bool m_writeOp;
- bool m_deleteOp;
- class SetValueRecList* m_setValueList;
-};
-#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
-class AttrInfo;
-class SetValueRecList;
+ // Scan related variables
+ Uint32 theBatchSize;
+ Uint32 theParallelism;
+ Uint32 m_keyInfo;
+ NdbApiSignal* theSCAN_TABREQ;
-class SetValueRec {
- friend class SetValueRecList;
-public:
- SetValueRec();
- ~SetValueRec();
-
- enum SetValueType {
- SET_STRING_ATTR1 = 0,
- SET_INT32_ATTR1 = 1,
- SET_UINT32_ATTR1 = 2,
- SET_INT64_ATTR1 = 3,
- SET_UINT64_ATTR1 = 4,
- SET_FLOAT_ATTR1 = 5,
- SET_DOUBLE_ATTR1 = 6,
- SET_STRING_ATTR2 = 7,
- SET_INT32_ATTR2 = 8,
- SET_UINT32_ATTR2 = 9,
- SET_INT64_ATTR2 = 10,
- SET_UINT64_ATTR2 = 11,
- SET_FLOAT_ATTR2 = 12,
- SET_DOUBLE_ATTR2 = 13
- };
+ int getFirstATTRINFOScan();
+ int saveBoundATTRINFO();
+ int doSendScan(int ProcessorId);
+ int prepareSendScan(Uint32 TC_ConnectPtr, Uint64 TransactionId);
+
+ int fix_receivers(Uint32 parallel, bool keyInfo);
+ Uint32 m_allocated_receivers;
+ NdbReceiver** m_receivers; // All receivers
- SetValueType stype;
- union {
- char* anAttrName;
- Uint32 anAttrId;
- };
- struct String {
- char* aStringValue;
- Uint32 len;
- };
- union {
- String stringStruct;
- Int32 anInt32Value;
- Uint32 anUint32Value;
- Int64 anInt64Value;
- Uint64 anUint64Value;
- float aFloatValue;
- double aDoubleValue;
- };
-private:
- SetValueRec* next;
-};
+ Uint32* m_prepared_receivers; // These are to be sent
+
+ Uint32 m_current_api_receiver;
+ Uint32 m_api_receivers_count;
+ NdbReceiver** m_api_receivers; // These are currently used by api
+
+ Uint32 m_conf_receivers_count; // NOTE needs mutex to access
+ NdbReceiver** m_conf_receivers; // receive thread puts them here
+
+ Uint32 m_sent_receivers_count; // NOTE needs mutex to access
+ NdbReceiver** m_sent_receivers; // receive thread puts them here
+
+ int send_next_scan(Uint32 cnt, bool close);
+ void receiver_delivered(NdbReceiver*);
+ void receiver_completed(NdbReceiver*);
+ void execCLOSE_SCAN_REP(Uint32 errCode);
-inline
-SetValueRec::SetValueRec() :
- next(0)
-{
-}
+ NdbOperation* takeOverScanOp(OperationType opType, NdbConnection*);
-class SetValueRecList {
-public:
- SetValueRecList();
- ~SetValueRecList();
-
- void add(const char* anAttrName, const char* aValue, Uint32 len = 0);
- void add(const char* anAttrName, Int32 aValue);
- void add(const char* anAttrName, Uint32 aValue);
- void add(const char* anAttrName, Int64 aValue);
- void add(const char* anAttrName, Uint64 aValue);
- void add(const char* anAttrName, float aValue);
- void add(const char* anAttrName, double aValue);
- void add(Uint32 anAttrId, const char* aValue, Uint32 len = 0);
- void add(Uint32 anAttrId, Int32 aValue);
- void add(Uint32 anAttrId, Uint32 aValue);
- void add(Uint32 anAttrId, Int64 aValue);
- void add(Uint32 anAttrId, Uint64 aValue);
- void add(Uint32 anAttrId, float aValue);
- void add(Uint32 anAttrId, double aValue);
-
- typedef void(* IterateFn)(SetValueRec&, NdbOperation&);
- static void callSetValueFn(SetValueRec&, NdbOperation&);
- void iterate(IterateFn nextfn, NdbOperation&);
-private:
- SetValueRec* first;
- SetValueRec* last;
+ Uint32 m_ordered;
};
inline
-SetValueRecList::SetValueRecList() :
- first(0),
- last(0)
-{
-}
-
-inline
-SetValueRecList::~SetValueRecList() {
- if (first) delete first;
- first = last = 0;
+NdbScanOperation::CursorType
+NdbScanOperation::get_cursor_type() const {
+ return m_cursor_type;
}
-
-inline
-void SetValueRecList::iterate(SetValueRecList::IterateFn nextfn, NdbOperation& oper)
-{
- SetValueRec* recPtr = first;
- while(recPtr) {
- (*nextfn)(*recPtr, oper);
- recPtr = recPtr->next; // Move to next in list - MASV
- }
-}
-
-#endif
-
#endif
diff --git a/ndb/include/util/Base64.hpp b/ndb/include/util/Base64.hpp
index a8678da946c..1156636eec8 100644
--- a/ndb/include/util/Base64.hpp
+++ b/ndb/include/util/Base64.hpp
@@ -20,7 +20,8 @@
#include <UtilBuffer.hpp>
#include <BaseString.hpp>
-int base64_encode(UtilBuffer &src, BaseString &dst);
-int base64_decode(BaseString &src, UtilBuffer &dst);
+int base64_encode(const UtilBuffer &src, BaseString &dst);
+int base64_decode(const BaseString &src, UtilBuffer &dst);
+int base64_decode(const char * s, size_t len, UtilBuffer &dst);
#endif /* !__BASE64_HPP_INCLUDED__ */
diff --git a/ndb/include/util/Bitmask.hpp b/ndb/include/util/Bitmask.hpp
index 00255d3a86b..7355742f845 100644
--- a/ndb/include/util/Bitmask.hpp
+++ b/ndb/include/util/Bitmask.hpp
@@ -134,7 +134,7 @@ public:
/**
* getText - Return as hex-digits (only for debug routines).
*/
- static void getText(unsigned size, const Uint32 data[], char* buf);
+ static char* getText(unsigned size, const Uint32 data[], char* buf);
};
inline bool
@@ -302,9 +302,10 @@ BitmaskImpl::setField(unsigned size, Uint32 data[],
set(size, data, pos + i, val & (1 << i));
}
-inline void
+inline char *
BitmaskImpl::getText(unsigned size, const Uint32 data[], char* buf)
{
+ char * org = buf;
const char* const hex = "0123456789abcdef";
for (int i = (size-1); i >= 0; i--) {
Uint32 x = data[i];
@@ -315,6 +316,7 @@ BitmaskImpl::getText(unsigned size, const Uint32 data[], char* buf)
buf += 8;
}
*buf = 0;
+ return org;
}
/**
@@ -333,7 +335,7 @@ public:
Uint32 data[size];
#if 0
Data & operator=(const Bitmask<size> & src) {
- src.assign(size, data);
+ src.copyto(size, data);
return *this;
}
#endif
@@ -346,6 +348,8 @@ public:
STATIC_CONST( NotFound = BitmaskImpl::NotFound );
STATIC_CONST( TextLength = size * 8 );
+ Bitmask() { clear();}
+
/**
* assign - Set all bits in <em>dst</em> to corresponding in <em>src/<em>
*/
@@ -359,9 +363,9 @@ public:
void assign(const Bitmask<size> & src);
/**
- * assign <em>dst</em> of size <em>sz</em> to <em>this</em>
+ * copy this to <em>dst</em>
*/
- void assign(unsigned sz, Uint32 dst[]) const;
+ void copyto(unsigned sz, Uint32 dst[]) const;
/**
* assign <em>this</em> according to <em>src/em>
@@ -469,7 +473,7 @@ public:
/**
* getText - Return as hex-digits (only for debug routines).
*/
- static void getText(const Uint32 data[], char* buf);
+ static char* getText(const Uint32 data[], char* buf);
char* getText(char* buf) const;
};
@@ -498,12 +502,12 @@ template <unsigned size>
inline void
Bitmask<size>::assign(const Bitmask<size> & src)
{
- assign(rep.data, src);
+ assign(rep.data, src.rep.data);
}
template <unsigned size>
inline void
-Bitmask<size>::assign(unsigned sz, Uint32 dst[]) const
+Bitmask<size>::copyto(unsigned sz, Uint32 dst[]) const
{
BitmaskImpl::assign(sz, dst, rep.data);
}
@@ -716,18 +720,17 @@ Bitmask<size>::bitXOR(const Bitmask<size>& mask2)
}
template <unsigned size>
-void
+char *
Bitmask<size>::getText(const Uint32 data[], char* buf)
{
- BitmaskImpl::getText(size, data, buf);
+ return BitmaskImpl::getText(size, data, buf);
}
template <unsigned size>
inline char *
Bitmask<size>::getText(char* buf) const
{
- getText(rep.data, buf);
- return buf;
+ return getText(rep.data, buf);
}
template <unsigned size>
diff --git a/ndb/include/util/ConfigValues.hpp b/ndb/include/util/ConfigValues.hpp
new file mode 100644
index 00000000000..48e1363bf4a
--- /dev/null
+++ b/ndb/include/util/ConfigValues.hpp
@@ -0,0 +1,252 @@
+#ifndef __CONFIG_VALUES_HPP
+#define __CONFIG_VALUES_HPP
+
+#include <ndb_types.h>
+#include <UtilBuffer.hpp>
+
+class ConfigValues {
+ friend class ConfigValuesFactory;
+ ConfigValues(Uint32 sz, Uint32 data);
+
+public:
+ ~ConfigValues();
+
+ enum ValueType {
+ InvalidType = 0,
+ IntType = 1,
+ StringType = 2,
+ SectionType = 3,
+ Int64Type = 4
+ };
+
+ struct Entry {
+ Uint32 m_key;
+ ValueType m_type;
+ union {
+ Uint32 m_int;
+ const char * m_string;
+ Uint64 m_int64;
+ };
+ };
+
+ class ConstIterator {
+ friend class ConfigValuesFactory;
+ const ConfigValues & m_cfg;
+ protected:
+ Uint32 m_currentSection;
+ public:
+ ConstIterator(const ConfigValues&c) : m_cfg(c) { m_currentSection = 0;}
+
+ bool openSection(Uint32 key, Uint32 no);
+ bool closeSection();
+
+ bool get(Uint32 key, Entry *) const;
+
+ bool get(Uint32 key, Uint32 * value) const;
+ bool get(Uint32 key, Uint64 * value) const;
+ bool get(Uint32 key, const char ** value) const;
+ bool getTypeOf(Uint32 key, ValueType * type) const;
+
+ Uint32 get(Uint32 key, Uint32 notFound) const;
+ Uint64 get64(Uint32 key, Uint64 notFound) const;
+ const char * get(Uint32 key, const char * notFound) const;
+ ValueType getTypeOf(Uint32 key) const;
+ };
+
+ class Iterator : public ConstIterator {
+ ConfigValues & m_cfg;
+ public:
+ Iterator(ConfigValues&c) : ConstIterator(c), m_cfg(c) {}
+
+ bool set(Uint32 key, Uint32 value);
+ bool set(Uint32 key, Uint64 value);
+ bool set(Uint32 key, const char * value);
+ };
+
+ Uint32 getPackedSize() const; // get size in bytes needed to pack
+ Uint32 pack(UtilBuffer&) const;
+ Uint32 pack(void * dst, Uint32 len) const;// pack into dst(of len %d);
+
+private:
+ friend class Iterator;
+ friend class ConstIterator;
+
+ bool getByPos(Uint32 pos, Entry *) const;
+ Uint64 & get64(Uint32 index) const;
+ char * & getString(Uint32 index) const;
+
+ Uint32 m_size;
+ Uint32 m_dataSize;
+ Uint32 m_stringCount;
+ Uint32 m_int64Count;
+
+ Uint32 m_values[1];
+ void * m_data[1];
+};
+
+class ConfigValuesFactory {
+ Uint32 m_currentSection;
+public:
+ Uint32 m_sectionCounter;
+ Uint32 m_freeKeys;
+ Uint32 m_freeData;
+
+public:
+ ConfigValuesFactory(Uint32 keys = 50, Uint32 data = 10); // Initial
+ ConfigValuesFactory(ConfigValues * m_cfg); //
+
+ ConfigValues * m_cfg;
+ ConfigValues * getConfigValues();
+
+ bool openSection(Uint32 key, Uint32 no);
+ bool put(const ConfigValues::Entry & );
+ bool put(Uint32 key, Uint32 value);
+ bool put64(Uint32 key, Uint64 value);
+ bool put(Uint32 key, const char * value);
+ bool closeSection();
+
+ void expand(Uint32 freeKeys, Uint32 freeData);
+ void shrink();
+
+ bool unpack(const UtilBuffer&);
+ bool unpack(const void * src, Uint32 len);
+
+ static ConfigValues * extractCurrentSection(const ConfigValues::ConstIterator &);
+
+private:
+ static ConfigValues * create(Uint32 keys, Uint32 data);
+ void put(const ConfigValues & src);
+};
+
+inline
+bool
+ConfigValues::ConstIterator::get(Uint32 key, Uint32 * value) const {
+ Entry tmp;
+ if(get(key, &tmp) && tmp.m_type == IntType){
+ * value = tmp.m_int;
+ return true;
+ }
+ return false;
+}
+
+inline
+bool
+ConfigValues::ConstIterator::get(Uint32 key, Uint64 * value) const {
+ Entry tmp;
+ if(get(key, &tmp) && tmp.m_type == Int64Type){
+ * value = tmp.m_int64;
+ return true;
+ }
+ return false;
+}
+
+inline
+bool
+ConfigValues::ConstIterator::get(Uint32 key, const char ** value) const {
+ Entry tmp;
+ if(get(key, &tmp) && tmp.m_type == StringType){
+ * value = tmp.m_string;
+ return true;
+ }
+ return false;
+}
+
+inline
+bool
+ConfigValues::ConstIterator::getTypeOf(Uint32 key, ValueType * type) const{
+ Entry tmp;
+ if(get(key, &tmp)){
+ * type = tmp.m_type;
+ return true;
+ }
+ return false;
+}
+
+inline
+Uint32
+ConfigValues::ConstIterator::get(Uint32 key, Uint32 notFound) const {
+ Entry tmp;
+ if(get(key, &tmp) && tmp.m_type == IntType){
+ return tmp.m_int;
+ }
+ return notFound;
+}
+
+inline
+Uint64
+ConfigValues::ConstIterator::get64(Uint32 key, Uint64 notFound) const {
+ Entry tmp;
+ if(get(key, &tmp) && tmp.m_type == Int64Type){
+ return tmp.m_int64;
+ }
+ return notFound;
+}
+
+inline
+const char *
+ConfigValues::ConstIterator::get(Uint32 key, const char * notFound) const {
+ Entry tmp;
+ if(get(key, &tmp) && tmp.m_type == StringType){
+ return tmp.m_string;
+ }
+ return notFound;
+}
+
+inline
+ConfigValues::ValueType
+ConfigValues::ConstIterator::getTypeOf(Uint32 key) const{
+ Entry tmp;
+ if(get(key, &tmp)){
+ return tmp.m_type;
+ }
+ return ConfigValues::InvalidType;
+}
+
+inline
+bool
+ConfigValuesFactory::put(Uint32 key, Uint32 val){
+ ConfigValues::Entry tmp;
+ tmp.m_key = key;
+ tmp.m_type = ConfigValues::IntType;
+ tmp.m_int = val;
+ return put(tmp);
+}
+
+inline
+bool
+ConfigValuesFactory::put64(Uint32 key, Uint64 val){
+ ConfigValues::Entry tmp;
+ tmp.m_key = key;
+ tmp.m_type = ConfigValues::Int64Type;
+ tmp.m_int64 = val;
+ return put(tmp);
+}
+
+inline
+bool
+ConfigValuesFactory::put(Uint32 key, const char * val){
+ ConfigValues::Entry tmp;
+ tmp.m_key = key;
+ tmp.m_type = ConfigValues::StringType;
+ tmp.m_string = val;
+ return put(tmp);
+}
+
+inline
+Uint32
+ConfigValues::pack(UtilBuffer& buf) const {
+ Uint32 len = getPackedSize();
+ void * tmp = buf.append(len);
+ if(tmp == 0){
+ return 0;
+ }
+ return pack(tmp, len);
+}
+
+inline
+bool
+ConfigValuesFactory::unpack(const UtilBuffer& buf){
+ return unpack(buf.get_data(), buf.length());
+}
+
+#endif
diff --git a/ndb/include/util/Properties.hpp b/ndb/include/util/Properties.hpp
index ff5d1338c79..2c30f7f7e3c 100644
--- a/ndb/include/util/Properties.hpp
+++ b/ndb/include/util/Properties.hpp
@@ -22,9 +22,10 @@
#include <UtilBuffer.hpp>
enum PropertiesType {
- PropertiesType_Uint32,
- PropertiesType_char,
- PropertiesType_Properties
+ PropertiesType_Uint32 = 0,
+ PropertiesType_char = 1,
+ PropertiesType_Properties = 2,
+ PropertiesType_Uint64 = 3
};
/**
@@ -36,6 +37,7 @@ enum PropertiesType {
*/
struct Property {
Property(const char* name, Uint32 val);
+ Property(const char* name, Uint64 val);
Property(const char* name, const char * value);
Property(const char* name, const class Properties * value);
~Property();
@@ -75,6 +77,7 @@ public:
void put(const Property *, int len);
bool put(const char * name, Uint32 value, bool replace = false);
+ bool put64(const char * name, Uint64 value, bool replace = false);
bool put(const char * name, const char * value, bool replace = false);
bool put(const char * name, const Properties * value, bool replace = false);
@@ -84,6 +87,7 @@ public:
* Compare get(name, no)
*/
bool put(const char *, Uint32 no, Uint32, bool replace = false);
+ bool put64(const char *, Uint32 no, Uint64, bool replace = false);
bool put(const char *, Uint32 no, const char *, bool replace = false);
bool put(const char *, Uint32 no, const Properties *, bool replace = false);
@@ -94,6 +98,7 @@ public:
bool contains(const char * name) const;
bool get(const char * name, Uint32 * value) const;
+ bool get(const char * name, Uint64 * value) const;
bool get(const char * name, const char ** value) const;
bool get(const char * name, BaseString & value) const;
bool get(const char * name, const Properties ** value) const;
@@ -109,6 +114,7 @@ public:
bool contains(const char * name, Uint32 no) const;
bool get(const char * name, Uint32 no, Uint32 * value) const;
+ bool get(const char * name, Uint32 no, Uint64 * value) const;
bool get(const char * name, Uint32 no, const char ** value) const;
bool get(const char * name, Uint32 no, const Properties ** value) const;
@@ -230,11 +236,12 @@ Properties::unpack(UtilBuffer &buf) {
inline bool
Properties::pack(UtilBuffer &buf) const {
Uint32 size = getPackedSize();
- char *tmp_buf = new char[size];
+ void *tmp_buf = buf.append(size);
+ if(tmp_buf == 0)
+ return false;
bool ret = pack((Uint32 *)tmp_buf);
if(ret == false)
return false;
- buf.append(tmp_buf, size);
return true;
}
diff --git a/ndb/include/util/UtilBuffer.hpp b/ndb/include/util/UtilBuffer.hpp
index b357fa0fdf2..f43fc960a16 100644
--- a/ndb/include/util/UtilBuffer.hpp
+++ b/ndb/include/util/UtilBuffer.hpp
@@ -63,6 +63,15 @@ public:
return 0;
};
+ void * append(size_t l){
+ if(grow(len+l) != 0)
+ return 0;
+
+ void * ret = (char*)data+len;
+ len += l;
+ return ret;
+ }
+
int assign(const void * d, size_t l) {
if (data) free(data);
data = NULL;