Commit da2ae189 authored by unknown's avatar unknown

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
parents 489aa9be 910b86cd
...@@ -90,6 +90,7 @@ CCFLAGS_LOC += \ ...@@ -90,6 +90,7 @@ CCFLAGS_LOC += \
-I$(call fixpath,$(NDB_TOP)/include/transporter) \ -I$(call fixpath,$(NDB_TOP)/include/transporter) \
-I$(call fixpath,$(NDB_TOP)/include/debugger) \ -I$(call fixpath,$(NDB_TOP)/include/debugger) \
-I$(call fixpath,$(NDB_TOP)/include/mgmcommon) \ -I$(call fixpath,$(NDB_TOP)/include/mgmcommon) \
-I$(call fixpath,$(NDB_TOP)/include/mgmapi) \
-I$(call fixpath,$(NDB_TOP)/include/ndbapi) \ -I$(call fixpath,$(NDB_TOP)/include/ndbapi) \
-I$(call fixpath,$(NDB_TOP)/include/util) \ -I$(call fixpath,$(NDB_TOP)/include/util) \
-I$(call fixpath,$(NDB_TOP)/include/portlib) \ -I$(call fixpath,$(NDB_TOP)/include/portlib) \
...@@ -105,6 +106,7 @@ CCFLAGS_LOC += \ ...@@ -105,6 +106,7 @@ CCFLAGS_LOC += \
-I$(call fixpath,$(NDB_TOP)/include/transporter) \ -I$(call fixpath,$(NDB_TOP)/include/transporter) \
-I$(call fixpath,$(NDB_TOP)/include/debugger) \ -I$(call fixpath,$(NDB_TOP)/include/debugger) \
-I$(call fixpath,$(NDB_TOP)/include/mgmcommon) \ -I$(call fixpath,$(NDB_TOP)/include/mgmcommon) \
-I$(call fixpath,$(NDB_TOP)/include/mgmapi) \
-I$(call fixpath,$(NDB_TOP)/include/ndbapi) \ -I$(call fixpath,$(NDB_TOP)/include/ndbapi) \
-I$(call fixpath,$(NDB_TOP)/include/util) \ -I$(call fixpath,$(NDB_TOP)/include/util) \
-I$(call fixpath,$(NDB_TOP)/include/portlib) \ -I$(call fixpath,$(NDB_TOP)/include/portlib) \
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#define DBTUP 0xF9 #define DBTUP 0xF9
#define DBDICT 0xFA #define DBDICT 0xFA
#define NDBCNTR 0xFB #define NDBCNTR 0xFB
#define CNTR 0xFB
#define QMGR 0xFC #define QMGR 0xFC
#define NDBFS 0xFD #define NDBFS 0xFD
#define CMVMI 0xFE #define CMVMI 0xFE
......
...@@ -177,43 +177,43 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; ...@@ -177,43 +177,43 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_API_FAILCONF 113 #define GSN_API_FAILCONF 113
#define GSN_API_FAILREQ 114 #define GSN_API_FAILREQ 114
#define GSN_APPL_CHANGEREP 115 #define GSN_CNTR_START_REQ 115
// 116 not unused // 116 not unused
#define GSN_APPL_HB 117 #define GSN_CNTR_START_REF 117
#define GSN_APPL_HBREQ 118 #define GSN_CNTR_START_CONF 118
#define GSN_APPL_REGCONF 119 #define GSN_CNTR_START_REP 119
#define GSN_APPL_REGREF 120 // 120 unused
#define GSN_APPL_REGREQ 121 // 121 unused
#define GSN_APPL_RUN 122 // 122 unused
#define GSN_APPL_STARTCONF 123 // 123 unused
#define GSN_APPL_STARTREG 124 // 124 unused
#define GSN_CHECK_LCP_STOP 125 #define GSN_CHECK_LCP_STOP 125
#define GSN_CLOSE_COMCONF 126 #define GSN_CLOSE_COMCONF 126 // local
#define GSN_CLOSE_COMREQ 127 #define GSN_CLOSE_COMREQ 127 // local
#define GSN_CM_ACKADD 128 #define GSN_CM_ACKADD 128 // distr.
#define GSN_CM_ACKALARM 129 // 129 unused
#define GSN_CM_ADD 130 #define GSN_CM_ADD 130 // distr.
#define GSN_CM_APPCHG 131 // 131 unused
// 132 not unused // 132 not unused
// 133 not unused // 133 not unused
#define GSN_CM_HEARTBEAT 134 #define GSN_CM_HEARTBEAT 134 // distr.
#define GSN_CM_INFOCONF 135 // 135 unused
#define GSN_CM_INFOREQ 136 // 136 unused
#define GSN_CM_INIT 137 // 137 unused
#define GSN_CM_NODEINFOCONF 138 #define GSN_CM_NODEINFOCONF 138 // distr.
#define GSN_CM_NODEINFOREF 139 #define GSN_CM_NODEINFOREF 139 // distr.
#define GSN_CM_NODEINFOREQ 140 #define GSN_CM_NODEINFOREQ 140 // distr.
#define GSN_CM_REGCONF 141 #define GSN_CM_REGCONF 141 // distr.
#define GSN_CM_REGREF 142 #define GSN_CM_REGREF 142 // distr.
#define GSN_CM_REGREQ 143 #define GSN_CM_REGREQ 143 // distr.
#define GSN_CM_RUN 144 // 144 unused
#define GSN_CMVMI_CFGCONF 145 // 145 unused
#define GSN_CMVMI_CFGREQ 146 // 146 unused
#define GSN_CNTR_CHANGEREP 147 #define GSN_CM_ADD_REP 147 // local
#define GSN_CNTR_MASTERCONF 148 // 148 unused
#define GSN_CNTR_MASTERREF 149 // 149 unused
#define GSN_CNTR_MASTERREQ 150 // 150 unused
#define GSN_CNTR_WAITREP 151 #define GSN_CNTR_WAITREP 151 // distr.
#define GSN_COMMIT 152 #define GSN_COMMIT 152
#define GSN_COMMIT_FAILCONF 153 #define GSN_COMMIT_FAILCONF 153
#define GSN_COMMIT_FAILREQ 154 #define GSN_COMMIT_FAILREQ 154
...@@ -426,11 +426,13 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; ...@@ -426,11 +426,13 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_NEXT_SCANREF 331 #define GSN_NEXT_SCANREF 331
#define GSN_NEXT_SCANREQ 332 #define GSN_NEXT_SCANREQ 332
#define GSN_NEXTOPERATION 333 #define GSN_NEXTOPERATION 333
#define GSN_SIZEALT_ACK 334
#define GSN_SIZEALT_REP 335 #define GSN_READ_CONFIG_REQ 334 // new name for sizealt, local
#define GSN_NODE_STATESCONF 336 #define GSN_READ_CONFIG_CONF 335 // new name for sizealt, local
#define GSN_NODE_STATESREF 337
#define GSN_NODE_STATESREQ 338 // 336 unused
// 337 unused
// 338 unused
#define GSN_OPEN_COMCONF 339 #define GSN_OPEN_COMCONF 339
#define GSN_OPEN_COMREF 340 #define GSN_OPEN_COMREF 340
#define GSN_OPEN_COMREQ 341 #define GSN_OPEN_COMREQ 341
...@@ -511,7 +513,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; ...@@ -511,7 +513,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_TEST_ORD 407 #define GSN_TEST_ORD 407
#define GSN_TESTSIG 408 #define GSN_TESTSIG 408
#define GSN_TIME_SIGNAL 409 #define GSN_TIME_SIGNAL 409
#define GSN_VOTE_MASTERORD 410 // 410 unused
// 411 unused // 411 unused
// 412 unused // 412 unused
#define GSN_TUP_ABORTREQ 414 #define GSN_TUP_ABORTREQ 414
...@@ -580,7 +582,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; ...@@ -580,7 +582,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_CHECKNODEGROUPSREQ 471 #define GSN_CHECKNODEGROUPSREQ 471
#define GSN_CHECKNODEGROUPSCONF 472 #define GSN_CHECKNODEGROUPSCONF 472
#define GSN_ARBIT_CFG 473 // 473 unused
#define GSN_ARBIT_PREPREQ 474 #define GSN_ARBIT_PREPREQ 474
#define GSN_ARBIT_PREPCONF 475 #define GSN_ARBIT_PREPCONF 475
#define GSN_ARBIT_PREPREF 476 #define GSN_ARBIT_PREPREF 476
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#define _LOG_LEVEL_HPP #define _LOG_LEVEL_HPP
#include <ndb_global.h> #include <ndb_global.h>
#include <mgmapi_config_parameters.h>
/** /**
* *
...@@ -45,53 +46,60 @@ public: ...@@ -45,53 +46,60 @@ public:
*/ */
LogLevel & operator= (const LogLevel &); LogLevel & operator= (const LogLevel &);
static const Uint32 MIN_LOGLEVEL_ID = CFG_LOGLEVEL_STARTUP;
enum EventCategory { enum EventCategory {
/** /**
* Events during all kind of startups * Events during all kind of startups
*/ */
llStartUp = 0, llStartUp = CFG_LOGLEVEL_STARTUP - MIN_LOGLEVEL_ID,
/** /**
* Events during shutdown * Events during shutdown
*/ */
llShutdown = 1, llShutdown = CFG_LOGLEVEL_SHUTDOWN - MIN_LOGLEVEL_ID,
/** /**
* Transaction statistics * Transaction statistics
* Job level * Job level
* TCP/IP speed * TCP/IP speed
*/ */
llStatistic = 2, llStatistic = CFG_LOGLEVEL_STATISTICS - MIN_LOGLEVEL_ID,
/** /**
* Checkpoints * Checkpoints
*/ */
llCheckpoint = 3, llCheckpoint = CFG_LOGLEVEL_CHECKPOINT - MIN_LOGLEVEL_ID,
/** /**
* Events during node restart * Events during node restart
*/ */
llNodeRestart = 4, llNodeRestart = CFG_LOGLEVEL_NODERESTART - MIN_LOGLEVEL_ID,
/** /**
* Events related to connection / communication * Events related to connection / communication
*/ */
llConnection = 5, llConnection = CFG_LOGLEVEL_CONNECTION - MIN_LOGLEVEL_ID,
/** /**
* Assorted event w.r.t unexpected happenings * 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 * Assorted event w.r.t information
*/ */
llInfo = 7, llInfo = CFG_LOGLEVEL_INFO - MIN_LOGLEVEL_ID,
/** /**
* Events related to global replication * Events related to global replication
*/ */
llGrep = 8 llGrep = CFG_LOGLEVEL_GREP - MIN_LOGLEVEL_ID
}; };
struct LogLevelCategoryName { struct LogLevelCategoryName {
...@@ -107,7 +115,7 @@ public: ...@@ -107,7 +115,7 @@ public:
/** /**
* No of categories * No of categories
*/ */
#define _LOGLEVEL_CATEGORIES 9 #define _LOGLEVEL_CATEGORIES 10
static const Uint32 LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES; static const Uint32 LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES;
void clear(); void clear();
......
#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
...@@ -37,13 +37,11 @@ public: ...@@ -37,13 +37,11 @@ public:
Uint32 requestType; // direct flag, output code Uint32 requestType; // direct flag, output code
Uint32 output; Uint32 output;
}; };
union {
Uint32 nodeId; // nodeId input for GetNodeGroupMembers Uint32 nodeId; // nodeId input for GetNodeGroupMembers
NodeBitmask mask; /* set of NDB nodes, input for ArbitCheck, NodeBitmask mask; /* set of NDB nodes, input for ArbitCheck,
* output for GetNodeGroupMembers * output for GetNodeGroupMembers
*/ */
};
enum RequestType { enum RequestType {
Direct = 0x1, Direct = 0x1,
ArbitCheck = 0x2, ArbitCheck = 0x2,
...@@ -57,7 +55,7 @@ public: ...@@ -57,7 +55,7 @@ public:
Partitioning = 3 // possible network partitioning Partitioning = 3 // possible network partitioning
}; };
STATIC_CONST( SignalLength = 2 + NodeBitmask::Size ); STATIC_CONST( SignalLength = 3 + NodeBitmask::Size );
}; };
#endif #endif
#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
...@@ -88,7 +88,7 @@ class CreateFragmentationConf { ...@@ -88,7 +88,7 @@ class CreateFragmentationConf {
friend bool printCREATE_FRAGMENTATION_CONF(FILE *, friend bool printCREATE_FRAGMENTATION_CONF(FILE *,
const Uint32 *, Uint32, Uint16); const Uint32 *, Uint32, Uint16);
public: public:
STATIC_CONST( SignalLength = 3 ); STATIC_CONST( SignalLength = 4 );
SECTION( FRAGMENTS = 0 ); SECTION( FRAGMENTS = 0 );
private: private:
......
...@@ -100,6 +100,7 @@ public: ...@@ -100,6 +100,7 @@ public:
CustomTriggerId = 25, CustomTriggerId = 25,
FrmLen = 26, FrmLen = 26,
FrmData = 27, FrmData = 27,
FragmentCount = 128, // No of fragments in table (!fragment replicas)
TableEnd = 999, TableEnd = 999,
AttributeName = 1000, // String, Mandatory AttributeName = 1000, // String, Mandatory
...@@ -277,6 +278,7 @@ public: ...@@ -277,6 +278,7 @@ public:
Uint32 CustomTriggerId; Uint32 CustomTriggerId;
Uint32 FrmLen; Uint32 FrmLen;
char FrmData[MAX_FRM_DATA_SIZE]; char FrmData[MAX_FRM_DATA_SIZE];
Uint32 FragmentCount;
void init(); void init();
}; };
......
...@@ -101,7 +101,8 @@ public: ...@@ -101,7 +101,8 @@ public:
NoSuchTable = 1, NoSuchTable = 1,
DropWoPrep = 2, // Calling Drop with first calling PrepDrop DropWoPrep = 2, // Calling Drop with first calling PrepDrop
PrepDropInProgress = 3, PrepDropInProgress = 3,
DropInProgress = 4 DropInProgress = 4,
NF_FakeErrorREF = 5
}; };
private: private:
......
...@@ -39,7 +39,7 @@ class EventSubscribeReq { ...@@ -39,7 +39,7 @@ class EventSubscribeReq {
friend class MgmtSrvr; friend class MgmtSrvr;
public: public:
STATIC_CONST( SignalLength = 14 ); STATIC_CONST( SignalLength = 22 );
private: private:
/** /**
* Note: If you use the same blockRef as you have used earlier, * Note: If you use the same blockRef as you have used earlier,
...@@ -53,8 +53,8 @@ private: ...@@ -53,8 +53,8 @@ private:
*/ */
Uint32 noOfEntries; Uint32 noOfEntries;
Uint32 theCategories[6]; Uint32 theCategories[10];
Uint32 theLevels[6]; Uint32 theLevels[10];
}; };
#endif #endif
...@@ -39,6 +39,7 @@ class FsOpenReq { ...@@ -39,6 +39,7 @@ class FsOpenReq {
friend class Backup; friend class Backup;
friend class Dbdict; friend class Dbdict;
friend class Ndbcntr; // For initial start... friend class Ndbcntr; // For initial start...
friend class Dbdih;
/** /**
* For printing * For printing
......
...@@ -25,6 +25,7 @@ class KeyInfo { ...@@ -25,6 +25,7 @@ class KeyInfo {
*/ */
friend class DbUtil; friend class DbUtil;
friend class NdbOperation; friend class NdbOperation;
friend class NdbScanOperation;
/** /**
* Reciver(s) * Reciver(s)
......
...@@ -88,7 +88,8 @@ public: ...@@ -88,7 +88,8 @@ public:
NoSuchTable = 1, NoSuchTable = 1,
PrepDropInProgress = 2, PrepDropInProgress = 2,
DropInProgress = 3, DropInProgress = 3,
InvalidTableState = 4 InvalidTableState = 4,
NF_FakeErrorREF = 5
}; };
private: private:
...@@ -137,7 +138,8 @@ public: ...@@ -137,7 +138,8 @@ public:
enum ErrorCode { enum ErrorCode {
NoSuchTable = 1, NoSuchTable = 1,
IllegalTableState = 2, IllegalTableState = 2,
DropInProgress = 3 DropInProgress = 3,
NF_FakeErrorREF = 4
}; };
Uint32 tableId; Uint32 tableId;
......
#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
...@@ -48,11 +48,13 @@ class ReadNodesConf { ...@@ -48,11 +48,13 @@ class ReadNodesConf {
friend class Suma; friend class Suma;
friend class Grep; friend class Grep;
friend bool printREAD_NODES_CONF(FILE*, const Uint32 *, Uint32, Uint16);
public: public:
STATIC_CONST( SignalLength = 2 + 6*NodeBitmask::Size ); STATIC_CONST( SignalLength = 3 + 5*NdbNodeBitmask::Size );
private: private:
Uint32 noOfNodes; Uint32 noOfNodes;
Uint32 ndynamicId;
/** /**
* *
...@@ -63,47 +65,21 @@ private: ...@@ -63,47 +65,21 @@ private:
/** /**
* This array defines all the ndb nodes in the system * This array defines all the ndb nodes in the system
*/ */
Uint32 allNodes[NodeBitmask::Size]; union {
Uint32 allNodes[NdbNodeBitmask::Size];
Uint32 definedNodes[NdbNodeBitmask::Size];
};
/** /**
* This array describes wheather the nodes are currently active * This array describes wheather the nodes are currently active
* *
* NOTE Not valid when send from Qmgr * NOTE Not valid when send from Qmgr
*/ */
Uint32 inactiveNodes[NodeBitmask::Size]; Uint32 inactiveNodes[NdbNodeBitmask::Size];
/** Uint32 clusterNodes[NdbNodeBitmask::Size]; // From Qmgr
* This array describes the version id of the nodes Uint32 startingNodes[NdbNodeBitmask::Size]; // From Cntr
* The version id is a 4 bit number Uint32 startedNodes[NdbNodeBitmask::Size]; // From Cntr
*
* NOTE Not valid when send from Qmgr
*/
Uint32 theVersionIds[4*NodeBitmask::Size];
static void setVersionId(NodeId, Uint8 versionId, Uint32 theVersionIds[]);
static Uint8 getVersionId(NodeId, const Uint32 theVersionIds[]);
}; };
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 #endif
...@@ -33,8 +33,8 @@ class ScanTabReq { ...@@ -33,8 +33,8 @@ class ScanTabReq {
/** /**
* Sender(s) * Sender(s)
*/ */
friend class NdbOperation;
friend class NdbConnection; friend class NdbConnection;
friend class NdbScanOperation;
/** /**
* For printing * For printing
...@@ -73,6 +73,7 @@ private: ...@@ -73,6 +73,7 @@ private:
static Uint8 getHoldLockFlag(const UintR & requestInfo); static Uint8 getHoldLockFlag(const UintR & requestInfo);
static Uint8 getReadCommittedFlag(const UintR & requestInfo); static Uint8 getReadCommittedFlag(const UintR & requestInfo);
static Uint8 getRangeScanFlag(const UintR & requestInfo); static Uint8 getRangeScanFlag(const UintR & requestInfo);
static Uint8 getScanBatch(const UintR & requestInfo);
/** /**
* Set:ers for requestInfo * Set:ers for requestInfo
...@@ -83,7 +84,7 @@ private: ...@@ -83,7 +84,7 @@ private:
static void setHoldLockFlag(UintR & requestInfo, Uint32 flag); static void setHoldLockFlag(UintR & requestInfo, Uint32 flag);
static void setReadCommittedFlag(UintR & requestInfo, Uint32 flag); static void setReadCommittedFlag(UintR & requestInfo, Uint32 flag);
static void setRangeScanFlag(UintR & requestInfo, Uint32 flag); static void setRangeScanFlag(UintR & requestInfo, Uint32 flag);
static void setScanBatch(Uint32& requestInfo, Uint32 sz);
}; };
/** /**
...@@ -94,10 +95,11 @@ private: ...@@ -94,10 +95,11 @@ private:
h = Hold lock mode - 1 Bit 10 h = Hold lock mode - 1 Bit 10
c = Read Committed - 1 Bit 11 c = Read Committed - 1 Bit 11
x = Range Scan (TUX) - 1 Bit 15 x = Range Scan (TUX) - 1 Bit 15
b = Scan batch - 5 Bit 16-19 (max 15)
1111111111222222222233 1111111111222222222233
01234567890123456789012345678901 01234567890123456789012345678901
ppppppppl hc x ppppppppl hc xbbbbb
*/ */
#define PARALLELL_SHIFT (0) #define PARALLELL_SHIFT (0)
...@@ -115,6 +117,9 @@ private: ...@@ -115,6 +117,9 @@ private:
#define RANGE_SCAN_SHIFT (15) #define RANGE_SCAN_SHIFT (15)
#define RANGE_SCAN_MASK (1) #define RANGE_SCAN_MASK (1)
#define SCAN_BATCH_SHIFT (16)
#define SCAN_BATCH_MASK (31)
inline inline
Uint8 Uint8
ScanTabReq::getParallelism(const UintR & requestInfo){ ScanTabReq::getParallelism(const UintR & requestInfo){
...@@ -145,6 +150,12 @@ ScanTabReq::getRangeScanFlag(const UintR & requestInfo){ ...@@ -145,6 +150,12 @@ ScanTabReq::getRangeScanFlag(const UintR & requestInfo){
return (Uint8)((requestInfo >> RANGE_SCAN_SHIFT) & RANGE_SCAN_MASK); return (Uint8)((requestInfo >> RANGE_SCAN_SHIFT) & RANGE_SCAN_MASK);
} }
inline
Uint8
ScanTabReq::getScanBatch(const Uint32 & requestInfo){
return (Uint8)((requestInfo >> SCAN_BATCH_SHIFT) & SCAN_BATCH_MASK);
}
inline inline
void void
ScanTabReq::clearRequestInfo(UintR & requestInfo){ ScanTabReq::clearRequestInfo(UintR & requestInfo){
...@@ -186,6 +197,12 @@ ScanTabReq::setRangeScanFlag(UintR & requestInfo, Uint32 flag){ ...@@ -186,6 +197,12 @@ ScanTabReq::setRangeScanFlag(UintR & requestInfo, Uint32 flag){
requestInfo |= (flag << RANGE_SCAN_SHIFT); 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,6 +230,7 @@ public: ...@@ -213,6 +230,7 @@ public:
* Length of signal * Length of signal
*/ */
STATIC_CONST( SignalLength = 4 ); STATIC_CONST( SignalLength = 4 );
static const Uint32 EndOfData = (1 << 31);
private: private:
...@@ -225,29 +243,15 @@ private: ...@@ -225,29 +243,15 @@ private:
UintR requestInfo; // DATA 1 UintR requestInfo; // DATA 1
UintR transId1; // DATA 2 UintR transId1; // DATA 2
UintR transId2; // DATA 3 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: ...@@ -267,33 +271,6 @@ private:
#define STATUS_SHIFT (8) #define STATUS_SHIFT (8)
#define STATUS_MASK (0xFF) #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 * SENDER: Dbtc, API
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#define SET_LOGLEVEL_ORD_HPP #define SET_LOGLEVEL_ORD_HPP
#include <LogLevel.hpp> #include <LogLevel.hpp>
#include "SignalData.hpp"
/** /**
* *
......
...@@ -33,6 +33,7 @@ class TcCommitConf { ...@@ -33,6 +33,7 @@ class TcCommitConf {
* Reciver(s) * Reciver(s)
*/ */
friend class Ndb; friend class Ndb;
friend class NdbConnection;
public: public:
STATIC_CONST( SignalLength = 3 ); STATIC_CONST( SignalLength = 3 );
......
...@@ -38,6 +38,7 @@ class TcKeyReq { ...@@ -38,6 +38,7 @@ class TcKeyReq {
friend class Ndbcntr; friend class Ndbcntr;
friend class NdbOperation; friend class NdbOperation;
friend class NdbIndexOperation; friend class NdbIndexOperation;
friend class NdbScanOperation;
friend class DbUtil; friend class DbUtil;
/** /**
......
#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
...@@ -84,9 +84,10 @@ extern "C" { ...@@ -84,9 +84,10 @@ extern "C" {
NDB_MGM_NODE_TYPE_API = 0, /*/< An application node (API)*/ NDB_MGM_NODE_TYPE_API = 0, /*/< An application node (API)*/
NDB_MGM_NODE_TYPE_NDB = 1, /*/< A database node (DB)*/ 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_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_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" { ...@@ -199,6 +200,8 @@ extern "C" {
int node_group; ///< Node group of node int node_group; ///< Node group of node
///< (only valid for DB nodes) ///< (only valid for DB nodes)
int version; ///< Internal version number 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" { ...@@ -654,6 +657,36 @@ extern "C" {
int ndb_mgm_exit_single_user(NdbMgmHandle handle, int ndb_mgm_exit_single_user(NdbMgmHandle handle,
struct ndb_mgm_reply* reply); 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 #ifdef __cplusplus
} }
#endif #endif
......
#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
#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
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#define ConfigRetriever_H #define ConfigRetriever_H
#include <ndb_types.h> #include <ndb_types.h>
#include <Properties.hpp> #include <mgmapi.h>
/** /**
* @class ConfigRetriever * @class ConfigRetriever
...@@ -44,10 +44,10 @@ public: ...@@ -44,10 +44,10 @@ public:
* to establish a connection. This is repeated until a connection is * to establish a connection. This is repeated until a connection is
* established, so the function hangs until a connection is established. * 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. * 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(); const char * getErrorString();
...@@ -72,21 +72,16 @@ public: ...@@ -72,21 +72,16 @@ public:
*/ */
inline Uint32 getOwnNodeId() { return _ownNodeId; } inline Uint32 getOwnNodeId() { return _ownNodeId; }
/**
* Get configuration object
*/
class Properties * getConfig(int versionId);
/** /**
* Get config using socket * Get config using socket
*/ */
class Properties * getConfig(const char * mgmhost, unsigned int port, struct ndb_mgm_configuration * getConfig(const char * mgmhost, short port,
Uint32 nodeId, int versionId); int versionId);
/** /**
* Get config from file * Get config from file
*/ */
class Properties * getConfig(const char * filename, Uint32 nodeId, struct ndb_mgm_configuration * getConfig(const char * file, int versionId);
int versionId);
private: private:
char * errorString; char * errorString;
enum ErrorType { enum ErrorType {
...@@ -97,18 +92,17 @@ private: ...@@ -97,18 +92,17 @@ private:
void setError(ErrorType, const char * errorMsg); 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; char * _localConfigFileName;
struct LocalConfig * _localConfig; struct LocalConfig * _localConfig;
int _ownNodeId; int _ownNodeId;
char * m_connectString; char * m_connectString;
char * m_defaultConnectString; char * m_defaultConnectString;
/**
* Verify config
*/
bool verifyConfig(const struct ndb_mgm_configuration *, int type);
}; };
#endif #endif
......
...@@ -58,6 +58,10 @@ public: ...@@ -58,6 +58,10 @@ public:
void print() const { props->print(); } void print() const { props->print(); }
static Uint32 configureTransporters(Uint32 nodeId,
const class ndb_mgm_configuration &,
class TransporterRegistry &);
private: private:
NodeId the_ownId; NodeId the_ownId;
Properties * props; Properties * props;
......
...@@ -867,6 +867,7 @@ class NdbObjectIdMap; ...@@ -867,6 +867,7 @@ class NdbObjectIdMap;
class NdbOperation; class NdbOperation;
class NdbEventOperationImpl; class NdbEventOperationImpl;
class NdbScanOperation; class NdbScanOperation;
class NdbIndexScanOperation;
class NdbIndexOperation; class NdbIndexOperation;
class NdbConnection; class NdbConnection;
class NdbApiSignal; class NdbApiSignal;
...@@ -875,7 +876,6 @@ class NdbLabel; ...@@ -875,7 +876,6 @@ class NdbLabel;
class NdbBranch; class NdbBranch;
class NdbSubroutine; class NdbSubroutine;
class NdbCall; class NdbCall;
class NdbScanReceiver;
class Table; class Table;
class BaseString; class BaseString;
class NdbEventOperation; class NdbEventOperation;
...@@ -960,8 +960,9 @@ class Ndb ...@@ -960,8 +960,9 @@ class Ndb
friend class NdbConnection; friend class NdbConnection;
friend class Table; friend class Table;
friend class NdbApiSignal; friend class NdbApiSignal;
friend class NdbScanReceiver;
friend class NdbIndexOperation; friend class NdbIndexOperation;
friend class NdbScanOperation;
friend class NdbIndexScanOperation;
friend class NdbDictionaryImpl; friend class NdbDictionaryImpl;
friend class NdbDictInterface; friend class NdbDictInterface;
...@@ -1439,7 +1440,7 @@ private: ...@@ -1439,7 +1440,7 @@ private:
NdbConnection* doConnect(Uint32 nodeId); NdbConnection* doConnect(Uint32 nodeId);
void doDisconnect(); 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 NdbLabel* getNdbLabel(); // Get a NdbLabel from idle list
NdbBranch* getNdbBranch(); // Get a NdbBranch from idle list NdbBranch* getNdbBranch(); // Get a NdbBranch from idle list
NdbSubroutine* getNdbSubroutine();// Get a NdbSubroutine from idle NdbSubroutine* getNdbSubroutine();// Get a NdbSubroutine from idle
...@@ -1448,21 +1449,21 @@ private: ...@@ -1448,21 +1449,21 @@ private:
NdbRecAttr* getRecAttr(); // Get a receeive attribute object from NdbRecAttr* getRecAttr(); // Get a receeive attribute object from
// idle list of the Ndb object. // idle list of the Ndb object.
NdbOperation* getOperation(); // Get an operation from idle list 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 NdbIndexOperation* getIndexOperation();// Get an index operation from idle
class NdbGlobalEventBufferHandle* getGlobalEventBufferHandle(); class NdbGlobalEventBufferHandle* getGlobalEventBufferHandle();
void releaseSignal(NdbApiSignal* anApiSignal); void releaseSignal(NdbApiSignal* anApiSignal);
void releaseSignalsInList(NdbApiSignal** pList); void releaseSignalsInList(NdbApiSignal** pList);
void releaseNdbScanRec(NdbScanReceiver* aNdbScanRec); void releaseNdbScanRec(NdbReceiver* aNdbScanRec);
void releaseNdbLabel(NdbLabel* anNdbLabel); void releaseNdbLabel(NdbLabel* anNdbLabel);
void releaseNdbBranch(NdbBranch* anNdbBranch); void releaseNdbBranch(NdbBranch* anNdbBranch);
void releaseNdbSubroutine(NdbSubroutine* anNdbSubroutine); void releaseNdbSubroutine(NdbSubroutine* anNdbSubroutine);
void releaseNdbCall(NdbCall* anNdbCall); void releaseNdbCall(NdbCall* anNdbCall);
void releaseRecAttr (NdbRecAttr* aRecAttr); void releaseRecAttr (NdbRecAttr* aRecAttr);
void releaseOperation(NdbOperation* anOperation); void releaseOperation(NdbOperation* anOperation);
void releaseScanOperation(NdbScanOperation* aScanOperation); void releaseScanOperation(NdbIndexScanOperation*);
void check_send_timeout(); void check_send_timeout();
void remove_sent_list(Uint32); void remove_sent_list(Uint32);
...@@ -1558,7 +1559,6 @@ private: ...@@ -1558,7 +1559,6 @@ private:
void* int2void (Uint32 val); void* int2void (Uint32 val);
NdbReceiver* void2rec (void* val); NdbReceiver* void2rec (void* val);
NdbConnection* void2con (void* val); NdbConnection* void2con (void* val);
NdbScanReceiver* void2rec_srec(void* val);
NdbOperation* void2rec_op (void* val); NdbOperation* void2rec_op (void* val);
NdbIndexOperation* void2rec_iop (void* val); NdbIndexOperation* void2rec_iop (void* val);
...@@ -1598,7 +1598,7 @@ private: ...@@ -1598,7 +1598,7 @@ private:
NdbOperation* theOpIdleList; // First operation in the idle list. 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. NdbIndexOperation* theIndexOpIdleList; // First index operation in the idle list.
NdbConnection* theTransactionList; NdbConnection* theTransactionList;
NdbConnection** theConnectionArray; NdbConnection** theConnectionArray;
...@@ -1608,7 +1608,7 @@ private: ...@@ -1608,7 +1608,7 @@ private:
NdbBranch* theBranchList; // First branch descriptor in list NdbBranch* theBranchList; // First branch descriptor in list
NdbSubroutine* theSubroutineList; // First subroutine descriptor in NdbSubroutine* theSubroutineList; // First subroutine descriptor in
NdbCall* theCallList; // First call descriptor in list NdbCall* theCallList; // First call descriptor in list
NdbScanReceiver* theScanList; NdbReceiver* theScanList;
Uint32 theMyRef; // My block reference Uint32 theMyRef; // My block reference
Uint32 theNode; // The node number of our node Uint32 theNode; // The node number of our node
......
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
#include "NdbOperation.hpp" #include "NdbOperation.hpp"
#include "NdbScanOperation.hpp" #include "NdbScanOperation.hpp"
#include "NdbIndexOperation.hpp" #include "NdbIndexOperation.hpp"
#include "NdbIndexScanOperation.hpp"
#include "NdbScanFilter.hpp"
#include "NdbSchemaCon.hpp"
#include "NdbSchemaOp.hpp"
#include "NdbRecAttr.hpp" #include "NdbRecAttr.hpp"
#include "NdbResultSet.hpp" #include "NdbResultSet.hpp"
#include "NdbDictionary.hpp" #include "NdbDictionary.hpp"
......
...@@ -22,12 +22,11 @@ ...@@ -22,12 +22,11 @@
class NdbConnection; class NdbConnection;
class NdbOperation; class NdbOperation;
class NdbCursorOperation;
class NdbScanOperation; class NdbScanOperation;
class NdbIndexScanOperation;
class NdbIndexOperation; class NdbIndexOperation;
class NdbApiSignal; class NdbApiSignal;
class Ndb; class Ndb;
class NdbScanReceiver;
/** /**
...@@ -159,7 +158,7 @@ class NdbConnection ...@@ -159,7 +158,7 @@ class NdbConnection
friend class NdbOperation; friend class NdbOperation;
friend class NdbScanOperation; friend class NdbScanOperation;
friend class NdbIndexOperation; friend class NdbIndexOperation;
friend class NdbScanReceiver; friend class NdbIndexScanOperation;
public: public:
...@@ -175,57 +174,32 @@ public: ...@@ -175,57 +174,32 @@ public:
*/ */
NdbOperation* getNdbOperation(const char* aTableName); 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 an operation from NdbScanOperation idlelist and
* get the NdbConnection object which * get the NdbConnection object which
* was fetched by startTransaction pointing to this operation. * was fetched by startTransaction pointing to this operation.
* This operation will set the theTableId
* in the NdbOperation object.synchronous.
* *
* @param aTableName a table name. * @param aTableName a table name.
* @return pointer to an NdbOperation object if successful, otherwise NULL * @return pointer to an NdbOperation object if successful, otherwise NULL
*/ */
NdbScanOperation* getNdbScanOperation(const char* aTableName); NdbScanOperation* getNdbScanOperation(const char* aTableName);
#endif
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/** /**
* Get an operation from NdbScanOperation idlelist and * Get an operation from NdbScanOperation idlelist and
* get the NdbConnection object which * get the NdbConnection object which
* was fetched by startTransaction pointing to this operation. * 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 anIndexName The index name.
* @param aTableName a table name. * @param aTableName a table name.
* @return pointer to an NdbOperation object if successful, otherwise NULL * @return pointer to an NdbOperation object if successful, otherwise NULL
*/ */
NdbScanOperation* getNdbScanOperation(const char* anIndexName, NdbIndexScanOperation* getNdbIndexScanOperation(const char* anIndexName,
const char* aTableName); const char* aTableName);
#endif
/** /**
* Get an operation from NdbIndexOperation idlelist and * Get an operation from NdbIndexOperation idlelist and
* get the NdbConnection object that * get the NdbConnection object that
* was fetched by startTransaction pointing to this operation. * 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 indexName An index name (as created by createIndex).
* @param tableName A table name. * @param tableName A table name.
...@@ -337,75 +311,6 @@ public: ...@@ -337,75 +311,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 * @name Meta Information
* @{ * @{
...@@ -581,13 +486,7 @@ private: ...@@ -581,13 +486,7 @@ private:
int receiveTCINDXCONF(const class TcIndxConf *, Uint32 aDataLength); int receiveTCINDXCONF(const class TcIndxConf *, Uint32 aDataLength);
int receiveTCINDXREF(NdbApiSignal*); int receiveTCINDXREF(NdbApiSignal*);
int receiveSCAN_TABREF(NdbApiSignal*); int receiveSCAN_TABREF(NdbApiSignal*);
int receiveSCAN_TABCONF(NdbApiSignal*); int receiveSCAN_TABCONF(NdbApiSignal*, const Uint32*, Uint32 len);
int receiveSCAN_TABINFO(NdbApiSignal*);
int checkNextScanResultComplete();
int sendScanStart();
int sendScanNext(bool stopScanFlag);
int fetchNextScanResult();
int doSend(); // Send all operations int doSend(); // Send all operations
int sendROLLBACK(); // Send of an ROLLBACK int sendROLLBACK(); // Send of an ROLLBACK
...@@ -610,7 +509,7 @@ private: ...@@ -610,7 +509,7 @@ private:
// Release all cursor operations in connection // Release all cursor operations in connection
void releaseOps(NdbOperation*); void releaseOps(NdbOperation*);
void releaseCursorOperations(NdbCursorOperation*); void releaseScanOperations(NdbIndexScanOperation*);
// Set the transaction identity of the transaction // Set the transaction identity of the transaction
void setTransactionId(Uint64 aTransactionId); void setTransactionId(Uint64 aTransactionId);
...@@ -626,7 +525,7 @@ private: ...@@ -626,7 +525,7 @@ private:
int checkMagicNumber(); // Verify correct object int checkMagicNumber(); // Verify correct object
NdbOperation* getNdbOperation(class NdbTableImpl* aTable); NdbOperation* getNdbOperation(class NdbTableImpl* aTable);
NdbScanOperation* getNdbScanOperation(class NdbTableImpl* aTable); NdbIndexScanOperation* getNdbScanOperation(class NdbTableImpl* aTable);
NdbIndexOperation* getNdbIndexOperation(class NdbIndexImpl* anIndex, NdbIndexOperation* getNdbIndexOperation(class NdbIndexImpl* anIndex,
class NdbTableImpl* aTable); class NdbTableImpl* aTable);
...@@ -679,7 +578,6 @@ private: ...@@ -679,7 +578,6 @@ private:
Uint32 theNoOfOpSent; // How many operations have been sent Uint32 theNoOfOpSent; // How many operations have been sent
Uint32 theNoOfOpCompleted; // How many operations have completed Uint32 theNoOfOpCompleted; // How many operations have completed
Uint32 theNoOfOpFetched; // How many operations was actually fetched Uint32 theNoOfOpFetched; // How many operations was actually fetched
Uint32 theNoOfSCANTABCONFRecv; // How many SCAN_TABCONF have been received
Uint32 theMyRef; // Our block reference Uint32 theMyRef; // Our block reference
Uint32 theTCConPtr; // Transaction Co-ordinator connection pointer. Uint32 theTCConPtr; // Transaction Co-ordinator connection pointer.
Uint64 theTransactionId; // theTransactionId of the transaction Uint64 theTransactionId; // theTransactionId of the transaction
...@@ -715,20 +613,16 @@ private: ...@@ -715,20 +613,16 @@ private:
Uint32 theNodeSequence; // The sequence no of the db node Uint32 theNodeSequence; // The sequence no of the db node
bool theReleaseOnClose; bool theReleaseOnClose;
// Cursor operations // Scan operations
bool m_waitForReply; bool m_waitForReply;
NdbCursorOperation* m_theFirstCursorOperation; NdbIndexScanOperation* m_theFirstScanOperation;
NdbCursorOperation* m_theLastCursorOperation; NdbIndexScanOperation* m_theLastScanOperation;
NdbCursorOperation* m_firstExecutedCursorOp; NdbIndexScanOperation* m_firstExecutedScanOp;
// Scan operations
bool theScanFinished;
NdbScanReceiver* theCurrentScanRec; // The current operation to // Scan operations
// distribute to the app. // The operation actually performing the scan
NdbScanReceiver* thePreviousScanRec; // The previous operation read by NdbScanOperation* theScanningOp;
// nextScanResult.
NdbOperation* theScanningOp; // The operation actually performing the scan
Uint32 theBuddyConPtr; Uint32 theBuddyConPtr;
static void sendTC_COMMIT_ACK(NdbApiSignal *, static void sendTC_COMMIT_ACK(NdbApiSignal *,
...@@ -739,6 +633,17 @@ private: ...@@ -739,6 +633,17 @@ private:
#ifdef VM_TRACE #ifdef VM_TRACE
void printState(); void printState();
#endif #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 inline
......
...@@ -17,77 +17,4 @@ ...@@ -17,77 +17,4 @@
#ifndef NdbCursorOperation_H #ifndef NdbCursorOperation_H
#define 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 #endif
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#ifndef NdbIndexOperation_H #ifndef NdbIndexOperation_H
#define NdbIndexOperation_H #define NdbIndexOperation_H
#include <NdbCursorOperation.hpp> #include "NdbOperation.hpp"
class Index; class Index;
class NdbResultSet; class NdbResultSet;
......
/* 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
This diff is collapsed.
...@@ -74,8 +74,9 @@ class AttrInfo; ...@@ -74,8 +74,9 @@ class AttrInfo;
class NdbRecAttr class NdbRecAttr
{ {
friend class NdbOperation; friend class NdbOperation;
friend class NdbIndexScanOperation;
friend class NdbEventOperationImpl; friend class NdbEventOperationImpl;
friend class NdbScanReceiver; friend class NdbReceiver;
friend class Ndb; friend class Ndb;
public: public:
...@@ -244,9 +245,8 @@ private: ...@@ -244,9 +245,8 @@ private:
NdbRecAttr(); NdbRecAttr();
Uint32 attrId() const; /* Get attribute id */ Uint32 attrId() const; /* Get attribute id */
void setNULL(); /* Set NULL indicator */ bool setNULL(); /* Set NULL indicator */
void setNotNULL(); /* Set Not NULL indicator */ bool receive_data(const Uint32*, Uint32);
void setUNDEFINED(); /* Set UNDEFINED indicator */
void release(); /* Release memory if allocated */ void release(); /* Release memory if allocated */
void init(); /* Initialise object when allocated */ void init(); /* Initialise object when allocated */
...@@ -254,6 +254,7 @@ private: ...@@ -254,6 +254,7 @@ private:
void next(NdbRecAttr* aRecAttr); void next(NdbRecAttr* aRecAttr);
NdbRecAttr* next() const; NdbRecAttr* next() const;
int setup(const class NdbColumnImpl* anAttrInfo, char* aValue); int setup(const class NdbColumnImpl* anAttrInfo, char* aValue);
/* Set up attributes and buffers */ /* Set up attributes and buffers */
bool copyoutRequired() const; /* Need to copy data to application */ bool copyoutRequired() const; /* Need to copy data to application */
...@@ -268,6 +269,7 @@ private: ...@@ -268,6 +269,7 @@ private:
Uint32 theAttrId; /* The attribute id */ Uint32 theAttrId; /* The attribute id */
int theNULLind; int theNULLind;
bool m_nullable;
Uint32 theAttrSize; Uint32 theAttrSize;
Uint32 theArraySize; Uint32 theArraySize;
const NdbDictionary::Column* m_column; const NdbDictionary::Column* m_column;
...@@ -288,29 +290,7 @@ NdbRecAttr::getColumn() const { ...@@ -288,29 +290,7 @@ NdbRecAttr::getColumn() const {
inline inline
Uint32 Uint32
NdbRecAttr::attrSize() const { NdbRecAttr::attrSize() const {
return theAttrSize;
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;
}
} }
inline inline
...@@ -448,24 +428,11 @@ NdbRecAttr::attrId() const ...@@ -448,24 +428,11 @@ NdbRecAttr::attrId() const
} }
inline inline
void bool
NdbRecAttr::setNULL() NdbRecAttr::setNULL()
{ {
theNULLind = 1; theNULLind = 1;
} return m_nullable;
inline
void
NdbRecAttr::setNotNULL()
{
theNULLind = 0;
}
inline
void
NdbRecAttr::setUNDEFINED()
{
theNULLind = -1;
} }
inline inline
......
...@@ -23,6 +23,12 @@ ...@@ -23,6 +23,12 @@
class Ndb; class Ndb;
class NdbReceiver class NdbReceiver
{ {
friend class Ndb;
friend class NdbOperation;
friend class NdbScanOperation;
friend class NdbIndexOperation;
friend class NdbIndexScanOperation;
friend class NdbConnection;
public: public:
enum ReceiverType { NDB_UNINITIALIZED, enum ReceiverType { NDB_UNINITIALIZED,
NDB_OPERATION = 1, NDB_OPERATION = 1,
...@@ -31,7 +37,8 @@ public: ...@@ -31,7 +37,8 @@ public:
}; };
NdbReceiver(Ndb *aNdb); NdbReceiver(Ndb *aNdb);
void init(ReceiverType type, void* owner); void init(ReceiverType type, void* owner, bool keyInfo);
void release();
~NdbReceiver(); ~NdbReceiver();
Uint32 getId(){ Uint32 getId(){
...@@ -42,18 +49,51 @@ public: ...@@ -42,18 +49,51 @@ public:
return m_type; return m_type;
} }
inline NdbConnection * getTransaction();
void* getOwner(){ void* getOwner(){
return m_owner; return m_owner;
} }
bool checkMagicNumber() const; bool checkMagicNumber() const;
inline void next(NdbReceiver* next) { m_next = next;}
inline NdbReceiver* next() { return m_next; }
private: private:
Uint32 theMagicNumber; Uint32 theMagicNumber;
Ndb* m_ndb; Ndb* m_ndb;
Uint32 m_id; Uint32 m_id;
Uint32 m_tcPtrI;
Uint32 m_key_info;
ReceiverType m_type; ReceiverType m_type;
void* m_owner; 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 #ifdef NDB_NO_DROPPED_SIGNAL
...@@ -72,5 +112,32 @@ NdbReceiver::checkMagicNumber() const { ...@@ -72,5 +112,32 @@ NdbReceiver::checkMagicNumber() const {
return retVal; 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
#endif #endif
...@@ -30,17 +30,15 @@ ...@@ -30,17 +30,15 @@
#define NdbResultSet_H #define NdbResultSet_H
#include <NdbCursorOperation.hpp>
#include <NdbIndexOperation.hpp>
#include <NdbScanOperation.hpp> #include <NdbScanOperation.hpp>
/** /**
* @class NdbResultSet * @class NdbResultSet
* @brief NdbResultSet contains a NdbCursorOperation. * @brief NdbResultSet contains a NdbScanOperation.
*/ */
class NdbResultSet class NdbResultSet
{ {
friend class NdbCursorOperation; friend class NdbScanOperation;
public: public:
...@@ -93,22 +91,57 @@ public: ...@@ -93,22 +91,57 @@ public:
*/ */
int nextResult(bool fetchAllowed = true); int nextResult(bool fetchAllowed = true);
/**
* Close result set (scan)
*/
void close(); 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();
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();
int deleteTuple(NdbConnection* takeOverTransaction); int deleteTuple(NdbConnection* takeOverTransaction);
private: private:
NdbResultSet(NdbCursorOperation*); NdbResultSet(NdbScanOperation*);
~NdbResultSet(); ~NdbResultSet();
void init(); void init();
NdbCursorOperation* m_operation; NdbScanOperation* m_operation;
}; };
#endif #endif
...@@ -29,67 +29,74 @@ ...@@ -29,67 +29,74 @@
#ifndef NdbScanOperation_H #ifndef NdbScanOperation_H
#define NdbScanOperation_H #define NdbScanOperation_H
#include <NdbOperation.hpp> #include <NdbOperation.hpp>
#include <NdbCursorOperation.hpp>
/** /**
* @class NdbScanOperation * @class NdbScanOperation
* @brief Class of scan operations for use in transactions. * @brief Class of scan operations for use in transactions.
*/ */
class NdbScanOperation : public NdbCursorOperation class NdbScanOperation : public NdbOperation {
{
friend class Ndb; friend class Ndb;
friend class NdbConnection; friend class NdbConnection;
friend class NdbResultSet; friend class NdbResultSet;
friend class NdbOperation; friend class NdbOperation;
public: 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. * readTuples returns a NdbResultSet where tuples are stored.
* Tuples are not stored in NdbResultSet until execute(NoCommit) * Tuples are not stored in NdbResultSet until execute(NoCommit)
* has been executed and nextResult has been called. * has been executed and nextResult has been called.
* *
* @param parallel Scan parallelism * @param parallel Scan parallelism
* @param batch No of rows to fetch from each fragment at a time
* @param LockMode Scan lock handling * @param LockMode Scan lock handling
* @returns NdbResultSet. * @returns NdbResultSet.
* @note specifying 0 for batch and parallall means max performance
*/ */
virtual NdbResultSet* readTuples(unsigned parallel = 0, NdbResultSet* readTuples(LockMode = LM_Read,
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);
}
int updateTuples(); inline NdbResultSet* readTuplesExclusive(int parallell = 0){
int updateTuples(Uint32 parallelism); return readTuples(LM_Exclusive, 0, parallell);
}
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(); protected:
CursorType m_cursor_type;
NdbCursorOperation::CursorType cursorType(); NdbScanOperation(Ndb* aNdb);
~NdbScanOperation();
virtual int nextResult(bool fetchAllowed = true); int nextResult(bool fetchAllowed = true);
virtual void release(); virtual void release();
void closeScan(); void closeScan();
...@@ -105,125 +112,51 @@ private: ...@@ -105,125 +112,51 @@ private:
virtual void setErrorCode(int aErrorCode); virtual void setErrorCode(int aErrorCode);
virtual void setErrorCodeAbort(int aErrorCode); virtual void setErrorCodeAbort(int aErrorCode);
virtual int equal_impl(const NdbColumnImpl* anAttrObject, NdbResultSet * m_resultSet;
const char* aValue, NdbResultSet* getResultSet();
Uint32 len);
private:
NdbConnection *m_transConnection; NdbConnection *m_transConnection;
bool m_autoExecute;
bool m_updateOp;
bool m_writeOp;
bool m_deleteOp;
class SetValueRecList* m_setValueList;
};
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL // Scan related variables
class AttrInfo; Uint32 theBatchSize;
class SetValueRecList; Uint32 theParallelism;
Uint32 m_keyInfo;
NdbApiSignal* theSCAN_TABREQ;
class SetValueRec { int getFirstATTRINFOScan();
friend class SetValueRecList; int saveBoundATTRINFO();
public: int doSendScan(int ProcessorId);
SetValueRec(); int prepareSendScan(Uint32 TC_ConnectPtr, Uint64 TransactionId);
~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
};
SetValueType stype; int fix_receivers(Uint32 parallel, bool keyInfo);
union { Uint32 m_allocated_receivers;
char* anAttrName; NdbReceiver** m_receivers; // All receivers
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;
};
inline Uint32* m_prepared_receivers; // These are to be sent
SetValueRec::SetValueRec() :
next(0)
{
}
class SetValueRecList { Uint32 m_current_api_receiver;
public: Uint32 m_api_receivers_count;
SetValueRecList(); NdbReceiver** m_api_receivers; // These are currently used by api
~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;
};
inline Uint32 m_conf_receivers_count; // NOTE needs mutex to access
SetValueRecList::SetValueRecList() : NdbReceiver** m_conf_receivers; // receive thread puts them here
first(0),
last(0)
{
}
inline Uint32 m_sent_receivers_count; // NOTE needs mutex to access
SetValueRecList::~SetValueRecList() { NdbReceiver** m_sent_receivers; // receive thread puts them here
if (first) delete first;
first = last = 0; int send_next_scan(Uint32 cnt, bool close);
} void receiver_delivered(NdbReceiver*);
void receiver_completed(NdbReceiver*);
void execCLOSE_SCAN_REP(Uint32 errCode);
NdbOperation* takeOverScanOp(OperationType opType, NdbConnection*);
Uint32 m_ordered;
};
inline inline
void SetValueRecList::iterate(SetValueRecList::IterateFn nextfn, NdbOperation& oper) NdbScanOperation::CursorType
{ NdbScanOperation::get_cursor_type() const {
SetValueRec* recPtr = first; return m_cursor_type;
while(recPtr) {
(*nextfn)(*recPtr, oper);
recPtr = recPtr->next; // Move to next in list - MASV
}
} }
#endif #endif
#endif
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
#include <UtilBuffer.hpp> #include <UtilBuffer.hpp>
#include <BaseString.hpp> #include <BaseString.hpp>
int base64_encode(UtilBuffer &src, BaseString &dst); int base64_encode(const UtilBuffer &src, BaseString &dst);
int base64_decode(BaseString &src, UtilBuffer &dst); int base64_decode(const BaseString &src, UtilBuffer &dst);
int base64_decode(const char * s, size_t len, UtilBuffer &dst);
#endif /* !__BASE64_HPP_INCLUDED__ */ #endif /* !__BASE64_HPP_INCLUDED__ */
...@@ -134,7 +134,7 @@ public: ...@@ -134,7 +134,7 @@ public:
/** /**
* getText - Return as hex-digits (only for debug routines). * 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 inline bool
...@@ -302,9 +302,10 @@ BitmaskImpl::setField(unsigned size, Uint32 data[], ...@@ -302,9 +302,10 @@ BitmaskImpl::setField(unsigned size, Uint32 data[],
set(size, data, pos + i, val & (1 << i)); set(size, data, pos + i, val & (1 << i));
} }
inline void inline char *
BitmaskImpl::getText(unsigned size, const Uint32 data[], char* buf) BitmaskImpl::getText(unsigned size, const Uint32 data[], char* buf)
{ {
char * org = buf;
const char* const hex = "0123456789abcdef"; const char* const hex = "0123456789abcdef";
for (int i = (size-1); i >= 0; i--) { for (int i = (size-1); i >= 0; i--) {
Uint32 x = data[i]; Uint32 x = data[i];
...@@ -315,6 +316,7 @@ BitmaskImpl::getText(unsigned size, const Uint32 data[], char* buf) ...@@ -315,6 +316,7 @@ BitmaskImpl::getText(unsigned size, const Uint32 data[], char* buf)
buf += 8; buf += 8;
} }
*buf = 0; *buf = 0;
return org;
} }
/** /**
...@@ -333,7 +335,7 @@ public: ...@@ -333,7 +335,7 @@ public:
Uint32 data[size]; Uint32 data[size];
#if 0 #if 0
Data & operator=(const Bitmask<size> & src) { Data & operator=(const Bitmask<size> & src) {
src.assign(size, data); src.copyto(size, data);
return *this; return *this;
} }
#endif #endif
...@@ -346,6 +348,8 @@ public: ...@@ -346,6 +348,8 @@ public:
STATIC_CONST( NotFound = BitmaskImpl::NotFound ); STATIC_CONST( NotFound = BitmaskImpl::NotFound );
STATIC_CONST( TextLength = size * 8 ); STATIC_CONST( TextLength = size * 8 );
Bitmask() { clear();}
/** /**
* assign - Set all bits in <em>dst</em> to corresponding in <em>src/<em> * assign - Set all bits in <em>dst</em> to corresponding in <em>src/<em>
*/ */
...@@ -359,9 +363,9 @@ public: ...@@ -359,9 +363,9 @@ public:
void assign(const Bitmask<size> & src); 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> * assign <em>this</em> according to <em>src/em>
...@@ -469,7 +473,7 @@ public: ...@@ -469,7 +473,7 @@ public:
/** /**
* getText - Return as hex-digits (only for debug routines). * 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; char* getText(char* buf) const;
}; };
...@@ -498,12 +502,12 @@ template <unsigned size> ...@@ -498,12 +502,12 @@ template <unsigned size>
inline void inline void
Bitmask<size>::assign(const Bitmask<size> & src) Bitmask<size>::assign(const Bitmask<size> & src)
{ {
assign(rep.data, src); assign(rep.data, src.rep.data);
} }
template <unsigned size> template <unsigned size>
inline void inline void
Bitmask<size>::assign(unsigned sz, Uint32 dst[]) const Bitmask<size>::copyto(unsigned sz, Uint32 dst[]) const
{ {
BitmaskImpl::assign(sz, dst, rep.data); BitmaskImpl::assign(sz, dst, rep.data);
} }
...@@ -716,18 +720,17 @@ Bitmask<size>::bitXOR(const Bitmask<size>& mask2) ...@@ -716,18 +720,17 @@ Bitmask<size>::bitXOR(const Bitmask<size>& mask2)
} }
template <unsigned size> template <unsigned size>
void char *
Bitmask<size>::getText(const Uint32 data[], char* buf) Bitmask<size>::getText(const Uint32 data[], char* buf)
{ {
BitmaskImpl::getText(size, data, buf); return BitmaskImpl::getText(size, data, buf);
} }
template <unsigned size> template <unsigned size>
inline char * inline char *
Bitmask<size>::getText(char* buf) const Bitmask<size>::getText(char* buf) const
{ {
getText(rep.data, buf); return getText(rep.data, buf);
return buf;
} }
template <unsigned size> template <unsigned size>
......
#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
...@@ -22,9 +22,10 @@ ...@@ -22,9 +22,10 @@
#include <UtilBuffer.hpp> #include <UtilBuffer.hpp>
enum PropertiesType { enum PropertiesType {
PropertiesType_Uint32, PropertiesType_Uint32 = 0,
PropertiesType_char, PropertiesType_char = 1,
PropertiesType_Properties PropertiesType_Properties = 2,
PropertiesType_Uint64 = 3
}; };
/** /**
...@@ -36,6 +37,7 @@ enum PropertiesType { ...@@ -36,6 +37,7 @@ enum PropertiesType {
*/ */
struct Property { struct Property {
Property(const char* name, Uint32 val); Property(const char* name, Uint32 val);
Property(const char* name, Uint64 val);
Property(const char* name, const char * value); Property(const char* name, const char * value);
Property(const char* name, const class Properties * value); Property(const char* name, const class Properties * value);
~Property(); ~Property();
...@@ -75,6 +77,7 @@ public: ...@@ -75,6 +77,7 @@ public:
void put(const Property *, int len); void put(const Property *, int len);
bool put(const char * name, Uint32 value, bool replace = false); 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 char * value, bool replace = false);
bool put(const char * name, const Properties * value, bool replace = false); bool put(const char * name, const Properties * value, bool replace = false);
...@@ -84,6 +87,7 @@ public: ...@@ -84,6 +87,7 @@ public:
* Compare get(name, no) * Compare get(name, no)
*/ */
bool put(const char *, Uint32 no, Uint32, bool replace = false); 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 char *, bool replace = false);
bool put(const char *, Uint32 no, const Properties *, bool replace = false); bool put(const char *, Uint32 no, const Properties *, bool replace = false);
...@@ -94,6 +98,7 @@ public: ...@@ -94,6 +98,7 @@ public:
bool contains(const char * name) const; bool contains(const char * name) const;
bool get(const char * name, Uint32 * value) 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, const char ** value) const;
bool get(const char * name, BaseString & value) const; bool get(const char * name, BaseString & value) const;
bool get(const char * name, const Properties ** value) const; bool get(const char * name, const Properties ** value) const;
...@@ -109,6 +114,7 @@ public: ...@@ -109,6 +114,7 @@ public:
bool contains(const char * name, Uint32 no) const; 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, 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 char ** value) const;
bool get(const char * name, Uint32 no, const Properties ** value) const; bool get(const char * name, Uint32 no, const Properties ** value) const;
...@@ -230,11 +236,12 @@ Properties::unpack(UtilBuffer &buf) { ...@@ -230,11 +236,12 @@ Properties::unpack(UtilBuffer &buf) {
inline bool inline bool
Properties::pack(UtilBuffer &buf) const { Properties::pack(UtilBuffer &buf) const {
Uint32 size = getPackedSize(); 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); bool ret = pack((Uint32 *)tmp_buf);
if(ret == false) if(ret == false)
return false; return false;
buf.append(tmp_buf, size);
return true; return true;
} }
......
...@@ -63,6 +63,15 @@ public: ...@@ -63,6 +63,15 @@ public:
return 0; 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) { int assign(const void * d, size_t l) {
if (data) free(data); if (data) free(data);
data = NULL; data = NULL;
......
...@@ -17,13 +17,14 @@ ...@@ -17,13 +17,14 @@
#include <LogLevel.hpp> #include <LogLevel.hpp>
const LogLevel::LogLevelCategoryName LogLevel::LOGLEVEL_CATEGORY_NAME[] = { const LogLevel::LogLevelCategoryName LogLevel::LOGLEVEL_CATEGORY_NAME[] = {
{"LogLevelStartup"}, { "LogLevelStartup" },
{"LogLevelShutdown"}, { "LogLevelShutdown" },
{"LogLevelStatistic"}, { "LogLevelStatistic" },
{"LogLevelCheckpoint"}, { "LogLevelCheckpoint" },
{"LogLevelNodeRestart"}, { "LogLevelNodeRestart" },
{"LogLevelConnection"}, { "LogLevelConnection" },
{"LogLevelError"}, { "LogLevelError" },
{"LogLevelInfo"}, { "LogLevelWarning" },
{"LogLevelGrep"} { "LogLevelInfo" },
{ "LogLevelGrep" }
}; };
#include <signaldata/CntrStart.hpp>
bool
printCNTR_START_REQ(FILE * output, const Uint32 * theData,
Uint32 len, Uint16 receiverBlockNo) {
const CntrStartReq * const sig = (CntrStartReq *)theData;
fprintf(output, " nodeId: %x\n", sig->nodeId);
fprintf(output, " startType: %x\n", sig->startType);
fprintf(output, " lastGci: %x\n", sig->lastGci);
return true;
}
bool
printCNTR_START_REF(FILE * output, const Uint32 * theData,
Uint32 len, Uint16 receiverBlockNo) {
const CntrStartRef * const sig = (CntrStartRef *)theData;
fprintf(output, " errorCode: %x\n", sig->errorCode);
fprintf(output, " masterNodeId: %x\n", sig->masterNodeId);
return true;
}
bool
printCNTR_START_CONF(FILE * output, const Uint32 * theData,
Uint32 len, Uint16 receiverBlockNo) {
const CntrStartConf * const sig = (CntrStartConf *)theData;
fprintf(output, " startType: %x\n", sig->startType);
fprintf(output, " startGci: %x\n", sig->startGci);
fprintf(output, " masterNodeId: %x\n", sig->masterNodeId);
fprintf(output, " noStartNodes: %x\n", sig->noStartNodes);
char buf[32*NdbNodeBitmask::Size+1];
fprintf(output, " startedNodes: %s\n",
BitmaskImpl::getText(NdbNodeBitmask::Size, sig->startedNodes, buf));
fprintf(output, " startingNodes: %s\n",
BitmaskImpl::getText(NdbNodeBitmask::Size, sig->startingNodes, buf));
return true;
}
...@@ -48,6 +48,7 @@ DictTabInfo::TableMapping[] = { ...@@ -48,6 +48,7 @@ DictTabInfo::TableMapping[] = {
DTIMAP(Table, CustomTriggerId, CustomTriggerId), DTIMAP(Table, CustomTriggerId, CustomTriggerId),
DTIMAP2(Table, FrmLen, FrmLen, 0, MAX_FRM_DATA_SIZE), DTIMAP2(Table, FrmLen, FrmLen, 0, MAX_FRM_DATA_SIZE),
DTIMAPB(Table, FrmData, FrmData, 0, MAX_FRM_DATA_SIZE, FrmLen), DTIMAPB(Table, FrmData, FrmData, 0, MAX_FRM_DATA_SIZE, FrmLen),
DTIMAP(Table, FragmentCount, FragmentCount),
DTIBREAK(AttributeName) DTIBREAK(AttributeName)
}; };
...@@ -128,6 +129,7 @@ DictTabInfo::Table::init(){ ...@@ -128,6 +129,7 @@ DictTabInfo::Table::init(){
CustomTriggerId = RNIL; CustomTriggerId = RNIL;
FrmLen = 0; FrmLen = 0;
memset(FrmData, 0, sizeof(FrmData)); memset(FrmData, 0, sizeof(FrmData));
FragmentCount = 0;
} }
void void
......
...@@ -25,6 +25,7 @@ SOURCES = TcKeyReq.cpp TcKeyConf.cpp TcKeyRef.cpp \ ...@@ -25,6 +25,7 @@ SOURCES = TcKeyReq.cpp TcKeyConf.cpp TcKeyRef.cpp \
CopyGCI.cpp SystemError.cpp StartRec.cpp NFCompleteRep.cpp \ CopyGCI.cpp SystemError.cpp StartRec.cpp NFCompleteRep.cpp \
FailRep.cpp DisconnectRep.cpp SignalDroppedRep.cpp \ FailRep.cpp DisconnectRep.cpp SignalDroppedRep.cpp \
SumaImpl.cpp NdbSttor.cpp CreateFragmentation.cpp \ SumaImpl.cpp NdbSttor.cpp CreateFragmentation.cpp \
CntrStart.cpp ReadNodesConf.cpp \
UtilLock.cpp TuxMaint.cpp TupAccess.cpp AccLock.cpp \ UtilLock.cpp TuxMaint.cpp TupAccess.cpp AccLock.cpp \
LqhTrans.cpp LqhTrans.cpp
......
#include <signaldata/ReadNodesConf.hpp>
bool
printREAD_NODES_CONF(FILE * output, const Uint32 * theData,
Uint32 len, Uint16 receiverBlockNo) {
const ReadNodesConf * const sig = (ReadNodesConf *)theData;
fprintf(output, " noOfNodes: %x\n", sig->noOfNodes);
fprintf(output, " ndynamicId: %x\n", sig->ndynamicId);
fprintf(output, " masterNodeId: %x\n", sig->masterNodeId);
char buf[32*NdbNodeBitmask::Size+1];
fprintf(output, " allNodes(defined): %s\n",
BitmaskImpl::getText(NdbNodeBitmask::Size, sig->allNodes, buf));
fprintf(output, " inactiveNodes: %s\n",
BitmaskImpl::getText(NdbNodeBitmask::Size, sig->inactiveNodes, buf));
fprintf(output, " clusterNodes: %s\n",
BitmaskImpl::getText(NdbNodeBitmask::Size, sig->clusterNodes, buf));
fprintf(output, " startedNodes: %s\n",
BitmaskImpl::getText(NdbNodeBitmask::Size, sig->startedNodes, buf));
fprintf(output, " startingNodes: %s\n",
BitmaskImpl::getText(NdbNodeBitmask::Size, sig->startingNodes, buf));
return true;
}
...@@ -30,8 +30,12 @@ printSCANTABREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiv ...@@ -30,8 +30,12 @@ printSCANTABREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiv
fprintf(output, " apiConnectPtr: H\'%.8x\n", fprintf(output, " apiConnectPtr: H\'%.8x\n",
sig->apiConnectPtr); sig->apiConnectPtr);
fprintf(output, " requestInfo: H\'%.8x:\n", requestInfo); fprintf(output, " requestInfo: H\'%.8x:\n", requestInfo);
fprintf(output, " Parallellism: %u, LockMode: %u, Holdlock: %u, RangeScan: %u\n", fprintf(output, " Parallellism: %u, Batch: %u LockMode: %u, Holdlock: %u, RangeScan: %u\n",
sig->getParallelism(requestInfo), sig->getLockMode(requestInfo), sig->getHoldLockFlag(requestInfo), sig->getRangeScanFlag(requestInfo)); sig->getParallelism(requestInfo),
sig->getScanBatch(requestInfo),
sig->getLockMode(requestInfo),
sig->getHoldLockFlag(requestInfo),
sig->getRangeScanFlag(requestInfo));
fprintf(output, " attrLen: %d, tableId: %d, tableSchemaVer: %d\n", fprintf(output, " attrLen: %d, tableId: %d, tableSchemaVer: %d\n",
sig->attrLen, sig->tableId, sig->tableSchemaVersion); sig->attrLen, sig->tableId, sig->tableSchemaVersion);
...@@ -39,11 +43,21 @@ printSCANTABREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiv ...@@ -39,11 +43,21 @@ printSCANTABREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiv
fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x) storedProcId: H\'%.8x\n", fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x) storedProcId: H\'%.8x\n",
sig->transId1, sig->transId2, sig->storedProcId); sig->transId1, sig->transId2, sig->storedProcId);
fprintf(output, " OperationPtr(s):\n"); fprintf(output, " OperationPtr(s):\n ");
for(int i = 0; i<16; i=i+4){ Uint32 restLen = (len - 9);
fprintf(output, " H\'%.8x, H\'%.8x, H\'%.8x, H\'%.8x\n", const Uint32 * rest = &sig->apiOperationPtr[0];
sig->apiOperationPtr[i], sig->apiOperationPtr[i+1], while(restLen >= 7){
sig->apiOperationPtr[i+2], sig->apiOperationPtr[i+3]); fprintf(output,
" H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x\n",
rest[0], rest[1], rest[2], rest[3],
rest[4], rest[5], rest[6]);
restLen -= 7;
rest += 7;
}
if(restLen > 0){
for(Uint32 i = 0; i<restLen; i++)
fprintf(output, " H\'%.8x", rest[i]);
fprintf(output, "\n");
} }
return false; return false;
} }
...@@ -60,23 +74,8 @@ printSCANTABCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 recei ...@@ -60,23 +74,8 @@ printSCANTABCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 recei
fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x)\n", fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x)\n",
sig->transId1, sig->transId2); sig->transId1, sig->transId2);
fprintf(output, " requestInfo: H\'%.8x(Operations: %u, ScanStatus: %u(\"", fprintf(output, " requestInfo: H\'%.8x(EndOfData: %d)\n",
requestInfo, sig->getOperations(requestInfo), sig->getScanStatus(requestInfo)); requestInfo, (requestInfo & ScanTabConf::EndOfData != 0));
switch(sig->getScanStatus(requestInfo)){
case 0:
fprintf(output, "ZFALSE");
break;
case 1:
fprintf(output, "ZTRUE");
break;
case 2:
fprintf(output, "ZCLOSED");
break;
default:
fprintf(output, "UNKNOWN");
break;
}
fprintf(output, "\"))\n");
#if 0 #if 0
fprintf(output, " Operation(s):\n"); fprintf(output, " Operation(s):\n");
for(int i = 0; i<16; i++){ for(int i = 0; i<16; i++){
......
...@@ -70,6 +70,8 @@ ...@@ -70,6 +70,8 @@
#include <signaldata/NdbSttor.hpp> #include <signaldata/NdbSttor.hpp>
#include <signaldata/CreateFragmentation.hpp> #include <signaldata/CreateFragmentation.hpp>
#include <signaldata/UtilLock.hpp> #include <signaldata/UtilLock.hpp>
#include <signaldata/CntrStart.hpp>
#include <signaldata/ReadNodesConf.hpp>
#include <signaldata/TuxMaint.hpp> #include <signaldata/TuxMaint.hpp>
#include <signaldata/TupAccess.hpp> #include <signaldata/TupAccess.hpp>
#include <signaldata/AccLock.hpp> #include <signaldata/AccLock.hpp>
...@@ -240,6 +242,12 @@ SignalDataPrintFunctions[] = { ...@@ -240,6 +242,12 @@ SignalDataPrintFunctions[] = {
,{ GSN_UTIL_UNLOCK_REQ, printUTIL_UNLOCK_REQ } ,{ GSN_UTIL_UNLOCK_REQ, printUTIL_UNLOCK_REQ }
,{ GSN_UTIL_UNLOCK_REF, printUTIL_UNLOCK_REF } ,{ GSN_UTIL_UNLOCK_REF, printUTIL_UNLOCK_REF }
,{ GSN_UTIL_UNLOCK_CONF, printUTIL_UNLOCK_CONF } ,{ GSN_UTIL_UNLOCK_CONF, printUTIL_UNLOCK_CONF }
,{ GSN_CNTR_START_REQ, printCNTR_START_REQ }
,{ GSN_CNTR_START_REF, printCNTR_START_REF }
,{ GSN_CNTR_START_CONF, printCNTR_START_CONF }
,{ GSN_READ_NODESCONF, printREAD_NODES_CONF }
,{ GSN_TUX_MAINT_REQ, printTUX_MAINT_REQ } ,{ GSN_TUX_MAINT_REQ, printTUX_MAINT_REQ }
,{ GSN_TUP_READ_ATTRS, printTUP_READ_ATTRS } ,{ GSN_TUP_READ_ATTRS, printTUP_READ_ATTRS }
,{ GSN_TUP_QUERY_TH, printTUP_QUERY_TH } ,{ GSN_TUP_QUERY_TH, printTUP_QUERY_TH }
......
...@@ -101,40 +101,23 @@ const GsnName SignalNames [] = { ...@@ -101,40 +101,23 @@ const GsnName SignalNames [] = {
,{ GSN_ADD_FRAGREQ, "ADD_FRAGREQ" } ,{ GSN_ADD_FRAGREQ, "ADD_FRAGREQ" }
,{ GSN_API_FAILCONF, "API_FAILCONF" } ,{ GSN_API_FAILCONF, "API_FAILCONF" }
,{ GSN_API_FAILREQ, "API_FAILREQ" } ,{ GSN_API_FAILREQ, "API_FAILREQ" }
,{ GSN_APPL_CHANGEREP, "APPL_CHANGEREP" }
// ,{ GSN_APPL_ERROR, "APPL_ERROR" }
,{ GSN_APPL_HB, "APPL_HB" }
,{ GSN_APPL_HBREQ, "APPL_HBREQ" }
,{ GSN_APPL_REGCONF, "APPL_REGCONF" }
,{ GSN_APPL_REGREF, "APPL_REGREF" }
,{ GSN_APPL_REGREQ, "APPL_REGREQ" }
,{ GSN_APPL_RUN, "APPL_RUN" }
,{ GSN_APPL_STARTCONF, "APPL_STARTCONF" }
,{ GSN_APPL_STARTREG, "APPL_STARTREG" }
,{ GSN_CHECK_LCP_STOP, "CHECK_LCP_STOP" } ,{ GSN_CHECK_LCP_STOP, "CHECK_LCP_STOP" }
,{ GSN_CLOSE_COMCONF, "CLOSE_COMCONF" } ,{ GSN_CLOSE_COMCONF, "CLOSE_COMCONF" }
,{ GSN_CLOSE_COMREQ, "CLOSE_COMREQ" } ,{ GSN_CLOSE_COMREQ, "CLOSE_COMREQ" }
,{ GSN_CM_ACKADD, "CM_ACKADD" } ,{ GSN_CM_ACKADD, "CM_ACKADD" }
,{ GSN_CM_ACKALARM, "CM_ACKALARM" }
,{ GSN_CM_ADD, "CM_ADD" } ,{ GSN_CM_ADD, "CM_ADD" }
,{ GSN_CM_APPCHG, "CM_APPCHG" } ,{ GSN_CM_ADD_REP, "CM_ADD_REP" }
,{ GSN_CM_HEARTBEAT, "CM_HEARTBEAT" } ,{ GSN_CM_HEARTBEAT, "CM_HEARTBEAT" }
,{ GSN_CM_INFOCONF, "CM_INFOCONF" }
,{ GSN_CM_INFOREQ, "CM_INFOREQ" }
,{ GSN_CM_INIT, "CM_INIT" }
,{ GSN_CM_NODEINFOCONF, "CM_NODEINFOCONF" } ,{ GSN_CM_NODEINFOCONF, "CM_NODEINFOCONF" }
,{ GSN_CM_NODEINFOREF, "CM_NODEINFOREF" } ,{ GSN_CM_NODEINFOREF, "CM_NODEINFOREF" }
,{ GSN_CM_NODEINFOREQ, "CM_NODEINFOREQ" } ,{ GSN_CM_NODEINFOREQ, "CM_NODEINFOREQ" }
,{ GSN_CM_REGCONF, "CM_REGCONF" } ,{ GSN_CM_REGCONF, "CM_REGCONF" }
,{ GSN_CM_REGREF, "CM_REGREF" } ,{ GSN_CM_REGREF, "CM_REGREF" }
,{ GSN_CM_REGREQ, "CM_REGREQ" } ,{ GSN_CM_REGREQ, "CM_REGREQ" }
,{ GSN_CM_RUN, "CM_RUN" } ,{ GSN_CNTR_START_REQ, "CNTR_START_REQ" }
,{ GSN_CMVMI_CFGCONF, "CMVMI_CFGCONF" } ,{ GSN_CNTR_START_REF, "CNTR_START_REF" }
,{ GSN_CMVMI_CFGREQ, "CMVMI_CFGREQ" } ,{ GSN_CNTR_START_CONF, "CNTR_START_CONF" }
,{ GSN_CNTR_CHANGEREP, "CNTR_CHANGEREP" } ,{ GSN_CNTR_START_REP, "CNTR_START_REP" }
,{ GSN_CNTR_MASTERCONF, "CNTR_MASTERCONF" }
,{ GSN_CNTR_MASTERREF, "CNTR_MASTERREF" }
,{ GSN_CNTR_MASTERREQ, "CNTR_MASTERREQ" }
,{ GSN_CNTR_WAITREP, "CNTR_WAITREP" } ,{ GSN_CNTR_WAITREP, "CNTR_WAITREP" }
,{ GSN_COMMIT, "COMMIT" } ,{ GSN_COMMIT, "COMMIT" }
,{ GSN_COMMIT_FAILCONF, "COMMIT_FAILCONF" } ,{ GSN_COMMIT_FAILCONF, "COMMIT_FAILCONF" }
...@@ -294,9 +277,6 @@ const GsnName SignalNames [] = { ...@@ -294,9 +277,6 @@ const GsnName SignalNames [] = {
,{ GSN_NEXT_SCANREQ, "NEXT_SCANREQ" } ,{ GSN_NEXT_SCANREQ, "NEXT_SCANREQ" }
,{ GSN_NEXTOPERATION, "NEXTOPERATION" } ,{ GSN_NEXTOPERATION, "NEXTOPERATION" }
,{ GSN_NF_COMPLETEREP, "NF_COMPLETEREP" } ,{ GSN_NF_COMPLETEREP, "NF_COMPLETEREP" }
,{ GSN_NODE_STATESCONF, "NODE_STATESCONF" }
,{ GSN_NODE_STATESREF, "NODE_STATESREF" }
,{ GSN_NODE_STATESREQ, "NODE_STATESREQ" }
,{ GSN_OPEN_COMCONF, "OPEN_COMCONF" } ,{ GSN_OPEN_COMCONF, "OPEN_COMCONF" }
,{ GSN_OPEN_COMREF, "OPEN_COMREF" } ,{ GSN_OPEN_COMREF, "OPEN_COMREF" }
,{ GSN_OPEN_COMREQ, "OPEN_COMREQ" } ,{ GSN_OPEN_COMREQ, "OPEN_COMREQ" }
...@@ -318,8 +298,8 @@ const GsnName SignalNames [] = { ...@@ -318,8 +298,8 @@ const GsnName SignalNames [] = {
,{ GSN_SEND_PACKED, "SEND_PACKED" } ,{ GSN_SEND_PACKED, "SEND_PACKED" }
,{ GSN_SET_LOGLEVELORD, "SET_LOGLEVELORD" } ,{ GSN_SET_LOGLEVELORD, "SET_LOGLEVELORD" }
,{ GSN_SHRINKCHECK2, "SHRINKCHECK2" } ,{ GSN_SHRINKCHECK2, "SHRINKCHECK2" }
,{ GSN_SIZEALT_ACK, "SIZEALT_ACK" } ,{ GSN_READ_CONFIG_REQ, "READ_CONFIG_REQ" }
,{ GSN_SIZEALT_REP, "SIZEALT_REP" } ,{ GSN_READ_CONFIG_CONF, "READ_CONFIG_CONF" }
,{ GSN_SR_FRAGIDCONF, "SR_FRAGIDCONF" } ,{ GSN_SR_FRAGIDCONF, "SR_FRAGIDCONF" }
,{ GSN_SR_FRAGIDREF, "SR_FRAGIDREF" } ,{ GSN_SR_FRAGIDREF, "SR_FRAGIDREF" }
,{ GSN_SR_FRAGIDREQ, "SR_FRAGIDREQ" } ,{ GSN_SR_FRAGIDREQ, "SR_FRAGIDREQ" }
...@@ -396,7 +376,6 @@ const GsnName SignalNames [] = { ...@@ -396,7 +376,6 @@ const GsnName SignalNames [] = {
,{ GSN_UPDATE_TOCONF, "UPDATE_TOCONF" } ,{ GSN_UPDATE_TOCONF, "UPDATE_TOCONF" }
,{ GSN_UPDATE_TOREF, "UPDATE_TOREF" } ,{ GSN_UPDATE_TOREF, "UPDATE_TOREF" }
,{ GSN_UPDATE_TOREQ, "UPDATE_TOREQ" } ,{ GSN_UPDATE_TOREQ, "UPDATE_TOREQ" }
,{ GSN_VOTE_MASTERORD, "VOTE_MASTERORD" }
,{ GSN_TUP_ALLOCREQ, "TUP_ALLOCREQ" } ,{ GSN_TUP_ALLOCREQ, "TUP_ALLOCREQ" }
,{ GSN_LQH_ALLOCREQ, "LQH_ALLOCREQ" } ,{ GSN_LQH_ALLOCREQ, "LQH_ALLOCREQ" }
,{ GSN_TUP_DEALLOCREQ, "TUP_DEALLOCREQ" } ,{ GSN_TUP_DEALLOCREQ, "TUP_DEALLOCREQ" }
...@@ -428,7 +407,6 @@ const GsnName SignalNames [] = { ...@@ -428,7 +407,6 @@ const GsnName SignalNames [] = {
,{ GSN_CHECKNODEGROUPSREQ, "CHECKNODEGROUPSREQ" } ,{ GSN_CHECKNODEGROUPSREQ, "CHECKNODEGROUPSREQ" }
,{ GSN_CHECKNODEGROUPSCONF, "CHECKNODEGROUPSCONF" } ,{ GSN_CHECKNODEGROUPSCONF, "CHECKNODEGROUPSCONF" }
,{ GSN_ARBIT_CFG, "ARBIT_CFG" }
,{ GSN_ARBIT_PREPREQ, "ARBIT_PREPREQ" } ,{ GSN_ARBIT_PREPREQ, "ARBIT_PREPREQ" }
,{ GSN_ARBIT_PREPCONF, "ARBIT_PREPCONF" } ,{ GSN_ARBIT_PREPCONF, "ARBIT_PREPCONF" }
,{ GSN_ARBIT_PREPREF, "ARBIT_PREPREF" } ,{ GSN_ARBIT_PREPREF, "ARBIT_PREPREF" }
......
...@@ -26,23 +26,17 @@ ...@@ -26,23 +26,17 @@
//***************************************************************************** //*****************************************************************************
Config::Config() { Config::Config() {
m_info = new ConfigInfo(); m_oldConfig = 0;
} m_configValues = 0;
Config::Config(const Config & org) :
Properties(org) {
m_info = new ConfigInfo();
}
Config::Config(const Properties & org) :
Properties(org) {
m_info = new ConfigInfo();
} }
Config::~Config() { Config::~Config() {
delete m_info; if(m_configValues != 0){
free(m_configValues);
}
if(m_oldConfig != 0)
delete m_oldConfig;
} }
/*****************************************************************************/ /*****************************************************************************/
...@@ -52,26 +46,34 @@ Config::printAllNameValuePairs(NdbOut &out, ...@@ -52,26 +46,34 @@ Config::printAllNameValuePairs(NdbOut &out,
const Properties *prop, const Properties *prop,
const char* s) const { const char* s) const {
Properties::Iterator it(prop); Properties::Iterator it(prop);
const Properties * section = m_info->getInfo(s); const Properties * section = m_info.getInfo(s);
for (const char* n = it.first(); n != NULL; n = it.next()) { for (const char* n = it.first(); n != NULL; n = it.next()) {
Uint32 int_value; Uint32 int_value;
const char* str_value; const char* str_value;
Uint64 int_64;
if (m_info->getStatus(section, n) == ConfigInfo::INTERNAL) if(!section->contains(n))
continue; continue;
if (m_info->getStatus(section, n) == ConfigInfo::DEPRICATED) if (m_info.getStatus(section, n) == ConfigInfo::INTERNAL)
continue; continue;
if (m_info->getStatus(section, n) == ConfigInfo::NOTIMPLEMENTED) if (m_info.getStatus(section, n) == ConfigInfo::DEPRICATED)
continue;
if (m_info.getStatus(section, n) == ConfigInfo::NOTIMPLEMENTED)
continue; continue;
out << n << ": "; out << n << ": ";
switch (m_info->getType(section, n)) { switch (m_info.getType(section, n)) {
case ConfigInfo::INT: case ConfigInfo::INT:
MGM_REQUIRE(prop->get(n, &int_value)); MGM_REQUIRE(prop->get(n, &int_value));
out << int_value; out << int_value;
break; break;
case ConfigInfo::INT64:
MGM_REQUIRE(prop->get(n, &int_64));
out << int_64;
break;
case ConfigInfo::BOOL: case ConfigInfo::BOOL:
MGM_REQUIRE(prop->get(n, &int_value)); MGM_REQUIRE(prop->get(n, &int_value));
if (int_value) { if (int_value) {
...@@ -92,6 +94,7 @@ Config::printAllNameValuePairs(NdbOut &out, ...@@ -92,6 +94,7 @@ Config::printAllNameValuePairs(NdbOut &out,
/*****************************************************************************/ /*****************************************************************************/
void Config::printConfigFile(NdbOut &out) const { void Config::printConfigFile(NdbOut &out) const {
#if 0
Uint32 noOfNodes, noOfConnections, noOfComputers; Uint32 noOfNodes, noOfConnections, noOfComputers;
MGM_REQUIRE(get("NoOfNodes", &noOfNodes)); MGM_REQUIRE(get("NoOfNodes", &noOfNodes));
MGM_REQUIRE(get("NoOfConnections", &noOfConnections)); MGM_REQUIRE(get("NoOfConnections", &noOfConnections));
...@@ -172,15 +175,12 @@ void Config::printConfigFile(NdbOut &out) const { ...@@ -172,15 +175,12 @@ void Config::printConfigFile(NdbOut &out) const {
endl; endl;
} }
} }
} #endif
const
ConfigInfo* Config::getConfigInfo() const {
return m_info;
} }
Uint32 Uint32
Config::getGenerationNumber() const { Config::getGenerationNumber() const {
#if 0
Uint32 ret; Uint32 ret;
const Properties *prop = NULL; const Properties *prop = NULL;
...@@ -191,10 +191,14 @@ Config::getGenerationNumber() const { ...@@ -191,10 +191,14 @@ Config::getGenerationNumber() const {
return ret; return ret;
return 0; return 0;
#else
return 0;
#endif
} }
int int
Config::setGenerationNumber(Uint32 gen) { Config::setGenerationNumber(Uint32 gen) {
#if 0
Properties *prop = NULL; Properties *prop = NULL;
getCopy("SYSTEM", &prop); getCopy("SYSTEM", &prop);
...@@ -205,12 +209,16 @@ Config::setGenerationNumber(Uint32 gen) { ...@@ -205,12 +209,16 @@ Config::setGenerationNumber(Uint32 gen) {
return 0; return 0;
} }
return -1; return -1;
#else
return -1;
#endif
} }
bool bool
Config::change(const BaseString &section, Config::change(const BaseString &section,
const BaseString &param, const BaseString &param,
const BaseString &value) { const BaseString &value) {
#if 0
const char *name; const char *name;
Properties::Iterator it(this); Properties::Iterator it(this);
...@@ -252,4 +260,7 @@ Config::change(const BaseString &section, ...@@ -252,4 +260,7 @@ Config::change(const BaseString &section,
} }
} }
return true; return true;
#else
return false;
#endif
} }
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#ifndef Config_H #ifndef Config_H
#define Config_H #define Config_H
#include <signaldata/ConfigParamId.hpp>
#include <LogLevel.hpp> #include <LogLevel.hpp>
#include <kernel_types.h> #include <kernel_types.h>
...@@ -25,6 +24,9 @@ ...@@ -25,6 +24,9 @@
#include <NdbOut.hpp> #include <NdbOut.hpp>
#include <ndb_limits.h> #include <ndb_limits.h>
#include <Properties.hpp> #include <Properties.hpp>
#include "ConfigInfo.hpp"
class ConfigInfo;
/** /**
* @class Config * @class Config
...@@ -38,14 +40,14 @@ ...@@ -38,14 +40,14 @@
* *
* The following categories (sections) of configuration parameters exists: * The following categories (sections) of configuration parameters exists:
* - COMPUTER, DB, MGM, API, TCP, SCI, SHM, OSE * - COMPUTER, DB, MGM, API, TCP, SCI, SHM, OSE
*
*/ */
class Config : public Properties {
class Config {
public: public:
/** /**
* Constructor which loads the object with an Properties object * Constructor which loads the object with an Properties object
*/ */
Config(const Config & org);
Config(const Properties & org);
Config(); Config();
virtual ~Config(); virtual ~Config();
...@@ -58,8 +60,6 @@ public: ...@@ -58,8 +60,6 @@ public:
printConfigFile(ndb); printConfigFile(ndb);
} }
const class ConfigInfo* getConfigInfo() const;
Uint32 getGenerationNumber() const; Uint32 getGenerationNumber() const;
int setGenerationNumber(Uint32); int setGenerationNumber(Uint32);
...@@ -69,7 +69,13 @@ public: ...@@ -69,7 +69,13 @@ public:
const BaseString &param, const BaseString &param,
const BaseString &value); const BaseString &value);
/**
* Info
*/
const ConfigInfo * getConfigInfo() const { return &m_info;}
private: private:
ConfigInfo m_info;
void printAllNameValuePairs(NdbOut &out, void printAllNameValuePairs(NdbOut &out,
const Properties *prop, const Properties *prop,
...@@ -78,7 +84,9 @@ private: ...@@ -78,7 +84,9 @@ private:
/** /**
* Information about parameters (min, max values etc) * Information about parameters (min, max values etc)
*/ */
const class ConfigInfo* m_info; public:
Properties * m_oldConfig;
struct ndb_mgm_configuration * m_configValues;
}; };
#endif // Config_H #endif // Config_H
This diff is collapsed.
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
* A MANDATORY parameters must be specified in the config file * A MANDATORY parameters must be specified in the config file
* An UNDEFINED parameter may or may not be specified in the config file * An UNDEFINED parameter may or may not be specified in the config file
*/ */
static const Uint32 MANDATORY = ~0; // Default value for mandatory params. static const Uint64 MANDATORY = ~0; // Default value for mandatory params.
static const Uint32 UNDEFINED = (~0)-1; // Default value for undefined params. static const Uint64 UNDEFINED = (~0)-1; // Default value for undefined params.
/** /**
* @class ConfigInfo * @class ConfigInfo
...@@ -38,10 +38,10 @@ static const Uint32 UNDEFINED = (~0)-1; // Default value for undefined params. ...@@ -38,10 +38,10 @@ static const Uint32 UNDEFINED = (~0)-1; // Default value for undefined params.
*/ */
class ConfigInfo { class ConfigInfo {
public: public:
enum Type {BOOL, INT, STRING}; enum Type { BOOL, INT, INT64, STRING, SECTION };
enum Status {USED, ///< Active enum Status { USED, ///< Active
DEPRICATED, ///< Can be, but should not be used anymore DEPRICATED, ///< Can be, but shouldn't
NOTIMPLEMENTED, ///< Can not be used currently. Is ignored. NOTIMPLEMENTED, ///< Is ignored.
INTERNAL ///< Not configurable by the user INTERNAL ///< Not configurable by the user
}; };
...@@ -49,16 +49,16 @@ public: ...@@ -49,16 +49,16 @@ public:
* Entry for one configuration parameter * Entry for one configuration parameter
*/ */
struct ParamInfo { struct ParamInfo {
Uint32 _paramId;
const char* _fname; const char* _fname;
const char* _pname;
const char* _section; const char* _section;
const char* _description; const char* _description;
Status _status; Status _status;
bool _updateable; bool _updateable;
Type _type; Type _type;
Uint32 _default; Uint64 _default;
Uint32 _min; Uint64 _min;
Uint32 _max; Uint64 _max;
}; };
/** /**
...@@ -84,16 +84,15 @@ public: ...@@ -84,16 +84,15 @@ public:
* *
* @note Result is not defined if section/name are wrong! * @note Result is not defined if section/name are wrong!
*/ */
bool verify(const Properties* section, const char* fname, Uint32 value) const; bool verify(const Properties* secti, const char* fname, Uint64 value) const;
bool isSection(const char*) const; bool isSection(const char*) const;
const char* getPName(const Properties * section, const char* fname) const; const char* getDescription(const Properties * sec, const char* fname) const;
const char* getDescription(const Properties * section, const char* fname) const;
Type getType(const Properties * section, const char* fname) const; Type getType(const Properties * section, const char* fname) const;
Status getStatus(const Properties* section, const char* fname) const; Status getStatus(const Properties* section, const char* fname) const;
Uint32 getMin(const Properties * section, const char* fname) const; Uint64 getMin(const Properties * section, const char* fname) const;
Uint32 getMax(const Properties * section, const char* fname) const; Uint64 getMax(const Properties * section, const char* fname) const;
Uint32 getDefault(const Properties * section, const char* fname) const; Uint64 getDefault(const Properties * section, const char* fname) const;
const Properties * getInfo(const char * section) const; const Properties * getInfo(const char * section) const;
const Properties * getDefaults(const char * section) const; const Properties * getDefaults(const char * section) const;
......
...@@ -17,10 +17,14 @@ ...@@ -17,10 +17,14 @@
#include "IPCConfig.hpp" #include "IPCConfig.hpp"
#include <NdbOut.hpp> #include <NdbOut.hpp>
#include <NdbHost.h> #include <NdbHost.h>
#include <TransporterDefinitions.hpp> #include <TransporterDefinitions.hpp>
#include <TransporterRegistry.hpp> #include <TransporterRegistry.hpp>
#include <Properties.hpp> #include <Properties.hpp>
#include <mgmapi_configuration.hpp>
#include <mgmapi_config_parameters.h>
#if defined DEBUG_TRANSPORTER #if defined DEBUG_TRANSPORTER
#define DEBUG(t) ndbout << __FILE__ << ":" << __LINE__ << ":" << t << endl; #define DEBUG(t) ndbout << __FILE__ << ":" << __LINE__ << ":" << t << endl;
#else #else
...@@ -334,3 +338,158 @@ IPCConfig::getNodeType(NodeId id) const { ...@@ -334,3 +338,158 @@ IPCConfig::getNodeType(NodeId id) const {
return out; return out;
} }
Uint32
IPCConfig::configureTransporters(Uint32 nodeId,
const class ndb_mgm_configuration & config,
class TransporterRegistry & tr){
Uint32 noOfTransportersCreated = 0;
ndb_mgm_configuration_iterator iter(config, CFG_SECTION_CONNECTION);
for(iter.first(); iter.valid(); iter.next()){
Uint32 nodeId1, nodeId2, remoteNodeId;
if(iter.get(CFG_CONNECTION_NODE_1, &nodeId1)) continue;
if(iter.get(CFG_CONNECTION_NODE_2, &nodeId2)) continue;
if(nodeId1 != nodeId && nodeId2 != nodeId) continue;
remoteNodeId = (nodeId == nodeId1 ? nodeId2 : nodeId1);
Uint32 sendSignalId = 1;
Uint32 checksum = 1;
if(iter.get(CFG_CONNECTION_SEND_SIGNAL_ID, &sendSignalId)) continue;
if(iter.get(CFG_CONNECTION_CHECKSUM, &checksum)) continue;
Uint32 type = ~0;
if(iter.get(CFG_TYPE_OF_SECTION, &type)) continue;
switch(type){
case CONNECTION_TYPE_SHM:{
SHM_TransporterConfiguration conf;
conf.localNodeId = nodeId;
conf.remoteNodeId = remoteNodeId;
conf.byteOrder = 0;
conf.compression = 0;
conf.checksum = checksum;
conf.signalId = sendSignalId;
if(iter.get(CFG_SHM_KEY, &conf.shmKey)) break;
if(iter.get(CFG_SHM_BUFFER_MEM, &conf.shmSize)) break;
if(!tr.createTransporter(&conf)){
ndbout << "Failed to create SHM Transporter from: "
<< conf.localNodeId << " to: " << conf.remoteNodeId << endl;
} else {
noOfTransportersCreated++;
}
break;
}
case CONNECTION_TYPE_SCI:{
SCI_TransporterConfiguration conf;
conf.localNodeId = nodeId;
conf.remoteNodeId = remoteNodeId;
conf.byteOrder = 0;
conf.compression = 0;
conf.checksum = checksum;
conf.signalId = sendSignalId;
if(iter.get(CFG_SCI_SEND_LIMIT, &conf.sendLimit)) break;
if(iter.get(CFG_SCI_BUFFER_MEM, &conf.bufferSize)) break;
if(nodeId == nodeId1){
if(iter.get(CFG_SCI_NODE1_ADAPTERS, &conf.nLocalAdapters)) break;
if(iter.get(CFG_SCI_NODE2_ADAPTERS, &conf.nRemoteAdapters)) break;
if(iter.get(CFG_SCI_NODE2_ADAPTER0, &conf.remoteSciNodeId0)) break;
if(conf.nRemoteAdapters > 1){
if(iter.get(CFG_SCI_NODE2_ADAPTER1, &conf.remoteSciNodeId1)) break;
}
} else {
if(iter.get(CFG_SCI_NODE2_ADAPTERS, &conf.nLocalAdapters)) break;
if(iter.get(CFG_SCI_NODE1_ADAPTERS, &conf.nRemoteAdapters)) break;
if(iter.get(CFG_SCI_NODE1_ADAPTER0, &conf.remoteSciNodeId0)) break;
if(conf.nRemoteAdapters > 1){
if(iter.get(CFG_SCI_NODE1_ADAPTER1, &conf.remoteSciNodeId1)) break;
}
}
if(!tr.createTransporter(&conf)){
ndbout << "Failed to create SCI Transporter from: "
<< conf.localNodeId << " to: " << conf.remoteNodeId << endl;
} else {
noOfTransportersCreated++;
continue;
}
}
case CONNECTION_TYPE_TCP:{
TCP_TransporterConfiguration conf;
const char * host1, * host2;
if(iter.get(CFG_TCP_HOSTNAME_1, &host1)) break;
if(iter.get(CFG_TCP_HOSTNAME_2, &host2)) break;
if(iter.get(CFG_TCP_SERVER_PORT, &conf.port)) break;
if(iter.get(CFG_TCP_SEND_BUFFER_SIZE, &conf.sendBufferSize)) break;
if(iter.get(CFG_TCP_RECEIVE_BUFFER_SIZE, &conf.maxReceiveSize)) break;
const char * proxy;
if (!iter.get(CFG_TCP_PROXY, &proxy)) {
if (strlen(proxy) > 0 && nodeId2 == nodeId) {
// TODO handle host:port
conf.port = atoi(proxy);
}
}
conf.localNodeId = nodeId;
conf.remoteNodeId = remoteNodeId;
conf.localHostName = (nodeId == nodeId1 ? host1 : host2);
conf.remoteHostName = (nodeId == nodeId1 ? host2 : host1);
conf.byteOrder = 0;
conf.compression = 0;
conf.checksum = checksum;
conf.signalId = sendSignalId;
if(!tr.createTransporter(&conf)){
ndbout << "Failed to create TCP Transporter from: "
<< nodeId << " to: " << remoteNodeId << endl;
} else {
noOfTransportersCreated++;
}
case CONNECTION_TYPE_OSE:{
OSE_TransporterConfiguration conf;
const char * host1, * host2;
if(iter.get(CFG_OSE_HOSTNAME_1, &host1)) break;
if(iter.get(CFG_OSE_HOSTNAME_2, &host2)) break;
if(iter.get(CFG_OSE_PRIO_A_SIZE, &conf.prioASignalSize)) break;
if(iter.get(CFG_OSE_PRIO_B_SIZE, &conf.prioBSignalSize)) break;
if(iter.get(CFG_OSE_RECEIVE_ARRAY_SIZE, &conf.receiveBufferSize)) break;
conf.localNodeId = nodeId;
conf.remoteNodeId = remoteNodeId;
conf.localHostName = (nodeId == nodeId1 ? host1 : host2);
conf.remoteHostName = (nodeId == nodeId1 ? host2 : host1);
conf.byteOrder = 0;
conf.compression = 0;
conf.checksum = checksum;
conf.signalId = sendSignalId;
if(!tr.createTransporter(&conf)){
ndbout << "Failed to create OSE Transporter from: "
<< nodeId << " to: " << remoteNodeId << endl;
} else {
noOfTransportersCreated++;
}
}
default:
ndbout << "Unknown transporter type from: " << nodeId <<
" to: " << remoteNodeId << endl;
break;
}
}
}
return noOfTransportersCreated;
}
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <ndb_global.h> #include <ndb_global.h>
#include <Properties.hpp> #include <Properties.hpp>
#include <ConfigValues.hpp>
class Config; class Config;
class ConfigInfo; class ConfigInfo;
...@@ -28,18 +29,40 @@ class ConfigInfo; ...@@ -28,18 +29,40 @@ class ConfigInfo;
* @class InitConfigFileParser * @class InitConfigFileParser
* @brief Reads initial config file and returns Config object * @brief Reads initial config file and returns Config object
* *
* This class contains one public method InitConfigFileParser::getConfig, * This class contains one public method InitConfigFileParser::parseConfig,
* which reads an initial configuration file and returns a Config * which reads an initial configuration file and returns a Config
* object if the config file has correct syntax and semantic. * object if the config file has correct syntax and semantic.
*/ */
class InitConfigFileParser { class InitConfigFileParser {
public: public:
/**
* Constructor
*/
InitConfigFileParser();
~InitConfigFileParser();
/**
* Reads the initial configuration file, checks syntax and semantic
* and stores internally the values of all parameters.
*
* @returns Config or NULL on failure
* @note must be freed by caller
*/
Config * parseConfig(FILE * file);
Config * parseConfig(const char * filename);
/**
* Parser context struct
*/
enum ContextSectionType { Undefined, Section, DefaultSection }; enum ContextSectionType { Undefined, Section, DefaultSection };
/** /**
* Context = Which section in init config file we are currently parsing * Context = Which section in init config file we are currently parsing
*/ */
struct Context { struct Context {
Context(const ConfigInfo *);
~Context();
ContextSectionType type; ///< Section type (e.g. default section,section) ContextSectionType type; ///< Section type (e.g. default section,section)
char fname[256]; ///< Section name occuring in init config file char fname[256]; ///< Section name occuring in init config file
char pname[256]; ///< Section name stored in properties object char pname[256]; ///< Section name stored in properties object
...@@ -47,8 +70,8 @@ public: ...@@ -47,8 +70,8 @@ public:
Uint32 m_sectionLineno; ///< Where did current section start Uint32 m_sectionLineno; ///< Where did current section start
const ConfigInfo * m_info; // The config info const ConfigInfo * m_info; // The config info
const Properties * m_config; // The config object Properties * m_config; // The config object
const Properties * m_defaults; // The user defaults Properties * m_defaults; // The user defaults
Properties * m_currentSection; // The current section I'm in Properties * m_currentSection; // The current section I'm in
const Properties * m_userDefaults; // The defaults of this section const Properties * m_userDefaults; // The defaults of this section
...@@ -56,36 +79,13 @@ public: ...@@ -56,36 +79,13 @@ public:
const Properties * m_currentInfo; // The "info" for this section const Properties * m_currentInfo; // The "info" for this section
Properties m_userProperties; // User properties (temporary values) Properties m_userProperties; // User properties (temporary values)
ConfigValuesFactory m_configValues; //
public: public:
void reportError(const char * msg, ...); void reportError(const char * msg, ...);
void reportWarning(const char * msg, ...); void reportWarning(const char * msg, ...);
}; };
/**
* Constructor
* @param initialConfigFileName: Name of the initial configuration file
*/
InitConfigFileParser(const char* initialConfigFileName);
~InitConfigFileParser();
/**
* Reads the initial configuration file, checks syntax and semantic
* and stores internally the values of all parameters.
*
* @returns true if succeeded, o/w false (e.g. incorrect config file)
*/
bool readConfigFile();
/**
* Get config. Must execute InitConfigFileParser::readConfigFile first.
*
* @returns Config if succeeded, o/w NULL
*/
const Config* getConfig();
private: private:
/** /**
* Check if line only contains space/comments * Check if line only contains space/comments
...@@ -111,33 +111,16 @@ private: ...@@ -111,33 +111,16 @@ private:
bool parseNameValuePair(Context&, const char* line); bool parseNameValuePair(Context&, const char* line);
bool storeNameValuePair(Context&, const char* fname, const char* value); bool storeNameValuePair(Context&, const char* fname, const char* value);
bool convertStringToUint32(const char* s, Uint32& val, Uint32 log10base = 0); bool convertStringToUint64(const char* s, Uint64& val, Uint32 log10base = 0);
bool convertStringToBool(const char* s, bool& val); bool convertStringToBool(const char* s, bool& val);
bool storeSection(Context&);
const Properties* getSection(const char * name, const Properties* src); const Properties* getSection(const char * name, const Properties* src);
/***************************************************************************
* VARIABLES
***************************************************************************/
FILE* m_initConfigStream;
/** /**
* Information about parameters (min, max values etc) * Information about parameters (min, max values etc)
*/ */
const ConfigInfo* m_info; ConfigInfo* m_info;
/**
* Configuration from initial configuration file
* (returned by InitConfigFileParser::readConfigFile)
*/
Config* m_config;
/**
* Default values specified in default sections
*/
Properties* m_defaults;
bool storeSection(Context&);
}; };
#endif // InitConfigFileParser_H #endif // InitConfigFileParser_H
...@@ -5,6 +5,7 @@ TYPE := ndbapi mgmapiclient ...@@ -5,6 +5,7 @@ TYPE := ndbapi mgmapiclient
PIC_ARCHIVE := Y PIC_ARCHIVE := Y
ARCHIVE_TARGET := mgmsrvcommon ARCHIVE_TARGET := mgmsrvcommon
# Removed temporary
DIRS := printConfig DIRS := printConfig
SOURCES = \ SOURCES = \
...@@ -17,6 +18,8 @@ SOURCES = \ ...@@ -17,6 +18,8 @@ SOURCES = \
SOURCES.c = NdbConfig.c SOURCES.c = NdbConfig.c
CFLAGS_IPCConfig.cpp := -I$(call fixpath,$(NDB_TOP)/src/mgmapi)
include $(NDB_TOP)/Epilogue.mk include $(NDB_TOP)/Epilogue.mk
......
...@@ -7,8 +7,10 @@ BIN_TARGET_ARCHIVES := general portlib ...@@ -7,8 +7,10 @@ BIN_TARGET_ARCHIVES := general portlib
CCFLAGS_LOC += -I.. CCFLAGS_LOC += -I..
SOURCES := printConfig.cpp SOURCES := printConfig.cpp ../ConfigRetriever.cpp
SOURCES.c := ../ConfigRetriever.c ../NdbConfig.c ../LocalConfig.c SOURCES.c := ../NdbConfig.c ../LocalConfig.c
CFLAGS_printConfig.cpp := -I$(call fixpath,$(NDB_TOP)/src/mgmapi)
include $(NDB_TOP)/Epilogue.mk include $(NDB_TOP)/Epilogue.mk
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <ndb_global.h> #include <ndb_global.h>
#include <NdbMain.h> #include <NdbMain.h>
#include <mgmapi.h>
#include <ConfigRetriever.hpp> #include <ConfigRetriever.hpp>
#include <Properties.hpp> #include <Properties.hpp>
#include <NdbOut.hpp> #include <NdbOut.hpp>
...@@ -50,8 +51,8 @@ NDB_COMMAND(printConfig, ...@@ -50,8 +51,8 @@ NDB_COMMAND(printConfig,
return 0; return 0;
} }
Properties * p = 0;
ConfigRetriever c; ConfigRetriever c;
struct ndb_mgm_configuration * p = 0;
if(strcmp("host", argv[1]) == 0){ if(strcmp("host", argv[1]) == 0){
int verId = 0; int verId = 0;
...@@ -64,7 +65,6 @@ NDB_COMMAND(printConfig, ...@@ -64,7 +65,6 @@ NDB_COMMAND(printConfig,
p = c.getConfig(argv[2], p = c.getConfig(argv[2],
atoi(argv[3]), atoi(argv[3]),
atoi(argv[4]),
verId); verId);
} else if (strcmp("file", argv[1]) == 0){ } else if (strcmp("file", argv[1]) == 0){
int verId = 0; int verId = 0;
...@@ -79,12 +79,11 @@ NDB_COMMAND(printConfig, ...@@ -79,12 +79,11 @@ NDB_COMMAND(printConfig,
} }
if(p != 0){ if(p != 0){
p->print(stdout); //
free(p);
} else { } else {
ndbout << "Configuration not found: " << c.getErrorString() << endl; ndbout << "Configuration not found: " << c.getErrorString() << endl;
} }
delete p;
return 0; return 0;
} }
...@@ -22,89 +22,186 @@ static char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ...@@ -22,89 +22,186 @@ static char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789+/"; "0123456789+/";
int int
base64_encode(UtilBuffer &src, BaseString &dst) { base64_encode(const UtilBuffer &src, BaseString &dst) {
char *s = (char *)src.get_data(); const unsigned char *s = (const unsigned char *)src.get_data();
int i = 0; size_t i = 0;
size_t len = 0;
size_t src_len = src.length();
while(i < src_len) {
if(len == 76){
len = 0;
dst.append('\n');
}
while(i < src.length()) { unsigned c;
int c;
c = s[i++]; c = s[i++];
c <<= 8; c <<= 8;
if(i < src.length()) if(i < src_len)
c += s[i]; c += s[i];
c <<= 8; c <<= 8;
i++; i++;
if(i < src.length()) if(i < src_len)
c += s[i]; c += s[i];
i++; i++;
dst.append(base64_table[(c >> 18) & 0x3f]); dst.append(base64_table[(c >> 18) & 0x3f]);
dst.append(base64_table[(c >> 12) & 0x3f]); dst.append(base64_table[(c >> 12) & 0x3f]);
if(i > (src.length() + 1)) if(i > (src_len + 1))
dst.append('='); dst.append('=');
else else
dst.append(base64_table[(c >> 6) & 0x3f]); dst.append(base64_table[(c >> 6) & 0x3f]);
if(i > src.length()) if(i > src_len)
dst.append('='); dst.append('=');
else else
dst.append(base64_table[(c >> 0) & 0x3f]); dst.append(base64_table[(c >> 0) & 0x3f]);
len += 4;
} }
return 0; return 0;
} }
static inline int static inline unsigned
pos(char c) { pos(unsigned char c) {
return strchr(base64_table, c) - base64_table; return strchr(base64_table, c) - base64_table;
} }
int int
base64_decode(BaseString &src, UtilBuffer &dst) { base64_decode(const BaseString &src, UtilBuffer &dst) {
size_t size; return base64_decode(src.c_str(), src.length(), dst);
size = (src.length() * 3) / 4; }
#define SKIP_SPACE(src, i, size){ \
while(i < size && isspace(* src)){ \
i++; \
src++; \
} \
if(i == size){ \
i = size + 1; \
break; \
} \
}
int
base64_decode(const char * src, size_t size, UtilBuffer &dst) {
size_t i = 0; size_t i = 0;
const char *s = src.c_str(); while(i < size){
while(i < size) { unsigned c = 0;
int c = 0;
int mark = 0; int mark = 0;
c += pos(*s++);
SKIP_SPACE(src, i, size);
c += pos(*src++);
c <<= 6; c <<= 6;
i++; i++;
c += pos(*s++); SKIP_SPACE(src, i, size);
c += pos(*src++);
c <<= 6; c <<= 6;
i++; i++;
if(*s != '=') SKIP_SPACE(src, i, size);
c += pos(*s++);
if(* src != '=')
c += pos(*src++);
else { else {
size--; i = size;
mark++; mark = 2;
c <<= 6;
goto end;
} }
c <<= 6; c <<= 6;
i++; i++;
if(*s != '=') SKIP_SPACE(src, i, size);
c += pos(*s++);
if(*src != '=')
c += pos(*src++);
else { else {
size--; i = size;
mark++; mark = 1;
goto end;
} }
/* c <<= 6; */
i++; i++;
end:
char b[3]; char b[3];
b[0] = (c >> 16) & 0xff; b[0] = (c >> 16) & 0xff;
b[1] = (c >> 8) & 0xff; b[1] = (c >> 8) & 0xff;
b[2] = (c >> 0) & 0xff; b[2] = (c >> 0) & 0xff;
dst.append((void *)b, 3-mark); dst.append((void *)b, 3-mark);
} }
if(i != size){
abort();
return -1;
}
return 0; return 0;
} }
#ifdef __TEST__B64
/**
* USER_FLAGS="-D__TEST__B64" make Base64.o && g++ Base64.o BaseString.o
*/
inline
void
require(bool b){
if(!b)
abort();
}
int
main(void){
for(int i = 0; i < 500; i++){
const size_t len = rand() % 10000 + 1;
UtilBuffer src;
for(size_t j = 0; j<len; j++){
char c = rand();
src.append(&c, 1);
}
require(src.length() == len);
BaseString str;
require(base64_encode(src, str) == 0);
if(str.length() == 3850){
printf(">%s<\n", str.c_str());
}
UtilBuffer dst;
require(base64_decode(str, dst) == 0);
require(dst.length() == src.length());
const char * c_src = (char*)src.get_data();
const char * c_dst = (char*)dst.get_data();
if(memcmp(src.get_data(), dst.get_data(), src.length()) != 0){
printf("-- src --\n");
for(int i2 = 0; i2<len; i2++){
unsigned char c = c_src[i2];
printf("%.2x ", (unsigned)c);
if((i2 % 8) == 7)
printf("\n");
}
printf("\n");
printf("-- dst --\n");
for(int i2 = 0; i2<len; i2++){
unsigned char c = c_dst[i2];
printf("%.2x ", (unsigned)c);
if((i2 % 8) == 7)
printf("\n");
}
printf("\n");
abort();
}
}
return 0;
}
#endif
This diff is collapsed.
...@@ -8,7 +8,7 @@ ARCHIVE_TARGET := general ...@@ -8,7 +8,7 @@ ARCHIVE_TARGET := general
SOURCES = File.cpp md5_hash.cpp Properties.cpp socket_io.cpp \ SOURCES = File.cpp md5_hash.cpp Properties.cpp socket_io.cpp \
SimpleProperties.cpp Parser.cpp InputStream.cpp SocketServer.cpp \ SimpleProperties.cpp Parser.cpp InputStream.cpp SocketServer.cpp \
OutputStream.cpp NdbOut.cpp BaseString.cpp Base64.cpp \ OutputStream.cpp NdbOut.cpp BaseString.cpp Base64.cpp \
NdbSqlUtil.cpp new.cpp NdbSqlUtil.cpp ConfigValues.cpp new.cpp
SOURCES.c = uucode.c random.c getarg.c version.c SOURCES.c = uucode.c random.c getarg.c version.c
...@@ -20,7 +20,7 @@ ifeq ($(NDB_OS), OSE) ...@@ -20,7 +20,7 @@ ifeq ($(NDB_OS), OSE)
endif endif
SOURCES.c += strdup.c strlcat.c strlcpy.c SOURCES.c += strdup.c strlcat.c strlcpy.c
DIRS := testSimpleProperties DIRS := testSimpleProperties testProperties testConfigValues
include $(NDB_TOP)/Epilogue.mk include $(NDB_TOP)/Epilogue.mk
......
...@@ -21,6 +21,12 @@ ...@@ -21,6 +21,12 @@
#include <NdbTCP.h> #include <NdbTCP.h>
#include <NdbOut.hpp> #include <NdbOut.hpp>
static
char * f_strdup(const char * s){
if(!s) return 0;
return strdup(s);
}
/** /**
* Note has to be a multiple of 4 bytes * Note has to be a multiple of 4 bytes
*/ */
...@@ -36,6 +42,7 @@ struct PropertyImpl{ ...@@ -36,6 +42,7 @@ struct PropertyImpl{
~PropertyImpl(); ~PropertyImpl();
PropertyImpl(const char * name, Uint32 value); PropertyImpl(const char * name, Uint32 value);
PropertyImpl(const char * name, Uint64 value);
PropertyImpl(const char * name, const char * value); PropertyImpl(const char * name, const char * value);
PropertyImpl(const char * name, const Properties * value); PropertyImpl(const char * name, const Properties * value);
...@@ -167,6 +174,11 @@ Properties::put(const char * name, Uint32 value, bool replace){ ...@@ -167,6 +174,11 @@ Properties::put(const char * name, Uint32 value, bool replace){
return ::put(impl, name, value, replace); return ::put(impl, name, value, replace);
} }
bool
Properties::put64(const char * name, Uint64 value, bool replace){
return ::put(impl, name, value, replace);
}
bool bool
Properties::put(const char * name, const char * value, bool replace){ Properties::put(const char * name, const char * value, bool replace){
return ::put(impl, name, value, replace); return ::put(impl, name, value, replace);
...@@ -208,6 +220,40 @@ Properties::get(const char * name, Uint32 * value) const { ...@@ -208,6 +220,40 @@ Properties::get(const char * name, Uint32 * value) const {
setErrno(E_PROPERTIES_OK); setErrno(E_PROPERTIES_OK);
return true; return true;
} }
if(nvp->valueType == PropertiesType_Uint64){
Uint64 tmp = * (Uint64 *)nvp->value;
Uint64 max = 1; max <<= 32;
if(tmp < max){
* value = (Uint32)tmp;
setErrno(E_PROPERTIES_OK);
return true;
}
}
setErrno(E_PROPERTIES_INVALID_TYPE);
return false;
}
bool
Properties::get(const char * name, Uint64 * value) const {
PropertyImpl * nvp = impl->get(name);
if(nvp == 0){
setErrno(E_PROPERTIES_NO_SUCH_ELEMENT);
return false;
}
if(nvp->valueType == PropertiesType_Uint32){
Uint32 tmp = * (Uint32 *)nvp->value;
* value = (Uint64)tmp;
setErrno(E_PROPERTIES_OK);
return true;
}
if(nvp->valueType == PropertiesType_Uint64){
* value = * (Uint64 *)nvp->value;
setErrno(E_PROPERTIES_OK);
return true;
}
setErrno(E_PROPERTIES_INVALID_TYPE); setErrno(E_PROPERTIES_INVALID_TYPE);
return false; return false;
} }
...@@ -263,7 +309,7 @@ Properties::getCopy(const char * name, char ** value) const { ...@@ -263,7 +309,7 @@ Properties::getCopy(const char * name, char ** value) const {
} }
if(nvp->valueType == PropertiesType_char){ if(nvp->valueType == PropertiesType_char){
* value = strdup((const char *)nvp->value); * value = f_strdup((const char *)nvp->value);
setErrno(E_PROPERTIES_OK); setErrno(E_PROPERTIES_OK);
return true; return true;
} }
...@@ -313,6 +359,10 @@ Properties::print(FILE * out, const char * prefix) const{ ...@@ -313,6 +359,10 @@ Properties::print(FILE * out, const char * prefix) const{
fprintf(out, "%s%s = (Uint32) %d\n", buf, impl->content[i]->name, fprintf(out, "%s%s = (Uint32) %d\n", buf, impl->content[i]->name,
*(Uint32 *)impl->content[i]->value); *(Uint32 *)impl->content[i]->value);
break; break;
case PropertiesType_Uint64:
fprintf(out, "%s%s = (Uint64) %lld\n", buf, impl->content[i]->name,
*(Uint64 *)impl->content[i]->value);
break;
case PropertiesType_char: case PropertiesType_char:
fprintf(out, "%s%s = (char*) \"%s\"\n", buf, impl->content[i]->name, fprintf(out, "%s%s = (char*) \"%s\"\n", buf, impl->content[i]->name,
(char *)impl->content[i]->value); (char *)impl->content[i]->value);
...@@ -598,11 +648,18 @@ PropertiesImpl::getPackedSize(Uint32 pLen) const { ...@@ -598,11 +648,18 @@ PropertiesImpl::getPackedSize(Uint32 pLen) const {
sz += 4; // Name Len sz += 4; // Name Len
sz += 4; // Value Len sz += 4; // Value Len
sz += mod4(pLen + strlen(content[i]->name)); // Name sz += mod4(pLen + strlen(content[i]->name)); // Name
if(content[i]->valueType == PropertiesType_char){ switch(content[i]->valueType){
case PropertiesType_char:
sz += mod4(strlen((char *)content[i]->value)); sz += mod4(strlen((char *)content[i]->value));
} else if(content[i]->valueType == PropertiesType_Uint32){ break;
case PropertiesType_Uint32:
sz += mod4(4); sz += mod4(4);
} else { break;
case PropertiesType_Uint64:
sz += mod4(8);
break;
case PropertiesType_Properties:
default:
assert(0); assert(0);
} }
} }
...@@ -700,6 +757,9 @@ PropertiesImpl::pack(Uint32 *& buf, const char * prefix, Uint32 pLen) const { ...@@ -700,6 +757,9 @@ PropertiesImpl::pack(Uint32 *& buf, const char * prefix, Uint32 pLen) const {
case PropertiesType_Uint32: case PropertiesType_Uint32:
valLenData = 4; valLenData = 4;
break; break;
case PropertiesType_Uint64:
valLenData = 8;
break;
case PropertiesType_char: case PropertiesType_char:
valLenData = strlen((char *)content[i]->value); valLenData = strlen((char *)content[i]->value);
break; break;
...@@ -722,6 +782,14 @@ PropertiesImpl::pack(Uint32 *& buf, const char * prefix, Uint32 pLen) const { ...@@ -722,6 +782,14 @@ PropertiesImpl::pack(Uint32 *& buf, const char * prefix, Uint32 pLen) const {
case PropertiesType_Uint32: case PropertiesType_Uint32:
* (Uint32 *)valBuf = htonl(* (Uint32 *)content[i]->value); * (Uint32 *)valBuf = htonl(* (Uint32 *)content[i]->value);
break; break;
case PropertiesType_Uint64:{
Uint64 val = * (Uint64 *)content[i]->value;
Uint32 hi = (val >> 32);
Uint32 lo = (val & 0xFFFFFFFF);
* (Uint32 *)valBuf = htonl(hi);
* (Uint32 *)(valBuf + 4) = htonl(lo);
}
break;
case PropertiesType_char: case PropertiesType_char:
memcpy(valBuf, content[i]->value, strlen((char*)content[i]->value)); memcpy(valBuf, content[i]->value, strlen((char*)content[i]->value));
break; break;
...@@ -788,6 +856,12 @@ PropertiesImpl::unpack(const Uint32 * buf, Uint32 &bufLen, Properties * top, ...@@ -788,6 +856,12 @@ PropertiesImpl::unpack(const Uint32 * buf, Uint32 &bufLen, Properties * top,
case PropertiesType_Uint32: case PropertiesType_Uint32:
res3 = top->put(nameBuf, ntohl(* (Uint32 *)valBuf), true); res3 = top->put(nameBuf, ntohl(* (Uint32 *)valBuf), true);
break; break;
case PropertiesType_Uint64:{
Uint64 hi = ntohl(* (Uint32 *)valBuf);
Uint64 lo = ntohl(* (Uint32 *)(valBuf + 4));
res3 = top->put64(nameBuf, (hi << 32) + lo, true);
}
break;
case PropertiesType_char: case PropertiesType_char:
res3 = top->put(nameBuf, valBuf, true); res3 = top->put(nameBuf, valBuf, true);
break; break;
...@@ -808,6 +882,9 @@ PropertyImpl::~PropertyImpl(){ ...@@ -808,6 +882,9 @@ PropertyImpl::~PropertyImpl(){
case PropertiesType_Uint32: case PropertiesType_Uint32:
delete (Uint32 *)value; delete (Uint32 *)value;
break; break;
case PropertiesType_Uint64:
delete (Uint64 *)value;
break;
case PropertiesType_char: case PropertiesType_char:
free((char *)value); free((char *)value);
break; break;
...@@ -822,6 +899,8 @@ PropertyImpl::copyPropertyImpl(const PropertyImpl & org){ ...@@ -822,6 +899,8 @@ PropertyImpl::copyPropertyImpl(const PropertyImpl & org){
switch(org.valueType){ switch(org.valueType){
case PropertiesType_Uint32: case PropertiesType_Uint32:
return new PropertyImpl(org.name, * (Uint32 *)org.value); return new PropertyImpl(org.name, * (Uint32 *)org.value);
case PropertiesType_Uint64:
return new PropertyImpl(org.name, * (Uint64 *)org.value);
break; break;
case PropertiesType_char: case PropertiesType_char:
return new PropertyImpl(org.name, (char *)org.value); return new PropertyImpl(org.name, (char *)org.value);
...@@ -836,21 +915,28 @@ PropertyImpl::copyPropertyImpl(const PropertyImpl & org){ ...@@ -836,21 +915,28 @@ PropertyImpl::copyPropertyImpl(const PropertyImpl & org){
} }
PropertyImpl::PropertyImpl(const char * _name, Uint32 _value){ PropertyImpl::PropertyImpl(const char * _name, Uint32 _value){
this->name = strdup(_name); this->name = f_strdup(_name);
this->value = new Uint32; this->value = new Uint32;
* ((Uint32 *)this->value) = _value; * ((Uint32 *)this->value) = _value;
this->valueType = PropertiesType_Uint32; this->valueType = PropertiesType_Uint32;
} }
PropertyImpl::PropertyImpl(const char * _name, Uint64 _value){
this->name = f_strdup(_name);
this->value = new Uint64;
* ((Uint64 *)this->value) = _value;
this->valueType = PropertiesType_Uint64;
}
PropertyImpl::PropertyImpl(const char * _name, const char * _value){ PropertyImpl::PropertyImpl(const char * _name, const char * _value){
this->name = strdup(_name); this->name = f_strdup(_name);
this->value = strdup(_value); this->value = f_strdup(_value);
this->valueType = PropertiesType_char; this->valueType = PropertiesType_char;
} }
PropertyImpl::PropertyImpl(const char * _name, const Properties * _value){ PropertyImpl::PropertyImpl(const char * _name, const Properties * _value){
this->name = strdup(_name); this->name = f_strdup(_name);
this->value = new Properties(* _value); this->value = new Properties(* _value);
this->valueType = PropertiesType_Properties; this->valueType = PropertiesType_Properties;
} }
...@@ -902,6 +988,16 @@ Properties::put(const char * name, Uint32 no, Uint32 val, bool replace){ ...@@ -902,6 +988,16 @@ Properties::put(const char * name, Uint32 no, Uint32 val, bool replace){
return res; return res;
} }
bool
Properties::put64(const char * name, Uint32 no, Uint64 val, bool replace){
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = put(tmp, val, replace);
free(tmp);
return res;
}
bool bool
Properties::put(const char * name, Uint32 no, const char * val, bool replace){ Properties::put(const char * name, Uint32 no, const char * val, bool replace){
...@@ -957,6 +1053,16 @@ Properties::get(const char * name, Uint32 no, Uint32 * value) const{ ...@@ -957,6 +1053,16 @@ Properties::get(const char * name, Uint32 no, Uint32 * value) const{
return res; return res;
} }
bool
Properties::get(const char * name, Uint32 no, Uint64 * value) const{
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = get(tmp, value);
free(tmp);
return res;
}
bool bool
Properties::get(const char * name, Uint32 no, const char ** value) const { Properties::get(const char * name, Uint32 no, const char ** value) const {
......
...@@ -202,13 +202,13 @@ vprintln_socket(NDB_SOCKET_TYPE socket, int timeout_millis, ...@@ -202,13 +202,13 @@ vprintln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
size_t size = sizeof(buf); size_t size = sizeof(buf);
if (fmt != 0) { if (fmt != 0) {
size = vsnprintf(buf, sizeof(buf)-1, fmt, ap); size = vsnprintf(buf, sizeof(buf), fmt, ap);
/* Check if the output was truncated */ /* Check if the output was truncated */
if(size >= sizeof(buf)) { if(size >= sizeof(buf)-1) {
buf2 = (char *)malloc(size+2); buf2 = (char *)malloc(size+2);
if(buf2 == NULL) if(buf2 == NULL)
return -1; return -1;
vsnprintf(buf2, size, fmt, ap); vsnprintf(buf2, size+1, fmt, ap);
} else } else
size = sizeof(buf); size = sizeof(buf);
} else } else
......
include .defs.mk
TYPE := util
BIN_TARGET := testConfigValues
BIN_TARGET_ARCHIVES := portlib general
SOURCES := testConfigValues.cpp
CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/util)
include $(NDB_TOP)/Epilogue.mk
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment