Commit 9d851e93 authored by joreland@mysql.com's avatar joreland@mysql.com

Merge

parents 9fb4e4b3 886551bb
......@@ -90,6 +90,7 @@ CCFLAGS_LOC += \
-I$(call fixpath,$(NDB_TOP)/include/transporter) \
-I$(call fixpath,$(NDB_TOP)/include/debugger) \
-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/util) \
-I$(call fixpath,$(NDB_TOP)/include/portlib) \
......@@ -105,6 +106,7 @@ CCFLAGS_LOC += \
-I$(call fixpath,$(NDB_TOP)/include/transporter) \
-I$(call fixpath,$(NDB_TOP)/include/debugger) \
-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/util) \
-I$(call fixpath,$(NDB_TOP)/include/portlib) \
......
......@@ -37,6 +37,7 @@
#define DBTUP 0xF9
#define DBDICT 0xFA
#define NDBCNTR 0xFB
#define CNTR 0xFB
#define QMGR 0xFC
#define NDBFS 0xFD
#define CMVMI 0xFE
......
......@@ -177,43 +177,43 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_API_FAILCONF 113
#define GSN_API_FAILREQ 114
#define GSN_APPL_CHANGEREP 115
#define GSN_CNTR_START_REQ 115
// 116 not unused
#define GSN_APPL_HB 117
#define GSN_APPL_HBREQ 118
#define GSN_APPL_REGCONF 119
#define GSN_APPL_REGREF 120
#define GSN_APPL_REGREQ 121
#define GSN_APPL_RUN 122
#define GSN_APPL_STARTCONF 123
#define GSN_APPL_STARTREG 124
#define GSN_CNTR_START_REF 117
#define GSN_CNTR_START_CONF 118
#define GSN_CNTR_START_REP 119
// 120 unused
// 121 unused
// 122 unused
// 123 unused
// 124 unused
#define GSN_CHECK_LCP_STOP 125
#define GSN_CLOSE_COMCONF 126
#define GSN_CLOSE_COMREQ 127
#define GSN_CM_ACKADD 128
#define GSN_CM_ACKALARM 129
#define GSN_CM_ADD 130
#define GSN_CM_APPCHG 131
#define GSN_CLOSE_COMCONF 126 // local
#define GSN_CLOSE_COMREQ 127 // local
#define GSN_CM_ACKADD 128 // distr.
// 129 unused
#define GSN_CM_ADD 130 // distr.
// 131 unused
// 132 not unused
// 133 not unused
#define GSN_CM_HEARTBEAT 134
#define GSN_CM_INFOCONF 135
#define GSN_CM_INFOREQ 136
#define GSN_CM_INIT 137
#define GSN_CM_NODEINFOCONF 138
#define GSN_CM_NODEINFOREF 139
#define GSN_CM_NODEINFOREQ 140
#define GSN_CM_REGCONF 141
#define GSN_CM_REGREF 142
#define GSN_CM_REGREQ 143
#define GSN_CM_RUN 144
#define GSN_CMVMI_CFGCONF 145
#define GSN_CMVMI_CFGREQ 146
#define GSN_CNTR_CHANGEREP 147
#define GSN_CNTR_MASTERCONF 148
#define GSN_CNTR_MASTERREF 149
#define GSN_CNTR_MASTERREQ 150
#define GSN_CNTR_WAITREP 151
#define GSN_CM_HEARTBEAT 134 // distr.
// 135 unused
// 136 unused
// 137 unused
#define GSN_CM_NODEINFOCONF 138 // distr.
#define GSN_CM_NODEINFOREF 139 // distr.
#define GSN_CM_NODEINFOREQ 140 // distr.
#define GSN_CM_REGCONF 141 // distr.
#define GSN_CM_REGREF 142 // distr.
#define GSN_CM_REGREQ 143 // distr.
// 144 unused
// 145 unused
// 146 unused
#define GSN_CM_ADD_REP 147 // local
// 148 unused
// 149 unused
// 150 unused
#define GSN_CNTR_WAITREP 151 // distr.
#define GSN_COMMIT 152
#define GSN_COMMIT_FAILCONF 153
#define GSN_COMMIT_FAILREQ 154
......@@ -426,11 +426,13 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_NEXT_SCANREF 331
#define GSN_NEXT_SCANREQ 332
#define GSN_NEXTOPERATION 333
#define GSN_SIZEALT_ACK 334
#define GSN_SIZEALT_REP 335
#define GSN_NODE_STATESCONF 336
#define GSN_NODE_STATESREF 337
#define GSN_NODE_STATESREQ 338
#define GSN_READ_CONFIG_REQ 334 // new name for sizealt, local
#define GSN_READ_CONFIG_CONF 335 // new name for sizealt, local
// 336 unused
// 337 unused
// 338 unused
#define GSN_OPEN_COMCONF 339
#define GSN_OPEN_COMREF 340
#define GSN_OPEN_COMREQ 341
......@@ -511,8 +513,8 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_TEST_ORD 407
#define GSN_TESTSIG 408
#define GSN_TIME_SIGNAL 409
#define GSN_VOTE_MASTERORD 410
// 411 unused
// 410 unused
// 411 unused
// 412 unused
#define GSN_TUP_ABORTREQ 414
#define GSN_TUP_ADD_ATTCONF 415
......@@ -580,7 +582,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_CHECKNODEGROUPSREQ 471
#define GSN_CHECKNODEGROUPSCONF 472
#define GSN_ARBIT_CFG 473
// 473 unused
#define GSN_ARBIT_PREPREQ 474
#define GSN_ARBIT_PREPCONF 475
#define GSN_ARBIT_PREPREF 476
......
......@@ -18,6 +18,7 @@
#define _LOG_LEVEL_HPP
#include <ndb_global.h>
#include <mgmapi_config_parameters.h>
/**
*
......@@ -45,53 +46,60 @@ public:
*/
LogLevel & operator= (const LogLevel &);
static const Uint32 MIN_LOGLEVEL_ID = CFG_LOGLEVEL_STARTUP;
enum EventCategory {
/**
* Events during all kind of startups
*/
llStartUp = 0,
llStartUp = CFG_LOGLEVEL_STARTUP - MIN_LOGLEVEL_ID,
/**
* Events during shutdown
*/
llShutdown = 1,
llShutdown = CFG_LOGLEVEL_SHUTDOWN - MIN_LOGLEVEL_ID,
/**
* Transaction statistics
* Job level
* TCP/IP speed
*/
llStatistic = 2,
llStatistic = CFG_LOGLEVEL_STATISTICS - MIN_LOGLEVEL_ID,
/**
* Checkpoints
*/
llCheckpoint = 3,
llCheckpoint = CFG_LOGLEVEL_CHECKPOINT - MIN_LOGLEVEL_ID,
/**
* Events during node restart
*/
llNodeRestart = 4,
llNodeRestart = CFG_LOGLEVEL_NODERESTART - MIN_LOGLEVEL_ID,
/**
* Events related to connection / communication
*/
llConnection = 5,
llConnection = CFG_LOGLEVEL_CONNECTION - MIN_LOGLEVEL_ID,
/**
* Assorted event w.r.t unexpected happenings
*/
llError = 6,
llError = CFG_LOGLEVEL_ERROR - MIN_LOGLEVEL_ID,
/**
* Assorted event w.r.t warning
*/
llWarning = CFG_LOGLEVEL_WARNING - MIN_LOGLEVEL_ID,
/**
* Assorted event w.r.t information
*/
llInfo = 7,
llInfo = CFG_LOGLEVEL_INFO - MIN_LOGLEVEL_ID,
/**
* Events related to global replication
*/
llGrep = 8
llGrep = CFG_LOGLEVEL_GREP - MIN_LOGLEVEL_ID
};
struct LogLevelCategoryName {
......@@ -107,7 +115,7 @@ public:
/**
* No of categories
*/
#define _LOGLEVEL_CATEGORIES 9
#define _LOGLEVEL_CATEGORIES 10
static const Uint32 LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES;
void clear();
......
#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:
Uint32 requestType; // direct flag, output code
Uint32 output;
};
union {
Uint32 nodeId; // nodeId input for GetNodeGroupMembers
NodeBitmask mask; /* set of NDB nodes, input for ArbitCheck,
* output for GetNodeGroupMembers
*/
};
Uint32 nodeId; // nodeId input for GetNodeGroupMembers
NodeBitmask mask; /* set of NDB nodes, input for ArbitCheck,
* output for GetNodeGroupMembers
*/
enum RequestType {
Direct = 0x1,
ArbitCheck = 0x2,
......@@ -57,7 +55,7 @@ public:
Partitioning = 3 // possible network partitioning
};
STATIC_CONST( SignalLength = 2 + NodeBitmask::Size );
STATIC_CONST( SignalLength = 3 + NodeBitmask::Size );
};
#endif
#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 {
friend bool printCREATE_FRAGMENTATION_CONF(FILE *,
const Uint32 *, Uint32, Uint16);
public:
STATIC_CONST( SignalLength = 3 );
STATIC_CONST( SignalLength = 4 );
SECTION( FRAGMENTS = 0 );
private:
......
......@@ -100,6 +100,7 @@ public:
CustomTriggerId = 25,
FrmLen = 26,
FrmData = 27,
FragmentCount = 128, // No of fragments in table (!fragment replicas)
TableEnd = 999,
AttributeName = 1000, // String, Mandatory
......@@ -277,6 +278,7 @@ public:
Uint32 CustomTriggerId;
Uint32 FrmLen;
char FrmData[MAX_FRM_DATA_SIZE];
Uint32 FragmentCount;
void init();
};
......
......@@ -101,7 +101,8 @@ public:
NoSuchTable = 1,
DropWoPrep = 2, // Calling Drop with first calling PrepDrop
PrepDropInProgress = 3,
DropInProgress = 4
DropInProgress = 4,
NF_FakeErrorREF = 5
};
private:
......
......@@ -39,7 +39,7 @@ class EventSubscribeReq {
friend class MgmtSrvr;
public:
STATIC_CONST( SignalLength = 14 );
STATIC_CONST( SignalLength = 22 );
private:
/**
* Note: If you use the same blockRef as you have used earlier,
......@@ -53,8 +53,8 @@ private:
*/
Uint32 noOfEntries;
Uint32 theCategories[6];
Uint32 theLevels[6];
Uint32 theCategories[10];
Uint32 theLevels[10];
};
#endif
......@@ -39,6 +39,7 @@ class FsOpenReq {
friend class Backup;
friend class Dbdict;
friend class Ndbcntr; // For initial start...
friend class Dbdih;
/**
* For printing
......
......@@ -25,6 +25,7 @@ class KeyInfo {
*/
friend class DbUtil;
friend class NdbOperation;
friend class NdbScanOperation;
/**
* Reciver(s)
......
......@@ -88,7 +88,8 @@ public:
NoSuchTable = 1,
PrepDropInProgress = 2,
DropInProgress = 3,
InvalidTableState = 4
InvalidTableState = 4,
NF_FakeErrorREF = 5
};
private:
......@@ -137,7 +138,8 @@ public:
enum ErrorCode {
NoSuchTable = 1,
IllegalTableState = 2,
DropInProgress = 3
DropInProgress = 3,
NF_FakeErrorREF = 4
};
Uint32 tableId;
......
#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 {
friend class Suma;
friend class Grep;
friend bool printREAD_NODES_CONF(FILE*, const Uint32 *, Uint32, Uint16);
public:
STATIC_CONST( SignalLength = 2 + 6*NodeBitmask::Size );
STATIC_CONST( SignalLength = 3 + 5*NdbNodeBitmask::Size );
private:
Uint32 noOfNodes;
Uint32 ndynamicId;
/**
*
......@@ -63,47 +65,21 @@ private:
/**
* This array defines all the ndb nodes in the system
*/
Uint32 allNodes[NodeBitmask::Size];
/**
* This array describes wheather the nodes are currently active
*
* NOTE Not valid when send from Qmgr
*/
Uint32 inactiveNodes[NodeBitmask::Size];
union {
Uint32 allNodes[NdbNodeBitmask::Size];
Uint32 definedNodes[NdbNodeBitmask::Size];
};
/**
* This array describes the version id of the nodes
* The version id is a 4 bit number
* This array describes wheather the nodes are currently active
*
* NOTE Not valid when send from Qmgr
*/
Uint32 theVersionIds[4*NodeBitmask::Size];
Uint32 inactiveNodes[NdbNodeBitmask::Size];
static void setVersionId(NodeId, Uint8 versionId, Uint32 theVersionIds[]);
static Uint8 getVersionId(NodeId, const Uint32 theVersionIds[]);
Uint32 clusterNodes[NdbNodeBitmask::Size]; // From Qmgr
Uint32 startingNodes[NdbNodeBitmask::Size]; // From Cntr
Uint32 startedNodes[NdbNodeBitmask::Size]; // From Cntr
};
inline
void
ReadNodesConf::setVersionId(NodeId nodeId, Uint8 versionId,
Uint32 theVersionIds[]){
const int word = nodeId >> 3;
const int shift = (nodeId & 7) << 2;
const Uint32 mask = ~(((Uint32)15) << shift);
const Uint32 tmp = theVersionIds[word];
theVersionIds[word] = (tmp & mask) | ((((Uint32)versionId) & 15) << shift);
}
inline
Uint8
ReadNodesConf::getVersionId(NodeId nodeId, const Uint32 theVersionIds[]){
const int word = nodeId >> 3;
const int shift = (nodeId & 7) << 2;
return (theVersionIds[word] >> shift) & 15;
}
#endif
......@@ -33,8 +33,8 @@ class ScanTabReq {
/**
* Sender(s)
*/
friend class NdbOperation;
friend class NdbConnection;
friend class NdbScanOperation;
/**
* For printing
......@@ -73,6 +73,7 @@ private:
static Uint8 getHoldLockFlag(const UintR & requestInfo);
static Uint8 getReadCommittedFlag(const UintR & requestInfo);
static Uint8 getRangeScanFlag(const UintR & requestInfo);
static Uint8 getScanBatch(const UintR & requestInfo);
/**
* Set:ers for requestInfo
......@@ -83,7 +84,7 @@ private:
static void setHoldLockFlag(UintR & requestInfo, Uint32 flag);
static void setReadCommittedFlag(UintR & requestInfo, Uint32 flag);
static void setRangeScanFlag(UintR & requestInfo, Uint32 flag);
static void setScanBatch(Uint32& requestInfo, Uint32 sz);
};
/**
......@@ -94,10 +95,11 @@ private:
h = Hold lock mode - 1 Bit 10
c = Read Committed - 1 Bit 11
x = Range Scan (TUX) - 1 Bit 15
b = Scan batch - 5 Bit 16-19 (max 15)
1111111111222222222233
01234567890123456789012345678901
ppppppppl hc x
ppppppppl hc xbbbbb
*/
#define PARALLELL_SHIFT (0)
......@@ -115,6 +117,9 @@ private:
#define RANGE_SCAN_SHIFT (15)
#define RANGE_SCAN_MASK (1)
#define SCAN_BATCH_SHIFT (16)
#define SCAN_BATCH_MASK (31)
inline
Uint8
ScanTabReq::getParallelism(const UintR & requestInfo){
......@@ -145,6 +150,12 @@ ScanTabReq::getRangeScanFlag(const UintR & requestInfo){
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
void
ScanTabReq::clearRequestInfo(UintR & requestInfo){
......@@ -186,6 +197,12 @@ ScanTabReq::setRangeScanFlag(UintR & requestInfo, Uint32 flag){
requestInfo |= (flag << RANGE_SCAN_SHIFT);
}
inline
void
ScanTabReq::setScanBatch(Uint32 & requestInfo, Uint32 flag){
ASSERT_MAX(flag, SCAN_BATCH_MASK, "ScanTabReq::setScanBatch");
requestInfo |= (flag << SCAN_BATCH_SHIFT);
}
/**
*
......@@ -213,7 +230,8 @@ public:
* Length of signal
*/
STATIC_CONST( SignalLength = 4 );
static const Uint32 EndOfData = (1 << 31);
private:
// Type definitions
......@@ -225,29 +243,15 @@ private:
UintR requestInfo; // DATA 1
UintR transId1; // DATA 2
UintR transId2; // DATA 3
#if 0
UintR operLenAndIdx[16]; // DATA 4-19
/**
* Get:ers for operLenAndIdx
*/
static Uint32 getLen(const UintR & operLenAndIdx);
static Uint8 getIdx(const UintR & operLenAndIdx);
#endif
/**
* Get:ers for requestInfo
*/
static Uint8 getOperations(const UintR & reqInfo);
static Uint8 getScanStatus(const UintR & reqInfo);
/**
* Set:ers for requestInfo
*/
static void setOperations(UintR & reqInfo, Uint32 ops);
static void setScanStatus(UintR & reqInfo, Uint32 stat);
struct OpData {
Uint32 apiPtrI;
Uint32 tcPtrI;
Uint32 info;
};
static Uint32 getLength(Uint32 opDataInfo) { return opDataInfo >> 5; };
static Uint32 getRows(Uint32 opDataInfo) { return opDataInfo & 31;}
};
/**
......@@ -267,33 +271,6 @@ private:
#define STATUS_SHIFT (8)
#define STATUS_MASK (0xFF)
inline
Uint8
ScanTabConf::getOperations(const UintR & reqInfo){
return (Uint8)((reqInfo >> OPERATIONS_SHIFT) & OPERATIONS_MASK);
}
inline
void
ScanTabConf::setOperations(UintR & requestInfo, Uint32 ops){
ASSERT_MAX(ops, OPERATIONS_MASK, "ScanTabConf::setOperations");
requestInfo |= (ops << OPERATIONS_SHIFT);
}
inline
Uint8
ScanTabConf::getScanStatus(const UintR & reqInfo){
return (Uint8)((reqInfo >> STATUS_SHIFT) & STATUS_MASK);
}
inline
void
ScanTabConf::setScanStatus(UintR & requestInfo, Uint32 stat){
ASSERT_MAX(stat, STATUS_MASK, "ScanTabConf::setScanStatus");
requestInfo |= (stat << STATUS_SHIFT);
}
/**
*
* SENDER: Dbtc, API
......
......@@ -18,6 +18,7 @@
#define SET_LOGLEVEL_ORD_HPP
#include <LogLevel.hpp>
#include "SignalData.hpp"
/**
*
......
......@@ -33,6 +33,7 @@ class TcCommitConf {
* Reciver(s)
*/
friend class Ndb;
friend class NdbConnection;
public:
STATIC_CONST( SignalLength = 3 );
......
......@@ -38,6 +38,7 @@ class TcKeyReq {
friend class Ndbcntr;
friend class NdbOperation;
friend class NdbIndexOperation;
friend class NdbScanOperation;
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" {
NDB_MGM_NODE_TYPE_API = 0, /*/< An application node (API)*/
NDB_MGM_NODE_TYPE_NDB = 1, /*/< A database node (DB)*/
NDB_MGM_NODE_TYPE_MGM = 2, /*/< A management server node (MGM)*/
NDB_MGM_NODE_TYPE_REP = 3, ///< A replication node
NDB_MGM_NODE_TYPE_MIN = 0, /*/< Min valid value*/
NDB_MGM_NODE_TYPE_MAX = 2 /*/< Max valid value*/
NDB_MGM_NODE_TYPE_MAX = 3 /*/< Max valid value*/
};
/**
......@@ -199,6 +200,8 @@ extern "C" {
int node_group; ///< Node group of node
///< (only valid for DB nodes)
int version; ///< Internal version number
int connect_count; ///< No of times node has connected
///< or disconnected to the mgm srv
};
/**
......@@ -654,6 +657,36 @@ extern "C" {
int ndb_mgm_exit_single_user(NdbMgmHandle handle,
struct ndb_mgm_reply* reply);
/**
* Get configuration
* @param handle NDB management handle.
* @param version Version of configuration, 0 means latest
* @see MAKE_VERSION
* @Note the caller must free the pointer returned.
*/
struct ndb_mgm_configuration * ndb_mgm_get_configuration(NdbMgmHandle handle,
unsigned version);
/**
* Config iterator
*/
typedef struct ndb_mgm_configuration_iterator ndb_mgm_configuration_iterator;
ndb_mgm_configuration_iterator* ndb_mgm_create_configuration_iterator
(struct ndb_mgm_configuration *, unsigned type_of_section);
void ndb_mgm_destroy_iterator(ndb_mgm_configuration_iterator*);
int ndb_mgm_first(ndb_mgm_configuration_iterator*);
int ndb_mgm_next(ndb_mgm_configuration_iterator*);
int ndb_mgm_valid(const ndb_mgm_configuration_iterator*);
int ndb_mgm_find(ndb_mgm_configuration_iterator*,
int param, unsigned value);
int ndb_mgm_get_int_parameter(const ndb_mgm_configuration_iterator*,
int param, unsigned * value);
int ndb_mgm_get_int64_parameter(const ndb_mgm_configuration_iterator*,
int param, unsigned long long * value);
int ndb_mgm_get_string_parameter(const ndb_mgm_configuration_iterator*,
int param, const char ** value);
#ifdef __cplusplus
}
#endif
......
#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 @@
#define ConfigRetriever_H
#include <ndb_types.h>
#include <Properties.hpp>
#include <mgmapi.h>
/**
* @class ConfigRetriever
......@@ -44,11 +44,11 @@ public:
* to establish a connection. This is repeated until a connection is
* established, so the function hangs until a connection is established.
*
* @return Properties object if succeeded,
* @return ndb_mgm_configuration object if succeeded,
* NULL if erroneous local config file or configuration error.
*/
class Properties * getConfig(const char * nodeType, int versionId);
struct ndb_mgm_configuration * getConfig(int versionId, int nodeType);
const char * getErrorString();
/**
......@@ -71,22 +71,17 @@ public:
* @return Node id of this node (as stated in local config or connectString)
*/
inline Uint32 getOwnNodeId() { return _ownNodeId; }
/**
* Get configuration object
*/
class Properties * getConfig(int versionId);
/**
* Get config using socket
*/
class Properties * getConfig(const char * mgmhost, unsigned int port,
Uint32 nodeId, int versionId);
struct ndb_mgm_configuration * getConfig(const char * mgmhost, short port,
int versionId);
/**
* Get config from file
*/
class Properties * getConfig(const char * filename, Uint32 nodeId,
int versionId);
struct ndb_mgm_configuration * getConfig(const char * file, int versionId);
private:
char * errorString;
enum ErrorType {
......@@ -97,18 +92,17 @@ private:
void setError(ErrorType, const char * errorMsg);
/**
* Verifies that received configuration is correct
*/
bool verifyProperties(const char* nodeType, Properties *p,
Uint32 nodeId, int versionId);
char * _localConfigFileName;
struct LocalConfig * _localConfig;
int _ownNodeId;
char * m_connectString;
char * m_defaultConnectString;
/**
* Verify config
*/
bool verifyConfig(const struct ndb_mgm_configuration *, int type);
};
#endif
......
......@@ -58,6 +58,10 @@ public:
void print() const { props->print(); }
static Uint32 configureTransporters(Uint32 nodeId,
const class ndb_mgm_configuration &,
class TransporterRegistry &);
private:
NodeId the_ownId;
Properties * props;
......
......@@ -867,6 +867,7 @@ class NdbObjectIdMap;
class NdbOperation;
class NdbEventOperationImpl;
class NdbScanOperation;
class NdbIndexScanOperation;
class NdbIndexOperation;
class NdbConnection;
class NdbApiSignal;
......@@ -875,7 +876,6 @@ class NdbLabel;
class NdbBranch;
class NdbSubroutine;
class NdbCall;
class NdbScanReceiver;
class Table;
class BaseString;
class NdbEventOperation;
......@@ -960,8 +960,9 @@ class Ndb
friend class NdbConnection;
friend class Table;
friend class NdbApiSignal;
friend class NdbScanReceiver;
friend class NdbIndexOperation;
friend class NdbScanOperation;
friend class NdbIndexScanOperation;
friend class NdbDictionaryImpl;
friend class NdbDictInterface;
......@@ -1439,7 +1440,7 @@ private:
NdbConnection* doConnect(Uint32 nodeId);
void doDisconnect();
NdbScanReceiver* getNdbScanRec();// Get a NdbScanReceiver from idle list
NdbReceiver* getNdbScanRec();// Get a NdbScanReceiver from idle list
NdbLabel* getNdbLabel(); // Get a NdbLabel from idle list
NdbBranch* getNdbBranch(); // Get a NdbBranch from idle list
NdbSubroutine* getNdbSubroutine();// Get a NdbSubroutine from idle
......@@ -1448,21 +1449,21 @@ private:
NdbRecAttr* getRecAttr(); // Get a receeive attribute object from
// idle list of the Ndb object.
NdbOperation* getOperation(); // Get an operation from idle list
NdbScanOperation* getScanOperation(); // Get a scan operation from idle
NdbIndexScanOperation* getScanOperation(); // Get a scan operation from idle
NdbIndexOperation* getIndexOperation();// Get an index operation from idle
class NdbGlobalEventBufferHandle* getGlobalEventBufferHandle();
void releaseSignal(NdbApiSignal* anApiSignal);
void releaseSignalsInList(NdbApiSignal** pList);
void releaseNdbScanRec(NdbScanReceiver* aNdbScanRec);
void releaseNdbScanRec(NdbReceiver* aNdbScanRec);
void releaseNdbLabel(NdbLabel* anNdbLabel);
void releaseNdbBranch(NdbBranch* anNdbBranch);
void releaseNdbSubroutine(NdbSubroutine* anNdbSubroutine);
void releaseNdbCall(NdbCall* anNdbCall);
void releaseRecAttr (NdbRecAttr* aRecAttr);
void releaseOperation(NdbOperation* anOperation);
void releaseScanOperation(NdbScanOperation* aScanOperation);
void releaseScanOperation(NdbIndexScanOperation*);
void check_send_timeout();
void remove_sent_list(Uint32);
......@@ -1558,7 +1559,6 @@ private:
void* int2void (Uint32 val);
NdbReceiver* void2rec (void* val);
NdbConnection* void2con (void* val);
NdbScanReceiver* void2rec_srec(void* val);
NdbOperation* void2rec_op (void* val);
NdbIndexOperation* void2rec_iop (void* val);
......@@ -1598,7 +1598,7 @@ private:
NdbOperation* theOpIdleList; // First operation in the idle list.
NdbScanOperation* theScanOpIdleList; // First scan operation in the idle list.
NdbIndexScanOperation* theScanOpIdleList; // First scan operation in the idle list.
NdbIndexOperation* theIndexOpIdleList; // First index operation in the idle list.
NdbConnection* theTransactionList;
NdbConnection** theConnectionArray;
......@@ -1608,7 +1608,7 @@ private:
NdbBranch* theBranchList; // First branch descriptor in list
NdbSubroutine* theSubroutineList; // First subroutine descriptor in
NdbCall* theCallList; // First call descriptor in list
NdbScanReceiver* theScanList;
NdbReceiver* theScanList;
Uint32 theMyRef; // My block reference
Uint32 theNode; // The node number of our node
......
......@@ -23,6 +23,10 @@
#include "NdbOperation.hpp"
#include "NdbScanOperation.hpp"
#include "NdbIndexOperation.hpp"
#include "NdbIndexScanOperation.hpp"
#include "NdbScanFilter.hpp"
#include "NdbSchemaCon.hpp"
#include "NdbSchemaOp.hpp"
#include "NdbRecAttr.hpp"
#include "NdbResultSet.hpp"
#include "NdbDictionary.hpp"
......
......@@ -22,12 +22,11 @@
class NdbConnection;
class NdbOperation;
class NdbCursorOperation;
class NdbScanOperation;
class NdbIndexScanOperation;
class NdbIndexOperation;
class NdbApiSignal;
class Ndb;
class NdbScanReceiver;
/**
......@@ -159,7 +158,7 @@ class NdbConnection
friend class NdbOperation;
friend class NdbScanOperation;
friend class NdbIndexOperation;
friend class NdbScanReceiver;
friend class NdbIndexScanOperation;
public:
......@@ -175,57 +174,32 @@ public:
*/
NdbOperation* getNdbOperation(const char* aTableName);
/**
* Get an NdbOperation for index scan of a table.
* Note that the operation has to be defined before it is executed.
*
* @note All operations within the same transaction need to
* be initialized with this method.
*
* @param anIndexName The index name.
* @param aTableName The table name.
* @return Pointer to an NdbOperation object if successful, otherwise NULL.
*/
NdbOperation* getNdbOperation(const char* anIndexName,
const char* aTableName);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/**
* Get an operation from NdbScanOperation idlelist and
* get the NdbConnection object which
* was fetched by startTransaction pointing to this operation.
* This operation will set the theTableId
* in the NdbOperation object.synchronous.
*
* @param aTableName a table name.
* @return pointer to an NdbOperation object if successful, otherwise NULL
*/
NdbScanOperation* getNdbScanOperation(const char* aTableName);
#endif
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/**
* Get an operation from NdbScanOperation idlelist and
* get the NdbConnection object which
* was fetched by startTransaction pointing to this operation.
* This operation will set the theTableId
* in the NdbOperation object.synchronous.
*
* @param anIndexName The index name.
* @param aTableName a table name.
* @return pointer to an NdbOperation object if successful, otherwise NULL
*/
NdbScanOperation* getNdbScanOperation(const char* anIndexName,
const char* aTableName);
#endif
NdbIndexScanOperation* getNdbIndexScanOperation(const char* anIndexName,
const char* aTableName);
/**
* Get an operation from NdbIndexOperation idlelist and
* get the NdbConnection object that
* was fetched by startTransaction pointing to this operation.
* This operation will set the theTableId
* in the NdbOperation object. Synchronous.
*
* @param indexName An index name (as created by createIndex).
* @param tableName A table name.
......@@ -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
* @{
......@@ -581,13 +486,7 @@ private:
int receiveTCINDXCONF(const class TcIndxConf *, Uint32 aDataLength);
int receiveTCINDXREF(NdbApiSignal*);
int receiveSCAN_TABREF(NdbApiSignal*);
int receiveSCAN_TABCONF(NdbApiSignal*);
int receiveSCAN_TABINFO(NdbApiSignal*);
int checkNextScanResultComplete();
int sendScanStart();
int sendScanNext(bool stopScanFlag);
int fetchNextScanResult();
int receiveSCAN_TABCONF(NdbApiSignal*, const Uint32*, Uint32 len);
int doSend(); // Send all operations
int sendROLLBACK(); // Send of an ROLLBACK
......@@ -610,7 +509,7 @@ private:
// Release all cursor operations in connection
void releaseOps(NdbOperation*);
void releaseCursorOperations(NdbCursorOperation*);
void releaseScanOperations(NdbIndexScanOperation*);
// Set the transaction identity of the transaction
void setTransactionId(Uint64 aTransactionId);
......@@ -626,7 +525,7 @@ private:
int checkMagicNumber(); // Verify correct object
NdbOperation* getNdbOperation(class NdbTableImpl* aTable);
NdbScanOperation* getNdbScanOperation(class NdbTableImpl* aTable);
NdbIndexScanOperation* getNdbScanOperation(class NdbTableImpl* aTable);
NdbIndexOperation* getNdbIndexOperation(class NdbIndexImpl* anIndex,
class NdbTableImpl* aTable);
......@@ -679,7 +578,6 @@ private:
Uint32 theNoOfOpSent; // How many operations have been sent
Uint32 theNoOfOpCompleted; // How many operations have completed
Uint32 theNoOfOpFetched; // How many operations was actually fetched
Uint32 theNoOfSCANTABCONFRecv; // How many SCAN_TABCONF have been received
Uint32 theMyRef; // Our block reference
Uint32 theTCConPtr; // Transaction Co-ordinator connection pointer.
Uint64 theTransactionId; // theTransactionId of the transaction
......@@ -715,20 +613,16 @@ private:
Uint32 theNodeSequence; // The sequence no of the db node
bool theReleaseOnClose;
// Cursor operations
// Scan operations
bool m_waitForReply;
NdbCursorOperation* m_theFirstCursorOperation;
NdbCursorOperation* m_theLastCursorOperation;
NdbIndexScanOperation* m_theFirstScanOperation;
NdbIndexScanOperation* m_theLastScanOperation;
NdbCursorOperation* m_firstExecutedCursorOp;
// Scan operations
bool theScanFinished;
NdbIndexScanOperation* m_firstExecutedScanOp;
NdbScanReceiver* theCurrentScanRec; // The current operation to
// distribute to the app.
NdbScanReceiver* thePreviousScanRec; // The previous operation read by
// nextScanResult.
NdbOperation* theScanningOp; // The operation actually performing the scan
// Scan operations
// The operation actually performing the scan
NdbScanOperation* theScanningOp;
Uint32 theBuddyConPtr;
static void sendTC_COMMIT_ACK(NdbApiSignal *,
......@@ -739,6 +633,17 @@ private:
#ifdef VM_TRACE
void printState();
#endif
bool checkState_TransId(const Uint32 * transId) const {
const Uint32 tTmp1 = transId[0];
const Uint32 tTmp2 = transId[1];
Uint64 tRecTransId = (Uint64)tTmp1 + ((Uint64)tTmp2 << 32);
bool b = theStatus == Connected && theTransactionId == tRecTransId;
#ifdef NDB_NO_DROPPED_SIGNAL
if(!b) abort();
#endif
return b;
}
};
inline
......
......@@ -17,77 +17,4 @@
#ifndef NdbCursorOperation_H
#define NdbCursorOperation_H
#include <NdbOperation.hpp>
class NdbResultSet;
/**
* @class NdbCursorOperation
* @brief Operation using cursors
*/
class NdbCursorOperation : public NdbOperation
{
friend class NdbResultSet;
friend class NdbConnection;
public:
/**
* Type of cursor
*/
enum CursorType {
NoCursor = 0,
ScanCursor = 1,
IndexCursor = 2
};
/**
* Lock when performing scan
*/
enum LockMode {
LM_Read = 0,
LM_Exclusive = 1,
LM_CommittedRead = 2,
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
LM_Dirty = 2
#endif
};
virtual CursorType cursorType() = 0;
/**
* readTuples returns a NdbResultSet where tuples are stored.
* Tuples are not stored in NdbResultSet until execute(NoCommit)
* has been executed and nextResult has been called.
*
* @param parallel Scan parallelism
* @param LockMode Scan lock handling
* @returns NdbResultSet.
*/
virtual NdbResultSet* readTuples(unsigned parallel = 0,
LockMode = LM_Read ) = 0;
inline NdbResultSet* readTuplesExclusive(int parallell = 0){
return readTuples(parallell, LM_Exclusive);
}
protected:
NdbCursorOperation(Ndb* aNdb);
~NdbCursorOperation();
void cursInit();
virtual int executeCursor(int ProcessorId) = 0;
NdbResultSet* getResultSet();
NdbResultSet* m_resultSet;
private:
virtual int nextResult(bool fetchAllowed) = 0;
virtual void closeScan() = 0;
};
#endif
......@@ -29,7 +29,7 @@
#ifndef NdbIndexOperation_H
#define NdbIndexOperation_H
#include <NdbCursorOperation.hpp>
#include "NdbOperation.hpp"
class Index;
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;
class NdbRecAttr
{
friend class NdbOperation;
friend class NdbIndexScanOperation;
friend class NdbEventOperationImpl;
friend class NdbScanReceiver;
friend class NdbReceiver;
friend class Ndb;
public:
......@@ -244,9 +245,8 @@ private:
NdbRecAttr();
Uint32 attrId() const; /* Get attribute id */
void setNULL(); /* Set NULL indicator */
void setNotNULL(); /* Set Not NULL indicator */
void setUNDEFINED(); /* Set UNDEFINED indicator */
bool setNULL(); /* Set NULL indicator */
bool receive_data(const Uint32*, Uint32);
void release(); /* Release memory if allocated */
void init(); /* Initialise object when allocated */
......@@ -254,6 +254,7 @@ private:
void next(NdbRecAttr* aRecAttr);
NdbRecAttr* next() const;
int setup(const class NdbColumnImpl* anAttrInfo, char* aValue);
/* Set up attributes and buffers */
bool copyoutRequired() const; /* Need to copy data to application */
......@@ -268,6 +269,7 @@ private:
Uint32 theAttrId; /* The attribute id */
int theNULLind;
bool m_nullable;
Uint32 theAttrSize;
Uint32 theArraySize;
const NdbDictionary::Column* m_column;
......@@ -288,29 +290,7 @@ NdbRecAttr::getColumn() const {
inline
Uint32
NdbRecAttr::attrSize() const {
switch(getType()){
case NdbDictionary::Column::Int:
case NdbDictionary::Column::Unsigned:
case NdbDictionary::Column::Float:
return 4;
case NdbDictionary::Column::Decimal:
case NdbDictionary::Column::Char:
case NdbDictionary::Column::Varchar:
case NdbDictionary::Column::Binary:
case NdbDictionary::Column::Varbinary:
return 1;
case NdbDictionary::Column::Bigint:
case NdbDictionary::Column::Bigunsigned:
case NdbDictionary::Column::Double:
case NdbDictionary::Column::Datetime:
return 8;
case NdbDictionary::Column::Timespec:
return 12;
case NdbDictionary::Column::Undefined:
default:
return 0;
}
return theAttrSize;
}
inline
......@@ -448,24 +428,11 @@ NdbRecAttr::attrId() const
}
inline
void
bool
NdbRecAttr::setNULL()
{
theNULLind = 1;
}
inline
void
NdbRecAttr::setNotNULL()
{
theNULLind = 0;
}
inline
void
NdbRecAttr::setUNDEFINED()
{
theNULLind = -1;
return m_nullable;
}
inline
......
......@@ -23,6 +23,12 @@
class Ndb;
class NdbReceiver
{
friend class Ndb;
friend class NdbOperation;
friend class NdbScanOperation;
friend class NdbIndexOperation;
friend class NdbIndexScanOperation;
friend class NdbConnection;
public:
enum ReceiverType { NDB_UNINITIALIZED,
NDB_OPERATION = 1,
......@@ -31,7 +37,8 @@ public:
};
NdbReceiver(Ndb *aNdb);
void init(ReceiverType type, void* owner);
void init(ReceiverType type, void* owner, bool keyInfo);
void release();
~NdbReceiver();
Uint32 getId(){
......@@ -42,18 +49,51 @@ public:
return m_type;
}
inline NdbConnection * getTransaction();
void* getOwner(){
return m_owner;
}
bool checkMagicNumber() const;
inline void next(NdbReceiver* next) { m_next = next;}
inline NdbReceiver* next() { return m_next; }
private:
Uint32 theMagicNumber;
Ndb* m_ndb;
Uint32 m_id;
Uint32 m_tcPtrI;
Uint32 m_key_info;
ReceiverType m_type;
void* m_owner;
NdbReceiver* m_next;
/**
* At setup
*/
class NdbRecAttr * getValue(const class NdbColumnImpl*, char * user_dst_ptr);
void do_get_value(NdbReceiver*, Uint32 rows, Uint32 key_size);
void prepareSend();
int execKEYINFO20(Uint32 info, const Uint32* ptr, Uint32 len);
int execTRANSID_AI(const Uint32* ptr, Uint32 len);
int execTCOPCONF(Uint32 len);
int execSCANOPCONF(Uint32 tcPtrI, Uint32 len, Uint32 rows);
class NdbRecAttr* theFirstRecAttr;
class NdbRecAttr* theCurrentRecAttr;
class NdbRecAttr** m_rows;
Uint32 m_list_index; // When using multiple
Uint32 m_current_row;
Uint32 m_result_rows;
Uint32 m_defined_rows;
Uint32 m_expected_result_length;
Uint32 m_received_result_length;
bool nextResult() const { return m_current_row < m_result_rows; }
void copyout(NdbReceiver&);
};
#ifdef NDB_NO_DROPPED_SIGNAL
......@@ -72,5 +112,32 @@ NdbReceiver::checkMagicNumber() const {
return retVal;
}
inline
void
NdbReceiver::prepareSend(){
m_current_row = 0;
m_received_result_length = 0;
m_expected_result_length = 0;
theCurrentRecAttr = theFirstRecAttr;
}
inline
int
NdbReceiver::execTCOPCONF(Uint32 len){
Uint32 tmp = m_received_result_length;
m_expected_result_length = len;
return (tmp == len ? 1 : 0);
}
inline
int
NdbReceiver::execSCANOPCONF(Uint32 tcPtrI, Uint32 len, Uint32 rows){
m_tcPtrI = tcPtrI;
m_result_rows = rows;
Uint32 tmp = m_received_result_length;
m_expected_result_length = len;
return (tmp == len ? 1 : 0);
}
#endif
#endif
......@@ -30,17 +30,15 @@
#define NdbResultSet_H
#include <NdbCursorOperation.hpp>
#include <NdbIndexOperation.hpp>
#include <NdbScanOperation.hpp>
/**
* @class NdbResultSet
* @brief NdbResultSet contains a NdbCursorOperation.
* @brief NdbResultSet contains a NdbScanOperation.
*/
class NdbResultSet
{
friend class NdbCursorOperation;
friend class NdbScanOperation;
public:
......@@ -93,22 +91,57 @@ public:
*/
int nextResult(bool fetchAllowed = true);
/**
* Close result set (scan)
*/
void close();
/**
* Transfer scan operation to an updating transaction. Use this function
* when a scan has found a record that you want to update.
* 1. Start a new transaction.
* 2. Call the function takeOverForUpdate using your new transaction
* as parameter, all the properties of the found record will be copied
* to the new transaction.
* 3. When you execute the new transaction, the lock held by the scan will
* be transferred to the new transaction(it's taken over).
*
* @note You must have started the scan with openScanExclusive
* to be able to update the found tuple.
*
* @param updateTrans the update transaction connection.
* @return an NdbOperation or NULL.
*/
NdbOperation* updateTuple();
NdbOperation* updateTuple(NdbConnection* takeOverTransaction);
NdbOperation* updateTuple(NdbConnection* updateTrans);
/**
* Transfer scan operation to a deleting transaction. Use this function
* when a scan has found a record that you want to delete.
* 1. Start a new transaction.
* 2. Call the function takeOverForDelete using your new transaction
* as parameter, all the properties of the found record will be copied
* to the new transaction.
* 3. When you execute the new transaction, the lock held by the scan will
* be transferred to the new transaction(its taken over).
*
* @note You must have started the scan with openScanExclusive
* to be able to delete the found tuple.
*
* @param deleteTrans the delete transaction connection.
* @return an NdbOperation or NULL.
*/
int deleteTuple();
int deleteTuple(NdbConnection* takeOverTransaction);
private:
NdbResultSet(NdbCursorOperation*);
NdbResultSet(NdbScanOperation*);
~NdbResultSet();
void init();
NdbCursorOperation* m_operation;
NdbScanOperation* m_operation;
};
#endif
......@@ -29,67 +29,74 @@
#ifndef NdbScanOperation_H
#define NdbScanOperation_H
#include <NdbOperation.hpp>
#include <NdbCursorOperation.hpp>
/**
* @class NdbScanOperation
* @brief Class of scan operations for use in transactions.
*/
class NdbScanOperation : public NdbCursorOperation
{
class NdbScanOperation : public NdbOperation {
friend class Ndb;
friend class NdbConnection;
friend class NdbResultSet;
friend class NdbOperation;
public:
/**
* Type of cursor
*/
enum CursorType {
NoCursor = 0,
ScanCursor = 1,
IndexCursor = 2
};
/**
* Lock when performing scan
*/
enum LockMode {
LM_Read = 0,
LM_Exclusive = 1,
LM_CommittedRead = 2,
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
LM_Dirty = 2
#endif
};
/**
* Type of cursor
*/
CursorType get_cursor_type() const;
/**
* readTuples returns a NdbResultSet where tuples are stored.
* Tuples are not stored in NdbResultSet until execute(NoCommit)
* has been executed and nextResult has been called.
*
* @param parallel Scan parallelism
* @param batch No of rows to fetch from each fragment at a time
* @param LockMode Scan lock handling
* @returns NdbResultSet.
* @note specifying 0 for batch and parallall means max performance
*/
virtual NdbResultSet* readTuples(unsigned parallel = 0,
LockMode = LM_Read );
NdbResultSet* readTuples(LockMode = LM_Read,
Uint32 batch = 0, Uint32 parallel = 0);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
inline NdbResultSet* readTuples(int parallell){
return readTuples(LM_Read, 0, parallell);
}
inline NdbResultSet* readTuplesExclusive(int parallell = 0){
return readTuples(LM_Exclusive, 0, parallell);
}
protected:
CursorType m_cursor_type;
int updateTuples();
int updateTuples(Uint32 parallelism);
int deleteTuples();
int deleteTuples(Uint32 parallelism);
// Overload setValue for updateTuples
int setValue(const char* anAttrName, const char* aValue, Uint32 len = 0);
int setValue(const char* anAttrName, Int32 aValue);
int setValue(const char* anAttrName, Uint32 aValue);
int setValue(const char* anAttrName, Int64 aValue);
int setValue(const char* anAttrName, Uint64 aValue);
int setValue(const char* anAttrName, float aValue);
int setValue(const char* anAttrName, double aValue);
int setValue(Uint32 anAttrId, const char* aValue, Uint32 len = 0);
int setValue(Uint32 anAttrId, Int32 aValue);
int setValue(Uint32 anAttrId, Uint32 aValue);
int setValue(Uint32 anAttrId, Int64 aValue);
int setValue(Uint32 anAttrId, Uint64 aValue);
int setValue(Uint32 anAttrId, float aValue);
int setValue(Uint32 anAttrId, double aValue);
#endif
private:
NdbScanOperation(Ndb* aNdb);
~NdbScanOperation();
NdbCursorOperation::CursorType cursorType();
virtual int nextResult(bool fetchAllowed = true);
int nextResult(bool fetchAllowed = true);
virtual void release();
void closeScan();
......@@ -105,125 +112,51 @@ private:
virtual void setErrorCode(int aErrorCode);
virtual void setErrorCodeAbort(int aErrorCode);
virtual int equal_impl(const NdbColumnImpl* anAttrObject,
const char* aValue,
Uint32 len);
private:
NdbResultSet * m_resultSet;
NdbResultSet* getResultSet();
NdbConnection *m_transConnection;
bool m_autoExecute;
bool m_updateOp;
bool m_writeOp;
bool m_deleteOp;
class SetValueRecList* m_setValueList;
};
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
class AttrInfo;
class SetValueRecList;
// Scan related variables
Uint32 theBatchSize;
Uint32 theParallelism;
Uint32 m_keyInfo;
NdbApiSignal* theSCAN_TABREQ;
class SetValueRec {
friend class SetValueRecList;
public:
SetValueRec();
~SetValueRec();
enum SetValueType {
SET_STRING_ATTR1 = 0,
SET_INT32_ATTR1 = 1,
SET_UINT32_ATTR1 = 2,
SET_INT64_ATTR1 = 3,
SET_UINT64_ATTR1 = 4,
SET_FLOAT_ATTR1 = 5,
SET_DOUBLE_ATTR1 = 6,
SET_STRING_ATTR2 = 7,
SET_INT32_ATTR2 = 8,
SET_UINT32_ATTR2 = 9,
SET_INT64_ATTR2 = 10,
SET_UINT64_ATTR2 = 11,
SET_FLOAT_ATTR2 = 12,
SET_DOUBLE_ATTR2 = 13
};
int getFirstATTRINFOScan();
int saveBoundATTRINFO();
int doSendScan(int ProcessorId);
int prepareSendScan(Uint32 TC_ConnectPtr, Uint64 TransactionId);
int fix_receivers(Uint32 parallel, bool keyInfo);
Uint32 m_allocated_receivers;
NdbReceiver** m_receivers; // All receivers
SetValueType stype;
union {
char* anAttrName;
Uint32 anAttrId;
};
struct String {
char* aStringValue;
Uint32 len;
};
union {
String stringStruct;
Int32 anInt32Value;
Uint32 anUint32Value;
Int64 anInt64Value;
Uint64 anUint64Value;
float aFloatValue;
double aDoubleValue;
};
private:
SetValueRec* next;
};
Uint32* m_prepared_receivers; // These are to be sent
Uint32 m_current_api_receiver;
Uint32 m_api_receivers_count;
NdbReceiver** m_api_receivers; // These are currently used by api
Uint32 m_conf_receivers_count; // NOTE needs mutex to access
NdbReceiver** m_conf_receivers; // receive thread puts them here
Uint32 m_sent_receivers_count; // NOTE needs mutex to access
NdbReceiver** m_sent_receivers; // receive thread puts them here
int send_next_scan(Uint32 cnt, bool close);
void receiver_delivered(NdbReceiver*);
void receiver_completed(NdbReceiver*);
void execCLOSE_SCAN_REP(Uint32 errCode);
inline
SetValueRec::SetValueRec() :
next(0)
{
}
NdbOperation* takeOverScanOp(OperationType opType, NdbConnection*);
class SetValueRecList {
public:
SetValueRecList();
~SetValueRecList();
void add(const char* anAttrName, const char* aValue, Uint32 len = 0);
void add(const char* anAttrName, Int32 aValue);
void add(const char* anAttrName, Uint32 aValue);
void add(const char* anAttrName, Int64 aValue);
void add(const char* anAttrName, Uint64 aValue);
void add(const char* anAttrName, float aValue);
void add(const char* anAttrName, double aValue);
void add(Uint32 anAttrId, const char* aValue, Uint32 len = 0);
void add(Uint32 anAttrId, Int32 aValue);
void add(Uint32 anAttrId, Uint32 aValue);
void add(Uint32 anAttrId, Int64 aValue);
void add(Uint32 anAttrId, Uint64 aValue);
void add(Uint32 anAttrId, float aValue);
void add(Uint32 anAttrId, double aValue);
typedef void(* IterateFn)(SetValueRec&, NdbOperation&);
static void callSetValueFn(SetValueRec&, NdbOperation&);
void iterate(IterateFn nextfn, NdbOperation&);
private:
SetValueRec* first;
SetValueRec* last;
Uint32 m_ordered;
};
inline
SetValueRecList::SetValueRecList() :
first(0),
last(0)
{
}
inline
SetValueRecList::~SetValueRecList() {
if (first) delete first;
first = last = 0;
NdbScanOperation::CursorType
NdbScanOperation::get_cursor_type() const {
return m_cursor_type;
}
inline
void SetValueRecList::iterate(SetValueRecList::IterateFn nextfn, NdbOperation& oper)
{
SetValueRec* recPtr = first;
while(recPtr) {
(*nextfn)(*recPtr, oper);
recPtr = recPtr->next; // Move to next in list - MASV
}
}
#endif
#endif
......@@ -20,7 +20,8 @@
#include <UtilBuffer.hpp>
#include <BaseString.hpp>
int base64_encode(UtilBuffer &src, BaseString &dst);
int base64_decode(BaseString &src, UtilBuffer &dst);
int base64_encode(const UtilBuffer &src, BaseString &dst);
int base64_decode(const BaseString &src, UtilBuffer &dst);
int base64_decode(const char * s, size_t len, UtilBuffer &dst);
#endif /* !__BASE64_HPP_INCLUDED__ */
......@@ -134,7 +134,7 @@ public:
/**
* getText - Return as hex-digits (only for debug routines).
*/
static void getText(unsigned size, const Uint32 data[], char* buf);
static char* getText(unsigned size, const Uint32 data[], char* buf);
};
inline bool
......@@ -302,9 +302,10 @@ BitmaskImpl::setField(unsigned size, Uint32 data[],
set(size, data, pos + i, val & (1 << i));
}
inline void
inline char *
BitmaskImpl::getText(unsigned size, const Uint32 data[], char* buf)
{
char * org = buf;
const char* const hex = "0123456789abcdef";
for (int i = (size-1); i >= 0; i--) {
Uint32 x = data[i];
......@@ -315,6 +316,7 @@ BitmaskImpl::getText(unsigned size, const Uint32 data[], char* buf)
buf += 8;
}
*buf = 0;
return org;
}
/**
......@@ -333,7 +335,7 @@ public:
Uint32 data[size];
#if 0
Data & operator=(const Bitmask<size> & src) {
src.assign(size, data);
src.copyto(size, data);
return *this;
}
#endif
......@@ -346,6 +348,8 @@ public:
STATIC_CONST( NotFound = BitmaskImpl::NotFound );
STATIC_CONST( TextLength = size * 8 );
Bitmask() { clear();}
/**
* assign - Set all bits in <em>dst</em> to corresponding in <em>src/<em>
*/
......@@ -359,9 +363,9 @@ public:
void assign(const Bitmask<size> & src);
/**
* assign <em>dst</em> of size <em>sz</em> to <em>this</em>
* copy this to <em>dst</em>
*/
void assign(unsigned sz, Uint32 dst[]) const;
void copyto(unsigned sz, Uint32 dst[]) const;
/**
* assign <em>this</em> according to <em>src/em>
......@@ -469,7 +473,7 @@ public:
/**
* getText - Return as hex-digits (only for debug routines).
*/
static void getText(const Uint32 data[], char* buf);
static char* getText(const Uint32 data[], char* buf);
char* getText(char* buf) const;
};
......@@ -498,12 +502,12 @@ template <unsigned size>
inline void
Bitmask<size>::assign(const Bitmask<size> & src)
{
assign(rep.data, src);
assign(rep.data, src.rep.data);
}
template <unsigned size>
inline void
Bitmask<size>::assign(unsigned sz, Uint32 dst[]) const
Bitmask<size>::copyto(unsigned sz, Uint32 dst[]) const
{
BitmaskImpl::assign(sz, dst, rep.data);
}
......@@ -716,18 +720,17 @@ Bitmask<size>::bitXOR(const Bitmask<size>& mask2)
}
template <unsigned size>
void
char *
Bitmask<size>::getText(const Uint32 data[], char* buf)
{
BitmaskImpl::getText(size, data, buf);
return BitmaskImpl::getText(size, data, buf);
}
template <unsigned size>
inline char *
Bitmask<size>::getText(char* buf) const
{
getText(rep.data, buf);
return buf;
return getText(rep.data, buf);
}
template <unsigned size>
......
#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 @@
#include <UtilBuffer.hpp>
enum PropertiesType {
PropertiesType_Uint32,
PropertiesType_char,
PropertiesType_Properties
PropertiesType_Uint32 = 0,
PropertiesType_char = 1,
PropertiesType_Properties = 2,
PropertiesType_Uint64 = 3
};
/**
......@@ -36,6 +37,7 @@ enum PropertiesType {
*/
struct Property {
Property(const char* name, Uint32 val);
Property(const char* name, Uint64 val);
Property(const char* name, const char * value);
Property(const char* name, const class Properties * value);
~Property();
......@@ -75,6 +77,7 @@ public:
void put(const Property *, int len);
bool put(const char * name, Uint32 value, bool replace = false);
bool put64(const char * name, Uint64 value, bool replace = false);
bool put(const char * name, const char * value, bool replace = false);
bool put(const char * name, const Properties * value, bool replace = false);
......@@ -84,6 +87,7 @@ public:
* Compare get(name, no)
*/
bool put(const char *, Uint32 no, Uint32, bool replace = false);
bool put64(const char *, Uint32 no, Uint64, bool replace = false);
bool put(const char *, Uint32 no, const char *, bool replace = false);
bool put(const char *, Uint32 no, const Properties *, bool replace = false);
......@@ -94,6 +98,7 @@ public:
bool contains(const char * name) const;
bool get(const char * name, Uint32 * value) const;
bool get(const char * name, Uint64 * value) const;
bool get(const char * name, const char ** value) const;
bool get(const char * name, BaseString & value) const;
bool get(const char * name, const Properties ** value) const;
......@@ -109,6 +114,7 @@ public:
bool contains(const char * name, Uint32 no) const;
bool get(const char * name, Uint32 no, Uint32 * value) const;
bool get(const char * name, Uint32 no, Uint64 * value) const;
bool get(const char * name, Uint32 no, const char ** value) const;
bool get(const char * name, Uint32 no, const Properties ** value) const;
......@@ -230,11 +236,12 @@ Properties::unpack(UtilBuffer &buf) {
inline bool
Properties::pack(UtilBuffer &buf) const {
Uint32 size = getPackedSize();
char *tmp_buf = new char[size];
void *tmp_buf = buf.append(size);
if(tmp_buf == 0)
return false;
bool ret = pack((Uint32 *)tmp_buf);
if(ret == false)
return false;
buf.append(tmp_buf, size);
return true;
}
......
......@@ -63,6 +63,15 @@ public:
return 0;
};
void * append(size_t l){
if(grow(len+l) != 0)
return 0;
void * ret = (char*)data+len;
len += l;
return ret;
}
int assign(const void * d, size_t l) {
if (data) free(data);
data = NULL;
......
......@@ -17,13 +17,14 @@
#include <LogLevel.hpp>
const LogLevel::LogLevelCategoryName LogLevel::LOGLEVEL_CATEGORY_NAME[] = {
{"LogLevelStartup"},
{"LogLevelShutdown"},
{"LogLevelStatistic"},
{"LogLevelCheckpoint"},
{"LogLevelNodeRestart"},
{"LogLevelConnection"},
{"LogLevelError"},
{"LogLevelInfo"},
{"LogLevelGrep"}
{ "LogLevelStartup" },
{ "LogLevelShutdown" },
{ "LogLevelStatistic" },
{ "LogLevelCheckpoint" },
{ "LogLevelNodeRestart" },
{ "LogLevelConnection" },
{ "LogLevelError" },
{ "LogLevelWarning" },
{ "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[] = {
DTIMAP(Table, CustomTriggerId, CustomTriggerId),
DTIMAP2(Table, FrmLen, FrmLen, 0, MAX_FRM_DATA_SIZE),
DTIMAPB(Table, FrmData, FrmData, 0, MAX_FRM_DATA_SIZE, FrmLen),
DTIMAP(Table, FragmentCount, FragmentCount),
DTIBREAK(AttributeName)
};
......@@ -128,6 +129,7 @@ DictTabInfo::Table::init(){
CustomTriggerId = RNIL;
FrmLen = 0;
memset(FrmData, 0, sizeof(FrmData));
FragmentCount = 0;
}
void
......
......@@ -25,6 +25,7 @@ SOURCES = TcKeyReq.cpp TcKeyConf.cpp TcKeyRef.cpp \
CopyGCI.cpp SystemError.cpp StartRec.cpp NFCompleteRep.cpp \
FailRep.cpp DisconnectRep.cpp SignalDroppedRep.cpp \
SumaImpl.cpp NdbSttor.cpp CreateFragmentation.cpp \
CntrStart.cpp ReadNodesConf.cpp \
UtilLock.cpp TuxMaint.cpp TupAccess.cpp AccLock.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,20 +30,34 @@ printSCANTABREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiv
fprintf(output, " apiConnectPtr: H\'%.8x\n",
sig->apiConnectPtr);
fprintf(output, " requestInfo: H\'%.8x:\n", requestInfo);
fprintf(output, " Parallellism: %u, LockMode: %u, Holdlock: %u, RangeScan: %u\n",
sig->getParallelism(requestInfo), sig->getLockMode(requestInfo), sig->getHoldLockFlag(requestInfo), sig->getRangeScanFlag(requestInfo));
fprintf(output, " Parallellism: %u, Batch: %u LockMode: %u, Holdlock: %u, RangeScan: %u\n",
sig->getParallelism(requestInfo),
sig->getScanBatch(requestInfo),
sig->getLockMode(requestInfo),
sig->getHoldLockFlag(requestInfo),
sig->getRangeScanFlag(requestInfo));
fprintf(output, " attrLen: %d, tableId: %d, tableSchemaVer: %d\n",
sig->attrLen, sig->tableId, sig->tableSchemaVersion);
fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x) storedProcId: H\'%.8x\n",
sig->transId1, sig->transId2, sig->storedProcId);
fprintf(output, " OperationPtr(s):\n");
for(int i = 0; i<16; i=i+4){
fprintf(output, " H\'%.8x, H\'%.8x, H\'%.8x, H\'%.8x\n",
sig->apiOperationPtr[i], sig->apiOperationPtr[i+1],
sig->apiOperationPtr[i+2], sig->apiOperationPtr[i+3]);
fprintf(output, " OperationPtr(s):\n ");
Uint32 restLen = (len - 9);
const Uint32 * rest = &sig->apiOperationPtr[0];
while(restLen >= 7){
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;
}
......@@ -60,23 +74,8 @@ printSCANTABCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 recei
fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x)\n",
sig->transId1, sig->transId2);
fprintf(output, " requestInfo: H\'%.8x(Operations: %u, ScanStatus: %u(\"",
requestInfo, sig->getOperations(requestInfo), sig->getScanStatus(requestInfo));
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");
fprintf(output, " requestInfo: H\'%.8x(EndOfData: %d)\n",
requestInfo, (requestInfo & ScanTabConf::EndOfData != 0));
#if 0
fprintf(output, " Operation(s):\n");
for(int i = 0; i<16; i++){
......
......@@ -70,6 +70,8 @@
#include <signaldata/NdbSttor.hpp>
#include <signaldata/CreateFragmentation.hpp>
#include <signaldata/UtilLock.hpp>
#include <signaldata/CntrStart.hpp>
#include <signaldata/ReadNodesConf.hpp>
#include <signaldata/TuxMaint.hpp>
#include <signaldata/TupAccess.hpp>
#include <signaldata/AccLock.hpp>
......@@ -240,6 +242,12 @@ SignalDataPrintFunctions[] = {
,{ GSN_UTIL_UNLOCK_REQ, printUTIL_UNLOCK_REQ }
,{ GSN_UTIL_UNLOCK_REF, printUTIL_UNLOCK_REF }
,{ 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_TUP_READ_ATTRS, printTUP_READ_ATTRS }
,{ GSN_TUP_QUERY_TH, printTUP_QUERY_TH }
......
......@@ -101,40 +101,23 @@ const GsnName SignalNames [] = {
,{ GSN_ADD_FRAGREQ, "ADD_FRAGREQ" }
,{ GSN_API_FAILCONF, "API_FAILCONF" }
,{ 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_CLOSE_COMCONF, "CLOSE_COMCONF" }
,{ GSN_CLOSE_COMREQ, "CLOSE_COMREQ" }
,{ GSN_CM_ACKADD, "CM_ACKADD" }
,{ GSN_CM_ACKALARM, "CM_ACKALARM" }
,{ GSN_CM_ADD, "CM_ADD" }
,{ GSN_CM_APPCHG, "CM_APPCHG" }
,{ GSN_CM_ADD_REP, "CM_ADD_REP" }
,{ 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_NODEINFOREF, "CM_NODEINFOREF" }
,{ GSN_CM_NODEINFOREQ, "CM_NODEINFOREQ" }
,{ GSN_CM_REGCONF, "CM_REGCONF" }
,{ GSN_CM_REGREF, "CM_REGREF" }
,{ GSN_CM_REGREQ, "CM_REGREQ" }
,{ GSN_CM_RUN, "CM_RUN" }
,{ GSN_CMVMI_CFGCONF, "CMVMI_CFGCONF" }
,{ GSN_CMVMI_CFGREQ, "CMVMI_CFGREQ" }
,{ GSN_CNTR_CHANGEREP, "CNTR_CHANGEREP" }
,{ GSN_CNTR_MASTERCONF, "CNTR_MASTERCONF" }
,{ GSN_CNTR_MASTERREF, "CNTR_MASTERREF" }
,{ GSN_CNTR_MASTERREQ, "CNTR_MASTERREQ" }
,{ GSN_CNTR_START_REQ, "CNTR_START_REQ" }
,{ GSN_CNTR_START_REF, "CNTR_START_REF" }
,{ GSN_CNTR_START_CONF, "CNTR_START_CONF" }
,{ GSN_CNTR_START_REP, "CNTR_START_REP" }
,{ GSN_CNTR_WAITREP, "CNTR_WAITREP" }
,{ GSN_COMMIT, "COMMIT" }
,{ GSN_COMMIT_FAILCONF, "COMMIT_FAILCONF" }
......@@ -294,9 +277,6 @@ const GsnName SignalNames [] = {
,{ GSN_NEXT_SCANREQ, "NEXT_SCANREQ" }
,{ GSN_NEXTOPERATION, "NEXTOPERATION" }
,{ 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_COMREF, "OPEN_COMREF" }
,{ GSN_OPEN_COMREQ, "OPEN_COMREQ" }
......@@ -318,8 +298,8 @@ const GsnName SignalNames [] = {
,{ GSN_SEND_PACKED, "SEND_PACKED" }
,{ GSN_SET_LOGLEVELORD, "SET_LOGLEVELORD" }
,{ GSN_SHRINKCHECK2, "SHRINKCHECK2" }
,{ GSN_SIZEALT_ACK, "SIZEALT_ACK" }
,{ GSN_SIZEALT_REP, "SIZEALT_REP" }
,{ GSN_READ_CONFIG_REQ, "READ_CONFIG_REQ" }
,{ GSN_READ_CONFIG_CONF, "READ_CONFIG_CONF" }
,{ GSN_SR_FRAGIDCONF, "SR_FRAGIDCONF" }
,{ GSN_SR_FRAGIDREF, "SR_FRAGIDREF" }
,{ GSN_SR_FRAGIDREQ, "SR_FRAGIDREQ" }
......@@ -396,7 +376,6 @@ const GsnName SignalNames [] = {
,{ GSN_UPDATE_TOCONF, "UPDATE_TOCONF" }
,{ GSN_UPDATE_TOREF, "UPDATE_TOREF" }
,{ GSN_UPDATE_TOREQ, "UPDATE_TOREQ" }
,{ GSN_VOTE_MASTERORD, "VOTE_MASTERORD" }
,{ GSN_TUP_ALLOCREQ, "TUP_ALLOCREQ" }
,{ GSN_LQH_ALLOCREQ, "LQH_ALLOCREQ" }
,{ GSN_TUP_DEALLOCREQ, "TUP_DEALLOCREQ" }
......@@ -428,7 +407,6 @@ const GsnName SignalNames [] = {
,{ GSN_CHECKNODEGROUPSREQ, "CHECKNODEGROUPSREQ" }
,{ GSN_CHECKNODEGROUPSCONF, "CHECKNODEGROUPSCONF" }
,{ GSN_ARBIT_CFG, "ARBIT_CFG" }
,{ GSN_ARBIT_PREPREQ, "ARBIT_PREPREQ" }
,{ GSN_ARBIT_PREPCONF, "ARBIT_PREPCONF" }
,{ GSN_ARBIT_PREPREF, "ARBIT_PREPREF" }
......
......@@ -26,23 +26,17 @@
//*****************************************************************************
Config::Config() {
m_info = new ConfigInfo();
}
Config::Config(const Config & org) :
Properties(org) {
m_info = new ConfigInfo();
}
Config::Config(const Properties & org) :
Properties(org) {
m_info = new ConfigInfo();
m_oldConfig = 0;
m_configValues = 0;
}
Config::~Config() {
delete m_info;
if(m_configValues != 0){
free(m_configValues);
}
if(m_oldConfig != 0)
delete m_oldConfig;
}
/*****************************************************************************/
......@@ -52,25 +46,33 @@ Config::printAllNameValuePairs(NdbOut &out,
const Properties *prop,
const char* s) const {
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()) {
Uint32 int_value;
const char* str_value;
Uint64 int_64;
if (m_info->getStatus(section, n) == ConfigInfo::INTERNAL)
if(!section->contains(n))
continue;
if (m_info->getStatus(section, n) == ConfigInfo::DEPRICATED)
if (m_info.getStatus(section, n) == ConfigInfo::INTERNAL)
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;
out << n << ": ";
switch (m_info->getType(section, n)) {
switch (m_info.getType(section, n)) {
case ConfigInfo::INT:
MGM_REQUIRE(prop->get(n, &int_value));
out << int_value;
break;
case ConfigInfo::INT64:
MGM_REQUIRE(prop->get(n, &int_64));
out << int_64;
break;
case ConfigInfo::BOOL:
MGM_REQUIRE(prop->get(n, &int_value));
......@@ -92,6 +94,7 @@ Config::printAllNameValuePairs(NdbOut &out,
/*****************************************************************************/
void Config::printConfigFile(NdbOut &out) const {
#if 0
Uint32 noOfNodes, noOfConnections, noOfComputers;
MGM_REQUIRE(get("NoOfNodes", &noOfNodes));
MGM_REQUIRE(get("NoOfConnections", &noOfConnections));
......@@ -172,15 +175,12 @@ void Config::printConfigFile(NdbOut &out) const {
endl;
}
}
}
const
ConfigInfo* Config::getConfigInfo() const {
return m_info;
#endif
}
Uint32
Config::getGenerationNumber() const {
#if 0
Uint32 ret;
const Properties *prop = NULL;
......@@ -191,10 +191,14 @@ Config::getGenerationNumber() const {
return ret;
return 0;
#else
return 0;
#endif
}
int
Config::setGenerationNumber(Uint32 gen) {
#if 0
Properties *prop = NULL;
getCopy("SYSTEM", &prop);
......@@ -205,12 +209,16 @@ Config::setGenerationNumber(Uint32 gen) {
return 0;
}
return -1;
#else
return -1;
#endif
}
bool
Config::change(const BaseString &section,
const BaseString &param,
const BaseString &value) {
#if 0
const char *name;
Properties::Iterator it(this);
......@@ -252,4 +260,7 @@ Config::change(const BaseString &section,
}
}
return true;
#else
return false;
#endif
}
......@@ -17,7 +17,6 @@
#ifndef Config_H
#define Config_H
#include <signaldata/ConfigParamId.hpp>
#include <LogLevel.hpp>
#include <kernel_types.h>
......@@ -25,6 +24,9 @@
#include <NdbOut.hpp>
#include <ndb_limits.h>
#include <Properties.hpp>
#include "ConfigInfo.hpp"
class ConfigInfo;
/**
* @class Config
......@@ -38,14 +40,14 @@
*
* The following categories (sections) of configuration parameters exists:
* - COMPUTER, DB, MGM, API, TCP, SCI, SHM, OSE
*
*/
class Config : public Properties {
class Config {
public:
/**
* Constructor which loads the object with an Properties object
*/
Config(const Config & org);
Config(const Properties & org);
Config();
virtual ~Config();
......@@ -58,8 +60,6 @@ public:
printConfigFile(ndb);
}
const class ConfigInfo* getConfigInfo() const;
Uint32 getGenerationNumber() const;
int setGenerationNumber(Uint32);
......@@ -69,7 +69,13 @@ public:
const BaseString &param,
const BaseString &value);
/**
* Info
*/
const ConfigInfo * getConfigInfo() const { return &m_info;}
private:
ConfigInfo m_info;
void printAllNameValuePairs(NdbOut &out,
const Properties *prop,
......@@ -78,7 +84,9 @@ private:
/**
* 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
This diff is collapsed.
......@@ -27,8 +27,8 @@
* A MANDATORY parameters must 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 Uint32 UNDEFINED = (~0)-1; // Default value for undefined params.
static const Uint64 MANDATORY = ~0; // Default value for mandatory params.
static const Uint64 UNDEFINED = (~0)-1; // Default value for undefined params.
/**
* @class ConfigInfo
......@@ -38,27 +38,27 @@ static const Uint32 UNDEFINED = (~0)-1; // Default value for undefined params.
*/
class ConfigInfo {
public:
enum Type {BOOL, INT, STRING};
enum Status {USED, ///< Active
DEPRICATED, ///< Can be, but should not be used anymore
NOTIMPLEMENTED, ///< Can not be used currently. Is ignored.
INTERNAL ///< Not configurable by the user
enum Type { BOOL, INT, INT64, STRING, SECTION };
enum Status { USED, ///< Active
DEPRICATED, ///< Can be, but shouldn't
NOTIMPLEMENTED, ///< Is ignored.
INTERNAL ///< Not configurable by the user
};
/**
* Entry for one configuration parameter
*/
struct ParamInfo {
Uint32 _paramId;
const char* _fname;
const char* _pname;
const char* _section;
const char* _description;
Status _status;
bool _updateable;
Type _type;
Uint32 _default;
Uint32 _min;
Uint32 _max;
Uint64 _default;
Uint64 _min;
Uint64 _max;
};
/**
......@@ -84,16 +84,15 @@ public:
*
* @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;
const char* getPName(const Properties * section, const char* fname) const;
const char* getDescription(const Properties * section, const char* fname) const;
const char* getDescription(const Properties * sec, const char* fname) const;
Type getType(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;
Uint32 getMax(const Properties * section, const char* fname) const;
Uint32 getDefault(const Properties * section, const char* fname) const;
Uint64 getMin(const Properties * section, const char* fname) const;
Uint64 getMax(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 * getDefaults(const char * section) const;
......
......@@ -17,10 +17,14 @@
#include "IPCConfig.hpp"
#include <NdbOut.hpp>
#include <NdbHost.h>
#include <TransporterDefinitions.hpp>
#include <TransporterRegistry.hpp>
#include <Properties.hpp>
#include <mgmapi_configuration.hpp>
#include <mgmapi_config_parameters.h>
#if defined DEBUG_TRANSPORTER
#define DEBUG(t) ndbout << __FILE__ << ":" << __LINE__ << ":" << t << endl;
#else
......@@ -334,3 +338,158 @@ IPCConfig::getNodeType(NodeId id) const {
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 @@
#include <ndb_global.h>
#include <Properties.hpp>
#include <ConfigValues.hpp>
class Config;
class ConfigInfo;
......@@ -28,18 +29,40 @@ class ConfigInfo;
* @class InitConfigFileParser
* @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
* object if the config file has correct syntax and semantic.
*/
class InitConfigFileParser {
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 };
/**
* Context = Which section in init config file we are currently parsing
*/
struct Context {
Context(const ConfigInfo *);
~Context();
ContextSectionType type; ///< Section type (e.g. default section,section)
char fname[256]; ///< Section name occuring in init config file
char pname[256]; ///< Section name stored in properties object
......@@ -47,8 +70,8 @@ public:
Uint32 m_sectionLineno; ///< Where did current section start
const ConfigInfo * m_info; // The config info
const Properties * m_config; // The config object
const Properties * m_defaults; // The user defaults
Properties * m_config; // The config object
Properties * m_defaults; // The user defaults
Properties * m_currentSection; // The current section I'm in
const Properties * m_userDefaults; // The defaults of this section
......@@ -56,36 +79,13 @@ public:
const Properties * m_currentInfo; // The "info" for this section
Properties m_userProperties; // User properties (temporary values)
ConfigValuesFactory m_configValues; //
public:
void reportError(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:
/**
* Check if line only contains space/comments
......@@ -111,33 +111,16 @@ private:
bool parseNameValuePair(Context&, const char* line);
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 storeSection(Context&);
const Properties* getSection(const char * name, const Properties* src);
/***************************************************************************
* VARIABLES
***************************************************************************/
FILE* m_initConfigStream;
/**
* Information about parameters (min, max values etc)
*/
const 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&);
ConfigInfo* m_info;
};
#endif // InitConfigFileParser_H
......@@ -5,6 +5,7 @@ TYPE := ndbapi mgmapiclient
PIC_ARCHIVE := Y
ARCHIVE_TARGET := mgmsrvcommon
# Removed temporary
DIRS := printConfig
SOURCES = \
......@@ -17,6 +18,8 @@ SOURCES = \
SOURCES.c = NdbConfig.c
CFLAGS_IPCConfig.cpp := -I$(call fixpath,$(NDB_TOP)/src/mgmapi)
include $(NDB_TOP)/Epilogue.mk
......
......@@ -7,8 +7,10 @@ BIN_TARGET_ARCHIVES := general portlib
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
......@@ -18,6 +18,7 @@
#include <ndb_global.h>
#include <NdbMain.h>
#include <mgmapi.h>
#include <ConfigRetriever.hpp>
#include <Properties.hpp>
#include <NdbOut.hpp>
......@@ -50,9 +51,9 @@ NDB_COMMAND(printConfig,
return 0;
}
Properties * p = 0;
ConfigRetriever c;
struct ndb_mgm_configuration * p = 0;
if(strcmp("host", argv[1]) == 0){
int verId = 0;
if(argc > 5)
......@@ -64,7 +65,6 @@ NDB_COMMAND(printConfig,
p = c.getConfig(argv[2],
atoi(argv[3]),
atoi(argv[4]),
verId);
} else if (strcmp("file", argv[1]) == 0){
int verId = 0;
......@@ -79,12 +79,11 @@ NDB_COMMAND(printConfig,
}
if(p != 0){
p->print(stdout);
//
free(p);
} else {
ndbout << "Configuration not found: " << c.getErrorString() << endl;
}
delete p;
return 0;
}
......@@ -22,89 +22,186 @@ static char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789+/";
int
base64_encode(UtilBuffer &src, BaseString &dst) {
char *s = (char *)src.get_data();
int i = 0;
base64_encode(const UtilBuffer &src, BaseString &dst) {
const unsigned char *s = (const unsigned char *)src.get_data();
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()) {
int c;
unsigned c;
c = s[i++];
c <<= 8;
if(i < src.length())
if(i < src_len)
c += s[i];
c <<= 8;
i++;
if(i < src.length())
if(i < src_len)
c += s[i];
i++;
dst.append(base64_table[(c >> 18) & 0x3f]);
dst.append(base64_table[(c >> 12) & 0x3f]);
if(i > (src.length() + 1))
if(i > (src_len + 1))
dst.append('=');
else
dst.append(base64_table[(c >> 6) & 0x3f]);
if(i > src.length())
if(i > src_len)
dst.append('=');
else
dst.append(base64_table[(c >> 0) & 0x3f]);
len += 4;
}
return 0;
}
static inline int
pos(char c) {
static inline unsigned
pos(unsigned char c) {
return strchr(base64_table, c) - base64_table;
}
int
base64_decode(BaseString &src, UtilBuffer &dst) {
size_t size;
size = (src.length() * 3) / 4;
base64_decode(const BaseString &src, UtilBuffer &dst) {
return base64_decode(src.c_str(), src.length(), dst);
}
#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;
const char *s = src.c_str();
while(i < size) {
int c = 0;
while(i < size){
unsigned c = 0;
int mark = 0;
c += pos(*s++);
SKIP_SPACE(src, i, size);
c += pos(*src++);
c <<= 6;
i++;
c += pos(*s++);
SKIP_SPACE(src, i, size);
c += pos(*src++);
c <<= 6;
i++;
if(*s != '=')
c += pos(*s++);
SKIP_SPACE(src, i, size);
if(* src != '=')
c += pos(*src++);
else {
size--;
mark++;
i = size;
mark = 2;
c <<= 6;
goto end;
}
c <<= 6;
i++;
if(*s != '=')
c += pos(*s++);
SKIP_SPACE(src, i, size);
if(*src != '=')
c += pos(*src++);
else {
size--;
mark++;
i = size;
mark = 1;
goto end;
}
/* c <<= 6; */
i++;
end:
char b[3];
b[0] = (c >> 16) & 0xff;
b[1] = (c >> 8) & 0xff;
b[2] = (c >> 0) & 0xff;
dst.append((void *)b, 3-mark);
}
if(i != size){
abort();
return -1;
}
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
SOURCES = File.cpp md5_hash.cpp Properties.cpp socket_io.cpp \
SimpleProperties.cpp Parser.cpp InputStream.cpp SocketServer.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
......@@ -20,7 +20,7 @@ ifeq ($(NDB_OS), OSE)
endif
SOURCES.c += strdup.c strlcat.c strlcpy.c
DIRS := testSimpleProperties
DIRS := testSimpleProperties testProperties testConfigValues
include $(NDB_TOP)/Epilogue.mk
......
This diff is collapsed.
......@@ -202,13 +202,13 @@ vprintln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
size_t size = sizeof(buf);
if (fmt != 0) {
size = vsnprintf(buf, sizeof(buf)-1, fmt, ap);
size = vsnprintf(buf, sizeof(buf), fmt, ap);
/* Check if the output was truncated */
if(size >= sizeof(buf)) {
if(size >= sizeof(buf)-1) {
buf2 = (char *)malloc(size+2);
if(buf2 == NULL)
return -1;
vsnprintf(buf2, size, fmt, ap);
vsnprintf(buf2, size+1, fmt, ap);
} else
size = sizeof(buf);
} 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
#include <ConfigValues.hpp>
#include <NdbOut.hpp>
#include <stdlib.h>
#include <string.h>
#define CF_NODES 1
#define CF_LOG_PAGES 2
#define CF_MEM_PAGES 3
#define CF_START_TO 4
#define CF_STOP_TO 5
void print(Uint32 i, ConfigValues::ConstIterator & cf){
ndbout_c("---");
for(Uint32 j = 2; j<=7; j++){
switch(cf.getTypeOf(j)){
case ConfigValues::IntType:
ndbout_c("Node %d : CFG(%d) : %d",
i, j, cf.get(j, 999));
break;
case ConfigValues::Int64Type:
ndbout_c("Node %d : CFG(%d) : %lld (64)",
i, j, cf.get64(j, 999));
break;
case ConfigValues::StringType:
ndbout_c("Node %d : CFG(%d) : %s",
i, j, cf.get(j, "<NOT FOUND>"));
break;
default:
ndbout_c("Node %d : CFG(%d) : TYPE: %d",
i, j, cf.getTypeOf(j));
}
}
}
void print(Uint32 i, ConfigValues & _cf){
ConfigValues::ConstIterator cf(_cf);
print(i, cf);
}
void
print(ConfigValues & _cf){
ConfigValues::ConstIterator cf(_cf);
Uint32 i = 0;
while(cf.openSection(CF_NODES, i)){
print(i, cf);
cf.closeSection();
i++;
}
}
inline
void
require(bool b){
if(!b)
abort();
}
int
main(void){
{
ConfigValuesFactory cvf(10, 20);
cvf.openSection(1, 0);
cvf.put(2, 12);
cvf.put64(3, 13);
cvf.put(4, 14);
cvf.put64(5, 15);
cvf.put(6, "Keso");
cvf.put(7, "Kent");
cvf.closeSection();
cvf.openSection(1, 1);
cvf.put(2, 22);
cvf.put64(3, 23);
cvf.put(4, 24);
cvf.put64(5, 25);
cvf.put(6, "Kalle");
cvf.put(7, "Anka");
cvf.closeSection();
ndbout_c("-- print --");
print(* cvf.m_cfg);
cvf.shrink();
ndbout_c("shrink\n-- print --");
print(* cvf.m_cfg);
cvf.expand(10, 10);
ndbout_c("expand\n-- print --");
print(* cvf.m_cfg);
ndbout_c("packed size: %d", cvf.m_cfg->getPackedSize());
ConfigValues::ConstIterator iter(* cvf.m_cfg);
iter.openSection(CF_NODES, 0);
ConfigValues * cfg2 = ConfigValuesFactory::extractCurrentSection(iter);
print(99, * cfg2);
cvf.shrink();
ndbout_c("packed size: %d", cfg2->getPackedSize());
UtilBuffer buf;
Uint32 l1 = cvf.m_cfg->pack(buf);
Uint32 l2 = cvf.m_cfg->getPackedSize();
require(l1 == l2);
ConfigValuesFactory cvf2;
require(cvf2.unpack(buf));
UtilBuffer buf2;
cvf2.shrink();
Uint32 l3 = cvf2.m_cfg->pack(buf2);
require(l1 == l3);
ndbout_c("unpack\n-- print --");
print(* cvf2.m_cfg);
cfg2->~ConfigValues();;
cvf.m_cfg->~ConfigValues();
free(cfg2);
free(cvf.m_cfg);
}
return 0;
}
include .defs.mk
TYPE :=
TYPE := util
BIN_TARGET := keso
BIN_TARGET_ARCHIVES := portlib general
SOURCES := testProperties.cpp
CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/util)
include $(NDB_TOP)/Epilogue.mk
......@@ -63,12 +63,6 @@ readFromFile(Properties & p, const char *fname, bool uu = true){
return res;
}
Property defs[] = {
Property("Rolf", 123)
,Property("Keso", "Kent")
};
void putALot(Properties & tmp){
int i = 123;
tmp.put("LockPagesInMainMemory", i++);
......@@ -124,7 +118,6 @@ main(void){
p.put("Ank4", "anka");
putALot(p);
//p.put(defs, 2);
Properties tmp;
tmp.put("Type", "TCP");
tmp.put("OwnNodeId", 1);
......@@ -136,8 +129,8 @@ main(void){
tmp.put("Compression", (Uint32)false);
tmp.put("Checksum", 1);
tmp.put("SendBufferSize", 2000);
tmp.put("MaxReceiveSize", 1000);
tmp.put64("SendBufferSize", 2000);
tmp.put64("MaxReceiveSize", 1000);
tmp.put("PortNumber", 1233);
putALot(tmp);
......
include .defs.mk
DIRS := error blocks vm ndb-main
DIRS := error vm ndb-main blocks
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.
......@@ -179,7 +179,7 @@ Dbacc::Dbacc(const class Configuration & conf):
addRecSignal(GSN_DROP_TAB_REQ, &Dbacc::execDROP_TAB_REQ);
addRecSignal(GSN_FSREMOVECONF, &Dbacc::execFSREMOVECONF);
addRecSignal(GSN_FSREMOVEREF, &Dbacc::execFSREMOVEREF);
addRecSignal(GSN_SIZEALT_REP, &Dbacc::execSIZEALT_REP);
addRecSignal(GSN_READ_CONFIG_REQ, &Dbacc::execREAD_CONFIG_REQ, true);
addRecSignal(GSN_SET_VAR_REQ, &Dbacc::execSET_VAR_REQ);
initData();
......
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.
......@@ -220,7 +220,7 @@ Dblqh::Dblqh(const class Configuration & conf):
addRecSignal(GSN_CHECK_LCP_STOP, &Dblqh::execCHECK_LCP_STOP);
addRecSignal(GSN_SEND_PACKED, &Dblqh::execSEND_PACKED);
addRecSignal(GSN_TUP_ATTRINFO, &Dblqh::execTUP_ATTRINFO);
addRecSignal(GSN_SIZEALT_REP, &Dblqh::execSIZEALT_REP);
addRecSignal(GSN_READ_CONFIG_REQ, &Dblqh::execREAD_CONFIG_REQ, true);
addRecSignal(GSN_LQHFRAGREQ, &Dblqh::execLQHFRAGREQ);
addRecSignal(GSN_LQHADDATTREQ, &Dblqh::execLQHADDATTREQ);
addRecSignal(GSN_TUP_ADD_ATTCONF, &Dblqh::execTUP_ADD_ATTCONF);
......
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