summaryrefslogtreecommitdiff
path: root/ndb/include
diff options
context:
space:
mode:
Diffstat (limited to 'ndb/include')
-rw-r--r--ndb/include/debugger/DebuggerNames.hpp71
-rw-r--r--ndb/include/debugger/EventLogger.hpp234
-rw-r--r--ndb/include/debugger/GrepError.hpp94
-rw-r--r--ndb/include/debugger/SignalLoggerManager.hpp175
-rw-r--r--ndb/include/editline/editline.h38
-rw-r--r--ndb/include/kernel/AttributeDescriptor.hpp250
-rw-r--r--ndb/include/kernel/AttributeHeader.hpp204
-rw-r--r--ndb/include/kernel/AttributeList.hpp32
-rw-r--r--ndb/include/kernel/BlockNumbers.h81
-rw-r--r--ndb/include/kernel/GlobalSignalNumbers.h957
-rw-r--r--ndb/include/kernel/GrepEvent.hpp59
-rw-r--r--ndb/include/kernel/Interpreter.hpp284
-rw-r--r--ndb/include/kernel/LogLevel.hpp173
-rw-r--r--ndb/include/kernel/NodeBitmask.hpp89
-rw-r--r--ndb/include/kernel/NodeInfo.hpp94
-rw-r--r--ndb/include/kernel/NodeState.hpp308
-rw-r--r--ndb/include/kernel/RefConvert.hpp47
-rw-r--r--ndb/include/kernel/kernel_types.h43
-rw-r--r--ndb/include/kernel/ndb_limits.h94
-rw-r--r--ndb/include/kernel/signaldata/AbortAll.hpp88
-rw-r--r--ndb/include/kernel/signaldata/AccFrag.hpp89
-rw-r--r--ndb/include/kernel/signaldata/AccLock.hpp65
-rw-r--r--ndb/include/kernel/signaldata/AccScan.hpp164
-rw-r--r--ndb/include/kernel/signaldata/AccSizeAltReq.hpp53
-rw-r--r--ndb/include/kernel/signaldata/AlterIndx.hpp268
-rw-r--r--ndb/include/kernel/signaldata/AlterTab.hpp125
-rw-r--r--ndb/include/kernel/signaldata/AlterTable.hpp179
-rw-r--r--ndb/include/kernel/signaldata/AlterTrig.hpp288
-rw-r--r--ndb/include/kernel/signaldata/ApiRegSignalData.hpp92
-rw-r--r--ndb/include/kernel/signaldata/ApiVersion.hpp60
-rw-r--r--ndb/include/kernel/signaldata/ArbitSignalData.hpp154
-rw-r--r--ndb/include/kernel/signaldata/AttrInfo.hpp52
-rw-r--r--ndb/include/kernel/signaldata/BackupContinueB.hpp38
-rw-r--r--ndb/include/kernel/signaldata/BackupImpl.hpp366
-rw-r--r--ndb/include/kernel/signaldata/BackupSignalData.hpp252
-rw-r--r--ndb/include/kernel/signaldata/BlockCommitOrd.hpp62
-rw-r--r--ndb/include/kernel/signaldata/BuildIndx.hpp308
-rw-r--r--ndb/include/kernel/signaldata/CheckNodeGroups.hpp63
-rw-r--r--ndb/include/kernel/signaldata/CloseComReqConf.hpp53
-rw-r--r--ndb/include/kernel/signaldata/CmInit.hpp48
-rw-r--r--ndb/include/kernel/signaldata/CmRegSignalData.hpp192
-rw-r--r--ndb/include/kernel/signaldata/CmvmiCfgConf.hpp49
-rw-r--r--ndb/include/kernel/signaldata/CntrMasterConf.hpp47
-rw-r--r--ndb/include/kernel/signaldata/CntrMasterReq.hpp50
-rw-r--r--ndb/include/kernel/signaldata/ConfigParamId.hpp71
-rw-r--r--ndb/include/kernel/signaldata/ContinueFragmented.hpp36
-rw-r--r--ndb/include/kernel/signaldata/CopyActive.hpp84
-rw-r--r--ndb/include/kernel/signaldata/CopyFrag.hpp87
-rw-r--r--ndb/include/kernel/signaldata/CopyGCIReq.hpp63
-rw-r--r--ndb/include/kernel/signaldata/CreateEvnt.hpp488
-rw-r--r--ndb/include/kernel/signaldata/CreateFrag.hpp61
-rw-r--r--ndb/include/kernel/signaldata/CreateFragmentation.hpp101
-rw-r--r--ndb/include/kernel/signaldata/CreateIndx.hpp295
-rw-r--r--ndb/include/kernel/signaldata/CreateTab.hpp108
-rw-r--r--ndb/include/kernel/signaldata/CreateTable.hpp140
-rw-r--r--ndb/include/kernel/signaldata/CreateTrig.hpp414
-rw-r--r--ndb/include/kernel/signaldata/DiAddTab.hpp90
-rw-r--r--ndb/include/kernel/signaldata/DiGetNodes.hpp62
-rw-r--r--ndb/include/kernel/signaldata/DictSchemaInfo.hpp45
-rw-r--r--ndb/include/kernel/signaldata/DictSizeAltReq.hpp51
-rw-r--r--ndb/include/kernel/signaldata/DictStart.hpp54
-rw-r--r--ndb/include/kernel/signaldata/DictTabInfo.hpp483
-rw-r--r--ndb/include/kernel/signaldata/DihAddFrag.hpp62
-rw-r--r--ndb/include/kernel/signaldata/DihContinueB.hpp75
-rw-r--r--ndb/include/kernel/signaldata/DihSizeAltReq.hpp50
-rw-r--r--ndb/include/kernel/signaldata/DihStartTab.hpp65
-rw-r--r--ndb/include/kernel/signaldata/DihSwitchReplica.hpp72
-rw-r--r--ndb/include/kernel/signaldata/DisconnectRep.hpp61
-rw-r--r--ndb/include/kernel/signaldata/DropIndx.hpp253
-rw-r--r--ndb/include/kernel/signaldata/DropTab.hpp114
-rw-r--r--ndb/include/kernel/signaldata/DropTabFile.hpp64
-rw-r--r--ndb/include/kernel/signaldata/DropTable.hpp80
-rw-r--r--ndb/include/kernel/signaldata/DropTrig.hpp300
-rw-r--r--ndb/include/kernel/signaldata/DumpStateOrd.hpp134
-rw-r--r--ndb/include/kernel/signaldata/EmptyLcp.hpp77
-rw-r--r--ndb/include/kernel/signaldata/EndTo.hpp49
-rw-r--r--ndb/include/kernel/signaldata/EventReport.hpp159
-rw-r--r--ndb/include/kernel/signaldata/EventSubscribeReq.hpp60
-rw-r--r--ndb/include/kernel/signaldata/ExecFragReq.hpp43
-rw-r--r--ndb/include/kernel/signaldata/FailRep.hpp56
-rw-r--r--ndb/include/kernel/signaldata/FireTrigOrd.hpp200
-rw-r--r--ndb/include/kernel/signaldata/FsAppendReq.hpp57
-rw-r--r--ndb/include/kernel/signaldata/FsCloseReq.hpp85
-rw-r--r--ndb/include/kernel/signaldata/FsConf.hpp77
-rw-r--r--ndb/include/kernel/signaldata/FsOpenReq.hpp266
-rw-r--r--ndb/include/kernel/signaldata/FsReadWriteReq.hpp152
-rw-r--r--ndb/include/kernel/signaldata/FsRef.hpp116
-rw-r--r--ndb/include/kernel/signaldata/FsRemoveReq.hpp78
-rw-r--r--ndb/include/kernel/signaldata/GCPSave.hpp98
-rw-r--r--ndb/include/kernel/signaldata/GetTabInfo.hpp126
-rw-r--r--ndb/include/kernel/signaldata/GetTableId.hpp93
-rw-r--r--ndb/include/kernel/signaldata/GrepImpl.hpp891
-rw-r--r--ndb/include/kernel/signaldata/HotSpareRep.hpp48
-rwxr-xr-xndb/include/kernel/signaldata/IndxAttrInfo.hpp56
-rwxr-xr-xndb/include/kernel/signaldata/IndxKeyInfo.hpp56
-rw-r--r--ndb/include/kernel/signaldata/InvalidateNodeLCPConf.hpp41
-rw-r--r--ndb/include/kernel/signaldata/InvalidateNodeLCPReq.hpp42
-rw-r--r--ndb/include/kernel/signaldata/KeyInfo.hpp45
-rw-r--r--ndb/include/kernel/signaldata/LCP.hpp154
-rw-r--r--ndb/include/kernel/signaldata/ListTables.hpp166
-rw-r--r--ndb/include/kernel/signaldata/LqhFrag.hpp252
-rw-r--r--ndb/include/kernel/signaldata/LqhKey.hpp534
-rw-r--r--ndb/include/kernel/signaldata/LqhSizeAltReq.hpp53
-rw-r--r--ndb/include/kernel/signaldata/LqhTransConf.hpp218
-rw-r--r--ndb/include/kernel/signaldata/ManagementServer.hpp87
-rw-r--r--ndb/include/kernel/signaldata/MasterGCP.hpp84
-rw-r--r--ndb/include/kernel/signaldata/MasterLCP.hpp86
-rw-r--r--ndb/include/kernel/signaldata/NFCompleteRep.hpp80
-rw-r--r--ndb/include/kernel/signaldata/NdbSttor.hpp85
-rw-r--r--ndb/include/kernel/signaldata/NdbfsContinueB.hpp35
-rw-r--r--ndb/include/kernel/signaldata/NextScan.hpp67
-rw-r--r--ndb/include/kernel/signaldata/NodeFailRep.hpp68
-rw-r--r--ndb/include/kernel/signaldata/NodeStateSignalData.hpp94
-rw-r--r--ndb/include/kernel/signaldata/PackedSignal.hpp43
-rw-r--r--ndb/include/kernel/signaldata/PrepDropTab.hpp170
-rw-r--r--ndb/include/kernel/signaldata/PrepFailReqRef.hpp49
-rw-r--r--ndb/include/kernel/signaldata/ReadNodesConf.hpp109
-rw-r--r--ndb/include/kernel/signaldata/RelTabMem.hpp69
-rw-r--r--ndb/include/kernel/signaldata/RepImpl.hpp500
-rw-r--r--ndb/include/kernel/signaldata/ResumeReq.hpp69
-rw-r--r--ndb/include/kernel/signaldata/ScanFrag.hpp344
-rw-r--r--ndb/include/kernel/signaldata/ScanTab.hpp453
-rw-r--r--ndb/include/kernel/signaldata/SetLogLevelOrd.hpp70
-rw-r--r--ndb/include/kernel/signaldata/SetVarReq.hpp84
-rw-r--r--ndb/include/kernel/signaldata/SignalData.hpp65
-rw-r--r--ndb/include/kernel/signaldata/SignalDataPrint.hpp36
-rw-r--r--ndb/include/kernel/signaldata/SignalDroppedRep.hpp44
-rw-r--r--ndb/include/kernel/signaldata/SrFragidConf.hpp43
-rw-r--r--ndb/include/kernel/signaldata/StartFragReq.hpp47
-rw-r--r--ndb/include/kernel/signaldata/StartInfo.hpp84
-rw-r--r--ndb/include/kernel/signaldata/StartMe.hpp63
-rw-r--r--ndb/include/kernel/signaldata/StartOrd.hpp48
-rw-r--r--ndb/include/kernel/signaldata/StartPerm.hpp68
-rw-r--r--ndb/include/kernel/signaldata/StartRec.hpp61
-rw-r--r--ndb/include/kernel/signaldata/StartTo.hpp50
-rw-r--r--ndb/include/kernel/signaldata/StopMe.hpp70
-rw-r--r--ndb/include/kernel/signaldata/StopPerm.hpp96
-rw-r--r--ndb/include/kernel/signaldata/StopReq.hpp202
-rw-r--r--ndb/include/kernel/signaldata/SumaImpl.hpp619
-rw-r--r--ndb/include/kernel/signaldata/SystemError.hpp60
-rw-r--r--ndb/include/kernel/signaldata/TamperOrd.hpp40
-rw-r--r--ndb/include/kernel/signaldata/TcCommit.hpp74
-rw-r--r--ndb/include/kernel/signaldata/TcContinueB.hpp49
-rw-r--r--ndb/include/kernel/signaldata/TcHbRep.hpp64
-rw-r--r--ndb/include/kernel/signaldata/TcIndx.hpp528
-rw-r--r--ndb/include/kernel/signaldata/TcKeyConf.hpp131
-rw-r--r--ndb/include/kernel/signaldata/TcKeyFailConf.hpp53
-rw-r--r--ndb/include/kernel/signaldata/TcKeyRef.hpp52
-rw-r--r--ndb/include/kernel/signaldata/TcKeyReq.hpp547
-rw-r--r--ndb/include/kernel/signaldata/TcRollbackRep.hpp50
-rw-r--r--ndb/include/kernel/signaldata/TcSizeAltReq.hpp52
-rw-r--r--ndb/include/kernel/signaldata/TestOrd.hpp229
-rwxr-xr-xndb/include/kernel/signaldata/TransIdAI.hpp59
-rw-r--r--ndb/include/kernel/signaldata/TrigAttrInfo.hpp138
-rw-r--r--ndb/include/kernel/signaldata/TupAccess.hpp172
-rw-r--r--ndb/include/kernel/signaldata/TupCommit.hpp51
-rw-r--r--ndb/include/kernel/signaldata/TupFrag.hpp188
-rw-r--r--ndb/include/kernel/signaldata/TupKey.hpp126
-rw-r--r--ndb/include/kernel/signaldata/TupSizeAltReq.hpp58
-rw-r--r--ndb/include/kernel/signaldata/TuxBound.hpp56
-rw-r--r--ndb/include/kernel/signaldata/TuxContinueB.hpp30
-rw-r--r--ndb/include/kernel/signaldata/TuxMaint.hpp66
-rw-r--r--ndb/include/kernel/signaldata/TuxSizeAltReq.hpp48
-rw-r--r--ndb/include/kernel/signaldata/UpdateTo.hpp59
-rw-r--r--ndb/include/kernel/signaldata/UtilDelete.hpp121
-rw-r--r--ndb/include/kernel/signaldata/UtilExecute.hpp136
-rw-r--r--ndb/include/kernel/signaldata/UtilLock.hpp334
-rw-r--r--ndb/include/kernel/signaldata/UtilPrepare.hpp161
-rw-r--r--ndb/include/kernel/signaldata/UtilRelease.hpp83
-rw-r--r--ndb/include/kernel/signaldata/UtilSequence.hpp101
-rw-r--r--ndb/include/kernel/signaldata/WaitGCP.hpp109
-rw-r--r--ndb/include/kernel/trigger_definitions.h66
-rw-r--r--ndb/include/logger/ConsoleLogHandler.hpp57
-rw-r--r--ndb/include/logger/FileLogHandler.hpp110
-rw-r--r--ndb/include/logger/LogHandler.hpp198
-rw-r--r--ndb/include/logger/Logger.hpp294
-rw-r--r--ndb/include/logger/SysLogHandler.hpp97
-rw-r--r--ndb/include/mgmapi/mgmapi.h663
-rw-r--r--ndb/include/mgmapi/mgmapi_debug.h114
-rw-r--r--ndb/include/mgmcommon/ConfigRetriever.hpp116
-rw-r--r--ndb/include/mgmcommon/IPCConfig.hpp79
-rw-r--r--ndb/include/mgmcommon/MgmtErrorReporter.hpp74
-rw-r--r--ndb/include/mgmcommon/NdbConfig.h34
-rw-r--r--ndb/include/ndb_types.h51
-rw-r--r--ndb/include/ndb_version.h53
-rw-r--r--ndb/include/ndbapi/AttrType.hpp329
-rw-r--r--ndb/include/ndbapi/Ndb.hpp1702
-rw-r--r--ndb/include/ndbapi/NdbApi.hpp33
-rw-r--r--ndb/include/ndbapi/NdbConnection.hpp885
-rw-r--r--ndb/include/ndbapi/NdbCursorOperation.hpp93
-rw-r--r--ndb/include/ndbapi/NdbDictionary.hpp1033
-rw-r--r--ndb/include/ndbapi/NdbError.hpp212
-rw-r--r--ndb/include/ndbapi/NdbEventOperation.hpp205
-rw-r--r--ndb/include/ndbapi/NdbIndexOperation.hpp192
-rw-r--r--ndb/include/ndbapi/NdbOperation.hpp1338
-rw-r--r--ndb/include/ndbapi/NdbPool.hpp35
-rw-r--r--ndb/include/ndbapi/NdbRecAttr.hpp512
-rw-r--r--ndb/include/ndbapi/NdbReceiver.hpp72
-rw-r--r--ndb/include/ndbapi/NdbResultSet.hpp114
-rw-r--r--ndb/include/ndbapi/NdbScanFilter.hpp177
-rw-r--r--ndb/include/ndbapi/NdbScanOperation.hpp248
-rw-r--r--ndb/include/ndbapi/NdbSchemaCon.hpp132
-rw-r--r--ndb/include/ndbapi/NdbSchemaOp.hpp458
-rw-r--r--ndb/include/ndbapi/ndbapi_limits.h47
-rw-r--r--ndb/include/newtonapi/dba.h732
-rw-r--r--ndb/include/newtonapi/defs/pcn_types.h41
-rw-r--r--ndb/include/portlib/NdbCondition.h94
-rw-r--r--ndb/include/portlib/NdbConstant.hpp28
-rw-r--r--ndb/include/portlib/NdbDaemon.h72
-rw-r--r--ndb/include/portlib/NdbEnv.h34
-rw-r--r--ndb/include/portlib/NdbHost.h43
-rw-r--r--ndb/include/portlib/NdbMain.h66
-rw-r--r--ndb/include/portlib/NdbMem.h82
-rw-r--r--ndb/include/portlib/NdbMutex.h114
-rw-r--r--ndb/include/portlib/NdbSleep.h38
-rw-r--r--ndb/include/portlib/NdbStdio.h36
-rw-r--r--ndb/include/portlib/NdbTCP.h137
-rw-r--r--ndb/include/portlib/NdbThread.h103
-rw-r--r--ndb/include/portlib/NdbTick.h69
-rw-r--r--ndb/include/portlib/NdbUnistd.h39
-rw-r--r--ndb/include/portlib/PortDefs.h96
-rw-r--r--ndb/include/portlib/prefetch.h69
-rw-r--r--ndb/include/transporter/TransporterCallback.hpp345
-rw-r--r--ndb/include/transporter/TransporterDefinitions.hpp152
-rw-r--r--ndb/include/transporter/TransporterRegistry.hpp281
-rw-r--r--ndb/include/util/Base64.hpp26
-rw-r--r--ndb/include/util/BaseString.hpp260
-rw-r--r--ndb/include/util/Bitmask.hpp755
-rw-r--r--ndb/include/util/File.hpp206
-rw-r--r--ndb/include/util/InputStream.hpp48
-rw-r--r--ndb/include/util/NdbAutoPtr.hpp49
-rw-r--r--ndb/include/util/NdbOut.hpp132
-rw-r--r--ndb/include/util/NdbSqlUtil.hpp357
-rw-r--r--ndb/include/util/NdbString.h48
-rw-r--r--ndb/include/util/OutputStream.hpp67
-rw-r--r--ndb/include/util/Parser.hpp290
-rw-r--r--ndb/include/util/Properties.hpp246
-rw-r--r--ndb/include/util/SimpleProperties.hpp290
-rw-r--r--ndb/include/util/SocketServer.hpp131
-rw-r--r--ndb/include/util/UtilBuffer.hpp90
-rw-r--r--ndb/include/util/Vector.hpp289
-rw-r--r--ndb/include/util/getarg.h115
-rw-r--r--ndb/include/util/md5_hash.hpp25
-rw-r--r--ndb/include/util/random.h84
-rw-r--r--ndb/include/util/socket_io.h40
-rw-r--r--ndb/include/util/uucode.h36
-rw-r--r--ndb/include/util/version.h50
247 files changed, 39338 insertions, 0 deletions
diff --git a/ndb/include/debugger/DebuggerNames.hpp b/ndb/include/debugger/DebuggerNames.hpp
new file mode 100644
index 00000000000..cf9b1b57226
--- /dev/null
+++ b/ndb/include/debugger/DebuggerNames.hpp
@@ -0,0 +1,71 @@
+/* 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 DEBUGGER_NAMES
+#define DEBUGGER_NAMES
+
+#include <kernel_types.h>
+#include <signaldata/SignalDataPrint.hpp>
+
+/**
+ * getSignalName
+ *
+ * NOTES: Very quick
+ *
+ * RETURNS: Signal name or 0 if none found
+ */
+const char *
+getSignalName(GlobalSignalNumber gsn, const char * defualtValue = "Unknown");
+
+/**
+ * getGsn
+ *
+ * NOTES: Very slow
+ *
+ * RETURNS: Gsn or 0 if none found
+ */
+GlobalSignalNumber
+getGsn(const char * signalName);
+
+/**
+ * getBlockName
+ *
+ * NOTES: Very quick
+ *
+ * RETURNS: Block name or
+ * defValue if not a valid block number
+ */
+const char *
+getBlockName(BlockNumber blockNo, const char * defValue = 0);
+
+/**
+ * getBlockNo
+ *
+ * NOTES: Very slow
+ *
+ * RETURNS: BlockNo or 0 if none found
+ */
+BlockNumber
+getBlockNo(const char * blockName);
+
+/**
+ * Find a print function for a signal
+ *
+ * RETURNS: 0 if none found
+ */
+SignalDataPrintFunction findPrintFunction(GlobalSignalNumber);
+
+#endif
diff --git a/ndb/include/debugger/EventLogger.hpp b/ndb/include/debugger/EventLogger.hpp
new file mode 100644
index 00000000000..c49bd176ee8
--- /dev/null
+++ b/ndb/include/debugger/EventLogger.hpp
@@ -0,0 +1,234 @@
+/* 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 EVENTLOGGER_H
+#define EVENTLOGGER_H
+
+#include <Logger.hpp>
+#include <FileLogHandler.hpp>
+#include <GrepError.hpp>
+#include <kernel_types.h>
+#include <kernel/LogLevel.hpp>
+#include <signaldata/EventReport.hpp>
+
+/**
+ * The EventLogger is primarily used for logging NDB events
+ * in the Management Server. It inherits all logging functionality of Logger.
+ *
+ * HOW TO USE
+ *
+ * 1) Create an EventLogger
+ *
+ * EventLogger myEventLogger = new EventLogger();
+ *
+ * 2) Log NDB events and other log messages.
+ *
+ * myEventLogger->info("Changing log levels.");
+ *
+ * EventReport* report = (EventReport*)&theSignalData[0];
+ * myEventLogger->log(eventReport->getEventType(), theSignalData, aNodeId);
+ *
+ *
+ * The following NDB event categories and log levels are enabled as default:
+ *
+ * EVENT-CATEGORY LOG-LEVEL
+ *
+ * Startup 4
+ * Shutdown 1
+ * Statistic 2
+ * Checkpoint 5
+ * NodeRestart 8
+ * Connection 2
+ * Error 15
+ * Info 10
+ *
+ * @see Logger
+ * @version #@ $Id: EventLogger.hpp,v 1.3 2003/09/01 10:15:52 innpeno Exp $
+ */
+class EventLogger : public Logger
+{
+public:
+ /**
+ * Default constructor. Enables default log levels and
+ * sets the log category to 'EventLogger'.
+ */
+ EventLogger();
+
+ /**
+ * Destructor.
+ */
+ ~EventLogger();
+
+ /**
+ * Open/create the eventlog, the default name is 'cluster.log'.
+ *
+ * @return true if successful.
+ */
+ bool open();
+
+ /**
+ * Opens/creates the eventlog with the specified filename.
+ *
+ * @param aFileName the eventlog filename.
+ * @param maxNoFiles the maximum no of archived eventlog files.
+ * @param maxFileSize the maximum eventlog file size.
+ * @param maxLogEntries the maximum number of log entries before
+ * checking time to archive.
+ * @return true if successful.
+ */
+ bool open(const char* logFileName,
+ int maxNoFiles = FileLogHandler::MAX_NO_FILES,
+ long int maxFileSize = FileLogHandler::MAX_FILE_SIZE,
+ unsigned int maxLogEntries = FileLogHandler::MAX_LOG_ENTRIES);
+
+ /**
+ * Closes the eventlog.
+ */
+ void close();
+
+ /**
+ * Logs the NDB event.
+ *
+ * @param nodeId the node id of event origin.
+ * @param eventType the type of event.
+ * @param theData the event data.
+ * @deprecated use log(int eventType, const Uint32* theData, NodeId nodeId)
+ */
+ void log(NodeId nodeId, int eventType, const Uint32* theData);
+
+ /**
+ * Logs the NDB event.
+ *
+ * @param eventType the type of event.
+ * @param theData the event data.
+ * @param nodeId the node id of event origin.
+ */
+ void log(int eventType, const Uint32* theData, NodeId nodeId = 0);
+
+ /**
+ * Returns the current log levels.
+ * Enable, disable log levels to filter the events that are sent to the
+ * eventlog.
+ *
+ * @return the log level.
+ */
+ LogLevel& getLoglevel();
+
+ /**
+ * Returns the log level that is used to filter an event. The event will not
+ * be logged unless its event category's log level is <= levelFilter.
+ *
+ * @return the log level filter that is used for all event categories.
+ */
+ int getFilterLevel() const;
+ /**
+ * Sets log level filter. The event will be logged if
+ * the event category's log level is <= 'filterLevel'.
+ *
+ * @param level the log level to filter.
+ */
+ void setFilterLevel(int filterLevel);
+
+ /**
+ * Returns the event text for the specified event report type.
+ *
+ * @param type the event type.
+ * @param theData the event data.
+ * @param nodeId a node id.
+ * @return the event report text.
+ */
+ static const char* getText(int type,
+ const Uint32* theData, NodeId nodeId = 0);
+
+ /**
+ * Find a category matching the string
+ *
+ * @param str string to match.
+ * @param cat the event category.
+ * @param exactMatch only do exact matching.
+ *
+ * @return TRUE if match is found, then cat is modified
+ * FALSE if match is not found
+ */
+ static bool matchEventCategory(const char * str,
+ LogLevel::EventCategory * cat,
+ bool exactMatch = false);
+
+ /**
+ * Returns category name or NULL if not found.
+ *
+ * @param cat the event category.
+ * @return category name.
+ */
+ static const char * getEventCategoryName(LogLevel::EventCategory cat);
+
+ /**
+ * Specifies allowed event categories/log levels.
+ */
+ struct EventCategoryName {
+ LogLevel::EventCategory category;
+ const char * name;
+ };
+
+ static const EventCategoryName eventCategoryNames[];
+ static const Uint32 noOfEventCategoryNames;
+
+ /**
+ * This matrix defines which event should be printed when
+ *
+ * threshold - is in range [0-15]
+ * severity - DEBUG to ALERT (Type of log message)
+ */
+ struct EventRepLogLevelMatrix {
+ EventReport::EventType eventType;
+ LogLevel::EventCategory eventCategory;
+ Uint32 threshold;
+ Logger::LoggerLevel severity;
+ };
+
+ static const EventRepLogLevelMatrix matrix[];
+
+ /**
+ * Default log levels for management nodes.
+ *
+ * threshold - is in range [0-15]
+ */
+ struct EventLogMatrix {
+ LogLevel::EventCategory eventCategory;
+ Uint32 threshold;
+ };
+
+ static const EventLogMatrix defEventLogMatrix[];
+
+
+ static const Uint32 matrixSize;
+ static const Uint32 defEventLogMatrixSize;
+
+private:
+ /** Prohibit */
+ EventLogger(const EventLogger&);
+ EventLogger operator = (const EventLogger&);
+ bool operator == (const EventLogger&);
+
+ LogLevel m_logLevel;
+ Uint32 m_filterLevel;
+
+ STATIC_CONST(MAX_TEXT_LENGTH = 256);
+ static char m_text[MAX_TEXT_LENGTH];
+};
+
+
+#endif
diff --git a/ndb/include/debugger/GrepError.hpp b/ndb/include/debugger/GrepError.hpp
new file mode 100644
index 00000000000..ab6a7b272a5
--- /dev/null
+++ b/ndb/include/debugger/GrepError.hpp
@@ -0,0 +1,94 @@
+/* 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 GREP_ERROR_H
+#define GREP_ERROR_H
+
+#include <ndb_types.h>
+
+/**
+ *
+ */
+class GrepError {
+public:
+ enum Code {
+ NO_ERROR = 0,
+ SUBSCRIPTION_ID_NOMEM = 1,
+ SUBSCRIPTION_ID_NOT_FOUND = 2,
+ SUBSCRIPTION_ID_NOT_UNIQUE = 3,
+ SUBSCRIPTION_ID_SUMA_FAILED_CREATE = 4,
+ SUBSCRIPTION_ID_ALREADY_EXIST = 5,
+ COULD_NOT_ALLOCATE_MEM_FOR_SIGNAL = 6,
+ NULL_VALUE = 7,
+ SEQUENCE_ERROR = 8,
+ NOSPACE_IN_POOL= 9,
+ SUBSCRIPTION_NOT_FOUND = 10,
+
+ NF_FakeErrorREF = 11,
+
+ // Error that the user can get when issuing commands
+ SUBSCRIPTION_NOT_STARTED = 100,
+ START_OF_COMPONENT_IN_WRONG_STATE,
+ START_ALREADY_IN_PROGRESS,
+ ILLEGAL_STOP_EPOCH_ID,
+ WRONG_NO_OF_SECTIONS,
+ ILLEGAL_ACTION_WHEN_STOPPING,
+ ILLEGAL_USE_OF_COMMAND,
+ CHANNEL_NOT_STOPPABLE,
+
+ // subscriber releated 20 - 30
+ SUBSCRIBER_NOT_FOUND = 20,
+
+ //SUMA specific 400 - 600
+ SELECTED_TABLE_NOT_FOUND = 400,
+ SELECTED_TABLE_ALREADY_ADDED = 401,
+
+ //REP ERRORS starts at 1000
+ REP_NO_CONNECTED_NODES = 1001,
+ REP_DELETE_NEGATIVE_EPOCH = 1002,
+ REP_DELETE_NONEXISTING_EPOCH = 1003,
+ REP_APPLY_LOGRECORD_FAILED = 1012,
+ REP_APPLY_METARECORD_FAILED = 1013,
+ REP_APPLY_NONCOMPLETE_GCIBUFFER = 1004,
+ REP_APPLY_NULL_GCIBUFFER = 1005,
+ REP_APPLIER_START_TRANSACTION = 1006,
+ REP_APPLIER_NO_TABLE = 1007,
+ REP_APPLIER_NO_OPERATION = 1007,
+ REP_APPLIER_EXECUTE_TRANSACTION = 1008,
+ REP_APPLIER_CREATE_TABLE = 1009,
+ REP_APPLIER_PREPARE_TABLE = 1010,
+ REP_DISCONNECT = 1011,
+ REQUESTOR_ILLEGAL_STATE_FOR_SLOWSTOP = 1200,
+ REQUESTOR_ILLEGAL_STATE_FOR_FASTSTOP = 1201,
+ REP_NOT_PROPER_TABLE = 1202,
+ REP_TABLE_ALREADY_SELECTED = 1203,
+ REP_TABLE_NOT_FOUND = 1204,
+
+ NOT_YET_IMPLEMENTED,
+ NO_OF_ERROR_CODES
+ };
+
+ struct ErrorDescription {
+ Code errCode;
+ const char * name;
+ };
+ static const ErrorDescription errorDescriptions[];
+ static const Uint32 noOfErrorDescs;
+ static const char * getErrorDesc(GrepError::Code err);
+
+};
+
+#endif
diff --git a/ndb/include/debugger/SignalLoggerManager.hpp b/ndb/include/debugger/SignalLoggerManager.hpp
new file mode 100644
index 00000000000..3d89b399f3b
--- /dev/null
+++ b/ndb/include/debugger/SignalLoggerManager.hpp
@@ -0,0 +1,175 @@
+/* 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 */
+
+//****************************************************************************
+//
+// .NAME
+// SignalLoggerManager - Handle signal loggers
+//
+//****************************************************************************
+#ifndef SignalLoggerManager_H
+#define SignalLoggerManager_H
+
+
+#include <NdbStdio.h>
+#include <kernel_types.h>
+#include <BlockNumbers.h>
+#include <TransporterDefinitions.hpp>
+
+class SignalLoggerManager
+{
+public:
+ SignalLoggerManager();
+ virtual ~SignalLoggerManager();
+
+ /**
+ * Sets output
+ * @Returns old output stream
+ */
+ FILE * setOutputStream(FILE * output);
+
+ /**
+ * Gets current output
+ */
+ FILE * getOutputStream() const;
+
+ void flushSignalLog();
+
+ /**
+ * For direct signals
+ * @See also SimulatedBlock EXECUTE_DIRECT
+ */
+ void executeDirect(const SignalHeader&,
+ Uint8 prio, const Uint32 * theData, Uint32 node);
+
+ /**
+ * For input signals
+ */
+ void executeSignal(const SignalHeader&, Uint8 prio,
+ const Uint32 * theData, Uint32 node,
+ const SegmentedSectionPtr ptr[3], Uint32 secs);
+
+ void executeSignal(const SignalHeader&, Uint8 prio,
+ const Uint32 * theData, Uint32 node,
+ const LinearSectionPtr ptr[3], Uint32 secs);
+
+ /**
+ * For output signals
+ */
+ void sendSignal(const SignalHeader&, Uint8 prio,
+ const Uint32 * theData, Uint32 node,
+ const SegmentedSectionPtr ptr[3], Uint32 secs);
+
+ void sendSignal(const SignalHeader&, Uint8 prio,
+ const Uint32 * theData, Uint32 node,
+ const LinearSectionPtr ptr[3], Uint32 secs);
+
+ /**
+ * For output signals
+ */
+ void sendSignalWithDelay(Uint32 delayInMilliSeconds,
+ const SignalHeader&,
+ Uint8 prio, const Uint32 * data, Uint32 node,
+ const SegmentedSectionPtr ptr[3], Uint32 secs);
+
+ /**
+ * Generic messages in the signal log
+ */
+ void log(BlockNumber bno, const char * msg);
+
+ /**
+ * LogModes
+ */
+ enum LogMode {
+ LogOff = 0,
+ LogIn = 1,
+ LogOut = 2,
+ LogInOut = 3
+ };
+
+ /**
+ * Returns no of loggers affected
+ */
+ int log(LogMode logMode, const char * params);
+ int logOn(bool allBlocks, BlockNumber bno, LogMode logMode);
+ int logOff(bool allBlocks, BlockNumber bno, LogMode logMode);
+ int logToggle(bool allBlocks, BlockNumber bno, LogMode logMode);
+
+ void setTrace(unsigned long trace);
+ unsigned long getTrace() const;
+
+ void setOwnNodeId(int nodeId);
+ void setLogDistributed(bool val);
+
+ /**
+ * Print header
+ */
+ static void printSignalHeader(FILE * output,
+ const SignalHeader & sh,
+ Uint8 prio,
+ Uint32 node,
+ bool printReceiversSignalId);
+
+ /**
+ * Function for printing the Signal Data
+ */
+ static void printSignalData(FILE * out,
+ const SignalHeader & sh, const Uint32 *);
+
+ /**
+ * Print linear section.
+ */
+ static void printLinearSection(FILE * output,
+ const SignalHeader & sh,
+ const LinearSectionPtr ptr[3],
+ unsigned i);
+
+ /**
+ * Print segmented section.
+ */
+ static void printSegmentedSection(FILE * output,
+ const SignalHeader & sh,
+ const SegmentedSectionPtr ptr[3],
+ unsigned i);
+
+ /**
+ * Print data word in hex. Adds line break before the word
+ * when pos > 0 && pos % 7 == 0. Increments pos.
+ */
+ static void printDataWord(FILE * output, Uint32 & pos, const Uint32 data);
+
+private:
+ bool m_logDistributed;
+ int m_ownNodeId;
+
+ FILE * outputStream;
+ int log(int cmd, BlockNumber bno, LogMode logMode);
+
+ Uint32 traceId;
+ Uint8 logModes[NO_OF_BLOCKS];
+
+ inline bool
+ logMatch(BlockNumber bno, LogMode mask)
+ {
+ // avoid addressing outside logModes
+ return
+ bno < MIN_BLOCK_NO || bno > MAX_BLOCK_NO ||
+ (logModes[bno-MIN_BLOCK_NO] & mask);
+ }
+};
+
+#endif // SignalLoggerManager_H
+
diff --git a/ndb/include/editline/editline.h b/ndb/include/editline/editline.h
new file mode 100644
index 00000000000..2757e385968
--- /dev/null
+++ b/ndb/include/editline/editline.h
@@ -0,0 +1,38 @@
+/* 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 */
+
+/* $Id: editline.h,v 1.1 2002/12/11 13:53:46 hin Exp $ */
+
+/*
+ * Public include file for editline, to be included instead of readline.h
+ */
+
+#ifndef __EDITLINE_H_INCLUDED__
+#define __EDITLINE_H_INCLUDED__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern char *readline(const char *);
+extern void add_history(char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !__EDITLINE_H_INCLUDED__ */
+
diff --git a/ndb/include/kernel/AttributeDescriptor.hpp b/ndb/include/kernel/AttributeDescriptor.hpp
new file mode 100644
index 00000000000..071d45e2607
--- /dev/null
+++ b/ndb/include/kernel/AttributeDescriptor.hpp
@@ -0,0 +1,250 @@
+/* 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 ATTRIBUTE_DESCRIPTOR_HPP
+#define ATTRIBUTE_DESCRIPTOR_HPP
+
+class AttributeDescriptor {
+ friend class Dbdict;
+ friend class Dbtup;
+ friend class Dbtux;
+
+private:
+ static void setType(Uint32 &, Uint32 type);
+ static void setSize(Uint32 &, Uint32 size);
+ static void setArray(Uint32 &, Uint32 arraySize);
+ static void setOriginal(Uint32 &, Uint32 original);
+ static void setNullable(Uint32 &, Uint32 nullable);
+ static void setDGroup(Uint32 &, Uint32 dgroup);
+ static void setDKey(Uint32 &, Uint32 dkey);
+ static void setPrimaryKey(Uint32 &, Uint32 dkey);
+ static void setStoredInTup(Uint32 &, Uint32 storedInTup);
+ static void setDynamic(Uint32 &, Uint32 dynamicInd);
+
+ static Uint32 getType(const Uint32 &);
+ static Uint32 getSize(const Uint32 &);
+ static Uint32 getSizeInWords(const Uint32 &);
+ static Uint32 getArrayType(const Uint32 &);
+ static Uint32 getArraySize(const Uint32 &);
+ static Uint32 getOriginal(const Uint32 &);
+ static Uint32 getNullable(const Uint32 &);
+ static Uint32 getDGroup(const Uint32 &);
+ static Uint32 getDKey(const Uint32 &);
+ static Uint32 getPrimaryKey(const Uint32 &);
+ static Uint32 getStoredInTup(const Uint32 &);
+ static Uint32 getDynamic(const Uint32 &);
+};
+
+/**
+ *
+ * a = Array type - 2 Bits -> Max 3 (Bit 0-1)
+ * t = Attribute type - 2 Bits -> Max 3 (Bit 2-3)
+ * s = Attribute size - 3 Bits -> Max 7 (Bit 4-6)
+ * o = Original attribute - 1 Bit 7
+ * n = Nullable - 1 Bit 8
+ * ? = Stored in tup - 1 Bit 9
+ * d = Disk based - 1 Bit 10
+ * g = Distribution Group Ind- 1 Bit 11
+ * k = Distribution Key Ind - 1 Bit 12
+ * r = Distribution group sz - 1 Bit 13
+ * p = Primary key attribute - 1 Bit 14
+ * y = Dynamic attribute - 1 Bit 15
+ * z = Array size - 16 Bits -> Max 65535 (Bit 16-31)
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * aattsss n dgkrpyzzzzzzzzzzzzzzzz
+ *
+ */
+
+#define AD_ARRAY_TYPE_SHIFT (0)
+#define AD_ARRAY_TYPE_MASK (3)
+
+#define AD_TYPE_SHIFT (2)
+#define AD_TYPE_MASK (3)
+
+#define AD_SIZE_SHIFT (4)
+#define AD_SIZE_MASK (7)
+
+#define AD_SIZE_IN_WORDS_OFFSET (31)
+#define AD_SIZE_IN_WORDS_SHIFT (5)
+
+#define AD_ORIGINAL_SHIFT (8)
+#define AD_NULLABLE_SHIFT (8)
+#define AD_TUP_STORED_SHIFT (9)
+
+#define AD_DISTR_GROUP_SHIFT (11)
+#define AD_DISTR_KEY_SHIFT (12)
+#define AD_DISTR_GROUP_SZ (13)
+#define AD_PRIMARY_KEY (14)
+#define AD_DYNAMIC (15)
+
+#define AD_ARRAY_SIZE_SHIFT (16)
+#define AD_ARRAY_SIZE_MASK (65535)
+
+inline
+void
+AttributeDescriptor::setType(Uint32 & desc, Uint32 type){
+ ASSERT_MAX(type, AD_TYPE_MASK, "AttributeDescriptor::setType");
+ desc |= (type << AD_TYPE_SHIFT);
+}
+
+inline
+void
+AttributeDescriptor::setSize(Uint32 & desc, Uint32 size){
+ ASSERT_MAX(size, AD_SIZE_MASK, "AttributeDescriptor::setSize");
+ desc |= (size << AD_SIZE_SHIFT);
+}
+
+inline
+void
+AttributeDescriptor::setArray(Uint32 & desc, Uint32 size){
+ ASSERT_MAX(size, AD_ARRAY_SIZE_MASK, "AttributeDescriptor::setArray");
+ desc |= (size << AD_ARRAY_SIZE_SHIFT);
+ if(size <= 1){
+ desc |= (size << AD_ARRAY_TYPE_SHIFT);
+ } else {
+ desc |= (2 << AD_ARRAY_TYPE_SHIFT);
+ }
+}
+
+inline
+void
+AttributeDescriptor::setNullable(Uint32 & desc, Uint32 nullable){
+ ASSERT_BOOL(nullable, "AttributeDescriptor::setNullable");
+ desc |= (nullable << AD_NULLABLE_SHIFT);
+}
+
+inline
+void
+AttributeDescriptor::setOriginal(Uint32 & desc, Uint32 original){
+ ASSERT_BOOL(original, "AttributeDescriptor::setOriginal");
+ desc |= (original << AD_ORIGINAL_SHIFT);
+}
+
+inline
+void
+AttributeDescriptor::setDGroup(Uint32 & desc, Uint32 dgroup){
+ ASSERT_BOOL(dgroup, "AttributeDescriptor::setDGroup");
+ desc |= (dgroup << AD_DISTR_GROUP_SHIFT);
+}
+
+inline
+void
+AttributeDescriptor::setDKey(Uint32 & desc, Uint32 dkey){
+ ASSERT_BOOL(dkey, "AttributeDescriptor::setDKey");
+ desc |= (dkey << AD_DISTR_KEY_SHIFT);
+}
+
+inline
+void
+AttributeDescriptor::setPrimaryKey(Uint32 & desc, Uint32 dkey){
+ ASSERT_BOOL(dkey, "AttributeDescriptor::setPrimaryKey");
+ desc |= (dkey << AD_PRIMARY_KEY);
+}
+
+inline
+void
+AttributeDescriptor::setStoredInTup(Uint32 & desc, Uint32 storedInTup){
+ ASSERT_BOOL(storedInTup, "AttributeDescriptor::setStoredInTup");
+ desc |= (storedInTup << AD_TUP_STORED_SHIFT);
+}
+
+inline
+void
+AttributeDescriptor::setDynamic(Uint32 & desc, Uint32 dynamic){
+ ASSERT_BOOL(dynamic, "AttributeDescriptor::setDynamic");
+ desc |= (dynamic << AD_DYNAMIC);
+}
+
+/**
+ * Getters
+ */
+inline
+Uint32
+AttributeDescriptor::getType(const Uint32 & desc){
+ return (desc >> AD_TYPE_SHIFT) & AD_TYPE_MASK;
+}
+
+inline
+Uint32
+AttributeDescriptor::getSize(const Uint32 & desc){
+ return (desc >> AD_SIZE_SHIFT) & AD_SIZE_MASK;
+}
+
+inline
+Uint32
+AttributeDescriptor::getSizeInWords(const Uint32 & desc){
+ return ((getArraySize(desc) << getSize(desc))
+ + AD_SIZE_IN_WORDS_OFFSET)
+ >> AD_SIZE_IN_WORDS_SHIFT;
+}
+
+inline
+Uint32
+AttributeDescriptor::getArrayType(const Uint32 & desc){
+ return (desc >> AD_ARRAY_TYPE_SHIFT) & AD_ARRAY_TYPE_MASK;
+}
+
+inline
+Uint32
+AttributeDescriptor::getArraySize(const Uint32 & desc){
+ return (desc >> AD_ARRAY_SIZE_SHIFT) & AD_ARRAY_SIZE_MASK;
+}
+
+inline
+Uint32
+AttributeDescriptor::getNullable(const Uint32 & desc){
+ return (desc >> AD_NULLABLE_SHIFT) & 1;
+}
+
+inline
+Uint32
+AttributeDescriptor::getOriginal(const Uint32 & desc){
+ return (desc >> AD_ORIGINAL_SHIFT) & 1;
+}
+
+inline
+Uint32
+AttributeDescriptor::getDGroup(const Uint32 & desc){
+ return (desc >> AD_DISTR_GROUP_SHIFT) & 1;
+}
+
+inline
+Uint32
+AttributeDescriptor::getDKey(const Uint32 & desc){
+ return (desc >> AD_DISTR_KEY_SHIFT) & 1;
+}
+
+inline
+Uint32
+AttributeDescriptor::getPrimaryKey(const Uint32 & desc){
+ return (desc >> AD_PRIMARY_KEY) & 1;
+}
+
+inline
+Uint32
+AttributeDescriptor::getDynamic(const Uint32 & desc){
+ return (desc >> AD_DYNAMIC) & 1;
+}
+
+inline
+Uint32
+AttributeDescriptor::getStoredInTup(const Uint32 & desc){
+ return (desc >> AD_TUP_STORED_SHIFT) & 1;
+}
+
+#endif
diff --git a/ndb/include/kernel/AttributeHeader.hpp b/ndb/include/kernel/AttributeHeader.hpp
new file mode 100644
index 00000000000..91190fdd223
--- /dev/null
+++ b/ndb/include/kernel/AttributeHeader.hpp
@@ -0,0 +1,204 @@
+/* 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 ATTRIBUTE_HEADER
+#define ATTRIBUTE_HEADER
+
+#include <new>
+/**
+ * @class AttributeHeader
+ * @brief Header passed in front of every attribute value in AttrInfo signal
+ */
+class AttributeHeader {
+ friend class Dbtup;
+ friend class Backup;
+ friend class NdbOperation;
+ friend class DbUtil;
+ friend class Suma;
+
+public:
+ /** Initialize AttributeHeader at location aHeaderPtr */
+ static AttributeHeader& init(void* aHeaderPtr, Uint32 anAttributeId,
+ Uint32 aDataSize);
+
+ /** Returns size of AttributeHeader (usually one or two words) */
+ Uint32 getHeaderSize() const; // In 32-bit words
+
+ /** Store AttributeHeader in location given as argument */
+ void insertHeader(Uint32*);
+
+ /** Get next attribute header (if there is one) */
+ AttributeHeader* getNext() const;
+
+ /** Get location of attribute value */
+ Uint32* getDataPtr() const;
+
+ /** Getters and Setters */
+ Uint32 getAttributeId() const;
+ void setAttributeId(Uint32);
+ Uint32 getDataSize() const; // In 32-bit words
+ void setDataSize(Uint32);
+ bool isNULL() const;
+ void setNULL();
+
+ /** Print **/
+ //void print(NdbOut&);
+ void print(FILE*);
+
+ static Uint32 getDataSize(Uint32);
+
+public:
+ AttributeHeader(Uint32 = 0);
+ AttributeHeader(Uint32 anAttributeId, Uint32 aDataSize);
+ ~AttributeHeader();
+
+ Uint32 m_value;
+};
+
+/**
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * ssssssssssssss eiiiiiiiiiiiiiiii
+ *
+ * i = Attribute Id
+ * s = Size of current "chunk" - 14 Bits -> 16384 (words) = 65k
+ * Including optional extra word(s).
+ * e - Element data/Blob, read element of array
+ * If == 0 next data word contains attribute value.
+ * If == 1 next data word contains:
+ * For Array of Fixed size Elements
+ * Start Index (16 bit), Stop Index(16 bit)
+ * For Blob
+ * Start offset (32 bit) (length is defined in previous word)
+ *
+ * An attribute value equal to "null" is represented by setting s == 0.
+ *
+ * Bit 14 is not yet used.
+ */
+
+inline
+AttributeHeader& AttributeHeader::init(void* aHeaderPtr, Uint32 anAttributeId,
+ Uint32 aDataSize)
+{
+ return * new (aHeaderPtr) AttributeHeader(anAttributeId, aDataSize);
+}
+
+inline
+AttributeHeader::AttributeHeader(Uint32 aHeader)
+{
+ m_value = aHeader;
+}
+
+inline
+AttributeHeader::AttributeHeader(Uint32 anAttributeId, Uint32 aDataSize)
+{
+ m_value = 0;
+ this->setAttributeId(anAttributeId);
+ this->setDataSize(aDataSize);
+}
+
+inline
+AttributeHeader::~AttributeHeader()
+{}
+
+inline
+Uint32 AttributeHeader::getHeaderSize() const
+{
+ // Should check 'e' bit here
+ return 1;
+}
+
+inline
+Uint32 AttributeHeader::getAttributeId() const
+{
+ return (m_value & 0xFFFF0000) >> 16;
+}
+
+inline
+void AttributeHeader::setAttributeId(Uint32 anAttributeId)
+{
+ m_value &= 0x0000FFFF; // Clear attribute id
+ m_value |= (anAttributeId << 16);
+}
+
+inline
+Uint32 AttributeHeader::getDataSize() const
+{
+ return (m_value & 0x3FFF);
+}
+
+inline
+void AttributeHeader::setDataSize(Uint32 aDataSize)
+{
+ m_value &= (~0x3FFF);
+ m_value |= aDataSize;
+}
+
+inline
+bool AttributeHeader::isNULL() const
+{
+ return (getDataSize() == 0);
+}
+
+inline
+void AttributeHeader::setNULL()
+{
+ setDataSize(0);
+}
+
+inline
+Uint32* AttributeHeader::getDataPtr() const
+{
+ return (Uint32*)&m_value + getHeaderSize();
+}
+
+inline
+void AttributeHeader::insertHeader(Uint32* target)
+{
+ *target = m_value;
+}
+
+inline
+AttributeHeader*
+AttributeHeader::getNext() const {
+ return (AttributeHeader*)(getDataPtr() + getDataSize());
+}
+
+inline
+void
+//AttributeHeader::print(NdbOut& output) {
+AttributeHeader::print(FILE* output) {
+ fprintf(output, "AttributeId: H\'%.8x (D\'%d), DataSize: H\'%.8x (D\'%d), "
+ "isNULL: %d\n",
+ getAttributeId(), getAttributeId(),
+ getDataSize(), getDataSize(),
+ isNULL());
+}
+
+inline
+Uint32
+AttributeHeader::getDataSize(Uint32 m_value){
+ return (m_value & 0x3FFF);
+}
+
+#endif
+
+
+
+
+
+
+
diff --git a/ndb/include/kernel/AttributeList.hpp b/ndb/include/kernel/AttributeList.hpp
new file mode 100644
index 00000000000..7c6f71df3d2
--- /dev/null
+++ b/ndb/include/kernel/AttributeList.hpp
@@ -0,0 +1,32 @@
+/* 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 ATTRIBUTE_LIST_HPP
+#define ATTRIBUTE_LIST_HPP
+
+/**
+ * Masks and lists used by index and trigger. Must be plain old Uint32 data.
+ * XXX depends on other headers XXX move to some common file
+ */
+
+typedef Bitmask<MAXNROFATTRIBUTESINWORDS> AttributeMask;
+
+struct AttributeList {
+ Uint32 sz;
+ Uint32 id[MAX_ATTRIBUTES_IN_INDEX];
+};
+
+#endif
diff --git a/ndb/include/kernel/BlockNumbers.h b/ndb/include/kernel/BlockNumbers.h
new file mode 100644
index 00000000000..84c3fc656a9
--- /dev/null
+++ b/ndb/include/kernel/BlockNumbers.h
@@ -0,0 +1,81 @@
+/* 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 BLOCK_NUMBERS_H
+#define BLOCK_NUMBERS_H
+
+#include <kernel_types.h>
+#include <RefConvert.hpp>
+
+// 240
+#define MIN_API_BLOCK_NO 0x8000
+
+// 2047
+#define API_PACKED 0x07ff
+
+// 4002
+#define API_CLUSTERMGR 0x0FA2
+
+#define BACKUP 0xF4
+#define DBTC 0xF5
+#define DBDIH 0xF6
+#define DBLQH 0xF7
+#define DBACC 0xF8
+#define DBTUP 0xF9
+#define DBDICT 0xFA
+#define NDBCNTR 0xFB
+#define QMGR 0xFC
+#define NDBFS 0xFD
+#define CMVMI 0xFE
+#define TRIX 0xFF
+#define DBUTIL 0x100
+#define SUMA 0x101
+#define GREP 0x102
+#define DBTUX 0x103
+
+const BlockReference BACKUP_REF = numberToRef(BACKUP, 0);
+const BlockReference DBTC_REF = numberToRef(DBTC, 0);
+const BlockReference DBDIH_REF = numberToRef(DBDIH, 0);
+const BlockReference DBLQH_REF = numberToRef(DBLQH, 0);
+const BlockReference DBACC_REF = numberToRef(DBACC, 0);
+const BlockReference DBTUP_REF = numberToRef(DBTUP, 0);
+const BlockReference DBDICT_REF = numberToRef(DBDICT, 0);
+const BlockReference NDBCNTR_REF = numberToRef(NDBCNTR, 0);
+const BlockReference QMGR_REF = numberToRef(QMGR, 0);
+const BlockReference NDBFS_REF = numberToRef(NDBFS, 0);
+const BlockReference CMVMI_REF = numberToRef(CMVMI, 0);
+const BlockReference TRIX_REF = numberToRef(TRIX, 0);
+const BlockReference DBUTIL_REF = numberToRef(DBUTIL, 0);
+const BlockReference SUMA_REF = numberToRef(SUMA, 0);
+const BlockReference GREP_REF = numberToRef(GREP, 0);
+const BlockReference DBTUX_REF = numberToRef(DBTUX, 0);
+
+const BlockNumber MIN_BLOCK_NO = BACKUP;
+const BlockNumber MAX_BLOCK_NO = DBTUX;
+const BlockNumber NO_OF_BLOCKS = (MAX_BLOCK_NO - MIN_BLOCK_NO + 1);
+
+/**
+ * Used for printing and stuff
+ */
+struct BlockName {
+ const char* name;
+ BlockNumber number;
+};
+
+extern const BlockName BlockNames[];
+extern const BlockNumber NO_OF_BLOCK_NAMES;
+
+#endif
diff --git a/ndb/include/kernel/GlobalSignalNumbers.h b/ndb/include/kernel/GlobalSignalNumbers.h
new file mode 100644
index 00000000000..87385de1f14
--- /dev/null
+++ b/ndb/include/kernel/GlobalSignalNumbers.h
@@ -0,0 +1,957 @@
+/* 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 GLOBAL_SIGNAL_NUMBERS_H
+#define GLOBAL_SIGNAL_NUMBERS_H
+
+#include <kernel_types.h>
+/**
+ * NOTE
+ *
+ * When adding a new signal, remember to update MAX_GSN and SignalNames.cpp
+ */
+
+
+
+const GlobalSignalNumber MAX_GSN = 712;
+
+
+
+
+struct GsnName {
+ GlobalSignalNumber gsn;
+ const char * name;
+};
+
+extern const GsnName SignalNames[];
+extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
+
+/**
+ * These are used by API and kernel
+ */
+#define GSN_API_REGCONF 1
+#define GSN_API_REGREF 2
+#define GSN_API_REGREQ 3
+
+#define GSN_ATTRINFO 4
+#define GSN_TRANSID_AI 5
+#define GSN_KEYINFO 6
+#define GSN_READCONF 7
+
+#define GSN_TCKEY_FAILCONF 8
+#define GSN_TCKEY_FAILREF 9
+#define GSN_TCKEYCONF 10
+#define GSN_TCKEYREF 11
+#define GSN_TCKEYREQ 12
+
+#define GSN_TCROLLBACKCONF 13
+#define GSN_TCROLLBACKREF 14
+#define GSN_TCROLLBACKREQ 15
+#define GSN_TCROLLBACKREP 16
+
+#define GSN_TC_COMMITCONF 17
+#define GSN_TC_COMMITREF 18
+#define GSN_TC_COMMITREQ 19
+#define GSN_TC_HBREP 20
+
+#define GSN_TRANSID_AI_R 21
+#define GSN_KEYINFO20_R 22
+
+#define GSN_GET_TABINFOREF 23
+#define GSN_GET_TABINFOREQ 24
+#define GSN_GET_TABINFO_CONF 190
+
+#define GSN_GET_TABLEID_REQ 683
+#define GSN_GET_TABLEID_REF 684
+#define GSN_GET_TABLEID_CONF 685
+
+#define GSN_DIHNDBTAMPER 25
+#define GSN_NODE_FAILREP 26
+#define GSN_NF_COMPLETEREP 27
+
+#define GSN_SCAN_NEXTREQ 28
+#define GSN_SCAN_TABCONF 29
+#define GSN_SCAN_TABINFO 30
+#define GSN_SCAN_TABREF 31
+#define GSN_SCAN_TABREQ 32
+#define GSN_KEYINFO20 33
+
+#define GSN_TCRELEASECONF 34
+#define GSN_TCRELEASEREF 35
+#define GSN_TCRELEASEREQ 36
+
+#define GSN_TCSEIZECONF 37
+#define GSN_TCSEIZEREF 38
+#define GSN_TCSEIZEREQ 39
+
+// 40 unused
+// 41 unused
+// 42 unused
+// 43 unused
+// 44 unused
+// 45 unused
+// 46 unused
+// 47 unused
+// 48 unused
+// 49 unused
+// 50 unused
+// 51 unused
+// 52 unused
+// 53 unused
+// 54 unused
+// 55 unused
+// 56 unused
+// 57 unused
+// 58 unused
+// 59 unused
+// 60 unused
+// 61 unused
+// 62 unused
+// 63 unused
+// 64 unused
+// 65 unused
+// 66 unused
+
+/**
+ * These are used only by kernel
+ */
+
+#define GSN_ACC_ABORTCONF 67
+// 68 unused
+// 69 unused
+// 70 unused
+#define GSN_ACC_ABORTREQ 71
+#define GSN_ACC_CHECK_SCAN 72
+#define GSN_ACC_COMMITCONF 73
+#define GSN_ACC_COMMITREQ 74
+#define GSN_ACC_CONTOPCONF 75
+#define GSN_ACC_CONTOPREQ 76
+#define GSN_ACC_LCPCONF 77
+#define GSN_ACC_LCPREF 78
+#define GSN_ACC_LCPREQ 79
+#define GSN_ACC_LCPSTARTED 80
+#define GSN_ACC_OVER_REC 81
+
+#define GSN_ACC_SAVE_PAGES 83
+#define GSN_ACC_SCAN_INFO 84
+#define GSN_ACC_SCAN_INFO24 85
+#define GSN_ACC_SCANCONF 86
+#define GSN_ACC_SCANREF 87
+#define GSN_ACC_SCANREQ 88
+#define GSN_ACC_SRCONF 89
+#define GSN_ACC_SRREF 90
+#define GSN_ACC_SRREQ 91
+#define GSN_ACC_TO_CONF 92
+#define GSN_ACC_TO_REF 93
+#define GSN_ACC_TO_REQ 94
+#define GSN_ACCFRAGCONF 95
+#define GSN_ACCFRAGREF 96
+#define GSN_ACCFRAGREQ 97
+#define GSN_ACCKEYCONF 98
+#define GSN_ACCKEYREF 99
+#define GSN_ACCKEYREQ 100
+#define GSN_ACCMINUPDATE 101
+#define GSN_ACCSEIZECONF 103
+#define GSN_ACCSEIZEREF 104
+#define GSN_ACCSEIZEREQ 105
+#define GSN_ACCUPDATECONF 106
+#define GSN_ACCUPDATEKEY 107
+#define GSN_ACCUPDATEREF 108
+
+#define GSN_ADD_FRAGCONF 109
+#define GSN_ADD_FRAGREF 110
+#define GSN_ADD_FRAGREQ 111
+
+#define GSN_API_FAILCONF 113
+#define GSN_API_FAILREQ 114
+#define GSN_APPL_CHANGEREP 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_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
+// 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_COMMIT 152
+#define GSN_COMMIT_FAILCONF 153
+#define GSN_COMMIT_FAILREQ 154
+#define GSN_COMMITCONF 155
+#define GSN_COMMITREQ 156
+#define GSN_COMMITTED 157
+#define GSN_COMPLETE 159
+#define GSN_COMPLETECONF 160
+#define GSN_COMPLETED 161
+#define GSN_COMPLETEREQ 162
+#define GSN_CONNECT_REP 163
+#define GSN_CONTINUEB 164
+// 165 not unused
+#define GSN_COPY_ACTIVECONF 166
+#define GSN_COPY_ACTIVEREF 167
+#define GSN_COPY_ACTIVEREQ 168
+#define GSN_COPY_FRAGCONF 169
+#define GSN_COPY_FRAGREF 170
+#define GSN_COPY_FRAGREQ 171
+#define GSN_COPY_GCICONF 172
+#define GSN_COPY_GCIREQ 173
+#define GSN_COPY_STATECONF 174
+#define GSN_COPY_STATEREQ 175
+#define GSN_COPY_TABCONF 176
+#define GSN_COPY_TABREQ 177
+#define GSN_CREATE_FRAGCONF 178
+#define GSN_CREATE_FRAGREF 179
+#define GSN_CREATE_FRAGREQ 180
+#define GSN_DEBUG_SIG 181
+#define GSN_DI_FCOUNTCONF 182
+#define GSN_DI_FCOUNTREF 183
+#define GSN_DI_FCOUNTREQ 184
+#define GSN_DIADDTABCONF 185
+#define GSN_DIADDTABREF 186
+#define GSN_DIADDTABREQ 187
+// 188 not unused
+// 189 not unused
+// 190 not unused
+#define GSN_DICTSTARTCONF 191
+#define GSN_DICTSTARTREQ 192
+
+#define GSN_LIST_TABLES_REQ 193
+#define GSN_LIST_TABLES_CONF 194
+
+#define GSN_ABORT 195
+#define GSN_ABORTCONF 196
+#define GSN_ABORTED 197
+#define GSN_ABORTREQ 198
+
+/******************************************
+ * DROP TABLE
+ *
+ */
+
+/**
+ * This is drop table's public interface
+ */
+#define GSN_DROP_TABLE_REQ 82
+#define GSN_DROP_TABLE_REF 102
+#define GSN_DROP_TABLE_CONF 112
+
+/**
+ * This is used for implementing drop table
+ */
+#define GSN_PREP_DROP_TAB_REQ 199
+#define GSN_PREP_DROP_TAB_REF 200
+#define GSN_PREP_DROP_TAB_CONF 201
+
+#define GSN_DROP_TAB_REQ 202
+#define GSN_DROP_TAB_REF 203
+#define GSN_DROP_TAB_CONF 204
+
+#define GSN_WAIT_DROP_TAB_REQ 208
+#define GSN_WAIT_DROP_TAB_REF 209
+#define GSN_WAIT_DROP_TAB_CONF 216
+
+/*****************************************/
+
+#define GSN_UPDATE_TOCONF 205
+#define GSN_UPDATE_TOREF 206
+#define GSN_UPDATE_TOREQ 207
+
+#define GSN_DIGETNODESCONF 210
+#define GSN_DIGETNODESREF 211
+#define GSN_DIGETNODESREQ 212
+#define GSN_DIGETPRIMCONF 213
+#define GSN_DIGETPRIMREF 214
+#define GSN_DIGETPRIMREQ 215
+
+#define GSN_DIH_RESTARTCONF 217
+#define GSN_DIH_RESTARTREF 218
+#define GSN_DIH_RESTARTREQ 219
+
+// 220 not unused
+// 221 not unused
+// 222 not unused
+
+#define GSN_EMPTY_LCP_REQ 223
+#define GSN_EMPTY_LCP_CONF 224
+
+#define GSN_SCHEMA_INFO 225
+#define GSN_SCHEMA_INFOCONF 226
+
+#define GSN_MASTER_GCPCONF 227
+#define GSN_MASTER_GCPREF 228
+#define GSN_MASTER_GCPREQ 229
+
+// 230 not unused
+// 231 not unused
+
+#define GSN_DIRELEASECONF 232
+#define GSN_DIRELEASEREF 233
+#define GSN_DIRELEASEREQ 234
+#define GSN_DISCONNECT_REP 235
+#define GSN_DISEIZECONF 236
+#define GSN_DISEIZEREF 237
+#define GSN_DISEIZEREQ 238
+#define GSN_DIVERIFYCONF 239
+#define GSN_DIVERIFYREF 240
+#define GSN_DIVERIFYREQ 241
+#define GSN_ENABLE_COMORD 242
+#define GSN_END_LCPCONF 243
+#define GSN_END_LCPREQ 244
+#define GSN_END_TOCONF 245
+#define GSN_END_TOREQ 246
+#define GSN_EVENT_REP 247
+#define GSN_EXEC_FRAGCONF 248
+#define GSN_EXEC_FRAGREF 249
+#define GSN_EXEC_FRAGREQ 250
+#define GSN_EXEC_SRCONF 251
+#define GSN_EXEC_SRREQ 252
+#define GSN_EXPANDCHECK2 253
+#define GSN_FAIL_REP 254
+#define GSN_FSCLOSECONF 255
+#define GSN_FSCLOSEREF 256
+#define GSN_FSCLOSEREQ 257
+#define GSN_FSAPPENDCONF 258
+#define GSN_FSOPENCONF 259
+#define GSN_FSOPENREF 260
+#define GSN_FSOPENREQ 261
+#define GSN_FSREADCONF 262
+#define GSN_FSREADREF 263
+#define GSN_FSREADREQ 264
+#define GSN_FSSYNCCONF 265
+#define GSN_FSSYNCREF 266
+#define GSN_FSSYNCREQ 267
+#define GSN_FSAPPENDREQ 268
+#define GSN_FSAPPENDREF 269
+#define GSN_FSWRITECONF 270
+#define GSN_FSWRITEREF 271
+#define GSN_FSWRITEREQ 272
+#define GSN_GCP_ABORT 273
+#define GSN_GCP_ABORTED 274
+#define GSN_GCP_COMMIT 275
+#define GSN_GCP_NODEFINISH 276
+#define GSN_GCP_NOMORETRANS 277
+#define GSN_GCP_PREPARE 278
+#define GSN_GCP_PREPARECONF 279
+#define GSN_GCP_PREPAREREF 280
+#define GSN_GCP_SAVECONF 281
+#define GSN_GCP_SAVEREF 282
+#define GSN_GCP_SAVEREQ 283
+#define GSN_GCP_TCFINISHED 284
+#define GSN_SR_FRAGIDCONF 285
+#define GSN_SR_FRAGIDREF 286
+#define GSN_SR_FRAGIDREQ 287
+#define GSN_GETGCICONF 288
+#define GSN_GETGCIREQ 289
+#define GSN_HOT_SPAREREP 290
+#define GSN_INCL_NODECONF 291
+#define GSN_INCL_NODEREF 292
+#define GSN_INCL_NODEREQ 293
+#define GSN_LCP_FRAGIDCONF 294
+#define GSN_LCP_FRAGIDREF 295
+#define GSN_LCP_FRAGIDREQ 296
+#define GSN_LCP_HOLDOPCONF 297
+#define GSN_LCP_HOLDOPREF 298
+#define GSN_LCP_HOLDOPREQ 299
+#define GSN_SHRINKCHECK2 301
+#define GSN_GET_SCHEMA_INFOREQ 302
+// 303 not unused
+// 304 not unused
+#define GSN_LQH_RESTART_OP 305
+#define GSN_LQH_TRANSCONF 306
+#define GSN_LQH_TRANSREQ 307
+#define GSN_LQHADDATTCONF 308
+#define GSN_LQHADDATTREF 309
+#define GSN_LQHADDATTREQ 310
+#define GSN_LQHFRAGCONF 311
+#define GSN_LQHFRAGREF 312
+#define GSN_LQHFRAGREQ 313
+#define GSN_LQHKEYCONF 314
+#define GSN_LQHKEYREF 315
+#define GSN_LQHKEYREQ 316
+
+#define GSN_MASTER_LCPCONF 318
+#define GSN_MASTER_LCPREF 319
+#define GSN_MASTER_LCPREQ 320
+
+#define GSN_MEMCHECKCONF 321
+#define GSN_MEMCHECKREQ 322
+#define GSN_NDB_FAILCONF 323
+#define GSN_NDB_STARTCONF 324
+#define GSN_NDB_STARTREF 325
+#define GSN_NDB_STARTREQ 326
+#define GSN_NDB_STTOR 327
+#define GSN_NDB_STTORRY 328
+#define GSN_NDB_TAMPER 329
+#define GSN_NEXT_SCANCONF 330
+#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_OPEN_COMCONF 339
+#define GSN_OPEN_COMREF 340
+#define GSN_OPEN_COMREQ 341
+#define GSN_PACKED_SIGNAL 342
+#define GSN_PREP_FAILCONF 343
+#define GSN_PREP_FAILREF 344
+#define GSN_PREP_FAILREQ 345
+#define GSN_PRES_TOCONF 346
+#define GSN_PRES_TOREQ 347
+#define GSN_READ_NODESCONF 348
+#define GSN_READ_NODESREF 349
+#define GSN_READ_NODESREQ 350
+#define GSN_SCAN_FRAGCONF 351
+#define GSN_SCAN_FRAGREF 352
+#define GSN_SCAN_FRAGREQ 353
+#define GSN_SCAN_HBREP 354
+#define GSN_SCAN_PROCCONF 355
+#define GSN_SCAN_PROCREQ 356
+#define GSN_SEND_PACKED 357
+#define GSN_SET_LOGLEVELORD 358
+
+#define GSN_LQH_ALLOCREQ 359
+#define GSN_TUP_ALLOCREQ 360
+#define GSN_TUP_DEALLOCREQ 361
+
+// 362 not unused
+
+#define GSN_TUP_WRITELOG_REQ 363
+#define GSN_LQH_WRITELOG_REQ 364
+
+#define GSN_LCP_FRAG_REP 300
+#define GSN_LCP_FRAG_ORD 365
+#define GSN_LCP_COMPLETE_REP 158
+
+#define GSN_START_LCP_REQ 317
+#define GSN_START_LCP_CONF 366
+
+#define GSN_UNBLO_DICTCONF 367
+#define GSN_UNBLO_DICTREQ 368
+#define GSN_START_COPYCONF 369
+#define GSN_START_COPYREF 370
+#define GSN_START_COPYREQ 371
+#define GSN_START_EXEC_SR 372
+#define GSN_START_FRAGCONF 373
+#define GSN_START_FRAGREF 374
+#define GSN_START_FRAGREQ 375
+#define GSN_START_LCP_REF 376
+#define GSN_START_LCP_ROUND 377
+#define GSN_START_MECONF 378
+#define GSN_START_MEREF 379
+#define GSN_START_MEREQ 380
+#define GSN_START_PERMCONF 381
+#define GSN_START_PERMREF 382
+#define GSN_START_PERMREQ 383
+#define GSN_START_RECCONF 384
+#define GSN_START_RECREF 385
+#define GSN_START_RECREQ 386
+#define GSN_START_TOCONF 387
+#define GSN_START_TOREQ 388
+#define GSN_STORED_PROCCONF 389
+#define GSN_STORED_PROCREF 390
+#define GSN_STORED_PROCREQ 391
+#define GSN_STTOR 392
+#define GSN_STTORRY 393
+#define GSN_BACKUP_TRIG_REQ 394
+#define GSN_SYSTEM_ERROR 395
+#define GSN_TAB_COMMITCONF 396
+#define GSN_TAB_COMMITREF 397
+#define GSN_TAB_COMMITREQ 398
+#define GSN_TAKE_OVERTCCONF 399
+#define GSN_TAKE_OVERTCREQ 400
+#define GSN_TC_CLOPSIZECONF 401
+#define GSN_TC_CLOPSIZEREQ 402
+#define GSN_TC_SCHVERCONF 403
+#define GSN_TC_SCHVERREQ 404
+#define GSN_TCGETOPSIZECONF 405
+#define GSN_TCGETOPSIZEREQ 406
+#define GSN_TEST_ORD 407
+#define GSN_TESTSIG 408
+#define GSN_TIME_SIGNAL 409
+#define GSN_VOTE_MASTERORD 410
+// 411 unused
+// 412 unused
+#define GSN_TUP_ABORTREQ 414
+#define GSN_TUP_ADD_ATTCONF 415
+#define GSN_TUP_ADD_ATTRREF 416
+#define GSN_TUP_ADD_ATTRREQ 417
+#define GSN_TUP_ATTRINFO 418
+#define GSN_TUP_COMMITREQ 419
+// 420 unused
+#define GSN_TUP_LCPCONF 421
+#define GSN_TUP_LCPREF 422
+#define GSN_TUP_LCPREQ 423
+#define GSN_TUP_LCPSTARTED 424
+#define GSN_TUP_PREPLCPCONF 425
+#define GSN_TUP_PREPLCPREF 426
+#define GSN_TUP_PREPLCPREQ 427
+#define GSN_TUP_SRCONF 428
+#define GSN_TUP_SRREF 429
+#define GSN_TUP_SRREQ 430
+#define GSN_TUPFRAGCONF 431
+#define GSN_TUPFRAGREF 432
+#define GSN_TUPFRAGREQ 433
+#define GSN_TUPKEYCONF 434
+#define GSN_TUPKEYREF 435
+#define GSN_TUPKEYREQ 436
+#define GSN_TUPRELEASECONF 437
+#define GSN_TUPRELEASEREF 438
+#define GSN_TUPRELEASEREQ 439
+#define GSN_TUPSEIZECONF 440
+#define GSN_TUPSEIZEREF 441
+#define GSN_TUPSEIZEREQ 442
+
+#define GSN_ABORT_ALL_REQ 445
+#define GSN_ABORT_ALL_REF 446
+#define GSN_ABORT_ALL_CONF 447
+
+#define GSN_STATISTICS_REQ 448
+#define GSN_STOP_ORD 449
+#define GSN_TAMPER_ORD 450
+#define GSN_SET_VAR_REQ 451
+#define GSN_SET_VAR_CONF 452
+#define GSN_SET_VAR_REF 453
+#define GSN_STATISTICS_CONF 454
+
+#define GSN_START_ORD 455
+// 456 unused
+// 457 unused
+
+#define GSN_EVENT_SUBSCRIBE_REQ 458
+#define GSN_EVENT_SUBSCRIBE_CONF 459
+#define GSN_EVENT_SUBSCRIBE_REF 460
+#define GSN_ACC_COM_BLOCK 461
+#define GSN_ACC_COM_UNBLOCK 462
+#define GSN_TUP_COM_BLOCK 463
+#define GSN_TUP_COM_UNBLOCK 464
+
+#define GSN_DUMP_STATE_ORD 465
+
+#define GSN_START_INFOREQ 466
+#define GSN_START_INFOREF 467
+#define GSN_START_INFOCONF 468
+
+#define GSN_TC_COMMIT_ACK 469
+#define GSN_REMOVE_MARKER_ORD 470
+
+#define GSN_CHECKNODEGROUPSREQ 471
+#define GSN_CHECKNODEGROUPSCONF 472
+
+#define GSN_ARBIT_CFG 473
+#define GSN_ARBIT_PREPREQ 474
+#define GSN_ARBIT_PREPCONF 475
+#define GSN_ARBIT_PREPREF 476
+#define GSN_ARBIT_STARTREQ 477
+#define GSN_ARBIT_STARTCONF 478
+#define GSN_ARBIT_STARTREF 479
+#define GSN_ARBIT_CHOOSEREQ 480
+#define GSN_ARBIT_CHOOSECONF 481
+#define GSN_ARBIT_CHOOSEREF 482
+#define GSN_ARBIT_STOPORD 483
+#define GSN_ARBIT_STOPREP 484
+
+#define GSN_BLOCK_COMMIT_ORD 485
+#define GSN_UNBLOCK_COMMIT_ORD 486
+
+#define GSN_NODE_STATE_REP 487
+#define GSN_CHANGE_NODE_STATE_REQ 488
+#define GSN_CHANGE_NODE_STATE_CONF 489
+
+#define GSN_DIH_SWITCH_REPLICA_REQ 490
+#define GSN_DIH_SWITCH_REPLICA_CONF 491
+#define GSN_DIH_SWITCH_REPLICA_REF 492
+
+#define GSN_STOP_PERM_REQ 493
+#define GSN_STOP_PERM_REF 494
+#define GSN_STOP_PERM_CONF 495
+
+#define GSN_STOP_ME_REQ 496
+#define GSN_STOP_ME_REF 497
+#define GSN_STOP_ME_CONF 498
+
+#define GSN_WAIT_GCP_REQ 499
+#define GSN_WAIT_GCP_REF 500
+#define GSN_WAIT_GCP_CONF 501
+
+// 502 not used
+
+/**
+ * Trigger and index signals
+ */
+
+/**
+ * These are used by API and kernel
+ */
+#define GSN_TRIG_ATTRINFO 503
+#define GSN_CREATE_TRIG_REQ 504
+#define GSN_CREATE_TRIG_CONF 505
+#define GSN_CREATE_TRIG_REF 506
+#define GSN_ALTER_TRIG_REQ 507
+#define GSN_ALTER_TRIG_CONF 508
+#define GSN_ALTER_TRIG_REF 509
+#define GSN_CREATE_INDX_REQ 510
+#define GSN_CREATE_INDX_CONF 511
+#define GSN_CREATE_INDX_REF 512
+#define GSN_DROP_TRIG_REQ 513
+#define GSN_DROP_TRIG_CONF 514
+#define GSN_DROP_TRIG_REF 515
+#define GSN_DROP_INDX_REQ 516
+#define GSN_DROP_INDX_CONF 517
+#define GSN_DROP_INDX_REF 518
+#define GSN_TCINDXREQ 519
+#define GSN_TCINDXCONF 520
+#define GSN_TCINDXREF 521
+#define GSN_INDXKEYINFO 522
+#define GSN_INDXATTRINFO 523
+#define GSN_TCINDXNEXTREQ 524
+#define GSN_TCINDXNEXTCONF 525
+#define GSN_TCINDXNEXREF 526
+#define GSN_FIRE_TRIG_ORD 527
+
+/**
+ * These are used only by kernel
+ */
+#define GSN_BUILDINDXREQ 528
+#define GSN_BUILDINDXCONF 529
+#define GSN_BUILDINDXREF 530
+
+/**
+ * Backup interface
+ */
+#define GSN_BACKUP_REQ 531
+#define GSN_BACKUP_DATA 532
+#define GSN_BACKUP_REF 533
+#define GSN_BACKUP_CONF 534
+
+#define GSN_ABORT_BACKUP_ORD 535
+
+#define GSN_BACKUP_ABORT_REP 536
+#define GSN_BACKUP_COMPLETE_REP 537
+#define GSN_BACKUP_NF_COMPLETE_REP 538
+
+/**
+ * Internal backup signals
+ */
+#define GSN_DEFINE_BACKUP_REQ 539
+#define GSN_DEFINE_BACKUP_REF 540
+#define GSN_DEFINE_BACKUP_CONF 541
+
+#define GSN_START_BACKUP_REQ 542
+#define GSN_START_BACKUP_REF 543
+#define GSN_START_BACKUP_CONF 544
+
+#define GSN_BACKUP_FRAGMENT_REQ 545
+#define GSN_BACKUP_FRAGMENT_REF 546
+#define GSN_BACKUP_FRAGMENT_CONF 547
+
+#define GSN_STOP_BACKUP_REQ 548
+#define GSN_STOP_BACKUP_REF 549
+#define GSN_STOP_BACKUP_CONF 550
+
+/**
+ * Used for master take-over / API status request
+ */
+#define GSN_BACKUP_STATUS_REQ 551
+#define GSN_BACKUP_STATUS_REF 116
+#define GSN_BACKUP_STATUS_CONF 165
+
+/**
+ * Db sequence signals
+ */
+#define GSN_UTIL_SEQUENCE_REQ 552
+#define GSN_UTIL_SEQUENCE_REF 553
+#define GSN_UTIL_SEQUENCE_CONF 554
+
+#define GSN_FSREMOVEREQ 555
+#define GSN_FSREMOVEREF 556
+#define GSN_FSREMOVECONF 557
+
+#define GSN_UTIL_PREPARE_REQ 558
+#define GSN_UTIL_PREPARE_CONF 559
+#define GSN_UTIL_PREPARE_REF 560
+
+#define GSN_UTIL_EXECUTE_REQ 561
+#define GSN_UTIL_EXECUTE_CONF 562
+#define GSN_UTIL_EXECUTE_REF 563
+
+#define GSN_UTIL_RELEASE_REQ 564
+#define GSN_UTIL_RELEASE_CONF 565
+#define GSN_UTIL_RELEASE_REF 566
+
+/**
+ * When dropping a long signal due to lack of memory resources
+ */
+#define GSN_SIGNAL_DROPPED_REP 567
+#define GSN_CONTINUE_FRAGMENTED 568
+
+/**
+ * Suma participant interface
+ */
+#define GSN_SUB_REMOVE_REQ 569
+#define GSN_SUB_REMOVE_REF 570
+#define GSN_SUB_REMOVE_CONF 571
+#define GSN_SUB_STOP_REQ 572
+#define GSN_SUB_STOP_REF 573
+#define GSN_SUB_STOP_CONF 574
+// 575 unused
+#define GSN_SUB_CREATE_REQ 576
+#define GSN_SUB_CREATE_REF 577
+#define GSN_SUB_CREATE_CONF 578
+#define GSN_SUB_START_REQ 579
+#define GSN_SUB_START_REF 580
+#define GSN_SUB_START_CONF 581
+#define GSN_SUB_SYNC_REQ 582
+#define GSN_SUB_SYNC_REF 583
+#define GSN_SUB_SYNC_CONF 584
+#define GSN_SUB_META_DATA 585
+#define GSN_SUB_TABLE_DATA 586
+
+#define GSN_CREATE_TABLE_REQ 587
+#define GSN_CREATE_TABLE_REF 588
+#define GSN_CREATE_TABLE_CONF 589
+
+#define GSN_ALTER_TABLE_REQ 624
+#define GSN_ALTER_TABLE_REF 625
+#define GSN_ALTER_TABLE_CONF 626
+
+#define GSN_SUB_SYNC_CONTINUE_REQ 590
+#define GSN_SUB_SYNC_CONTINUE_REF 591
+#define GSN_SUB_SYNC_CONTINUE_CONF 592
+#define GSN_SUB_GCP_COMPLETE_REP 593
+
+#define GSN_CREATE_FRAGMENTATION_REQ 594
+#define GSN_CREATE_FRAGMENTATION_REF 595
+#define GSN_CREATE_FRAGMENTATION_CONF 596
+
+#define GSN_CREATE_TAB_REQ 597
+#define GSN_CREATE_TAB_REF 598
+#define GSN_CREATE_TAB_CONF 599
+
+#define GSN_ALTER_TAB_REQ 600
+#define GSN_ALTER_TAB_REF 601
+#define GSN_ALTER_TAB_CONF 602
+
+#define GSN_ALTER_INDX_REQ 603
+#define GSN_ALTER_INDX_REF 604
+#define GSN_ALTER_INDX_CONF 605
+
+/**
+ * Grep signals
+ */
+#define GSN_GREP_SUB_CREATE_REQ 606
+#define GSN_GREP_SUB_CREATE_REF 607
+#define GSN_GREP_SUB_CREATE_CONF 608
+#define GSN_GREP_CREATE_REQ 609
+#define GSN_GREP_CREATE_REF 610
+#define GSN_GREP_CREATE_CONF 611
+
+#define GSN_GREP_SUB_START_REQ 612
+#define GSN_GREP_SUB_START_REF 613
+#define GSN_GREP_SUB_START_CONF 614
+#define GSN_GREP_START_REQ 615
+#define GSN_GREP_START_REF 616
+#define GSN_GREP_START_CONF 617
+
+#define GSN_GREP_SUB_SYNC_REQ 618
+#define GSN_GREP_SUB_SYNC_REF 619
+#define GSN_GREP_SUB_SYNC_CONF 620
+#define GSN_GREP_SYNC_REQ 621
+#define GSN_GREP_SYNC_REF 622
+#define GSN_GREP_SYNC_CONF 623
+
+/**
+ * REP signals
+ */
+#define GSN_REP_WAITGCP_REQ 627
+#define GSN_REP_WAITGCP_REF 628
+#define GSN_REP_WAITGCP_CONF 629
+#define GSN_GREP_WAITGCP_REQ 630
+#define GSN_GREP_WAITGCP_REF 631
+#define GSN_GREP_WAITGCP_CONF 632
+#define GSN_REP_GET_GCI_REQ 633
+#define GSN_REP_GET_GCI_REF 634
+#define GSN_REP_GET_GCI_CONF 635
+#define GSN_REP_GET_GCIBUFFER_REQ 636
+#define GSN_REP_GET_GCIBUFFER_REF 637
+#define GSN_REP_GET_GCIBUFFER_CONF 638
+#define GSN_REP_INSERT_GCIBUFFER_REQ 639
+#define GSN_REP_INSERT_GCIBUFFER_REF 640
+#define GSN_REP_INSERT_GCIBUFFER_CONF 641
+#define GSN_REP_CLEAR_PS_GCIBUFFER_REQ 642
+#define GSN_REP_CLEAR_PS_GCIBUFFER_REF 643
+#define GSN_REP_CLEAR_PS_GCIBUFFER_CONF 644
+#define GSN_REP_CLEAR_SS_GCIBUFFER_REQ 645
+#define GSN_REP_CLEAR_SS_GCIBUFFER_REF 646
+#define GSN_REP_CLEAR_SS_GCIBUFFER_CONF 647
+#define GSN_REP_DATA_PAGE 648
+#define GSN_REP_GCIBUFFER_ACC_REP 649
+
+#define GSN_GREP_SUB_REMOVE_REQ 650
+#define GSN_GREP_SUB_REMOVE_REF 651
+#define GSN_GREP_SUB_REMOVE_CONF 652
+#define GSN_GREP_REMOVE_REQ 653
+#define GSN_GREP_REMOVE_REF 654
+#define GSN_GREP_REMOVE_CONF 655
+
+// Start Global Replication
+#define GSN_GREP_REQ 656
+
+/**
+ * Management server
+ */
+#define GSN_MGM_LOCK_CONFIG_REQ 657
+#define GSN_MGM_LOCK_CONFIG_REP 658
+#define GSN_MGM_UNLOCK_CONFIG_REQ 659
+#define GSN_MGM_UNLOCK_CONFIG_REP 660
+
+#define GSN_UTIL_CREATE_LOCK_REQ 132
+#define GSN_UTIL_CREATE_LOCK_REF 133
+#define GSN_UTIL_CREATE_LOCK_CONF 188
+
+#define GSN_UTIL_DESTROY_LOCK_REQ 189
+#define GSN_UTIL_DESTROY_LOCK_REF 220
+#define GSN_UTIL_DESTROY_LOCK_CONF 221
+
+#define GSN_UTIL_LOCK_REQ 222
+#define GSN_UTIL_LOCK_REF 230
+#define GSN_UTIL_LOCK_CONF 231
+
+#define GSN_UTIL_UNLOCK_REQ 303
+#define GSN_UTIL_UNLOCK_REF 304
+#define GSN_UTIL_UNLOCK_CONF 362
+
+/* SUMA */
+#define GSN_CREATE_SUBID_REQ 661
+#define GSN_CREATE_SUBID_REF 662
+#define GSN_CREATE_SUBID_CONF 663
+
+/* GREP */
+#define GSN_GREP_CREATE_SUBID_REQ 664
+#define GSN_GREP_CREATE_SUBID_REF 665
+#define GSN_GREP_CREATE_SUBID_CONF 666
+#define GSN_REP_DROP_TABLE_REQ 667
+#define GSN_REP_DROP_TABLE_REF 668
+#define GSN_REP_DROP_TABLE_CONF 669
+
+/*
+ * TUX
+ */
+#define GSN_TUXFRAGREQ 670
+#define GSN_TUXFRAGCONF 671
+#define GSN_TUXFRAGREF 672
+#define GSN_TUX_ADD_ATTRREQ 673
+#define GSN_TUX_ADD_ATTRCONF 674
+#define GSN_TUX_ADD_ATTRREF 675
+
+/*
+ * REP
+ */
+#define GSN_REP_DISCONNECT_REP 676
+
+#define GSN_TUX_MAINT_REQ 677
+#define GSN_TUX_MAINT_CONF 678
+#define GSN_TUX_MAINT_REF 679
+
+/*
+ * TUP access
+ */
+#define GSN_TUP_READ_ATTRS 680
+#define GSN_TUP_QUERY_TH 712
+#define GSN_TUP_STORE_TH 681
+
+/**
+ * from mgmtsrvr to NDBCNTR
+ */
+#define GSN_RESUME_REQ 682
+#define GSN_STOP_REQ 443
+#define GSN_STOP_REF 444
+#define GSN_API_VERSION_REQ 697
+#define GSN_API_VERSION_CONF 698
+
+// not used 686
+// not used 687
+// not used 689
+// not used 690
+
+/**
+ * SUMA restart protocol
+ */
+#define GSN_SUMA_START_ME 691
+#define GSN_SUMA_HANDOVER_REQ 692
+#define GSN_SUMA_HANDOVER_CONF 693
+
+// not used 694
+// not used 695
+// not used 696
+
+/**
+ * GREP restart protocol
+ */
+#define GSN_GREP_START_ME 706
+#define GSN_GREP_ADD_SUB_REQ 707
+#define GSN_GREP_ADD_SUB_REF 708
+#define GSN_GREP_ADD_SUB_CONF 709
+
+
+/*
+ * EVENT Signals
+ */
+#define GSN_SUB_GCP_COMPLETE_ACC 699
+
+#define GSN_CREATE_EVNT_REQ 700
+#define GSN_CREATE_EVNT_CONF 701
+#define GSN_CREATE_EVNT_REF 702
+
+#define GSN_DROP_EVNT_REQ 703
+#define GSN_DROP_EVNT_CONF 704
+#define GSN_DROP_EVNT_REF 705
+
+#define GSN_TUX_BOUND_INFO 710
+
+#define GSN_ACC_LOCKREQ 711
+
+
+#endif
diff --git a/ndb/include/kernel/GrepEvent.hpp b/ndb/include/kernel/GrepEvent.hpp
new file mode 100644
index 00000000000..2073a7072c9
--- /dev/null
+++ b/ndb/include/kernel/GrepEvent.hpp
@@ -0,0 +1,59 @@
+/* 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 GREP_EVENT_H
+#define GREP_EVENT_H
+
+class GrepEvent {
+public:
+ enum Subscription {
+ GrepSS_CreateSubIdConf = 1,
+ GrepSS_SubCreateConf = 2,
+ GrepSS_SubStartMetaConf = 3,
+ GrepSS_SubStartDataConf = 4,
+ GrepSS_SubSyncDataConf = 5,
+ GrepSS_SubSyncMetaConf = 6,
+ GrepSS_SubRemoveConf = 7,
+
+ GrepPS_CreateSubIdConf = 8,
+ GrepPS_SubCreateConf = 9,
+ GrepPS_SubStartMetaConf = 10,
+ GrepPS_SubStartDataConf = 11,
+ GrepPS_SubSyncMetaConf = 12,
+ GrepPS_SubSyncDataConf = 13,
+ GrepPS_SubRemoveConf = 14,
+
+ GrepPS_CreateSubIdRef = 15,
+ GrepPS_SubCreateRef = 16,
+ GrepPS_SubStartMetaRef = 17,
+ GrepPS_SubStartDataRef = 18,
+ GrepPS_SubSyncMetaRef = 19,
+ GrepPS_SubSyncDataRef = 20,
+ GrepPS_SubRemoveRef = 21,
+
+ GrepSS_CreateSubIdRef = 22,
+ GrepSS_SubCreateRef = 23,
+ GrepSS_SubStartMetaRef = 24,
+ GrepSS_SubStartDataRef = 25,
+ GrepSS_SubSyncMetaRef = 26,
+ GrepSS_SubSyncDataRef = 27,
+ GrepSS_SubRemoveRef = 28,
+
+ Rep_Disconnect = 29
+
+ };
+};
+#endif
diff --git a/ndb/include/kernel/Interpreter.hpp b/ndb/include/kernel/Interpreter.hpp
new file mode 100644
index 00000000000..2c282be361c
--- /dev/null
+++ b/ndb/include/kernel/Interpreter.hpp
@@ -0,0 +1,284 @@
+/* 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 NDB_INTERPRETER_HPP
+#define NDB_INTERPRETER_HPP
+
+#include <ndb_types.h>
+
+class Interpreter {
+public:
+
+ inline static Uint32 mod4(Uint32 len){
+ return len + ((4 - (len & 3)) & 3);
+ }
+
+
+ /**
+ * General Mnemonic format
+ *
+ * i = Instruction - 5 Bits ( 0 - 5 ) max 63
+ * x = Register 1 - 3 Bits ( 6 - 8 ) max 7
+ * y = Register 2 - 3 Bits ( 9 -11 ) max 7
+ * b = Branch offset (only branches)
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * iiiiiixxxyyy bbbbbbbbbbbbbbbb
+ *
+ *
+ */
+
+ /**
+ * Instructions
+ */
+ static const Uint32 READ_ATTR_INTO_REG = 1;
+ static const Uint32 WRITE_ATTR_FROM_REG = 2;
+ static const Uint32 LOAD_CONST_NULL = 3;
+ static const Uint32 LOAD_CONST16 = 4;
+ static const Uint32 LOAD_CONST32 = 5;
+ static const Uint32 LOAD_CONST64 = 6;
+ static const Uint32 ADD_REG_REG = 7;
+ static const Uint32 SUB_REG_REG = 8;
+ static const Uint32 BRANCH = 9;
+ static const Uint32 BRANCH_REG_EQ_NULL = 10;
+ static const Uint32 BRANCH_REG_NE_NULL = 11;
+ static const Uint32 BRANCH_EQ_REG_REG = 12;
+ static const Uint32 BRANCH_NE_REG_REG = 13;
+ static const Uint32 BRANCH_LT_REG_REG = 14;
+ static const Uint32 BRANCH_LE_REG_REG = 15;
+ static const Uint32 BRANCH_GT_REG_REG = 16;
+ static const Uint32 BRANCH_GE_REG_REG = 17;
+ static const Uint32 EXIT_OK = 18;
+ static const Uint32 EXIT_REFUSE = 19;
+ static const Uint32 CALL = 20;
+ static const Uint32 RETURN = 21;
+ static const Uint32 EXIT_OK_LAST = 22;
+ static const Uint32 BRANCH_ATTR_OP_ARG = 23;
+ static const Uint32 BRANCH_ATTR_EQ_NULL = 24;
+ static const Uint32 BRANCH_ATTR_NE_NULL = 25;
+
+ /**
+ * Macros for creating code
+ */
+ static Uint32 Read(Uint32 AttrId, Uint32 Register);
+ static Uint32 Write(Uint32 AttrId, Uint32 Register);
+
+ static Uint32 LoadNull(Uint32 Register);
+ static Uint32 LoadConst16(Uint32 Register, Uint32 Value);
+ static Uint32 LoadConst32(Uint32 Register); // Value in next word
+ static Uint32 LoadConst64(Uint32 Register); // Value in next 2 words
+ static Uint32 Add(Uint32 DstReg, Uint32 SrcReg1, Uint32 SrcReg2);
+ static Uint32 Sub(Uint32 DstReg, Uint32 SrcReg1, Uint32 SrcReg2);
+ static Uint32 Branch(Uint32 Inst, Uint32 R1, Uint32 R2);
+ static Uint32 ExitOK();
+
+ /**
+ * Branch string
+ *
+ * i = Instruction - 5 Bits ( 0 - 5 ) max 63
+ * a = Attribute id
+ * l = Length of string
+ * b = Branch offset
+ * t = branch type
+ * d = Array length diff
+ * v = Varchar flag
+ * p = No-blank-padding flag for char compare
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * iiiiii ddvtttpbbbbbbbbbbbbbbbb
+ * aaaaaaaaaaaaaaaallllllllllllllll
+ * -string.... -
+ */
+ enum UnaryCondition {
+ IS_NULL = 0,
+ IS_NOT_NULL = 1
+ };
+
+ enum BinaryCondition {
+ EQ = 0,
+ NE = 1,
+ LT = 2,
+ LE = 3,
+ GT = 4,
+ GE = 5,
+ LIKE = 6,
+ NOT_LIKE = 7
+ };
+ static Uint32 BranchCol(BinaryCondition cond,
+ Uint32 arrayLengthDiff, Uint32 varchar, bool nopad);
+ static Uint32 BranchCol_2(Uint32 AttrId);
+ static Uint32 BranchCol_2(Uint32 AttrId, Uint32 Len);
+
+ static Uint32 getBinaryCondition(Uint32 op1);
+ static Uint32 getArrayLengthDiff(Uint32 op1);
+ static Uint32 isVarchar(Uint32 op1);
+ static Uint32 isNopad(Uint32 op1);
+ static Uint32 getBranchCol_AttrId(Uint32 op2);
+ static Uint32 getBranchCol_Len(Uint32 op2);
+
+ /**
+ * Macros for decoding code
+ */
+ static Uint32 getOpCode(Uint32 op);
+ static Uint32 getReg1(Uint32 op);
+ static Uint32 getReg2(Uint32 op);
+ static Uint32 getReg3(Uint32 op);
+};
+
+inline
+Uint32
+Interpreter::Read(Uint32 AttrId, Uint32 Register){
+ return (AttrId << 16) + (Register << 6) + READ_ATTR_INTO_REG;
+}
+
+inline
+Uint32
+Interpreter::Write(Uint32 AttrId, Uint32 Register){
+ return (AttrId << 16) + (Register << 6) + WRITE_ATTR_FROM_REG;
+}
+
+inline
+Uint32
+Interpreter::LoadConst16(Uint32 Register, Uint32 Value){
+ return (Value << 16) + (Register << 6) + LOAD_CONST16;
+}
+
+inline
+Uint32
+Interpreter::LoadConst32(Uint32 Register){
+ return (Register << 6) + LOAD_CONST32;
+}
+
+inline
+Uint32
+Interpreter::LoadConst64(Uint32 Register){
+ return (Register << 6) + LOAD_CONST64;
+}
+
+inline
+Uint32
+Interpreter::Add(Uint32 Dcoleg, Uint32 SrcReg1, Uint32 SrcReg2){
+ return (SrcReg1 << 6) + (SrcReg2 << 9) + (Dcoleg << 16) + ADD_REG_REG;
+}
+
+inline
+Uint32
+Interpreter::Sub(Uint32 Dcoleg, Uint32 SrcReg1, Uint32 SrcReg2){
+ return (SrcReg1 << 6) + (SrcReg2 << 9) + (Dcoleg << 16) + SUB_REG_REG;
+}
+
+inline
+Uint32
+Interpreter::Branch(Uint32 Inst, Uint32 R1, Uint32 R2){
+ return (R1 << 9) + (R2 << 6) + Inst;
+}
+
+inline
+Uint32
+Interpreter::BranchCol(BinaryCondition cond,
+ Uint32 arrayLengthDiff,
+ Uint32 varchar, bool nopad){
+ //ndbout_c("BranchCol: cond=%d diff=%u varchar=%u nopad=%d",
+ //cond, arrayLengthDiff, varchar, nopad);
+ return
+ BRANCH_ATTR_OP_ARG +
+ (arrayLengthDiff << 9) +
+ (varchar << 11) +
+ (cond << 12) +
+ (nopad << 15);
+}
+
+inline
+Uint32
+Interpreter::BranchCol_2(Uint32 AttrId, Uint32 Len){
+ return (AttrId << 16) + Len;
+}
+
+inline
+Uint32
+Interpreter::BranchCol_2(Uint32 AttrId){
+ return (AttrId << 16);
+}
+
+inline
+Uint32
+Interpreter::getBinaryCondition(Uint32 op){
+ return (op >> 12) & 0x7;
+}
+
+inline
+Uint32
+Interpreter::getArrayLengthDiff(Uint32 op){
+ return (op >> 9) & 0x3;
+}
+
+inline
+Uint32
+Interpreter::isVarchar(Uint32 op){
+ return (op >> 11) & 1;
+}
+
+inline
+Uint32
+Interpreter::isNopad(Uint32 op){
+ return (op >> 15) & 1;
+}
+
+inline
+Uint32
+Interpreter::getBranchCol_AttrId(Uint32 op){
+ return (op >> 16) & 0xFFFF;
+}
+
+inline
+Uint32
+Interpreter::getBranchCol_Len(Uint32 op){
+ return op & 0xFFFF;
+}
+
+inline
+Uint32
+Interpreter::ExitOK(){
+ return EXIT_OK;
+}
+
+inline
+Uint32
+Interpreter::getOpCode(Uint32 op){
+ return op & 0x3f;
+}
+
+inline
+Uint32
+Interpreter::getReg1(Uint32 op){
+ return (op >> 6) & 0x7;
+}
+
+inline
+Uint32
+Interpreter::getReg2(Uint32 op){
+ return (op >> 9) & 0x7;
+}
+
+inline
+Uint32
+Interpreter::getReg3(Uint32 op){
+ return (op >> 16) & 0x7;
+}
+
+#endif
diff --git a/ndb/include/kernel/LogLevel.hpp b/ndb/include/kernel/LogLevel.hpp
new file mode 100644
index 00000000000..0902f3e488b
--- /dev/null
+++ b/ndb/include/kernel/LogLevel.hpp
@@ -0,0 +1,173 @@
+/* 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 _LOG_LEVEL_HPP
+#define _LOG_LEVEL_HPP
+
+#include <ndb_types.h>
+#include <assert.h>
+
+/**
+ *
+ */
+class LogLevel {
+ friend class Config;
+public:
+ /**
+ * Constructor
+ */
+ LogLevel();
+
+ /**
+ * Howto add a new event category:
+ * 1. Add the new event category to EventCategory below
+ * 2. Update #define _LOGLEVEL_CATEGORIES (found below) with the number of
+ * items in EventCategory
+ * 3. Update LogLevelCategoryName in LogLevel.cpp
+ * 4. Add the event in EventLogger
+ */
+
+
+ /**
+ * Copy operator
+ */
+ LogLevel & operator= (const LogLevel &);
+
+ enum EventCategory {
+ /**
+ * Events during all kind of startups
+ */
+ llStartUp = 0,
+
+ /**
+ * Events during shutdown
+ */
+ llShutdown = 1,
+
+ /**
+ * Transaction statistics
+ * Job level
+ * TCP/IP speed
+ */
+ llStatistic = 2,
+
+ /**
+ * Checkpoints
+ */
+ llCheckpoint = 3,
+
+ /**
+ * Events during node restart
+ */
+ llNodeRestart = 4,
+
+ /**
+ * Events related to connection / communication
+ */
+ llConnection = 5,
+
+ /**
+ * Assorted event w.r.t unexpected happenings
+ */
+ llError = 6,
+
+ /**
+ * Assorted event w.r.t information
+ */
+ llInfo = 7,
+
+ /**
+ * Events related to global replication
+ */
+ llGrep = 8
+ };
+
+ struct LogLevelCategoryName {
+ const char* name;
+ };
+
+ /**
+ * Log/event level category names. Remember to update the names whenever
+ * a new category is added.
+ */
+ static const LogLevelCategoryName LOGLEVEL_CATEGORY_NAME[];
+
+ /**
+ * No of categories
+ */
+#define _LOGLEVEL_CATEGORIES 9
+ static const Uint32 LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES;
+
+ void clear();
+
+ /**
+ * Note level is valid as 0-15
+ */
+ void setLogLevel(EventCategory ec, Uint32 level = 7);
+
+ /**
+ * Get the loglevel (0-15) for a category
+ */
+ Uint32 getLogLevel(EventCategory ec) const;
+
+private:
+ /**
+ * The actual data
+ */
+ Uint32 logLevelData[LOGLEVEL_CATEGORIES];
+
+ LogLevel(const LogLevel &);
+};
+
+inline
+LogLevel::LogLevel(){
+ clear();
+}
+
+inline
+LogLevel &
+LogLevel::operator= (const LogLevel & org){
+ for(Uint32 i = 0; i<LOGLEVEL_CATEGORIES; i++){
+ logLevelData[i] = org.logLevelData[i];
+ }
+ return * this;
+}
+
+inline
+void
+LogLevel::clear(){
+ for(Uint32 i = 0; i<LOGLEVEL_CATEGORIES; i++){
+ logLevelData[i] = 0;
+ }
+}
+
+inline
+void
+LogLevel::setLogLevel(EventCategory ec, Uint32 level){
+ assert(ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES);
+ logLevelData[ec] = level;
+}
+
+inline
+Uint32
+LogLevel::getLogLevel(EventCategory ec) const{
+ assert(ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES);
+
+ return logLevelData[ec];
+}
+
+
+#endif
diff --git a/ndb/include/kernel/NodeBitmask.hpp b/ndb/include/kernel/NodeBitmask.hpp
new file mode 100644
index 00000000000..423c01cd841
--- /dev/null
+++ b/ndb/include/kernel/NodeBitmask.hpp
@@ -0,0 +1,89 @@
+/* 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 NODE_BITMASK_HPP
+#define NODE_BITMASK_HPP
+
+#include <ndb_limits.h>
+#include <kernel_types.h>
+#include <Bitmask.hpp>
+
+/**
+ * No of 32 bits words needed to store a node bitmask
+ * containing all the nodes in the system
+ * Both NDB nodes and API, MGM... nodes
+ *
+ * Note that this is used in a lot of signals
+ */
+#define _NODE_BITMASK_SIZE 2
+
+/**
+ * No of 32 bits words needed to store a node bitmask
+ * containing all the ndb nodes in the system
+ *
+ * Note that this is used in a lot of signals
+ */
+#define _NDB_NODE_BITMASK_SIZE 2
+
+/**
+ * No of 32 bits word needed to store B bits for N nodes
+ */
+#define NODE_ARRAY_SIZE(N, B) (((N)*(B)+31) >> 5)
+
+typedef Bitmask<(unsigned int)_NODE_BITMASK_SIZE> NodeBitmask;
+
+typedef Bitmask<(unsigned int)_NDB_NODE_BITMASK_SIZE> NdbNodeBitmask;
+
+#define __NBM_SZ ((MAX_NODES >> 5) + ((MAX_NODES & 31) != 0))
+#define __NNBM_SZ ((MAX_NDB_NODES >> 5) + ((MAX_NDB_NODES & 31) != 0))
+
+#if ( __NBM_SZ > _NODE_BITMASK_SIZE)
+#error "MAX_NODES can not fit into NODE_BITMASK_SIZE"
+#endif
+
+#if ( __NNBM_SZ > _NDB_NODE_BITMASK_SIZE)
+#error "MAX_NDB_NODES can not fit into NDB_NODE_BITMASK_SIZE"
+#endif
+
+/**
+ * General B Bits operations
+ *
+ * Get(x, A[], B)
+ * w = x >> S1
+ * s = (x & S2) << S3
+ * return (A[w] >> s) & S4
+ *
+ * Set(x, A[], v, B)
+ * w = x >> S1
+ * s = (x & S2) << S3
+ * m = ~(S4 << s)
+ * t = A[w] & m;
+ * A[w] = t | ((v & S4) << s)
+ *
+ * B(Bits) S1 S2 S3 S4
+ * 1 5 31 0 1
+ * 2 4 15 1 3
+ * 4 3 7 2 15
+ * 8 2 3 3 255
+ * 16 1 1 4 65535
+ *
+ * S1 = 5 - 2log(B)
+ * S2 = 2^S1 - 1
+ * S3 = 2log(B)
+ * S4 = 2^B - 1
+ */
+
+#endif
diff --git a/ndb/include/kernel/NodeInfo.hpp b/ndb/include/kernel/NodeInfo.hpp
new file mode 100644
index 00000000000..86aca7d6883
--- /dev/null
+++ b/ndb/include/kernel/NodeInfo.hpp
@@ -0,0 +1,94 @@
+/* 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 NODE_INFO_HPP
+#define NODE_INFO_HPP
+
+#include <NdbOut.hpp>
+
+class NodeInfo {
+public:
+ NodeInfo();
+
+ /**
+ * NodeType
+ */
+ enum NodeType {
+ DB = 0, ///< Database node
+ API = 1, ///< NDB API node
+ MGM = 2, ///< Management node (incl. NDB API)
+ REP = 3, ///< Replication node (incl. NDB API)
+ INVALID = 255 ///< Invalid type
+ };
+ NodeType getType() const;
+
+ Uint32 m_version; ///< Node version
+ Uint32 m_signalVersion; ///< Signal version
+ Uint32 m_type; ///< Node type
+ Uint32 m_connectCount; ///< No of times connected
+ bool m_connected; ///< Node is connected
+
+ friend NdbOut & operator<<(NdbOut&, const NodeInfo&);
+};
+
+
+inline
+NodeInfo::NodeInfo(){
+ m_version = 0;
+ m_signalVersion = 0;
+ m_type = INVALID;
+ m_connectCount = 0;
+}
+
+inline
+NodeInfo::NodeType
+NodeInfo::getType() const {
+ return (NodeType)m_type;
+}
+
+inline
+NdbOut &
+operator<<(NdbOut& ndbout, const NodeInfo & info){
+ ndbout << "[NodeInfo: ";
+ switch(info.m_type){
+ case NodeInfo::DB:
+ ndbout << "DB";
+ break;
+ case NodeInfo::API:
+ ndbout << "API";
+ break;
+ case NodeInfo::MGM:
+ ndbout << "MGM";
+ break;
+ case NodeInfo::REP:
+ ndbout << "REP";
+ break;
+ case NodeInfo::INVALID:
+ ndbout << "INVALID";
+ break;
+ default:
+ ndbout << "<Unknown: " << info.m_type << ">";
+ break;
+ }
+
+ ndbout << " version: " << info.m_version
+ << " sig. version; " << info.m_signalVersion
+ << " connect count: " << info.m_connectCount
+ << "]";
+ return ndbout;
+}
+
+#endif
diff --git a/ndb/include/kernel/NodeState.hpp b/ndb/include/kernel/NodeState.hpp
new file mode 100644
index 00000000000..1bc7806876d
--- /dev/null
+++ b/ndb/include/kernel/NodeState.hpp
@@ -0,0 +1,308 @@
+/* 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 NODE_STATE_HPP
+#define NODE_STATE_HPP
+
+#include <NdbOut.hpp>
+
+class NodeState {
+public:
+ enum StartLevel {
+ /**
+ * SL_NOTHING
+ * Nothing is started
+ */
+ SL_NOTHING = 0,
+
+ /**
+ * SL_CMVMI
+ * CMVMI is started
+ * Listening to management server
+ * Qmgr knows nothing...
+ */
+ SL_CMVMI = 1,
+
+ /**
+ * SL_STARTING
+ * All blocks are starting
+ * Initial or restart
+ * During this phase is <b>startPhase</b> valid
+ */
+ SL_STARTING = 2,
+
+ /**
+ * The database is started open for connections
+ */
+ SL_STARTED = 3,
+
+ SL_SINGLEUSER = 4,
+
+ /**
+ * SL_STOPPING_1 - Inform API
+ * API is informed not to start transactions on node
+ * The database is about to close
+ *
+ * New TcSeize(s) are refused (TcSeizeRef)
+ */
+ SL_STOPPING_1 = 5,
+
+ /**
+ * SL_STOPPING_2 - Close TC
+ * New transactions(TC) are refused
+ */
+ SL_STOPPING_2 = 6,
+
+
+
+
+ /**
+ * SL_STOPPING_3 - Wait for reads in LQH
+ * No transactions are running in TC
+ * New scans(s) and read(s) are refused in LQH
+ * NS: The node is not Primary for any fragment
+ * NS: No node is allow to start
+ */
+ SL_STOPPING_3 = 7,
+
+ /**
+ * SL_STOPPING_4 - Close LQH
+ * Node is out of DIGETNODES
+ * Insert/Update/Delete can still be running in LQH
+ * GCP is refused
+ * Node is not startable w.o Node Recovery
+ */
+ SL_STOPPING_4 = 8
+ };
+
+ enum StartType {
+ ST_INITIAL_START = 0,
+ ST_SYSTEM_RESTART = 1,
+ ST_NODE_RESTART = 2,
+ ST_INITIAL_NODE_RESTART = 3,
+ ST_ILLEGAL_TYPE = 4
+ };
+
+ /**
+ * Length in 32-bit words
+ */
+ static const Uint32 DataLength = 8;
+
+ /**
+ * Constructor(s)
+ */
+ NodeState();
+ NodeState(StartLevel);
+ NodeState(StartLevel, bool systemShutdown);
+ NodeState(StartLevel, Uint32 startPhase, StartType);
+
+ /**
+ * Current start level
+ */
+ Uint32 startLevel;
+
+ /**
+ * Node group
+ */
+ Uint32 nodeGroup; // valid when startLevel == SL_STARTING
+
+ /**
+ * Dynamic id
+ */
+ union {
+ Uint32 dynamicId; // valid when startLevel == SL_STARTING to API
+ Uint32 masterNodeId; // When from cntr
+ };
+
+ /**
+ *
+ */
+ union {
+ struct {
+ Uint32 startPhase; // valid when startLevel == SL_STARTING
+ Uint32 restartType; // valid when startLevel == SL_STARTING
+ } starting;
+ struct {
+ Uint32 systemShutdown; // valid when startLevel == SL_STOPPING_{X}
+ Uint32 timeout;
+ Uint32 alarmTime;
+ } stopping;
+
+
+ };
+ Uint32 singleUserMode;
+ Uint32 singleUserApi; //the single user node
+
+ void setDynamicId(Uint32 dynamic);
+ void setNodeGroup(Uint32 group);
+ void setSingleUser(Uint32 s);
+ void setSingleUserApi(Uint32 n);
+
+
+ /**
+ * Is a node restart in progress (ordinary or initial)
+ */
+ bool getNodeRestartInProgress() const;
+
+ /**
+ * Is a system restart ongoing
+ */
+ bool getSystemRestartInProgress() const;
+
+ /**
+ * Is in single user mode?
+ */
+ bool getSingleUserMode() const;
+
+ /**
+ * Is in single user mode
+ */
+ Uint32 getSingleUserApi() const;
+
+ friend NdbOut & operator<<(NdbOut&, const NodeState&);
+};
+
+inline
+NodeState::NodeState(){
+ startLevel = SL_CMVMI;
+ nodeGroup = 0xFFFFFFFF;
+ dynamicId = 0xFFFFFFFF;
+ singleUserMode = 0;
+ singleUserApi = 0xFFFFFFFF;
+}
+
+inline
+NodeState::NodeState(StartLevel sl){
+ NodeState::NodeState();
+ startLevel = sl;
+ singleUserMode = 0;
+ singleUserApi = 0xFFFFFFFF;
+}
+
+inline
+NodeState::NodeState(StartLevel sl, Uint32 sp, StartType typeOfStart){
+ NodeState::NodeState();
+ startLevel = sl;
+ starting.startPhase = sp;
+ starting.restartType = typeOfStart;
+ singleUserMode = 0;
+ singleUserApi = 0xFFFFFFFF;
+}
+
+inline
+NodeState::NodeState(StartLevel sl, bool sys){
+ NodeState::NodeState();
+ startLevel = sl;
+ stopping.systemShutdown = sys;
+ singleUserMode = 0;
+ singleUserApi = 0xFFFFFFFF;
+}
+
+inline
+void NodeState::setDynamicId(Uint32 dynamic){
+ dynamicId = dynamic;
+}
+
+inline
+void NodeState::setNodeGroup(Uint32 group){
+ nodeGroup = group;
+}
+
+inline
+void NodeState::setSingleUser(Uint32 s) {
+ singleUserMode = s;
+}
+
+inline
+void NodeState::setSingleUserApi(Uint32 n) {
+ singleUserApi = n;
+}
+inline
+bool NodeState::getNodeRestartInProgress() const {
+ return startLevel == SL_STARTING &&
+ (starting.restartType == ST_NODE_RESTART ||
+ starting.restartType == ST_INITIAL_NODE_RESTART);
+}
+
+inline
+bool NodeState::getSingleUserMode() const {
+ return singleUserMode;
+}
+
+inline
+Uint32 NodeState::getSingleUserApi() const {
+ return singleUserApi;
+}
+
+inline
+bool NodeState::getSystemRestartInProgress() const {
+ return startLevel == SL_STARTING && starting.restartType == ST_SYSTEM_RESTART;
+}
+
+inline
+NdbOut &
+operator<<(NdbOut& ndbout, const NodeState & state){
+ ndbout << "[NodeState: startLevel: ";
+ switch(state.startLevel){
+ case NodeState::SL_NOTHING:
+ ndbout << "<NOTHING> ]";
+ break;
+ case NodeState::SL_CMVMI:
+ ndbout << "<CMVMI> ]";
+ break;
+ case NodeState::SL_STARTING:
+ ndbout << "<STARTING type: ";
+ switch(state.starting.restartType){
+ case NodeState::ST_INITIAL_START:
+ ndbout << " INITIAL START";
+ break;
+ case NodeState::ST_SYSTEM_RESTART:
+ ndbout << " SYSTEM RESTART ";
+ break;
+ case NodeState::ST_NODE_RESTART:
+ ndbout << " NODE RESTART ";
+ break;
+ case NodeState::ST_INITIAL_NODE_RESTART:
+ ndbout << " INITIAL NODE RESTART ";
+ break;
+ case NodeState::ST_ILLEGAL_TYPE:
+ default:
+ ndbout << " UNKNOWN " << state.starting.restartType;
+ }
+ ndbout << " phase: " << state.starting.startPhase << "> ]";
+ break;
+ case NodeState::SL_STARTED:
+ ndbout << "<STARTED> ]";
+ break;
+ case NodeState::SL_STOPPING_1:
+ ndbout << "<STOPPING 1 sys: " << state.stopping.systemShutdown << "> ]";
+ break;
+ case NodeState::SL_STOPPING_2:
+ ndbout << "<STOPPING 2 sys: " << state.stopping.systemShutdown << "> ]";
+ break;
+ case NodeState::SL_STOPPING_3:
+ ndbout << "<STOPPING 3 sys: " << state.stopping.systemShutdown << "> ]";
+ break;
+ case NodeState::SL_STOPPING_4:
+ ndbout << "<STOPPING 4 sys: " << state.stopping.systemShutdown << "> ]";
+ break;
+ default:
+ ndbout << "<UNKNOWN " << state.startLevel << "> ]";
+ }
+ return ndbout;
+}
+
+#endif
diff --git a/ndb/include/kernel/RefConvert.hpp b/ndb/include/kernel/RefConvert.hpp
new file mode 100644
index 00000000000..7604b1cf224
--- /dev/null
+++ b/ndb/include/kernel/RefConvert.hpp
@@ -0,0 +1,47 @@
+/* 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 REFCONVERT_H
+#define REFCONVERT_H
+
+#include "kernel_types.h"
+
+/**
+ * Convert BlockReference to BlockNumber
+ */
+inline
+BlockNumber refToBlock(BlockReference ref){
+ return (BlockNumber)(ref >> 16);
+}
+
+/**
+ * Convert BlockReference to NodeId
+ */
+inline
+NodeId refToNode(BlockReference ref){
+ return (NodeId)(ref & 0xFFFF);
+}
+
+/**
+ * Convert NodeId and BlockNumber to BlockReference
+ */
+inline
+BlockReference numberToRef(BlockNumber bnr, NodeId proc){
+ return (((Uint32)bnr) << 16) + proc;
+}
+
+#endif
+
diff --git a/ndb/include/kernel/kernel_types.h b/ndb/include/kernel/kernel_types.h
new file mode 100644
index 00000000000..b176d20798c
--- /dev/null
+++ b/ndb/include/kernel/kernel_types.h
@@ -0,0 +1,43 @@
+/* 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 NDB_KERNEL_TYPES_H
+#define NDB_KERNEL_TYPES_H
+
+#include <ndb_types.h>
+
+typedef Uint16 NodeId;
+typedef Uint16 BlockNumber;
+typedef Uint32 BlockReference;
+typedef Uint16 GlobalSignalNumber;
+
+enum Operation_t {
+ ZREAD = 0
+ ,ZUPDATE = 1
+ ,ZINSERT = 2
+ ,ZDELETE = 3
+ ,ZWRITE = 4
+ ,ZREAD_EX = 5
+#if 0
+ ,ZREAD_CONSISTENT = 6
+#endif
+};
+
+#endif
+
+
+
+
diff --git a/ndb/include/kernel/ndb_limits.h b/ndb/include/kernel/ndb_limits.h
new file mode 100644
index 00000000000..65f729af1f2
--- /dev/null
+++ b/ndb/include/kernel/ndb_limits.h
@@ -0,0 +1,94 @@
+/* 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 NDB_LIMITS_H
+#define NDB_LIMITS_H
+
+#define RNIL 0xffffff00
+
+/**
+ * Note that actual value = MAX_NODES - 1,
+ * since NodeId = 0 can not be used
+ */
+#define MAX_NDB_NODES 49
+#define MAX_NODES 64
+
+/**
+ * MAX_API_NODES = MAX_NODES - No of NDB Nodes in use
+ */
+
+/**
+ * The maximum number of replicas in the system
+ */
+#define MAX_REPLICAS 4
+
+/**
+ * The maximum number of local checkpoints stored at a time
+ */
+#define MAX_LCP_STORED 3
+
+/**
+ * The maximum number of log execution rounds at system restart
+ */
+#define MAX_LOG_EXEC 4
+
+/**
+ * The maximum number of tuples per page
+ **/
+#define MAX_TUPLES_PER_PAGE 8191
+#define MAX_TUPLES_BITS 13 /* 13 bits = 8191 tuples per page */
+//#define MAX_NO_OF_TUPLEKEY 16 Not currently used
+#define MAX_TABLES 1600
+#define MAX_TAB_NAME_SIZE 128
+#define MAX_ATTR_NAME_SIZE 32
+#define MAX_ATTR_DEFAULT_VALUE_SIZE 128
+#define MAX_ATTRIBUTES_IN_TABLE 128
+#define MAX_ATTRIBUTES_IN_INDEX 32
+#define MAX_TUPLE_SIZE_IN_WORDS 2013
+#define MAX_FIXED_KEY_LENGTH_IN_WORDS 8
+#define MAX_KEY_SIZE_IN_WORDS 1023
+#define MAX_FRM_DATA_SIZE 6000
+
+#define MIN_ATTRBUF ((MAX_ATTRIBUTES_IN_TABLE/24) + 1)
+/*
+ * Number of Records to fetch per SCAN_NEXTREQ in a scan in LQH. The
+ * API can order a multiple of this number of records at a time since
+ * fragments can be scanned in parallel.
+ */
+#define MAX_PARALLEL_OP_PER_SCAN 16
+/*
+ * Maximum number of Parallel Scan queries on one hash index fragment
+ */
+#define MAX_PARALLEL_SCANS_PER_FRAG 12
+/*
+ * Maximum parallel ordered index scans per primary table fragment.
+ * Implementation limit is (256 minus 12).
+ */
+#define MAX_PARALLEL_INDEX_SCANS_PER_FRAG 32
+
+/**
+ * Computed defines
+ */
+#define MAXNROFATTRIBUTESINWORDS (MAX_ATTRIBUTES_IN_TABLE / 32)
+
+/*
+ * Ordered index constants. Make configurable per index later.
+ */
+#define MAX_TTREE_NODE_SIZE 64 // total words in node
+#define MAX_TTREE_PREF_SIZE 4 // words in min/max prefix each
+#define MAX_TTREE_NODE_SLACK 3 // diff between max and min occupancy
+
+#endif
diff --git a/ndb/include/kernel/signaldata/AbortAll.hpp b/ndb/include/kernel/signaldata/AbortAll.hpp
new file mode 100644
index 00000000000..a3d7f483953
--- /dev/null
+++ b/ndb/include/kernel/signaldata/AbortAll.hpp
@@ -0,0 +1,88 @@
+/* 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 ABORT_ALL_REQ_HPP
+#define ABORT_ALL_REQ_HPP
+
+#include "SignalData.hpp"
+
+class AbortAllReq {
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * Sender
+ */
+ friend class Ndbcntr;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+public:
+
+ Uint32 senderRef;
+ Uint32 senderData;
+};
+
+class AbortAllConf {
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbcntr;
+
+ /**
+ * Sender
+ */
+ friend class Dbtc;
+
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+public:
+ Uint32 senderData;
+};
+
+class AbortAllRef {
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbcntr;
+
+ /**
+ * Sender
+ */
+ friend class Dbtc;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ enum ErrorCode {
+ InvalidState = 1,
+ AbortAlreadyInProgress = 2,
+ FunctionNotImplemented = 3
+ };
+public:
+ Uint32 senderData;
+ Uint32 errorCode;
+};
+
+#endif
+
diff --git a/ndb/include/kernel/signaldata/AccFrag.hpp b/ndb/include/kernel/signaldata/AccFrag.hpp
new file mode 100644
index 00000000000..e28ab0d1ee6
--- /dev/null
+++ b/ndb/include/kernel/signaldata/AccFrag.hpp
@@ -0,0 +1,89 @@
+/* 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 ACC_FRAG_HPP
+#define ACC_FRAG_HPP
+
+#include "SignalData.hpp"
+
+class AccFragReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbacc;
+public:
+ STATIC_CONST( SignalLength = 12 );
+
+private:
+ Uint32 userPtr;
+ Uint32 userRef;
+ Uint32 tableId;
+ Uint32 reqInfo;
+ Uint32 fragId;
+ Uint32 localKeyLen;
+ Uint32 maxLoadFactor;
+ Uint32 minLoadFactor;
+ Uint32 kValue;
+ Uint32 lhFragBits;
+ Uint32 lhDirBits;
+ Uint32 keyLength;
+};
+
+class AccFragConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbacc;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+public:
+ STATIC_CONST( SignalLength = 7 );
+
+private:
+ Uint32 userPtr;
+ Uint32 rootFragPtr;
+ Uint32 fragId[2];
+ Uint32 fragPtr[2];
+ Uint32 rootHashCheck;
+};
+
+class AccFragRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dbacc;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 userPtr;
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/AccLock.hpp b/ndb/include/kernel/signaldata/AccLock.hpp
new file mode 100644
index 00000000000..1a41b4c9334
--- /dev/null
+++ b/ndb/include/kernel/signaldata/AccLock.hpp
@@ -0,0 +1,65 @@
+/* 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 ACC_LOCK_HPP
+#define ACC_LOCK_HPP
+
+#include "SignalData.hpp"
+
+/*
+ * Lock or unlock tuple. If lock request is queued, the reply is later
+ * via ACCKEYCONF.
+ */
+class AccLockReq {
+ friend class Dbtux;
+ friend class Dbacc;
+ friend bool printACC_LOCKREQ(FILE *, const Uint32*, Uint32, Uint16);
+public:
+ enum RequestType { // first byte
+ LockShared = 1,
+ LockExclusive = 2,
+ Unlock = 3,
+ Abort = 4,
+ AbortWithConf = 5
+ };
+ enum RequestFlag { // second byte
+ };
+ enum ReturnCode {
+ Success = 0,
+ IsBlocked = 1, // was put in lock queue
+ WouldBlock = 2, // if we add non-blocking option
+ Refused = 3,
+ NoFreeOp = 4
+ };
+ STATIC_CONST( LockSignalLength = 12 );
+ STATIC_CONST( UndoSignalLength = 3 );
+private:
+ Uint32 returnCode;
+ Uint32 requestInfo;
+ Uint32 accOpPtr;
+ // rest only if lock request
+ Uint32 userPtr;
+ Uint32 userRef;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 fragPtrI;
+ Uint32 hashValue;
+ Uint32 tupAddr;
+ Uint32 transId1;
+ Uint32 transId2;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/AccScan.hpp b/ndb/include/kernel/signaldata/AccScan.hpp
new file mode 100644
index 00000000000..eab1c3262fc
--- /dev/null
+++ b/ndb/include/kernel/signaldata/AccScan.hpp
@@ -0,0 +1,164 @@
+/* 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 ACC_SCAN_HPP
+#define ACC_SCAN_HPP
+
+#include "SignalData.hpp"
+
+/*
+ * Used by ACC and TUX scan.
+ */
+
+class AccScanReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbacc;
+ friend class Dbtux;
+public:
+ STATIC_CONST( SignalLength = 8 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 tableId;
+ Uint32 fragmentNo;
+ Uint32 requestInfo;
+ Uint32 transId1;
+ Uint32 transId2;
+ Uint32 savePointId;
+
+ /**
+ * Previously there where also a scan type
+ */
+ static Uint32 getLockMode(const Uint32 & requestInfo);
+ static Uint32 getKeyinfoFlag(const Uint32 & requestInfo);
+ static Uint32 getReadCommittedFlag(const Uint32 & requestInfo);
+
+ static void setLockMode(Uint32 & requestInfo, Uint32 lockMode);
+ static void setKeyinfoFlag(Uint32 & requestInfo, Uint32 keyinfo);
+ static void setReadCommittedFlag(Uint32 & requestInfo, Uint32 readCommitted);
+};
+
+/**
+ * Request Info
+ *
+ * l = Lock Mode - 1 Bit 2
+ * k = Keyinfo - 1 Bit 4
+ * h = Read Committed - 1 Bit 5
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * l kh
+ */
+#define AS_LOCK_MODE_SHIFT (2)
+#define AS_LOCK_MODE_MASK (1)
+
+#define AS_KEYINFO_SHIFT (4)
+#define AS_READ_COMMITTED_SHIFT (5)
+
+inline
+Uint32
+AccScanReq::getLockMode(const Uint32 & requestInfo){
+ return (requestInfo >> AS_LOCK_MODE_SHIFT) & AS_LOCK_MODE_MASK;
+}
+
+inline
+Uint32
+AccScanReq::getKeyinfoFlag(const Uint32 & requestInfo){
+ return (requestInfo >> AS_KEYINFO_SHIFT) & 1;
+}
+
+inline
+Uint32
+AccScanReq::getReadCommittedFlag(const Uint32 & requestInfo){
+ return (requestInfo >> AS_READ_COMMITTED_SHIFT) & 1;
+}
+
+inline
+void
+AccScanReq::setLockMode(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, AS_LOCK_MODE_MASK, "AccScanReq::setLockMode");
+ requestInfo |= (val << AS_LOCK_MODE_SHIFT);
+}
+
+inline
+void
+AccScanReq::setKeyinfoFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "AccScanReq::setKeyinfoFlag");
+ requestInfo |= (val << AS_KEYINFO_SHIFT);
+}
+
+inline
+void
+AccScanReq::setReadCommittedFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "AccScanReq::setReadCommittedFlag");
+ requestInfo |= (val << AS_READ_COMMITTED_SHIFT);
+}
+
+class AccScanConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbacc;
+ friend class Dbtux;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dblqh;
+
+ enum {
+ ZEMPTY_FRAGMENT = 0,
+ ZNOT_EMPTY_FRAGMENT = 1
+ };
+
+public:
+ STATIC_CONST( SignalLength = 8 );
+
+private:
+ Uint32 scanPtr;
+ Uint32 accPtr;
+ Uint32 unused1;
+ Uint32 unused2;
+ Uint32 unused3;
+ Uint32 unused4;
+ Uint32 unused5;
+ Uint32 flag;
+};
+
+class AccCheckScan {
+ friend class Dbacc;
+ friend class Dbtux;
+ friend class Dblqh;
+ enum {
+ ZCHECK_LCP_STOP = 0,
+ ZNOT_CHECK_LCP_STOP = 1
+ };
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+ Uint32 accPtr; // scanptr.i in ACC or TUX
+ Uint32 checkLcpStop; // from enum
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/AccSizeAltReq.hpp b/ndb/include/kernel/signaldata/AccSizeAltReq.hpp
new file mode 100644
index 00000000000..ac348444826
--- /dev/null
+++ b/ndb/include/kernel/signaldata/AccSizeAltReq.hpp
@@ -0,0 +1,53 @@
+/* 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 ACC_SIZE_ALT_REQ_H
+#define ACC_SIZE_ALT_REQ_H
+
+#include "SignalData.hpp"
+
+class AccSizeAltReq {
+ /**
+ * Sender(s)
+ */
+ friend class ClusterConfiguration;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbacc;
+private:
+ /**
+ * Indexes in theData
+ */
+ STATIC_CONST( IND_BLOCK_REF = 0 );
+ STATIC_CONST( IND_DIR_RANGE = 1 );
+ STATIC_CONST( IND_DIR_ARRAY = 2 );
+ STATIC_CONST( IND_FRAGMENT = 3 );
+ STATIC_CONST( IND_OP_RECS = 4 );
+ STATIC_CONST( IND_OVERFLOW_RECS = 5 );
+ STATIC_CONST( IND_PAGE8 = 6 );
+ STATIC_CONST( IND_ROOT_FRAG = 7 );
+ STATIC_CONST( IND_TABLE = 8 );
+ STATIC_CONST( IND_SCAN = 9 );
+
+ /**
+ * Use the index definitions to use the signal data
+ */
+ UintR theData[10];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/AlterIndx.hpp b/ndb/include/kernel/signaldata/AlterIndx.hpp
new file mode 100644
index 00000000000..1f464ded010
--- /dev/null
+++ b/ndb/include/kernel/signaldata/AlterIndx.hpp
@@ -0,0 +1,268 @@
+/* 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 ALTER_INDX_HPP
+#define ALTER_INDX_HPP
+
+#include "SignalData.hpp"
+#include <Bitmask.hpp>
+#include <trigger_definitions.h>
+
+/**
+ * AlterIndxReq.
+ */
+class AlterIndxReq {
+ friend bool printALTER_INDX_REQ(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum RequestType {
+ RT_UNDEFINED = 0,
+ RT_USER = 1,
+ RT_CREATE_INDEX = 2,
+ RT_DROP_INDEX = 3,
+ RT_SYSTEMRESTART = 4,
+ RT_NODERESTART = 5,
+ RT_DICT_PREPARE = 1 << 4,
+ RT_DICT_TC = 5 << 4,
+ RT_DICT_COMMIT = 0xC << 4,
+ RT_DICT_ABORT = 0xF << 4,
+ RT_TC = 5 << 8,
+ RT_TUX = 8 << 8
+ };
+ STATIC_CONST( SignalLength = 7 );
+
+private:
+ Uint32 m_userRef;
+ Uint32 m_connectionPtr;
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_indexId; // only set by DICT
+ Uint32 m_indexVersion;
+ Uint32 m_online; // new state 0-offline 1-online
+ // extra
+ Uint32 m_opKey;
+
+public:
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ AlterIndxReq::RequestType getRequestType() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 0, 16);
+ return (AlterIndxReq::RequestType)val;
+ }
+ void setRequestType(AlterIndxReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getRequestFlag() const {
+ return BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ };
+ void addRequestFlag(Uint32 val) {
+ val |= BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ BitmaskImpl::setField(1, &m_requestInfo, 16, 16, val);
+ };
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ Uint32 getIndexId() const {
+ return m_indexId;
+ }
+ void setIndexId(Uint32 val) {
+ m_indexId = val;
+ }
+ Uint32 getIndexVersion() const {
+ return m_indexVersion;
+ }
+ void setIndexVersion(Uint32 val) {
+ m_indexVersion = val;
+ }
+ Uint32 getOnline() const {
+ return m_online;
+ }
+ void setOnline(Uint32 val) {
+ m_online = val;
+ }
+ Uint32 getOpKey() const {
+ return m_opKey;
+ }
+ void setOpKey(Uint32 val) {
+ m_opKey = val;
+ }
+};
+
+/**
+ * AlterIndxConf.
+ */
+class AlterIndxConf {
+ friend bool printALTER_INDX_CONF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( InternalLength = 3 );
+ STATIC_CONST( SignalLength = 6 );
+
+private:
+ Uint32 m_userRef;
+ Uint32 m_connectionPtr;
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_indexId;
+ Uint32 m_indexVersion;
+
+public:
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ AlterIndxReq::RequestType getRequestType() const {
+ return (AlterIndxReq::RequestType)m_requestInfo;
+ }
+ void setRequestType(AlterIndxReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ Uint32 getIndexId() const {
+ return m_indexId;
+ }
+ void setIndexId(Uint32 val) {
+ m_indexId = val;
+ }
+ Uint32 getIndexVersion() const {
+ return m_indexVersion;
+ }
+ void setIndexVersion(Uint32 val) {
+ m_indexVersion = val;
+ }
+};
+
+/**
+ * AlterIndxRef.
+ */
+class AlterIndxRef {
+ friend bool printALTER_INDX_REF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum ErrorCode {
+ NoError = 0,
+ Busy = 701,
+ IndexNotFound = 4243,
+ IndexExists = 4244,
+ BadRequestType = 4247,
+ NotAnIndex = 4254,
+ BadState = 4347,
+ Inconsistency = 4348
+ };
+ STATIC_CONST( SignalLength = AlterIndxConf::SignalLength + 3 );
+
+private:
+ AlterIndxConf m_conf;
+ //Uint32 m_userRef;
+ //Uint32 m_connectionPtr;
+ //Uint32 m_requestInfo;
+ //Uint32 m_tableId;
+ //Uint32 m_indexId;
+ //Uint32 m_indexVersion;
+ Uint32 m_errorCode;
+ Uint32 m_errorLine;
+ Uint32 m_errorNode;
+
+public:
+ AlterIndxConf* getConf() {
+ return &m_conf;
+ }
+ const AlterIndxConf* getConf() const {
+ return &m_conf;
+ }
+ Uint32 getUserRef() const {
+ return m_conf.getUserRef();
+ }
+ void setUserRef(Uint32 val) {
+ m_conf.setUserRef(val);
+ }
+ Uint32 getConnectionPtr() const {
+ return m_conf.getConnectionPtr();
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_conf.setConnectionPtr(val);
+ }
+ AlterIndxReq::RequestType getRequestType() const {
+ return m_conf.getRequestType();
+ }
+ void setRequestType(AlterIndxReq::RequestType val) {
+ m_conf.setRequestType(val);
+ }
+ Uint32 getTableId() const {
+ return m_conf.getTableId();
+ }
+ void setTableId(Uint32 val) {
+ m_conf.setTableId(val);
+ }
+ Uint32 getIndexId() const {
+ return m_conf.getIndexId();
+ }
+ void setIndexId(Uint32 val) {
+ m_conf.setIndexId(val);
+ }
+ Uint32 getIndexVersion() const {
+ return m_conf.getIndexVersion();
+ }
+ void setIndexVersion(Uint32 val) {
+ m_conf.setIndexVersion(val);
+ }
+ AlterIndxRef::ErrorCode getErrorCode() const {
+ return (AlterIndxRef::ErrorCode)m_errorCode;
+ }
+ void setErrorCode(AlterIndxRef::ErrorCode val) {
+ m_errorCode = (Uint32)val;
+ }
+ Uint32 getErrorLine() const {
+ return m_errorLine;
+ }
+ void setErrorLine(Uint32 val) {
+ m_errorLine = val;
+ }
+ Uint32 getErrorNode() const {
+ return m_errorNode;
+ }
+ void setErrorNode(Uint32 val) {
+ m_errorNode = val;
+ }
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/AlterTab.hpp b/ndb/include/kernel/signaldata/AlterTab.hpp
new file mode 100644
index 00000000000..02d4eb95d2e
--- /dev/null
+++ b/ndb/include/kernel/signaldata/AlterTab.hpp
@@ -0,0 +1,125 @@
+/* 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 ALTER_TAB_HPP
+#define ALTER_TAB_HPP
+
+#include "SignalData.hpp"
+#include "GlobalSignalNumbers.h"
+
+/**
+ * AlterTab
+ *
+ * Implemenatation of AlterTable
+ */
+class AlterTabReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdict;
+ friend class Dbdih;
+ friend class Dbtc;
+ friend class Dblqh;
+
+ /**
+ * For printing
+ */
+ friend bool printALTER_TAB_REQ(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 9 );
+
+ enum RequestType {
+ AlterTablePrepare = 0, // Prepare alter table
+ AlterTableCommit = 1, // Commit alter table
+ AlterTableRevert = 2 // Prepare failed, revert instead
+ };
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 clientRef;
+ Uint32 clientData;
+
+ Uint32 changeMask;
+ Uint32 tableId;
+ Uint32 tableVersion;
+ Uint32 gci;
+ Uint32 requestType;
+
+ SECTION( DICT_TAB_INFO = 0 );
+};
+
+struct AlterTabRef {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdict;
+ friend class Dbdih;
+ friend class Dbtc;
+ friend class Dblqh;
+ friend class Dbtup;
+ friend class SafeCounter;
+
+ /**
+ * For printing
+ */
+ friend bool printALTER_TAB_REF(FILE *, const Uint32 *, Uint32, Uint16);
+
+ STATIC_CONST( SignalLength = 7 );
+ STATIC_CONST( GSN = GSN_ALTER_TAB_REF );
+
+ enum ErrorCode {
+ NF_FakeErrorREF = 255
+ };
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 errorCode;
+ Uint32 errorLine;
+ Uint32 errorKey;
+ Uint32 errorStatus;
+ Uint32 requestType;
+};
+
+class AlterTabConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdict;
+ friend class Dbdih;
+ friend class Dbtc;
+ friend class Dblqh;
+ friend class Dbtup;
+
+ /**
+ * For printing
+ */
+ friend bool printALTER_TAB_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 7 );
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 changeMask;
+ Uint32 tableId;
+ Uint32 tableVersion;
+ Uint32 gci;
+ Uint32 requestType;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/AlterTable.hpp b/ndb/include/kernel/signaldata/AlterTable.hpp
new file mode 100644
index 00000000000..30f8727551d
--- /dev/null
+++ b/ndb/include/kernel/signaldata/AlterTable.hpp
@@ -0,0 +1,179 @@
+/* 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 ALTER_TABLE_HPP
+#define ALTER_TABLE_HPP
+
+#include "SignalData.hpp"
+
+/**
+ * AlterTable
+ *
+ * This signal is sent by API to DICT/TRIX
+ * as a request to alter a secondary index
+ * and then from TRIX to TRIX(n) and TRIX to TC.
+ */
+class AlterTableReq {
+ /**
+ * Sender(s)
+ */
+ // API
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class NdbTableImpl;
+ friend class NdbDictInterface;
+ friend class Dbdict;
+
+ /**
+ * For printing
+ */
+ friend bool printALTER_TABLE_REQ(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 changeMask;
+ Uint32 tableId;
+ Uint32 tableVersion;
+
+ SECTION( DICT_TAB_INFO = 0 );
+
+/**
+ * ChangeMask
+ */
+
+/*
+ n = Changed name
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+ n-------------------------------
+*/
+#define NAME_SHIFT (0)
+
+ /**
+ * Getters and setters
+ */
+ static Uint8 getNameFlag(const UintR & changeMask);
+ static void setNameFlag(UintR & changeMask, Uint32 nameFlg);
+};
+
+inline
+Uint8
+AlterTableReq::getNameFlag(const UintR & changeMask){
+ return (Uint8)((changeMask >> NAME_SHIFT) & 1);
+}
+
+inline
+void
+AlterTableReq::setNameFlag(UintR & changeMask, Uint32 nameFlg){
+ changeMask |= (nameFlg << NAME_SHIFT);
+}
+
+
+class AlterTableRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+ friend class NdbDictInterface;
+
+ /**
+ * For printing
+ */
+ friend bool printALTER_TABLE_REF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 7 );
+
+ enum ErrorCode {
+ NoError = 0,
+ InvalidTableVersion = 241,
+ DropInProgress = 283,
+ Busy = 701,
+ NotMaster = 702,
+ InvalidFormat = 703,
+ AttributeNameTooLong = 704,
+ TableNameTooLong = 705,
+ Inconsistency = 706,
+ NoMoreTableRecords = 707,
+ NoMoreAttributeRecords = 708,
+ NoSuchTable = 709,
+ AttributeNameTwice = 720,
+ TableAlreadyExist = 721,
+ ArraySizeTooBig = 737,
+ RecordTooBig = 738,
+ InvalidPrimaryKeySize = 739,
+ NullablePrimaryKey = 740,
+ UnsupportedChange = 741
+ };
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 masterNodeId;
+ Uint32 errorCode;
+ Uint32 errorLine;
+ Uint32 errorKey;
+ Uint32 status;
+
+public:
+ Uint32 getErrorCode() const {
+ return errorCode;
+ }
+ Uint32 getErrorLine() const {
+ return errorLine;
+ }
+};
+
+class AlterTableConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+ friend class NdbDictInterface;
+
+ /**
+ * For printing
+ */
+ friend bool printALTER_TABLE_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 tableId;
+ Uint32 tableVersion;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/AlterTrig.hpp b/ndb/include/kernel/signaldata/AlterTrig.hpp
new file mode 100644
index 00000000000..a97c1fd0196
--- /dev/null
+++ b/ndb/include/kernel/signaldata/AlterTrig.hpp
@@ -0,0 +1,288 @@
+/* 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 ALTER_TRIG_HPP
+#define ALTER_TRIG_HPP
+
+#include "SignalData.hpp"
+#include <Bitmask.hpp>
+#include <trigger_definitions.h>
+
+/**
+ * AlterTrigReq.
+ */
+class AlterTrigReq {
+ friend bool printALTER_TRIG_REQ(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum RequestType {
+ RT_UNDEFINED = 0,
+ RT_USER = 1,
+ RT_CREATE_TRIGGER = 2,
+ RT_DROP_TRIGGER = 3,
+ RT_DICT_PREPARE = 1 << 4,
+ RT_DICT_TC = 5 << 4,
+ RT_DICT_LQH = 6 << 4,
+ RT_DICT_COMMIT = 0xC << 4,
+ RT_DICT_ABORT = 0xF << 4
+ };
+ STATIC_CONST( SignalLength = 8 );
+
+private:
+ Uint32 m_userRef;
+ Uint32 m_connectionPtr;
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_triggerId;
+ Uint32 m_triggerInfo;
+ Uint32 m_online; // new state 0-offline 1-online
+ Uint32 m_receiverRef; // receiver for subscription trigger
+ // extra
+ Uint32 m_opKey;
+
+public:
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ AlterTrigReq::RequestType getRequestType() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 0, 16);
+ return (AlterTrigReq::RequestType)val;
+ }
+ void setRequestType(AlterTrigReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getRequestFlag() const {
+ return BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ };
+ void addRequestFlag(Uint32 val) {
+ val |= BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ BitmaskImpl::setField(1, &m_requestInfo, 16, 16, val);
+ };
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ Uint32 getTriggerId() const {
+ return m_triggerId;
+ }
+ void setTriggerId(Uint32 val) {
+ m_triggerId = val;
+ }
+ Uint32 getTriggerInfo() const {
+ return m_triggerInfo;
+ }
+ void setTriggerInfo(Uint32 val) {
+ m_triggerInfo = val;
+ }
+ TriggerType::Value getTriggerType() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_triggerInfo, 0, 8);
+ return (TriggerType::Value)val;
+ }
+ void setTriggerType(TriggerType::Value val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 0, 8, (Uint32)val);
+ }
+ TriggerActionTime::Value getTriggerActionTime() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_triggerInfo, 8, 8);
+ return (TriggerActionTime::Value)val;
+ }
+ void setTriggerActionTime(TriggerActionTime::Value val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 8, 8, (Uint32)val);
+ }
+ TriggerEvent::Value getTriggerEvent() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_triggerInfo, 16, 8);
+ return (TriggerEvent::Value)val;
+ }
+ void setTriggerEvent(TriggerEvent::Value val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 16, 8, (Uint32)val);
+ }
+ bool getMonitorReplicas() const {
+ return BitmaskImpl::getField(1, &m_triggerInfo, 24, 1);
+ }
+ void setMonitorReplicas(bool val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 24, 1, val);
+ }
+ bool getMonitorAllAttributes() const {
+ return BitmaskImpl::getField(1, &m_triggerInfo, 25, 1);
+ }
+ void setMonitorAllAttributes(bool val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 25, 1, val);
+ }
+ Uint32 getOnline() const {
+ return m_online;
+ }
+ void setOnline(Uint32 val) {
+ m_online = val;
+ }
+ Uint32 getReceiverRef() const {
+ return m_receiverRef;
+ }
+ void setReceiverRef(Uint32 val) {
+ m_receiverRef = val;
+ }
+ Uint32 getOpKey() const {
+ return m_opKey;
+ }
+ void setOpKey(Uint32 val) {
+ m_opKey = val;
+ }
+};
+
+/**
+ * AlterTrigConf.
+ */
+class AlterTrigConf {
+ friend bool printALTER_TRIG_CONF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( InternalLength = 3 );
+ STATIC_CONST( SignalLength = 5 );
+
+private:
+ Uint32 m_userRef;
+ Uint32 m_connectionPtr;
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_triggerId;
+
+public:
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ AlterTrigReq::RequestType getRequestType() const {
+ return (AlterTrigReq::RequestType)m_requestInfo;
+ }
+ void setRequestType(AlterTrigReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ Uint32 getTriggerId() const {
+ return m_triggerId;
+ }
+ void setTriggerId(Uint32 val) {
+ m_triggerId = val;
+ }
+};
+
+/**
+ * AlterTrigRef.
+ */
+class AlterTrigRef {
+ friend bool printALTER_TRIG_REF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum ErrorCode {
+ NoError = 0,
+ Busy = 701,
+ TriggerNotFound = 4238,
+ TriggerExists = 4239,
+ BadRequestType = 4247
+ };
+ STATIC_CONST( SignalLength = AlterTrigConf::SignalLength + 3 );
+
+private:
+ AlterTrigConf m_conf;
+ //Uint32 m_userRef;
+ //Uint32 m_connectionPtr;
+ //Uint32 m_requestInfo;
+ //Uint32 m_tableId;
+ //Uint32 m_triggerId;
+ Uint32 m_errorCode;
+ Uint32 m_errorLine;
+ Uint32 m_errorNode;
+
+public:
+ AlterTrigConf* getConf() {
+ return &m_conf;
+ }
+ const AlterTrigConf* getConf() const {
+ return &m_conf;
+ }
+ Uint32 getUserRef() const {
+ return m_conf.getUserRef();
+ }
+ void setUserRef(Uint32 val) {
+ m_conf.setUserRef(val);
+ }
+ Uint32 getConnectionPtr() const {
+ return m_conf.getConnectionPtr();
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_conf.setConnectionPtr(val);
+ }
+ AlterTrigReq::RequestType getRequestType() const {
+ return m_conf.getRequestType();
+ }
+ void setRequestType(AlterTrigReq::RequestType val) {
+ m_conf.setRequestType(val);
+ }
+ Uint32 getTableId() const {
+ return m_conf.getTableId();
+ }
+ void setTableId(Uint32 val) {
+ m_conf.setTableId(val);
+ }
+ Uint32 getTriggerId() const {
+ return m_conf.getTriggerId();
+ }
+ void setTriggerId(Uint32 val) {
+ m_conf.setTriggerId(val);
+ }
+ ErrorCode getErrorCode() const {
+ return (ErrorCode)m_errorCode;
+ }
+ void setErrorCode(ErrorCode val) {
+ m_errorCode = (Uint32)val;
+ }
+ Uint32 getErrorLine() const {
+ return m_errorLine;
+ }
+ void setErrorLine(Uint32 val) {
+ m_errorLine = val;
+ }
+ Uint32 getErrorNode() const {
+ return m_errorNode;
+ }
+ void setErrorNode(Uint32 val) {
+ m_errorNode = val;
+ }
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/ApiRegSignalData.hpp b/ndb/include/kernel/signaldata/ApiRegSignalData.hpp
new file mode 100644
index 00000000000..84dca8fb260
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ApiRegSignalData.hpp
@@ -0,0 +1,92 @@
+/* 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 API_REGCONF_HPP
+#define API_REGCONF_HPP
+
+#include <NodeState.hpp>
+
+class ApiRegReq {
+ /**
+ * Sender(s)
+ */
+ friend class ClusterMgr;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Qmgr;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 ref;
+ Uint32 version; // Version of API node
+};
+
+/**
+ *
+ */
+class ApiRegRef {
+ /**
+ * Sender(s)
+ */
+ friend class Qmgr;
+
+ /**
+ * Reciver(s)
+ */
+ friend class ClusterMgr;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ enum ErrorCode {
+ WrongType = 1,
+ UnsupportedVersion = 2
+ };
+private:
+ Uint32 ref; // Qmgr ref
+ Uint32 version; // Version of NDB node
+ Uint32 errorCode;
+};
+
+/**
+ *
+ */
+class ApiRegConf {
+ /**
+ * Sender(s)
+ */
+ friend class Qmgr;
+
+ /**
+ * Reciver(s)
+ */
+ friend class ClusterMgr;
+
+public:
+ STATIC_CONST( SignalLength = 3 + NodeState::DataLength );
+private:
+
+ Uint32 qmgrRef;
+ Uint32 version; // Version of NDB node
+ Uint32 apiHeartbeatFrequency;
+ NodeState nodeState;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/ApiVersion.hpp b/ndb/include/kernel/signaldata/ApiVersion.hpp
new file mode 100644
index 00000000000..28281e7d186
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ApiVersion.hpp
@@ -0,0 +1,60 @@
+/* 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 API_VERSION_HPP
+#define API_VERSION_HPP
+
+class ApiVersionReq {
+/**
+ * Sender(s)
+ */
+ friend class MgmtSrv;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Qmgr;
+public:
+ STATIC_CONST( SignalLength = 3 );
+ Uint32 senderRef;
+ Uint32 nodeId; //api node id
+ Uint32 version; // Version of API node
+
+
+};
+
+
+
+class ApiVersionConf {
+/**
+ * Sender(s)
+ */
+ friend class Qmgr;
+
+ /**
+ * Reciver(s)
+ */
+ friend class MgmtSrv;
+public:
+ STATIC_CONST( SignalLength = 3 );
+ Uint32 senderRef;
+ Uint32 nodeId; //api node id
+ Uint32 version; // Version of API node
+
+
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/ArbitSignalData.hpp b/ndb/include/kernel/signaldata/ArbitSignalData.hpp
new file mode 100644
index 00000000000..271b9920cd0
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ArbitSignalData.hpp
@@ -0,0 +1,154 @@
+/* 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 ARBIT_SIGNAL_DATA_H
+#define ARBIT_SIGNAL_DATA_H
+
+#include <string.h>
+#include <NodeBitmask.hpp>
+#include <NdbTick.h>
+#include <NdbHost.h>
+#include "SignalData.hpp"
+#include "SignalDataPrint.hpp"
+
+/**
+ * The ticket.
+ */
+class ArbitTicket {
+private:
+ Uint32 data[2];
+
+public:
+ STATIC_CONST( DataLength = 2 );
+ STATIC_CONST( TextLength = DataLength * 8 ); // hex digits
+
+ inline void clear() {
+ data[0] = 0;
+ data[1] = 0;
+ }
+
+ inline void update() {
+ Uint16 cnt = data[0] & 0xFFFF; // previous count
+ Uint16 pid = NdbHost_GetProcessId();
+ data[0] = (pid << 16) | (cnt + 1);
+ data[1] = NdbTick_CurrentMillisecond();
+ }
+
+ inline bool match(ArbitTicket& aTicket) const {
+ return
+ data[0] == aTicket.data[0] &&
+ data[1] == aTicket.data[1];
+ }
+
+ inline void getText(char *buf, size_t buf_len) const {
+ snprintf(buf, buf_len, "%08x%08x", data[0], data[1]);
+ }
+
+/* inline char* getText() const {
+ static char buf[TextLength + 1];
+ getText(buf, sizeof(buf));
+ return buf;
+ } */
+};
+
+/**
+ * Result codes. Part of signal data. Each signal uses only
+ * a subset but a common namespace is convenient.
+ */
+class ArbitCode {
+public:
+ STATIC_CONST( ErrTextLength = 80 );
+
+ enum {
+ NoInfo = 0,
+
+ // CFG signals
+ CfgRank1 = 1, // these have to be 1 and 2
+ CfgRank2 = 2,
+
+ // QMGR continueB thread state
+ ThreadStart = 11, // continueB thread started
+
+ // PREP signals
+ PrepPart1 = 21, // zero old ticket
+ PrepPart2 = 22, // get new ticket
+ PrepAtrun = 23, // late joiner gets ticket at RUN time
+
+ // arbitrator state
+ ApiStart = 31, // arbitrator thread started
+ ApiFail = 32, // arbitrator died
+ ApiExit = 33, // arbitrator reported it will exit
+
+ // arbitration result
+ LoseNodes = 41, // lose on ndb node count
+ WinGroups = 42, // we win, no need for arbitration
+ LoseGroups = 43, // we lose, missing node group
+ Partitioning = 44, // possible network partitioning
+ WinChoose = 45, // positive reply
+ LoseChoose = 46, // negative reply
+ LoseNorun = 47, // arbitrator required but not running
+ LoseNocfg = 48, // arbitrator required but none configured
+
+ // general error codes
+ ErrTicket = 91, // invalid arbitrator-ticket
+ ErrToomany = 92, // too many requests
+ ErrState = 93, // invalid state
+ ErrTimeout = 94, // timeout waiting for signals
+ ErrUnknown = 95 // unknown error
+ };
+
+ static inline void getErrText(Uint32 code, char* buf, size_t buf_len) {
+ switch (code) {
+ case ErrTicket:
+ snprintf(buf, buf_len, "invalid arbitrator-ticket");
+ break;
+ case ErrToomany:
+ snprintf(buf, buf_len, "too many requests");
+ break;
+ case ErrState:
+ snprintf(buf, buf_len, "invalid state");
+ break;
+ case ErrTimeout:
+ snprintf(buf, buf_len, "timeout");
+ break;
+ default:
+ snprintf(buf, buf_len, "unknown error [code=%u]", code);
+ break;
+ }
+ }
+};
+
+/**
+ * Common class for arbitration signal data.
+ */
+class ArbitSignalData {
+public:
+ Uint32 sender; // sender's node id (must be word 0)
+ Uint32 code; // result code or other info
+ Uint32 node; // arbitrator node id
+ ArbitTicket ticket; // ticket
+ NodeBitmask mask; // set of nodes
+
+ STATIC_CONST( SignalLength = 3 + ArbitTicket::DataLength + NodeBitmask::Size );
+
+ inline bool match(ArbitSignalData& aData) const {
+ return
+ node == aData.node &&
+ ticket.match(aData.ticket);
+ }
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/AttrInfo.hpp b/ndb/include/kernel/signaldata/AttrInfo.hpp
new file mode 100644
index 00000000000..18bd9b22c40
--- /dev/null
+++ b/ndb/include/kernel/signaldata/AttrInfo.hpp
@@ -0,0 +1,52 @@
+/* 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 ATTRINFO_HPP
+#define ATTRINFO_HPP
+
+#include "SignalData.hpp"
+
+class AttrInfo {
+ /**
+ * Sender(s)
+ */
+ friend class DbUtil;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbtup;
+
+ /**
+ * Sender(s) / Receiver(s)
+ */
+ friend class Dbtc;
+ friend class Dblqh;
+
+ friend bool printATTRINFO(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( HeaderLength = 3 );
+ STATIC_CONST( DataLength = 22 );
+ STATIC_CONST( MaxSignalLength = HeaderLength + DataLength );
+
+private:
+ Uint32 connectPtr;
+ Uint32 transId[2];
+ Uint32 attrData[DataLength];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/BackupContinueB.hpp b/ndb/include/kernel/signaldata/BackupContinueB.hpp
new file mode 100644
index 00000000000..d3d3f79f310
--- /dev/null
+++ b/ndb/include/kernel/signaldata/BackupContinueB.hpp
@@ -0,0 +1,38 @@
+/* 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 BACKUP_CONTINUEB_H
+#define BACKUP_CONTINUEB_H
+
+#include "SignalData.hpp"
+
+class BackupContinueB {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Backup;
+ friend bool printCONTINUEB_BACKUP(FILE * output, const Uint32 * theData, Uint32 len);
+private:
+ enum {
+ START_FILE_THREAD = 0,
+ BUFFER_UNDERFLOW = 1,
+ BUFFER_FULL_SCAN = 2,
+ BUFFER_FULL_FRAG_COMPLETE = 3,
+ BUFFER_FULL_META = 4
+ };
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/BackupImpl.hpp b/ndb/include/kernel/signaldata/BackupImpl.hpp
new file mode 100644
index 00000000000..1872069daa7
--- /dev/null
+++ b/ndb/include/kernel/signaldata/BackupImpl.hpp
@@ -0,0 +1,366 @@
+/* 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 BACKUP_IMPL_HPP
+#define BACKUP_IMPL_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+
+class DefineBackupReq {
+ /**
+ * Sender(s)
+ */
+ friend class BackupMaster;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Backup;
+
+ friend bool printDEFINE_BACKUP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 8 + NdbNodeBitmask::Size);
+
+private:
+ /**
+ * i - value of backup object
+ */
+ Uint32 backupPtr;
+
+ Uint32 backupId;
+ Uint32 clientRef;
+ Uint32 clientData;
+ Uint32 senderRef;
+
+ /**
+ * Which node(s) is participating in the backup
+ */
+ NdbNodeBitmask nodes;
+
+ /**
+ * Generated random number
+ */
+ Uint32 backupKey[2];
+
+ /**
+ * Length of backup data
+ */
+ Uint32 backupDataLen;
+};
+
+class DefineBackupRef {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class BackupMaster;
+
+ friend bool printDEFINE_BACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ enum ErrorCode {
+ Undefined = 200,
+ FailedToAllocateBuffers = 202,
+ FailedToSetupFsBuffers = 203,
+ FailedToAllocateTables = 204,
+ FailedInsertFileHeader = 205,
+ FailedInsertTableList = 206,
+ FailedAllocateTableMem = 207,
+ FailedToAllocateFileRecord = 208,
+ FailedToAllocateAttributeRecord = 209
+ };
+private:
+ Uint32 backupId;
+ Uint32 backupPtr;
+ Uint32 errorCode;
+};
+
+class DefineBackupConf {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class BackupMaster;
+
+ friend bool printDEFINE_BACKUP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 backupId;
+ Uint32 backupPtr;
+};
+
+class StartBackupReq {
+ /**
+ * Sender(s)
+ */
+ friend class BackupMaster;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Backup;
+
+ friend bool printSTART_BACKUP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+
+ STATIC_CONST( MaxTableTriggers = 4 );
+ STATIC_CONST( HeaderLength = 5 );
+ STATIC_CONST( TableTriggerLength = 4);
+
+private:
+ Uint32 backupId;
+ Uint32 backupPtr;
+ Uint32 signalNo;
+ Uint32 noOfSignals;
+ Uint32 noOfTableTriggers;
+
+ struct TableTriggers {
+ Uint32 tableId;
+ Uint32 triggerIds[3];
+ } tableTriggers[MaxTableTriggers];
+};
+
+class StartBackupRef {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class BackupMaster;
+
+ friend bool printSTART_BACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ enum ErrorCode {
+ FailedToAllocateTriggerRecord = 1
+ };
+private:
+ Uint32 backupId;
+ Uint32 backupPtr;
+ Uint32 signalNo;
+ Uint32 errorCode;
+};
+
+class StartBackupConf {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class BackupMaster;
+
+ friend bool printSTART_BACKUP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 backupId;
+ Uint32 backupPtr;
+ Uint32 signalNo;
+};
+
+class BackupFragmentReq {
+ /**
+ * Sender(s)
+ */
+ friend class BackupMaster;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Backup;
+
+ friend bool printBACKUP_FRAGMENT_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+private:
+ Uint32 backupId;
+ Uint32 backupPtr;
+ Uint32 tableId;
+ Uint32 fragmentNo;
+ Uint32 count;
+};
+
+class BackupFragmentRef {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class BackupMaster;
+
+ friend bool printBACKUP_FRAGMENT_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+private:
+ Uint32 backupId;
+ Uint32 backupPtr;
+ Uint32 tableId;
+ Uint32 fragmentNo;
+ Uint32 errorCode;
+};
+
+class BackupFragmentConf {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class BackupMaster;
+
+ friend bool printBACKUP_FRAGMENT_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 6 );
+
+private:
+ Uint32 backupId;
+ Uint32 backupPtr;
+ Uint32 tableId;
+ Uint32 fragmentNo;
+ Uint32 noOfRecords;
+ Uint32 noOfBytes;
+};
+
+class StopBackupReq {
+ /**
+ * Sender(s)
+ */
+ friend class BackupMaster;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Backup;
+
+ friend bool printSTOP_BACKUP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 backupId;
+ Uint32 backupPtr;
+ Uint32 startGCP;
+ Uint32 stopGCP;
+};
+
+class StopBackupRef {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class BackupMaster;
+
+ friend bool printSTOP_BACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 backupId;
+ Uint32 backupPtr;
+ Uint32 errorCode;
+};
+
+class StopBackupConf {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class BackupMaster;
+
+ friend bool printSTOP_BACKUP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 backupId;
+ Uint32 backupPtr;
+ Uint32 noOfLogBytes;
+ Uint32 noOfLogRecords;
+};
+
+class BackupStatusReq {
+ /**
+ * Sender(s)
+ */
+ friend class BackupMaster;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Backup;
+
+ friend bool printBACKUP_STATUS_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+private:
+};
+
+class BackupStatusConf {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class BackupMaster;
+
+ friend bool printBACKUP_STATUS_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+private:
+};
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/BackupSignalData.hpp b/ndb/include/kernel/signaldata/BackupSignalData.hpp
new file mode 100644
index 00000000000..42eb8464d53
--- /dev/null
+++ b/ndb/include/kernel/signaldata/BackupSignalData.hpp
@@ -0,0 +1,252 @@
+/* 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 BACKUP_HPP
+#define BACKUP_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+
+/**
+ * Request to start a backup
+ */
+class BackupReq {
+ /**
+ * Sender(s)
+ */
+ friend class MgmtSrvr;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Backup;
+
+ friend bool printBACKUP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 senderData;
+ Uint32 backupDataLen;
+};
+
+class BackupData {
+ /**
+ * Sender(s)
+ */
+ friend class BackupMaster;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Backup;
+
+ friend bool printBACKUP_DATA(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 25 );
+
+ enum KeyValues {
+ /**
+ * Buffer(s) and stuff
+ */
+ BufferSize = 1, // In MB
+ BlockSize = 2, // Write in chunks of this (in bytes)
+ MinWrite = 3, // Minimum write as multiple of blocksize
+ MaxWrite = 4, // Maximum write as multiple of blocksize
+
+ // Max throughput
+ // Parallell files
+
+ NoOfTables = 1000,
+ TableName = 1001 // char*
+ };
+private:
+ enum RequestType {
+ ClientToMaster = 1,
+ MasterToSlave = 2
+ };
+ Uint32 requestType;
+
+ union {
+ Uint32 backupPtr;
+ Uint32 senderData;
+ };
+ Uint32 backupId;
+
+ /**
+ * totalLen = totalLen_offset >> 16
+ * offset = totalLen_offset & 0xFFFF
+ */
+ Uint32 totalLen_offset;
+
+ /**
+ * Length in this = signal->length() - 3
+ * Sender block ref = signal->senderBlockRef()
+ */
+ Uint32 backupData[21];
+};
+
+/**
+ * The request to start a backup was refused
+ */
+class BackupRef {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class MgmtSrvr;
+
+ friend bool printBACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ enum ErrorCodes {
+ Undefined = 100,
+ IAmNotMaster = 101,
+ OutOfBackupRecord = 102,
+ OutOfResources = 103,
+ SequenceFailure = 104,
+ BackupDefinitionNotImplemented = 105
+ };
+ Uint32 senderData;
+ Uint32 errorCode;
+ union {
+ Uint32 masterRef;
+ };
+};
+
+/**
+ * The backup has started
+ */
+class BackupConf {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class MgmtSrvr;
+
+ friend bool printBACKUP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 + NdbNodeBitmask::Size );
+
+private:
+ Uint32 senderData;
+ Uint32 backupId;
+ NdbNodeBitmask nodes;
+};
+
+/**
+ * A backup has been aborted
+ */
+class BackupAbortRep {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class MgmtSrvr;
+
+ friend bool printBACKUP_ABORT_REP(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 senderData;
+ Uint32 backupId;
+ Uint32 reason;
+};
+
+/**
+ * A backup has been completed
+ */
+class BackupCompleteRep {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class MgmtSrvr;
+
+ friend bool printBACKUP_COMPLETE_REP(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 8 + NdbNodeBitmask::Size );
+private:
+ Uint32 senderData;
+ Uint32 backupId;
+ Uint32 startGCP;
+ Uint32 stopGCP;
+ Uint32 noOfBytes;
+ Uint32 noOfRecords;
+ Uint32 noOfLogBytes;
+ Uint32 noOfLogRecords;
+ NdbNodeBitmask nodes;
+};
+
+/**
+ * A master has finished taking-over backup responsiblility
+ */
+class BackupNFCompleteRep {
+ friend bool printBACKUP_NF_COMPLETE_REP(FILE*, const Uint32*, Uint32, Uint16);
+};
+
+/**
+ * Abort of backup
+ */
+class AbortBackupOrd {
+ /**
+ * Sender / Reciver
+ */
+ friend class Backup;
+ friend class MgmtSrvr;
+
+ friend bool printABORT_BACKUP_ORD(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ enum RequestType {
+ ClientAbort = 1,
+ BackupComplete = 2,
+ BackupFailure = 3, // General backup failure coordinator -> slave
+ LogBufferFull = 4, // slave -> coordinator
+ FileOrScanError = 5, // slave -> coordinator
+ BackupFailureDueToNodeFail = 6, // slave -> slave
+ OkToClean = 7 // master -> slave
+ };
+private:
+ Uint32 requestType;
+ Uint32 backupId;
+ union {
+ Uint32 backupPtr;
+ Uint32 senderData;
+ };
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/BlockCommitOrd.hpp b/ndb/include/kernel/signaldata/BlockCommitOrd.hpp
new file mode 100644
index 00000000000..3b33dceb758
--- /dev/null
+++ b/ndb/include/kernel/signaldata/BlockCommitOrd.hpp
@@ -0,0 +1,62 @@
+/* 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 BLOCK_COMMIT_ORD_HPP
+#define BLOCK_COMMIT_ORD_HPP
+
+/**
+ * These two signals are sent via EXECUTE_DIRECT
+ * to DBDIH from QMGR
+ *
+ * Block make sure that no commit is performed
+ * Unblock turns on commit again
+ */
+
+class BlockCommitOrd {
+ /**
+ * Sender(s)
+ */
+ friend class Qmgr;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbdih;
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+private:
+ Uint32 failNo; // As used by Qmgr
+};
+
+class UnblockCommitOrd {
+ /**
+ * Sender(s)
+ */
+ friend class Qmgr;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbdih;
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+private:
+ Uint32 failNo; // As used by Qmgr
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/BuildIndx.hpp b/ndb/include/kernel/signaldata/BuildIndx.hpp
new file mode 100644
index 00000000000..9cf1123cc61
--- /dev/null
+++ b/ndb/include/kernel/signaldata/BuildIndx.hpp
@@ -0,0 +1,308 @@
+/* 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 BUILD_INDX_HPP
+#define BUILD_INDX_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+#include <NdbString.h>
+#include <signaldata/DictTabInfo.hpp>
+
+/**
+ * BuildIndxReq
+ *
+ * This signal is sent by DICT to TRIX(n)
+ * as a request to build a secondary index
+ */
+class BuildIndxReq {
+ friend bool printBUILD_INDX_REQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ enum RequestType {
+ RT_UNDEFINED = 0,
+ RT_USER = 1,
+ RT_ALTER_INDEX = 2,
+ RT_SYSTEMRESTART = 3,
+ RT_DICT_PREPARE = 1 << 4,
+ RT_DICT_TC = 5 << 4,
+ RT_DICT_TRIX = 7 << 4,
+ RT_DICT_TUX = 8 << 4,
+ RT_DICT_COMMIT = 0xC << 4,
+ RT_DICT_ABORT = 0xF << 4,
+ RT_TRIX = 7 << 8
+ };
+ STATIC_CONST( SignalLength = 9 );
+ STATIC_CONST( INDEX_COLUMNS = 0 );
+ STATIC_CONST( KEY_COLUMNS = 1 );
+ STATIC_CONST( NoOfSections = 2 );
+
+private:
+ Uint32 m_userRef; // user block reference
+ Uint32 m_connectionPtr; // user "schema connection"
+ Uint32 m_requestInfo;
+ Uint32 m_buildId; // Suma subscription id
+ Uint32 m_buildKey; // Suma subscription key
+ Uint32 m_tableId; // table being indexed
+ Uint32 m_indexType; // from DictTabInfo::TableType
+ Uint32 m_indexId; // table storing index
+ Uint32 m_parallelism; // number of parallel insert transactions
+ // extra
+ Uint32 m_opKey;
+ // Sent data ends here
+ Uint32 m_slack[25 - SignalLength - 1];
+ Uint32 m_sectionBuffer[MAX_ATTRIBUTES_IN_TABLE * 2];
+
+public:
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ BuildIndxReq::RequestType getRequestType() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 0, 16);
+ return (BuildIndxReq::RequestType)val;
+ }
+ void setRequestType(BuildIndxReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getRequestFlag() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ return (BuildIndxReq::RequestType)val;
+ };
+ void addRequestFlag(Uint32 val) {
+ val |= BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ BitmaskImpl::setField(1, &m_requestInfo, 16, 16, val);
+ };
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ Uint32 getBuildId() const {
+ return m_buildId;
+ }
+ void setBuildId(Uint32 val) {
+ m_buildId = val;
+ }
+ Uint32 getBuildKey() const {
+ return m_buildKey;
+ }
+ void setBuildKey(Uint32 val) {
+ m_buildKey = val;
+ }
+ Uint32 getIndexType() const {
+ return m_indexType;
+ }
+ void setIndexType(Uint32 val) {
+ m_indexType = val;
+ }
+ Uint32 getIndexId() const {
+ return m_indexId;
+ }
+ void setIndexId(Uint32 val) {
+ m_indexId = val;
+ }
+ Uint32 getParallelism() const {
+ return m_parallelism;
+ }
+ void setParallelism(Uint32 val) {
+ m_parallelism = val;
+ }
+ Uint32 getOpKey() const {
+ return m_opKey;
+ }
+ void setOpKey(Uint32 val) {
+ m_opKey = val;
+ }
+ // Column order
+ void setColumnOrder(Uint32* indexBuf, Uint32 indexLen,
+ Uint32* keyBuf, Uint32 keyLen,
+ struct LinearSectionPtr orderPtr[]);
+};
+
+inline
+void BuildIndxReq::setColumnOrder(Uint32* indexBuf, Uint32 indexLen,
+ Uint32* keyBuf, Uint32 keyLen,
+ struct LinearSectionPtr orderPtr[])
+
+{
+ printf("BuildIndxReq::setColumnOrder: indexLen %u, keyLen %u\n", indexLen, keyLen);
+ // Copy buffers
+ MEMCOPY_NO_WORDS(m_sectionBuffer, indexBuf, indexLen);
+ MEMCOPY_NO_WORDS(m_sectionBuffer + indexLen, keyBuf, keyLen);
+ orderPtr[INDEX_COLUMNS].p = m_sectionBuffer;
+ orderPtr[INDEX_COLUMNS].sz = indexLen;
+ orderPtr[KEY_COLUMNS].p = m_sectionBuffer + indexLen;
+ orderPtr[KEY_COLUMNS].sz = keyLen;
+}
+
+/**
+ * BuildIndxConf
+ *
+ * This signal is sent back to DICT from TRIX
+ * as confirmation of succesfull index build
+ * (BuildIndxReq).
+ */
+class BuildIndxConf {
+ friend bool printBUILD_INDX_CONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( InternalLength = 3 );
+ STATIC_CONST( SignalLength = 6 );
+
+private:
+ friend class BuildIndxRef;
+ Uint32 m_userRef;
+ Uint32 m_connectionPtr;
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_indexType;
+ Uint32 m_indexId;
+
+public:
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ BuildIndxReq::RequestType getRequestType() const {
+ return (BuildIndxReq::RequestType)m_requestInfo;
+ }
+ void setRequestType(BuildIndxReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ Uint32 getIndexType() const {
+ return m_indexType;
+ }
+ void setIndexType(Uint32 val) {
+ m_indexType = val;
+ }
+ Uint32 getIndexId() const {
+ return m_indexId;
+ }
+ void setIndexId(Uint32 val) {
+ m_indexId = val;
+ }
+};
+
+/**
+ * BuildIndxRef
+ *
+ * This signal is sent back to API from DICT/TRIX
+ * as refusal of a failed index creation
+ * (BuildIndxReq). It is also sent as refusal
+ * from TC to TRIX and TRIX to DICT.
+ */
+class BuildIndxRef {
+ friend bool printBUILD_INDX_REF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ enum ErrorCode {
+ NoError = 0,
+ Busy = 701,
+ BadRequestType = 4247,
+ InvalidPrimaryTable = 4249,
+ InvalidIndexType = 4250,
+ IndexNotUnique = 4251,
+ AllocationFailure = 4252,
+ InternalError = 4346
+ };
+ STATIC_CONST( SignalLength = BuildIndxConf::SignalLength + 1 );
+
+private:
+ //Uint32 m_userRef;
+ //Uint32 m_connectionPtr;
+ //Uint32 m_requestInfo;
+ //Uint32 m_tableId;
+ //Uint32 m_indexType;
+ //Uint32 m_indexId;
+ BuildIndxConf m_conf;
+ Uint32 m_errorCode;
+
+public:
+ BuildIndxConf* getConf() {
+ return &m_conf;
+ }
+ const BuildIndxConf* getConf() const {
+ return &m_conf;
+ }
+ Uint32 getUserRef() const {
+ return m_conf.getUserRef();
+ }
+ void setUserRef(Uint32 val) {
+ m_conf.setUserRef(val);
+ }
+ Uint32 getConnectionPtr() const {
+ return m_conf.getConnectionPtr();
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_conf.setConnectionPtr(val);
+ }
+ BuildIndxReq::RequestType getRequestType() const {
+ return m_conf.getRequestType();
+ }
+ void setRequestType(BuildIndxReq::RequestType val) {
+ m_conf.setRequestType(val);
+ }
+ Uint32 getTableId() const {
+ return m_conf.getTableId();
+ }
+ void setTableId(Uint32 val) {
+ m_conf.setTableId(val);
+ }
+ Uint32 getIndexType() const {
+ return m_conf.getIndexType();
+ }
+ void setIndexType(Uint32 val) {
+ m_conf.setIndexType(val);
+ }
+ Uint32 getIndexId() const {
+ return m_conf.getIndexId();
+ }
+ void setIndexId(Uint32 val) {
+ m_conf.setIndexId(val);
+ }
+ BuildIndxRef::ErrorCode getErrorCode() const {
+ return (BuildIndxRef::ErrorCode)m_errorCode;
+ }
+ void setErrorCode(BuildIndxRef::ErrorCode val) {
+ m_errorCode = (Uint32)val;
+ }
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CheckNodeGroups.hpp b/ndb/include/kernel/signaldata/CheckNodeGroups.hpp
new file mode 100644
index 00000000000..9b2f847e128
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CheckNodeGroups.hpp
@@ -0,0 +1,63 @@
+/* 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 CHECKNODEGROUPS_H
+#define CHECKNODEGROUPS_H
+
+#include <string.h>
+#include <NodeBitmask.hpp>
+#include "SignalData.hpp"
+#include "SignalDataPrint.hpp"
+
+/**
+ * Ask DIH to check if a node set can survive i.e. if it
+ * has at least one node in every node group. Returns one
+ * of Win, Lose, Partitioning.
+ *
+ * Same class is used for REQ and CONF. The REQ can also
+ * be executed as a direct signal.
+ */
+class CheckNodeGroups {
+public:
+ Uint32 blockRef; // sender's node id
+ union {
+ 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
+ */
+ };
+
+ enum RequestType {
+ Direct = 0x1,
+ ArbitCheck = 0x2,
+ GetNodeGroup = 0x4,
+ GetNodeGroupMembers = 0x8
+ };
+
+ enum Output {
+ Lose = 1, // we cannot survive
+ Win = 2, // we and only we can survive
+ Partitioning = 3 // possible network partitioning
+ };
+
+ STATIC_CONST( SignalLength = 2 + NodeBitmask::Size );
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CloseComReqConf.hpp b/ndb/include/kernel/signaldata/CloseComReqConf.hpp
new file mode 100644
index 00000000000..3d3dc54ba64
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CloseComReqConf.hpp
@@ -0,0 +1,53 @@
+/* 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 CLOSE_COMREQCONF_HPP
+#define CLOSE_COMREQCONF_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+
+/**
+ * The Req signal is sent by Qmgr to Cmvmi
+ * and the Conf signal is sent back
+ *
+ * NOTE that the signals are identical
+ */
+class CloseComReqConf {
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Qmgr;
+ friend class Cmvmi;
+
+ /**
+ * For printing
+ */
+ friend bool printCLOSECOMREQCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( SignalLength = 3 + NodeBitmask::Size );
+private:
+
+ Uint32 xxxBlockRef;
+ Uint32 failNo;
+
+ Uint32 noOfNodes;
+ Uint32 theNodes[NodeBitmask::Size];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CmInit.hpp b/ndb/include/kernel/signaldata/CmInit.hpp
new file mode 100644
index 00000000000..b59547b767b
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CmInit.hpp
@@ -0,0 +1,48 @@
+/* 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 CM_INIT_HPP
+#define CM_INIT_HPP
+
+#include <NodeBitmask.hpp>
+
+/**
+ *
+ */
+class CmInit {
+ /**
+ * Sender(s)
+ */
+ friend class Cmvmi;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Qmgr;
+
+public:
+ STATIC_CONST( SignalLength = 4 + NodeBitmask::Size );
+private:
+
+ Uint32 heartbeatDbDb;
+ Uint32 heartbeatDbApi;
+ Uint32 inactiveTransactionCheck;
+ Uint32 arbitTimeout;
+
+ Uint32 allNdbNodes[NodeBitmask::Size];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CmRegSignalData.hpp b/ndb/include/kernel/signaldata/CmRegSignalData.hpp
new file mode 100644
index 00000000000..f33c991249f
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CmRegSignalData.hpp
@@ -0,0 +1,192 @@
+/* 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 CM_REG_HPP
+#define CM_REG_HPP
+
+#include <NodeBitmask.hpp>
+
+/**
+ * This is the first distributed signal
+ * (the node tries to register in the cluster)
+ */
+class CmRegReq {
+ /**
+ * Sender(s) & Reciver(s)
+ */
+ friend class Qmgr;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+private:
+
+ Uint32 blockRef;
+ Uint32 nodeId;
+ Uint32 version; // See ndb_version.h
+};
+
+/**
+ * The node receving this signal has been accepted into the cluster
+ */
+class CmRegConf {
+ /**
+ * Sender(s) & Reciver(s)
+ */
+ friend class Qmgr;
+
+public:
+ STATIC_CONST( SignalLength = 4 + NdbNodeBitmask::Size );
+private:
+
+ Uint32 presidentBlockRef;
+ Uint32 presidentNodeId;
+ Uint32 presidentVersion;
+
+ /**
+ * The dynamic id that the node reciving this signal has
+ */
+ Uint32 dynamicId;
+
+ Uint32 allNdbNodes[NdbNodeBitmask::Size];
+};
+
+/**
+ *
+ */
+class CmRegRef {
+ /**
+ * Sender(s) & Reciver(s)
+ */
+ friend class Qmgr;
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ enum ErrorCode {
+ ZBUSY = 0, /* Only the president can send this */
+ ZBUSY_PRESIDENT = 1,/* Only the president can send this */
+ ZBUSY_TO_PRES = 2, /* Only the president can send this */
+ ZNOT_IN_CFG = 3, /* Only the president can send this */
+ ZELECTION = 4, /* Receiver is definitely not president,
+ * but we are not sure if sender ends up
+ * as president. */
+ ZNOT_PRESIDENT = 5, /* We are not president */
+ ZNOT_DEAD = 6, /* We are not dead when we are starting */
+ ZINCOMPATIBLE_VERSION = 7
+ };
+private:
+
+ Uint32 blockRef;
+ Uint32 nodeId;
+ Uint32 errorCode;
+ Uint32 presidentCandidate;
+};
+
+class CmAdd {
+ /**
+ * Sender(s) & Reciver(s)
+ */
+ friend class Qmgr;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ enum RequestType {
+ Prepare = 0,
+ AddCommit = 1,
+ CommitNew = 2
+ };
+
+ Uint32 requestType;
+ Uint32 startingNodeId;
+ Uint32 startingVersion;
+};
+
+class CmAckAdd {
+ /**
+ * Sender(s) & Reciver(s)
+ */
+ friend class Qmgr;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 senderNodeId;
+ Uint32 requestType; // see CmAdd::RequestType
+ Uint32 startingNodeId;
+};
+
+class CmNodeInfoReq {
+ /**
+ * Sender(s) & Reciver(s)
+ */
+ friend class Qmgr;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ /**
+ * This is information for sending node (starting node)
+ */
+ Uint32 nodeId;
+ Uint32 dynamicId;
+ Uint32 version;
+};
+
+class CmNodeInfoRef {
+ /**
+ * Sender(s) & Reciver(s)
+ */
+ friend class Qmgr;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ enum ErrorCode {
+ NotRunning = 1
+ };
+
+private:
+ Uint32 nodeId;
+ Uint32 errorCode;
+};
+
+class CmNodeInfoConf {
+ /**
+ * Sender(s) & Reciver(s)
+ */
+ friend class Qmgr;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 nodeId;
+ Uint32 dynamicId;
+ Uint32 version;
+};
+
+#endif
+
+
+
+
+
+
+
diff --git a/ndb/include/kernel/signaldata/CmvmiCfgConf.hpp b/ndb/include/kernel/signaldata/CmvmiCfgConf.hpp
new file mode 100644
index 00000000000..12b785723d9
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CmvmiCfgConf.hpp
@@ -0,0 +1,49 @@
+/* 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 CMVMI_CFGCONF_H
+#define CMVMI_CFGCONF_H
+
+#include "SignalData.hpp"
+
+/**
+ * This signal is used for transfering the
+ * ISP_X Data
+ *
+ * I.e. Configuration data which is sent in a specific start phase
+ *
+ */
+class CmvmiCfgConf {
+ /**
+ * Sender(s)
+ */
+ friend class Cmvmi;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbcntr;
+
+public:
+ STATIC_CONST( NO_OF_WORDS = 16 );
+ STATIC_CONST( LENGTH = 17 );
+private:
+
+ Uint32 startPhase;
+ Uint32 theData[NO_OF_WORDS];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CntrMasterConf.hpp b/ndb/include/kernel/signaldata/CntrMasterConf.hpp
new file mode 100644
index 00000000000..e6bf363ea68
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CntrMasterConf.hpp
@@ -0,0 +1,47 @@
+/* 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 CNTR_MASTERCONF_HPP
+#define CNTR_MASTERCONF_HPP
+
+#include <NodeBitmask.hpp>
+
+/**
+ * This signals is sent by NdbCntr-Master to NdbCntr
+ */
+class CntrMasterConf {
+ /**
+ * Sender(s)
+ */
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+
+ /**
+ * Reciver(s)
+ */
+
+public:
+ STATIC_CONST( SignalLength = 1 + NodeBitmask::Size );
+private:
+
+ Uint32 noStartNodes;
+ Uint32 theNodes[NodeBitmask::Size];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CntrMasterReq.hpp b/ndb/include/kernel/signaldata/CntrMasterReq.hpp
new file mode 100644
index 00000000000..caf9efb1243
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CntrMasterReq.hpp
@@ -0,0 +1,50 @@
+/* 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 CNTR_MASTERREQ_HPP
+#define CNTR_MASTERREQ_HPP
+
+#include <NodeBitmask.hpp>
+
+/**
+ * This signals is sent by NdbCntr-Master to NdbCntr
+ */
+class CntrMasterReq {
+ /**
+ * Sender(s)
+ */
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+
+ /**
+ * Reciver(s)
+ */
+
+public:
+ STATIC_CONST( SignalLength = 4 + NodeBitmask::Size );
+private:
+
+ Uint32 userBlockRef;
+ Uint32 userNodeId;
+ Uint32 typeOfStart;
+ Uint32 noRestartNodes;
+ Uint32 theNodes[NodeBitmask::Size];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/ConfigParamId.hpp b/ndb/include/kernel/signaldata/ConfigParamId.hpp
new file mode 100644
index 00000000000..9d9e04957ab
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ConfigParamId.hpp
@@ -0,0 +1,71 @@
+/* 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 ConfigParamId_H
+#define ConfigParamId_H
+
+ enum ConfigParamId {
+
+ Id,
+ ExecuteOnComputer,
+ MaxNoOfSavedMessages,
+ ShmKey,
+
+ LockPagesInMainMemory,
+ TimeBetweenWatchDogCheck,
+ StopOnError,
+
+ MaxNoOfConcurrentOperations,
+ MaxNoOfConcurrentTransactions,
+ MemorySpaceIndexes,
+ MemorySpaceTuples,
+ MemoryDiskPages,
+ NoOfFreeDiskClusters,
+ NoOfDiskClusters,
+
+ TimeToWaitAlive,
+ HeartbeatIntervalDbDb,
+ HeartbeatIntervalDbApi,
+ ArbitTimeout,
+
+ TimeBetweenLocalCheckpoints,
+ TimeBetweenGlobalCheckpoints,
+ NoOfFragmentLogFiles,
+ NoOfConcurrentCheckpointsDuringRestart,
+ TransactionDeadlockDetectionTimeout,
+ TransactionInactiveTime,
+ NoOfConcurrentProcessesHandleTakeover,
+
+ NoOfConcurrentCheckpointsAfterRestart,
+
+ NoOfDiskPagesToDiskDuringRestartTUP,
+ NoOfDiskPagesToDiskAfterRestartTUP,
+ NoOfDiskPagesToDiskDuringRestartACC,
+ NoOfDiskPagesToDiskAfterRestartACC,
+
+ NoOfDiskClustersPerDiskFile,
+ NoOfDiskFiles,
+
+ MaxNoOfSavedEvents
+ };
+
+#endif // ConfigParamId_H
+
+
+
+
+
+
diff --git a/ndb/include/kernel/signaldata/ContinueFragmented.hpp b/ndb/include/kernel/signaldata/ContinueFragmented.hpp
new file mode 100644
index 00000000000..3d12b9e51eb
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ContinueFragmented.hpp
@@ -0,0 +1,36 @@
+/* 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 CONTINUE_FRAGMENTED_HPP
+#define CONTINUE_FRAGMENTED_HPP
+
+#include "SignalData.hpp"
+
+class ContinueFragmented {
+
+ /**
+ * Sender/Reciver(s)
+ */
+ friend class SimulatedBlock;
+
+ friend bool printCONTINUE_FRAGMENTED(FILE *,const Uint32 *, Uint32, Uint16);
+public:
+
+private:
+ Uint32 line;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CopyActive.hpp b/ndb/include/kernel/signaldata/CopyActive.hpp
new file mode 100644
index 00000000000..19b05bda072
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CopyActive.hpp
@@ -0,0 +1,84 @@
+/* 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 COPY_ACTIVE_HPP
+#define COPY_ACTIVE_HPP
+
+#include "SignalData.hpp"
+
+class CopyActiveReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+private:
+ Uint32 userPtr;
+ Uint32 userRef;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 distributionKey;
+};
+
+class CopyActiveConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+private:
+ Uint32 userPtr;
+ Uint32 startingNodeId;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 startGci;
+};
+class CopyActiveRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+private:
+ Uint32 userPtr;
+ Uint32 startingNodeId;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CopyFrag.hpp b/ndb/include/kernel/signaldata/CopyFrag.hpp
new file mode 100644
index 00000000000..67b935dda64
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CopyFrag.hpp
@@ -0,0 +1,87 @@
+/* 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 COPY_FRAG_HPP
+#define COPY_FRAG_HPP
+
+#include "SignalData.hpp"
+
+class CopyFragReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+public:
+ STATIC_CONST( SignalLength = 7 );
+
+private:
+ Uint32 userPtr;
+ Uint32 userRef;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 nodeId;
+ Uint32 schemaVersion;
+ Uint32 distributionKey;
+};
+
+class CopyFragConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+private:
+ Uint32 userPtr;
+ Uint32 sendingNodeId;
+ Uint32 startingNodeId;
+ Uint32 tableId;
+ Uint32 fragId;
+};
+class CopyFragRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+public:
+ STATIC_CONST( SignalLength = 6 );
+
+private:
+ Uint32 userPtr;
+ Uint32 sendingNodeId;
+ Uint32 startingNodeId;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CopyGCIReq.hpp b/ndb/include/kernel/signaldata/CopyGCIReq.hpp
new file mode 100644
index 00000000000..4b401654de3
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CopyGCIReq.hpp
@@ -0,0 +1,63 @@
+/* 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 COPY_GCI_REQ_HPP
+#define COPY_GCI_REQ_HPP
+
+#include "SignalData.hpp"
+
+/**
+ * This signal is used for transfering the sysfile
+ * between Dih on different nodes.
+ *
+ * The master will distributes the file to the other nodes
+ *
+ * Since the Sysfile can be larger than on StartMeConf signal,
+ * there might be more than on of these signals sent before
+ * the entire sysfile is transfered
+
+ */
+class CopyGCIReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+ friend bool printCOPY_GCI_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ enum CopyReason {
+ IDLE = 0,
+ LOCAL_CHECKPOINT = 1,
+ RESTART = 2,
+ GLOBAL_CHECKPOINT = 3,
+ INITIAL_START_COMPLETED = 4
+ };
+
+private:
+
+ Uint32 anyData;
+ Uint32 copyReason;
+ Uint32 startWord;
+
+ /**
+ * No of free words to carry data
+ */
+ STATIC_CONST( DATA_SIZE = 22 );
+
+ Uint32 data[DATA_SIZE];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CreateEvnt.hpp b/ndb/include/kernel/signaldata/CreateEvnt.hpp
new file mode 100644
index 00000000000..7398fb6d8cc
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CreateEvnt.hpp
@@ -0,0 +1,488 @@
+/* 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 CREATE_EVNT_HPP
+#define CREATE_EVNT_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+#include <signaldata/DictTabInfo.hpp>
+
+/**
+ * DropEvntReq.
+ */
+class DropEvntReq {
+ friend bool printDROP_EVNT_REQ(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+ SECTION( EVENT_NAME_SECTION = 0 );
+
+ union { // user block reference
+ Uint32 senderRef;
+ Uint32 m_userRef;
+ };
+ union {
+ Uint32 senderData;
+ Uint32 m_userData; // user
+ };
+
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getUserData() const {
+ return m_userData;
+ }
+ void setUserData(Uint32 val) {
+ m_userData = val;
+ }
+};
+
+/**
+ * DropEvntConf.
+ */
+class DropEvntConf {
+ friend bool printDROP_EVNT_CONF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ union { // user block reference
+ Uint32 senderRef;
+ Uint32 m_userRef;
+ };
+ union {
+ Uint32 senderData;
+ Uint32 m_userData; // user
+ };
+
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getUserData() const {
+ return m_userData;
+ }
+ void setUserData(Uint32 val) {
+ m_userData = val;
+ }
+};
+
+/**
+ * DropEvntRef.
+ */
+class DropEvntRef {
+ friend bool printDROP_EVNT_REF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum ErrorCode {
+ NoError = 0,
+ Undefined = 1,
+ UndefinedTCError = 2,
+ NF_FakeErrorREF = 11,
+ Busy = 701,
+ NotMaster = 702,
+ SeizeError = 703,
+ EventNotFound = 4238,
+ EventNameTooLong = 4241,
+ TooManyEvents = 4242,
+ BadRequestType = 4247,
+ InvalidName = 4248,
+ InvalidPrimaryTable = 4249,
+ InvalidEventType = 4250,
+ NotUnique = 4251,
+ AllocationError = 4252,
+ CreateEventTableFailed = 4253,
+ InvalidAttributeOrder = 4255,
+ Temporary = 0x1 << 16
+ };
+
+ STATIC_CONST( SignalLength = 5 );
+
+ union { // user block reference
+ Uint32 senderRef;
+ Uint32 m_userRef;
+ };
+ union {
+ Uint32 senderData;
+ Uint32 m_userData; // user
+ };
+ union {
+ Uint32 errorCode;
+ Uint32 m_errorCode;
+ };
+ Uint32 m_errorLine;
+ Uint32 m_errorNode;
+
+ bool isTemporary() const
+ { return (errorCode & Temporary) > 0; }
+
+ void setTemporary()
+ { errorCode |= Temporary; }
+
+ ErrorCode setTemporary(ErrorCode ec)
+ { return (ErrorCode) (errorCode = ((Uint32) ec | (Uint32)Temporary)); }
+
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getUserData() const {
+ return m_userData;
+ }
+ void setUserData(Uint32 val) {
+ m_userData = val;
+ }
+ DropEvntRef::ErrorCode getErrorCode() const {
+ return (DropEvntRef::ErrorCode)m_errorCode;
+ }
+ void setErrorCode(DropEvntRef::ErrorCode val) {
+ m_errorCode = (Uint32)val;
+ }
+ Uint32 getErrorLine() const {
+ return m_errorLine;
+ }
+ void setErrorLine(Uint32 val) {
+ m_errorLine = val;
+ }
+ Uint32 getErrorNode() const {
+ return m_errorNode;
+ }
+ void setErrorNode(Uint32 val) {
+ m_errorNode = val;
+ }
+};
+
+/**
+ * CreateEvntReq.
+ */
+struct CreateEvntReq {
+ friend bool printCREATE_EVNT_REQ(FILE*, const Uint32*, Uint32, Uint16);
+
+ enum RequestType {
+ RT_UNDEFINED = 0,
+ RT_USER_CREATE = 1,
+ RT_USER_GET = 2,
+
+ RT_DICT_AFTER_GET = 0x1 << 4
+ // RT_DICT_MASTER = 0x2 << 4,
+
+ // RT_DICT_COMMIT = 0xC << 4,
+ // RT_DICT_ABORT = 0xF << 4,
+ // RT_TC = 5 << 8
+ };
+ STATIC_CONST( SignalLengthGet = 3 );
+ STATIC_CONST( SignalLengthCreate = 5+MAXNROFATTRIBUTESINWORDS );
+ STATIC_CONST( SignalLength = 7+MAXNROFATTRIBUTESINWORDS );
+ // SECTION( ATTRIBUTE_LIST_SECTION = 0 );
+ SECTION( EVENT_NAME_SECTION = 0 );
+
+ union {
+ Uint32 m_userRef; // user block reference
+ Uint32 senderRef; // user block reference
+ };
+ union {
+ Uint32 m_userData; // user
+ Uint32 senderData; // user
+ };
+ Uint32 m_requestInfo;
+ Uint32 m_tableId; // table to event
+ AttributeMask::Data m_attrListBitmask;
+ Uint32 m_eventType; // from DictTabInfo::TableType
+ Uint32 m_eventId; // event table id set by DICT/SUMA
+ Uint32 m_eventKey; // event table key set by DICT/SUMA
+
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getUserData() const {
+ return m_userData;
+ }
+ void setUserData(Uint32 val) {
+ m_userData = val;
+ }
+ CreateEvntReq::RequestType getRequestType() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 0, 16);
+ return (CreateEvntReq::RequestType)val;
+ }
+ void setRequestType(CreateEvntReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getRequestFlag() const {
+ return BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ };
+ void addRequestFlag(Uint32 val) {
+ val |= BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ BitmaskImpl::setField(1, &m_requestInfo, 16, 16, val);
+ };
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ AttributeMask getAttrListBitmask() const {
+ AttributeMask tmp;
+ tmp.assign(m_attrListBitmask);
+ return tmp;
+ }
+ void setAttrListBitmask(const AttributeMask & val) {
+ m_attrListBitmask = val;
+ }
+ Uint32 getEventType() const {
+ return m_eventType;
+ }
+ void setEventType(Uint32 val) {
+ m_eventType = (Uint32)val;
+ }
+ Uint32 getEventId() const {
+ return m_eventId;
+ }
+ void setEventId(Uint32 val) {
+ m_eventId = val;
+ }
+ Uint32 getEventKey() const {
+ return m_eventKey;
+ }
+ void setEventKey(Uint32 val) {
+ m_eventKey = val;
+ }
+};
+
+/**
+ * CreateEvntConf.
+ */
+class CreateEvntConf {
+ friend bool printCREATE_EVNT_CONF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ // STATIC_CONST( InternalLength = 3 );
+ STATIC_CONST( SignalLength = 7+MAXNROFATTRIBUTESINWORDS );
+
+ union {
+ Uint32 m_userRef; // user block reference
+ Uint32 senderRef; // user block reference
+ };
+ union {
+ Uint32 m_userData; // user
+ Uint32 senderData; // user
+ };
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ AttributeMask m_attrListBitmask;
+ Uint32 m_eventType;
+ Uint32 m_eventId;
+ Uint32 m_eventKey;
+
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getUserData() const {
+ return m_userData;
+ }
+ void setUserData(Uint32 val) {
+ m_userData = val;
+ }
+ CreateEvntReq::RequestType getRequestType() const {
+ return (CreateEvntReq::RequestType)m_requestInfo;
+ }
+ void setRequestType(CreateEvntReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ AttributeMask getAttrListBitmask() const {
+ return m_attrListBitmask;
+ }
+ void setAttrListBitmask(const AttributeMask & val) {
+ m_attrListBitmask = val;
+ }
+ Uint32 getEventType() const {
+ return m_eventType;
+ }
+ void setEventType(Uint32 val) {
+ m_eventType = (Uint32)val;
+ }
+ Uint32 getEventId() const {
+ return m_eventId;
+ }
+ void setEventId(Uint32 val) {
+ m_eventId = val;
+ }
+ Uint32 getEventKey() const {
+ return m_eventKey;
+ }
+ void setEventKey(Uint32 val) {
+ m_eventKey = val;
+ }
+};
+
+/**
+ * CreateEvntRef.
+ */
+struct CreateEvntRef {
+ friend class SafeCounter;
+ friend bool printCREATE_EVNT_REF(FILE*, const Uint32*, Uint32, Uint16);
+
+ STATIC_CONST( SignalLength = 10 );
+ enum ErrorCode {
+ NoError = 0,
+ Undefined = 1,
+ UndefinedTCError = 2,
+ NF_FakeErrorREF = 11,
+ Busy = 701,
+ NotMaster = 702,
+ SeizeError = 703,
+ EventNotFound = 4238,
+ EventExists = 4239,
+ EventNameTooLong = 4241,
+ TooManyEvents = 4242,
+ // EventExists = 4244,
+ AttributeNotStored = 4245,
+ AttributeNullable = 4246,
+ BadRequestType = 4247,
+ InvalidName = 4248,
+ InvalidPrimaryTable = 4249,
+ InvalidEventType = 4250,
+ NotUnique = 4251,
+ AllocationError = 4252,
+ CreateEventTableFailed = 4253,
+ InvalidAttributeOrder = 4255,
+ Temporary = 0x1 << 16
+ };
+ bool isTemporary() const;
+ void setTemporary();
+ ErrorCode setTemporary(ErrorCode ec);
+ static ErrorCode makeTemporary(ErrorCode ec);
+
+ union {
+ Uint32 m_userRef; // user block reference
+ Uint32 senderRef; // user block reference
+ };
+ union {
+ Uint32 m_userData; // user
+ Uint32 senderData; // user
+ };
+
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_eventType;
+ Uint32 m_eventId;
+ Uint32 m_eventKey;
+ Uint32 errorCode;
+ Uint32 m_errorLine;
+ Uint32 m_errorNode;
+
+#if 0
+ CreateEvntConf* getConf() {
+ return &m_conf;
+ }
+ const CreateEvntConf* getConf() const {
+ return &m_conf;
+ }
+#endif
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getUserData() const {
+ return m_userData;
+ }
+ void setUserData(Uint32 val) {
+ m_userData = val;
+ }
+ CreateEvntReq::RequestType getRequestType() const {
+ return (CreateEvntReq::RequestType)m_requestInfo;
+ }
+ void setRequestType(CreateEvntReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+
+ Uint32 getEventType() const {
+ return m_eventType;
+ }
+ void setEventType(Uint32 val) {
+ m_eventType = (Uint32)val;
+ }
+ Uint32 getEventId() const {
+ return m_eventId;
+ }
+ void setEventId(Uint32 val) {
+ m_eventId = val;
+ }
+ Uint32 getEventKey() const {
+ return m_eventKey;
+ }
+ void setEventKey(Uint32 val) {
+ m_eventKey = val;
+ }
+
+ CreateEvntRef::ErrorCode getErrorCode() const {
+ return (CreateEvntRef::ErrorCode)errorCode;
+ }
+ void setErrorCode(CreateEvntRef::ErrorCode val) {
+ errorCode = (Uint32)val;
+ }
+ Uint32 getErrorLine() const {
+ return m_errorLine;
+ }
+ void setErrorLine(Uint32 val) {
+ m_errorLine = val;
+ }
+ Uint32 getErrorNode() const {
+ return m_errorNode;
+ }
+ void setErrorNode(Uint32 val) {
+ m_errorNode = val;
+ }
+};
+inline bool CreateEvntRef::isTemporary() const
+{ return (errorCode & CreateEvntRef::Temporary) > 0; };
+inline void CreateEvntRef::setTemporary()
+{ errorCode |= CreateEvntRef::Temporary; };
+inline CreateEvntRef::ErrorCode CreateEvntRef::setTemporary(ErrorCode ec)
+{ return (CreateEvntRef::ErrorCode)
+ (errorCode = ((Uint32) ec | (Uint32)CreateEvntRef::Temporary)); };
+inline CreateEvntRef::ErrorCode CreateEvntRef::makeTemporary(ErrorCode ec)
+{ return (CreateEvntRef::ErrorCode)
+ ( (Uint32) ec | (Uint32)CreateEvntRef::Temporary ); };
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CreateFrag.hpp b/ndb/include/kernel/signaldata/CreateFrag.hpp
new file mode 100644
index 00000000000..a7b3f836353
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CreateFrag.hpp
@@ -0,0 +1,61 @@
+/* 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 CREATE_FRAG_HPP
+#define CREATE_FRAG_HPP
+
+class CreateFragReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 8 );
+
+ enum ReplicaType {
+ STORED = 7,
+ COMMIT_STORED = 9
+ };
+private:
+
+ Uint32 userPtr;
+ BlockReference userRef;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 startingNodeId;
+ Uint32 copyNodeId;
+ Uint32 startGci;
+ Uint32 replicaType;
+};
+
+class CreateFragConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 5 );
+private:
+
+ Uint32 userPtr;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 sendingNodeId;
+ Uint32 startingNodeId;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/CreateFragmentation.hpp b/ndb/include/kernel/signaldata/CreateFragmentation.hpp
new file mode 100644
index 00000000000..a2f45a9580d
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CreateFragmentation.hpp
@@ -0,0 +1,101 @@
+/* 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 CREATE_FRAGMENTATION_REQ_HPP
+#define CREATE_FRAGMENTATION_REQ_HPP
+
+#include "SignalData.hpp"
+
+class CreateFragmentationReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+
+ friend bool printCREATE_FRAGMENTATION_REQ(FILE *,
+ const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 6 );
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 fragmentationType;
+ Uint32 noOfFragments;
+ Uint32 fragmentNode;
+ Uint32 primaryTableId; // use same fragmentation as this table if not RNIL
+};
+
+class CreateFragmentationRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+ friend bool printCREATE_FRAGMENTATION_REF(FILE *,
+ const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ enum ErrorCode {
+ OK = 0
+ ,InvalidFragmentationType = 1
+ ,InvalidNodeId = 2
+ ,InvalidNodeType = 3
+ ,InvalidPrimaryTable = 4
+ };
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 errorCode;
+};
+
+class CreateFragmentationConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+ friend bool printCREATE_FRAGMENTATION_CONF(FILE *,
+ const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+ SECTION( FRAGMENTS = 0 );
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 noOfReplicas;
+ Uint32 noOfFragments;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CreateIndx.hpp b/ndb/include/kernel/signaldata/CreateIndx.hpp
new file mode 100644
index 00000000000..3e277b38dea
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CreateIndx.hpp
@@ -0,0 +1,295 @@
+/* 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 CREATE_INDX_HPP
+#define CREATE_INDX_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+#include <signaldata/DictTabInfo.hpp>
+
+/**
+ * CreateIndxReq.
+ */
+class CreateIndxReq {
+ friend bool printCREATE_INDX_REQ(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum RequestType {
+ RT_UNDEFINED = 0,
+ RT_USER = 1,
+ RT_DICT_PREPARE = 1 << 4,
+ RT_DICT_COMMIT = 0xC << 4,
+ RT_DICT_ABORT = 0xF << 4,
+ RT_TC = 5 << 8
+ };
+ STATIC_CONST( SignalLength = 8 );
+ SECTION( ATTRIBUTE_LIST_SECTION = 0 );
+ SECTION( INDEX_NAME_SECTION = 1 );
+
+private:
+ Uint32 m_connectionPtr; // user "schema connection"
+ Uint32 m_userRef; // user block reference
+ Uint32 m_requestInfo;
+ Uint32 m_tableId; // table to index
+ Uint32 m_indexType; // from DictTabInfo::TableType
+ Uint32 m_indexId; // index table id set by DICT
+ Uint32 m_indexVersion; // index table version set by DICT
+ Uint32 m_online; // alter online
+ // extra
+ Uint32 m_opKey;
+
+public:
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ CreateIndxReq::RequestType getRequestType() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 0, 16);
+ return (CreateIndxReq::RequestType)val;
+ }
+ void setRequestType(CreateIndxReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getRequestFlag() const {
+ return BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ };
+ void addRequestFlag(Uint32 val) {
+ val |= BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ BitmaskImpl::setField(1, &m_requestInfo, 16, 16, val);
+ };
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ DictTabInfo::TableType getIndexType() const {
+ return (DictTabInfo::TableType)m_indexType;
+ }
+ void setIndexType(DictTabInfo::TableType val) {
+ m_indexType = (Uint32)val;
+ }
+ Uint32 getIndexId() const {
+ return m_indexId;
+ }
+ void setIndexId(Uint32 val) {
+ m_indexId = val;
+ }
+ Uint32 getOnline() const {
+ return m_online;
+ }
+ void setOnline(Uint32 val) {
+ m_online = val;
+ }
+ Uint32 getIndexVersion() const {
+ return m_indexVersion;
+ }
+ void setIndexVersion(Uint32 val) {
+ m_indexVersion = val;
+ }
+ Uint32 getOpKey() const {
+ return m_opKey;
+ }
+ void setOpKey(Uint32 val) {
+ m_opKey = val;
+ }
+};
+
+/**
+ * CreateIndxConf.
+ */
+class CreateIndxConf {
+ friend bool printCREATE_INDX_CONF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( InternalLength = 3 );
+ STATIC_CONST( SignalLength = 7 );
+
+private:
+ Uint32 m_connectionPtr;
+ Uint32 m_userRef;
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_indexType;
+ Uint32 m_indexId;
+ Uint32 m_indexVersion;
+
+public:
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ CreateIndxReq::RequestType getRequestType() const {
+ return (CreateIndxReq::RequestType)m_requestInfo;
+ }
+ void setRequestType(CreateIndxReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ DictTabInfo::TableType getIndexType() const {
+ return (DictTabInfo::TableType)m_indexType;
+ }
+ void setIndexType(DictTabInfo::TableType val) {
+ m_indexType = (Uint32)val;
+ }
+ Uint32 getIndexId() const {
+ return m_indexId;
+ }
+ void setIndexId(Uint32 val) {
+ m_indexId = val;
+ }
+ Uint32 getIndexVersion() const {
+ return m_indexVersion;
+ }
+ void setIndexVersion(Uint32 val) {
+ m_indexVersion = val;
+ }
+};
+
+/**
+ * CreateIndxRef.
+ */
+class CreateIndxRef {
+ friend bool printCREATE_INDX_REF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = CreateIndxReq::SignalLength + 3 );
+ enum ErrorCode {
+ NoError = 0,
+ Busy = 701,
+ NotMaster = 702,
+ TriggerNotFound = 4238,
+ TriggerExists = 4239,
+ IndexNameTooLong = 4241,
+ TooManyIndexes = 4242,
+ IndexExists = 4244,
+ AttributeNotStored = 4245,
+ AttributeNullable = 4246,
+ BadRequestType = 4247,
+ InvalidName = 4248,
+ InvalidPrimaryTable = 4249,
+ InvalidIndexType = 4250,
+ NotUnique = 4251,
+ AllocationError = 4252,
+ CreateIndexTableFailed = 4253,
+ InvalidAttributeOrder = 4255
+ };
+
+private:
+ CreateIndxConf m_conf;
+ //Uint32 m_userRef;
+ //Uint32 m_connectionPtr;
+ //Uint32 m_requestInfo;
+ //Uint32 m_tableId;
+ //Uint32 m_indexType;
+ //Uint32 m_indexId;
+ //Uint32 m_indexVersion;
+ Uint32 m_errorCode;
+ Uint32 m_errorLine;
+ Uint32 m_errorNode;
+
+public:
+ CreateIndxConf* getConf() {
+ return &m_conf;
+ }
+ const CreateIndxConf* getConf() const {
+ return &m_conf;
+ }
+ Uint32 getUserRef() const {
+ return m_conf.getUserRef();
+ }
+ void setUserRef(Uint32 val) {
+ m_conf.setUserRef(val);
+ }
+ Uint32 getConnectionPtr() const {
+ return m_conf.getConnectionPtr();
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_conf.setConnectionPtr(val);
+ }
+ CreateIndxReq::RequestType getRequestType() const {
+ return m_conf.getRequestType();
+ }
+ void setRequestType(CreateIndxReq::RequestType val) {
+ m_conf.setRequestType(val);
+ }
+ Uint32 getTableId() const {
+ return m_conf.getTableId();
+ }
+ void setTableId(Uint32 val) {
+ m_conf.setTableId(val);
+ }
+ DictTabInfo::TableType getIndexType() const {
+ return m_conf.getIndexType();
+ }
+ void setIndexType(DictTabInfo::TableType val) {
+ m_conf.setIndexType(val);
+ }
+ Uint32 getIndexId() const {
+ return m_conf.getIndexId();
+ }
+ void setIndexId(Uint32 val) {
+ m_conf.setIndexId(val);
+ }
+ Uint32 getIndexVersion() const {
+ return m_conf.getIndexVersion();
+ }
+ void setIndexVersion(Uint32 val) {
+ m_conf.setIndexVersion(val);
+ }
+ CreateIndxRef::ErrorCode getErrorCode() const {
+ return (CreateIndxRef::ErrorCode)m_errorCode;
+ }
+ void setErrorCode(CreateIndxRef::ErrorCode val) {
+ m_errorCode = (Uint32)val;
+ }
+ Uint32 getErrorLine() const {
+ return m_errorLine;
+ }
+ void setErrorLine(Uint32 val) {
+ m_errorLine = val;
+ }
+ Uint32 getErrorNode() const {
+ return m_errorNode;
+ }
+ void setErrorNode(Uint32 val) {
+ m_errorNode = val;
+ }
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CreateTab.hpp b/ndb/include/kernel/signaldata/CreateTab.hpp
new file mode 100644
index 00000000000..b2ef52a6bf7
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CreateTab.hpp
@@ -0,0 +1,108 @@
+/* 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 CREATE_TAB_HPP
+#define CREATE_TAB_HPP
+
+#include "SignalData.hpp"
+
+/**
+ * CreateTab
+ *
+ * Implemenatation of CreateTable
+ */
+class CreateTabReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * For printing
+ */
+ friend bool printCREATE_TAB_REQ(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 8 );
+
+ enum RequestType {
+ CreateTablePrepare = 0, // Prepare create table
+ CreateTableCommit = 1, // Commit create table
+ CreateTableDrop = 2 // Prepare failed, drop instead
+ };
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 clientRef;
+ Uint32 clientData;
+
+ Uint32 tableId;
+ Uint32 tableVersion;
+ Uint32 gci;
+ Uint32 requestType;
+
+ SECTION( DICT_TAB_INFO = 0 );
+ SECTION( FRAGMENTATION = 1 );
+};
+
+struct CreateTabRef {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdict;
+ friend class SafeCounter;
+
+ /**
+ * For printing
+ */
+ friend bool printCREATE_TAB_REF(FILE *, const Uint32 *, Uint32, Uint16);
+
+ STATIC_CONST( SignalLength = 6 );
+ STATIC_CONST( GSN = GSN_CREATE_TAB_REF );
+
+ enum ErrorCode {
+ NF_FakeErrorREF = 255
+ };
+
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 errorCode;
+ Uint32 errorLine;
+ Uint32 errorKey;
+ Uint32 errorStatus;
+};
+
+class CreateTabConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * For printing
+ */
+ friend bool printCREATE_TAB_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CreateTable.hpp b/ndb/include/kernel/signaldata/CreateTable.hpp
new file mode 100644
index 00000000000..424367f28d5
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CreateTable.hpp
@@ -0,0 +1,140 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef CREATE_TABLE_HPP
+#define CREATE_TABLE_HPP
+
+#include "SignalData.hpp"
+
+/**
+ * CreateTable
+ *
+ * This signal is sent by API to DICT/TRIX
+ * as a request to create a secondary index
+ * and then from TRIX to TRIX(n) and TRIX to TC.
+ */
+class CreateTableReq {
+ /**
+ * Sender(s)
+ */
+ // API
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class NdbDictInterface;
+ friend class Dbdict;
+ friend class Ndbcntr;
+
+ /**
+ * For printing
+ */
+ friend bool printCREATE_TABLE_REQ(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+
+ SECTION( DICT_TAB_INFO = 0 );
+};
+
+class CreateTableRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+ friend class NdbDictInterface;
+
+ /**
+ * For printing
+ */
+ friend bool printCREATE_TABLE_REF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 7 );
+
+ enum ErrorCode {
+ NoError = 0,
+ Busy = 701,
+ NotMaster = 702,
+ InvalidFormat = 703,
+ AttributeNameTooLong = 704,
+ TableNameTooLong = 705,
+ Inconsistency = 706,
+ NoMoreTableRecords = 707,
+ NoMoreAttributeRecords = 708,
+ AttributeNameTwice = 720,
+ TableAlreadyExist = 721,
+ ArraySizeTooBig = 737,
+ RecordTooBig = 738,
+ InvalidPrimaryKeySize = 739,
+ NullablePrimaryKey = 740
+ };
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 masterNodeId;
+ Uint32 errorCode;
+ Uint32 errorLine;
+ Uint32 errorKey;
+ Uint32 status;
+
+public:
+ Uint32 getErrorCode() const {
+ return errorCode;
+ }
+ Uint32 getErrorLine() const {
+ return errorLine;
+ }
+};
+
+class CreateTableConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+ friend class NdbDictInterface;
+
+ /**
+ * For printing
+ */
+ friend bool printCREATE_TABLE_REF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 tableId;
+ Uint32 tableVersion;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/CreateTrig.hpp b/ndb/include/kernel/signaldata/CreateTrig.hpp
new file mode 100644
index 00000000000..a8de9e50dd4
--- /dev/null
+++ b/ndb/include/kernel/signaldata/CreateTrig.hpp
@@ -0,0 +1,414 @@
+/* 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 CREATE_TRIG_HPP
+#define CREATE_TRIG_HPP
+
+#include "SignalData.hpp"
+#include <Bitmask.hpp>
+#include <trigger_definitions.h>
+#include <AttributeList.hpp>
+
+/**
+ * CreateTrigReq.
+ */
+class CreateTrigReq {
+ friend bool printCREATE_TRIG_REQ(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum RequestType {
+ RT_UNDEFINED = 0,
+ RT_USER = 1,
+ RT_ALTER_INDEX = 2,
+ RT_BUILD_INDEX = 3,
+ RT_DICT_PREPARE = 1 << 4,
+ RT_DICT_CREATE = 2 << 4,
+ RT_DICT_COMMIT = 0xC << 4,
+ RT_DICT_ABORT = 0xF << 4,
+ RT_TC = 5 << 8,
+ RT_LQH = 6 << 8
+ };
+ STATIC_CONST( SignalLength = 9 + MAXNROFATTRIBUTESINWORDS);
+ SECTION( TRIGGER_NAME_SECTION = 0 );
+ SECTION( ATTRIBUTE_MASK_SECTION = 1 ); // not yet in use
+ enum KeyValues {
+ TriggerNameKey = 0xa1
+ };
+
+private:
+ Uint32 m_userRef;
+ Uint32 m_connectionPtr;
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_indexId; // only for index trigger
+ Uint32 m_triggerId; // only set by DICT
+ Uint32 m_triggerInfo; // flags | event | timing | type
+ Uint32 m_online; // alter online (not normally for subscription)
+ Uint32 m_receiverRef; // receiver for subscription trigger
+ AttributeMask m_attributeMask;
+ // extra
+ Uint32 m_opKey;
+
+public:
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ CreateTrigReq::RequestType getRequestType() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 0, 16);
+ return (CreateTrigReq::RequestType)val;
+ }
+ void setRequestType(CreateTrigReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getRequestFlag() const {
+ return BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ };
+ void addRequestFlag(Uint32 val) {
+ val |= BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ BitmaskImpl::setField(1, &m_requestInfo, 16, 16, val);
+ };
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ Uint32 getIndexId() const {
+ return m_indexId;
+ }
+ void setIndexId(Uint32 val) {
+ m_indexId = val;
+ }
+ Uint32 getTriggerId() const {
+ return m_triggerId;
+ }
+ void setTriggerId(Uint32 val) {
+ m_triggerId = val;
+ }
+ Uint32 getTriggerInfo() const {
+ return m_triggerInfo;
+ }
+ void setTriggerInfo(Uint32 val) {
+ m_triggerInfo = val;
+ }
+ TriggerType::Value getTriggerType() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_triggerInfo, 0, 8);
+ return (TriggerType::Value)val;
+ }
+ void setTriggerType(TriggerType::Value val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 0, 8, (Uint32)val);
+ }
+ TriggerActionTime::Value getTriggerActionTime() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_triggerInfo, 8, 8);
+ return (TriggerActionTime::Value)val;
+ }
+ void setTriggerActionTime(TriggerActionTime::Value val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 8, 8, (Uint32)val);
+ }
+ TriggerEvent::Value getTriggerEvent() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_triggerInfo, 16, 8);
+ return (TriggerEvent::Value)val;
+ }
+ void setTriggerEvent(TriggerEvent::Value val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 16, 8, (Uint32)val);
+ }
+ bool getMonitorReplicas() const {
+ return BitmaskImpl::getField(1, &m_triggerInfo, 24, 1);
+ }
+ void setMonitorReplicas(bool val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 24, 1, val);
+ }
+ bool getMonitorAllAttributes() const {
+ return BitmaskImpl::getField(1, &m_triggerInfo, 25, 1);
+ }
+ void setMonitorAllAttributes(bool val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 25, 1, val);
+ }
+ Uint32 getOnline() const {
+ return m_online;
+ }
+ void setOnline(Uint32 val) {
+ m_online = val;
+ }
+ Uint32 getReceiverRef() const {
+ return m_receiverRef;
+ }
+ void setReceiverRef(Uint32 val) {
+ m_receiverRef = val;
+ }
+ AttributeMask& getAttributeMask() {
+ return m_attributeMask;
+ }
+ const AttributeMask& getAttributeMask() const {
+ return m_attributeMask;
+ }
+ void clearAttributeMask() {
+ m_attributeMask.clear();
+ }
+ void setAttributeMask(const AttributeMask& val) {
+ m_attributeMask = val;
+ }
+ void setAttributeMask(Uint16 val) {
+ m_attributeMask.set(val);
+ }
+ Uint32 getOpKey() const {
+ return m_opKey;
+ }
+ void setOpKey(Uint32 val) {
+ m_opKey = val;
+ }
+};
+
+/**
+ * CreateTrigConf.
+ */
+class CreateTrigConf {
+ friend bool printCREATE_TRIG_CONF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( InternalLength = 3 );
+ STATIC_CONST( SignalLength = 7 );
+
+private:
+ Uint32 m_userRef;
+ Uint32 m_connectionPtr;
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_indexId;
+ Uint32 m_triggerId;
+ Uint32 m_triggerInfo; // BACKUP wants this
+
+public:
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ CreateTrigReq::RequestType getRequestType() const {
+ return (CreateTrigReq::RequestType)m_requestInfo;
+ }
+ void setRequestType(CreateTrigReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ Uint32 getIndexId() const {
+ return m_indexId;
+ }
+ void setIndexId(Uint32 val) {
+ m_indexId = val;
+ }
+ Uint32 getTriggerId() const {
+ return m_triggerId;
+ }
+ void setTriggerId(Uint32 val) {
+ m_triggerId = val;
+ }
+ Uint32 getTriggerInfo() const {
+ return m_triggerInfo;
+ }
+ void setTriggerInfo(Uint32 val) {
+ m_triggerInfo = val;
+ }
+ TriggerType::Value getTriggerType() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_triggerInfo, 0, 8);
+ return (TriggerType::Value)val;
+ }
+ void setTriggerType(TriggerType::Value val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 0, 8, (Uint32)val);
+ }
+ TriggerActionTime::Value getTriggerActionTime() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_triggerInfo, 8, 8);
+ return (TriggerActionTime::Value)val;
+ }
+ void setTriggerActionTime(TriggerActionTime::Value val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 8, 8, (Uint32)val);
+ }
+ TriggerEvent::Value getTriggerEvent() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_triggerInfo, 16, 8);
+ return (TriggerEvent::Value)val;
+ }
+ void setTriggerEvent(TriggerEvent::Value val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 16, 8, (Uint32)val);
+ }
+ bool getMonitorReplicas() const {
+ return BitmaskImpl::getField(1, &m_triggerInfo, 24, 1);
+ }
+ void setMonitorReplicas(bool val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 24, 1, val);
+ }
+ bool getMonitorAllAttributes() const {
+ return BitmaskImpl::getField(1, &m_triggerInfo, 25, 1);
+ }
+ void setMonitorAllAttributes(bool val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 25, 1, val);
+ }
+};
+
+/**
+ * CreateTrigRef.
+ */
+class CreateTrigRef {
+ friend bool printCREATE_TRIG_REF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum ErrorCode {
+ NoError = 0,
+ Busy = 701,
+ TriggerNameTooLong = 4236,
+ TooManyTriggers = 4237,
+ TriggerNotFound = 4238,
+ TriggerExists = 4239,
+ UnsupportedTriggerType = 4240,
+ BadRequestType = 4247,
+ InvalidName = 4248,
+ InvalidTable = 4249
+ };
+ STATIC_CONST( SignalLength = CreateTrigConf::SignalLength + 3 );
+
+private:
+ CreateTrigConf m_conf;
+ //Uint32 m_userRef;
+ //Uint32 m_connectionPtr;
+ //Uint32 m_requestInfo;
+ //Uint32 m_tableId;
+ //Uint32 m_indexId;
+ //Uint32 m_triggerId;
+ //Uint32 m_triggerInfo;
+ Uint32 m_errorCode;
+ Uint32 m_errorLine;
+ Uint32 m_errorNode;
+
+public:
+ CreateTrigConf* getConf() {
+ return &m_conf;
+ }
+ const CreateTrigConf* getConf() const {
+ return &m_conf;
+ }
+ Uint32 getUserRef() const {
+ return m_conf.getUserRef();
+ }
+ void setUserRef(Uint32 val) {
+ m_conf.setUserRef(val);
+ }
+ Uint32 getConnectionPtr() const {
+ return m_conf.getConnectionPtr();
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_conf.setConnectionPtr(val);
+ }
+ CreateTrigReq::RequestType getRequestType() const {
+ return m_conf.getRequestType();
+ }
+ void setRequestType(CreateTrigReq::RequestType val) {
+ m_conf.setRequestType(val);
+ }
+ Uint32 getTableId() const {
+ return m_conf.getTableId();
+ }
+ void setTableId(Uint32 val) {
+ m_conf.setTableId(val);
+ }
+ Uint32 getIndexId() const {
+ return m_conf.getIndexId();
+ }
+ void setIndexId(Uint32 val) {
+ m_conf.setIndexId(val);
+ }
+ Uint32 getTriggerId() const {
+ return m_conf.getTriggerId();
+ }
+ void setTriggerId(Uint32 val) {
+ m_conf.setTriggerId(val);
+ }
+ Uint32 getTriggerInfo() const {
+ return m_conf.getTriggerInfo();
+ }
+ void setTriggerInfo(Uint32 val) {
+ m_conf.setTriggerInfo(val);
+ }
+ TriggerType::Value getTriggerType() const {
+ return m_conf.getTriggerType();
+ }
+ void setTriggerType(TriggerType::Value val) {
+ m_conf.setTriggerType(val);
+ }
+ TriggerActionTime::Value getTriggerActionTime() const {
+ return m_conf.getTriggerActionTime();
+ }
+ void setTriggerActionTime(TriggerActionTime::Value val) {
+ m_conf.setTriggerActionTime(val);
+ }
+ TriggerEvent::Value getTriggerEvent() const {
+ return m_conf.getTriggerEvent();
+ }
+ void setTriggerEvent(TriggerEvent::Value val) {
+ m_conf.setTriggerEvent(val);
+ }
+ bool getMonitorReplicas() const {
+ return m_conf.getMonitorReplicas();
+ }
+ void setMonitorReplicas(bool val) {
+ m_conf.setMonitorReplicas(val);
+ }
+ bool getMonitorAllAttributes() const {
+ return m_conf.getMonitorAllAttributes();
+ }
+ void setMonitorAllAttributes(bool val) {
+ m_conf.setMonitorAllAttributes(val);
+ }
+ CreateTrigRef::ErrorCode getErrorCode() const {
+ return (CreateTrigRef::ErrorCode)m_errorCode;
+ }
+ void setErrorCode(CreateTrigRef::ErrorCode val) {
+ m_errorCode = (Uint32)val;
+ }
+ Uint32 getErrorLine() const {
+ return m_errorLine;
+ }
+ void setErrorLine(Uint32 val) {
+ m_errorLine = val;
+ }
+ Uint32 getErrorNode() const {
+ return m_errorNode;
+ }
+ void setErrorNode(Uint32 val) {
+ m_errorNode = val;
+ }
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DiAddTab.hpp b/ndb/include/kernel/signaldata/DiAddTab.hpp
new file mode 100644
index 00000000000..6b17515eb6f
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DiAddTab.hpp
@@ -0,0 +1,90 @@
+/* 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 DIADDTABREQ_HPP
+#define DIADDTABREQ_HPP
+
+#include "SignalData.hpp"
+
+class DiAddTabReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+public:
+ STATIC_CONST( SignalLength = 9 );
+ SECTION( FRAGMENTATION = 0 );
+
+private:
+ Uint32 connectPtr;
+ Uint32 tableId;
+ Uint32 fragType;
+ Uint32 kValue;
+ Uint32 noOfReplicas; //Currently not used
+ Uint32 storedTable;
+ Uint32 tableType;
+ Uint32 schemaVersion;
+ Uint32 primaryTableId;
+};
+
+class DiAddTabRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ union {
+ Uint32 connectPtr;
+ Uint32 senderData;
+ };
+ Uint32 errorCode;
+};
+
+class DiAddTabConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+private:
+ union {
+ Uint32 connectPtr;
+ Uint32 senderData;
+ };
+};
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DiGetNodes.hpp b/ndb/include/kernel/signaldata/DiGetNodes.hpp
new file mode 100644
index 00000000000..05ab6bfebb3
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DiGetNodes.hpp
@@ -0,0 +1,62 @@
+/* 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 DIGETNODES_HPP
+#define DIGETNODES_HPP
+
+#include <NodeBitmask.hpp>
+#include <ndb_limits.h>
+
+/**
+ *
+ */
+class DiGetNodesConf {
+ /**
+ * Receiver(s)
+ */
+ friend class Dbtc;
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+public:
+ STATIC_CONST( SignalLength = 3 + MAX_REPLICAS );
+private:
+ Uint32 zero;
+ Uint32 fragId;
+ Uint32 reqinfo;
+ Uint32 nodes[MAX_REPLICAS];
+};
+/**
+ *
+ */
+class DiGetNodesReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+public:
+ STATIC_CONST( SignalLength = 3 );
+private:
+ Uint32 notUsed;
+ Uint32 tableId;
+ Uint32 hashValue;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/DictSchemaInfo.hpp b/ndb/include/kernel/signaldata/DictSchemaInfo.hpp
new file mode 100644
index 00000000000..d7f82abc299
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DictSchemaInfo.hpp
@@ -0,0 +1,45 @@
+/* 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 DICT_SCHEMA_INFO_HPP
+#define DICT_SCHEMA_INFO_HPP
+
+#include "SignalData.hpp"
+
+class DictSchemaInfo {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdict;
+
+public:
+ static const unsigned HeaderLength = 3;
+ static const unsigned DataLength = 22;
+
+private:
+ Uint32 senderRef;
+ Uint32 offset;
+ Uint32 totalLen;
+
+ /**
+ * Length in this = signal->length() - 3
+ * Sender block ref = signal->senderBlockRef()
+ */
+
+ Uint32 schemaInfoData[22];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DictSizeAltReq.hpp b/ndb/include/kernel/signaldata/DictSizeAltReq.hpp
new file mode 100644
index 00000000000..b40f0c8c1af
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DictSizeAltReq.hpp
@@ -0,0 +1,51 @@
+/* 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 DICT_SIZE_ALT_REQ_H
+#define DICT_SIZE_ALT_REQ_H
+
+
+
+#include "SignalData.hpp"
+
+class DictSizeAltReq {
+ /**
+ * Sender(s)
+ */
+ friend class ClusterConfiguration;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbdict;
+private:
+ /**
+ * Indexes in theData
+ */
+ STATIC_CONST( IND_BLOCK_REF = 0 );
+ STATIC_CONST( IND_ATTRIBUTE = 1 );
+ STATIC_CONST( IND_CONNECT = 2 );
+ STATIC_CONST( IND_FRAG_CONNECT = 3 );
+ STATIC_CONST( IND_TABLE = 4 );
+ STATIC_CONST( IND_TC_CONNECT = 5 );
+
+ /**
+ * Use the index definitions to use the signal data
+ */
+ UintR theData[6];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DictStart.hpp b/ndb/include/kernel/signaldata/DictStart.hpp
new file mode 100644
index 00000000000..59310601f48
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DictStart.hpp
@@ -0,0 +1,54 @@
+/* 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 DICT_START_HPP
+#define DICT_START_HPP
+
+class DictStartReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+
+ Uint32 restartGci;
+ Uint32 senderRef;
+};
+
+class DictStartConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+
+public:
+private:
+
+ Uint32 startingNodeId;
+ Uint32 startWord;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/DictTabInfo.hpp b/ndb/include/kernel/signaldata/DictTabInfo.hpp
new file mode 100644
index 00000000000..791388d5df8
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DictTabInfo.hpp
@@ -0,0 +1,483 @@
+/* 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 DICT_TAB_INFO_HPP
+#define DICT_TAB_INFO_HPP
+
+#include "SignalData.hpp"
+#include <AttributeDescriptor.hpp>
+#include <SimpleProperties.hpp>
+#include <ndb_limits.h>
+#include <trigger_definitions.h>
+#include <NdbSqlUtil.hpp>
+
+#define DTIMAP(x, y, z) \
+ { DictTabInfo::y, offsetof(x, z), SimpleProperties::Uint32Value, 0, (~0), 0 }
+
+#define DTIMAP2(x, y, z, u, v) \
+ { DictTabInfo::y, offsetof(x, z), SimpleProperties::Uint32Value, u, v, 0 }
+
+#define DTIMAPS(x, y, z, u, v) \
+ { DictTabInfo::y, offsetof(x, z), SimpleProperties::StringValue, u, v, 0 }
+
+#define DTIMAPB(x, y, z, u, v, l) \
+ { DictTabInfo::y, offsetof(x, z), SimpleProperties::BinaryValue, u, v, \
+ offsetof(x, l) }
+
+#define DTIBREAK(x) \
+ { DictTabInfo::x, 0, SimpleProperties::InvalidValue, 0, 0 }
+
+class DictTabInfo {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ // Blocks
+ friend class Backup;
+ friend class Dbdict;
+ friend class Ndbcntr;
+ friend class Trix;
+ friend class DbUtil;
+ // API
+ friend class Table;
+ friend class NdbSchemaOp;
+
+ /**
+ * For printing
+ */
+ friend bool printDICTTABINFO(FILE * output,
+ const Uint32 * theData,
+ Uint32 len,
+ Uint16 receiverBlockNo);
+
+public:
+ enum RequestType {
+ CreateTableFromAPI = 1,
+ AddTableFromDict = 2, // Between DICT's
+ CopyTable = 3, // Between DICT's
+ ReadTableFromDiskSR = 4, // Local in DICT
+ GetTabInfoConf = 5,
+ AlterTableFromAPI = 6
+ };
+
+ enum KeyValues {
+ TableName = 1, // String, Mandatory
+ TableId = 2, //Mandatory between DICT's otherwise not allowed
+ TableVersion = 3, //Mandatory between DICT's otherwise not allowed
+ TableLoggedFlag = 4, //Default Logged
+ NoOfKeyAttr = 5, //Default 1
+ NoOfAttributes = 6, //Mandatory
+ NoOfNullable = 7, //Deafult 0
+ NoOfVariable = 8, //Default 0
+ TableKValue = 9, //Default 6
+ MinLoadFactor = 10, //Default 70
+ MaxLoadFactor = 11, //Default 80
+ KeyLength = 12, //Default 1 (No of words in primary key)
+ FragmentTypeVal = 13, //Default AllNodesSmallTable
+ TableStorageVal = 14, //Default StorageType::MainMemory
+ ScanOptimised = 15, //Default updateOptimised
+ FragmentKeyTypeVal = 16, //Default PrimaryKey
+ SecondTableId = 17, //Mandatory between DICT's otherwise not allowed
+ TableTypeVal = 18, //Default TableType::UserTable
+ PrimaryTable = 19, //Mandatory for index otherwise RNIL
+ PrimaryTableId = 20, //ditto
+ IndexState = 21,
+ InsertTriggerId = 22,
+ UpdateTriggerId = 23,
+ DeleteTriggerId = 24,
+ CustomTriggerId = 25,
+ FrmLen = 26,
+ FrmData = 27,
+ TableEnd = 999,
+
+ AttributeName = 1000, // String, Mandatory
+ AttributeId = 1001, //Mandatory between DICT's otherwise not allowed
+ AttributeType = 1002, //Default UnSignedType
+ AttributeSize = 1003, //Default DictTabInfo::a32Bit
+ AttributeArraySize = 1005, //Default 1
+ AttributeKeyFlag = 1006, //Default noKey
+ AttributeStorage = 1007, //Default MainMemory
+ AttributeNullableFlag = 1008, //Default NotNullable
+ AttributeDGroup = 1009, //Default NotDGroup
+ AttributeDKey = 1010, //Default NotDKey
+ AttributeStoredInd = 1011, //Default NotStored
+ AttributeGroup = 1012, //Default 0
+ AttributeExtType = 1013, //Default 0 (undefined)
+ AttributeExtPrecision = 1014, //Default 0
+ AttributeExtScale = 1015, //Default 0
+ AttributeExtLength = 1016, //Default 0
+ AttributeAutoIncrement = 1017, //Default false
+ AttributeDefaultValue = 1018, //Default value (printable string)
+ AttributeEnd = 1999 //
+ };
+ // ----------------------------------------------------------------------
+ // Part of the protocol is that we only transfer parameters which do not
+ // have a default value. Thus the default values are part of the protocol.
+ // ----------------------------------------------------------------------
+
+ // FragmentKeyType constants
+ enum FragmentKeyType {
+ PrimaryKey = 0,
+ DistributionKey = 1,
+ DistributionGroup = 2
+ };
+
+ // FragmentType constants
+ enum FragmentType {
+ AllNodesSmallTable = 0,
+ AllNodesMediumTable = 1,
+ AllNodesLargeTable = 2,
+ SingleFragment = 3
+ };
+
+ // TableStorage AND AttributeStorage constants
+ enum StorageType {
+ MainMemory = 0,
+ DiskMemory = 1
+ };
+
+ // TableType constants + objects
+ enum TableType {
+ UndefTableType = 0,
+ SystemTable = 1,
+ UserTable = 2,
+ UniqueHashIndex = 3,
+ HashIndex = 4,
+ UniqueOrderedIndex = 5,
+ OrderedIndex = 6,
+ // constant 10 hardcoded in Dbdict.cpp
+ HashIndexTrigger = 10 + TriggerType::SECONDARY_INDEX,
+ SubscriptionTrigger = 10 + TriggerType::SUBSCRIPTION,
+ ReadOnlyConstraint = 10 + TriggerType::READ_ONLY_CONSTRAINT,
+ IndexTrigger = 10 + TriggerType::ORDERED_INDEX
+ };
+ static inline bool
+ isTable(int tableType) {
+ return
+ tableType == SystemTable ||
+ tableType == UserTable;
+ }
+ static inline bool
+ isIndex(int tableType) {
+ return
+ tableType == UniqueHashIndex ||
+ tableType == HashIndex ||
+ tableType == UniqueOrderedIndex ||
+ tableType == OrderedIndex;
+ }
+ static inline bool
+ isUniqueIndex(int tableType) {
+ return
+ tableType == UniqueHashIndex ||
+ tableType == UniqueOrderedIndex;
+ }
+ static inline bool
+ isNonUniqueIndex(int tableType) {
+ return
+ tableType == HashIndex ||
+ tableType == OrderedIndex;
+ }
+ static inline bool
+ isHashIndex(int tableType) {
+ return
+ tableType == UniqueHashIndex ||
+ tableType == HashIndex;
+ }
+ static inline bool
+ isOrderedIndex(int tableType) {
+ return
+ tableType == UniqueOrderedIndex ||
+ tableType == OrderedIndex;
+ }
+
+ // Object state for translating from/to API
+ enum ObjectState {
+ StateUndefined = 0,
+ StateOffline = 1,
+ StateBuilding = 2,
+ StateDropping = 3,
+ StateOnline = 4,
+ StateBroken = 9
+ };
+
+ // Object store for translating from/to API
+ enum ObjectStore {
+ StoreUndefined = 0,
+ StoreTemporary = 1,
+ StorePermanent = 2
+ };
+
+ // ScanOptimised constants
+ static const unsigned updateOptimised = 0;
+ static const unsigned scanOptimised = 1;
+
+ // AttributeType constants
+ static const unsigned SignedType = 0;
+ static const unsigned UnSignedType = 1;
+ static const unsigned FloatingPointType = 2;
+ static const unsigned StringType = 3;
+
+ // AttributeSize constants
+ static const unsigned an8Bit = 3;
+ static const unsigned a16Bit = 4;
+ static const unsigned a32Bit = 5;
+ static const unsigned a64Bit = 6;
+ static const unsigned a128Bit = 7;
+
+ // AttributeDGroup constants
+ static const unsigned NotDGroup = 0;
+ static const unsigned DGroup = 1;
+
+ // AttributeDKey constants
+ static const unsigned NotDKey = 0;
+ static const unsigned DKey = 1;
+
+ // AttributeStoredInd constants
+ static const unsigned NotStored = 0;
+ static const unsigned Stored = 1;
+
+ // Table data interpretation
+ struct Table {
+ char TableName[MAX_TAB_NAME_SIZE];
+ Uint32 TableId;
+ Uint32 SecondTableId;
+ char PrimaryTable[MAX_TAB_NAME_SIZE]; // Only used when "index"
+ Uint32 PrimaryTableId;
+ Uint32 TableLoggedFlag;
+ Uint32 NoOfKeyAttr;
+ Uint32 NoOfAttributes;
+ Uint32 NoOfNullable;
+ Uint32 NoOfVariable;
+ Uint32 TableKValue;
+ Uint32 MinLoadFactor;
+ Uint32 MaxLoadFactor;
+ Uint32 KeyLength;
+ Uint32 FragmentType;
+ Uint32 TableStorage;
+ Uint32 ScanOptimised;
+ Uint32 FragmentKeyType;
+ Uint32 TableType;
+ Uint32 TableVersion;
+ Uint32 IndexState;
+ Uint32 InsertTriggerId;
+ Uint32 UpdateTriggerId;
+ Uint32 DeleteTriggerId;
+ Uint32 CustomTriggerId;
+ Uint32 FrmLen;
+ char FrmData[MAX_FRM_DATA_SIZE];
+
+ void init();
+ };
+
+ static const
+ SimpleProperties::SP2StructMapping TableMapping[];
+
+ static const Uint32 TableMappingSize;
+
+ // AttributeExtType values
+ enum ExtType {
+ ExtUndefined = NdbSqlUtil::Type::Undefined,
+ ExtTinyint = NdbSqlUtil::Type::Tinyint,
+ ExtTinyunsigned = NdbSqlUtil::Type::Tinyunsigned,
+ ExtSmallint = NdbSqlUtil::Type::Smallint,
+ ExtSmallunsigned = NdbSqlUtil::Type::Smallunsigned,
+ ExtMediumint = NdbSqlUtil::Type::Mediumint,
+ ExtMediumunsigned = NdbSqlUtil::Type::Mediumunsigned,
+ ExtInt = NdbSqlUtil::Type::Int,
+ ExtUnsigned = NdbSqlUtil::Type::Unsigned,
+ ExtBigint = NdbSqlUtil::Type::Bigint,
+ ExtBigunsigned = NdbSqlUtil::Type::Bigunsigned,
+ ExtFloat = NdbSqlUtil::Type::Float,
+ ExtDouble = NdbSqlUtil::Type::Double,
+ ExtDecimal = NdbSqlUtil::Type::Decimal,
+ ExtChar = NdbSqlUtil::Type::Char,
+ ExtVarchar = NdbSqlUtil::Type::Varchar,
+ ExtBinary = NdbSqlUtil::Type::Binary,
+ ExtVarbinary = NdbSqlUtil::Type::Varbinary,
+ ExtDatetime = NdbSqlUtil::Type::Datetime,
+ ExtTimespec = NdbSqlUtil::Type::Timespec
+ };
+
+ // Attribute data interpretation
+ struct Attribute {
+ char AttributeName[MAX_TAB_NAME_SIZE];
+ Uint32 AttributeId;
+ Uint32 AttributeType;
+ Uint32 AttributeSize;
+ Uint32 AttributeArraySize;
+ Uint32 AttributeKeyFlag;
+ Uint32 AttributeStorage;
+ Uint32 AttributeNullableFlag;
+ Uint32 AttributeDGroup;
+ Uint32 AttributeDKey;
+ Uint32 AttributeStoredInd;
+ Uint32 AttributeGroup;
+ Uint32 AttributeExtType;
+ Uint32 AttributeExtPrecision;
+ Uint32 AttributeExtScale;
+ Uint32 AttributeExtLength;
+ Uint32 AttributeAutoIncrement;
+ char AttributeDefaultValue[MAX_ATTR_DEFAULT_VALUE_SIZE];
+
+ void init();
+
+ inline
+ Uint32 sizeInWords()
+ {
+ return ((1 << AttributeSize) * AttributeArraySize + 31) >> 5;
+ }
+
+ // translate to old kernel types and sizes
+ inline bool
+ translateExtType() {
+ switch (AttributeExtType) {
+ case DictTabInfo::ExtUndefined:
+ break;
+ case DictTabInfo::ExtTinyint:
+ AttributeType = DictTabInfo::SignedType;
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtTinyunsigned:
+ AttributeType = DictTabInfo::UnSignedType;
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtSmallint:
+ AttributeType = DictTabInfo::SignedType;
+ AttributeSize = DictTabInfo::a16Bit;
+ AttributeArraySize = AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtSmallunsigned:
+ AttributeType = DictTabInfo::UnSignedType;
+ AttributeSize = DictTabInfo::a16Bit;
+ AttributeArraySize = AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtMediumint:
+ AttributeType = DictTabInfo::SignedType;
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 3 * AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtMediumunsigned:
+ AttributeType = DictTabInfo::UnSignedType;
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 3 * AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtInt:
+ AttributeType = DictTabInfo::SignedType;
+ AttributeSize = DictTabInfo::a32Bit;
+ AttributeArraySize = AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtUnsigned:
+ AttributeType = DictTabInfo::UnSignedType;
+ AttributeSize = DictTabInfo::a32Bit;
+ AttributeArraySize = AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtBigint:
+ AttributeType = DictTabInfo::SignedType;
+ AttributeSize = DictTabInfo::a64Bit;
+ AttributeArraySize = AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtBigunsigned:
+ AttributeType = DictTabInfo::UnSignedType;
+ AttributeSize = DictTabInfo::a64Bit;
+ AttributeArraySize = AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtFloat:
+ AttributeType = DictTabInfo::FloatingPointType;
+ AttributeSize = DictTabInfo::a32Bit;
+ AttributeArraySize = AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtDouble:
+ AttributeType = DictTabInfo::FloatingPointType;
+ AttributeSize = DictTabInfo::a64Bit;
+ AttributeArraySize = AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtDecimal:
+ // not yet implemented anywhere
+ break;
+ case DictTabInfo::ExtChar:
+ case DictTabInfo::ExtBinary:
+ AttributeType = DictTabInfo::StringType;
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtVarchar:
+ case DictTabInfo::ExtVarbinary:
+ AttributeType = DictTabInfo::StringType;
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = AttributeExtLength + 2;
+ return true;
+ case DictTabInfo::ExtDatetime:
+ AttributeType = DictTabInfo::StringType;
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 8 * AttributeExtLength;
+ return true;
+ case DictTabInfo::ExtTimespec:
+ AttributeType = DictTabInfo::StringType;
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 12 * AttributeExtLength;
+ return true;
+ };
+ return false;
+ }
+
+ inline void print(FILE *out) {
+ fprintf(out, "AttributeId = %d\n", AttributeId);
+ fprintf(out, "AttributeType = %d\n", AttributeType);
+ fprintf(out, "AttributeSize = %d\n", AttributeSize);
+ fprintf(out, "AttributeArraySize = %d\n", AttributeArraySize);
+ fprintf(out, "AttributeKeyFlag = %d\n", AttributeKeyFlag);
+ fprintf(out, "AttributeStorage = %d\n", AttributeStorage);
+ fprintf(out, "AttributeNullableFlag = %d\n", AttributeNullableFlag);
+ fprintf(out, "AttributeDGroup = %d\n", AttributeDGroup);
+ fprintf(out, "AttributeDKey = %d\n", AttributeDKey);
+ fprintf(out, "AttributeStoredInd = %d\n", AttributeStoredInd);
+ fprintf(out, "AttributeGroup = %d\n", AttributeGroup);
+ fprintf(out, "AttributeAutoIncrement = %d\n", AttributeAutoIncrement);
+ fprintf(out, "AttributeExtType = %d\n", AttributeExtType);
+ fprintf(out, "AttributeExtPrecision = %d\n", AttributeExtPrecision);
+ fprintf(out, "AttributeExtScale = %d\n", AttributeExtScale);
+ fprintf(out, "AttributeExtLength = %d\n", AttributeExtLength);
+ fprintf(out, "AttributeDefaultValue = \"%s\"\n",
+ AttributeDefaultValue ? AttributeDefaultValue : "");
+ }
+ };
+
+ static const
+ SimpleProperties::SP2StructMapping AttributeMapping[];
+
+ static const Uint32 AttributeMappingSize;
+
+ // Signal constants
+ STATIC_CONST( DataLength = 20 );
+ STATIC_CONST( HeaderLength = 5 );
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 requestType;
+ Uint32 totalLen;
+ Uint32 offset;
+
+ /**
+ * Length of this data = signal->length() - HeaderLength
+ * Sender block ref = signal->senderBlockRef()
+ */
+
+ Uint32 tabInfoData[DataLength];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DihAddFrag.hpp b/ndb/include/kernel/signaldata/DihAddFrag.hpp
new file mode 100644
index 00000000000..6e5a24ee413
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DihAddFrag.hpp
@@ -0,0 +1,62 @@
+/* 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 DIHADDFRAG_HPP
+#define DIHADDFRAG_HPP
+
+#include <NodeBitmask.hpp>
+#include <ndb_limits.h>
+
+/**
+ *
+ */
+class DihAddFragConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+ Uint32 senderNodeId;
+ Uint32 tableId;
+};
+/**
+ *
+ */
+class DihAddFragReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 10 + MAX_REPLICAS );
+private:
+ Uint32 masterRef;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 kValue;
+ Uint32 method;
+ Uint32 mask;
+ Uint32 hashPointer;
+ Uint32 noOfFragments;
+ Uint32 noOfBackups;
+ Uint32 storedTable;
+ Uint32 nodes[MAX_REPLICAS];
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/DihContinueB.hpp b/ndb/include/kernel/signaldata/DihContinueB.hpp
new file mode 100644
index 00000000000..e683b55351c
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DihContinueB.hpp
@@ -0,0 +1,75 @@
+/* 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 DIH_CONTINUEB_H
+#define DIH_CONTINUEB_H
+
+#include "SignalData.hpp"
+
+class DihContinueB {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Dbdih;
+ friend bool printCONTINUEB_DBDIH(FILE * output, const Uint32 * theData, Uint32 len);
+private:
+ enum Type {
+ ZPACK_TABLE_INTO_PAGES = 1,
+ ZPACK_FRAG_INTO_PAGES = 2,
+ ZREAD_PAGES_INTO_TABLE = 3,
+ ZREAD_PAGES_INTO_FRAG = 4,
+ //ZREAD_TAB_DESCRIPTION = 5,
+ ZCOPY_TABLE = 6,
+ ZCOPY_TABLE_NODE = 7,
+ ZSTART_FRAGMENT = 8,
+ ZCOMPLETE_RESTART = 9,
+ ZREAD_TABLE_FROM_PAGES = 10,
+ ZSR_PHASE2_READ_TABLE = 11,
+ ZCHECK_TC_COUNTER = 12,
+ ZCALCULATE_KEEP_GCI = 13,
+ ZSTORE_NEW_LCP_ID = 14,
+ ZTABLE_UPDATE = 15,
+ ZCHECK_LCP_COMPLETED = 16,
+ ZINIT_LCP = 17,
+ ZADD_TABLE_MASTER_PAGES = 19,
+ ZDIH_ADD_TABLE_MASTER = 20,
+ ZADD_TABLE_SLAVE_PAGES = 21,
+ ZDIH_ADD_TABLE_SLAVE = 22,
+ ZSTART_GCP = 23,
+ ZCOPY_GCI = 24,
+ ZEMPTY_VERIFY_QUEUE = 25,
+ ZCHECK_GCP_STOP = 26,
+ ZREMOVE_NODE_FROM_TABLE = 27,
+ ZCOPY_NODE = 28,
+ ZSTART_TAKE_OVER = 29,
+ ZCHECK_START_TAKE_OVER = 30,
+ ZTO_START_COPY_FRAG = 31,
+ ZINITIALISE_RECORDS = 33,
+ ZINVALIDATE_NODE_LCP = 34,
+ ZSTART_PERMREQ_AGAIN = 35,
+ SwitchReplica = 36,
+ ZSEND_START_TO = 37,
+ ZSEND_ADD_FRAG = 38,
+ ZSEND_CREATE_FRAG = 39,
+ ZSEND_UPDATE_TO = 40,
+ ZSEND_END_TO = 41,
+
+ WAIT_DROP_TAB_WRITING_TO_FILE = 42,
+ CHECK_WAIT_DROP_TAB_FAILED_LQH = 43
+ };
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DihSizeAltReq.hpp b/ndb/include/kernel/signaldata/DihSizeAltReq.hpp
new file mode 100644
index 00000000000..73279447859
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DihSizeAltReq.hpp
@@ -0,0 +1,50 @@
+/* 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 DIH_SIZE_ALT_REQ_H
+#define DIH_SIZE_ALT_REQ_H
+
+#include "SignalData.hpp"
+
+class DihSizeAltReq {
+ /**
+ * Sender(s)
+ */
+ friend class ClusterConfiguration;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbdih;
+private:
+ /**
+ * Indexes in theData
+ */
+ STATIC_CONST( IND_BLOCK_REF = 0 );
+ STATIC_CONST( IND_API_CONNECT = 1 );
+ STATIC_CONST( IND_CONNECT = 2 );
+ STATIC_CONST( IND_FRAG_CONNECT = 3 );
+ STATIC_CONST( IND_MORE_NODES = 4 );
+ STATIC_CONST( IND_REPLICAS = 5 );
+ STATIC_CONST( IND_TABLE = 6 );
+
+ /**
+ * Use the index definitions to use the signal data
+ */
+ UintR theData[7];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DihStartTab.hpp b/ndb/include/kernel/signaldata/DihStartTab.hpp
new file mode 100644
index 00000000000..75443e6070e
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DihStartTab.hpp
@@ -0,0 +1,65 @@
+/* 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 DIH_STARTTAB__HPP
+#define DIH_STARTTAB__HPP
+
+#include "SignalData.hpp"
+
+class DihStartTabReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+public:
+ STATIC_CONST( HeaderLength = 3 );
+
+private:
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 noOfTables;
+
+ struct {
+ Uint32 tableId;
+ Uint32 schemaVersion;
+ } tables[10];
+};
+
+class DihStartTabConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DihSwitchReplica.hpp b/ndb/include/kernel/signaldata/DihSwitchReplica.hpp
new file mode 100644
index 00000000000..d4212f510f3
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DihSwitchReplica.hpp
@@ -0,0 +1,72 @@
+/* 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 DIH_SWITCH_REPLICA_HPP
+#define DIH_SWITCH_REPLICA_HPP
+
+/**
+ * This signal is sent from master DIH to all DIH's
+ * switches primary / backup nodes for replica(s)
+ *
+ */
+class DihSwitchReplicaReq {
+ /**
+ * Sender/Reciver
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 4 + MAX_REPLICAS );
+
+private:
+ /**
+ * Request Info
+ *
+ */
+ Uint32 senderRef;
+ Uint32 tableId;
+ Uint32 fragNo;
+ Uint32 noOfReplicas;
+ Uint32 newNodeOrder[MAX_REPLICAS];
+};
+
+class DihSwitchReplicaRef {
+ /**
+ * Sender/Reciver
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 senderNode;
+ Uint32 errorCode; // See StopPermRef::ErrorCode
+};
+
+class DihSwitchReplicaConf {
+ /**
+ * Sender/Reciver
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+private:
+ Uint32 senderNode;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/DisconnectRep.hpp b/ndb/include/kernel/signaldata/DisconnectRep.hpp
new file mode 100644
index 00000000000..d7fcdc4fb35
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DisconnectRep.hpp
@@ -0,0 +1,61 @@
+/* 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 DISCONNECT_REP_HPP
+#define DISCONNECT_REP_HPP
+
+#include "SignalData.hpp"
+
+/**
+ *
+ */
+class DisconnectRep {
+ /**
+ * Receiver(s)
+ */
+ friend class Qmgr;
+ friend class Cmvmi; // Cmvmi
+
+ /**
+ * Senders
+ */
+ friend class Dbtc;
+ friend void reportDisconnect(void * , NodeId, Uint32); // TransporterCallback
+
+ /**
+ * For printing
+ */
+ friend bool printDISCONNECT_REP(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ enum ErrCode {
+ // ErrorCodes come from different sources
+ // for example TransporterCallback.hpp
+ // or inet errno
+ // This one is selected not to conflict with any of them
+ TcReportNodeFailed = 0xFF000001
+ };
+
+private:
+
+ Uint32 nodeId;
+ Uint32 err;
+};
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DropIndx.hpp b/ndb/include/kernel/signaldata/DropIndx.hpp
new file mode 100644
index 00000000000..0c0cf31aec8
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DropIndx.hpp
@@ -0,0 +1,253 @@
+/* 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 DROP_INDX_HPP
+#define DROP_INDX_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+
+/**
+ * DropIndxReq.
+ */
+class DropIndxReq {
+ friend bool printDROP_INDX_REQ(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum RequestType {
+ RT_UNDEFINED = 0,
+ RT_USER = 1,
+ RT_DICT_PREPARE = 1 << 4,
+ RT_DICT_COMMIT = 0xC << 4,
+ RT_DICT_ABORT = 0xF << 4,
+ RT_TC = 5 << 8
+ };
+ STATIC_CONST( SignalLength = 6 );
+
+private:
+ Uint32 m_connectionPtr;
+ Uint32 m_userRef;
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_indexId;
+ Uint32 m_indexVersion;
+ // extra
+ Uint32 m_opKey;
+
+public:
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ DropIndxReq::RequestType getRequestType() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 0, 16);
+ return (DropIndxReq::RequestType)val;
+ }
+ void setRequestType(DropIndxReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getRequestFlag() const {
+ return BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ };
+ void addRequestFlag(Uint32 val) {
+ val |= BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ BitmaskImpl::setField(1, &m_requestInfo, 16, 16, val);
+ };
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ Uint32 getIndexId() const {
+ return m_indexId;
+ }
+ void setIndexId(Uint32 val) {
+ m_indexId = val;
+ }
+ Uint32 getIndexVersion() const {
+ return m_indexVersion;
+ }
+ void setIndexVersion(Uint32 val) {
+ m_indexVersion = val;
+ }
+ Uint32 getOpKey() const {
+ return m_opKey;
+ }
+ void setOpKey(Uint32 val) {
+ m_opKey = val;
+ }
+};
+
+/**
+ * DropIndxConf.
+ */
+class DropIndxConf {
+ friend bool printDROP_INDX_CONF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( InternalLength = 3 );
+ STATIC_CONST( SignalLength = 6 );
+
+private:
+ Uint32 m_connectionPtr;
+ Uint32 m_userRef;
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_indexId;
+ Uint32 m_indexVersion;
+
+public:
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ DropIndxReq::RequestType getRequestType() const {
+ return (DropIndxReq::RequestType)m_requestInfo;
+ }
+ void setRequestType(DropIndxReq::RequestType val) {
+ m_requestInfo = val;
+ }
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ Uint32 getIndexId() const {
+ return m_indexId;
+ }
+ void setIndexId(Uint32 val) {
+ m_indexId = val;
+ }
+ Uint32 getIndexVersion() const {
+ return m_indexVersion;
+ }
+ void setIndexVersion(Uint32 val) {
+ m_indexVersion = val;
+ }
+};
+
+/**
+ * DropIndxRef.
+ */
+class DropIndxRef {
+ friend bool printDROP_INDX_REF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum ErrorCode {
+ NoError = 0,
+ InvalidIndexVersion = 241,
+ Busy = 701,
+ IndexNotFound = 4243,
+ BadRequestType = 4247,
+ InvalidName = 4248,
+ NotAnIndex = 4254
+ };
+ STATIC_CONST( SignalLength = DropIndxConf::SignalLength + 3 );
+
+private:
+ DropIndxConf m_conf;
+ //Uint32 m_userRef;
+ //Uint32 m_connectionPtr;
+ //Uint32 m_requestInfo;
+ //Uint32 m_tableId;
+ //Uint32 m_indexId;
+ //Uint32 m_indexVersion;
+ Uint32 m_errorCode;
+ Uint32 m_errorLine;
+ Uint32 m_errorNode;
+
+public:
+ DropIndxConf* getConf() {
+ return &m_conf;
+ }
+ const DropIndxConf* getConf() const {
+ return &m_conf;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_conf.getConnectionPtr();
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_conf.setConnectionPtr(val);
+ }
+ Uint32 getUserRef() const {
+ return m_conf.getUserRef();
+ }
+ void setUserRef(Uint32 val) {
+ m_conf.setUserRef(val);
+ }
+ DropIndxReq::RequestType getRequestType() const {
+ return m_conf.getRequestType();
+ }
+ void setRequestType(DropIndxReq::RequestType val) {
+ m_conf.setRequestType(val);
+ }
+ Uint32 getTableId() const {
+ return m_conf.getTableId();
+ }
+ void setTableId(Uint32 val) {
+ m_conf.setTableId(val);
+ }
+ Uint32 getIndexId() const {
+ return m_conf.getIndexId();
+ }
+ void setIndexId(Uint32 val) {
+ m_conf.setIndexId(val);
+ }
+ Uint32 getIndexVersion() const {
+ return m_conf.getIndexVersion();
+ }
+ void setIndexVersion(Uint32 val) {
+ m_conf.setIndexVersion(val);
+ }
+ DropIndxRef::ErrorCode getErrorCode() const {
+ return (DropIndxRef::ErrorCode)m_errorCode;
+ }
+ void setErrorCode(DropIndxRef::ErrorCode val) {
+ m_errorCode = (Uint32)val;
+ }
+ Uint32 getErrorLine() const {
+ return m_errorLine;
+ }
+ void setErrorLine(Uint32 val) {
+ m_errorLine = val;
+ }
+ Uint32 getErrorNode() const {
+ return m_errorNode;
+ }
+ void setErrorNode(Uint32 val) {
+ m_errorNode = val;
+ }
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DropTab.hpp b/ndb/include/kernel/signaldata/DropTab.hpp
new file mode 100644
index 00000000000..906f952d852
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DropTab.hpp
@@ -0,0 +1,114 @@
+/* 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 DROP_TAB_HPP
+#define DROP_TAB_HPP
+
+#include "SignalData.hpp"
+
+class DropTabReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbtc;
+ friend class Dblqh;
+ friend class Dbacc;
+ friend class Dbtup;
+ friend class Dbtux;
+ friend class Dbdih;
+
+ friend bool printDROP_TAB_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ enum RequestType {
+ OnlineDropTab = 0,
+ CreateTabDrop = 1,
+ RestartDropTab = 2
+ };
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 tableId;
+ Uint32 requestType;
+};
+
+class DropTabConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+ friend class Dblqh;
+ friend class Dbacc;
+ friend class Dbtup;
+ friend class Dbtux;
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+ friend bool printDROP_TAB_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 tableId;
+};
+
+class DropTabRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+ friend class Dblqh;
+ friend class Dbacc;
+ friend class Dbtup;
+ friend class Dbtux;
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+ friend bool printDROP_TAB_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ enum ErrorCode {
+ NoSuchTable = 1,
+ DropWoPrep = 2, // Calling Drop with first calling PrepDrop
+ PrepDropInProgress = 3,
+ DropInProgress = 4
+ };
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 tableId;
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DropTabFile.hpp b/ndb/include/kernel/signaldata/DropTabFile.hpp
new file mode 100644
index 00000000000..9ae4dae41c1
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DropTabFile.hpp
@@ -0,0 +1,64 @@
+/* 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 DROP_TABFILE_HPP
+#define DROP_TABFILE_HPP
+
+#include "SignalData.hpp"
+
+class DropTabFileReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+ friend class Dbacc;
+ friend class Dbtup;
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 userPtr;
+ Uint32 userRef;
+ Uint32 primaryTableId;
+ Uint32 secondaryTableId;
+};
+class DropTabFileConf {
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+ friend class Dbacc;
+ friend class Dbtup;
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 userPtr;
+ Uint32 senderRef;
+ Uint32 nodeId;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DropTable.hpp b/ndb/include/kernel/signaldata/DropTable.hpp
new file mode 100644
index 00000000000..7a5b96e4cd1
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DropTable.hpp
@@ -0,0 +1,80 @@
+/* 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 DROP_TABLE_HPP
+#define DROP_TABLE_HPP
+
+#include "SignalData.hpp"
+
+class DropTableReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdict;
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+public:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 tableId;
+ Uint32 tableVersion;
+};
+
+class DropTableRef {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdict;
+
+public:
+ STATIC_CONST( SignalLength = 6 );
+
+public:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 tableId;
+ Uint32 tableVersion;
+ Uint32 errorCode;
+ Uint32 masterNodeId;
+
+ enum ErrorCode {
+ Busy = 701,
+ NotMaster = 702,
+ NoSuchTable = 709,
+ InvalidTableVersion = 241,
+ DropInProgress = 283,
+ NoDropTableRecordAvailable = 1229
+ };
+};
+
+class DropTableConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdict;
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+public:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 tableId;
+ Uint32 tableVersion;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DropTrig.hpp b/ndb/include/kernel/signaldata/DropTrig.hpp
new file mode 100644
index 00000000000..7c5049f3de8
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DropTrig.hpp
@@ -0,0 +1,300 @@
+/* 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 DROP_TRIG_HPP
+#define DROP_TRIG_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+#include <trigger_definitions.h>
+
+/**
+ * DropTrigReq.
+ */
+class DropTrigReq {
+ friend bool printDROP_TRIG_REQ(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum RequestType {
+ RT_UNDEFINED = 0,
+ RT_USER = 1,
+ RT_ALTER_INDEX = 2,
+ RT_BUILD_INDEX = 3,
+ RT_DICT_PREPARE = 1 << 4,
+ RT_DICT_COMMIT = 0xC << 4,
+ RT_DICT_ABORT = 0xF << 4,
+ RT_TC = 5 << 8,
+ RT_LQH = 6 << 8
+ };
+ STATIC_CONST( SignalLength = 7 );
+ SECTION( TRIGGER_NAME_SECTION = 0 ); // optional
+ enum KeyValues {
+ TriggerNameKey = 0xa1
+ };
+
+private:
+ Uint32 m_userRef;
+ Uint32 m_connectionPtr;
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_indexId; // set by DICT if index trigger
+ Uint32 m_triggerId; // set by DICT based on name
+ Uint32 m_triggerInfo; // only for TUP
+ // extra
+ Uint32 m_opKey;
+
+public:
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ DropTrigReq::RequestType getRequestType() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 0, 16);
+ return (DropTrigReq::RequestType)val;
+ }
+ void setRequestType(DropTrigReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getRequestFlag() const {
+ return BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ };
+ void addRequestFlag(Uint32 val) {
+ val |= BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
+ BitmaskImpl::setField(1, &m_requestInfo, 16, 16, val);
+ };
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ Uint32 getIndexId() const {
+ return m_indexId;
+ }
+ void setIndexId(Uint32 val) {
+ m_indexId = val;
+ }
+ Uint32 getTriggerId() const {
+ return m_triggerId;
+ }
+ void setTriggerId(Uint32 val) {
+ m_triggerId = val;
+ }
+ Uint32 getTriggerInfo() const {
+ return m_triggerInfo;
+ }
+ void setTriggerInfo(Uint32 val) {
+ m_triggerInfo = val;
+ }
+ TriggerType::Value getTriggerType() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_triggerInfo, 0, 8);
+ return (TriggerType::Value)val;
+ }
+ void setTriggerType(TriggerType::Value val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 0, 8, (Uint32)val);
+ }
+ TriggerActionTime::Value getTriggerActionTime() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_triggerInfo, 8, 8);
+ return (TriggerActionTime::Value)val;
+ }
+ void setTriggerActionTime(TriggerActionTime::Value val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 8, 8, (Uint32)val);
+ }
+ TriggerEvent::Value getTriggerEvent() const {
+ const Uint32 val = BitmaskImpl::getField(1, &m_triggerInfo, 16, 8);
+ return (TriggerEvent::Value)val;
+ }
+ void setTriggerEvent(TriggerEvent::Value val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 16, 8, (Uint32)val);
+ }
+ bool getMonitorReplicas() const {
+ return BitmaskImpl::getField(1, &m_triggerInfo, 24, 1);
+ }
+ void setMonitorReplicas(bool val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 24, 1, val);
+ }
+ bool getMonitorAllAttributes() const {
+ return BitmaskImpl::getField(1, &m_triggerInfo, 25, 1);
+ }
+ void setMonitorAllAttributes(bool val) {
+ BitmaskImpl::setField(1, &m_triggerInfo, 25, 1, val);
+ }
+ Uint32 getOpKey() const {
+ return m_opKey;
+ }
+ void setOpKey(Uint32 val) {
+ m_opKey = val;
+ }
+};
+
+/**
+ * DropTrigConf.
+ */
+class DropTrigConf {
+ friend bool printDROP_TRIG_CONF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ STATIC_CONST( InternalLength = 3 );
+ STATIC_CONST( SignalLength = 6 );
+
+private:
+ Uint32 m_userRef;
+ Uint32 m_connectionPtr;
+ Uint32 m_requestInfo;
+ Uint32 m_tableId;
+ Uint32 m_indexId;
+ Uint32 m_triggerId;
+
+ // Public methods
+public:
+ Uint32 getUserRef() const {
+ return m_userRef;
+ }
+ void setUserRef(Uint32 val) {
+ m_userRef = val;
+ }
+ Uint32 getConnectionPtr() const {
+ return m_connectionPtr;
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_connectionPtr = val;
+ }
+ DropTrigReq::RequestType getRequestType() const {
+ return (DropTrigReq::RequestType)m_requestInfo;
+ }
+ void setRequestType(DropTrigReq::RequestType val) {
+ m_requestInfo = (Uint32)val;
+ }
+ Uint32 getTableId() const {
+ return m_tableId;
+ }
+ void setTableId(Uint32 val) {
+ m_tableId = val;
+ }
+ Uint32 getIndexId() const {
+ return m_indexId;
+ }
+ void setIndexId(Uint32 val) {
+ m_indexId = val;
+ }
+ Uint32 getTriggerId() const {
+ return m_triggerId;
+ }
+ void setTriggerId(Uint32 val) {
+ m_triggerId = val;
+ }
+};
+
+/**
+ * DropTrigRef.
+ */
+class DropTrigRef {
+ friend bool printDROP_TRIG_REF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum ErrorCode {
+ NoError = 0,
+ Busy = 701,
+ TriggerNotFound = 4238,
+ BadRequestType = 4247,
+ InvalidName = 4248
+ };
+ STATIC_CONST( SignalLength = DropTrigConf::SignalLength + 3 );
+
+private:
+ DropTrigConf m_conf;
+ //Uint32 m_userRef;
+ //Uint32 m_connectionPtr;
+ //Uint32 m_requestInfo;
+ //Uint32 m_tableId;
+ //Uint32 m_indexId;
+ //Uint32 m_triggerId;
+ Uint32 m_errorCode;
+ Uint32 m_errorLine;
+ Uint32 m_errorNode;
+
+public:
+ DropTrigConf* getConf() {
+ return &m_conf;
+ }
+ const DropTrigConf* getConf() const {
+ return &m_conf;
+ }
+ Uint32 getUserRef() const {
+ return m_conf.getUserRef();
+ }
+ void setUserRef(Uint32 val) {
+ m_conf.setUserRef(val);
+ }
+ Uint32 getConnectionPtr() const {
+ return m_conf.getConnectionPtr();
+ }
+ void setConnectionPtr(Uint32 val) {
+ m_conf.setConnectionPtr(val);
+ }
+ DropTrigReq::RequestType getRequestType() const {
+ return m_conf.getRequestType();
+ }
+ void setRequestType(DropTrigReq::RequestType val) {
+ m_conf.setRequestType(val);
+ }
+ Uint32 getTableId() const {
+ return m_conf.getTableId();
+ }
+ void setTableId(Uint32 val) {
+ m_conf.setTableId(val);
+ }
+ Uint32 getIndexId() const {
+ return m_conf.getIndexId();
+ }
+ void setIndexId(Uint32 val) {
+ m_conf.setIndexId(val);
+ }
+ Uint32 getTriggerId() const {
+ return m_conf.getTriggerId();
+ }
+ void setTriggerId(Uint32 val) {
+ m_conf.setTriggerId(val);
+ }
+ DropTrigRef::ErrorCode getErrorCode() const {
+ return (DropTrigRef::ErrorCode)m_errorCode;
+ }
+ void setErrorCode(DropTrigRef::ErrorCode val) {
+ m_errorCode = (Uint32)val;
+ }
+ Uint32 getErrorLine() const {
+ return m_errorLine;
+ }
+ void setErrorLine(Uint32 val) {
+ m_errorLine = val;
+ }
+ Uint32 getErrorNode() const {
+ return m_errorNode;
+ }
+ void setErrorNode(Uint32 val) {
+ m_errorNode = val;
+ }
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/DumpStateOrd.hpp b/ndb/include/kernel/signaldata/DumpStateOrd.hpp
new file mode 100644
index 00000000000..6403a52926f
--- /dev/null
+++ b/ndb/include/kernel/signaldata/DumpStateOrd.hpp
@@ -0,0 +1,134 @@
+/* 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 DUMP_STATE_ORD_HPP
+#define DUMP_STATE_ORD_HPP
+
+#include "SignalData.hpp"
+
+/**
+ * DumpStateOrd is sent by the mgmtsrvr to CMVMI.
+ * CMVMI the redirect the signal to all blocks.
+ *
+ * The implementation of the DumpStateOrd should dump state information
+ * (typically using the infoEvent-function)
+ */
+class DumpStateOrd {
+ /**
+ * Sender/Reciver
+ */
+ friend class Cmvmi;
+
+ /**
+ * Sender(s)
+ */
+ friend class MgmtSrvr;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbacc;
+ friend class Dblqh;
+ friend class Dbtup;
+ friend class Dbtc;
+ friend class Ndbcntr;
+ friend class Qmgr;
+ friend class Dbdih;
+ friend class Dbdict;
+ friend class Ndbfs;
+
+public:
+ enum DumpStateType {
+ // 1 QMGR Dump information about phase 1 variables
+ // 13 CMVMI Dump signal counter
+ // 13 NDBCNTR Dump start phase information
+ // 13 NDBCNTR_REF Dump start phase information
+ CommitAckMarkersSize = 14, // TC+LQH Dump free size in commitAckMarkerP
+ CommitAckMarkersDump = 15, // TC+LQH Dump info in commitAckMarkerPool
+ DihDumpNodeRestartInfo = 16, // 16 DIH Dump node restart info
+ DihDumpNodeStatusInfo = 17,// 17 DIH Dump node status info
+ DihPrintFragmentation = 18,// 18 DIH Print fragmentation
+ // 19 NDBFS Fipple with O_SYNC, O_CREATE etc.
+ // 20-24 BACKUP
+ NdbcntrTestStopOnError = 25,
+ // 100-105 TUP and ACC
+ // 200-240 UTIL
+ // 300-305 TRIX
+ NdbfsDumpFileStat = 400,
+ NdbfsDumpAllFiles = 401,
+ NdbfsDumpOpenFiles = 402,
+ NdbfsDumpIdleFiles = 403,
+ // 1222-1225 DICT
+ LqhDumpAllDefinedTabs = 1332,
+ LqhDumpNoLogPages = 1333,
+ LqhDumpOneScanRec = 2300,
+ LqhDumpAllScanRec = 2301,
+ LqhDumpAllActiveScanRec = 2302,
+ LqhDumpLcpState = 2303,
+ AccDumpOneScanRec = 2400,
+ AccDumpAllScanRec = 2401,
+ AccDumpAllActiveScanRec = 2402,
+ AccDumpOneOperationRec = 2403,
+ AccDumpNumOpRecs = 2404,
+ AccDumpFreeOpRecs = 2405,
+ AccDumpNotFreeOpRecs = 2406,
+ DumpPageMemory = 1000, // Acc & TUP
+ TcDumpAllScanFragRec = 2500,
+ TcDumpOneScanFragRec = 2501,
+ TcDumpAllScanRec = 2502,
+ TcDumpAllActiveScanRec = 2503,
+ TcDumpOneScanRec = 2504,
+ TcDumpOneApiConnectRec = 2505,
+ TcDumpAllApiConnectRec = 2506,
+ TcSetTransactionTimeout = 2507,
+ CmvmiDumpConnections = 2600,
+ CmvmiDumpLongSignalMemory = 2601,
+ CmvmiSetRestartOnErrorInsert = 2602,
+ CmvmiTestLongSigWithDelay = 2603,
+ // 7000 DIH
+ // 7001 DIH
+ // 7002 DIH
+ // 7003 DIH
+ // 7004 DIH
+ // 7005 DIH
+ // 7006 DIH
+ // 7006 DIH
+ // 7007 DIH
+ // 7008 DIH
+ // 7009 DIH
+ // 7010 DIH
+ // 7011 DIH
+ // 7012 DIH
+ DihDumpLCPState= 7013,
+ DihDumpLCPMasterTakeOver = 7014,
+ // 7015 DIH
+ DihAllAllowNodeStart = 7016,
+ DihMinTimeBetweenLCP = 7017,
+ DihMaxTimeBetweenLCP = 7018,
+ EnableUndoDelayDataWrite = 7080, // DIH+ACC+TUP
+ DihStartLcpImmediately = 7099,
+ // 8000 Suma
+ // 12000 Tux
+ TuxLogToFile = 12001,
+ TuxSetLogFlags = 12002,
+ TuxMetaDataJunk = 12009
+ };
+public:
+
+ Uint32 args[25]; // Generic argument
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/EmptyLcp.hpp b/ndb/include/kernel/signaldata/EmptyLcp.hpp
new file mode 100644
index 00000000000..32ea6c13231
--- /dev/null
+++ b/ndb/include/kernel/signaldata/EmptyLcp.hpp
@@ -0,0 +1,77 @@
+/* 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 EMPTY_LCPREQ_HPP
+#define EMPTY_LCPREQ_HPP
+
+/**
+ * This signals is sent by Dbdih-Master to Dblqh
+ * as part of master take over after node crash
+ */
+class EmptyLcpReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Sender(s) / Receiver(s)
+ */
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+
+public:
+ STATIC_CONST( SignalLength = 1 );
+private:
+
+ Uint32 senderRef;
+};
+
+/**
+ * This signals is sent by Dblqh to Dbdih
+ * as part of master take over after node crash
+ */
+class EmptyLcpConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Sender(s) / Receiver(s)
+ */
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 6 );
+private:
+
+ Uint32 senderNodeId;
+ Uint32 tableId;
+ Uint32 fragmentId;
+ Uint32 lcpNo;
+ Uint32 lcpId;
+ Uint32 idle;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/EndTo.hpp b/ndb/include/kernel/signaldata/EndTo.hpp
new file mode 100644
index 00000000000..944cca3ca98
--- /dev/null
+++ b/ndb/include/kernel/signaldata/EndTo.hpp
@@ -0,0 +1,49 @@
+/* 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 END_TO_HPP
+#define END_TO_HPP
+
+class EndToReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+private:
+ Uint32 userPtr;
+ BlockReference userRef;
+ Uint32 startingNodeId;
+ Uint32 nodeTakenOver;
+};
+
+class EndToConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+private:
+
+ Uint32 userPtr;
+ Uint32 sendingNodeId;
+ Uint32 startingNodeId;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/EventReport.hpp b/ndb/include/kernel/signaldata/EventReport.hpp
new file mode 100644
index 00000000000..b6106bb0ca4
--- /dev/null
+++ b/ndb/include/kernel/signaldata/EventReport.hpp
@@ -0,0 +1,159 @@
+/* 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 SD_EVENT_REPORT_H
+#define SD_EVENT_REPORT_H
+
+#include "SignalData.hpp"
+
+/**
+ * Send by different block to report that a event has taken place
+ *
+ * SENDER: *Block*
+ * RECIVER: SimBlockCMCtrBlck
+ */
+class EventReport {
+ friend class SimulatedBlock;
+ friend class Cmvmi;
+ friend class SimblockMissra;
+ friend class Dbacc;
+ friend class Dblqh;
+ friend class Dbtup;
+ friend class Dbtc;
+ friend class Ndbcntr;
+ friend class Qmgr;
+ friend class Dbdih;
+ friend class Dbdict;
+ friend class MgmtSrvr;
+ friend class Grep;
+public:
+ /*
+ EventType defines what event reports to send.
+
+ The ORDER is NOT important anymore. //ejonore 2003-07-24 15:03
+
+ HOW TO ADD A NEW EVENT
+ --------------------
+ 1) Add SentHeartbeat EventType in the category where it belongs.
+ ...
+ // INFO
+ SentHeartbeat,
+ InfoEvent
+ ...
+
+ 2) remeber to update # of events below. Just to keep count...
+ Number of event types = 53
+
+ 3) Add a new SentHeartBeat entry to EventLogger::matrix[].
+ ...
+ // INFO
+ { EventReport::SentHeartbeat, LogLevel::llInfo, 11, INFO },
+ { EventReport::InfoEvent, LogLevel::llInfo, 2, INFO }
+ ...
+
+ 4) Add SentHeartbeat in EventLogger::getText()
+
+ */
+ enum EventType {
+ // CONNECTION
+ Connected = 0,
+ Disconnected = 1,
+ CommunicationClosed = 2,
+ CommunicationOpened = 3,
+ ConnectedApiVersion = 51,
+ // CHECKPOINT
+ GlobalCheckpointStarted = 4,
+ GlobalCheckpointCompleted = 5,
+ LocalCheckpointStarted = 6,
+ LocalCheckpointCompleted = 7,
+ LCPStoppedInCalcKeepGci = 8,
+ LCPFragmentCompleted = 9,
+ // STARTUP
+ NDBStartStarted = 10,
+ NDBStartCompleted = 11,
+ STTORRYRecieved = 12,
+ StartPhaseCompleted = 13,
+ CM_REGCONF = 14,
+ CM_REGREF = 15,
+ FIND_NEIGHBOURS = 16,
+ NDBStopStarted = 17,
+ NDBStopAborted = 18,
+ StartREDOLog = 19,
+ StartLog = 20,
+ UNDORecordsExecuted = 21,
+
+ // NODERESTART
+ NR_CopyDict = 22,
+ NR_CopyDistr = 23,
+ NR_CopyFragsStarted = 24,
+ NR_CopyFragDone = 25,
+ NR_CopyFragsCompleted = 26,
+
+ // NODEFAIL
+ NodeFailCompleted = 27,
+ NODE_FAILREP = 28,
+ ArbitState = 29,
+ ArbitResult = 30,
+ GCP_TakeoverStarted = 31,
+ GCP_TakeoverCompleted = 32,
+ LCP_TakeoverStarted = 33,
+ LCP_TakeoverCompleted = 34,
+
+ // STATISTIC
+ TransReportCounters = 35,
+ OperationReportCounters = 36,
+ TableCreated = 37,
+ UndoLogBlocked = 38,
+ JobStatistic = 39,
+ SendBytesStatistic = 40,
+ ReceiveBytesStatistic = 41,
+ MemoryUsage = 50,
+
+ // ERROR
+ TransporterError = 42,
+ TransporterWarning = 43,
+ MissedHeartbeat = 44,
+ DeadDueToHeartbeat = 45,
+ WarningEvent = 46,
+ // INFO
+ SentHeartbeat = 47,
+ CreateLogBytes = 48,
+ InfoEvent = 49,
+
+ //GREP
+ GrepSubscriptionInfo = 52,
+ GrepSubscriptionAlert = 53
+ };
+
+ void setEventType(EventType type);
+ EventType getEventType() const;
+private:
+ UintR eventType; // DATA 0
+};
+
+inline
+void
+EventReport::setEventType(EventType type){
+ eventType = (UintR) type;
+}
+
+inline
+EventReport::EventType
+EventReport::getEventType() const {
+ return (EventType)eventType;
+}
+
+#endif
diff --git a/ndb/include/kernel/signaldata/EventSubscribeReq.hpp b/ndb/include/kernel/signaldata/EventSubscribeReq.hpp
new file mode 100644
index 00000000000..2ac62be19a3
--- /dev/null
+++ b/ndb/include/kernel/signaldata/EventSubscribeReq.hpp
@@ -0,0 +1,60 @@
+/* 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 SD_EVENT_SUB_REQ_H
+#define SD_EVENT_SUB_REQ_H
+
+#include "SignalData.hpp"
+
+/**
+ * Requests change (new, update, delete) of event subscription,
+ * i.e. forwarding of events.
+ *
+ * SENDER: Mgm server
+ * RECIVER: SimBlockCMCtrBlck
+ */
+
+class EventSubscribeReq {
+ /**
+ * Receiver(s)
+ */
+ friend class Cmvmi;
+
+ /**
+ * Sender(s)
+ */
+ friend class MgmtSrvr;
+
+public:
+ STATIC_CONST( SignalLength = 14 );
+private:
+ /**
+ * Note: If you use the same blockRef as you have used earlier,
+ * you update your ongoing subscription
+ */
+ Uint32 blockRef;
+
+ /**
+ * If you specify 0 entries, it's the same as cancelling an
+ * subscription
+ */
+ Uint32 noOfEntries;
+
+ Uint32 theCategories[6];
+ Uint32 theLevels[6];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/ExecFragReq.hpp b/ndb/include/kernel/signaldata/ExecFragReq.hpp
new file mode 100644
index 00000000000..e40213d6e29
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ExecFragReq.hpp
@@ -0,0 +1,43 @@
+/* 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 EXEC_FRAGREQ_HPP
+#define EXEC_FRAGREQ_HPP
+
+#include "SignalData.hpp"
+
+class ExecFragReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+public:
+ STATIC_CONST( SignalLength = 6 );
+
+private:
+ Uint32 userPtr;
+ Uint32 userRef;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 startGci;
+ Uint32 lastGci;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/FailRep.hpp b/ndb/include/kernel/signaldata/FailRep.hpp
new file mode 100644
index 00000000000..44577f07fdc
--- /dev/null
+++ b/ndb/include/kernel/signaldata/FailRep.hpp
@@ -0,0 +1,56 @@
+/* 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 FAIL_REP_HPP
+#define FAIL_REP_HPP
+
+#include "SignalData.hpp"
+
+/**
+ *
+ */
+class FailRep {
+ /**
+ * Sender(s) & Reciver(s)
+ */
+ friend class Qmgr;
+
+ /**
+ * For printing
+ */
+ friend bool printFAIL_REP(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ enum FailCause {
+ ZOWN_FAILURE=0,
+ ZOTHER_NODE_WHEN_WE_START=1,
+ ZIN_PREP_FAIL_REQ=2,
+ ZSTART_IN_REGREQ=3,
+ ZHEARTBEAT_FAILURE=4,
+ ZLINK_FAILURE=5,
+ ZOTHERNODE_FAILED_DURING_START=6
+ };
+
+private:
+
+ Uint32 failNodeId;
+ Uint32 failCause;
+};
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/FireTrigOrd.hpp b/ndb/include/kernel/signaldata/FireTrigOrd.hpp
new file mode 100644
index 00000000000..20a0a863094
--- /dev/null
+++ b/ndb/include/kernel/signaldata/FireTrigOrd.hpp
@@ -0,0 +1,200 @@
+/* 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 FIRE_TRIG_ORD_HPP
+#define FIRE_TRIG_ORD_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+#include <trigger_definitions.h>
+#include <string.h>
+
+/**
+ * FireTrigOrd
+ *
+ * This signal is sent by TUP to signal
+ * that a trigger has fired
+ */
+class FireTrigOrd {
+ /**
+ * Sender(s)
+ */
+ // API
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbtup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc;
+ friend class Backup;
+ friend class SumaParticipant;
+
+ /**
+ * For printing
+ */
+ friend bool printFIRE_TRIG_ORD(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( SignalLength = 7 );
+ STATIC_CONST( SignalWithGCILength = 8 );
+ STATIC_CONST( SignalWithHashValueLength = 9 );
+
+private:
+ Uint32 m_connectionPtr;
+ Uint32 m_userRef;
+ Uint32 m_triggerId;
+ TriggerEvent::Value m_triggerEvent;
+ Uint32 m_noPrimKeyWords;
+ Uint32 m_noBeforeValueWords;
+ Uint32 m_noAfterValueWords;
+ Uint32 m_gci;
+ Uint32 m_hashValue;
+ // Public methods
+public:
+ Uint32 getConnectionPtr() const;
+ void setConnectionPtr(Uint32);
+ Uint32 getUserRef() const;
+ void setUserRef(Uint32);
+ Uint32 getTriggerId() const;
+ void setTriggerId(Uint32 anIndxId);
+ TriggerEvent::Value getTriggerEvent() const;
+ void setTriggerEvent(TriggerEvent::Value);
+ Uint32 getNoOfPrimaryKeyWords() const;
+ void setNoOfPrimaryKeyWords(Uint32);
+ Uint32 getNoOfBeforeValueWords() const;
+ void setNoOfBeforeValueWords(Uint32);
+ Uint32 getNoOfAfterValueWords() const;
+ void setNoOfAfterValueWords(Uint32);
+ Uint32 getGCI() const;
+ void setGCI(Uint32);
+ Uint32 getHashValue() const;
+ void setHashValue(Uint32);
+};
+
+inline
+Uint32 FireTrigOrd::getConnectionPtr() const
+{
+ return m_connectionPtr;
+}
+
+inline
+void FireTrigOrd::setConnectionPtr(Uint32 aConnectionPtr)
+{
+ m_connectionPtr = aConnectionPtr;
+}
+
+inline
+Uint32 FireTrigOrd::getUserRef() const
+{
+ return m_userRef;
+}
+
+inline
+void FireTrigOrd::setUserRef(Uint32 aUserRef)
+{
+ m_userRef = aUserRef;
+}
+
+inline
+Uint32 FireTrigOrd::getTriggerId() const
+{
+ return m_triggerId;
+}
+
+inline
+void FireTrigOrd::setTriggerId(Uint32 aTriggerId)
+{
+ m_triggerId = aTriggerId;
+}
+
+inline
+TriggerEvent::Value FireTrigOrd::getTriggerEvent() const
+{
+ return m_triggerEvent;
+}
+
+inline
+void FireTrigOrd::setTriggerEvent(TriggerEvent::Value aTriggerEvent)
+{
+ m_triggerEvent = aTriggerEvent;
+}
+
+inline
+Uint32 FireTrigOrd::getNoOfPrimaryKeyWords() const
+{
+ return m_noPrimKeyWords;
+}
+
+inline
+void FireTrigOrd::setNoOfPrimaryKeyWords(Uint32 noPrim)
+{
+ m_noPrimKeyWords = noPrim;
+}
+
+inline
+Uint32 FireTrigOrd::getNoOfBeforeValueWords() const
+{
+ return m_noBeforeValueWords;
+}
+
+inline
+void FireTrigOrd::setNoOfBeforeValueWords(Uint32 noBefore)
+{
+ m_noBeforeValueWords = noBefore;
+}
+
+inline
+Uint32 FireTrigOrd::getNoOfAfterValueWords() const
+{
+ return m_noAfterValueWords;
+}
+
+inline
+void FireTrigOrd::setNoOfAfterValueWords(Uint32 noAfter)
+{
+ m_noAfterValueWords = noAfter;
+}
+
+inline
+Uint32 FireTrigOrd::getGCI() const
+{
+ return m_gci;
+}
+
+inline
+void FireTrigOrd::setGCI(Uint32 aGCI)
+{
+ m_gci = aGCI;
+}
+
+inline
+Uint32 FireTrigOrd::getHashValue() const
+{
+ return m_hashValue;
+}
+
+inline
+void FireTrigOrd::setHashValue(Uint32 flag)
+{
+ m_hashValue = flag;
+}
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/FsAppendReq.hpp b/ndb/include/kernel/signaldata/FsAppendReq.hpp
new file mode 100644
index 00000000000..e2fd61f8a11
--- /dev/null
+++ b/ndb/include/kernel/signaldata/FsAppendReq.hpp
@@ -0,0 +1,57 @@
+/* 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 FS_APPENDREQ_H
+#define FS_APPENDREQ_H
+
+#include "SignalData.hpp"
+
+/**
+ *
+ * SENDER:
+ * RECIVER: Ndbfs
+ */
+class FsAppendReq {
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbfs;
+ friend class VoidFs;
+
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ friend bool printFSAPPENDREQ(FILE * output, const Uint32 * theData,
+ Uint32 len, Uint16 receiverBlockNo);
+public:
+ STATIC_CONST( SignalLength = 6 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+ UintR filePointer; // DATA 0
+ UintR userReference; // DATA 1
+ UintR userPointer; // DATA 2
+ UintR varIndex; // DATA 3
+ UintR offset; // DATA 4
+ UintR size; // DATA 5
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/FsCloseReq.hpp b/ndb/include/kernel/signaldata/FsCloseReq.hpp
new file mode 100644
index 00000000000..8ff47145f87
--- /dev/null
+++ b/ndb/include/kernel/signaldata/FsCloseReq.hpp
@@ -0,0 +1,85 @@
+/* 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 FS_CLOSE_REQ_H
+#define FS_CLOSE_REQ_H
+
+#include "SignalData.hpp"
+
+/**
+ *
+ * SENDER:
+ * RECIVER: Ndbfs
+ */
+class FsCloseReq {
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbfs; // Reciver
+ friend class VoidFs;
+
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+ friend class Dbdict;
+
+ /**
+ * For printing
+ */
+ friend bool printFSCLOSEREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+
+ UintR filePointer; // DATA 0
+ UintR userReference; // DATA 1
+ UintR userPointer; // DATA 2
+ UintR fileFlag; // DATA 3
+
+ static bool getRemoveFileFlag(const UintR & fileflag);
+ static void setRemoveFileFlag(UintR & fileflag, bool removefile);
+
+};
+
+
+inline
+bool
+FsCloseReq::getRemoveFileFlag(const UintR & fileflag){
+ return (fileflag == 1);
+}
+
+inline
+void
+FsCloseReq::setRemoveFileFlag(UintR & fileflag, bool removefile){
+ ASSERT_BOOL(removefile, "FsCloseReq::setRemoveFileFlag");
+ if (removefile == true)
+ fileflag = 1;
+ else
+ fileflag = 0;
+}
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/FsConf.hpp b/ndb/include/kernel/signaldata/FsConf.hpp
new file mode 100644
index 00000000000..f66d9feea49
--- /dev/null
+++ b/ndb/include/kernel/signaldata/FsConf.hpp
@@ -0,0 +1,77 @@
+/* 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 FS_CONF_H
+#define FS_CONF_H
+
+#include "SignalData.hpp"
+
+/**
+ * FsConf - Common signal class for all CONF signals sent from Ndbfs
+ * GSN_FSCLOSECONF, GSN_FSOPENCONF, GSN_FSWRITECONF, GSN_FSREADCONF,
+ * GSN_FSSYNCCONF, GSN_FSREMOVECONF
+ */
+
+/**
+ *
+ * SENDER: Ndbfs
+ * RECIVER:
+ */
+class FsConf {
+ /**
+ * Reciver(s)
+ */
+ friend class Backup;
+ friend class Dbacc;
+ friend class Dbtup;
+ friend class Dbdict;
+
+ /**
+ * Sender(s)
+ */
+ friend class Ndbfs;
+ friend class VoidFs;
+
+ /**
+ * For printing
+ */
+ friend bool printFSCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ /**
+ * Length of signal
+ */
+ /**
+ * FSOPENCONF: static const UintR SignalLength = 2;
+ * FSCLOSECONF, FSREADCONF, FSWRITECONF, FSSYNCCONF: static const UintR SignalLength = 2;
+ */
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+ UintR userPointer; // DATA 0
+
+ /**
+ * Only used if FSOPENCONF
+ */
+ UintR filePointer; // DATA 1
+};
+
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/FsOpenReq.hpp b/ndb/include/kernel/signaldata/FsOpenReq.hpp
new file mode 100644
index 00000000000..b84d78ba9dd
--- /dev/null
+++ b/ndb/include/kernel/signaldata/FsOpenReq.hpp
@@ -0,0 +1,266 @@
+/* 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 FS_OPEN_REQ_H
+#define FS_OPEN_REQ_H
+
+#include "SignalData.hpp"
+
+/**
+ *
+ * SENDER:
+ * RECIVER: Ndbfs
+ */
+class FsOpenReq {
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbfs; // Reciver
+ friend class AsyncFile; // Uses FsOpenReq to decode file open flags
+ friend class Filename;
+ friend class VoidFs;
+
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+ friend class Dbdict;
+ friend class Ndbcntr; // For initial start...
+
+ /**
+ * For printing
+ */
+ friend bool printFSOPENREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( SignalLength = 7 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+
+ UintR userReference; // DATA 0
+ UintR userPointer; // DATA 1
+ UintR fileNumber[4]; // DATA 2 - 5
+ UintR fileFlags; // DATA 6
+
+ STATIC_CONST( OM_READONLY = 0 );
+ STATIC_CONST( OM_WRITEONLY = 1 );
+ STATIC_CONST( OM_READWRITE = 2 );
+
+ STATIC_CONST( OM_APPEND = 0x8 ); // Not Implemented on W2k
+ STATIC_CONST( OM_SYNC = 0x10 );
+ STATIC_CONST( OM_CREATE = 0x100 );
+ STATIC_CONST( OM_TRUNCATE = 0x200 );
+
+ enum Suffixes {
+ S_DATA = 0,
+ S_FRAGLOG = 1,
+ S_LOGLOG = 2,
+ S_FRAGLIST = 3,
+ S_TABLELIST = 4,
+ S_SCHEMALOG = 5,
+ S_SYSFILE = 6,
+ S_LOG = 7,
+ S_CTL = 8
+ };
+
+ static Uint32 getVersion(const Uint32 fileNumber[]);
+ static Uint32 getSuffix(const Uint32 fileNumber[]);
+
+ static void setVersion(Uint32 fileNumber[], Uint8 val);
+ static void setSuffix(Uint32 fileNumber[], Uint8 val);
+
+ /**
+ * V1
+ */
+ static Uint32 v1_getDisk(const Uint32 fileNumber[]);
+ static Uint32 v1_getTable(const Uint32 fileNumber[]);
+ static Uint32 v1_getFragment(const Uint32 fileNumber[]);
+ static Uint32 v1_getS(const Uint32 fileNumber[]);
+ static Uint32 v1_getP(const Uint32 fileNumber[]);
+
+ static void v1_setDisk(Uint32 fileNumber[], Uint8 val);
+ static void v1_setTable(Uint32 fileNumber[], Uint32 val);
+ static void v1_setFragment(Uint32 fileNumber[], Uint32 val);
+ static void v1_setS(Uint32 fileNumber[], Uint32 val);
+ static void v1_setP(Uint32 fileNumber[], Uint8 val);
+
+ /**
+ * V2 - Backup
+ */
+ static Uint32 v2_getSequence(const Uint32 fileNumber[]);
+ static Uint32 v2_getNodeId(const Uint32 fileNumber[]);
+ static Uint32 v2_getCount(const Uint32 fileNumber[]);
+
+ static void v2_setSequence(Uint32 fileNumber[], Uint32 no);
+ static void v2_setNodeId(Uint32 fileNumber[], Uint32 no);
+ static void v2_setCount(Uint32 fileNumber[], Uint32 no);
+};
+
+/**
+ * File flags (set according to solaris standard)
+ *
+ o = Open mode - 2 Bits -> max 3
+ c = create new file - 1 Bit
+ t = truncate existing - 1 Bit
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+ oo ct
+*/
+
+
+/**
+ * -- v1 --
+ * File number[0] = Table
+ * File number[1] = Fragment
+ * File number[2] = S-value
+ * File number[3] =
+ * p = v1_P 0 - 7
+ * d = v1_disk 8 - 15
+ * s = v1_suffix 16 - 23
+ * v = version 24 - 31
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * ppppppppddddddddssssssssvvvvvvvv
+ *
+ * -- v2 --
+ * File number[0] = Backup Sequence Number
+ * File number[1] = Node Id
+ * File number[3] =
+ * v = version 24 - 31
+ * s = v1_suffix 16 - 23
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * ppppppppddddddddssssssssvvvvvvvv
+ *
+ */
+inline
+Uint32 FsOpenReq::getVersion(const Uint32 fileNumber[]){
+ return (fileNumber[3] >> 24) & 0xff;
+}
+
+inline
+void FsOpenReq::setVersion(Uint32 fileNumber[], Uint8 val){
+ const Uint32 t = fileNumber[3];
+ fileNumber[3] = t & 0x00FFFFFF | (((Uint32)val) << 24);
+}
+
+inline
+Uint32 FsOpenReq::getSuffix(const Uint32 fileNumber[]){
+ return (fileNumber[3] >> 16)& 0xff;
+}
+
+inline
+void FsOpenReq::setSuffix(Uint32 fileNumber[], Uint8 val){
+ const Uint32 t = fileNumber[3];
+ fileNumber[3] = t & 0xFF00FFFF | (((Uint32)val) << 16);
+}
+
+inline
+Uint32 FsOpenReq::v1_getDisk(const Uint32 fileNumber[]){
+ return (fileNumber[3]>>8) & 0xff;
+}
+
+inline
+void FsOpenReq::v1_setDisk(Uint32 fileNumber[], Uint8 val){
+ const Uint32 t = fileNumber[3];
+ fileNumber[3] = t & 0xFFFF00FF | (((Uint32)val) << 8);
+}
+
+inline
+Uint32 FsOpenReq::v1_getTable(const Uint32 fileNumber[]){
+ return fileNumber[0];
+}
+
+inline
+void FsOpenReq::v1_setTable(Uint32 fileNumber[], Uint32 val){
+ fileNumber[0] = val;
+}
+
+inline
+Uint32 FsOpenReq::v1_getFragment(const Uint32 fileNumber[]){
+ return fileNumber[1];
+}
+
+inline
+void FsOpenReq::v1_setFragment(Uint32 fileNumber[], Uint32 val){
+ fileNumber[1] = val;
+}
+
+inline
+Uint32 FsOpenReq::v1_getS(const Uint32 fileNumber[]){
+ return fileNumber[2];
+}
+
+inline
+void FsOpenReq::v1_setS(Uint32 fileNumber[], Uint32 val){
+ fileNumber[2] = val;
+}
+
+inline
+Uint32 FsOpenReq::v1_getP(const Uint32 fileNumber[]){
+ return fileNumber[3] & 0xff;
+}
+
+inline
+void FsOpenReq::v1_setP(Uint32 fileNumber[], Uint8 val){
+ const Uint32 t = fileNumber[3];
+ fileNumber[3] = t & 0xFFFFFF00 | val;
+}
+
+/****************/
+inline
+Uint32 FsOpenReq::v2_getSequence(const Uint32 fileNumber[]){
+ return fileNumber[0];
+}
+
+inline
+void FsOpenReq::v2_setSequence(Uint32 fileNumber[], Uint32 val){
+ fileNumber[0] = val;
+}
+
+inline
+Uint32 FsOpenReq::v2_getNodeId(const Uint32 fileNumber[]){
+ return fileNumber[1];
+}
+
+inline
+void FsOpenReq::v2_setNodeId(Uint32 fileNumber[], Uint32 val){
+ fileNumber[1] = val;
+}
+
+inline
+Uint32 FsOpenReq::v2_getCount(const Uint32 fileNumber[]){
+ return fileNumber[2];
+}
+
+inline
+void FsOpenReq::v2_setCount(Uint32 fileNumber[], Uint32 val){
+ fileNumber[2] = val;
+}
+
+
+#endif
+
diff --git a/ndb/include/kernel/signaldata/FsReadWriteReq.hpp b/ndb/include/kernel/signaldata/FsReadWriteReq.hpp
new file mode 100644
index 00000000000..6e4fa4d260e
--- /dev/null
+++ b/ndb/include/kernel/signaldata/FsReadWriteReq.hpp
@@ -0,0 +1,152 @@
+/* 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 FS_READWRITEREQ_H
+#define FS_READWRITEREQ_H
+
+#include "SignalData.hpp"
+
+/**
+ * FsReadWriteReq - Common signal class for FSWRITEREQ and FSREADREQ
+ *
+ */
+
+/**
+ *
+ * SENDER:
+ * RECIVER: Ndbfs
+ */
+class FsReadWriteReq {
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbfs;
+ friend class VoidFs;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+
+ /**
+ * For printing
+ */
+ friend bool printFSREADWRITEREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ /**
+ * Enum type for errorCode
+ */
+ enum NdbfsFormatType {
+ fsFormatListOfPairs=0,
+ fsFormatArrayOfPages=1,
+ fsFormatListOfMemPages=2,
+ fsFormatMax
+ };
+
+ /**
+ * Length of signal
+ */
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+ UintR filePointer; // DATA 0
+ UintR userReference; // DATA 1
+ UintR userPointer; // DATA 2
+ UintR operationFlag; // DATA 3
+ UintR varIndex; // DATA 4
+ UintR numberOfPages; // DATA 5
+
+//-------------------------------------------------------------
+// Variable sized part. Those will contain
+// info about memory/file pages to read/write
+//-------------------------------------------------------------
+ union {
+ UintR pageData[16]; // DATA 6 - 21
+ struct {
+ Uint32 varIndex; // In unit cluster size
+ Uint32 fileOffset; // In unit page size
+ } listOfPair[8];
+ struct {
+ Uint32 varIndex;
+ Uint32 fileOffset;
+ } arrayOfPages;
+ struct {
+ Uint32 varIndex[1]; // Size = numberOfPages
+ Uint32 fileOffset;
+ } listOfMemPages;
+ } data;
+
+ static Uint8 getSyncFlag(const UintR & opFlag);
+ static void setSyncFlag(UintR & opFlag, Uint8 flag);
+
+ static NdbfsFormatType getFormatFlag(const UintR & opFlag);
+ static void setFormatFlag(UintR & opFlag, Uint8 flag);
+
+};
+
+/**
+ * Operation flag
+ *
+ f = Format of pageData - 4 Bits -> max 15
+ s = sync after write flag - 1 Bit
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+ ffffs
+*/
+
+#define SYNC_SHIFT (4)
+#define SYNC_MASK (0x01)
+
+#define FORMAT_MASK (0x0F)
+
+
+inline
+Uint8
+FsReadWriteReq::getSyncFlag(const UintR & opFlag){
+ return (Uint8)((opFlag >> SYNC_SHIFT) & SYNC_MASK);
+}
+
+inline
+FsReadWriteReq::NdbfsFormatType
+FsReadWriteReq::getFormatFlag(const UintR & opFlag){
+ return (NdbfsFormatType)(opFlag & FORMAT_MASK);
+}
+
+inline
+void
+FsReadWriteReq::setSyncFlag(UintR & opFlag, Uint8 flag){
+ ASSERT_BOOL(flag, "FsReadWriteReq::setSyncFlag");
+ opFlag |= (flag << SYNC_SHIFT);
+}
+
+inline
+void
+FsReadWriteReq::setFormatFlag(UintR & opFlag, Uint8 flag){
+ ASSERT_MAX(flag, fsFormatMax, "FsReadWriteReq::setSyncFlag");
+ opFlag |= flag;
+}
+
+
+
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/FsRef.hpp b/ndb/include/kernel/signaldata/FsRef.hpp
new file mode 100644
index 00000000000..650f6520fb5
--- /dev/null
+++ b/ndb/include/kernel/signaldata/FsRef.hpp
@@ -0,0 +1,116 @@
+/* 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 FS_REF_H
+#define FS_REF_H
+
+#include "SignalData.hpp"
+
+/**
+ * FsRef - Common signal class for all REF signals sent from Ndbfs
+ * GSN_FSCLOSEREF, GSN_FSOPENREF, GSN_FSWRITEREF, GSN_FSREADREF,
+ * GSN_FSSYNCREF
+ */
+
+
+/**
+ *
+ * SENDER: Ndbfs
+ * RECIVER:
+ */
+class FsRef {
+ /**
+ * Reciver(s)
+ */
+ friend class Dbdict;
+ friend class Backup;
+
+ /**
+ * Sender(s)
+ */
+ friend class Ndbfs;
+ friend class VoidFs;
+
+ /**
+ * For printing
+ */
+ friend bool printFSREF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ /**
+ * Enum type for errorCode
+ */
+ enum NdbfsErrorCodeType {
+ fsErrNone=0,
+ fsErrHardwareFailed=1,
+ fsErrUserError=2,
+ fsErrEnvironmentError=3,
+ fsErrTemporaryNotAccessible=4,
+ fsErrNoSpaceLeftOnDevice=5,
+ fsErrPermissionDenied=6,
+ fsErrInvalidParameters=7,
+ fsErrUnknown=8,
+ fsErrNoMoreResources=9,
+ fsErrFileDoesNotExist=10,
+ fsErrReadUnderflow = 11,
+ fsErrMax
+ };
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+ UintR userPointer; // DATA 0
+ UintR errorCode; // DATA 1
+ UintR osErrorCode; // DATA 2
+ UintR senderData;
+
+ static NdbfsErrorCodeType getErrorCode(const UintR & errorcode);
+ static void setErrorCode(UintR & errorcode, NdbfsErrorCodeType errorcodetype);
+ static void setErrorCode(UintR & errorcode, UintR errorcodetype);
+
+};
+
+
+inline
+FsRef::NdbfsErrorCodeType
+FsRef::getErrorCode(const UintR & errorcode){
+ return (NdbfsErrorCodeType)errorcode;
+}
+
+inline
+void
+FsRef::setErrorCode(UintR & errorcode, NdbfsErrorCodeType errorcodetype){
+ ASSERT_MAX(errorcodetype, fsErrMax, "FsRef::setErrorCode");
+ errorcode = (UintR)errorcodetype;
+}
+
+inline
+void
+FsRef::setErrorCode(UintR & errorcode, UintR errorcodetype){
+ ASSERT_MAX(errorcodetype, fsErrMax, "FsRef::setErrorCode");
+ errorcode = errorcodetype;
+}
+
+
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/FsRemoveReq.hpp b/ndb/include/kernel/signaldata/FsRemoveReq.hpp
new file mode 100644
index 00000000000..efb566d883a
--- /dev/null
+++ b/ndb/include/kernel/signaldata/FsRemoveReq.hpp
@@ -0,0 +1,78 @@
+/* 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 FS_REMOVE_REQ_H
+#define FS_REMOVE_REQ_H
+
+#include "SignalData.hpp"
+#include "FsOpenReq.hpp"
+
+/**
+ *
+ * SENDER:
+ * RECIVER: Ndbfs
+ */
+class FsRemoveReq {
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbfs; // Reciver
+ friend class AsyncFile; // Uses FsOpenReq to decode file open flags
+ friend class Filename;
+ friend class VoidFs;
+
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+ friend class Dbdict;
+ friend class Dbacc;
+ friend class Dbtup;
+ friend class Ndbcntr; // For initial start...
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( SignalLength = 8 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+
+ UintR userReference; // DATA 0
+ UintR userPointer; // DATA 1
+ UintR fileNumber[4]; // DATA 2 - 5 // See FsOpen for interpretation
+
+ /**
+ * 0 = File -> rm file
+ * 1 = Directory -> rm -r path
+ */
+ UintR directory;
+
+ /**
+ * If directory = 1
+ *
+ * 0 = remove only files/direcories in directory specified in fileNumber
+ * 1 = remove directory specified in fileNumber
+ */
+ UintR ownDirectory;
+};
+
+#endif
+
diff --git a/ndb/include/kernel/signaldata/GCPSave.hpp b/ndb/include/kernel/signaldata/GCPSave.hpp
new file mode 100644
index 00000000000..2b4a25e6bb2
--- /dev/null
+++ b/ndb/include/kernel/signaldata/GCPSave.hpp
@@ -0,0 +1,98 @@
+/* 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 GCP_SAVE_HPP
+#define GCP_SAVE_HPP
+
+#include "SignalData.hpp"
+
+/**
+ * GCPSaveReq / (Ref/Conf) is sent as part of GCP
+ */
+class GCPSaveReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dblqh;
+
+ friend bool printGCPSaveReq(FILE * output, const Uint32 * theData,
+ Uint32 len, Uint16 receiverBlockNo);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 dihBlockRef;
+ Uint32 dihPtr;
+ Uint32 gci;
+};
+
+class GCPSaveRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbdih;
+
+ friend bool printGCPSaveRef(FILE * output, const Uint32 * theData,
+ Uint32 len, Uint16 receiverBlockNo);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ enum ErrorCode {
+ NodeShutdownInProgress = 1,
+ FakedSignalDueToNodeFailure = 2,
+ NodeRestartInProgress = 3
+ };
+
+private:
+ Uint32 dihPtr;
+ Uint32 nodeId;
+ Uint32 gci;
+ Uint32 errorCode;
+};
+
+class GCPSaveConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbdih;
+
+ friend bool printGCPSaveConf(FILE * output, const Uint32 * theData,
+ Uint32 len, Uint16 receiverBlockNo);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 dihPtr;
+ Uint32 nodeId;
+ Uint32 gci;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/GetTabInfo.hpp b/ndb/include/kernel/signaldata/GetTabInfo.hpp
new file mode 100644
index 00000000000..cb6e38872d3
--- /dev/null
+++ b/ndb/include/kernel/signaldata/GetTabInfo.hpp
@@ -0,0 +1,126 @@
+/* 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 GET_INFO_TAB_HPP
+#define GET_INFO_TAB_HPP
+
+#include "SignalData.hpp"
+
+/**
+ * GetTabInfo - Get table info from DICT
+ *
+ * Successfull return = series of DICTTABINFO-signals
+ */
+class GetTabInfoReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ // Blocks
+ friend class Dbdict;
+ friend class Backup;
+ friend class Trix;
+ friend class DbUtil;
+ // API
+ friend class Table;
+
+ friend bool printGET_TABINFO_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ // STATIC_CONST( MaxTableNameLengthInWords = 20 );
+public:
+ Uint32 senderData;
+ Uint32 senderRef;
+
+ /**
+ * 0 = request by id, 1 = request by name
+ */
+ Uint32 requestType;
+
+ union {
+ Uint32 tableId;
+ Uint32 tableNameLen;
+ };
+ Uint32 unused; // This is located here so that Req & Ref have the same format
+ // Uint32 tableName[MaxTableNameLengthInWords];
+
+ enum RequestType {
+ RequestById = 0,
+ RequestByName = 1,
+ LongSignalConf = 2
+ };
+ SECTION( TABLE_NAME = 0 );
+};
+
+class GetTabInfoRef {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ // Blocks
+ friend class Dbdict;
+ friend class Backup;
+ friend class Trix;
+ friend class DbUtil;
+ // API
+ friend class Table;
+
+ friend bool printGET_TABINFO_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+public:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 requestType; // 0 = request by id, 1 = request by name
+ union {
+ Uint32 tableId;
+ Uint32 tableNameLen;
+ };
+ Uint32 errorCode;
+
+ enum ErrorCode {
+ InvalidTableId = 709,
+ TableNotDefined = 723,
+ TableNameTooLong = 702,
+ Busy = 701
+ };
+};
+
+class GetTabInfoConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ // Blocks
+ friend class Dbdict;
+ friend class Backup;
+ friend class Trix;
+ friend class DbUtil;
+ friend class Suma;
+ // API
+ friend class Table;
+
+ friend bool printGET_TABINFO_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ SECTION( DICT_TAB_INFO = 0 );
+public:
+ Uint32 senderData;
+ Uint32 tableId;
+ Uint32 gci; // For table
+ Uint32 totalLen; // In words
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/GetTableId.hpp b/ndb/include/kernel/signaldata/GetTableId.hpp
new file mode 100644
index 00000000000..fb91c2e10d7
--- /dev/null
+++ b/ndb/include/kernel/signaldata/GetTableId.hpp
@@ -0,0 +1,93 @@
+/* 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 GET_TABLEID_HPP
+#define GET_TABLEID_HPP
+
+#include "SignalData.hpp"
+
+/**
+ * Convert tabname to table id
+ */
+class GetTableIdReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ // Blocks
+ friend class Dbdict;
+ friend class SumaParticipant;
+
+ friend bool printGET_TABLEID_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+public:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 len;
+ SECTION( TABLE_NAME = 0 );
+};
+
+
+/**
+ * Convert tabname to table id
+ */
+class GetTableIdRef {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ // Blocks
+ friend class Dbdict;
+ friend class SumaParticipant;
+ friend bool printGET_TABLEID_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+public:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 err;
+
+ enum ErrorCode {
+ InvalidTableId = 709,
+ TableNotDefined = 723,
+ TableNameTooLong = 702,
+ EmptyTable = 1111
+ };
+};
+
+
+/**
+ * Convert tabname to table id
+ */
+class GetTableIdConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ // Blocks
+ friend class Dbdict;
+ friend class SumaParticipant;
+ friend bool printGET_TABLEID_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+public:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 tableId;
+ Uint32 schemaVersion;
+
+};
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/GrepImpl.hpp b/ndb/include/kernel/signaldata/GrepImpl.hpp
new file mode 100644
index 00000000000..95b93df0a58
--- /dev/null
+++ b/ndb/include/kernel/signaldata/GrepImpl.hpp
@@ -0,0 +1,891 @@
+/* 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 GREP_IMPL_HPP
+#define GREP_IMPL_HPP
+
+#include "SignalData.hpp"
+#include <GrepError.hpp>
+#include <NodeBitmask.hpp>
+
+
+
+/*****************************************************************************
+ * GREP REQ Request a Global Replication (between SS and PS)
+ *****************************************************************************/
+/**
+ * @class GrepReq
+ * @brief
+ */
+class GrepReq
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+public:
+ enum Request {
+ START = 0, ///< Start Global Replication (all phases)
+ SLOWSTOP = 1, ///< Stop after finishing applying current GCI epoch
+ FASTSTOP = 2, ///< Stop after finishing applying all PS GCI epochs
+ STATUS = 3, ///< Status
+ REMOVE_BUFFERS = 4, ///< Remove buffers from PS and SS
+
+ START_SUBSCR = 5,
+ START_METALOG = 6, ///< Start Global Replication Logging of Metadata
+ START_METASCAN = 7, ///< Start Global Replication Scanning of Metadata
+ START_DATALOG = 8, ///< Start Global Replication Logging of table data
+ START_DATASCAN = 9, ///< Start Global Replication Scanning of table data
+ START_REQUESTOR = 10, ///< Start Global Replication Requestor
+ START_TRANSFER = 11, ///< Start SS-PS transfer
+ START_APPLY = 12, ///< Start applying GCI epochs in SS
+ START_DELETE = 13, ///< Start deleting buffers at PS/SS REP automatic.
+
+ STOP_SUBSCR = 14, ///< Remove subscription
+ STOP_METALOG = 15, ///< Stop Global Replication Logging of Metadata
+ STOP_METASCAN = 16, ///< Stop Global Replication Scanning of Metadata
+ STOP_DATALOG = 17, ///< Stop Global Replication Logging of table data
+ STOP_DATASCAN = 18, ///< Stop Global Replication Scanning of table data
+ STOP_REQUESTOR = 19, ///< Stop Global Replication Requestor
+ STOP_TRANSFER = 20, ///< Stop SS-PS transfer
+ STOP_APPLY = 21, ///< Stop applying GCI epochs in SS
+ STOP_DELETE = 22, ///< Stop deleting buffers at PS/SS REP automatically
+ CREATE_SUBSCR = 23, ///< Create subscription ID in SUMA
+ DROP_TABLE = 24, ///< Create subscription ID in SUMA
+ STOP = 25,
+
+ NO_REQUEST = 0xffffffff
+ };
+
+ STATIC_CONST( SignalLength = 2 );
+
+ Uint32 senderRef;
+ Uint32 request;
+};
+
+
+/*****************************************************************************
+ * CREATE Between SS and PS (DB and REP nodes)
+ *****************************************************************************/
+/**
+ * @class GrepSubCreateReq
+ * @brief
+ */
+class GrepSubCreateReq
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printGREP_SUB_CREATE_REQ(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 subscriptionType;
+ Uint32 senderRef;
+ Uint32 senderData;
+ SECTION( TABLE_LIST = 0 );
+};
+
+/**
+ * @class GrepSubCreateReq
+ * @brief
+ */
+class GrepSubCreateRef
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printGREP_SUB_CREATE_REF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 6 );
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 subscriptionType;
+ Uint32 err;
+ Uint32 senderRef;
+ Uint32 senderData;
+};
+
+
+/**
+ * @class GrepSubCreateConf
+ * @brief
+ */
+class GrepSubCreateConf
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printGREP_SUB_CREATE_CONF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 6 );
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 subscriptionType;
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 noOfNodeGroups;
+};
+
+
+
+/*****************************************************************************
+ * CREATE Internal between PS DB nodes
+ *****************************************************************************/
+
+/**
+ * @class GrepCreateReq
+ * @brief
+ */
+class GrepCreateReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class GrepParticipant;
+
+ friend bool printGREP_CREATE_REQ(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 8 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriberData;
+ Uint32 subscriberRef;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 subscriptionType;
+ SECTION( TABLE_LIST = 0 );
+};
+
+
+/**
+ * @class GrepCreateRef
+ * @brief
+ */
+class GrepCreateRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+
+ friend class GrepParticipant;
+
+ friend bool printGREP_CREATE_REF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ enum ErrorCode {
+ NF_FakeErrorREF = GrepError::NF_FakeErrorREF
+ };
+ STATIC_CONST( SignalLength = 6 );
+ Uint32 senderRef;
+ Uint32 senderData;
+ union {
+ Uint32 err;
+ Uint32 errorCode;
+ };
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 subscriptionType;
+};
+
+
+/**
+ * @class GrepCreateConf
+ * @brief
+ */
+class GrepCreateConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+
+ friend class GrepParticipant;
+
+ friend bool printGREP_CREATE_CONF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 6 );
+ Uint32 senderNodeId;
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 subscriptionType;
+};
+
+
+/*****************************************************************************
+ * START Between SS and PS (DB and REP nodes)
+ *****************************************************************************/
+
+/**
+ * @class GrepSubStartReq
+ * @brief
+ */
+class GrepSubStartReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printGREP_SUB_START_REQ(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 part;
+};
+
+/**
+ * @class GrepSubStartRef
+ * @brief
+ */
+class GrepSubStartRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printGREP_SUB_START_REF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 6 );
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 err;
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 part;
+};
+
+
+
+/**
+ * @class GrepSubStartConf
+ * @brief
+ */
+class GrepSubStartConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printGREP_SUB_START_CONF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 6 );
+
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 part;
+ Uint32 firstGCI;
+};
+
+
+/*****************************************************************************
+ * START Internal between PS DB nodes
+ *****************************************************************************/
+
+/**
+ * @class GrepStartReq
+ * @brief
+ */
+class GrepStartReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class GrepParticipant;
+
+ friend bool printGREP_START_REQ(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ Uint32 senderData;
+ Uint32 part;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+};
+
+
+/**
+ * @class GrepStartRef
+ * @brief
+ */
+class GrepStartRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+
+ friend class GrepParticipant;
+
+ friend bool printGREP_START_REF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ enum ErrorCode {
+ NF_FakeErrorREF = GrepError::NF_FakeErrorREF
+ };
+ STATIC_CONST( SignalLength = 6 );
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 part;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ union {
+ Uint32 err;
+ Uint32 errorCode;
+ };
+};
+
+
+/**
+ * @class GrepStartConf
+ * @brief
+ */
+class GrepStartConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+
+ friend class GrepParticipant;
+
+ friend bool printGREP_START_CONF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+ public:
+ STATIC_CONST( SignalLength = 7 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 part;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 firstGCI;
+ Uint32 senderNodeId;
+ };
+
+
+/*****************************************************************************
+ * SCAN (SYNC) Between SS and PS (REP and DB nodes)
+ *****************************************************************************/
+
+/**
+ * @class GrepSubSyncReq
+ * @brief
+ */
+class GrepSubSyncReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printGREP_SUB_SYNC_REQ(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 part;
+};
+
+
+/**
+ * @class GrepSubSyncRef
+ * @brief
+ */
+class GrepSubSyncRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printGREP_SUB_SYNC_REF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 6 );
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 senderRef;
+ Uint32 err;
+ Uint32 senderData;
+ Uint32 part;
+};
+
+
+/**
+ * @class GrepSubSyncConf
+ * @brief
+ */
+class GrepSubSyncConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printGREP_SUB_SYNC_CONF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+ public:
+ STATIC_CONST( SignalLength = 7 );
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 part;
+ Uint32 firstGCI;
+ Uint32 lastGCI;
+};
+
+
+
+/*****************************************************************************
+ * SCAN (SYNC) Internal between PS DB nodes
+ *****************************************************************************/
+
+/**
+ * @class GrepSyncReq
+ * @brief
+ */
+class GrepSyncReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class GrepParticipant;
+
+ friend bool printGREP_SYNC_REQ(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ Uint32 senderData;
+ Uint32 part;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+};
+
+
+/**
+ * @class GrepSyncRef
+ * @brief
+ */
+class GrepSyncRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+
+ friend class GrepParticipant;
+
+ friend bool printGREP_SYNC_REF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ enum ErrorCode {
+ NF_FakeErrorREF = GrepError::NF_FakeErrorREF
+ };
+ STATIC_CONST( SignalLength = 6 );
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 part;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ union {
+ Uint32 err;
+ Uint32 errorCode;
+ };
+};
+
+
+/**
+ * @class GrepSyncConf
+ * @brief
+ */
+class GrepSyncConf
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class GrepParticipant;
+
+ friend bool printGREP_SYNC_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 8 );
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 part;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 senderNodeId;
+ Uint32 firstGCI;
+ Uint32 lastGCI;
+};
+
+/*****************************************************************************
+ * ABORT - remove subscription
+ *****************************************************************************/
+
+/**
+ * @class GrepSubRemoveReq
+ * @brief Between PS and SS
+ */
+class GrepSubRemoveReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printGREP_SUB_REMOVE_REQ(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+};
+
+
+/**
+ * @class GrepSubRemoveRef
+ * @brief Between PS and SS
+ */
+class GrepSubRemoveRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printGREP_SUB_REMOVE_REF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 err;
+};
+
+
+/**
+ * @class
+ * @brief
+ */
+class GrepSubRemoveConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printGREP_SUB_REMOVE_CONF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+};
+
+
+/**
+ * @class
+ * @brief
+ */
+class GrepRemoveReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class GrepParticipant;
+
+ friend bool printGREP_REMOVE_REQ(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+};
+
+
+/**
+ * @class
+ * @brief
+ */
+class GrepRemoveRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+
+ friend class GrepParticipant;
+
+ friend bool printGREP_REMOVE_REF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ enum ErrorCode {
+ NF_FakeErrorREF = GrepError::NF_FakeErrorREF
+ };
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ union {
+ Uint32 err;
+ Uint32 errorCode;
+ };
+};
+
+
+/**
+ * @class
+ * @brief
+ */
+class GrepRemoveConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+
+ friend class GrepParticipant;
+
+ friend bool printGREP_REMOVE_CONF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 senderNodeId;
+};
+
+
+/*****************************************************************************
+ * WAIT FOR CGP
+ *****************************************************************************/
+
+/**
+ * @class GrepWaitGcpReq
+ * @brief
+ */
+class GrepWaitGcpReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+
+ friend class GrepParticipant;
+
+ friend bool printGREP_WAITGCP_REQ(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+ Uint32 senderData;
+ Uint32 gcp;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 senderNodeId;
+};
+
+/**
+ * @class GrepWaitGcpConf
+ * @brief
+ */
+class GrepWaitGcpConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+
+ friend class GrepParticipant;
+
+ friend bool printGREP_WAITGCP_CONF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 senderNodeId;
+};
+
+
+
+class GrepCreateSubscriptionIdConf {
+ friend class Grep;
+
+ friend bool printGREP_CREATE_SUBSCRIPTION_ID_CONF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ union { // Haven't decide what to call it
+ Uint32 senderData;
+ Uint32 subscriberData;
+ };
+};
+
+
+
+class GrepStartMe {
+ friend class Grep;
+ friend bool printGREP_START_ME(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 1 );
+ Uint32 senderRef;
+};
+
+
+
+
+/**
+ * @class GrepAddSubReq
+ * @brief
+ */
+class GrepAddSubReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class GrepParticipant;
+
+ friend bool printGREP_ADD_SUB_REQ(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 7 );
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriberData;
+ Uint32 subscriberRef;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 subscriptionType;
+};
+
+
+/**
+ * @class GrepAddSubRef
+ * @brief
+ */
+class GrepAddSubRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+
+ friend class GrepParticipant;
+
+ friend bool printGREP_CREATE_REF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderData;
+ Uint32 err;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 subscriptionType;
+};
+
+
+/**
+ * @class GrepAddSubConf
+ * @brief
+ */
+class GrepAddSubConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+
+ friend class GrepParticipant;
+
+ friend bool printGREP_CREATE_CONF(FILE *,
+ const Uint32 *,
+ Uint32,
+ Uint16);
+public:
+ STATIC_CONST( SignalLength = 1 );
+ Uint32 noOfSub;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/HotSpareRep.hpp b/ndb/include/kernel/signaldata/HotSpareRep.hpp
new file mode 100644
index 00000000000..fb9d338be1b
--- /dev/null
+++ b/ndb/include/kernel/signaldata/HotSpareRep.hpp
@@ -0,0 +1,48 @@
+/* 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 HOT_SPAREREP_HPP
+#define HOT_SPAREREP_HPP
+
+#include <NodeBitmask.hpp>
+
+/**
+ * This signals is sent by Dbdih to Dbdict
+ */
+class HotSpareRep {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbdict;
+
+public:
+ STATIC_CONST( SignalLength = 1 + NodeBitmask::Size );
+private:
+
+ Uint32 noHotSpareNodes;
+ Uint32 theHotSpareNodes[NodeBitmask::Size];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/IndxAttrInfo.hpp b/ndb/include/kernel/signaldata/IndxAttrInfo.hpp
new file mode 100755
index 00000000000..ec5790d84f3
--- /dev/null
+++ b/ndb/include/kernel/signaldata/IndxAttrInfo.hpp
@@ -0,0 +1,56 @@
+/* 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 INDX_ATTRINFO_HPP
+#define INDX_ATTRINFO_HPP
+
+#include "SignalData.hpp"
+
+class IndxAttrInfo {
+ /**
+ * Sender(s)
+ */
+ friend class NdbIndexOperation;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbtc;
+
+ friend bool printINDXATTRINFO(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( HeaderLength = 3 );
+ STATIC_CONST( DataLength = 22 );
+ STATIC_CONST( MaxSignalLength = HeaderLength + DataLength);
+
+ // Public methods
+public:
+ Uint32* getData() const;
+
+private:
+ Uint32 connectPtr;
+ Uint32 transId[2];
+ Uint32 attrData[DataLength];
+};
+
+inline
+Uint32* IndxAttrInfo::getData() const
+{
+ return (Uint32*)&attrData[0];
+}
+
+#endif
diff --git a/ndb/include/kernel/signaldata/IndxKeyInfo.hpp b/ndb/include/kernel/signaldata/IndxKeyInfo.hpp
new file mode 100755
index 00000000000..7cd7795ec71
--- /dev/null
+++ b/ndb/include/kernel/signaldata/IndxKeyInfo.hpp
@@ -0,0 +1,56 @@
+/* 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 INDX_KEY_INFO_HPP
+#define INDX_KEY_INFO_HPP
+
+#include "SignalData.hpp"
+
+class IndxKeyInfo {
+ /**
+ * Sender(s)
+ */
+ friend class NdbIndexOperation;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc;
+
+ friend bool printINDXKEYINFO(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( HeaderLength = 3 );
+ STATIC_CONST( DataLength = 20 );
+ STATIC_CONST( MaxSignalLength = HeaderLength + DataLength );
+
+ // Public methods
+public:
+ Uint32* getData() const;
+
+private:
+ Uint32 connectPtr;
+ Uint32 transId[2];
+ Uint32 keyData[DataLength];
+};
+
+inline
+Uint32* IndxKeyInfo::getData() const
+{
+ return (Uint32*)&keyData[0];
+}
+
+#endif
diff --git a/ndb/include/kernel/signaldata/InvalidateNodeLCPConf.hpp b/ndb/include/kernel/signaldata/InvalidateNodeLCPConf.hpp
new file mode 100644
index 00000000000..2497af354ce
--- /dev/null
+++ b/ndb/include/kernel/signaldata/InvalidateNodeLCPConf.hpp
@@ -0,0 +1,41 @@
+/* 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 INVALIDATE_NODE_LCP_CONF_HPP
+#define INVALIDATE_NODE_LCP_CONF_HPP
+
+/**
+ * This signal is sent from the non-master DIH to master DIHs
+ *
+ */
+class InvalidateNodeLCPConf {
+
+ /**
+ * Sender/Receiver
+ */
+ friend class Dbdih;
+
+ /**
+ * NodeId of sending node
+ * which is "done"
+ */
+ Uint32 sendingNodeId;
+
+public:
+ STATIC_CONST( SignalLength = 1 );
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/InvalidateNodeLCPReq.hpp b/ndb/include/kernel/signaldata/InvalidateNodeLCPReq.hpp
new file mode 100644
index 00000000000..e55a58710b4
--- /dev/null
+++ b/ndb/include/kernel/signaldata/InvalidateNodeLCPReq.hpp
@@ -0,0 +1,42 @@
+/* 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 INVALIDATE_NODE_LCP_REQ_HPP
+#define INVALIDATE_NODE_LCP_REQ_HPP
+
+/**
+ * This signal is sent from the master DIH to all DIHs
+ * when a node is starting without filesystem.
+ *
+ * All DIHs must then "forgett" that the starting node has
+ * performed LCP
+ *
+ * @see StartPermReq
+ */
+class InvalidateNodeLCPReq {
+
+ /**
+ * Sender/Receiver
+ */
+ friend class Dbdih;
+
+ Uint32 startingNodeId;
+
+public:
+ STATIC_CONST( SignalLength = 1 );
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/KeyInfo.hpp b/ndb/include/kernel/signaldata/KeyInfo.hpp
new file mode 100644
index 00000000000..b839a2c2035
--- /dev/null
+++ b/ndb/include/kernel/signaldata/KeyInfo.hpp
@@ -0,0 +1,45 @@
+/* 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 KEY_INFO_HPP
+#define KEY_INFO_HPP
+
+#include "SignalData.hpp"
+
+class KeyInfo {
+ /**
+ * Sender(s)
+ */
+ friend class DbUtil;
+ friend class NdbOperation;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc;
+
+public:
+ STATIC_CONST( HeaderLength = 3 );
+ STATIC_CONST( DataLength = 20 );
+ STATIC_CONST( MaxSignalLength = HeaderLength + DataLength );
+
+private:
+ Uint32 connectPtr;
+ Uint32 transId[2];
+ Uint32 keyData[DataLength];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/LCP.hpp b/ndb/include/kernel/signaldata/LCP.hpp
new file mode 100644
index 00000000000..7d3fb71ae7e
--- /dev/null
+++ b/ndb/include/kernel/signaldata/LCP.hpp
@@ -0,0 +1,154 @@
+/* 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 LCP_SIGNAL_DATA_HPP
+#define LCP_SIGNAL_DATA_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+
+class StartLcpReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Sender(s) / Receiver(s)
+ */
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+
+ friend bool printSTART_LCP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+
+ STATIC_CONST( SignalLength = 2 + 2 * NdbNodeBitmask::Size );
+private:
+ Uint32 senderRef;
+ Uint32 lcpId;
+
+ NdbNodeBitmask participatingDIH;
+ NdbNodeBitmask participatingLQH;
+};
+
+class StartLcpConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Sender(s) / Receiver(s)
+ */
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+
+ friend bool printSTART_LCP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+
+ STATIC_CONST( SignalLength = 2 );
+private:
+ Uint32 senderRef;
+ Uint32 lcpId;
+};
+
+/**
+ * This signals is sent by Dbdih to Dblqh
+ * to order checkpointing of a certain
+ * fragment.
+ */
+class LcpFragOrd {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Sender(s) / Receiver(s)
+ */
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+
+ friend bool printLCP_FRAG_ORD(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 6 );
+private:
+
+ Uint32 tableId;
+ Uint32 fragmentId;
+ Uint32 lcpNo;
+ Uint32 lcpId;
+ Uint32 lastFragmentFlag;
+ Uint32 keepGci;
+};
+
+
+class LcpFragRep {
+ /**
+ * Sender(s) and receiver(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ friend bool printLCP_FRAG_REP(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 7 );
+
+private:
+ Uint32 nodeId;
+ Uint32 lcpId;
+ Uint32 lcpNo;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 maxGciCompleted;
+ Uint32 maxGciStarted;
+};
+
+class LcpCompleteRep {
+ /**
+ * Sender(s) and receiver(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ friend bool printLCP_COMPLETE_REP(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 nodeId;
+ Uint32 blockNo;
+ Uint32 lcpId;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/ListTables.hpp b/ndb/include/kernel/signaldata/ListTables.hpp
new file mode 100644
index 00000000000..7fbfab1294c
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ListTables.hpp
@@ -0,0 +1,166 @@
+/* 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 LIST_TABLES_HPP
+#define LIST_TABLES_HPP
+
+#include <Bitmask.hpp>
+#include "SignalData.hpp"
+
+/**
+ * It is convenient to pack request/response data per table in one
+ * 32-bit word...
+ */
+class ListTablesData {
+public:
+ static Uint32 getTableId(Uint32 data) {
+ return BitmaskImpl::getField(1, &data, 0, 12);
+ }
+ static void setTableId(Uint32& data, Uint32 val) {
+ BitmaskImpl::setField(1, &data, 0, 12, val);
+ }
+ static Uint32 getTableType(Uint32 data) {
+ return BitmaskImpl::getField(1, &data, 12, 8);
+ }
+ static void setTableType(Uint32& data, Uint32 val) {
+ BitmaskImpl::setField(1, &data, 12, 8, val);
+ }
+ static Uint32 getTableStore(Uint32 data) {
+ return BitmaskImpl::getField(1, &data, 20, 4);
+ }
+ static void setTableStore(Uint32& data, Uint32 val) {
+ BitmaskImpl::setField(1, &data, 20, 4, val);
+ }
+ static Uint32 getTableState(Uint32 data) {
+ return BitmaskImpl::getField(1, &data, 24, 4);
+ }
+ static void setTableState(Uint32& data, Uint32 val) {
+ BitmaskImpl::setField(1, &data, 24, 4, val);
+ }
+ static Uint32 getListNames(Uint32 data) {
+ return BitmaskImpl::getField(1, &data, 28, 1);
+ }
+ static void setListNames(Uint32& data, Uint32 val) {
+ BitmaskImpl::setField(1, &data, 28, 1, val);
+ }
+ static Uint32 getListIndexes(Uint32 data) {
+ return BitmaskImpl::getField(1, &data, 29, 1);
+ }
+ static void setListIndexes(Uint32& data, Uint32 val) {
+ BitmaskImpl::setField(1, &data, 29, 1, val);
+ }
+};
+
+class ListTablesReq {
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+ friend class Table;
+ friend class Suma;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbdict;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+public:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 requestData;
+
+ Uint32 getTableId() {
+ return ListTablesData::getTableId(requestData);
+ }
+ void setTableId(Uint32 val) {
+ ListTablesData::setTableId(requestData, val);
+ }
+ Uint32 getTableType() const {
+ return ListTablesData::getTableType(requestData);
+ }
+ void setTableType(Uint32 val) {
+ ListTablesData::setTableType(requestData, val);
+ }
+ Uint32 getListNames() const {
+ return ListTablesData::getListNames(requestData);
+ }
+ void setListNames(Uint32 val) {
+ ListTablesData::setListNames(requestData, val);
+ }
+ Uint32 getListIndexes() const {
+ return ListTablesData::getListIndexes(requestData);
+ }
+ void setListIndexes(Uint32 val) {
+ ListTablesData::setListIndexes(requestData, val);
+ }
+};
+
+class ListTablesConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Backup;
+ friend class Table;
+ friend class Suma;
+
+public:
+ /**
+ * Note: last signal is indicated by having length < 25
+ */
+ STATIC_CONST( SignalLength = 25 );
+ STATIC_CONST( HeaderLength = 2 );
+ STATIC_CONST( DataLength = 23 );
+
+public:
+ Uint32 senderData;
+ Uint32 counter;
+ Uint32 tableData[DataLength];
+
+ static Uint32 getTableId(Uint32 data) {
+ return ListTablesData::getTableId(data);
+ }
+ void setTableId(unsigned pos, Uint32 val) {
+ ListTablesData::setTableId(tableData[pos], val);
+ }
+ static Uint32 getTableType(Uint32 data) {
+ return ListTablesData::getTableType(data);
+ }
+ void setTableType(unsigned pos, Uint32 val) {
+ ListTablesData::setTableType(tableData[pos], val);
+ }
+ static Uint32 getTableStore(Uint32 data) {
+ return ListTablesData::getTableStore(data);
+ }
+ void setTableStore(unsigned pos, Uint32 val) {
+ ListTablesData::setTableStore(tableData[pos], val);
+ }
+ static Uint32 getTableState(Uint32 data) {
+ return ListTablesData::getTableState(data);
+ }
+ void setTableState(unsigned pos, Uint32 val) {
+ ListTablesData::setTableState(tableData[pos], val);
+ }
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/LqhFrag.hpp b/ndb/include/kernel/signaldata/LqhFrag.hpp
new file mode 100644
index 00000000000..116e9c01ca0
--- /dev/null
+++ b/ndb/include/kernel/signaldata/LqhFrag.hpp
@@ -0,0 +1,252 @@
+/* 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 LQH_FRAG_HPP
+#define LQH_FRAG_HPP
+
+#include "SignalData.hpp"
+
+class AddFragReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+ friend bool printADD_FRAG_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 9 );
+
+ enum RequestInfo {
+ CreateInRunning = 0x8000000,
+ TemporaryTable = 0x00000010
+ };
+private:
+ Uint32 dihPtr;
+ Uint32 senderData; // The same data as sent in DIADDTABREQ
+ Uint32 fragmentId;
+ Uint32 requestInfo;
+ Uint32 tableId;
+ Uint32 nextLCP;
+ Uint32 nodeId;
+ Uint32 totalFragments;
+ Uint32 startGci;
+};
+
+class AddFragRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+
+ friend bool printADD_FRAG_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+private:
+ Uint32 dihPtr;
+};
+
+class AddFragConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+
+ friend bool printADD_FRAG_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 dihPtr;
+ Uint32 fragId;
+};
+
+class LqhFragReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+
+ friend bool printLQH_FRAG_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 25 );
+
+ enum RequestInfo {
+ CreateInRunning = 0x8000000,
+ TemporaryTable = 0x00000010
+ };
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 fragmentId;
+ Uint32 requestInfo;
+ Uint32 tableId;
+ Uint32 localKeyLength;
+ Uint32 maxLoadFactor;
+ Uint32 minLoadFactor;
+ Uint32 kValue;
+ Uint32 lh3DistrBits;
+ Uint32 lh3PageBits;
+ Uint32 noOfAttributes;
+ Uint32 noOfNullAttributes;
+ Uint32 noOfPagesToPreAllocate;
+ Uint32 schemaVersion;
+ Uint32 keyLength;
+ Uint32 nextLCP;
+ Uint32 noOfKeyAttr;
+ Uint32 noOfNewAttr;
+ Uint32 checksumIndicator;
+ Uint32 noOfAttributeGroups;
+ Uint32 GCPIndicator;
+ Uint32 startGci;
+ Uint32 tableType; // DictTabInfo::TableType
+ Uint32 primaryTableId; // table of index or RNIL
+};
+
+class LqhFragConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+ friend bool printLQH_FRAG_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 senderData;
+ Uint32 lqhFragPtr;
+};
+
+class LqhFragRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+ friend bool printLQH_FRAG_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 senderData;
+ Uint32 errorCode;
+};
+
+class LqhAddAttrReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+
+ friend bool printLQH_ADD_ATTR_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( HeaderLength = 4 );
+ STATIC_CONST( EntryLength = 3 );
+ STATIC_CONST( MAX_ATTRIBUTES = 6 );
+ struct Entry {
+ Uint32 attrId; // for index, includes primary attr id << 16
+ Uint32 attrDescriptor; // 2 words type info
+ Uint32 extTypeInfo;
+ };
+private:
+ Uint32 lqhFragPtr;
+ Uint32 noOfAttributes;
+ Uint32 senderData;
+ Uint32 senderAttrPtr;
+ Entry attributes[MAX_ATTRIBUTES];
+};
+
+class LqhAddAttrRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+ friend bool printLQH_ADD_ATTR_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 senderData;
+ Uint32 errorCode;
+};
+
+class LqhAddAttrConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+ friend bool printLQH_ADD_ATTR_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderAttrPtr;
+ Uint32 fragId;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/LqhKey.hpp b/ndb/include/kernel/signaldata/LqhKey.hpp
new file mode 100644
index 00000000000..e937180e3f7
--- /dev/null
+++ b/ndb/include/kernel/signaldata/LqhKey.hpp
@@ -0,0 +1,534 @@
+/* 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 LQH_KEY_H
+#define LQH_KEY_H
+
+#include "SignalData.hpp"
+
+class LqhKeyReq {
+ /**
+ * Reciver(s)
+ */
+ friend class Dblqh; // Reciver
+
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * For printing
+ */
+ friend bool printLQHKEYREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( FixedSignalLength = 11 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+//-------------------------------------------------------------
+// Unconditional part. First 10 words
+//-------------------------------------------------------------
+ UintR clientConnectPtr; // DATA 0
+ UintR attrLen; // DATA 1
+ UintR hashValue; // DATA 2
+ UintR requestInfo; // DATA 3
+ UintR tcBlockref; // DATA 4
+ UintR tableSchemaVersion; // DATA 5
+ UintR fragmentData; // DATA 6
+ UintR transId1; // DATA 7
+ UintR transId2; // DATA 8
+ UintR savePointId; // DATA 9
+ union {
+ /**
+ * When sent from TC -> LQH this variable contains scanInfo
+ * When send from LQH -> LQH this variable contains noFiredTriggers
+ */
+ UintR noFiredTriggers; // DATA 10
+ Uint32 scanInfo; // DATA 10
+ };
+
+//-------------------------------------------------------------
+// Variable sized key part. Those will be placed to
+// pack the signal in an appropriate manner.
+//-------------------------------------------------------------
+ UintR variableData[10]; // DATA 11 - 21
+
+ static UintR getAttrLen(const UintR & scanInfoAttrLen);
+ static UintR getScanTakeOverFlag(const UintR & scanInfoAttrLen);
+ static UintR getStoredProcFlag(const UintR & scanData);
+ static UintR getDistributionKey(const UintR & scanData);
+
+ static UintR getTableId(const UintR & tableSchemaVersion);
+ static UintR getSchemaVersion(const UintR & tableSchemaVersion);
+
+ static UintR getFragmentId(const UintR & fragmentData);
+ static UintR getNextReplicaNodeId(const UintR & fragmentData);
+
+ static Uint8 getLockType(const UintR & requestInfo);
+ static Uint8 getDirtyFlag(const UintR & requestInfo);
+ static Uint8 getInterpretedFlag(const UintR & requestInfo);
+ static Uint8 getSimpleFlag(const UintR & requestInfo);
+ static Uint8 getOperation(const UintR & requestInfo);
+ static Uint8 getSeqNoReplica(const UintR & requestInfo);
+ static Uint8 getLastReplicaNo(const UintR & requestInfo);
+ static Uint8 getAIInLqhKeyReq(const UintR & requestInfo);
+ static UintR getKeyLen(const UintR & requestInfo);
+ static UintR getSameClientAndTcFlag(const UintR & requestInfo);
+ static UintR getReturnedReadLenAIFlag(const UintR & requestInfo);
+ static UintR getApplicationAddressFlag(const UintR & requestInfo);
+ static UintR getMarkerFlag(const UintR & requestInfo);
+
+ /**
+ * Setters
+ */
+
+ static void setAttrLen(UintR & scanInfoAttrLen, UintR val);
+ static void setScanTakeOverFlag(UintR & scanInfoAttrLen, UintR val);
+ static void setStoredProcFlag(UintR & scanData, UintR val);
+ static void setDistributionKey(UintR & scanData, UintR val);
+
+ static void setTableId(UintR & tableSchemaVersion, UintR val);
+ static void setSchemaVersion(UintR & tableSchemaVersion, UintR val);
+
+ static void setFragmentId(UintR & fragmentData, UintR val);
+ static void setNextReplicaNodeId(UintR & fragmentData, UintR val);
+
+ static void setLockType(UintR & requestInfo, UintR val);
+ static void setDirtyFlag(UintR & requestInfo, UintR val);
+ static void setInterpretedFlag(UintR & requestInfo, UintR val);
+ static void setSimpleFlag(UintR & requestInfo, UintR val);
+ static void setOperation(UintR & requestInfo, UintR val);
+ static void setSeqNoReplica(UintR & requestInfo, UintR val);
+ static void setLastReplicaNo(UintR & requestInfo, UintR val);
+ static void setAIInLqhKeyReq(UintR & requestInfo, UintR val);
+ static void setKeyLen(UintR & requestInfo, UintR val);
+ static void setSameClientAndTcFlag(UintR & requestInfo, UintR val);
+ static void setReturnedReadLenAIFlag(UintR & requestInfo, UintR val);
+ static void setApplicationAddressFlag(UintR & requestInfo, UintR val);
+ static void setMarkerFlag(UintR & requestInfo, UintR val);
+};
+
+/**
+ * Request Info
+ *
+ * k = Key len - 10 Bits (0-9) max 1023
+ * l = Last Replica No - 2 Bits -> Max 3 (10-11)
+ * t = Lock type - 3 Bits -> Max 7 (12-14)
+ * p = Application Addr. Ind - 1 Bit (15)
+ * d = Dirty indicator - 1 Bit (16)
+ * i = Interpreted indicator - 1 Bit (17)
+ * s = Simple indicator - 1 Bit (18)
+ * o = Operation - 3 Bits (19-21)
+ * r = Sequence replica - 2 Bits (22-23)
+ * a = Attr Info in LQHKEYREQ - 3 Bits (24-26)
+ * c = Same client and tc - 1 Bit (27)
+ * u = Read Len Return Ind - 1 Bit (28)
+ * m = Commit ack marker - 1 Bit (29)
+ * - = Unused - 2 Bits (30-31)
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * kkkkkkkkkklltttpdisooorraaacum--
+ */
+
+#define RI_KEYLEN_SHIFT (0)
+#define RI_KEYLEN_MASK (1023)
+#define RI_LAST_REPL_SHIFT (10)
+#define RI_LAST_REPL_MASK (3)
+#define RI_LOCK_TYPE_SHIFT (12)
+#define RI_LOCK_TYPE_MASK (7)
+#define RI_APPL_ADDR_SHIFT (15)
+#define RI_DIRTY_SHIFT (16)
+#define RI_INTERPRETED_SHIFT (17)
+#define RI_SIMPLE_SHIFT (18)
+#define RI_OPERATION_SHIFT (19)
+#define RI_OPERATION_MASK (7)
+#define RI_SEQ_REPLICA_SHIFT (22)
+#define RI_SEQ_REPLICA_MASK (3)
+#define RI_AI_IN_THIS_SHIFT (24)
+#define RI_AI_IN_THIS_MASK (7)
+#define RI_SAME_CLIENT_SHIFT (27)
+#define RI_RETURN_AI_SHIFT (28)
+#define RI_MARKER_SHIFT (29)
+
+/**
+ * Scan Info
+ *
+ * a = Attr Len - 16 Bits -> max 65535 (0-15)
+ * p = Stored Procedure Ind - 1 Bit (16)
+ * d = Distribution key - 8 Bit -> max 255 (17-24)
+ * t = Scan take over indicator - 1 Bit (25)
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * aaaaaaaaaaaaaaaapddddddddt
+ */
+
+#define SI_ATTR_LEN_MASK (65535)
+#define SI_ATTR_LEN_SHIFT (0)
+#define SI_STORED_PROC_SHIFT (16)
+#define SI_DISTR_KEY_MASK (255)
+#define SI_DISTR_KEY_SHIFT (17)
+#define SI_SCAN_TO_SHIFT (25)
+#define SI_SCAN_INFO_MASK (63)
+#define SI_SCAN_INFO_SHIFT (26)
+
+inline
+UintR
+LqhKeyReq::getAttrLen(const UintR & scanData)
+{
+ return (scanData >> SI_ATTR_LEN_SHIFT) & SI_ATTR_LEN_MASK;
+}
+
+inline
+Uint32
+LqhKeyReq::getScanTakeOverFlag(const UintR & scanData)
+{
+ return (scanData >> SI_SCAN_TO_SHIFT) & 1;
+}
+
+inline
+UintR
+LqhKeyReq::getStoredProcFlag(const UintR & scanData){
+ return (scanData >> SI_STORED_PROC_SHIFT) & 1;
+}
+
+inline
+UintR
+LqhKeyReq::getDistributionKey(const UintR & scanData){
+ return (scanData >> SI_DISTR_KEY_SHIFT) & SI_DISTR_KEY_MASK;
+}
+
+inline
+UintR LqhKeyReq::getTableId(const UintR & tableSchemaVersion)
+{
+ return tableSchemaVersion & 0xFFFF;
+}
+
+inline
+UintR LqhKeyReq::getSchemaVersion(const UintR & tableSchemaVersion)
+{
+ return tableSchemaVersion >> 16;
+}
+
+inline
+UintR LqhKeyReq::getFragmentId(const UintR & fragmentData)
+{
+ return fragmentData & 0xFFFF;
+}
+
+inline
+UintR LqhKeyReq::getNextReplicaNodeId(const UintR & fragmentData)
+{
+ return fragmentData >> 16;
+}
+
+inline
+Uint8 LqhKeyReq::getLastReplicaNo(const UintR & requestInfo)
+{
+ return (requestInfo >> RI_LAST_REPL_SHIFT) & RI_LAST_REPL_MASK;
+}
+
+inline
+Uint8 LqhKeyReq::getLockType(const UintR & requestInfo)
+{
+ return (requestInfo >> RI_LOCK_TYPE_SHIFT) & RI_LOCK_TYPE_MASK;
+}
+
+inline
+Uint8 LqhKeyReq::getDirtyFlag(const UintR & requestInfo)
+{
+ return (requestInfo >> RI_DIRTY_SHIFT) & 1;
+}
+
+inline
+Uint8 LqhKeyReq::getInterpretedFlag(const UintR & requestInfo)
+{
+ return (requestInfo >> RI_INTERPRETED_SHIFT) & 1;
+}
+
+inline
+Uint8 LqhKeyReq::getSimpleFlag(const UintR & requestInfo)
+{
+ return (requestInfo >> RI_SIMPLE_SHIFT) & 1;
+}
+
+inline
+Uint8 LqhKeyReq::getOperation(const UintR & requestInfo)
+{
+ return (requestInfo >> RI_OPERATION_SHIFT) & RI_OPERATION_MASK;
+}
+
+inline
+Uint8 LqhKeyReq::getSeqNoReplica(const UintR & requestInfo)
+{
+ return (requestInfo >> RI_SEQ_REPLICA_SHIFT) & RI_SEQ_REPLICA_MASK;
+}
+
+
+inline
+Uint8 LqhKeyReq::getAIInLqhKeyReq(const UintR & requestInfo)
+{
+ return (requestInfo >> RI_AI_IN_THIS_SHIFT) & RI_AI_IN_THIS_MASK;
+}
+
+inline
+UintR LqhKeyReq::getKeyLen(const UintR & requestInfo)
+{
+ return (requestInfo >> RI_KEYLEN_SHIFT) & RI_KEYLEN_MASK;
+}
+
+inline
+UintR
+LqhKeyReq::getSameClientAndTcFlag(const UintR & requestInfo)
+{
+ return (requestInfo >> RI_SAME_CLIENT_SHIFT) & 1;
+}
+
+inline
+UintR LqhKeyReq::getReturnedReadLenAIFlag(const UintR & requestInfo)
+{
+ return (requestInfo >> RI_RETURN_AI_SHIFT) & 1;
+}
+
+inline
+UintR
+LqhKeyReq::getApplicationAddressFlag(const UintR & requestInfo){
+ return (requestInfo >> RI_APPL_ADDR_SHIFT) & 1;
+}
+
+inline
+void
+LqhKeyReq::setAttrLen(UintR & scanInfoAttrLen, UintR val){
+ ASSERT_MAX(val, SI_ATTR_LEN_MASK, "LqhKeyReq::setAttrLen");
+ scanInfoAttrLen |= (val << SI_ATTR_LEN_SHIFT);
+}
+
+
+inline
+void
+LqhKeyReq::setScanTakeOverFlag(UintR & scanInfoAttrLen, UintR val){
+ ASSERT_BOOL(val, "LqhKeyReq::setScanTakeOverFlag");
+ scanInfoAttrLen |= (val << SI_SCAN_TO_SHIFT);
+}
+inline
+void
+
+LqhKeyReq::setStoredProcFlag(UintR & scanData, UintR val){
+ ASSERT_BOOL(val, "LqhKeyReq::setStoredProcFlag");
+ scanData |= (val << SI_STORED_PROC_SHIFT);
+}
+
+inline
+void
+
+LqhKeyReq::setDistributionKey(UintR & scanData, UintR val){
+ ASSERT_MAX(val, SI_DISTR_KEY_MASK, "LqhKeyReq::setDistributionKey");
+ scanData |= (val << SI_DISTR_KEY_SHIFT);
+}
+
+#if 0
+inline
+void
+
+LqhKeyReq::setTableId(UintR & tableSchemaVersion, UintR val){
+
+}
+inline
+void
+LqhKeyReq::setSchemaVersion(UintR & tableSchemaVersion, UintR val);
+
+inline
+void
+LqhKeyReq::setFragmentId(UintR & fragmentData, UintR val);
+
+inline
+void
+LqhKeyReq::setNextReplicaNodeId(UintR & fragmentData, UintR val);
+#endif
+
+inline
+void
+LqhKeyReq::setLockType(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, RI_LOCK_TYPE_MASK, "LqhKeyReq::setLockType");
+ requestInfo |= (val << RI_LOCK_TYPE_SHIFT);
+}
+
+inline
+void
+LqhKeyReq::setDirtyFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "LqhKeyReq::setDirtyFlag");
+ requestInfo |= (val << RI_DIRTY_SHIFT);
+}
+
+inline
+void
+LqhKeyReq::setInterpretedFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "LqhKeyReq::setInterpretedFlag");
+ requestInfo |= (val << RI_INTERPRETED_SHIFT);
+}
+
+inline
+void
+LqhKeyReq::setSimpleFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "LqhKeyReq::setSimpleFlag");
+ requestInfo |= (val << RI_SIMPLE_SHIFT);
+}
+
+inline
+void
+LqhKeyReq::setOperation(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, RI_OPERATION_MASK, "LqhKeyReq::setOperation");
+ requestInfo |= (val << RI_OPERATION_SHIFT);
+}
+
+inline
+void
+LqhKeyReq::setSeqNoReplica(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, RI_SEQ_REPLICA_MASK, "LqhKeyReq::setSeqNoReplica");
+ requestInfo |= (val << RI_SEQ_REPLICA_SHIFT);
+}
+
+inline
+void
+LqhKeyReq::setLastReplicaNo(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, RI_LAST_REPL_MASK, "LqhKeyReq::setLastReplicaNo");
+ requestInfo |= (val << RI_LAST_REPL_SHIFT);
+}
+
+inline
+void
+LqhKeyReq::setAIInLqhKeyReq(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, RI_AI_IN_THIS_MASK, "LqhKeyReq::setAIInLqhKeyReq");
+ requestInfo |= (val << RI_AI_IN_THIS_SHIFT);
+}
+
+inline
+void
+LqhKeyReq::setKeyLen(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, RI_KEYLEN_MASK, "LqhKeyReq::setKeyLen");
+ requestInfo |= (val << RI_KEYLEN_SHIFT);
+}
+
+inline
+void
+LqhKeyReq::setSameClientAndTcFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "LqhKeyReq::setSameClientAndTcFlag");
+ requestInfo |= (val << RI_SAME_CLIENT_SHIFT);
+}
+
+inline
+void
+LqhKeyReq::setReturnedReadLenAIFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "LqhKeyReq::setReturnedReadLenAIFlag");
+ requestInfo |= (val << RI_RETURN_AI_SHIFT);
+}
+
+inline
+void
+LqhKeyReq::setApplicationAddressFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "LqhKeyReq::setApplicationAddressFlag");
+ requestInfo |= (val << RI_APPL_ADDR_SHIFT);
+}
+
+/**** */
+
+inline
+void
+LqhKeyReq::setMarkerFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "LqhKeyReq::setMarkerFlag");
+ requestInfo |= (val << RI_MARKER_SHIFT);
+}
+
+inline
+UintR
+LqhKeyReq::getMarkerFlag(const UintR & requestInfo){
+ return (requestInfo >> RI_MARKER_SHIFT) & 1;
+}
+
+class LqhKeyConf {
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ // Sent in a packed signal
+ friend class PackedSignal;
+ /**
+ * For printing
+ */
+ friend bool printPACKED_SIGNAL(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+ friend bool printLQHKEYCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( SignalLength = 7 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+ Uint32 connectPtr;
+ Uint32 opPtr;
+ Uint32 userRef;
+ Uint32 readLen;
+ Uint32 transId1;
+ Uint32 transId2;
+ Uint32 noFiredTriggers;
+};
+
+class LqhKeyRef {
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * For printing
+ */
+ friend bool printLQHKEYREF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+ Uint32 userRef;
+ Uint32 connectPtr;
+ Uint32 errorCode;
+ Uint32 transId1;
+ Uint32 transId2;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/LqhSizeAltReq.hpp b/ndb/include/kernel/signaldata/LqhSizeAltReq.hpp
new file mode 100644
index 00000000000..e47ce39897a
--- /dev/null
+++ b/ndb/include/kernel/signaldata/LqhSizeAltReq.hpp
@@ -0,0 +1,53 @@
+/* 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 LQH_SIZE_ALT_REQ_H
+#define LQH_SIZE_ALT_REQ_H
+
+
+
+#include "SignalData.hpp"
+
+class LqhSizeAltReq {
+ /**
+ * Sender(s)
+ */
+ friend class ClusterConfiguration;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dblqh;
+private:
+ /**
+ * Indexes in theData
+ */
+ STATIC_CONST( IND_BLOCK_REF = 0);
+ STATIC_CONST( IND_FRAG = 1);
+ STATIC_CONST( IND_CONNECT = 2);
+ STATIC_CONST( IND_TABLE = 3);
+ STATIC_CONST( IND_TC_CONNECT = 4);
+ STATIC_CONST( IND_REPLICAS = 5);
+ STATIC_CONST( IND_LOG_FILES = 6);
+ STATIC_CONST( IND_SCAN = 7);
+
+ /**
+ * Use the index definitions to use the signal data
+ */
+ UintR theData[8];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/LqhTransConf.hpp b/ndb/include/kernel/signaldata/LqhTransConf.hpp
new file mode 100644
index 00000000000..f62dfd07f51
--- /dev/null
+++ b/ndb/include/kernel/signaldata/LqhTransConf.hpp
@@ -0,0 +1,218 @@
+/* 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 LQH_TRANS_CONF_H
+#define LQH_TRANS_CONF_H
+
+#include "SignalData.hpp"
+
+/**
+ * This signal is sent as response to a LQH_TRANSREQ
+ * which is sent as by a take-over TC
+ */
+class LqhTransConf {
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ friend bool printLQH_TRANSCONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 15 );
+private:
+
+ /**
+ * This type describes the state of the operation returned in this signal
+ */
+ enum OperationStatus {
+ InvalidStatus = 0, /**< This status should never be sent in a signal
+ it is only used for initializing variables so that
+ you can easily later check if they have changed */
+ LastTransConf = 4, /**< This status indicates that LQH has finished the scan
+ of operations belonging to the died TC.
+ Data 0 - 2 is valid */
+
+ Prepared = 2,
+ Committed = 3,
+ Aborted = 1,
+ Marker = 5 /**< This means that the only thing left is a marker,
+ Data 0 - 6 is valid */
+ };
+
+ /**
+ * DATA VARIABLES
+ */
+ Uint32 tcRef; // 0
+ Uint32 lqhNodeId; // 1
+ Uint32 operationStatus; // 2 See enum OperationStatus
+ Uint32 transId1; // 3
+ Uint32 transId2; // 4
+ Uint32 apiRef; // 5
+ Uint32 apiOpRec; // 6
+ Uint32 lqhConnectPtr;
+ Uint32 oldTcOpRec;
+ Uint32 requestInfo;
+ Uint32 gci;
+ Uint32 nextNodeId1;
+ Uint32 nextNodeId2;
+ Uint32 nextNodeId3;
+ Uint32 tableId;
+
+ /**
+ * Getters
+ */
+ static Uint32 getReplicaNo(Uint32 & requestInfo);
+ static Uint32 getReplicaType(Uint32 & requestInfo);
+ static Uint32 getLastReplicaNo(Uint32 & requestInfo);
+ static Uint32 getSimpleFlag(Uint32 & requestInfo);
+ static Uint32 getDirtyFlag(Uint32 & requestInfo);
+ static Uint32 getOperation(Uint32 & requestInfo);
+ static Uint32 getMarkerFlag(Uint32 & requestInfo);
+
+ static void setReplicaNo(UintR & requestInfo, UintR val);
+ static void setReplicaType(UintR & requestInfo, UintR val);
+ static void setLastReplicaNo(UintR & requestInfo, UintR val);
+ static void setSimpleFlag(UintR & requestInfo, UintR val);
+ static void setDirtyFlag(UintR & requestInfo, UintR val);
+ static void setOperation(UintR & requestInfo, UintR val);
+ static void setMarkerFlag(Uint32 & requestInfo, Uint32 val);
+};
+
+/**
+ * Request Info
+ *
+ * t = replica type - 2 Bits (0-1)
+ * r = Replica No - 2 Bits (2-3)
+ * l = Last Replica No - 2 Bits (4-5)
+ * s = Simple - 1 Bits (6)
+ * d = Dirty - 1 Bit (7)
+ * o = Operation - 3 Bit (8-9)
+ * m = Marker present - 1 Bit (10)
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * ttrrllsdooom
+ */
+#define LTC_REPLICA_TYPE_SHIFT (0)
+#define LTC_REPLICA_TYPE_MASK (3)
+#define LTC_REPLICA_NO_SHIFT (2)
+#define LTC_REPLICA_NO_MASK (3)
+#define LTC_LAST_REPLICA_SHIFT (4)
+#define LTC_LAST_REPLICA_MASK (3)
+#define LTC_SIMPLE_SHIFT (6)
+#define LTC_DIRTY_SHIFT (7)
+#define LTC_OPERATION_SHIFT (8)
+#define LTC_OPERATION_MASK (7)
+#define LTC_MARKER_SHIFT (10)
+
+inline
+Uint32
+LqhTransConf::getReplicaType(Uint32 & requestInfo){
+ return (requestInfo >> LTC_REPLICA_TYPE_SHIFT) & LTC_REPLICA_TYPE_MASK;
+}
+
+inline
+Uint32
+LqhTransConf::getReplicaNo(Uint32 & requestInfo){
+ return (requestInfo >> LTC_REPLICA_NO_SHIFT) & LTC_REPLICA_NO_MASK;
+}
+
+inline
+Uint32
+LqhTransConf::getLastReplicaNo(Uint32 & requestInfo){
+ return (requestInfo >> LTC_LAST_REPLICA_SHIFT) & LTC_LAST_REPLICA_MASK;
+}
+
+inline
+Uint32
+LqhTransConf::getSimpleFlag(Uint32 & requestInfo){
+ return (requestInfo >> LTC_SIMPLE_SHIFT) & 1;
+}
+
+inline
+Uint32
+LqhTransConf::getDirtyFlag(Uint32 & requestInfo){
+ return (requestInfo >> LTC_DIRTY_SHIFT) & 1;
+}
+
+inline
+Uint32
+LqhTransConf::getOperation(Uint32 & requestInfo){
+ return (requestInfo >> LTC_OPERATION_SHIFT) & LTC_OPERATION_MASK;
+}
+
+inline
+Uint32
+LqhTransConf::getMarkerFlag(Uint32 & requestInfo){
+ return (requestInfo >> LTC_MARKER_SHIFT) & 1;
+}
+
+
+inline
+void
+LqhTransConf::setReplicaNo(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, LTC_REPLICA_NO_MASK, "LqhTransConf::setReplicaNo");
+ requestInfo |= (val << LTC_REPLICA_NO_SHIFT);
+}
+
+inline
+void
+LqhTransConf::setReplicaType(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, LTC_REPLICA_TYPE_MASK, "LqhTransConf::setReplicaType");
+ requestInfo |= (val << LTC_REPLICA_TYPE_SHIFT);
+}
+
+inline
+void
+LqhTransConf::setLastReplicaNo(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, LTC_LAST_REPLICA_MASK, "LqhTransConf::setLastReplicaNo");
+ requestInfo |= (val << LTC_LAST_REPLICA_SHIFT);
+}
+
+inline
+void
+LqhTransConf::setSimpleFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "LqhTransConf::setSimpleFlag");
+ requestInfo |= (val << LTC_SIMPLE_SHIFT);
+}
+
+inline
+void
+LqhTransConf::setDirtyFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "LqhTransConf::setDirtyFlag");
+ requestInfo |= (val << LTC_DIRTY_SHIFT);
+}
+
+inline
+void
+LqhTransConf::setOperation(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, LTC_OPERATION_MASK, "LqhTransConf::setOperation");
+ requestInfo |= (val << LTC_OPERATION_SHIFT);
+}
+
+inline
+void
+LqhTransConf::setMarkerFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "LqhTransConf::setMarkerFlag");
+ requestInfo |= (val << LTC_MARKER_SHIFT);
+}
+
+#endif
diff --git a/ndb/include/kernel/signaldata/ManagementServer.hpp b/ndb/include/kernel/signaldata/ManagementServer.hpp
new file mode 100644
index 00000000000..ce14e30c81d
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ManagementServer.hpp
@@ -0,0 +1,87 @@
+/* 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 MANAGEMENTSERVER_HPP
+#define MANAGEMENTSERVER_HPP
+
+#include "SignalData.hpp"
+
+/**
+ * Request to lock configuration
+ */
+class MgmLockConfigReq {
+ friend class MgmtSrvr;
+
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+private:
+ Uint32 newConfigGeneration;
+};
+
+/**
+ * Confirm configuration lock
+ */
+class MgmLockConfigRep {
+ friend class MgmtSrvr;
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+ /* Error codes */
+ enum ErrorCode {
+ OK,
+ UNKNOWN_ERROR,
+ GENERATION_MISMATCH,
+ ALREADY_LOCKED
+ };
+
+private:
+ Uint32 errorCode;
+};
+
+/**
+ * Unlock configuration
+ */
+class MgmUnlockConfigReq {
+ friend class MgmtSrvr;
+
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+private:
+ Uint32 commitConfig;
+};
+
+/**
+ * Confirm config unlock
+ */
+class MgmUnlockConfigRep {
+ friend class MgmtSrvr;
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+ /* Error codes */
+ enum ErrorCode {
+ OK,
+ UNKNOWN_ERROR,
+ NOT_LOCKED
+ };
+
+private:
+ Uint32 errorCode;
+};
+
+#endif /* !MANAGEMENTSERVER_HPP */
diff --git a/ndb/include/kernel/signaldata/MasterGCP.hpp b/ndb/include/kernel/signaldata/MasterGCP.hpp
new file mode 100644
index 00000000000..ebe6857a107
--- /dev/null
+++ b/ndb/include/kernel/signaldata/MasterGCP.hpp
@@ -0,0 +1,84 @@
+/* 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 MASTER_GCP_HPP
+#define MASTER_GCP_HPP
+
+#include <NodeBitmask.hpp>
+
+/**
+ *
+ */
+class MasterGCPConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 8 + NdbNodeBitmask::Size );
+
+ enum State {
+ GCP_READY = 0,
+ GCP_PREPARE_RECEIVED = 1,
+ GCP_COMMIT_RECEIVED = 2,
+ GCP_TC_FINISHED = 3
+ };
+private:
+ /**
+ * Data replied
+ */
+ Uint32 gcpState;
+ Uint32 senderNodeId;
+ Uint32 failedNodeId;
+ Uint32 newGCP;
+ Uint32 latestLCP;
+ Uint32 oldestRestorableGCI;
+ Uint32 keepGCI;
+ Uint32 lcpActive[NdbNodeBitmask::Size];
+};
+/**
+ *
+ */
+class MasterGCPReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+ Uint32 masterRef;
+ Uint32 failedNodeId;
+};
+
+/**
+ *
+ */
+class MasterGCPRef {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+ Uint32 senderNodeId;
+ Uint32 failedNodeId;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/MasterLCP.hpp b/ndb/include/kernel/signaldata/MasterLCP.hpp
new file mode 100644
index 00000000000..bf84ac73309
--- /dev/null
+++ b/ndb/include/kernel/signaldata/MasterLCP.hpp
@@ -0,0 +1,86 @@
+/* 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 MASTER_LCP_HPP
+#define MASTER_LCP_HPP
+
+#include <NdbOut.hpp>
+#include "SignalData.hpp"
+
+/**
+ *
+ */
+class MasterLCPConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+ friend bool printMASTER_LCP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ enum State {
+ LCP_STATUS_IDLE = 0,
+ LCP_STATUS_ACTIVE = 2,
+ LCP_TAB_COMPLETED = 8,
+ LCP_TAB_SAVED = 9
+ };
+
+ friend NdbOut& operator<<(NdbOut&, const State&);
+
+private:
+ /**
+ * Data replied
+ */
+ Uint32 senderNodeId;
+ Uint32 lcpState;
+ Uint32 failedNodeId;
+};
+/**
+ *
+ */
+class MasterLCPReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+ friend bool printMASTER_LCP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+ Uint32 masterRef;
+ Uint32 failedNodeId;
+};
+
+class MasterLCPRef {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+ friend bool printMASTER_LCP_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+ /**
+ * Data replied
+ */
+ Uint32 senderNodeId;
+ Uint32 failedNodeId;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/NFCompleteRep.hpp b/ndb/include/kernel/signaldata/NFCompleteRep.hpp
new file mode 100644
index 00000000000..c8bde705a86
--- /dev/null
+++ b/ndb/include/kernel/signaldata/NFCompleteRep.hpp
@@ -0,0 +1,80 @@
+/* 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 NF_COMPLETE_REP_HPP
+#define NF_COMPLETE_REP_HPP
+
+#include "SignalData.hpp"
+
+/**
+ * NFCompleteRep - Node Fail Complete Report
+ *
+ * This signal is sent by a block(or a node)
+ * when it has finished cleaning up after a node failure.
+ *
+ * It's also sent from Qmgr to the clusterMgr in API
+ * to tell the API that it can now abort all transactions still waiting for response
+ * from the failed NDB node
+ *
+ */
+class NFCompleteRep {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+ friend class Dblqh;
+ friend class Dbtc;
+ friend class Qmgr;
+
+ /**
+ * Sender/Reciver
+ */
+ friend class Dbdih;
+ friend class ClusterMgr;
+
+ friend bool printNF_COMPLETE_REP(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+private:
+
+ /**
+ * Which block has completed...
+ *
+ * NOTE: 0 means the node has completed
+ */
+ Uint32 blockNo;
+
+ /**
+ * Which node has completed...
+ */
+ Uint32 nodeId;
+
+ /**
+ * Which node has failed
+ */
+ Uint32 failedNodeId;
+
+ /**
+ * Is this the original message or a delayed variant.
+ */
+ Uint32 unused; // originalMessage
+
+ Uint32 from;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/NdbSttor.hpp b/ndb/include/kernel/signaldata/NdbSttor.hpp
new file mode 100644
index 00000000000..edd93ef96a8
--- /dev/null
+++ b/ndb/include/kernel/signaldata/NdbSttor.hpp
@@ -0,0 +1,85 @@
+/* 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 NDB_STTOR_HPP
+#define NDB_STTOR_HPP
+
+#include "SignalData.hpp"
+
+class NdbSttor {
+ /**
+ * Sender(s)
+ */
+ friend class NdbCntr;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbcntr;
+ friend class Dbdict;
+ friend class Dbdih;
+ friend class Dblqh;
+ friend class Dbtc;
+ friend class ClusterMgr;
+ friend class Trix;
+ friend class Backup;
+ friend class Suma;
+ friend class Grep;
+
+ friend bool printNDB_STTOR(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ STATIC_CONST( DataLength = 16 );
+private:
+
+ Uint32 senderRef;
+ Uint32 nodeId;
+ Uint32 internalStartPhase;
+ Uint32 typeOfStart;
+ Uint32 masterNodeId;
+ Uint32 unused;
+ Uint32 config[DataLength];
+};
+
+class NdbSttorry {
+ /**
+ * Receiver(s)
+ */
+ friend class NdbCntr;
+
+ /**
+ * Sender(s)
+ */
+ friend class Ndbcntr;
+ friend class Dbdict;
+ friend class Dbdih;
+ friend class Dblqh;
+ friend class Dbtc;
+ friend class ClusterMgr;
+ friend class Trix;
+ friend class Backup;
+ friend class Suma;
+ friend class Grep;
+
+ friend bool printNDB_STTORRY(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 1 );
+private:
+
+ Uint32 senderRef;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/NdbfsContinueB.hpp b/ndb/include/kernel/signaldata/NdbfsContinueB.hpp
new file mode 100644
index 00000000000..2d569be721f
--- /dev/null
+++ b/ndb/include/kernel/signaldata/NdbfsContinueB.hpp
@@ -0,0 +1,35 @@
+/* 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 NDBFS_CONTINUEB_H
+#define NDBFS_CONTINUEB_H
+
+#include "SignalData.hpp"
+
+class NdbfsContinueB {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Ndbfs;
+ friend bool printCONTINUEB_NDBFS(FILE * output, const Uint32 * theData, Uint32 len);
+private:
+ enum {
+ ZSCAN_MEMORYCHANNEL_10MS_DELAY = 0,
+ ZSCAN_MEMORYCHANNEL_NO_DELAY = 1
+ };
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/NextScan.hpp b/ndb/include/kernel/signaldata/NextScan.hpp
new file mode 100644
index 00000000000..3a1882f94e8
--- /dev/null
+++ b/ndb/include/kernel/signaldata/NextScan.hpp
@@ -0,0 +1,67 @@
+/* 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 NEXT_SCAN_HPP
+#define NEXT_SCAN_HPP
+
+#include "SignalData.hpp"
+
+class NextScanReq {
+ friend class Dblqh;
+ friend class Dbacc;
+ friend class Dbtux;
+public:
+ // two sets of defs picked from lqh/acc
+ enum ScanFlag {
+ ZSCAN_NEXT = 1,
+ ZSCAN_NEXT_COMMIT = 2,
+ ZSCAN_COMMIT = 3, // new
+ ZSCAN_CLOSE = 6,
+ ZSCAN_NEXT_ABORT = 12
+ };
+ enum CopyFlag {
+ todo_ZCOPY_NEXT = 1,
+ todo_ZCOPY_NEXT_COMMIT = 2,
+ todo_ZCOPY_COMMIT = 3,
+ todo_ZCOPY_REPEAT = 4,
+ todo_ZCOPY_ABORT = 5,
+ todo_ZCOPY_CLOSE = 6
+ };
+ STATIC_CONST( SignalLength = 3 );
+private:
+ Uint32 accPtr; // scan record in ACC/TUX
+ Uint32 accOperationPtr;
+ Uint32 scanFlag;
+};
+
+class NextScanConf {
+ friend class Dbacc;
+ friend class Dbtux;
+ friend class Dblqh;
+public:
+ // length is less if no keyinfo or no next result
+ STATIC_CONST( SignalLength = 11 );
+private:
+ Uint32 scanPtr; // scan record in LQH
+ Uint32 accOperationPtr;
+ Uint32 fragId;
+ Uint32 localKey[2];
+ Uint32 localKeyLength;
+ Uint32 keyLength;
+ Uint32 key[4];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/NodeFailRep.hpp b/ndb/include/kernel/signaldata/NodeFailRep.hpp
new file mode 100644
index 00000000000..060acd6a3e2
--- /dev/null
+++ b/ndb/include/kernel/signaldata/NodeFailRep.hpp
@@ -0,0 +1,68 @@
+/* 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 NODE_FAILREP_HPP
+#define NODE_FAILREP_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+
+/**
+ * This signals is sent by Qmgr to NdbCntr
+ * and then from NdbCntr sent to: dih, dict, lqh, tc & API
+ */
+class NodeFailRep {
+ /**
+ * Sender(s)
+ */
+ friend class Qmgr;
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+ friend class Dbdict;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbdih;
+ friend class Dblqh;
+ friend class Dbtc;
+ friend class ClusterMgr;
+ friend class Trix;
+ friend class Backup;
+ friend class Suma;
+ friend class Grep;
+ friend class SafeCounterManager;
+
+public:
+ STATIC_CONST( SignalLength = 3 + NodeBitmask::Size );
+private:
+
+ Uint32 failNo;
+
+ /**
+ * Note: This field is only set when signals is sent FROM Ndbcntr
+ * (not when signal is sent from Qmgr)
+ */
+ Uint32 masterNodeId;
+
+ Uint32 noOfNodes;
+ Uint32 theNodes[NodeBitmask::Size];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/NodeStateSignalData.hpp b/ndb/include/kernel/signaldata/NodeStateSignalData.hpp
new file mode 100644
index 00000000000..391d8f89566
--- /dev/null
+++ b/ndb/include/kernel/signaldata/NodeStateSignalData.hpp
@@ -0,0 +1,94 @@
+/* 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 NODE_STATE_SIGNAL_DATA_HPP
+#define NODE_STATE_SIGNAL_DATA_HPP
+
+#include <NodeState.hpp>
+
+/**
+ * NodeStateRep
+ *
+ * Sent so that all blocks will update their NodeState
+ */
+class NodeStateRep {
+ /**
+ * Sender(s)
+ */
+ friend class Ndbcntr;
+
+ /**
+ * Reciver
+ */
+ friend class SimulatedBlock;
+
+public:
+ STATIC_CONST( SignalLength = NodeState::DataLength );
+private:
+
+ NodeState nodeState;
+};
+
+/**
+ * ChangeNodeStateReq
+ *
+ * Sent by NdbCntr when synchronous NodeState updates are needed
+ */
+class ChangeNodeStateReq {
+ /**
+ * Sender(s)
+ */
+ friend class Ndbcntr;
+
+ /**
+ * Reciver
+ */
+ friend class SimulatedBlock;
+
+public:
+ STATIC_CONST( SignalLength = 2 + NodeState::DataLength );
+public:
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ NodeState nodeState;
+};
+
+/**
+ * ChangeNodeStateConf
+ *
+ * Sent by SimulatedBlock as a confirmation to ChangeNodeStateReq
+ */
+class ChangeNodeStateConf {
+ /**
+ * Sender(s)
+ */
+ friend class SimulatedBlock;
+
+ /**
+ * Reciver
+ */
+ friend class NdbCntr;
+
+public:
+ STATIC_CONST( SignalLength = 1 );
+private:
+
+ Uint32 senderData;
+};
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/PackedSignal.hpp b/ndb/include/kernel/signaldata/PackedSignal.hpp
new file mode 100644
index 00000000000..057bb39b25a
--- /dev/null
+++ b/ndb/include/kernel/signaldata/PackedSignal.hpp
@@ -0,0 +1,43 @@
+/* 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 PACKED_SIGNAL_HPP
+#define PACKED_SIGNAL_HPP
+
+#include "SignalData.hpp"
+
+// -------- CODES FOR COMPRESSED SIGNAL (PACKED_SIGNAL) -------
+#define ZCOMMIT 0
+#define ZCOMPLETE 1
+#define ZCOMMITTED 2
+#define ZCOMPLETED 3
+#define ZLQHKEYCONF 4
+#define ZREMOVE_MARKER 5
+
+class PackedSignal {
+
+ static Uint32 getSignalType(Uint32 data);
+
+ /**
+ * For printing
+ */
+ friend bool printPACKED_SIGNAL(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+};
+
+inline
+Uint32 PackedSignal::getSignalType(Uint32 data) { return data >> 28; };
+
+#endif
diff --git a/ndb/include/kernel/signaldata/PrepDropTab.hpp b/ndb/include/kernel/signaldata/PrepDropTab.hpp
new file mode 100644
index 00000000000..e9cc28fed0c
--- /dev/null
+++ b/ndb/include/kernel/signaldata/PrepDropTab.hpp
@@ -0,0 +1,170 @@
+/* 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 PREP_DROP_TAB_HPP
+#define PREP_DROP_TAB_HPP
+
+#include "SignalData.hpp"
+
+class PrepDropTabReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbtc;
+ friend class Dblqh;
+ friend class Dbdih;
+
+ friend bool printPREP_DROP_TAB_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 tableId;
+ Uint32 requestType; // @see DropTabReq::RequestType
+};
+
+class PrepDropTabConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+ friend class Dblqh;
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+ friend bool printPREP_DROP_TAB_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 tableId;
+};
+
+class PrepDropTabRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+ friend class Dblqh;
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdict;
+
+ friend bool printPREP_DROP_TAB_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ enum ErrorCode {
+ OK = 0,
+ NoSuchTable = 1,
+ PrepDropInProgress = 2,
+ DropInProgress = 3,
+ InvalidTableState = 4
+ };
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 tableId;
+ Uint32 errorCode;
+};
+
+class WaitDropTabReq {
+ /**
+ * Sender
+ */
+ friend class Dbtc;
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+
+ friend bool printWAIT_DROP_TAB_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ Uint32 tableId;
+ Uint32 senderRef;
+};
+
+class WaitDropTabRef {
+ /**
+ * Sender
+ */
+ friend class Dblqh;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbtc;
+ friend class Dbdih;
+
+ friend bool printWAIT_DROP_TAB_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ enum ErrorCode {
+ NoSuchTable = 1,
+ IllegalTableState = 2,
+ DropInProgress = 3
+ };
+
+ Uint32 tableId;
+ Uint32 senderRef;
+ Uint32 errorCode;
+ Uint32 tableStatus;
+};
+
+
+class WaitDropTabConf {
+ /**
+ * Sender
+ */
+ friend class Dblqh;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbtc;
+ friend class Dbdih;
+
+ friend bool printWAIT_DROP_TAB_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ Uint32 tableId;
+ Uint32 senderRef;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/PrepFailReqRef.hpp b/ndb/include/kernel/signaldata/PrepFailReqRef.hpp
new file mode 100644
index 00000000000..90b568237b8
--- /dev/null
+++ b/ndb/include/kernel/signaldata/PrepFailReqRef.hpp
@@ -0,0 +1,49 @@
+/* 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 PREP_FAILREQREF_HPP
+#define PREP_FAILREQREF_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+
+/**
+ * The Req signal is sent by Qmgr to Qmgr
+ * and the Ref signal might be sent back
+ *
+ * NOTE that the signals are identical
+ */
+class PrepFailReqRef {
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Qmgr;
+
+ friend bool printPREPFAILREQREF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( SignalLength = 3 + NodeBitmask::Size );
+private:
+
+ Uint32 xxxBlockRef;
+ Uint32 failNo;
+
+ Uint32 noOfNodes;
+ Uint32 theNodes[NodeBitmask::Size];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/ReadNodesConf.hpp b/ndb/include/kernel/signaldata/ReadNodesConf.hpp
new file mode 100644
index 00000000000..f3176cbf0e8
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ReadNodesConf.hpp
@@ -0,0 +1,109 @@
+/* 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 READ_NODESCONF_HPP
+#define READ_NODESCONF_HPP
+
+#include <NodeBitmask.hpp>
+
+/**
+ * This signals is sent by Qmgr to NdbCntr
+ * and then from NdbCntr sent to: dih, dict, lqh, tc
+ *
+ * NOTE Only noOfNodes & allNodes are valid when sent from Qmgr
+ */
+class ReadNodesConf {
+ /**
+ * Sender(s)
+ */
+ friend class Qmgr;
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbdih;
+ friend class Dbdict;
+ friend class Dblqh;
+ friend class Dbtc;
+ friend class Trix;
+ friend class Backup;
+ friend class Suma;
+ friend class Grep;
+
+public:
+ STATIC_CONST( SignalLength = 2 + 6*NodeBitmask::Size );
+private:
+
+ Uint32 noOfNodes;
+
+ /**
+ *
+ * NOTE Not valid when send from Qmgr
+ */
+ Uint32 masterNodeId;
+
+ /**
+ * 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];
+
+ /**
+ * This array describes the version id of the nodes
+ * The version id is a 4 bit number
+ *
+ * NOTE Not valid when send from Qmgr
+ */
+ Uint32 theVersionIds[4*NodeBitmask::Size];
+
+ static void setVersionId(NodeId, Uint8 versionId, Uint32 theVersionIds[]);
+ static Uint8 getVersionId(NodeId, const Uint32 theVersionIds[]);
+};
+
+inline
+void
+ReadNodesConf::setVersionId(NodeId nodeId, Uint8 versionId,
+ Uint32 theVersionIds[]){
+ const int word = nodeId >> 3;
+ const int shift = (nodeId & 7) << 2;
+
+ const Uint32 mask = ~(((Uint32)15) << shift);
+ const Uint32 tmp = theVersionIds[word];
+
+ theVersionIds[word] = (tmp & mask) | ((((Uint32)versionId) & 15) << shift);
+}
+
+inline
+Uint8
+ReadNodesConf::getVersionId(NodeId nodeId, const Uint32 theVersionIds[]){
+ const int word = nodeId >> 3;
+ const int shift = (nodeId & 7) << 2;
+
+ return (theVersionIds[word] >> shift) & 15;
+}
+
+#endif
diff --git a/ndb/include/kernel/signaldata/RelTabMem.hpp b/ndb/include/kernel/signaldata/RelTabMem.hpp
new file mode 100644
index 00000000000..9cf1787bba4
--- /dev/null
+++ b/ndb/include/kernel/signaldata/RelTabMem.hpp
@@ -0,0 +1,69 @@
+/* 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 REL_TABMEM_HPP
+#define REL_TABMEM_HPP
+
+#include "SignalData.hpp"
+
+class RelTabMemReq {
+ /**
+ * Sender(s) and Receiver(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbacc;
+ friend class Dbdih;
+ friend class Dblqh;
+ friend class Dbtc;
+ friend class Dbtup;
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 userPtr;
+ Uint32 userRef;
+ Uint32 primaryTableId;
+ Uint32 secondaryTableId;
+};
+
+class RelTabMemConf {
+ /**
+ * Sender(s) and Receiver(s)
+ */
+ friend class Dbdict;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dbacc;
+ friend class Dbdih;
+ friend class Dblqh;
+ friend class Dbtc;
+ friend class Dbtup;
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 userPtr;
+ Uint32 senderRef;
+ Uint32 nodeId;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/RepImpl.hpp b/ndb/include/kernel/signaldata/RepImpl.hpp
new file mode 100644
index 00000000000..affffe46f9c
--- /dev/null
+++ b/ndb/include/kernel/signaldata/RepImpl.hpp
@@ -0,0 +1,500 @@
+/* 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 REP_IMPL_HPP
+#define REP_IMPL_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+#include <ndb_limits.h>
+#include <debugger/GrepError.hpp>
+
+/**
+ * RecordType
+ * sz = no of elems in enum
+ * @todo support for meta_log must be added
+ */
+enum RecordType
+{
+ DATA_SCAN = 0,
+ DATA_LOG = 1,
+ META_SCAN = 2,
+ // META_LOG = 3, //removed META_LOG. not supported
+ RecordTypeSize = 3 // =4 if meta log is supported
+};
+
+/**
+ * Wait GCP
+ */
+class RepWaitGcpReq
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+ friend class GrepParticipant;
+ friend bool printREP_WAITGCP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 gcp;
+ Uint32 senderNodeId;
+};
+
+class RepWaitGcpConf
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+ friend class GrepParticipant;
+
+ friend bool printREP_WAITGCP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 senderNodeId;
+};
+
+class RepWaitGcpRef
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+ friend class GrepParticipant;
+
+ friend bool printREP_WAITGCP_REF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 6 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 senderNodeId;
+ GrepError::Code err;
+};
+
+class RepGetGciReq
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+ friend class Grep;
+
+ friend bool printREP_GET_GCI_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 nodeGrp;
+};
+
+class RepGetGciConf
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_GET_GCI_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 7 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 nodeGrp;
+ Uint32 firstPSGCI;
+ Uint32 lastPSGCI;
+ Uint32 firstSSGCI;
+ Uint32 lastSSGCI;
+};
+
+class RepGetGciRef
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_GET_GCI_REF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 8);
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 nodeGrp;
+ Uint32 firstPSGCI;
+ Uint32 lastPSGCI;
+ Uint32 firstSSGCI;
+ Uint32 lastSSGCI;
+ GrepError::Code err;
+};
+
+class RepGetGciBufferReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_GET_GCIBUFFER_REQ(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 firstGCI;
+ Uint32 lastGCI;
+ Uint32 nodeGrp;
+};
+
+
+class RepGetGciBufferConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_GET_GCIBUFFER_CONF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 8 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 firstPSGCI;
+ Uint32 lastPSGCI;
+ Uint32 firstSSGCI;
+ Uint32 lastSSGCI;
+ Uint32 currentGCIBuffer;
+ Uint32 nodeGrp;
+};
+
+class RepGetGciBufferRef
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_GET_GCIBUFFER_REF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 9 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 firstPSGCI;
+ Uint32 lastPSGCI;
+ Uint32 firstSSGCI;
+ Uint32 lastSSGCI;
+ Uint32 currentGCIBuffer;
+ Uint32 nodeGrp;
+ GrepError::Code err;
+};
+
+class RepInsertGciBufferReq
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_INSERT_GCIBUFFER_REQ(FILE *, const Uint32 *,
+ Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 gci;
+ Uint32 nodeGrp;
+ Uint32 force;
+};
+
+class RepInsertGciBufferRef
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_INSERT_GCIBUFFER_REF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 7 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 gci;
+ Uint32 nodeGrp;
+ Uint32 tableId;
+ Uint32 force;
+ GrepError::Code err;
+};
+
+class RepInsertGciBufferConf
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_INSERT_GCIBUFFER_CONF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 gci;
+ Uint32 nodeGrp;
+ Uint32 force;
+};
+
+
+class RepClearPSGciBufferReq
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_CLEAR_PS_GCIBUFFER_REQ(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 firstGCI;
+ Uint32 lastGCI;
+ Uint32 nodeGrp;
+};
+
+class RepClearPSGciBufferRef
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_CLEAR_PS_GCIBUFFER_REF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 7 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 firstGCI;
+ Uint32 lastGCI;
+ Uint32 currentGCI;
+ Uint32 nodeGrp;
+ GrepError::Code err;
+};
+
+class RepClearPSGciBufferConf
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_CLEAR_PS_GCIBUFFER_CONF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 firstGCI;
+ Uint32 lastGCI;
+ Uint32 nodeGrp;
+};
+
+class RepClearSSGciBufferReq
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_CLEAR_SS_GCIBUFFER_REQ(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 firstGCI;
+ Uint32 lastGCI;
+ Uint32 nodeGrp;
+};
+
+class RepClearSSGciBufferRef
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_CLEAR_SS_GCIBUFFER_REF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 7 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 firstGCI;
+ Uint32 lastGCI;
+ Uint32 currentGCI;
+ Uint32 nodeGrp;
+ GrepError::Code err;
+};
+
+class RepClearSSGciBufferConf
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_CLEAR_SS_GCIBUFFER_CONF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 firstGCI;
+ Uint32 lastGCI;
+ Uint32 nodeGrp;
+};
+
+
+class RepDataPage
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_DATA_PAGE(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 nodeGrp;
+ Uint32 gci;
+};
+
+
+class RepGciBufferAccRep
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_GCIBUFFER_ACC_REP(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 nodeGrp;
+ Uint32 gci;
+ Uint32 totalSentBytes;
+};
+
+class RepDropTableReq
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_DROP_TABLE_REQ(FILE *, const Uint32 *,
+ Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+ Uint32 tableId;
+ // char tableName[MAX_TAB_NAME_SIZE];
+};
+
+class RepDropTableRef
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_DROP_TABLE_REF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+ Uint32 tableId;
+ // char tableName[MAX_TAB_NAME_SIZE];
+};
+
+class RepDropTableConf
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+
+ friend bool printREP_DROP_TABLE_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+ Uint32 tableId;
+ //char tableName[MAX_TAB_NAME_SIZE];
+};
+
+class RepDisconnectRep
+{
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Rep;
+ friend class Grep;
+
+ friend bool printREP_DISCONNECT_REP(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ enum NodeType {
+ DB = 0,
+ REP = 1
+ };
+ STATIC_CONST( SignalLength = 7 );
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 nodeId;
+ Uint32 nodeType;
+ Uint32 subId;
+ Uint32 subKey;
+ Uint32 err;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/ResumeReq.hpp b/ndb/include/kernel/signaldata/ResumeReq.hpp
new file mode 100644
index 00000000000..a4880474ca8
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ResumeReq.hpp
@@ -0,0 +1,69 @@
+/* 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 RESUME_REQ_HPP
+#define RESUME_REQ_HPP
+
+#include "SignalData.hpp"
+
+class ResumeReq {
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbcntr;
+
+ /**
+ * Sender
+ */
+ friend class MgmtSrvr;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+public:
+
+ Uint32 senderRef;
+ Uint32 senderData;
+};
+
+class ResumeRef {
+
+ /**
+ * Reciver(s)
+ */
+ friend class MgmtSrvr;
+
+ /**
+ * Sender
+ */
+ friend class Ndbcntr;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ enum ErrorCode {
+ OK = 0,
+ NodeShutdownInProgress = 1,
+ SystemShutdownInProgress = 2,
+ NodeShutdownWouldCauseSystemCrash = 3
+ };
+
+public:
+ Uint32 senderData;
+ Uint32 errorCode;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/ScanFrag.hpp b/ndb/include/kernel/signaldata/ScanFrag.hpp
new file mode 100644
index 00000000000..2b37e544e1f
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ScanFrag.hpp
@@ -0,0 +1,344 @@
+/* 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 SCAN_FRAG_HPP
+#define SCAN_FRAG_HPP
+
+#include "SignalData.hpp"
+#include "ndb_limits.h"
+
+class ScanFragReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+ friend class Backup;
+ friend class Suma;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dblqh;
+public:
+ STATIC_CONST( SignalLength = 25 );
+
+public:
+ Uint32 senderData;
+ Uint32 resultRef; // Where to send the result
+ Uint32 savePointId;
+ Uint32 requestInfo;
+ Uint32 tableId;
+ Uint32 fragmentNo;
+ Uint32 schemaVersion;
+ Uint32 transId1;
+ Uint32 transId2;
+ Uint32 clientOpPtr[MAX_PARALLEL_OP_PER_SCAN];
+
+ static Uint32 getConcurrency(const Uint32 & requestInfo);
+ static Uint32 getLockMode(const Uint32 & requestInfo);
+ static Uint32 getHoldLockFlag(const Uint32 & requestInfo);
+ static Uint32 getKeyinfoFlag(const Uint32 & requestInfo);
+ static Uint32 getReadCommittedFlag(const Uint32 & requestInfo);
+ static Uint32 getRangeScanFlag(const Uint32 & requestInfo);
+ static Uint32 getAttrLen(const Uint32 & requestInfo);
+ static Uint32 getScanPrio(const Uint32 & requestInfo);
+
+ static void setConcurrency(Uint32 & requestInfo, Uint32 concurrency);
+ static void setLockMode(Uint32 & requestInfo, Uint32 lockMode);
+ static void setHoldLockFlag(Uint32 & requestInfo, Uint32 holdLock);
+ static void setKeyinfoFlag(Uint32 & requestInfo, Uint32 keyinfo);
+ static void setReadCommittedFlag(Uint32 & requestInfo, Uint32 readCommitted);
+ static void setRangeScanFlag(Uint32 & requestInfo, Uint32 rangeScan);
+ static void setAttrLen(Uint32 & requestInfo, Uint32 attrLen);
+ static void setScanPrio(Uint32& requestInfo, Uint32 prio);
+};
+
+class KeyInfo20 {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Backup;
+ friend class NdbOperation;
+ friend class NdbScanReceiver;
+public:
+ //STATIC_CONST( SignalLength = 21 );
+ STATIC_CONST( HeaderLength = 5);
+ STATIC_CONST( DataLength = 20 );
+
+
+ static Uint32 setScanInfo(Uint32 noOfOps, Uint32 scanNo);
+ static Uint32 getScanNo(Uint32 scanInfo);
+ static Uint32 getScanOp(Uint32 scanInfo);
+
+public:
+ Uint32 clientOpPtr;
+ Uint32 keyLen;
+ Uint32 scanInfo_Node;
+ Uint32 transId1;
+ Uint32 transId2;
+ Uint32 keyData[DataLength];
+};
+
+class ScanFragConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc;
+ friend class Backup;
+ friend class Suma;
+public:
+ STATIC_CONST( SignalLength = 21 );
+
+public:
+ Uint32 senderData;
+ Uint32 completedOps;
+ Uint32 fragmentCompleted;
+ Uint32 opReturnDataLen[16];
+ Uint32 transId1;
+ Uint32 transId2;
+};
+
+class ScanFragRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc;
+ friend class Backup;
+ friend class Suma;
+public:
+ STATIC_CONST( SignalLength = 4 );
+public:
+ enum ErrorCode {
+ ZNO_FREE_TC_CONREC_ERROR = 484,
+ ZTOO_FEW_CONCURRENT_OPERATIONS = 485,
+ ZTOO_MANY_CONCURRENT_OPERATIONS = 486,
+ ZSCAN_NO_FRAGMENT_ERROR = 487,
+ ZTOO_MANY_ACTIVE_SCAN_ERROR = 488,
+ ZNO_FREE_SCANREC_ERROR = 489,
+ ZSTANDBY_SCAN_ERROR = 1209,
+ ZSCAN_BOOK_ACC_OP_ERROR = 1219,
+ ZUNKNOWN_TRANS_ERROR = 1227
+ };
+
+ Uint32 senderData;
+ Uint32 transId1;
+ Uint32 transId2;
+ Uint32 errorCode;
+};
+
+/**
+ * This is part of Scan Fragment protocol
+ *
+ * Not to be confused with ScanNextReq in Scan Table protocol
+ */
+class ScanFragNextReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+ friend class Backup;
+ friend class Suma;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dblqh;
+
+ friend bool printSCANFRAGNEXTREQ(FILE * output, const Uint32 * theData,
+ Uint32 len, Uint16 receiverBlockNo);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+public:
+ Uint32 senderData;
+ Uint32 closeFlag;
+ Uint32 transId1;
+ Uint32 transId2;
+};
+
+/**
+ * Request Info
+ *
+ * a = Length of attrinfo - 16 Bits (16-31)
+ * c = Concurrency - 5 Bits (0-4) -> Max 31
+ * l = Lock Mode - 1 Bit 5
+ * h = Hold lock - 1 Bit 7
+ * k = Keyinfo - 1 Bit 8
+ * r = read committed - 1 Bit 9
+ * x = range scan - 1 Bit 6
+ * p = Scan prio - 4 Bits (12-15) -> max 15
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * ccccclxhkr ppppaaaaaaaaaaaaaaaa
+ */
+#define SF_CONCURRENCY_SHIFT (0)
+#define SF_CONCURRENCY_MASK (31)
+
+#define SF_LOCK_MODE_SHIFT (5)
+#define SF_LOCK_MODE_MASK (1)
+
+#define SF_HOLD_LOCK_SHIFT (7)
+#define SF_KEYINFO_SHIFT (8)
+#define SF_READ_COMMITTED_SHIFT (9)
+#define SF_RANGE_SCAN_SHIFT (6)
+
+#define SF_ATTR_LEN_SHIFT (16)
+#define SF_ATTR_LEN_MASK (65535)
+
+#define SF_PRIO_SHIFT 12
+#define SF_PRIO_MASK 15
+
+inline
+Uint32
+ScanFragReq::getConcurrency(const Uint32 & requestInfo){
+ return (requestInfo >> SF_CONCURRENCY_SHIFT) & SF_CONCURRENCY_MASK;
+}
+
+inline
+Uint32
+ScanFragReq::getLockMode(const Uint32 & requestInfo){
+ return (requestInfo >> SF_LOCK_MODE_SHIFT) & SF_LOCK_MODE_MASK;
+}
+
+inline
+Uint32
+ScanFragReq::getHoldLockFlag(const Uint32 & requestInfo){
+ return (requestInfo >> SF_HOLD_LOCK_SHIFT) & 1;
+}
+
+inline
+Uint32
+ScanFragReq::getKeyinfoFlag(const Uint32 & requestInfo){
+ return (requestInfo >> SF_KEYINFO_SHIFT) & 1;
+}
+
+inline
+Uint32
+ScanFragReq::getRangeScanFlag(const Uint32 & requestInfo){
+ return (requestInfo >> SF_RANGE_SCAN_SHIFT) & 1;
+}
+
+inline
+Uint32
+ScanFragReq::getReadCommittedFlag(const Uint32 & requestInfo){
+ return (requestInfo >> SF_READ_COMMITTED_SHIFT) & 1;
+}
+
+inline
+Uint32
+ScanFragReq::getAttrLen(const Uint32 & requestInfo){
+ return (requestInfo >> SF_ATTR_LEN_SHIFT) & SF_ATTR_LEN_MASK;
+}
+
+inline
+Uint32
+ScanFragReq::getScanPrio(const Uint32 & requestInfo){
+ return (requestInfo >> SF_PRIO_SHIFT) & SF_PRIO_MASK;
+}
+
+inline
+void
+ScanFragReq::setScanPrio(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, SF_PRIO_MASK, "ScanFragReq::setScanPrio");
+ requestInfo |= (val << SF_PRIO_SHIFT);
+}
+
+inline
+void
+ScanFragReq::setConcurrency(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, SF_CONCURRENCY_MASK, "ScanFragReq::setConcurrency");
+ requestInfo |= (val << SF_CONCURRENCY_SHIFT);
+}
+
+inline
+void
+ScanFragReq::setLockMode(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, SF_LOCK_MODE_MASK, "ScanFragReq::setLockMode");
+ requestInfo |= (val << SF_LOCK_MODE_SHIFT);
+}
+
+inline
+void
+ScanFragReq::setHoldLockFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "ScanFragReq::setHoldLockFlag");
+ requestInfo |= (val << SF_HOLD_LOCK_SHIFT);
+}
+
+inline
+void
+ScanFragReq::setKeyinfoFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "ScanFragReq::setKeyinfoFlag");
+ requestInfo |= (val << SF_KEYINFO_SHIFT);
+}
+
+inline
+void
+ScanFragReq::setReadCommittedFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "ScanFragReq::setReadCommittedFlag");
+ requestInfo |= (val << SF_READ_COMMITTED_SHIFT);
+}
+
+inline
+void
+ScanFragReq::setRangeScanFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "ScanFragReq::setRangeScanFlag");
+ requestInfo |= (val << SF_RANGE_SCAN_SHIFT);
+}
+
+inline
+void
+ScanFragReq::setAttrLen(UintR & requestInfo, UintR val){
+ ASSERT_MAX(val, SF_ATTR_LEN_MASK, "ScanFragReq::setAttrLen");
+ requestInfo |= (val << SF_ATTR_LEN_SHIFT);
+}
+
+inline
+Uint32
+KeyInfo20::setScanInfo(Uint32 opNo, Uint32 scanNo){
+ ASSERT_MAX(opNo, 15, "KeyInfo20::setScanInfo");
+ ASSERT_MAX(scanNo, 255, "KeyInfo20::setScanInfo");
+ return (opNo << 8) + scanNo;
+}
+
+inline
+Uint32
+KeyInfo20::getScanNo(Uint32 scanInfo){
+ return scanInfo & 0xFF;
+}
+
+inline
+Uint32
+KeyInfo20::getScanOp(Uint32 scanInfo){
+ return (scanInfo >> 8) & 0xF;
+}
+
+#endif
diff --git a/ndb/include/kernel/signaldata/ScanTab.hpp b/ndb/include/kernel/signaldata/ScanTab.hpp
new file mode 100644
index 00000000000..efd8a4918ab
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ScanTab.hpp
@@ -0,0 +1,453 @@
+/* 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 SCAN_TAB_H
+#define SCAN_TAB_H
+
+#include "SignalData.hpp"
+
+/**
+ *
+ * SENDER: API
+ * RECIVER: Dbtc
+ */
+class ScanTabReq {
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc; // Reciver
+
+ /**
+ * Sender(s)
+ */
+ friend class NdbOperation;
+ friend class NdbConnection;
+
+ /**
+ * For printing
+ */
+ friend bool printSCANTABREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( SignalLength = 25 );
+
+private:
+
+ // Type definitions
+
+ /**
+ * DATA VARIABLES
+ */
+ UintR apiConnectPtr; // DATA 0
+ UintR attrLen; // DATA 1
+ UintR requestInfo; // DATA 2
+ UintR tableId; // DATA 3
+ UintR tableSchemaVersion; // DATA 4
+ UintR storedProcId; // DATA 5
+ UintR transId1; // DATA 6
+ UintR transId2; // DATA 7
+ UintR buddyConPtr; // DATA 8
+ UintR apiOperationPtr[16]; // DATA 9-25
+
+ /**
+ * Get:ers for requestInfo
+ */
+ static Uint8 getParallelism(const UintR & requestInfo);
+ static Uint8 getLockMode(const UintR & requestInfo);
+ static Uint8 getHoldLockFlag(const UintR & requestInfo);
+ static Uint8 getReadCommittedFlag(const UintR & requestInfo);
+ static Uint8 getRangeScanFlag(const UintR & requestInfo);
+
+ /**
+ * Set:ers for requestInfo
+ */
+ static void clearRequestInfo(UintR & requestInfo);
+ static void setParallelism(UintR & requestInfo, Uint32 flag);
+ static void setLockMode(UintR & requestInfo, Uint32 flag);
+ static void setHoldLockFlag(UintR & requestInfo, Uint32 flag);
+ static void setReadCommittedFlag(UintR & requestInfo, Uint32 flag);
+ static void setRangeScanFlag(UintR & requestInfo, Uint32 flag);
+
+};
+
+/**
+ * Request Info
+ *
+ p = Parallelism - 8 Bits -> Max 256 (Bit 0-7)
+ l = Lock mode - 1 Bit 8
+ h = Hold lock mode - 1 Bit 10
+ c = Read Committed - 1 Bit 11
+ x = Range Scan (TUX) - 1 Bit 15
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+ ppppppppl hc x
+*/
+
+#define PARALLELL_SHIFT (0)
+#define PARALLELL_MASK (255)
+
+#define LOCK_MODE_SHIFT (8)
+#define LOCK_MODE_MASK (1)
+
+#define HOLD_LOCK_SHIFT (10)
+#define HOLD_LOCK_MASK (1)
+
+#define READ_COMMITTED_SHIFT (11)
+#define READ_COMMITTED_MASK (1)
+
+#define RANGE_SCAN_SHIFT (15)
+#define RANGE_SCAN_MASK (1)
+
+inline
+Uint8
+ScanTabReq::getParallelism(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> PARALLELL_SHIFT) & PARALLELL_MASK);
+}
+
+inline
+Uint8
+ScanTabReq::getLockMode(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> LOCK_MODE_SHIFT) & LOCK_MODE_MASK);
+}
+
+inline
+Uint8
+ScanTabReq::getHoldLockFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> HOLD_LOCK_SHIFT) & HOLD_LOCK_MASK);
+}
+
+inline
+Uint8
+ScanTabReq::getReadCommittedFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> READ_COMMITTED_SHIFT) & READ_COMMITTED_MASK);
+}
+
+inline
+Uint8
+ScanTabReq::getRangeScanFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> RANGE_SCAN_SHIFT) & RANGE_SCAN_MASK);
+}
+
+inline
+void
+ScanTabReq::clearRequestInfo(UintR & requestInfo){
+ requestInfo = 0;
+}
+
+inline
+void
+ScanTabReq::setParallelism(UintR & requestInfo, Uint32 type){
+ ASSERT_MAX(type, PARALLELL_MASK, "ScanTabReq::setParallellism");
+ requestInfo |= (type << PARALLELL_SHIFT);
+}
+
+inline
+void
+ScanTabReq::setLockMode(UintR & requestInfo, Uint32 mode){
+ ASSERT_MAX(mode, LOCK_MODE_MASK, "ScanTabReq::setLockMode");
+ requestInfo |= (mode << LOCK_MODE_SHIFT);
+}
+
+inline
+void
+ScanTabReq::setHoldLockFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "ScanTabReq::setHoldLockFlag");
+ requestInfo |= (flag << HOLD_LOCK_SHIFT);
+}
+
+inline
+void
+ScanTabReq::setReadCommittedFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "ScanTabReq::setReadCommittedFlag");
+ requestInfo |= (flag << READ_COMMITTED_SHIFT);
+}
+
+inline
+void
+ScanTabReq::setRangeScanFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "ScanTabReq::setRangeScanFlag");
+ requestInfo |= (flag << RANGE_SCAN_SHIFT);
+}
+
+
+/**
+ *
+ * SENDER: Dbtc
+ * RECIVER: API
+ */
+class ScanTabConf {
+ /**
+ * Reciver(s)
+ */
+ friend class NdbConnection; // Reciver
+
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * For printing
+ */
+ friend bool printSCANTABCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+
+ // Type definitions
+
+ /**
+ * DATA VARIABLES
+ */
+ UintR apiConnectPtr; // DATA 0
+ 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);
+
+
+};
+
+/**
+ * request info
+ *
+ o = received operations - 7 Bits -> Max 255 (Bit 0-7)
+ s = status of scan - 2 Bits -> Max ??? (Bit 8-?)
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+ ooooooooss
+*/
+
+#define OPERATIONS_SHIFT (0)
+#define OPERATIONS_MASK (0xFF)
+
+#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
+ * RECIVER: API, Dbtc
+ */
+class ScanTabInfo {
+ /**
+ * Reciver(s) and Sender(s)
+ */
+ friend class NdbConnection;
+ friend class Dbtc;
+
+ /**
+ * For printing
+ */
+ friend bool printSCANTABINFO(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( SignalLength = 17 );
+
+private:
+
+ // Type definitions
+
+ /**
+ * DATA VARIABLES
+ */
+ UintR apiConnectPtr; // DATA 0
+ UintR operLenAndIdx[16]; // DATA 1-16
+
+ /**
+ * Get:ers for operLenAndIdx
+ */
+ static Uint32 getLen(const UintR & operLenAndIdx);
+ static Uint8 getIdx(const UintR & operLenAndIdx);
+
+};
+
+
+/**
+ * Operation length and index
+ *
+ l = Length of operation - 24 Bits -> Max 16777215 (Bit 0-24)
+ i = Index of operation - 7 Bits -> Max 255 (Bit 25-32)
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+ llllllllllllllllllllllllliiiiiii
+*/
+
+#define LENGTH_SHIFT (0)
+#define LENGTH_MASK (0xFFFFFF)
+
+#define INDEX_SHIFT (24)
+#define INDEX_MASK (0xFF)
+
+inline
+Uint32
+ScanTabInfo::getLen(const UintR & operLenAndIdx){
+ return (Uint32)((operLenAndIdx >> LENGTH_SHIFT) & LENGTH_MASK);
+}
+
+inline
+Uint8
+ScanTabInfo::getIdx(const UintR & operLenAndIdx){
+ return (Uint8)((operLenAndIdx >> INDEX_SHIFT) & INDEX_MASK);
+}
+
+/**
+ *
+ * SENDER: Dbtc
+ * RECIVER: API
+ */
+class ScanTabRef {
+ /**
+ * Reciver(s)
+ */
+ friend class NdbConnection; // Reciver
+
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * For printing
+ */
+ friend bool printSCANTABREF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+
+ // Type definitions
+
+ /**
+ * DATA VARIABLES
+ */
+ UintR apiConnectPtr; // DATA 0
+ UintR transId1; // DATA 1
+ UintR transId2; // DATA 2
+ UintR errorCode; // DATA 3
+ // UintR sendScanNextReqWithClose; // DATA 4
+
+};
+
+/**
+ *
+ * SENDER: API
+ * RECIVER: Dbtc
+ */
+class ScanNextReq {
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc; // Reciver
+
+ /**
+ * Sender(s)
+ */
+ friend class NdbOperation;
+
+ /**
+ * For printing
+ */
+ friend bool printSCANNEXTREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+
+ // Type definitions
+
+ /**
+ * DATA VARIABLES
+ */
+ UintR apiConnectPtr; // DATA 0
+ UintR stopScan; // DATA 1
+ UintR transId1; // DATA 2
+ UintR transId2; // DATA 3
+
+ // stopScan = 1, stop this scan
+
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp b/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp
new file mode 100644
index 00000000000..680e9b25a49
--- /dev/null
+++ b/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp
@@ -0,0 +1,70 @@
+/* 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 SET_LOGLEVEL_ORD_HPP
+#define SET_LOGLEVEL_ORD_HPP
+
+#include <LogLevel.hpp>
+
+/**
+ *
+ */
+class SetLogLevelOrd {
+ /**
+ * Sender(s)
+ */
+ friend class MgmtSrvr; /* XXX can probably be removed */
+ friend class MgmApiSession;
+ friend class CommandInterpreter;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Cmvmi;
+
+ friend class NodeLogLevel;
+
+private:
+ STATIC_CONST( SignalLength = 25 );
+
+ Uint32 noOfEntries;
+ Uint32 theCategories[12];
+ Uint32 theLevels[12];
+
+ void clear();
+
+ /**
+ * Note level is valid as 0-15
+ */
+ void setLogLevel(LogLevel::EventCategory ec, int level = 7);
+};
+
+inline
+void
+SetLogLevelOrd::clear(){
+ noOfEntries = 0;
+}
+
+inline
+void
+SetLogLevelOrd::setLogLevel(LogLevel::EventCategory ec, int level){
+ assert(noOfEntries < 12);
+ theCategories[noOfEntries] = ec;
+ theLevels[noOfEntries] = level;
+ noOfEntries++;
+}
+
+#endif
diff --git a/ndb/include/kernel/signaldata/SetVarReq.hpp b/ndb/include/kernel/signaldata/SetVarReq.hpp
new file mode 100644
index 00000000000..8cb3e78be8b
--- /dev/null
+++ b/ndb/include/kernel/signaldata/SetVarReq.hpp
@@ -0,0 +1,84 @@
+/* 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 SETVARREQ_H
+#define SETVARREQ_H
+
+#include "SignalData.hpp"
+#include "ConfigParamId.hpp"
+
+class SetVarReq {
+
+public:
+
+
+ static UintR size();
+
+ void mgmtSrvrBlockRef(UintR mgmtSrvrBlockRef);
+ UintR mgmtSrvrBlockRef(void) const;
+
+ void variable(ConfigParamId variable);
+ ConfigParamId variable(void) const;
+
+ void value(UintR value);
+ UintR value(void) const;
+
+
+private:
+
+ UintR _mgmtSrvrBlockRef;
+ UintR _variable;
+ UintR _value;
+};
+
+
+
+inline UintR SetVarReq::size(void) {
+ return 3;
+}
+
+
+inline void SetVarReq::mgmtSrvrBlockRef(UintR mgmtSrvrBlockRef) {
+ _mgmtSrvrBlockRef = mgmtSrvrBlockRef;
+}
+
+inline UintR SetVarReq::mgmtSrvrBlockRef(void) const {
+ return _mgmtSrvrBlockRef;
+}
+
+
+inline void SetVarReq::variable(ConfigParamId variable) {
+ _variable = variable;
+}
+
+
+inline ConfigParamId SetVarReq::variable(void) const {
+ return static_cast<ConfigParamId>(_variable);
+}
+
+
+inline void SetVarReq::value(UintR value) {
+ _value = value;
+}
+
+inline UintR SetVarReq::value(void) const {
+ return _value;
+}
+
+
+
+#endif // SETVARREQ_H
+
diff --git a/ndb/include/kernel/signaldata/SignalData.hpp b/ndb/include/kernel/signaldata/SignalData.hpp
new file mode 100644
index 00000000000..071bd9b9104
--- /dev/null
+++ b/ndb/include/kernel/signaldata/SignalData.hpp
@@ -0,0 +1,65 @@
+/* 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 SIGNAL_DATA_H
+#define SIGNAL_DATA_H
+
+#include <ndb_limits.h>
+#include <kernel_types.h>
+#include <NdbStdio.h>
+#include <NdbConstant.hpp>
+#include <stdlib.h>
+
+#ifndef NDB_ASSERT
+#ifdef VM_TRACE
+#define NDB_ASSERT(test, message) { if(!(test)) { printf(message); exit(-1); }}
+#else
+#define NDB_ASSERT(test, message)
+#endif
+#endif
+
+// Useful ASSERT macros...
+#define ASSERT_BOOL(flag, message) NDB_ASSERT( (flag<=1), (message) )
+#define ASSERT_RANGE(value, min, max, message) \
+ NDB_ASSERT((value) >= (min) && (value) <= (max), (message))
+#define ASSERT_MAX(value, max, message) \
+ NDB_ASSERT((value) <= (max), (message))
+
+#define SECTION(x) STATIC_CONST(x)
+
+// defines for setter and getters on commonly used member data in signals
+
+#define GET_SET_SENDERDATA \
+ Uint32 getSenderData() { return senderData; }; \
+ void setSenderData(Uint32 _s) { senderData = _s; };
+
+#define GET_SET_SENDERREF \
+ Uint32 getSenderRef() { return senderRef; }; \
+ void setSenderRef(Uint32 _s) { senderRef = _s; };
+
+#define GET_SET_PREPAREID \
+ Uint32 getPrepareId() { return prepareId; }; \
+ void setPrepareId(Uint32 _s) { prepareId = _s; };
+
+#define GET_SET_ERRORCODE \
+ Uint32 getErrorCode() { return errorCode; }; \
+ void setErrorCode(Uint32 _s) { errorCode = _s; };
+
+#define GET_SET_TCERRORCODE \
+ Uint32 getTCErrorCode() { return TCErrorCode; }; \
+ void setTCErrorCode(Uint32 _s) { TCErrorCode = _s; };
+
+#endif
diff --git a/ndb/include/kernel/signaldata/SignalDataPrint.hpp b/ndb/include/kernel/signaldata/SignalDataPrint.hpp
new file mode 100644
index 00000000000..588e2893214
--- /dev/null
+++ b/ndb/include/kernel/signaldata/SignalDataPrint.hpp
@@ -0,0 +1,36 @@
+/* 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 SIGNAL_DATA_PRINT_H
+#define SIGNAL_DATA_PRINT_H
+
+#include <kernel_types.h>
+#include <NdbStdio.h>
+
+/**
+ * Typedef for a Signal Data Print Function
+ */
+typedef bool (* SignalDataPrintFunction)(FILE * output, const Uint32 * theData, Uint32 len, BlockNumber receiverBlockNo);
+
+struct NameFunctionPair {
+ GlobalSignalNumber gsn;
+ SignalDataPrintFunction function;
+};
+
+extern const NameFunctionPair SignalDataPrintFunctions[];
+extern const unsigned short NO_OF_PRINT_FUNCTIONS;
+
+#endif
diff --git a/ndb/include/kernel/signaldata/SignalDroppedRep.hpp b/ndb/include/kernel/signaldata/SignalDroppedRep.hpp
new file mode 100644
index 00000000000..20863524358
--- /dev/null
+++ b/ndb/include/kernel/signaldata/SignalDroppedRep.hpp
@@ -0,0 +1,44 @@
+/* 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 SIGNAL_DROPPED_HPP
+#define SIGNAL_DROPPED_HPP
+
+#include "SignalData.hpp"
+
+class SignalDroppedRep {
+
+ /**
+ * Reciver(s)
+ */
+ friend class SimulatedBlock;
+
+ /**
+ * Sender (TransporterCallback.cpp)
+ */
+ friend void execute(void * , struct SignalHeader* const, Uint8,
+ Uint32* const, struct LinearSectionPtr ptr[3]);
+
+ friend bool printSIGNAL_DROPPED_REP(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+private:
+ Uint32 originalGsn;
+ Uint32 originalLength;
+ Uint32 originalSectionCount;
+ Uint32 originalData[1];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/SrFragidConf.hpp b/ndb/include/kernel/signaldata/SrFragidConf.hpp
new file mode 100644
index 00000000000..9a6088ad57f
--- /dev/null
+++ b/ndb/include/kernel/signaldata/SrFragidConf.hpp
@@ -0,0 +1,43 @@
+/* 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 SR_FRAGIDCONF_HPP
+#define SR_FRAGIDCONF_HPP
+
+#include "SignalData.hpp"
+
+class SrFragidConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbacc;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+public:
+ STATIC_CONST( SignalLength = 10 );
+
+private:
+ Uint32 lcpPtr;
+ Uint32 accPtr;
+ Uint32 noLocFrag;
+ Uint32 fragId[4];
+ Uint32 fragPtr[2];
+ Uint32 hashCheckBit;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/StartFragReq.hpp b/ndb/include/kernel/signaldata/StartFragReq.hpp
new file mode 100644
index 00000000000..ec05c1ee366
--- /dev/null
+++ b/ndb/include/kernel/signaldata/StartFragReq.hpp
@@ -0,0 +1,47 @@
+/* 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 START_FRAGREQ_HPP
+#define START_FRAGREQ_HPP
+
+#include "SignalData.hpp"
+
+class StartFragReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+public:
+ STATIC_CONST( SignalLength = 19 );
+
+private:
+ Uint32 userPtr;
+ Uint32 userRef;
+ Uint32 lcpNo;
+ Uint32 lcpId;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 noOfLogNodes;
+ Uint32 lqhLogNode[4];
+ Uint32 startGci[4];
+ Uint32 lastGci[4];
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/StartInfo.hpp b/ndb/include/kernel/signaldata/StartInfo.hpp
new file mode 100644
index 00000000000..da032adba8a
--- /dev/null
+++ b/ndb/include/kernel/signaldata/StartInfo.hpp
@@ -0,0 +1,84 @@
+/* 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 START_INFO_HPP
+#define START_INFO_HPP
+
+/**
+ * This signal is sent from the master DIH to all DIHs
+ * when a node is starting.
+ * If the typeStart is initial node restart then the node
+ * has started without filesystem.
+ * All DIHs must then "forget" that the starting node has
+ * performed LCP's ever.
+ *
+ * @see StartPermReq
+ */
+
+class StartInfoReq {
+ /**
+ * Sender/Receiver
+ */
+ friend class Dbdih;
+
+ Uint32 startingNodeId;
+ Uint32 typeStart;
+ Uint32 systemFailureNo;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+};
+
+class StartInfoConf {
+
+ /**
+ * Sender/Receiver
+ */
+ friend class Dbdih;
+
+ /**
+ * NodeId of sending node
+ * which is "done"
+ */
+ Uint32 sendingNodeId;
+ Uint32 startingNodeId;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+};
+
+class StartInfoRef {
+
+ /**
+ * Sender/Receiver
+ */
+ friend class Dbdih;
+
+ /**
+ * NodeId of sending node
+ * The node was refused to start. This could be
+ * because there are still processes handling
+ * previous information from the starting node.
+ */
+ Uint32 sendingNodeId;
+ Uint32 startingNodeId;
+ Uint32 errorCode;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/StartMe.hpp b/ndb/include/kernel/signaldata/StartMe.hpp
new file mode 100644
index 00000000000..6593a9e9741
--- /dev/null
+++ b/ndb/include/kernel/signaldata/StartMe.hpp
@@ -0,0 +1,63 @@
+/* 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 START_ME_HPP
+#define START_ME_HPP
+
+/**
+ * This signal is sent...
+ *
+ * It also contains the Sysfile.
+ * Since the Sysfile can be larger than on StartMeConf signal,
+ * there might be more than on of these signals sent before
+ * the entire sysfile is transfered
+ *
+ */
+class StartMeReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+
+ Uint32 startingRef;
+ Uint32 startingVersion;
+};
+
+class StartMeConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 25 );
+private:
+
+ Uint32 startingNodeId;
+ Uint32 startWord;
+
+ /**
+ * No of free words to carry data
+ */
+ STATIC_CONST( DATA_SIZE = 23 );
+
+ Uint32 data[DATA_SIZE];
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/StartOrd.hpp b/ndb/include/kernel/signaldata/StartOrd.hpp
new file mode 100644
index 00000000000..43a48f70ba9
--- /dev/null
+++ b/ndb/include/kernel/signaldata/StartOrd.hpp
@@ -0,0 +1,48 @@
+/* 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 START_ORD_HPP
+#define START_ORD_HPP
+
+#include "SignalData.hpp"
+#include "StopReq.hpp"
+
+class StartOrd {
+public:
+ /**
+ * Senders
+ */
+ friend class ThreadConfig;
+ friend class MgmtSrvr;
+ friend class Ndbcntr;
+
+ /**
+ * Receivers
+ */
+ friend class SimBlockCMCtrBlck;
+
+ /**
+ * RequestInfo - See StopReq for getters/setters
+ */
+ Uint32 restartInfo;
+
+public:
+ STATIC_CONST( SignalLength = 1 );
+};
+
+
+#endif
+
diff --git a/ndb/include/kernel/signaldata/StartPerm.hpp b/ndb/include/kernel/signaldata/StartPerm.hpp
new file mode 100644
index 00000000000..38be72835a3
--- /dev/null
+++ b/ndb/include/kernel/signaldata/StartPerm.hpp
@@ -0,0 +1,68 @@
+/* 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 START_PERM_REQ_HPP
+#define START_PERM_REQ_HPP
+
+/**
+ * This signal is sent by starting DIH to master DIH
+ *
+ * Used when starting in an already started cluster
+ *
+ */
+class StartPermReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+private:
+
+ Uint32 blockRef;
+ Uint32 nodeId;
+ Uint32 startType;
+};
+
+class StartPermConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+
+ Uint32 startingNodeId;
+ Uint32 systemFailureNo;
+};
+
+class StartPermRef {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+
+ Uint32 startingNodeId;
+ Uint32 errorCode;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/StartRec.hpp b/ndb/include/kernel/signaldata/StartRec.hpp
new file mode 100644
index 00000000000..f8a4e01a094
--- /dev/null
+++ b/ndb/include/kernel/signaldata/StartRec.hpp
@@ -0,0 +1,61 @@
+/* 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 START_REC_HPP
+#define START_REC_HPP
+
+#include "SignalData.hpp"
+
+class StartRecReq {
+ /**
+ * Sender(s)
+ */
+ friend class Dbdih;
+ /**
+ * Receiver(s)
+ */
+ friend class Dblqh;
+
+ friend bool printSTART_REC_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+private:
+
+ Uint32 receivingNodeId;
+ Uint32 senderRef;
+ Uint32 keepGci;
+ Uint32 lastCompletedGci;
+ Uint32 newestGci;
+};
+
+class StartRecConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+ /**
+ * Receiver(s)
+ */
+ friend class Dbdih;
+
+ friend bool printSTART_REC_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 1 );
+private:
+
+ Uint32 startingNodeId;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/StartTo.hpp b/ndb/include/kernel/signaldata/StartTo.hpp
new file mode 100644
index 00000000000..5aecef6275d
--- /dev/null
+++ b/ndb/include/kernel/signaldata/StartTo.hpp
@@ -0,0 +1,50 @@
+/* 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 START_TO_HPP
+#define START_TO_HPP
+
+class StartToReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 5 );
+private:
+ Uint32 userPtr;
+ BlockReference userRef;
+ Uint32 startingNodeId;
+ Uint32 nodeTakenOver;
+ bool nodeRestart;
+};
+
+class StartToConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+private:
+
+ Uint32 userPtr;
+ Uint32 sendingNodeId;
+ Uint32 startingNodeId;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/StopMe.hpp b/ndb/include/kernel/signaldata/StopMe.hpp
new file mode 100644
index 00000000000..51d944a3b96
--- /dev/null
+++ b/ndb/include/kernel/signaldata/StopMe.hpp
@@ -0,0 +1,70 @@
+/* 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 STOP_ME_HPP
+#define STOP_ME_HPP
+
+/**
+ * This signal is sent by ndbcntr to local DIH
+ *
+ * If local DIH then sends it to all DIH's
+ *
+ * @see StopPermReq
+ * @see StartMeReq
+ * @see StartPermReq
+ */
+class StopMeReq {
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Sender
+ */
+ friend class Ndbcntr;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+
+ Uint32 senderRef;
+ Uint32 senderData;
+};
+
+class StopMeConf {
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbcntr;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+};
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/StopPerm.hpp b/ndb/include/kernel/signaldata/StopPerm.hpp
new file mode 100644
index 00000000000..95fb82c8cde
--- /dev/null
+++ b/ndb/include/kernel/signaldata/StopPerm.hpp
@@ -0,0 +1,96 @@
+/* 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 STOP_PERM_HPP
+#define STOP_PERM_HPP
+
+/**
+ * This signal is sent by ndbcntr to local DIH
+ *
+ * If local DIH is not master, it forwards it to master DIH
+ * and start acting as a proxy
+ *
+ * @see StopMeReq
+ * @see StartMeReq
+ * @see StartPermReq
+ */
+class StopPermReq {
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Sender
+ */
+ friend class Ndbcntr;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+public:
+
+ Uint32 senderRef;
+ Uint32 senderData;
+};
+
+class StopPermConf {
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbcntr;
+
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+private:
+ Uint32 senderData;
+};
+
+class StopPermRef {
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbcntr;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ enum ErrorCode {
+ StopOK = 0,
+ NodeStartInProgress = 1,
+ NodeShutdownInProgress = 2,
+ NF_CausedAbortOfStopProcedure = 3
+ };
+
+private:
+ Uint32 errorCode;
+ Uint32 senderData;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/StopReq.hpp b/ndb/include/kernel/signaldata/StopReq.hpp
new file mode 100644
index 00000000000..ea453ae115d
--- /dev/null
+++ b/ndb/include/kernel/signaldata/StopReq.hpp
@@ -0,0 +1,202 @@
+/* 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 STOP_REQ_HPP
+#define STOP_REQ_HPP
+
+#include "SignalData.hpp"
+
+class StopReq
+{
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbcntr;
+
+ /**
+ * Sender
+ */
+ friend class MgmtSrvr;
+
+public:
+ STATIC_CONST( SignalLength = 9 );
+
+public:
+ Uint32 senderRef;
+ Uint32 senderData;
+
+ Uint32 requestInfo;
+ Uint32 singleuser; // Indicates whether or not to enter
+ // single user mode.
+ // Only in conjunction with system stop
+ Uint32 singleUserApi; // allowed api in singleuser
+
+ Int32 apiTimeout; // Timeout before api transactions are refused
+ Int32 transactionTimeout; // Timeout before transactions are aborted
+ Int32 readOperationTimeout; // Timeout before read operations are aborted
+ Int32 operationTimeout; // Timeout before all operations are aborted
+
+ static void setSystemStop(Uint32 & requestInfo, bool value);
+ static void setPerformRestart(Uint32 & requestInfo, bool value);
+ static void setNoStart(Uint32 & requestInfo, bool value);
+ static void setInitialStart(Uint32 & requestInfo, bool value);
+ static void setEscalateOnNodeFail(Uint32 & requestInfo, bool value);
+ /**
+ * Don't perform "graceful" shutdown/restart...
+ */
+ static void setStopAbort(Uint32 & requestInfo, bool value);
+
+ static bool getSystemStop(const Uint32 & requestInfo);
+ static bool getPerformRestart(const Uint32 & requestInfo);
+ static bool getNoStart(const Uint32 & requestInfo);
+ static bool getInitialStart(const Uint32 & requestInfo);
+ static bool getEscalateOnNodeFail(const Uint32 & requestInfo);
+ static bool getStopAbort(const Uint32 & requestInfo);
+};
+
+class StopRef
+{
+ /**
+ * Reciver(s)
+ */
+ friend class MgmtSrvr;
+
+ /**
+ * Sender
+ */
+ friend class Ndbcntr;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ enum ErrorCode {
+ OK = 0,
+ NodeShutdownInProgress = 1,
+ SystemShutdownInProgress = 2,
+ NodeShutdownWouldCauseSystemCrash = 3
+ };
+
+public:
+ Uint32 senderData;
+ Uint32 errorCode;
+};
+
+inline
+bool
+StopReq::getSystemStop(const Uint32 & requestInfo)
+{
+ return requestInfo & 1;
+}
+
+inline
+bool
+StopReq::getPerformRestart(const Uint32 & requestInfo)
+{
+ return requestInfo & 2;
+}
+
+inline
+bool
+StopReq::getNoStart(const Uint32 & requestInfo)
+{
+ return requestInfo & 4;
+}
+
+inline
+bool
+StopReq::getInitialStart(const Uint32 & requestInfo)
+{
+ return requestInfo & 8;
+}
+
+inline
+bool
+StopReq::getEscalateOnNodeFail(const Uint32 & requestInfo)
+{
+ return requestInfo & 16;
+}
+
+inline
+bool
+StopReq::getStopAbort(const Uint32 & requestInfo)
+{
+ return requestInfo & 32;
+}
+
+
+inline
+void
+StopReq::setSystemStop(Uint32 & requestInfo, bool value)
+{
+ if(value)
+ requestInfo |= 1;
+ else
+ requestInfo &= ~1;
+}
+
+inline
+void
+StopReq::setPerformRestart(Uint32 & requestInfo, bool value)
+{
+ if(value)
+ requestInfo |= 2;
+ else
+ requestInfo &= ~2;
+}
+
+inline
+void
+StopReq::setNoStart(Uint32 & requestInfo, bool value)
+{
+ if(value)
+ requestInfo |= 4;
+ else
+ requestInfo &= ~4;
+}
+
+inline
+void
+StopReq::setInitialStart(Uint32 & requestInfo, bool value)
+{
+ if(value)
+ requestInfo |= 8;
+ else
+ requestInfo &= ~8;
+}
+
+inline
+void
+StopReq::setEscalateOnNodeFail(Uint32 & requestInfo, bool value)
+{
+ if(value)
+ requestInfo |= 16;
+ else
+ requestInfo &= ~16;
+}
+
+inline
+void
+StopReq::setStopAbort(Uint32 & requestInfo, bool value)
+{
+ if(value)
+ requestInfo |= 32;
+ else
+ requestInfo &= ~32;
+}
+
+
+#endif
+
diff --git a/ndb/include/kernel/signaldata/SumaImpl.hpp b/ndb/include/kernel/signaldata/SumaImpl.hpp
new file mode 100644
index 00000000000..089132cd9aa
--- /dev/null
+++ b/ndb/include/kernel/signaldata/SumaImpl.hpp
@@ -0,0 +1,619 @@
+/* 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 SUMA_IMPL_HPP
+#define SUMA_IMPL_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+
+
+class SubCreateReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+ friend class SumaParticipant;
+
+ friend bool printSUB_CREATE_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+ enum SubscriptionType {
+ SingleTableScan = 1, //
+ DatabaseSnapshot = 2, // All tables/all data (including new ones)
+ TableEvent = 3, //
+ SelectiveTableSnapshot = 4, // User defines tables
+ RemoveFlags = 0xff,
+ GetFlags = 0xff << 16,
+ AddTableFlag = 0x1 << 16,
+ RestartFlag = 0x2 << 16
+ };
+
+ Uint32 subscriberRef;
+ Uint32 subscriberData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 subscriptionType;
+ union {
+ Uint32 tableId; // Used when doing SingelTableScan
+ };
+ SECTION( ATTRIBUTE_LIST = 0); // Used when doing SingelTableScan
+ SECTION( TABLE_LIST = 1 );
+
+};
+
+class SubCreateRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+ friend class SumaParticipant;
+
+ friend bool printSUB_CREATE_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 6 );
+
+ Uint32 subscriberRef;
+ Uint32 subscriberData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 subscriptionType;
+ Uint32 err;
+
+ SECTION( ATTRIBUTE_LIST = 0); // Used when doing SingelTableScan
+ union {
+ Uint32 tableId; // Used when doing SingelTableScan
+ };
+};
+
+class SubCreateConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+ friend class SumaParticipant;
+
+ friend bool printSUB_CREATE_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ Uint32 subscriberData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+};
+
+class SubscriptionData {
+public:
+ enum Part {
+ MetaData = 1,
+ TableData = 2
+ };
+};
+
+class SubStartReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Suma;
+
+ friend bool printSUB_START_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 6 );
+ STATIC_CONST( SignalLength2 = SignalLength+1 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 part; // SubscriptionData::Part
+ Uint32 subscriberData;
+ Uint32 subscriberRef;
+};
+
+class SubStartRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Suma;
+
+ friend bool printSUB_START_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ enum ErrorCode {
+ Undefined = 0,
+ NF_FakeErrorREF = 11,
+ Busy = 701,
+ Temporary = 0x1 << 16
+ };
+ bool isTemporary() const;
+ void setTemporary();
+ ErrorCode setTemporary(ErrorCode ec);
+
+ STATIC_CONST( SignalLength = 7 );
+ STATIC_CONST( SignalLength2 = SignalLength+1 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 part; // SubscriptionData::Part
+ Uint32 subscriberData;
+ union { // do not change the order here!
+ Uint32 err;
+ Uint32 errorCode;
+ };
+ // with SignalLength2
+ Uint32 subscriberRef;
+};
+inline bool SubStartRef::isTemporary() const
+{ return (errorCode & SubStartRef::Temporary) > 0; };
+inline void SubStartRef::setTemporary()
+{ errorCode |= SubStartRef::Temporary; };
+inline SubStartRef::ErrorCode SubStartRef::setTemporary(ErrorCode ec)
+{ return (SubStartRef::ErrorCode)
+ (errorCode = ((Uint32) ec | (Uint32)SubStartRef::Temporary)); };
+
+class SubStartConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printSUB_START_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 7 );
+ STATIC_CONST( SignalLength2 = SignalLength+1 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 firstGCI;
+ Uint32 part; // SubscriptionData::Part
+ Uint32 subscriberData;
+ // with SignalLength2
+ Uint32 subscriberRef;
+};
+
+class SubStopReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Suma;
+
+ friend bool printSUB_STOP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 7 );
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 part; // SubscriptionData::Part
+ Uint32 subscriberData;
+ Uint32 subscriberRef;
+};
+
+class SubStopRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Suma;
+
+ friend bool printSUB_STOP_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ enum ErrorCode {
+ Undefined = 0,
+ NF_FakeErrorREF = 11,
+ Busy = 701,
+ Temporary = 0x1 << 16
+ };
+ bool isTemporary() const;
+ void setTemporary();
+ ErrorCode setTemporary(ErrorCode ec);
+
+ STATIC_CONST( SignalLength = 8 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 part; // SubscriptionData::Part
+ Uint32 subscriberData;
+ Uint32 subscriberRef;
+ union {
+ Uint32 err;
+ Uint32 errorCode;
+ };
+};
+inline bool SubStopRef::isTemporary() const
+{ return (errorCode & SubStopRef::Temporary) > 0; };
+inline void SubStopRef::setTemporary()
+{ errorCode |= SubStopRef::Temporary; };
+inline SubStopRef::ErrorCode SubStopRef::setTemporary(ErrorCode ec)
+{ return (SubStopRef::ErrorCode)
+ (errorCode = ((Uint32) ec | (Uint32)SubStopRef::Temporary)); };
+
+class SubStopConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+
+ friend bool printSUB_STOP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 7 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 part; // SubscriptionData::Part
+ Uint32 subscriberData;
+ Uint32 subscriberRef;
+};
+
+class SubSyncReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Suma;
+ friend class Grep;
+
+ friend bool printSUB_SYNC_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+public:
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 subscriberData;
+ Uint32 part; // SubscriptionData::Part
+};
+
+class SubSyncRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Suma;
+ friend class Grep;
+
+ friend bool printSUB_SYNC_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ enum ErrorCode {
+ Undefined = 0,
+ Temporary = 0x1 << 16
+ };
+ STATIC_CONST( SignalLength = 5 );
+
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 part; // SubscriptionData::Part
+ Uint32 subscriberData;
+ union {
+ Uint32 errorCode;
+ Uint32 err;
+ };
+};
+
+class SubSyncConf {
+
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Suma;
+ friend class Grep;
+
+ friend bool printSUB_SYNC_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 part; // SubscriptionData::Part
+ Uint32 subscriberData;
+};
+
+class SubMetaData {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class SumaParticipant;
+ friend class Grep;
+
+ friend bool printSUB_META_DATA(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+ SECTION( DICT_TAB_INFO = 0 );
+
+ Uint32 gci;
+ union { // Haven't decide what to call it
+ Uint32 senderData;
+ Uint32 subscriberData;
+ };
+ union {
+ Uint32 tableId;
+ };
+};
+
+class SubTableData {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class SumaParticipant;
+ friend class Grep;
+
+ friend bool printSUB_TABLE_DATA(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 7 );
+
+ enum LogType {
+ SCAN = 1,
+ LOG = 2,
+ REMOVE_FLAGS = 0xff,
+ GCINOTCONSISTENT = 0x1 << 16
+ };
+
+ void setGCINotConsistent() { logType |= (Uint32)GCINOTCONSISTENT; };
+ bool isGCIConsistent()
+ { return (logType & (Uint32)GCINOTCONSISTENT) == 0 ? true : false; };
+
+ union { // Haven't decide what to call it
+ Uint32 senderData;
+ Uint32 subscriberData;
+ };
+ Uint32 gci;
+ Uint32 tableId;
+ Uint32 operation;
+ Uint32 noOfAttributes;
+ Uint32 dataSize;
+ Uint32 logType;
+};
+
+class SubSyncContinueReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class SumaParticipant;
+ friend class Grep;
+ friend class Trix;
+
+ friend bool printSUB_SYNC_CONTINUE_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ union { // Haven't decide what to call it
+ Uint32 senderData;
+ Uint32 subscriberData;
+ };
+ Uint32 noOfRowsSent;
+};
+
+class SubSyncContinueRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class SumaParticipant;
+ friend class Grep;
+ friend class Trix;
+
+ friend bool printSUB_SYNC_CONTINUE_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+};
+
+class SubSyncContinueConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class SumaParticipant;
+ friend class Grep;
+ friend class Trix;
+
+ friend bool printSUB_SYNC_CONTINUE_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+};
+
+class SubGcpCompleteRep {
+
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Dbdih;
+ friend class SumaParticipant;
+ friend class Grep;
+ friend class Trix;
+
+ friend bool printSUB_GCP_COMPLETE_REP(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ Uint32 gci;
+ Uint32 senderRef;
+ union { // Haven't decide what to call it
+ Uint32 senderData;
+ Uint32 subscriberData;
+ };
+};
+
+class SubGcpCompleteAcc {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+public:
+ STATIC_CONST( SignalLength = SubGcpCompleteRep::SignalLength );
+
+ SubGcpCompleteRep rep;
+};
+
+class SubRemoveReq {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+ friend class SumaParticipant;
+
+ friend bool printSUB_REMOVE_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+};
+
+class SubRemoveRef {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+ friend class SumaParticipant;
+
+ friend bool printSUB_REMOVE_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+ enum ErrorCode {
+ Undefined = 0,
+ NF_FakeErrorREF = 11,
+ Busy = 701,
+ Temporary = 0x1 << 16
+ };
+ bool isTemporary() const;
+ void setTemporary();
+ ErrorCode setTemporary(ErrorCode ec);
+
+ Uint32 senderRef;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ union {
+ Uint32 err;
+ Uint32 errorCode;
+ };
+ union { // Haven't decide what to call it
+ Uint32 senderData;
+ Uint32 subscriberData;
+ };
+};
+inline bool SubRemoveRef::isTemporary() const
+{ return (err & SubRemoveRef::Temporary) > 0; };
+inline void SubRemoveRef::setTemporary()
+{ err |= SubRemoveRef::Temporary; };
+inline SubRemoveRef::ErrorCode SubRemoveRef::setTemporary(ErrorCode ec)
+{ return (SubRemoveRef::ErrorCode)
+ (errorCode = ((Uint32) ec | (Uint32)SubRemoveRef::Temporary)); };
+
+class SubRemoveConf {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Grep;
+ friend class SumaParticipant;
+
+ friend bool printSUB_REMOVE_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+ Uint32 senderRef;
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 err;
+ union { // Haven't decide what to call it
+ Uint32 senderData;
+ Uint32 subscriberData;
+ };
+
+};
+
+
+class CreateSubscriptionIdReq {
+ friend class Grep;
+ friend class SumaParticipant;
+
+ friend bool printCREATE_SUBSCRIPTION_ID_REQ(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ union { // Haven't decide what to call it
+ Uint32 senderData;
+ Uint32 subscriberData;
+ };
+};
+
+
+class CreateSubscriptionIdConf {
+ friend class Grep;
+ friend class SumaParticipant;
+
+ friend bool printCREATE_SUBSCRIPTION_ID_CONF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ union { // Haven't decide what to call it
+ Uint32 senderData;
+ Uint32 subscriberData;
+ };
+};
+
+
+class CreateSubscriptionIdRef {
+ friend class Grep;
+ friend class SumaParticipant;
+
+ friend bool printCREATE_SUBSCRIPTION_ID_REF(FILE *, const Uint32 *,
+ Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ Uint32 subscriptionId;
+ Uint32 subscriptionKey;
+ Uint32 err;
+ union { // Haven't decide what to call it
+ Uint32 senderData;
+ Uint32 subscriberData;
+ };
+};
+
+class SumaStartMe {
+public:
+ STATIC_CONST( SignalLength = 1 );
+ Uint32 unused;
+};
+
+class SumaHandoverReq {
+public:
+ STATIC_CONST( SignalLength = 1 );
+ Uint32 gci;
+};
+
+class SumaHandoverConf {
+public:
+ STATIC_CONST( SignalLength = 1 );
+ Uint32 gci;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/SystemError.hpp b/ndb/include/kernel/signaldata/SystemError.hpp
new file mode 100644
index 00000000000..7b4d47c5c2e
--- /dev/null
+++ b/ndb/include/kernel/signaldata/SystemError.hpp
@@ -0,0 +1,60 @@
+/* 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 SYSTEM_ERROR_HPP
+#define SYSTEM_ERROR_HPP
+
+#include "SignalData.hpp"
+
+class SystemError {
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbcntr;
+
+ /**
+ * Sender
+ */
+ friend class Dbtc;
+ friend class Dbdih;
+
+ /**
+ * For printing
+ */
+ friend bool printSYSTEM_ERROR(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ enum ErrorCode {
+ ScanfragStateError = 1,
+ ScanfragTimeout = 2,
+ GCPStopDetected = 3,
+ StartInProgressError = 4,
+ CopyFragRefError = 5,
+ TestStopOnError = 6
+ };
+
+private:
+ Uint32 errorRef;
+ Uint32 errorCode;
+ Uint32 data1;
+ Uint32 data2;
+};
+
+#endif
+
diff --git a/ndb/include/kernel/signaldata/TamperOrd.hpp b/ndb/include/kernel/signaldata/TamperOrd.hpp
new file mode 100644
index 00000000000..eb6cd47b093
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TamperOrd.hpp
@@ -0,0 +1,40 @@
+/* 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 TAMPERORD_H
+#define TAMPERORD_H
+
+#include "SignalData.hpp"
+
+class TamperOrd {
+ /**
+ * Sender
+ */
+ friend class MgmtSrvr;
+
+ /**
+ * Receiver
+ */
+ friend class Cmvmi;
+
+private:
+ STATIC_CONST( SignalLength = 1 );
+
+ UintR errorNo;
+};
+
+#endif // TAMPERORD_H
+
diff --git a/ndb/include/kernel/signaldata/TcCommit.hpp b/ndb/include/kernel/signaldata/TcCommit.hpp
new file mode 100644
index 00000000000..43eb7be1c39
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TcCommit.hpp
@@ -0,0 +1,74 @@
+/* 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 TCCOMMITCONF_HPP
+#define TCCOMMITCONF_HPP
+
+#include "SignalData.hpp"
+
+/**
+ * This is signal is sent from TC to API
+ * It means that the transaction was committed
+ */
+class TcCommitConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndb;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+private:
+
+ /**
+ * apiConnectPtr
+ *
+ * Bit 0 (lowest) is used as indicator
+ * if == 1 then tc expects a commit ack
+ */
+ Uint32 apiConnectPtr;
+
+ Uint32 transId1;
+ Uint32 transId2;
+};
+
+class TcCommitRef {
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * Reciver(s)
+ */
+ friend class NdbConnection;
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+private:
+
+ Uint32 apiConnectPtr;
+ Uint32 transId1;
+ Uint32 transId2;
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TcContinueB.hpp b/ndb/include/kernel/signaldata/TcContinueB.hpp
new file mode 100644
index 00000000000..7a093b457e8
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TcContinueB.hpp
@@ -0,0 +1,49 @@
+/* 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 TC_CONTINUEB_H
+#define TC_CONTINUEB_H
+
+#include "SignalData.hpp"
+
+class TcContinueB {
+ /**
+ * Sender(s)/Reciver(s)
+ */
+ friend class Dbtc;
+private:
+ enum {
+ ZRETURN_FROM_QUEUED_DELIVERY = 1,
+ ZCOMPLETE_TRANS_AT_TAKE_OVER = 2,
+ ZCONTINUE_TIME_OUT_CONTROL = 3,
+ ZNODE_TAKE_OVER_COMPLETED = 4,
+ ZINITIALISE_RECORDS = 5,
+ ZSEND_COMMIT_LOOP = 6,
+ ZSEND_COMPLETE_LOOP = 7,
+ ZHANDLE_FAILED_API_NODE = 8,
+ ZTRANS_EVENT_REP = 9,
+ ZABORT_BREAK = 10,
+ ZABORT_TIMEOUT_BREAK = 11,
+ ZCONTINUE_TIME_OUT_FRAG_CONTROL = 12,
+ ZHANDLE_FAILED_API_NODE_REMOVE_MARKERS = 13,
+ ZWAIT_ABORT_ALL = 14,
+ ZCHECK_SCAN_ACTIVE_FAILED_LQH = 15,
+ CHECK_WAIT_DROP_TAB_FAILED_LQH = 16,
+ TRIGGER_PENDING = 17
+ };
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TcHbRep.hpp b/ndb/include/kernel/signaldata/TcHbRep.hpp
new file mode 100644
index 00000000000..58ab015917a
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TcHbRep.hpp
@@ -0,0 +1,64 @@
+/* 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 TC_HB_REP_H
+#define TC_HB_REP_H
+
+#include "SignalData.hpp"
+
+/**
+ * @class TcHbRep
+ * @brief Order tc refresh(exetend) the timeout counters for this
+ * transaction
+ *
+ * - SENDER: API
+ * - RECEIVER: TC
+ */
+class TcHbRep {
+ /**
+ * Receiver(s)
+ */
+ friend class Dbtc; // Receiver
+
+ /**
+ * Sender(s)
+ */
+ friend class NdbConnection;
+
+ /**
+ * For printing
+ */
+ friend bool printTC_HBREP(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+
+ Uint32 apiConnectPtr; // DATA 0
+ UintR transId1; // DATA 1
+ UintR transId2; // DATA 2
+};
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TcIndx.hpp b/ndb/include/kernel/signaldata/TcIndx.hpp
new file mode 100644
index 00000000000..764d4e9fcd7
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TcIndx.hpp
@@ -0,0 +1,528 @@
+/* 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 TC_INDX_H
+#define TC_INDX_H
+
+#include "SignalData.hpp"
+
+class TcIndxReq {
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc; // Reciver
+
+ /**
+ * Sender(s)
+ */
+ friend class NdbIndexOperation;
+
+ /**
+ * For printing
+ */
+ friend bool printTCINDXREQ(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( StaticLength = 8 );
+ STATIC_CONST( SignalLength = 25 );
+ STATIC_CONST( MaxKeyInfo = 8 );
+ STATIC_CONST( MaxAttrInfo = 5 );
+
+private:
+
+ enum CommitType {
+ CommitIfFailFree = 0,
+ TryCommit = 1,
+ CommitAsMuchAsPossible = 2
+ };
+
+ /**
+ * DATA VARIABLES
+ */
+//-------------------------------------------------------------
+// Unconditional part. First 8 words
+//-------------------------------------------------------------
+ UintR apiConnectPtr; // DATA 0
+ UintR senderData; // DATA 1
+ UintR attrLen; // DATA 2 (including API Version)
+ UintR indexId; // DATA 3
+ UintR requestInfo; // DATA 4
+ UintR indexSchemaVersion; // DATA 5
+ UintR transId1; // DATA 6
+ UintR transId2; // DATA 7
+//-------------------------------------------------------------
+// Conditional part. Those four words will be sent only if their
+// indicator is set.
+//-------------------------------------------------------------
+ UintR scanInfo; // DATA 8
+ UintR distrGroupHashValue; // DATA 9
+ UintR distributionKeySize; // DATA 10
+ UintR storedProcId; // DATA 11
+
+//-------------------------------------------------------------
+// Variable sized key and attrinfo part. Those will be placed to
+// pack the signal in an appropriate manner.
+//-------------------------------------------------------------
+ UintR keyInfo[MaxKeyInfo]; // DATA 12 - 19
+ UintR attrInfo[MaxAttrInfo]; // DATA 20 - 24
+
+ static Uint8 getAPIVersion(const UintR & attrLen);
+
+ /**
+ * Get:ers for requestInfo
+ */
+ static Uint8 getCommitFlag(const UintR & requestInfo);
+ static Uint8 getCommitType(const UintR & requestInfo);
+ static Uint8 getStartFlag(const UintR & requestInfo);
+ static Uint8 getSimpleFlag(const UintR & requestInfo);
+ static Uint8 getDirtyFlag(const UintR & requestInfo);
+ static Uint8 getInterpretedFlag(const UintR & requestInfo);
+ static Uint8 getDistributionGroupFlag(const UintR & requestInfo);
+ static Uint8 getDistributionGroupTypeFlag(const UintR & requestInfo);
+ static Uint8 getDistributionKeyFlag(const UintR & requestInfo);
+ static Uint8 getScanIndFlag(const UintR & requestInfo);
+
+ static Uint8 getOperationType(const UintR & requestInfo);
+
+ static Uint16 getIndexLength(const UintR & requestInfo);
+ static Uint8 getAIInTcIndxReq(const UintR & requestInfo);
+
+ /**
+ * Get:ers for scanInfo
+ */
+
+ static void setAPIVersion(UintR & attrLen, Uint16 apiVersion);
+
+ /**
+ * Set:ers for requestInfo
+ */
+ static void clearRequestInfo(UintR & requestInfo);
+ static void setCommitType(UintR & requestInfo, Uint32 type);
+ static void setCommitFlag(UintR & requestInfo, Uint32 flag);
+ static void setStartFlag(UintR & requestInfo, Uint32 flag);
+ static void setSimpleFlag(UintR & requestInfo, Uint32 flag);
+ static void setDirtyFlag(UintR & requestInfo, Uint32 flag);
+ static void setInterpretedFlag(UintR & requestInfo, Uint32 flag);
+ static void setDistributionGroupFlag(UintR & requestInfo, Uint32 flag);
+ static void setDistributionGroupTypeFlag(UintR & requestInfo, Uint32 flag);
+ static void setDistributionKeyFlag(UintR & requestInfo, Uint32 flag);
+ static void setScanIndFlag(UintR & requestInfo, Uint32 flag);
+
+ static void setOperationType(UintR & requestInfo, Uint32 type);
+
+ static void setIndexLength(UintR & requestInfo, Uint32 len);
+ static void setAIInTcIndxReq(UintR & requestInfo, Uint32 len);
+
+ /**
+ * Set:ers for scanInfo
+ */
+
+};
+
+#define API_VER_NO_SHIFT (16)
+#define API_VER_NO_MASK (65535)
+
+/**
+ * Request Info
+ *
+ a = Attr Info in TCINDXREQ - 3 Bits -> Max 7 (Bit 16-18)
+ b = Distribution Key Ind - 1 Bit 2
+ c = Commit Indicator - 1 Bit 4
+ d = Dirty Indicator - 1 Bit 0
+ e = Scan Indicator - 1 Bit 14
+ g = Distribution Group Ind - 1 Bit 1
+ i = Interpreted Indicator - 1 Bit 15
+ k = Index lengt - 12 Bits -> Max 4095 (Bit 20 - 31)
+ o = Operation Type - 3 Bits -> Max 7 (Bit 5-7)
+ p = Simple Indicator - 1 Bit 8
+ s = Start Indicator - 1 Bit 11
+ t = Distribution GroupType - 1 Bit 3
+ y = Commit Type - 2 Bit 12-13
+ x = Last Op in execute - 1 Bit 19
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+ dgbtcooop syyeiaaa-kkkkkkkkkkkk
+*/
+
+#define COMMIT_SHIFT (4)
+#define START_SHIFT (11)
+#define SIMPLE_SHIFT (8)
+#define DIRTY_SHIFT (0)
+#define INTERPRETED_SHIFT (15)
+#define DISTR_GROUP_SHIFT (1)
+#define DISTR_GROUP_TYPE_SHIFT (3)
+#define DISTR_KEY_SHIFT (2)
+#define SCAN_SHIFT (14)
+
+#define OPERATION_SHIFT (5)
+#define OPERATION_MASK (7)
+
+#define AINFO_SHIFT (16)
+#define AINFO_MASK (7)
+
+#define INDEX_LEN_SHIFT (20)
+#define INDEX_LEN_MASK (4095)
+
+#define COMMIT_TYPE_SHIFT (12)
+#define COMMIT_TYPE_MASK (3)
+
+#define LAST_OP_IN_EXEC_SHIFT (19)
+
+/**
+ * Scan Info
+ *
+
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+
+*/
+
+inline
+Uint8
+TcIndxReq::getCommitFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> COMMIT_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcIndxReq::getCommitType(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> COMMIT_TYPE_SHIFT) & COMMIT_TYPE_MASK);
+}
+
+inline
+Uint8
+TcIndxReq::getStartFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> START_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcIndxReq::getSimpleFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> SIMPLE_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcIndxReq::getDirtyFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> DIRTY_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcIndxReq::getInterpretedFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> INTERPRETED_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcIndxReq::getDistributionGroupFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> DISTR_GROUP_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcIndxReq::getDistributionGroupTypeFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> DISTR_GROUP_TYPE_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcIndxReq::getDistributionKeyFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> DISTR_KEY_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcIndxReq::getScanIndFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> SCAN_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcIndxReq::getOperationType(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> OPERATION_SHIFT) & OPERATION_MASK);
+}
+
+inline
+Uint16
+TcIndxReq::getIndexLength(const UintR & requestInfo){
+ return (Uint16)((requestInfo >> INDEX_LEN_SHIFT) & INDEX_LEN_MASK);
+}
+
+inline
+Uint8
+TcIndxReq::getAIInTcIndxReq(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> AINFO_SHIFT) & AINFO_MASK);
+}
+
+inline
+void
+TcIndxReq::clearRequestInfo(UintR & requestInfo){
+ requestInfo = 0;
+}
+
+inline
+void
+TcIndxReq::setCommitType(UintR & requestInfo, Uint32 type){
+ ASSERT_MAX(type, COMMIT_TYPE_MASK, "TcIndxReq::setCommitType");
+ requestInfo |= (type << COMMIT_TYPE_SHIFT);
+}
+
+inline
+void
+TcIndxReq::setCommitFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcIndxReq::setCommitFlag");
+ requestInfo &= ~(1 << COMMIT_SHIFT);
+ requestInfo |= (flag << COMMIT_SHIFT);
+}
+
+inline
+void
+TcIndxReq::setStartFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcIndxReq::setStartFlag");
+ requestInfo &= ~(1 << START_SHIFT);
+ requestInfo |= (flag << START_SHIFT);
+}
+
+inline
+void
+TcIndxReq::setSimpleFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcIndxReq::setSimpleFlag");
+ requestInfo &= ~(1 << SIMPLE_SHIFT);
+ requestInfo |= (flag << SIMPLE_SHIFT);
+}
+
+inline
+void
+TcIndxReq::setDirtyFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcIndxReq::setDirtyFlag");
+ requestInfo &= ~(1 << DIRTY_SHIFT);
+ requestInfo |= (flag << DIRTY_SHIFT);
+}
+
+inline
+void
+TcIndxReq::setInterpretedFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcIndxReq::setInterpretedFlag");
+ requestInfo &= ~(1 << INTERPRETED_SHIFT);
+ requestInfo |= (flag << INTERPRETED_SHIFT);
+}
+
+inline
+void
+TcIndxReq::setDistributionGroupTypeFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcIndxReq::setDistributionGroupTypeFlag");
+ requestInfo &= ~(1 << DISTR_GROUP_TYPE_SHIFT);
+ requestInfo |= (flag << DISTR_GROUP_TYPE_SHIFT);
+}
+
+inline
+void
+TcIndxReq::setDistributionGroupFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcIndxReq::setDistributionGroupFlag");
+ requestInfo &= ~(1 << DISTR_GROUP_SHIFT);
+ requestInfo |= (flag << DISTR_GROUP_SHIFT);
+}
+
+inline
+void
+TcIndxReq::setDistributionKeyFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcIndxReq::setDistributionKeyFlag");
+ requestInfo &= ~(1 << DISTR_KEY_SHIFT);
+ requestInfo |= (flag << DISTR_KEY_SHIFT);
+}
+
+inline
+void
+TcIndxReq::setScanIndFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcIndxReq::setScanIndFlag");
+ requestInfo &= ~(1 << SCAN_SHIFT);
+ requestInfo |= (flag << SCAN_SHIFT);
+}
+
+inline
+void
+TcIndxReq::setOperationType(UintR & requestInfo, Uint32 type){
+ ASSERT_MAX(type, OPERATION_MASK, "TcIndxReq::setOperationType");
+ requestInfo |= (type << OPERATION_SHIFT);
+}
+
+inline
+void
+TcIndxReq::setIndexLength(UintR & requestInfo, Uint32 len){
+ ASSERT_MAX(len, INDEX_LEN_MASK, "TcIndxReq::setKeyLength");
+ requestInfo |= (len << INDEX_LEN_SHIFT);
+}
+
+inline
+void
+TcIndxReq::setAIInTcIndxReq(UintR & requestInfo, Uint32 len){
+ ASSERT_MAX(len, AINFO_MASK, "TcIndxReq::setAIInTcIndxReq");
+ requestInfo |= (len << AINFO_SHIFT);
+}
+
+inline
+Uint8
+TcIndxReq::getAPIVersion(const UintR & anAttrLen){
+ return (Uint16)((anAttrLen >> API_VER_NO_SHIFT) & API_VER_NO_MASK);
+}
+
+inline
+void
+TcIndxReq::setAPIVersion(UintR & anAttrLen, Uint16 apiVersion){
+// ASSERT_MAX(apiVersion, API_VER_NO_MASK, "TcIndxReq::setAPIVersion");
+ anAttrLen |= (apiVersion << API_VER_NO_SHIFT);
+}
+
+class TcIndxConf {
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndb;
+ friend class NdbConnection;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * For printing
+ */
+ friend bool printTCINDXCONF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( SignalLength = 5 );
+
+private:
+ /**
+ * DATA VARIABLES
+ */
+ //-------------------------------------------------------------
+ // Unconditional part. First 5 words
+ //-------------------------------------------------------------
+
+ Uint32 apiConnectPtr;
+ Uint32 gci;
+ Uint32 confInfo;
+ Uint32 transId1;
+ Uint32 transId2;
+
+ struct OperationConf {
+ Uint32 apiOperationPtr;
+ Uint32 attrInfoLen;
+ };
+ //-------------------------------------------------------------
+ // Operations confirmations,
+ // No of actually sent = getNoOfOperations(confInfo)
+ //-------------------------------------------------------------
+ OperationConf operations[10];
+
+ /**
+ * Get:ers for confInfo
+ */
+ static Uint32 getNoOfOperations(const Uint32 & confInfo);
+ static Uint32 getCommitFlag(const Uint32 & confInfo);
+ static bool getMarkerFlag(const Uint32 & confInfo);
+
+ /**
+ * Set:ers for confInfo
+ */
+ static void setCommitFlag(Uint32 & confInfo, Uint8 flag);
+ static void setNoOfOperations(Uint32 & confInfo, Uint32 noOfOps);
+ static void setMarkerFlag(Uint32 & confInfo, Uint32 flag);
+};
+
+inline
+Uint32
+TcIndxConf::getNoOfOperations(const Uint32 & confInfo){
+ return confInfo & 65535;
+}
+
+inline
+Uint32
+TcIndxConf::getCommitFlag(const Uint32 & confInfo){
+ return ((confInfo >> 16) & 1);
+}
+
+inline
+bool
+TcIndxConf::getMarkerFlag(const Uint32 & confInfo){
+ const Uint32 bits = 3 << 16; // Marker only valid when doing commit
+ return (confInfo & bits) == bits;
+}
+
+inline
+void
+TcIndxConf::setNoOfOperations(Uint32 & confInfo, Uint32 noOfOps){
+ ASSERT_MAX(noOfOps, 65535, "TcIndxConf::setNoOfOperations");
+ confInfo |= noOfOps;
+}
+
+inline
+void
+TcIndxConf::setCommitFlag(Uint32 & confInfo, Uint8 flag){
+ ASSERT_BOOL(flag, "TcIndxConf::setCommitFlag");
+ confInfo |= (flag << 16);
+}
+
+inline
+void
+TcIndxConf::setMarkerFlag(Uint32 & confInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcIndxConf::setMarkerFlag");
+ confInfo |= (flag << 17);
+}
+
+class TcIndxRef {
+
+ /**
+ * Reciver(s)
+ */
+ friend class NdbIndexOperation;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * For printing
+ */
+ friend bool printTCINDXREF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ /**
+ * Length of signal
+ */
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 connectPtr;
+ Uint32 transId[2];
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TcKeyConf.hpp b/ndb/include/kernel/signaldata/TcKeyConf.hpp
new file mode 100644
index 00000000000..bfd684b4af4
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TcKeyConf.hpp
@@ -0,0 +1,131 @@
+/* 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 TC_KEY_CONF_H
+#define TC_KEY_CONF_H
+
+#include "SignalData.hpp"
+
+/**
+ *
+ */
+class TcKeyConf {
+ /**
+ * Reciver(s)
+ */
+ friend class Ndb;
+ friend class NdbConnection;
+ friend class Ndbcntr;
+ friend class DbUtil;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * For printing
+ */
+ friend bool printTCKEYCONF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( StaticLength = 5 );
+ STATIC_CONST( OperationLength = 2 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+ //-------------------------------------------------------------
+ // Unconditional part. First 5 words
+ //-------------------------------------------------------------
+
+ Uint32 apiConnectPtr;
+ Uint32 gci;
+ Uint32 confInfo;
+ Uint32 transId1;
+ Uint32 transId2;
+
+ struct OperationConf {
+ Uint32 apiOperationPtr;
+ Uint32 attrInfoLen;
+ };
+ //-------------------------------------------------------------
+ // Operations confirmations,
+ // No of actually sent = getNoOfOperations(confInfo)
+ //-------------------------------------------------------------
+ OperationConf operations[10];
+
+ /**
+ * Get:ers for confInfo
+ */
+ static Uint32 getNoOfOperations(const Uint32 & confInfo);
+ static Uint32 getCommitFlag(const Uint32 & confInfo);
+ static bool getMarkerFlag(const Uint32 & confInfo);
+
+ /**
+ * Set:ers for confInfo
+ */
+ static void setCommitFlag(Uint32 & confInfo, Uint8 flag);
+ static void setNoOfOperations(Uint32 & confInfo, Uint32 noOfOps);
+ static void setMarkerFlag(Uint32 & confInfo, Uint32 flag);
+};
+
+inline
+Uint32
+TcKeyConf::getNoOfOperations(const Uint32 & confInfo){
+ return confInfo & 65535;
+}
+
+inline
+Uint32
+TcKeyConf::getCommitFlag(const Uint32 & confInfo){
+ return ((confInfo >> 16) & 1);
+}
+
+inline
+bool
+TcKeyConf::getMarkerFlag(const Uint32 & confInfo){
+ const Uint32 bits = 3 << 16; // Marker only valid when doing commit
+ return (confInfo & bits) == bits;
+}
+
+inline
+void
+TcKeyConf::setNoOfOperations(Uint32 & confInfo, Uint32 noOfOps){
+ ASSERT_MAX(noOfOps, 65535, "TcKeyConf::setNoOfOperations");
+ confInfo |= noOfOps;
+}
+
+inline
+void
+TcKeyConf::setCommitFlag(Uint32 & confInfo, Uint8 flag){
+ ASSERT_BOOL(flag, "TcKeyConf::setCommitFlag");
+ confInfo |= (flag << 16);
+}
+
+inline
+void
+TcKeyConf::setMarkerFlag(Uint32 & confInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcKeyConf::setMarkerFlag");
+ confInfo |= (flag << 17);
+}
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TcKeyFailConf.hpp b/ndb/include/kernel/signaldata/TcKeyFailConf.hpp
new file mode 100644
index 00000000000..d8207b63262
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TcKeyFailConf.hpp
@@ -0,0 +1,53 @@
+/* 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 TCKEYFAILCONF_HPP
+#define TCKEYFAILCONF_HPP
+
+#include <NodeBitmask.hpp>
+
+/**
+ * This is signal is sent from "Take-Over" TC after a node crash
+ * It means that the transaction was committed
+ */
+class TcKeyFailConf {
+ /**
+ * Sender(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndb;
+ friend class NdbConnection;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+private:
+
+ /**
+ * apiConnectPtr
+ *
+ * Bit 0 (lowest) is used as indicator
+ * if == 1 then tc expects a commit ack
+ */
+ Uint32 apiConnectPtr;
+ Uint32 transId1;
+ Uint32 transId2;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TcKeyRef.hpp b/ndb/include/kernel/signaldata/TcKeyRef.hpp
new file mode 100644
index 00000000000..c773920713a
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TcKeyRef.hpp
@@ -0,0 +1,52 @@
+/* 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 TCKEYREF_HPP
+#define TCKEYREF_HPP
+
+#include "SignalData.hpp"
+
+class TcKeyRef {
+
+ /**
+ * Receiver(s)
+ */
+ friend class NdbOperation;
+ friend class Ndbcntr;
+ friend class DbUtil;
+
+ /**
+ * Sender(s) / Receiver(s)
+ */
+ friend class Dbtc;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ friend bool printTCKEYREF(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 connectPtr;
+ Uint32 transId[2];
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TcKeyReq.hpp b/ndb/include/kernel/signaldata/TcKeyReq.hpp
new file mode 100644
index 00000000000..df0a00da3e0
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TcKeyReq.hpp
@@ -0,0 +1,547 @@
+/* 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 TC_KEY_REQ_H
+#define TC_KEY_REQ_H
+
+#include "SignalData.hpp"
+
+/**
+ * @class TcKeyReq
+ * @brief Contains KeyInfo and AttrInfo and is commonly followed by more signals
+ *
+ * - SENDER: API, NDBCNTR
+ * - RECEIVER: TC
+ */
+class TcKeyReq {
+ /**
+ * Receiver(s)
+ */
+ friend class Dbtc; // Receiver
+
+ /**
+ * Sender(s)
+ */
+ friend class Ndbcntr;
+ friend class NdbOperation;
+ friend class NdbIndexOperation;
+ friend class DbUtil;
+
+ /**
+ * For printing
+ */
+ friend bool printTCKEYREQ(FILE *, const Uint32 *, Uint32, Uint16);
+ friend bool printTCINDXREQ(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( StaticLength = 8 );
+ STATIC_CONST( SignalLength = 25 );
+ STATIC_CONST( MaxKeyInfo = 8 );
+ STATIC_CONST( MaxAttrInfo = 5 );
+ STATIC_CONST( MaxTotalAttrInfo = 0xFFFF );
+
+private:
+
+ enum AbortOption {
+ CommitIfFailFree = 0, AbortOnError = 0,
+ CommitAsMuchAsPossible = 2, IgnoreError = 2
+ };
+
+ typedef AbortOption CommitType;
+
+ /**
+ * DATA VARIABLES
+ */
+
+ // ----------------------------------------------------------------------
+ // Unconditional part = must be present in signal. First 8 words
+ // ----------------------------------------------------------------------
+ Uint32 apiConnectPtr; // DATA 0
+ union {
+ Uint32 senderData;
+ UintR apiOperationPtr; // DATA 1
+ };
+ /**
+ * ATTRIBUTE INFO (attrinfo) LENGTH
+ * This is the total length of all attribute info that is sent from
+ * the application as part of this operation.
+ * It includes all attribute info sent in possible attrinfo
+ * signals as well as the attribute info sent in TCKEYREQ.
+ */
+ UintR attrLen; // DATA 2 (also stores API Version)
+ UintR tableId; // DATA 3
+ UintR requestInfo; // DATA 4 Various transaction flags
+ UintR tableSchemaVersion; // DATA 5
+ UintR transId1; // DATA 6
+ UintR transId2; // DATA 7
+
+ // ----------------------------------------------------------------------
+ // Conditional part = can be present in signal.
+ // These four words will be sent only if their indicator is set.
+ // ----------------------------------------------------------------------
+ UintR scanInfo; // DATA 8 Various flags for scans
+ UintR distrGroupHashValue; // DATA 9
+ UintR distributionKeySize; // DATA 10
+ UintR storedProcId; // DATA 11
+
+ // ----------------------------------------------------------------------
+ // Variable sized KEY and ATTRINFO part.
+ // These will be placed to pack the signal in an appropriate manner.
+ // ----------------------------------------------------------------------
+ UintR keyInfo[MaxKeyInfo]; // DATA 12 - 19
+ UintR attrInfo[MaxAttrInfo]; // DATA 20 - 24
+
+ /**
+ * Get:ers for attrLen
+ */
+
+ static Uint16 getAPIVersion(const UintR & attrLen);
+ static Uint16 getAttrinfoLen(const UintR & attrLen);
+ static void setAPIVersion(UintR & attrLen, Uint16 apiVersion);
+ static void setAttrinfoLen(UintR & attrLen, Uint16 aiLen);
+
+
+ /**
+ * Get:ers for requestInfo
+ */
+ static Uint8 getCommitFlag(const UintR & requestInfo);
+ static Uint8 getAbortOption(const UintR & requestInfo);
+ static Uint8 getStartFlag(const UintR & requestInfo);
+ static Uint8 getSimpleFlag(const UintR & requestInfo);
+ static Uint8 getDirtyFlag(const UintR & requestInfo);
+ static Uint8 getInterpretedFlag(const UintR & requestInfo);
+ static Uint8 getDistributionGroupFlag(const UintR & requestInfo);
+ static Uint8 getDistributionGroupTypeFlag(const UintR & requestInfo);
+ static Uint8 getDistributionKeyFlag(const UintR & requestInfo);
+ static Uint8 getScanIndFlag(const UintR & requestInfo);
+ static Uint8 getOperationType(const UintR & requestInfo);
+ static Uint8 getExecuteFlag(const UintR & requestInfo);
+
+ static Uint16 getKeyLength(const UintR & requestInfo);
+ static Uint8 getAIInTcKeyReq(const UintR & requestInfo);
+ static Uint8 getExecutingTrigger(const UintR & requestInfo);
+
+ /**
+ * Get:ers for scanInfo
+ */
+ static Uint8 getTakeOverScanFlag(const UintR & scanInfo);
+ static Uint16 getTakeOverScanNode(const UintR & scanInfo);
+ static Uint16 getTakeOverScanInfo(const UintR & scanInfo);
+
+
+ /**
+ * Set:ers for requestInfo
+ */
+ static void clearRequestInfo(UintR & requestInfo);
+ static void setAbortOption(UintR & requestInfo, Uint32 type);
+ static void setCommitFlag(UintR & requestInfo, Uint32 flag);
+ static void setStartFlag(UintR & requestInfo, Uint32 flag);
+ static void setSimpleFlag(UintR & requestInfo, Uint32 flag);
+ static void setDirtyFlag(UintR & requestInfo, Uint32 flag);
+ static void setInterpretedFlag(UintR & requestInfo, Uint32 flag);
+ static void setDistributionGroupFlag(UintR & requestInfo, Uint32 flag);
+ static void setDistributionGroupTypeFlag(UintR & requestInfo, Uint32 flag);
+ static void setDistributionKeyFlag(UintR & requestInfo, Uint32 flag);
+ static void setScanIndFlag(UintR & requestInfo, Uint32 flag);
+ static void setExecuteFlag(UintR & requestInfo, Uint32 flag);
+ static void setOperationType(UintR & requestInfo, Uint32 type);
+
+ static void setKeyLength(UintR & requestInfo, Uint32 len);
+ static void setAIInTcKeyReq(UintR & requestInfo, Uint32 len);
+ static void setExecutingTrigger(UintR & requestInfo, Uint32 flag);
+
+ /**
+ * Set:ers for scanInfo
+ */
+ static void setTakeOverScanFlag(UintR & scanInfo, Uint8 flag);
+ static void setTakeOverScanNode(UintR & scanInfo, Uint16 node);
+ static void setTakeOverScanInfo(UintR & scanInfo, Uint16 aScanInfo);
+};
+
+/**
+ * Request Info
+ *
+ a = Attr Info in TCKEYREQ - 3 Bits -> Max 7 (Bit 16-18)
+ b = Distribution Key Ind - 1 Bit 2
+ c = Commit Indicator - 1 Bit 4
+ d = Dirty Indicator - 1 Bit 0
+ e = Scan Indicator - 1 Bit 14
+ f = Execute fired trigger - 1 Bit 19
+ g = Distribution Group Ind- 1 Bit 1
+ i = Interpreted Indicator - 1 Bit 15
+ k = Key length - 12 Bits -> Max 4095 (Bit 20 - 31)
+ o = Operation Type - 3 Bits -> Max 7 (Bit 5-7)
+ l = Execute - 1 Bit 10
+ p = Simple Indicator - 1 Bit 8
+ s = Start Indicator - 1 Bit 11
+ t = Distribution GroupType- 1 Bit 3
+ y = Commit Type - 2 Bit 12-13
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+ dgbtcooop lsyyeiaaafkkkkkkkkkkkk
+*/
+
+#define COMMIT_SHIFT (4)
+#define START_SHIFT (11)
+#define SIMPLE_SHIFT (8)
+#define DIRTY_SHIFT (0)
+#define EXECUTE_SHIFT (10)
+#define INTERPRETED_SHIFT (15)
+#define DISTR_GROUP_SHIFT (1)
+#define DISTR_GROUP_TYPE_SHIFT (3)
+#define DISTR_KEY_SHIFT (2)
+#define SCAN_SHIFT (14)
+
+#define OPERATION_SHIFT (5)
+#define OPERATION_MASK (7)
+
+#define AINFO_SHIFT (16)
+#define AINFO_MASK (7)
+
+#define KEY_LEN_SHIFT (20)
+#define KEY_LEN_MASK (4095)
+
+#define COMMIT_TYPE_SHIFT (12)
+#define COMMIT_TYPE_MASK (3)
+
+#define EXECUTING_TRIGGER_SHIFT (19)
+
+/**
+ * Scan Info
+ *
+ t = Scan take over indicator - 1 Bit
+ n = Take over node - 16 Bits -> max 65535
+ p = Scan Info - 12 Bits -> max 4095
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+ tpppppppppppp nnnnnnnnnnnnnnnn
+*/
+
+#define TAKE_OVER_SHIFT (0)
+
+#define TAKE_OVER_NODE_SHIFT (16)
+#define TAKE_OVER_NODE_MASK (65535)
+
+#define SCAN_INFO_SHIFT (1)
+#define SCAN_INFO_MASK (4095)
+
+/**
+ * Attr Len
+ *
+ n = Attrinfo length(words) - 16 Bits -> max 65535
+ a = API version no - 16 Bits -> max 65535
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+ aaaaaaaaaaaaaaaannnnnnnnnnnnnnnn
+*/
+
+#define API_VER_NO_SHIFT (16)
+#define API_VER_NO_MASK (65535)
+
+#define ATTRLEN_SHIFT (0)
+#define ATTRLEN_MASK (65535)
+
+inline
+Uint8
+TcKeyReq::getCommitFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> COMMIT_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcKeyReq::getAbortOption(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> COMMIT_TYPE_SHIFT) & COMMIT_TYPE_MASK);
+}
+
+inline
+Uint8
+TcKeyReq::getStartFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> START_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcKeyReq::getSimpleFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> SIMPLE_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcKeyReq::getExecuteFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> EXECUTE_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcKeyReq::getDirtyFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> DIRTY_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcKeyReq::getInterpretedFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> INTERPRETED_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcKeyReq::getDistributionGroupFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> DISTR_GROUP_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcKeyReq::getDistributionGroupTypeFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> DISTR_GROUP_TYPE_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcKeyReq::getDistributionKeyFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> DISTR_KEY_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcKeyReq::getScanIndFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> SCAN_SHIFT) & 1);
+}
+
+inline
+Uint8
+TcKeyReq::getOperationType(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> OPERATION_SHIFT) & OPERATION_MASK);
+}
+
+inline
+Uint16
+TcKeyReq::getKeyLength(const UintR & requestInfo){
+ return (Uint16)((requestInfo >> KEY_LEN_SHIFT) & KEY_LEN_MASK);
+}
+
+inline
+Uint8
+TcKeyReq::getAIInTcKeyReq(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> AINFO_SHIFT) & AINFO_MASK);
+}
+
+inline
+Uint8
+TcKeyReq::getExecutingTrigger(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> EXECUTING_TRIGGER_SHIFT) & 1);
+}
+
+inline
+void
+TcKeyReq::clearRequestInfo(UintR & requestInfo){
+ requestInfo = 0;
+}
+
+inline
+void
+TcKeyReq::setAbortOption(UintR & requestInfo, Uint32 type){
+ ASSERT_MAX(type, COMMIT_TYPE_MASK, "TcKeyReq::setAbortOption");
+ requestInfo &= ~(COMMIT_TYPE_MASK << COMMIT_TYPE_SHIFT);
+ requestInfo |= (type << COMMIT_TYPE_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setCommitFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcKeyReq::setCommitFlag");
+ requestInfo &= ~(1 << COMMIT_SHIFT);
+ requestInfo |= (flag << COMMIT_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setStartFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcKeyReq::setStartFlag");
+ requestInfo &= ~(1 << START_SHIFT);
+ requestInfo |= (flag << START_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setSimpleFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcKeyReq::setSimpleFlag");
+ requestInfo &= ~(1 << SIMPLE_SHIFT);
+ requestInfo |= (flag << SIMPLE_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setDirtyFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcKeyReq::setDirstFlag");
+ requestInfo &= ~(1 << DIRTY_SHIFT);
+ requestInfo |= (flag << DIRTY_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setExecuteFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcKeyReq::setExecuteFlag");
+ requestInfo &= ~(1 << EXECUTE_SHIFT);
+ requestInfo |= (flag << EXECUTE_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setInterpretedFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcKeyReq::setInterpretedFlag");
+ requestInfo &= ~(1 << INTERPRETED_SHIFT);
+ requestInfo |= (flag << INTERPRETED_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setDistributionGroupTypeFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcKeyReq::setDistributionGroupTypeFlag");
+ requestInfo &= ~(1 << DISTR_GROUP_TYPE_SHIFT);
+ requestInfo |= (flag << DISTR_GROUP_TYPE_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setDistributionGroupFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcKeyReq::setDistributionGroupFlag");
+ requestInfo &= ~(1 << DISTR_GROUP_SHIFT);
+ requestInfo |= (flag << DISTR_GROUP_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setDistributionKeyFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcKeyReq::setDistributionKeyFlag");
+ requestInfo &= ~(1 << DISTR_KEY_SHIFT);
+ requestInfo |= (flag << DISTR_KEY_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setScanIndFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcKeyReq::setScanIndFlag");
+ requestInfo &= ~(1 << SCAN_SHIFT);
+ requestInfo |= (flag << SCAN_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setOperationType(UintR & requestInfo, Uint32 type){
+ ASSERT_MAX(type, OPERATION_MASK, "TcKeyReq::setOperationType");
+ requestInfo &= ~(OPERATION_MASK << OPERATION_SHIFT);
+ requestInfo |= (type << OPERATION_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setKeyLength(UintR & requestInfo, Uint32 len){
+ ASSERT_MAX(len, KEY_LEN_MASK, "TcKeyReq::setKeyLength");
+ requestInfo &= ~(KEY_LEN_MASK << KEY_LEN_SHIFT);
+ requestInfo |= (len << KEY_LEN_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setAIInTcKeyReq(UintR & requestInfo, Uint32 len){
+ ASSERT_MAX(len, AINFO_MASK, "TcKeyReq::setAIInTcKeyReq");
+ requestInfo &= ~(AINFO_MASK << AINFO_SHIFT);
+ requestInfo |= (len << AINFO_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setExecutingTrigger(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "TcKeyReq::setExecutingTrigger");
+ requestInfo &= ~(1 << EXECUTING_TRIGGER_SHIFT);
+ requestInfo |= (flag << EXECUTING_TRIGGER_SHIFT);
+}
+
+inline
+Uint8
+TcKeyReq::getTakeOverScanFlag(const UintR & scanInfo){
+ return (Uint8)((scanInfo >> TAKE_OVER_SHIFT) & 1);
+}
+
+inline
+Uint16
+TcKeyReq::getTakeOverScanNode(const UintR & scanInfo){
+ return (Uint16)((scanInfo >> TAKE_OVER_NODE_SHIFT) & TAKE_OVER_NODE_MASK);
+}
+
+inline
+Uint16
+TcKeyReq::getTakeOverScanInfo(const UintR & scanInfo){
+ return (Uint16)((scanInfo >> SCAN_INFO_SHIFT) & SCAN_INFO_MASK);
+}
+
+
+inline
+void
+TcKeyReq::setTakeOverScanFlag(UintR & scanInfo, Uint8 flag){
+ ASSERT_BOOL(flag, "TcKeyReq::setTakeOverScanFlag");
+ scanInfo |= (flag << TAKE_OVER_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setTakeOverScanNode(UintR & scanInfo, Uint16 node){
+// ASSERT_MAX(node, TAKE_OVER_NODE_MASK, "TcKeyReq::setTakeOverScanNode");
+ scanInfo |= (node << TAKE_OVER_NODE_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setTakeOverScanInfo(UintR & scanInfo, Uint16 aScanInfo){
+// ASSERT_MAX(aScanInfo, SCAN_INFO_MASK, "TcKeyReq::setTakeOverScanInfo");
+ scanInfo |= (aScanInfo << SCAN_INFO_SHIFT);
+}
+
+
+inline
+Uint16
+TcKeyReq::getAPIVersion(const UintR & anAttrLen){
+ return (Uint16)((anAttrLen >> API_VER_NO_SHIFT) & API_VER_NO_MASK);
+}
+
+inline
+void
+TcKeyReq::setAPIVersion(UintR & anAttrLen, Uint16 apiVersion){
+// ASSERT_MAX(apiVersion, API_VER_NO_MASK, "TcKeyReq::setAPIVersion");
+ anAttrLen |= (apiVersion << API_VER_NO_SHIFT);
+}
+
+inline
+Uint16
+TcKeyReq::getAttrinfoLen(const UintR & anAttrLen){
+ return (Uint16)((anAttrLen) & ATTRLEN_MASK);
+}
+
+inline
+void
+TcKeyReq::setAttrinfoLen(UintR & anAttrLen, Uint16 aiLen){
+// ASSERT_MAX(aiLen, ATTRLEN_MASK, "TcKeyReq::setAttrinfoLen");
+ anAttrLen |= aiLen;
+}
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TcRollbackRep.hpp b/ndb/include/kernel/signaldata/TcRollbackRep.hpp
new file mode 100644
index 00000000000..b00731a04a6
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TcRollbackRep.hpp
@@ -0,0 +1,50 @@
+/* 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 TCROLLBACKREP_HPP
+#define TCROLLBACKREP_HPP
+
+#include "SignalData.hpp"
+
+class TcRollbackRep {
+ /**
+ * Sender(s)
+ */
+ friend class NdbConnection;
+ friend class DbUtil;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbtup;
+
+ /**
+ * Sender(s) / Receiver(s)
+ */
+ friend class Dbtc;
+
+ friend bool printTCROLBACKREP(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 connectPtr;
+ Uint32 transId[2];
+ Uint32 returnCode;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TcSizeAltReq.hpp b/ndb/include/kernel/signaldata/TcSizeAltReq.hpp
new file mode 100644
index 00000000000..34eacfe5a93
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TcSizeAltReq.hpp
@@ -0,0 +1,52 @@
+/* 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 TC_SIZE_ALT_REQ_H
+#define TC_SIZE_ALT_REQ_H
+
+
+
+#include "SignalData.hpp"
+
+class TcSizeAltReq {
+ /**
+ * Sender(s)
+ */
+ friend class ClusterConfiguration;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc;
+private:
+ /**
+ * Indexes in theData
+ */
+ STATIC_CONST( IND_BLOCK_REF = 0 );
+ STATIC_CONST( IND_API_CONNECT = 1 );
+ STATIC_CONST( IND_TC_CONNECT = 2 );
+ STATIC_CONST( IND_UNUSED = 3 );
+ STATIC_CONST( IND_TABLE = 4 );
+ STATIC_CONST( IND_TC_SCAN = 5 );
+ STATIC_CONST( IND_LOCAL_SCAN = 6 );
+
+ /**
+ * Use the index definitions to use the signal data
+ */
+ UintR theData[7];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TestOrd.hpp b/ndb/include/kernel/signaldata/TestOrd.hpp
new file mode 100644
index 00000000000..1600df08884
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TestOrd.hpp
@@ -0,0 +1,229 @@
+/* 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 TEST_ORD_H
+#define TEST_ORD_H
+
+#include "SignalData.hpp"
+
+/**
+ * Send by API to preform TEST ON / TEST OFF
+ *
+ * SENDER: API
+ * RECIVER: SimBlockCMCtrBlck
+ */
+class TestOrd {
+ friend class Ndb;
+ friend class Cmvmi;
+ friend class MgmtSrvr;
+public:
+
+ enum Command {
+ KeepUnchanged = 0,
+ On = 1,
+ Off = 2,
+ Toggle = 3,
+ COMMAND_MASK = 3
+ };
+
+ enum SignalLoggerSpecification {
+ InputSignals = 1,
+ OutputSignals = 2,
+ InputOutputSignals = 3,
+ LOG_MASK = 3
+ };
+
+ enum TraceSpecification {
+ TraceALL = 0,
+ TraceAPI = 1,
+ TraceGlobalCheckpoint = 2,
+ TraceLocalCheckpoint = 4,
+ TraceDisconnect = 8,
+ TRACE_MASK = 15
+ };
+
+private:
+ STATIC_CONST( SignalLength = 25 );
+
+ /**
+ * Clear Signal
+ */
+ void clear();
+
+ /**
+ * Set/Get test command
+ */
+ void setTestCommand(Command);
+ void getTestCommand(Command&) const;
+
+ /**
+ * Set trace command
+ */
+ void setTraceCommand(Command, TraceSpecification);
+
+ /**
+ * Get trace command
+ */
+ void getTraceCommand(Command&, TraceSpecification&) const;
+
+ /**
+ * Return no of signal logger commands
+ *
+ * -1 Means apply command(0) to all blocks
+ *
+ */
+ UintR getNoOfSignalLoggerCommands() const;
+
+ /**
+ * Add a signal logger command to a specific block
+ */
+ void addSignalLoggerCommand(BlockNumber, Command, SignalLoggerSpecification);
+
+ /**
+ * Add a signal logger command to all blocks
+ *
+ * Note removes all previously added commands
+ *
+ */
+ void addSignalLoggerCommand(Command, SignalLoggerSpecification);
+
+ /**
+ * Get Signal logger command
+ */
+ void getSignalLoggerCommand(int no, BlockNumber&, Command&, SignalLoggerSpecification&) const;
+
+ UintR testCommand; // DATA 0
+ UintR traceCommand; // DATA 1
+ UintR noOfSignalLoggerCommands; // DATA 2
+ UintR signalLoggerCommands[22]; // DATA 3 - 25
+};
+
+#define COMMAND_SHIFT (0)
+#define TRACE_SHIFT (2)
+#define LOG_SHIFT (2)
+
+#define BLOCK_NO_SHIFT (16)
+#define BLOCK_NO_MASK 65535
+
+/**
+ * Clear Signal
+ */
+inline
+void
+TestOrd::clear(){
+ setTestCommand(KeepUnchanged);
+ setTraceCommand(KeepUnchanged, TraceAPI); //
+ noOfSignalLoggerCommands = 0;
+}
+
+/**
+ * Set/Get test command
+ */
+inline
+void
+TestOrd::setTestCommand(Command cmd){
+ ASSERT_RANGE(cmd, 0, COMMAND_MASK, "TestOrd::setTestCommand");
+ testCommand = cmd;
+}
+
+inline
+void
+TestOrd::getTestCommand(Command & cmd) const{
+ cmd = (Command)(testCommand >> COMMAND_SHIFT);
+}
+
+/**
+ * Set trace command
+ */
+inline
+void
+TestOrd::setTraceCommand(Command cmd, TraceSpecification spec){
+ ASSERT_RANGE(cmd, 0, COMMAND_MASK, "TestOrd::setTraceCommand");
+ ASSERT_RANGE(spec, 0, TRACE_MASK, "TestOrd::setTraceCommand");
+ traceCommand = (cmd << COMMAND_SHIFT) | (spec << TRACE_SHIFT);
+}
+
+/**
+ * Get trace command
+ */
+inline
+void
+TestOrd::getTraceCommand(Command & cmd, TraceSpecification & spec) const{
+ cmd = (Command)((traceCommand >> COMMAND_SHIFT) & COMMAND_MASK);
+ spec = (TraceSpecification)((traceCommand >> TRACE_SHIFT) & TRACE_MASK);
+}
+
+/**
+ * Return no of signal logger commands
+ *
+ * -1 Means apply command(0) to all blocks
+ *
+ */
+inline
+UintR
+TestOrd::getNoOfSignalLoggerCommands() const{
+ return noOfSignalLoggerCommands;
+}
+
+/**
+ * Add a signal logger command to a specific block
+ */
+inline
+void
+TestOrd::addSignalLoggerCommand(BlockNumber bnr,
+ Command cmd, SignalLoggerSpecification spec){
+ ASSERT_RANGE(cmd, 0, COMMAND_MASK, "TestOrd::addSignalLoggerCommand");
+ ASSERT_RANGE(spec, 0, LOG_MASK, "TestOrd::addSignalLoggerCommand");
+ //ASSERT_MAX(bnr, BLOCK_NO_MASK, "TestOrd::addSignalLoggerCommand");
+
+ signalLoggerCommands[noOfSignalLoggerCommands] =
+ (bnr << BLOCK_NO_SHIFT) | (cmd << COMMAND_SHIFT) | (spec << LOG_SHIFT);
+ noOfSignalLoggerCommands ++;
+}
+
+/**
+ * Add a signal logger command to all blocks
+ *
+ * Note removes all previously added commands
+ *
+ */
+inline
+void
+TestOrd::addSignalLoggerCommand(Command cmd, SignalLoggerSpecification spec){
+ ASSERT_RANGE(cmd, 0, COMMAND_MASK, "TestOrd::addSignalLoggerCommand");
+ ASSERT_RANGE(spec, 0, LOG_MASK, "TestOrd::addSignalLoggerCommand");
+
+ noOfSignalLoggerCommands = ~0;
+ signalLoggerCommands[0] = (cmd << COMMAND_SHIFT) | (spec << LOG_SHIFT);
+}
+
+/**
+ * Get Signal logger command
+ */
+inline
+void
+TestOrd::getSignalLoggerCommand(int no, BlockNumber & bnr,
+ Command & cmd,
+ SignalLoggerSpecification & spec) const{
+ bnr = (BlockNumber)((signalLoggerCommands[no] >> BLOCK_NO_SHIFT)
+ & BLOCK_NO_MASK);
+ cmd = (Command)((signalLoggerCommands[no] >> COMMAND_SHIFT)
+ & COMMAND_MASK);
+ spec = (SignalLoggerSpecification)((signalLoggerCommands[no] >> LOG_SHIFT)
+ & LOG_MASK);
+}
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TransIdAI.hpp b/ndb/include/kernel/signaldata/TransIdAI.hpp
new file mode 100755
index 00000000000..4df7bf2a126
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TransIdAI.hpp
@@ -0,0 +1,59 @@
+/* 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 TRANSID_AI_HPP
+#define TRANSID_AI_HPP
+
+#include "SignalData.hpp"
+
+class TransIdAI {
+ /**
+ * Sender(s)
+ */
+ friend class Dbtup;
+
+ /**
+ * Receiver(s)
+ */
+ friend class NdbConnection;
+ friend class Dbtc;
+ friend class Dbutil;
+ friend class Dblqh;
+ friend class Suma;
+
+ friend bool printTRANSID_AI(FILE *, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( HeaderLength = 3 );
+ STATIC_CONST( DataLength = 22 );
+
+ // Public methods
+public:
+ Uint32* getData() const;
+
+public:
+ Uint32 connectPtr;
+ Uint32 transId[2];
+ Uint32 attrData[DataLength];
+};
+
+inline
+Uint32* TransIdAI::getData() const
+{
+ return (Uint32*)&attrData[0];
+}
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TrigAttrInfo.hpp b/ndb/include/kernel/signaldata/TrigAttrInfo.hpp
new file mode 100644
index 00000000000..e2c029b9033
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TrigAttrInfo.hpp
@@ -0,0 +1,138 @@
+/* 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 TRIG_ATTRINFO_HPP
+#define TRIG_ATTRINFO_HPP
+
+#include "SignalData.hpp"
+#include <NodeBitmask.hpp>
+#include <trigger_definitions.h>
+#include <string.h>
+
+/**
+ * TrigAttrInfo
+ *
+ * This signal is sent by TUP to signal
+ * that a trigger has fired
+ */
+class TrigAttrInfo {
+ /**
+ * Sender(s)
+ */
+ // API
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbtup;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtc;
+ friend class Backup;
+ friend class SumaParticipant;
+
+ /**
+ * For printing
+ */
+ friend bool printTRIG_ATTRINFO(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+enum AttrInfoType {
+ PRIMARY_KEY = 0,
+ BEFORE_VALUES = 1,
+ AFTER_VALUES = 2
+};
+
+ STATIC_CONST( DataLength = 22 );
+ STATIC_CONST( StaticLength = 3 );
+
+private:
+ Uint32 m_connectionPtr;
+ Uint32 m_trigId;
+ Uint32 m_type;
+ Uint32 m_data[DataLength];
+
+ // Public methods
+public:
+ Uint32 getConnectionPtr() const;
+ void setConnectionPtr(Uint32);
+ AttrInfoType getAttrInfoType() const;
+ void setAttrInfoType(AttrInfoType anAttrType);
+ Uint32 getTriggerId() const;
+ void setTriggerId(Uint32 aTriggerId);
+ Uint32 getTransactionId1() const;
+ void setTransactionId1(Uint32 aTransId);
+ Uint32 getTransactionId2() const;
+ void setTransactionId2(Uint32 aTransId);
+ Uint32* getData() const;
+ int setData(Uint32* aDataBuf, Uint32 aDataLen);
+};
+
+inline
+Uint32 TrigAttrInfo::getConnectionPtr() const
+{
+ return m_connectionPtr;
+}
+
+inline
+void TrigAttrInfo::setConnectionPtr(Uint32 aConnectionPtr)
+{
+ m_connectionPtr = aConnectionPtr;
+}
+
+inline
+TrigAttrInfo::AttrInfoType TrigAttrInfo::getAttrInfoType() const
+{
+ return (TrigAttrInfo::AttrInfoType) m_type;
+}
+
+inline
+void TrigAttrInfo::setAttrInfoType(TrigAttrInfo::AttrInfoType anAttrType)
+{
+ m_type = (Uint32) anAttrType;
+}
+
+inline
+Uint32 TrigAttrInfo::getTriggerId() const
+{
+ return m_trigId;
+}
+
+inline
+void TrigAttrInfo::setTriggerId(Uint32 aTriggerId)
+{
+ m_trigId = aTriggerId;
+}
+
+inline
+Uint32* TrigAttrInfo::getData() const
+{
+ return (Uint32*)&m_data[0];
+}
+
+inline
+int TrigAttrInfo::setData(Uint32* aDataBuf, Uint32 aDataLen)
+{
+ if (aDataLen > DataLength)
+ return -1;
+ memcpy(m_data, aDataBuf, aDataLen*sizeof(Uint32));
+
+ return 0;
+}
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TupAccess.hpp b/ndb/include/kernel/signaldata/TupAccess.hpp
new file mode 100644
index 00000000000..5cfb8c0d153
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TupAccess.hpp
@@ -0,0 +1,172 @@
+/* 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 TUP_ACCESS_HPP
+#define TUP_ACCESS_HPP
+
+#include "SignalData.hpp"
+
+/*
+ * Direct signals used by ACC and TUX to access the TUP block in the
+ * same thread.
+ *
+ * NOTE: Caller must set errorCode to RNIL. Signal printer uses this to
+ * distinguish between input and output (no better way exists).
+ */
+
+/*
+ * Read attributes from any table.
+ */
+class TupReadAttrs {
+ friend class Dbtup;
+ friend class Dbacc;
+ friend class Dbtux;
+ friend bool printTUP_READ_ATTRS(FILE*, const Uint32*, Uint32, Uint16);
+public:
+ enum Flag {
+ /*
+ * Read primary key attributes. No input attribute ids are
+ * specified. Instead TUP fills in both input and output sections.
+ * Tuple version is not used.
+ */
+ ReadKeys = (1 << 0)
+ };
+ STATIC_CONST( SignalLength = 10 );
+private:
+ /*
+ * Error code set by TUP. Zero means no error.
+ */
+ Uint32 errorCode;
+ /*
+ * Request info contains flags (see Flags above).
+ */
+ Uint32 requestInfo;
+ /*
+ * Table i-value.
+ */
+ Uint32 tableId;
+ /*
+ * Fragment is given by logical id within the table or by direct
+ * i-value (faster). Unknown values are given as RNIL. On return TUP
+ * fills in both values.
+ */
+ Uint32 fragId;
+ Uint32 fragPtrI;
+ /*
+ * Logical address ("local key") of "original" tuple (the latest
+ * version) consisting of logical fragment page id and tuple index
+ * within the page (shifted left by 1).
+ */
+ Uint32 tupAddr;
+ /*
+ * Version of the tuple to read. Not used if ReadKeys.
+ */
+ Uint32 tupVersion;
+ /*
+ * Real page id and offset of the "original" tuple. Unknown page is
+ * given as RNIL. On return TUP fills in these.
+ */
+ Uint32 pageId;
+ Uint32 pageOffset;
+ /*
+ * Shared buffer id. Currently must be 0 which means to use rest of
+ * signal data.
+ */
+ Uint32 bufferId;
+ /*
+ * Shared buffer 0 starts after signal class. Input is number of
+ * attributes and list of attribute ids in AttributeHeader format.
+ * Output is placed after the input and consists of a list of entries
+ * where each entry has an AttributeHeader followed by words of data.
+ */
+};
+
+/*
+ * Query status of tuple version. Used by TUX to decide if a tuple
+ * version found in index tree is visible to the transaction.
+ */
+class TupQueryTh {
+ friend class Dbtup;
+ friend class Dbtux;
+ friend bool printTUP_QUERY_TH(FILE*, const Uint32*, Uint32, Uint16);
+public:
+ enum Flag {
+ };
+ STATIC_CONST( SignalLength = 7 );
+private:
+ /*
+ TUX wants to check if tuple is visible to the scan query.
+ Input data is tuple address (tableId, fragId, tupAddr, tupVersion),
+ and transaction data so that TUP knows how to deduct if tuple is
+ visible (transId1, transId2, savePointId).
+ returnCode is set in return signal to indicate whether tuple is visible.
+ */
+ union {
+ Uint32 returnCode; // 1 if tuple visible
+ Uint32 tableId;
+ };
+ Uint32 fragId;
+ Uint32 tupAddr;
+ Uint32 tupVersion;
+ Uint32 transId1;
+ Uint32 transId2;
+ Uint32 savePointId;
+};
+
+/*
+ * Operate on entire tuple. Used by TUX where the table has a single
+ * Uint32 array attribute representing an index tree node.
+ */
+class TupStoreTh {
+ friend class Dbtup;
+ friend class Dbtux;
+ friend bool printTUP_STORE_TH(FILE*, const Uint32*, Uint32, Uint16);
+public:
+ enum OpCode {
+ OpUndefined = 0,
+ OpRead = 1,
+ OpInsert = 2,
+ OpUpdate = 3,
+ OpDelete = 4
+ };
+ STATIC_CONST( SignalLength = 12 );
+private:
+ /*
+ * These are as in TupReadAttrs (except opCode). Version must be
+ * zero. Ordered index tuple (tree node) has only current version.
+ */
+ Uint32 errorCode;
+ Uint32 opCode;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 fragPtrI;
+ Uint32 tupAddr;
+ Uint32 tupVersion;
+ Uint32 pageId;
+ Uint32 pageOffset;
+ Uint32 bufferId;
+ /*
+ * Data offset and size in words. Applies to both the buffer and the
+ * tuple. Used e.g. to read only node header.
+ */
+ Uint32 dataOffset;
+ Uint32 dataSize;
+ /*
+ * Shared buffer 0 starts after signal class.
+ */
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TupCommit.hpp b/ndb/include/kernel/signaldata/TupCommit.hpp
new file mode 100644
index 00000000000..7c5a7931e6c
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TupCommit.hpp
@@ -0,0 +1,51 @@
+/* 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 TUP_COMMIT_H
+#define TUP_COMMIT_H
+
+#include "SignalData.hpp"
+
+class TupCommitReq {
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtup;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * For printing
+ */
+ friend bool printTUPCOMMITREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+ Uint32 opPtr;
+ Uint32 gci;
+ Uint32 hashValue;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TupFrag.hpp b/ndb/include/kernel/signaldata/TupFrag.hpp
new file mode 100644
index 00000000000..ffde2217893
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TupFrag.hpp
@@ -0,0 +1,188 @@
+/* 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 TUP_FRAG_HPP
+#define TUP_FRAG_HPP
+
+#include "SignalData.hpp"
+
+/*
+ * Add fragment and add attribute signals between LQH and TUP,TUX.
+ * NOTE: return signals from TUP,TUX to LQH must have same format.
+ */
+
+// TUP: add fragment
+
+class TupFragReq {
+ friend class Dblqh;
+ friend class Dbtup;
+public:
+ STATIC_CONST( SignalLength = 14 );
+private:
+ Uint32 userPtr;
+ Uint32 userRef;
+ Uint32 reqInfo;
+ Uint32 tableId;
+ Uint32 noOfAttr;
+ Uint32 fragId;
+ Uint32 todo[8];
+};
+
+class TupFragConf {
+ friend class Dblqh;
+ friend class Dbtup;
+public:
+ STATIC_CONST( SignalLength = 4 );
+private:
+ Uint32 userPtr;
+ Uint32 tupConnectPtr;
+ Uint32 fragPtr;
+ Uint32 fragId;
+};
+
+class TupFragRef {
+ friend class Dblqh;
+ friend class Dbtup;
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+ Uint32 userPtr;
+ Uint32 errorCode;
+};
+
+// TUX: add fragment
+
+class TuxFragReq {
+ friend class Dblqh;
+ friend class Dbtux;
+public:
+ STATIC_CONST( SignalLength = 9 );
+private:
+ Uint32 userPtr;
+ Uint32 userRef;
+ Uint32 reqInfo;
+ Uint32 tableId;
+ Uint32 noOfAttr;
+ Uint32 fragId;
+ Uint32 fragOff;
+ Uint32 tableType;
+ Uint32 primaryTableId;
+};
+
+class TuxFragConf {
+ friend class Dblqh;
+ friend class Dbtux;
+public:
+ STATIC_CONST( SignalLength = 4 );
+private:
+ Uint32 userPtr;
+ Uint32 tuxConnectPtr;
+ Uint32 fragPtr;
+ Uint32 fragId;
+};
+
+class TuxFragRef {
+ friend class Dblqh;
+ friend class Dbtux;
+public:
+ STATIC_CONST( SignalLength = 2 );
+ enum ErrorCode {
+ NoError = 0,
+ InvalidRequest = 800,
+ NoFreeFragmentOper = 830,
+ NoFreeIndexFragment = 852,
+ NoFreeFragment = 604,
+ NoFreeAttributes = 827
+ };
+private:
+ Uint32 userPtr;
+ Uint32 errorCode;
+};
+
+// TUP: add attribute
+
+class TupAddAttrReq {
+ friend class Dblqh;
+ friend class Dbtux;
+public:
+ STATIC_CONST( SignalLength = 4 );
+private:
+ Uint32 tupConnectPtr;
+ Uint32 notused1;
+ Uint32 attrId;
+ Uint32 attrDescriptor;
+};
+
+class TupAddAttrConf {
+ friend class Dblqh;
+ friend class Dbtup;
+public:
+ STATIC_CONST( SignalLength = 1 );
+private:
+ Uint32 userPtr;
+};
+
+class TupAddAttrRef {
+ friend class Dblqh;
+ friend class Dbtup;
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+ Uint32 userPtr;
+ Uint32 errorCode;
+};
+
+// TUX: add attribute
+
+class TuxAddAttrReq {
+ friend class Dblqh;
+ friend class Dbtux;
+public:
+ STATIC_CONST( SignalLength = 6 );
+private:
+ Uint32 tuxConnectPtr;
+ Uint32 notused1;
+ Uint32 attrId;
+ Uint32 attrDescriptor;
+ Uint32 extTypeInfo;
+ Uint32 primaryAttrId;
+};
+
+class TuxAddAttrConf {
+ friend class Dblqh;
+ friend class Dbtux;
+public:
+ STATIC_CONST( SignalLength = 1 );
+private:
+ Uint32 userPtr;
+};
+
+class TuxAddAttrRef {
+ friend class Dblqh;
+ friend class Dbtux;
+public:
+ STATIC_CONST( SignalLength = 2 );
+ enum ErrorCode {
+ NoError = 0,
+ InvalidAttributeType = 831,
+ InvalidNodeSize = 832
+ };
+private:
+ Uint32 userPtr;
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TupKey.hpp b/ndb/include/kernel/signaldata/TupKey.hpp
new file mode 100644
index 00000000000..304bebbec88
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TupKey.hpp
@@ -0,0 +1,126 @@
+/* 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 TUP_KEY_H
+#define TUP_KEY_H
+
+#include "SignalData.hpp"
+
+class TupKeyReq {
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtup;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * For printing
+ */
+ friend bool printTUPKEYREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( SignalLength = 18 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+ Uint32 connectPtr;
+ Uint32 request;
+ Uint32 tableRef;
+ Uint32 fragId;
+ Uint32 keyRef1;
+ Uint32 keyRef2;
+ Uint32 attrBufLen;
+ Uint32 opRef;
+ Uint32 applRef;
+ Uint32 schemaVersion;
+ Uint32 storedProcedure;
+ Uint32 transId1;
+ Uint32 transId2;
+ Uint32 fragPtr;
+ Uint32 primaryReplica;
+ Uint32 coordinatorTC;
+ Uint32 tcOpIndex;
+ Uint32 savePointId;
+};
+
+class TupKeyConf {
+ /**
+ * Reciver(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dbtup;
+
+ /**
+ * For printing
+ */
+ friend bool printTUPKEYCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( SignalLength = 6 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+ Uint32 userPtr;
+ Uint32 pageId;
+ Uint32 pageIndex;
+ Uint32 readLength;
+ Uint32 writeLength;
+ Uint32 noFiredTriggers;
+};
+
+class TupKeyRef {
+ /**
+ * Reciver(s)
+ */
+ friend class Dblqh;
+
+ /**
+ * Sender(s)
+ */
+ friend class Dbtup;
+
+ /**
+ * For printing
+ */
+ friend bool printTUPKEYREF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+ Uint32 userRef;
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TupSizeAltReq.hpp b/ndb/include/kernel/signaldata/TupSizeAltReq.hpp
new file mode 100644
index 00000000000..215493bc188
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TupSizeAltReq.hpp
@@ -0,0 +1,58 @@
+/* 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 TUP_SIZE_ALT_REQ_H
+#define TUP_SIZE_ALT_REQ_H
+
+
+
+#include "SignalData.hpp"
+
+class TupSizeAltReq {
+ /**
+ * Sender(s)
+ */
+ friend class ClusterConfiguration;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Dbtup;
+private:
+ /**
+ * Indexes in theData
+ */
+ STATIC_CONST( IND_BLOCK_REF = 0 );
+ STATIC_CONST( IND_DISK_PAGE_ARRAY = 1 );
+ STATIC_CONST( IND_DISK_PAGE_REPRESENT = 2 );
+ STATIC_CONST( IND_FRAG = 3 );
+ STATIC_CONST( IND_PAGE_CLUSTER = 4 );
+ STATIC_CONST( IND_LOGIC_PAGE = 5 );
+ STATIC_CONST( IND_OP_RECS = 6 );
+ STATIC_CONST( IND_PAGE = 7 );
+ STATIC_CONST( IND_PAGE_RANGE = 8 );
+ STATIC_CONST( IND_TABLE = 9 );
+ STATIC_CONST( IND_TABLE_DESC = 10 );
+ STATIC_CONST( IND_DELETED_BLOCKS = 11 );
+ STATIC_CONST( IND_STORED_PROC = 12 );
+
+ /**
+ * Use the index definitions to use the signal data
+ */
+ UintR theData[13];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TuxBound.hpp b/ndb/include/kernel/signaldata/TuxBound.hpp
new file mode 100644
index 00000000000..1f256150573
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TuxBound.hpp
@@ -0,0 +1,56 @@
+/* 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 TUX_BOUND_HPP
+#define TUX_BOUND_HPP
+
+#include "SignalData.hpp"
+
+class TuxBoundInfo {
+ friend class Dblqh;
+ friend class Dbtux;
+public:
+ // must match API (0-4 and no changes expected)
+ enum BoundType {
+ BoundLE = 0, // bit 1 for less/greater
+ BoundLT = 1, // bit 0 for strict
+ BoundGE = 2,
+ BoundGT = 3,
+ BoundEQ = 4
+ };
+ enum ErrorCode {
+ InvalidAttrInfo = 4110,
+ InvalidBounds = 4259,
+ OutOfBuffers = 873
+ };
+ STATIC_CONST( SignalLength = 3 );
+private:
+ /*
+ * Error code set by TUX. Zero means no error.
+ */
+ Uint32 errorCode;
+ /*
+ * Pointer (i-value) to scan operation in TUX.
+ */
+ Uint32 tuxScanPtrI;
+ /*
+ * Number of words of bound info included after fixed signal data.
+ * Starts with 5 unused words (word 0 is length used by LQH).
+ */
+ Uint32 boundAiLength;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TuxContinueB.hpp b/ndb/include/kernel/signaldata/TuxContinueB.hpp
new file mode 100644
index 00000000000..385d85715e2
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TuxContinueB.hpp
@@ -0,0 +1,30 @@
+/* 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 TUX_CONTINUEB_H
+#define TUX_CONTINUEB_H
+
+#include "SignalData.hpp"
+
+class TuxContinueB {
+ friend class Dbtux;
+private:
+ enum {
+ DropIndex = 1
+ };
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TuxMaint.hpp b/ndb/include/kernel/signaldata/TuxMaint.hpp
new file mode 100644
index 00000000000..44deb33be80
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TuxMaint.hpp
@@ -0,0 +1,66 @@
+/* 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 TUX_MAINT_HPP
+#define TUX_MAINT_HPP
+
+#include "SignalData.hpp"
+
+/*
+ * Ordered index maintenance operation.
+ */
+
+class TuxMaintReq {
+ friend class Dbtup;
+ friend class Dbtux;
+ friend bool printTUX_MAINT_REQ(FILE*, const Uint32*, Uint32, Uint16);
+public:
+ enum OpCode { // first byte of opInfo
+ OpAdd = 1,
+ OpRemove = 2
+ };
+ enum OpFlag { // second byte of opInfo
+ };
+ enum ErrorCode {
+ NoError = 0, // must be zero
+ SearchError = 895, // add + found or remove + not found
+ NoMemError = 827
+ };
+ STATIC_CONST( SignalLength = 7 );
+private:
+ /*
+ * Error code set by TUX. Zero means no error.
+ */
+ Uint32 errorCode;
+ /*
+ * Table, index, fragment.
+ */
+ Uint32 tableId;
+ Uint32 indexId;
+ Uint32 fragId;
+ /*
+ * Tuple version identified by logical address of "original" tuple and
+ * version number.
+ */
+ Uint32 tupAddr;
+ Uint32 tupVersion;
+ /*
+ * Operation code and flags.
+ */
+ Uint32 opInfo;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/TuxSizeAltReq.hpp b/ndb/include/kernel/signaldata/TuxSizeAltReq.hpp
new file mode 100644
index 00000000000..5d5a0e102ba
--- /dev/null
+++ b/ndb/include/kernel/signaldata/TuxSizeAltReq.hpp
@@ -0,0 +1,48 @@
+/* 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 TUX_SIZE_ALT_REQ_H
+#define TUX_SIZE_ALT_REQ_H
+
+#include "SignalData.hpp"
+
+class TuxSizeAltReq {
+ /**
+ * Sender(s)
+ */
+ friend class ClusterConfiguration;
+
+ /**
+ * Receiver(s)
+ */
+ friend class Dbtux;
+private:
+ /**
+ * Indexes in theData
+ */
+ STATIC_CONST( IND_BLOCK_REF = 0 );
+ STATIC_CONST( IND_INDEX = 1 );
+ STATIC_CONST( IND_FRAGMENT = 2 );
+ STATIC_CONST( IND_ATTRIBUTE = 3 );
+ STATIC_CONST( IND_SCAN = 4 );
+
+ /**
+ * Use the index definitions to use the signal data
+ */
+ UintR theData[4];
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/UpdateTo.hpp b/ndb/include/kernel/signaldata/UpdateTo.hpp
new file mode 100644
index 00000000000..0fa5f31b6b4
--- /dev/null
+++ b/ndb/include/kernel/signaldata/UpdateTo.hpp
@@ -0,0 +1,59 @@
+/* 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 UPDATE_TO_HPP
+#define UPDATE_TO_HPP
+
+class UpdateToReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 6 );
+private:
+ enum UpdateState {
+ TO_COPY_FRAG_COMPLETED = 0,
+ TO_COPY_COMPLETED = 1
+ };
+ Uint32 userPtr;
+ BlockReference userRef;
+ UpdateState updateState;
+ Uint32 startingNodeId;
+
+ /**
+ * Only when TO_COPY_FRAG_COMPLETED
+ */
+ Uint32 tableId;
+ Uint32 fragmentNo;
+};
+
+class UpdateToConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+private:
+
+ Uint32 userPtr;
+ Uint32 sendingNodeId;
+ Uint32 startingNodeId;
+};
+#endif
diff --git a/ndb/include/kernel/signaldata/UtilDelete.hpp b/ndb/include/kernel/signaldata/UtilDelete.hpp
new file mode 100644
index 00000000000..67c13b8c2d5
--- /dev/null
+++ b/ndb/include/kernel/signaldata/UtilDelete.hpp
@@ -0,0 +1,121 @@
+/* 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 UTIL_DELETE_HPP
+#define UTIL_DELETE_HPP
+
+#include "SignalData.hpp"
+#include <SimpleProperties.hpp>
+
+/**
+ * UTIL_DELETE_REQ, UTIL_DELETE_CONF, UTIL_DELETE_REF
+ */
+
+/**
+ * @class UtilDeleteReq
+ * @brief Delete transaction in Util block
+ *
+ * Data format:
+ * - UTIL_DELETE_REQ <prepareId> <ListOfAttributeHeaderValuePairs>
+ */
+
+class UtilDeleteReq {
+ /** Sender(s) / Receiver(s) */
+ friend class DbUtil;
+
+ /** For printing */
+ friend bool printUTIL_DELETE_REQ(FILE * output, const Uint32 * theData,
+ Uint32 len, Uint16 receiverBlockNo);
+public:
+ STATIC_CONST( DataLength = 22 );
+ STATIC_CONST( HeaderLength = 3 );
+
+private:
+ Uint32 senderData;
+ Uint32 prepareId; // Which prepared transaction to execute
+ Uint32 totalDataLen; // Total length of attrData (including AttributeHeaders
+ // and possibly spanning over multiple signals)
+
+ /**
+ * Length in this = signal->length() - 3
+ * Sender block ref = signal->senderBlockRef()
+ */
+
+ Uint32 attrData[DataLength];
+};
+
+
+
+/**
+ * @class UtilDeleteConf
+ *
+ * Data format:
+ * - UTIL_PREPARE_CONF <UtilPrepareId>
+ */
+
+class UtilDeleteConf {
+ /**
+ * Sender(s) / Receiver(s)
+ */
+ friend class DbUtil;
+
+ /**
+ * For printing
+ */
+ friend bool printUTIL_DELETE_CONF(FILE * output,
+ const Uint32 * theData,
+ Uint32 len,
+ Uint16 receiverBlockNo);
+
+ STATIC_CONST( SignalLength = 1 );
+
+private:
+ Uint32 senderData; ///< The client data provided by the client sending
+ ///< UTIL_DELETE_REQ
+};
+
+
+/**
+ * @class UtilDeleteRef
+ *
+ * Data format:
+ * - UTIL_PREPARE_REF
+ */
+
+class UtilDeleteRef {
+ /**
+ * Sender(s) / Receiver(s)
+ */
+ friend class DbUtil;
+
+ /**
+ * For printing
+ */
+ friend bool printUTIL_DELETE_REF(FILE * output,
+ const Uint32 * theData,
+ Uint32 len,
+ Uint16 receiverBlockNo);
+
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 senderData;
+ Uint32 errorCode; ///< See UtilExecuteRef::errorCode
+ Uint32 TCErrorCode;
+};
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/UtilExecute.hpp b/ndb/include/kernel/signaldata/UtilExecute.hpp
new file mode 100644
index 00000000000..551fb172cac
--- /dev/null
+++ b/ndb/include/kernel/signaldata/UtilExecute.hpp
@@ -0,0 +1,136 @@
+/* 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 UTIL_EXECUTE_HPP
+#define UTIL_EXECUTE_HPP
+
+#include "SignalData.hpp"
+#include <SimpleProperties.hpp>
+
+/**
+ * UTIL_EXECUTE_REQ, UTIL_EXECUTE_CONF, UTIL_EXECUTE_REF
+ */
+
+/**
+ * @class UtilExecuteReq
+ * @brief Execute transaction in Util block
+ *
+ * Data format:
+ * - UTIL_EXECUTE_REQ <prepareId> <ListOfAttributeHeaderValuePairs>
+ */
+
+class UtilExecuteReq {
+ /** Sender(s) / Receiver(s) */
+ friend class DbUtil;
+ friend class Trix;
+
+ /** For printing */
+ friend bool printUTIL_EXECUTE_REQ(FILE * output, const Uint32 * theData,
+ Uint32 len, Uint16 receiverBlockNo);
+public:
+ STATIC_CONST( SignalLength = 3 );
+ STATIC_CONST( HEADER_SECTION = 0 );
+ STATIC_CONST( DATA_SECTION = 1 );
+ STATIC_CONST( NoOfSections = 2 );
+
+ GET_SET_SENDERREF
+ GET_SET_SENDERDATA
+ void setPrepareId(Uint32 pId) { prepareId = pId; }; // !! unsets release flag
+ Uint32 getPrepareId() { return prepareId & 0xFF; };
+ void setReleaseFlag() { prepareId |= 0x100; };
+ bool getReleaseFlag() { return (prepareId & 0x100) != 0; };
+private:
+ Uint32 senderData; // MUST be no 1!
+ Uint32 senderRef;
+ Uint32 prepareId; // Which prepared transaction to execute
+};
+
+/**
+ * @class UtilExecuteConf
+ *
+ * Data format:
+ * - UTIL_PREPARE_CONF <UtilPrepareId>
+ */
+
+class UtilExecuteConf {
+ /**
+ * Sender(s) / Receiver(s)
+ */
+ friend class DbUtil;
+ friend class Trix;
+
+ /**
+ * For printing
+ */
+ friend bool printUTIL_EXECUTE_CONF(FILE * output,
+ const Uint32 * theData,
+ Uint32 len,
+ Uint16 receiverBlockNo);
+public:
+ STATIC_CONST( SignalLength = 1 );
+
+ GET_SET_SENDERDATA
+private:
+ Uint32 senderData; // MUST be no 1!
+};
+
+
+/**
+ * @class UtilExecuteRef
+ *
+ * Data format:
+ * - UTIL_PREPARE_REF
+ */
+
+class UtilExecuteRef {
+ /**
+ * Sender(s) / Receiver(s)
+ */
+ friend class DbUtil;
+ friend class Trix;
+
+ /**
+ * For printing
+ */
+ friend bool printUTIL_EXECUTE_REF(FILE * output,
+ const Uint32 * theData,
+ Uint32 len,
+ Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ enum ErrorCode {
+ IllegalKeyNumber = 1,
+ IllegalAttrNumber = 2,
+ TCError = 3,
+ IllegalPrepareId = 4,
+ AllocationError = 5,
+ MissingDataSection = 6,
+ MissingData = 7
+ };
+
+ GET_SET_SENDERDATA
+ GET_SET_ERRORCODE
+ GET_SET_TCERRORCODE
+private:
+ Uint32 senderData; // MUST be no 1!
+ Uint32 errorCode;
+ Uint32 TCErrorCode;
+};
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/UtilLock.hpp b/ndb/include/kernel/signaldata/UtilLock.hpp
new file mode 100644
index 00000000000..1cac467daa0
--- /dev/null
+++ b/ndb/include/kernel/signaldata/UtilLock.hpp
@@ -0,0 +1,334 @@
+/* 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 UTIL_LOCK_HPP
+#define UTIL_LOCK_HPP
+
+#include "SignalData.hpp"
+
+class UtilLockReq {
+
+ /**
+ * Receiver
+ */
+ friend class DbUtil;
+
+ /**
+ * Sender
+ */
+ friend class Dbdih;
+ friend class MutexManager;
+
+ friend bool printUTIL_LOCK_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ enum RequestInfo {
+ TryLock = 1
+ };
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+ Uint32 requestInfo;
+};
+
+class UtilLockConf {
+
+ /**
+ * Receiver
+ */
+ friend class Dbdih;
+ friend class MutexManager;
+
+ /**
+ * Sender
+ */
+ friend class DbUtil;
+
+ friend bool printUTIL_LOCK_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+ Uint32 lockKey;
+};
+
+class UtilLockRef {
+
+ /**
+ * Reciver
+ */
+ friend class Dbdih;
+ friend class MutexManager;
+
+ /**
+ * Sender
+ */
+ friend class DbUtil;
+
+ friend bool printUTIL_LOCK_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ enum ErrorCode {
+ OK = 0,
+ NoSuchLock = 1,
+ OutOfLockRecords = 2,
+ DistributedLockNotSupported = 3,
+ LockAlreadyHeld = 4
+
+ };
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+ Uint32 errorCode;
+};
+
+class UtilUnlockReq {
+
+ /**
+ * Receiver
+ */
+ friend class DbUtil;
+
+ /**
+ * Sender
+ */
+ friend class Dbdih;
+ friend class MutexManager;
+
+ friend bool printUTIL_UNLOCK_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+ Uint32 lockKey;
+};
+
+class UtilUnlockConf {
+
+ /**
+ * Receiver
+ */
+ friend class Dbdih;
+ friend class MutexManager;
+
+ /**
+ * Sender
+ */
+ friend class DbUtil;
+
+ friend bool printUTIL_UNLOCK_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+};
+
+class UtilUnlockRef {
+
+ /**
+ * Reciver
+ */
+ friend class Dbdih;
+ friend class MutexManager;
+
+ /**
+ * Sender
+ */
+ friend class DbUtil;
+
+ friend bool printUTIL_UNLOCK_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+ enum ErrorCode {
+ OK = 0,
+ NoSuchLock = 1,
+ NotLockOwner = 2
+ };
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+ Uint32 errorCode;
+};
+
+/**
+ * Creating a lock
+ */
+class UtilCreateLockReq {
+ /**
+ * Receiver
+ */
+ friend class DbUtil;
+
+ /**
+ * Sender
+ */
+ friend class MutexManager;
+
+ friend bool printUTIL_CREATE_LOCK_REQ(FILE *, const Uint32*, Uint32, Uint16);
+public:
+ enum LockType {
+ Mutex = 0 // Lock with only exclusive locks
+ };
+
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+ Uint32 lockType;
+};
+
+class UtilCreateLockRef {
+ /**
+ * Sender
+ */
+ friend class DbUtil;
+
+ /**
+ * Receiver
+ */
+ friend class MutexManager;
+
+ friend bool printUTIL_CREATE_LOCK_REF(FILE *, const Uint32*, Uint32, Uint16);
+public:
+ enum ErrorCode {
+ OK = 0,
+ OutOfLockQueueRecords = 1,
+ LockIdAlreadyUsed = 2,
+ UnsupportedLockType = 3
+ };
+
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+ Uint32 errorCode;
+};
+
+class UtilCreateLockConf {
+ /**
+ * Sender
+ */
+ friend class DbUtil;
+
+ /**
+ * Receiver
+ */
+ friend class MutexManager;
+
+ friend bool printUTIL_CREATE_LOCK_CONF(FILE*, const Uint32*, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+};
+
+/**
+ * Creating a lock
+ */
+class UtilDestroyLockReq {
+ /**
+ * Receiver
+ */
+ friend class DbUtil;
+
+ /**
+ * Sender
+ */
+ friend class MutexManager;
+
+ friend bool printUTIL_DESTROY_LOCK_REQ(FILE *, const Uint32*, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+ Uint32 lockKey;
+};
+
+class UtilDestroyLockRef {
+ /**
+ * Sender
+ */
+ friend class DbUtil;
+
+ /**
+ * Receiver
+ */
+ friend class MutexManager;
+
+ friend bool printUTIL_DESTROY_LOCK_REF(FILE *, const Uint32*, Uint32, Uint16);
+public:
+ enum ErrorCode {
+ OK = 0,
+ NoSuchLock = 1,
+ NotLockOwner = 2
+ };
+
+ STATIC_CONST( SignalLength = 4 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+ Uint32 errorCode;
+};
+
+class UtilDestroyLockConf {
+ /**
+ * Sender
+ */
+ friend class DbUtil;
+
+ /**
+ * Receiver
+ */
+ friend class MutexManager;
+
+ friend bool printUTIL_DESTROY_LOCK_CONF(FILE*, const Uint32*, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/UtilPrepare.hpp b/ndb/include/kernel/signaldata/UtilPrepare.hpp
new file mode 100644
index 00000000000..8508487ce15
--- /dev/null
+++ b/ndb/include/kernel/signaldata/UtilPrepare.hpp
@@ -0,0 +1,161 @@
+/* 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 UTIL_PREPARE_REQ_HPP
+#define UTIL_PREPARE_REQ_HPP
+
+#include "SignalData.hpp"
+#include <SimpleProperties.hpp>
+
+#ifdef NDB_WIN32
+#ifdef NO_ERROR
+#undef NO_ERROR
+#endif
+#endif
+
+/**
+ * UTIL_PREPARE_REQ, UTIL_PREPARE_CONF, UTIL_PREPARE_REF
+ */
+
+/**
+ * @class UtilPrepareReq
+ * @brief Prepare transaction in Util block
+ *
+ * Data format:
+ * - UTIL_PREPARE_REQ <NoOfOps> (<OperationType> <TableName> <AttrName>+)+
+ */
+class UtilPrepareReq {
+ /**
+ * Sender(s) / Receiver(s)
+ */
+ friend class DbUtil;
+ friend class Trix;
+
+ /**
+ * For printing
+ */
+ friend bool printUTIL_PREPARE_REQ(FILE * output,
+ const Uint32 * theData,
+ Uint32 len,
+ Uint16 receiverBlockNo);
+
+public:
+ enum OperationTypeValue {
+ Read = 0,
+ Update = 1,
+ Insert = 2,
+ Delete = 3,
+ Write = 4
+
+ };
+
+ enum KeyValue {
+ NoOfOperations = 1, ///< No of operations in transaction
+ OperationType = 2, ///
+ TableName = 3, ///< String
+ AttributeName = 4, ///< String
+ TableId = 5,
+ AttributeId = 6
+ };
+
+ // Signal constants
+ STATIC_CONST( SignalLength = 2 );
+ STATIC_CONST( PROPERTIES_SECTION = 0 );
+ STATIC_CONST( NoOfSections = 1 );
+
+ GET_SET_SENDERREF
+ GET_SET_SENDERDATA
+private:
+ Uint32 senderData; // MUST be no 1!
+ Uint32 senderRef;
+};
+
+/**
+ * @class UtilPrepareConf
+ *
+ * Data format:
+ * - UTIL_PREPARE_CONF <UtilPrepareId>
+ */
+
+class UtilPrepareConf {
+ /**
+ * Sender(s) / Receiver(s)
+ */
+ friend class DbUtil;
+ friend class Trix;
+
+ /**
+ * For printing
+ */
+ friend bool printUTIL_PREPARE_CONF(FILE * output,
+ const Uint32 * theData,
+ Uint32 len,
+ Uint16 receiverBlockNo);
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ GET_SET_SENDERDATA
+ GET_SET_PREPAREID
+private:
+ Uint32 senderData; // MUST be no 1!
+ Uint32 prepareId;
+};
+
+
+/**
+ * @class UtilPrepareRef
+ *
+ * Data format:
+ * - UTIL_PREPARE_REF
+ */
+
+class UtilPrepareRef {
+ /**
+ * Sender(s) / Receiver(s)
+ */
+ friend class DbUtil;
+ friend class Trix;
+
+ /**
+ * For printing
+ */
+ friend bool printUTIL_PREPARE_REF(FILE * output,
+ const Uint32 * theData,
+ Uint32 len,
+ Uint16 receiverBlockNo);
+
+public:
+ enum ErrorCode {
+ NO_ERROR = 0,
+ PREPARE_SEIZE_ERROR = 1,
+ PREPARE_PAGES_SEIZE_ERROR = 2,
+ PREPARED_OPERATION_SEIZE_ERROR = 3,
+ DICT_TAB_INFO_ERROR = 4,
+ MISSING_PROPERTIES_SECTION = 5
+ };
+
+ STATIC_CONST( SignalLength = 2 );
+
+ GET_SET_SENDERDATA
+ GET_SET_ERRORCODE
+private:
+ Uint32 senderData; // MUST be no 1!
+ Uint32 errorCode;
+};
+
+
+#endif
diff --git a/ndb/include/kernel/signaldata/UtilRelease.hpp b/ndb/include/kernel/signaldata/UtilRelease.hpp
new file mode 100644
index 00000000000..d2864f02f47
--- /dev/null
+++ b/ndb/include/kernel/signaldata/UtilRelease.hpp
@@ -0,0 +1,83 @@
+/* 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 UTIL_RELEASE_HPP
+#define UTIL_PREPARE_HPP
+
+#include "SignalData.hpp"
+
+/**
+ * @class UtilReleaseReq
+ * @brief Release Prepared transaction in Util block
+ *
+ * Data format:
+ * - UTIL_PREPARE_RELEASE_REQ <UtilPrepareId>
+ */
+class UtilReleaseReq {
+ friend class DbUtil;
+ friend class Trix;
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+private:
+ Uint32 senderData; // MUST be no 1!
+ Uint32 prepareId;
+};
+
+
+/**
+ * @class UtilReleaseConf
+ *
+ * Data format:
+ * - UTIL_PREPARE_CONF <UtilPrepareId>
+ */
+
+class UtilReleaseConf {
+ friend class DbUtil;
+ friend class Trix;
+
+ STATIC_CONST( SignalLength = 1 );
+
+private:
+ Uint32 senderData; // MUST be no 1!
+};
+
+
+/**
+ * @class UtilReleaseRef
+ *
+ * Data format:
+ * - UTIL_PREPARE_RELEASE_REF
+ */
+
+class UtilReleaseRef {
+ friend class DbUtil;
+ friend class Trix;
+
+ enum ErrorCode {
+ NO_ERROR = 0,
+ NO_SUCH_PREPARE_SEIZED = 1
+ };
+
+ STATIC_CONST( SignalLength = 3 );
+
+private:
+ Uint32 senderData; // MUST be no 1!
+ Uint32 prepareId;
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/UtilSequence.hpp b/ndb/include/kernel/signaldata/UtilSequence.hpp
new file mode 100644
index 00000000000..50e5d673e99
--- /dev/null
+++ b/ndb/include/kernel/signaldata/UtilSequence.hpp
@@ -0,0 +1,101 @@
+/* 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 UTIL_SEQUENCE_HPP
+#define UTIL_SEQUENCE_HPP
+
+#include "SignalData.hpp"
+
+class UtilSequenceReq {
+
+ /**
+ * Receiver
+ */
+ friend class DbUtil;
+
+ /**
+ * Sender
+ */
+ friend class Backup;
+ friend class Suma;
+
+ friend bool printUTIL_SEQUENCE_REQ(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ enum RequestType {
+ NextVal = 1, // Return uniq value
+ CurrVal = 2, // Read
+ Create = 3 // Create a sequence
+ };
+private:
+ Uint32 senderData;
+ Uint32 sequenceId; // Number of sequence variable
+ Uint32 requestType;
+};
+
+class UtilSequenceConf {
+
+ /**
+ * Receiver
+ */
+ friend class Backup;
+ friend class Suma;
+ /**
+ * Sender
+ */
+ friend class DbUtil;
+
+ friend bool printUTIL_SEQUENCE_CONF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+private:
+ Uint32 senderData;
+ Uint32 sequenceId;
+ Uint32 requestType;
+ Uint32 sequenceValue[2];
+};
+
+class UtilSequenceRef {
+
+ /**
+ * Reciver
+ */
+ friend class Backup;
+ friend class Suma;
+ /**
+ * Sender
+ */
+ friend class DbUtil;
+
+ friend bool printUTIL_SEQUENCE_REF(FILE *, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 5 );
+
+ enum ErrorCode {
+ NoSuchSequence = 1,
+ TCError = 2
+ };
+private:
+ Uint32 senderData;
+ Uint32 sequenceId;
+ Uint32 requestType;
+ Uint32 errorCode;
+ Uint32 TCErrorCode;
+};
+
+#endif
diff --git a/ndb/include/kernel/signaldata/WaitGCP.hpp b/ndb/include/kernel/signaldata/WaitGCP.hpp
new file mode 100644
index 00000000000..ebed28714d2
--- /dev/null
+++ b/ndb/include/kernel/signaldata/WaitGCP.hpp
@@ -0,0 +1,109 @@
+/* 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 WAIT_GCP_HPP
+#define WAIT_GCP_HPP
+
+/**
+ * This signal is sent by anyone to local DIH
+ *
+ * If local DIH is not master, it forwards it to master DIH
+ * and start acting as a proxy
+ *
+ */
+class WaitGCPReq {
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Sender
+ */
+ friend class Ndbcntr;
+ friend class Dbdict;
+ friend class Backup;
+ //friend class Grep::PSCoord;
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+public:
+ enum RequestType {
+ Complete = 1, ///< Wait for a GCP to complete
+ CompleteForceStart = 2, ///< Wait for a GCP to complete start one if needed
+ CompleteIfRunning = 3, ///< Wait for ongoing GCP
+ CurrentGCI = 8 ///< Immediately return current GCI
+ };
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 requestType;
+};
+
+class WaitGCPConf {
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbcntr;
+ friend class Dbdict;
+ friend class Backup;
+ //friend class Grep::PSCoord;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+public:
+ Uint32 senderData;
+ Uint32 gcp;
+};
+
+class WaitGCPRef {
+
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Dbdih;
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbcntr;
+ friend class Dbdict;
+ friend class Backup;
+ friend class Grep;
+
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ enum ErrorCode {
+ StopOK = 0,
+ NF_CausedAbortOfProcedure = 1,
+ NoWaitGCPRecords = 2
+ };
+
+private:
+ Uint32 errorCode;
+ Uint32 senderData;
+};
+
+#endif
diff --git a/ndb/include/kernel/trigger_definitions.h b/ndb/include/kernel/trigger_definitions.h
new file mode 100644
index 00000000000..a5e7fb1953c
--- /dev/null
+++ b/ndb/include/kernel/trigger_definitions.h
@@ -0,0 +1,66 @@
+/* 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 NDB_TRIGGER_DEFINITIONS_H
+#define NDB_TRIGGER_DEFINITIONS_H
+
+#include "ndb_limits.h"
+
+#ifndef MIN
+#define MIN(x,y) (((x)<(y))?(x):(y))
+#endif
+
+#ifndef MAX
+#define MAX(x,y) (((x)>(y))?(x):(y))
+#endif
+
+#define ILLEGAL_TRIGGER_ID ((Uint32)(~0))
+
+struct TriggerType {
+ enum Value {
+ CONSTRAINT = 0,
+ SECONDARY_INDEX = 1,
+ FOREIGN_KEY = 2,
+ SCHEMA_UPGRADE = 3,
+ API_TRIGGER = 4,
+ SQL_TRIGGER = 5,
+ SUBSCRIPTION = 6,
+ READ_ONLY_CONSTRAINT = 7,
+ ORDERED_INDEX = 8,
+ SUBSCRIPTION_BEFORE = 9
+ };
+};
+
+struct TriggerActionTime {
+ enum Value {
+ TA_BEFORE = 0, // Immediate, before operation
+ TA_AFTER = 1, // Immediate, after operation
+ TA_DEFERRED = 2, // Before commit
+ TA_DETACHED = 3, // After commit in a separate transaction, NYI
+ TA_CUSTOM = 4 // Hardcoded per TriggerType
+ };
+};
+
+struct TriggerEvent {
+ enum Value {
+ TE_INSERT = 0,
+ TE_DELETE = 1,
+ TE_UPDATE = 2,
+ TE_CUSTOM = 3 // Hardcoded per TriggerType
+ };
+};
+
+#endif
diff --git a/ndb/include/logger/ConsoleLogHandler.hpp b/ndb/include/logger/ConsoleLogHandler.hpp
new file mode 100644
index 00000000000..ae77b13d3b7
--- /dev/null
+++ b/ndb/include/logger/ConsoleLogHandler.hpp
@@ -0,0 +1,57 @@
+/* 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 CONSOLELOGHANDLER_H
+#define CONSOLELOGHANDLER_H
+
+#include "LogHandler.hpp"
+
+/**
+ * Logs messages to the console/stdout.
+ *
+ * @see LogHandler
+ * @version #@ $Id: ConsoleLogHandler.hpp,v 1.2 2003/09/01 10:15:53 innpeno Exp $
+ */
+class ConsoleLogHandler : public LogHandler
+{
+public:
+ /**
+ * Default constructor.
+ */
+ ConsoleLogHandler();
+ /**
+ * Destructor.
+ */
+ virtual ~ConsoleLogHandler();
+
+ virtual bool open();
+ virtual bool close();
+
+ virtual bool setParam(const BaseString &param, const BaseString &value);
+
+protected:
+ virtual void writeHeader(const char* pCategory, Logger::LoggerLevel level);
+ virtual void writeMessage(const char* pMsg);
+ virtual void writeFooter();
+
+private:
+ /** Prohibit*/
+ ConsoleLogHandler(const ConsoleLogHandler&);
+ ConsoleLogHandler operator = (const ConsoleLogHandler&);
+ bool operator == (const ConsoleLogHandler&);
+
+};
+#endif
diff --git a/ndb/include/logger/FileLogHandler.hpp b/ndb/include/logger/FileLogHandler.hpp
new file mode 100644
index 00000000000..ae69a2f5418
--- /dev/null
+++ b/ndb/include/logger/FileLogHandler.hpp
@@ -0,0 +1,110 @@
+/* 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 FILELOGHANDLER_H
+#define FILELOGHANDLER_H
+
+#include "LogHandler.hpp"
+
+class File;
+
+/**
+ * Logs messages to a file. The log file will be archived depending on
+ * the file's size or after N number of log entries.
+ * There will be only a specified number of archived logs
+ * which will be "recycled".
+ *
+ * The archived log file will be named as <filename>.1..N.
+ *
+ *
+ * @see LogHandler
+ * @version #@ $Id: FileLogHandler.hpp,v 1.2 2003/09/01 10:15:53 innpeno Exp $
+ */
+class FileLogHandler : public LogHandler
+{
+public:
+ /** Max number of log files to archive. */
+ static const int MAX_NO_FILES = 6;
+ /** Max file size of the log before archiving. */
+ static const long MAX_FILE_SIZE = 1024000;
+ /** Max number of log entries before archiving. */
+ static const unsigned int MAX_LOG_ENTRIES = 10000;
+
+ /**
+ * Default constructor.
+ */
+ FileLogHandler();
+
+ /**
+ * Creates a new file handler with the specified filename,
+ * max number of archived log files and max log size for each log.
+ *
+ * @param aFileName the log filename.
+ * @param maxNoFiles the maximum number of archived log files.
+ * @param maxFileSize the maximum log file size before archiving.
+ * @param maxLogEntries the maximum number of log entries before checking time to archive.
+ */
+ FileLogHandler(const char* aFileName,
+ int maxNoFiles = MAX_NO_FILES,
+ long maxFileSize = MAX_FILE_SIZE,
+ unsigned int maxLogEntries = MAX_LOG_ENTRIES);
+
+ /**
+ * Destructor.
+ */
+ virtual ~FileLogHandler();
+
+ virtual bool open();
+ virtual bool close();
+
+ virtual bool setParam(const BaseString &param, const BaseString &value);
+ virtual bool checkParams();
+
+protected:
+ virtual void writeHeader(const char* pCategory, Logger::LoggerLevel level);
+ virtual void writeMessage(const char* pMsg);
+ virtual void writeFooter();
+
+private:
+ /** Prohibit */
+ FileLogHandler(const FileLogHandler&);
+ FileLogHandler operator = (const FileLogHandler&);
+ bool operator == (const FileLogHandler&);
+
+ /**
+ * Returns true if it is time to create a new log file.
+ */
+ bool isTimeForNewFile();
+
+ /**
+ * Archives the current log file and creates a new one.
+ * The archived log filename will be in the format of <filename>.N
+ *
+ * @return true if successful.
+ */
+ bool createNewFile();
+
+ bool setFilename(const BaseString &filename);
+ bool setMaxSize(const BaseString &size);
+ bool setMaxFiles(const BaseString &files);
+
+ int m_maxNoFiles;
+ long m_maxFileSize;
+ unsigned int m_maxLogEntries;
+ File* m_pLogFile;
+};
+
+#endif
diff --git a/ndb/include/logger/LogHandler.hpp b/ndb/include/logger/LogHandler.hpp
new file mode 100644
index 00000000000..8c5c9298f69
--- /dev/null
+++ b/ndb/include/logger/LogHandler.hpp
@@ -0,0 +1,198 @@
+/* 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 LOGHANDLER_H
+#define LOGHANDLER_H
+
+#include "Logger.hpp"
+
+#include <NdbStdio.h> // Defines NULL
+
+/**
+ * This class is the base class for all log handlers. A log handler is
+ * responsible for formatting and writing log messages to a specific output.
+ *
+ * A log entry consists of three parts: a header, <body/log message and a footer.
+ * <pre>
+ * 09:17:37 2002-03-13 [MgmSrv] INFO -- Local checkpoint 13344 started.
+ * </pre>
+ *
+ * Header format: TIME&DATE CATEGORY LEVEL --
+ * TIME&DATE = ctime() format.
+ * CATEGORY = Any string.
+ * LEVEL = ALERT to DEBUG (Log levels)
+ *
+ * Footer format: \n (currently only newline)
+ *
+ * @version #@ $Id: LogHandler.hpp,v 1.7 2003/09/01 10:15:53 innpeno Exp $
+ */
+class LogHandler
+{
+public:
+ /**
+ * Default constructor.
+ */
+ LogHandler();
+
+ /**
+ * Destructor.
+ */
+ virtual ~LogHandler();
+
+ /**
+ * Opens/initializes the log handler.
+ *
+ * @return true if successful.
+ */
+ virtual bool open() = 0;
+
+ /**
+ * Closes/free any allocated resources used by the log handler.
+ *
+ * @return true if successful.
+ */
+ virtual bool close() = 0;
+
+ /**
+ * Append a log message to the output stream/file whatever.
+ * append() will call writeHeader(), writeMessage() and writeFooter() for
+ * a child class and in that order.
+ *
+ * @param pCategory the category/name to tag the log entry with.
+ * @param level the log level.
+ * @param pMsg the log message.
+ */
+ void append(const char* pCategory, Logger::LoggerLevel level,
+ const char* pMsg);
+
+ /**
+ * Returns a default formatted header. It currently has the
+ * follwing default format: '%H:%M:%S %Y-%m-%d [CATEGORY] LOGLEVEL --'
+ *
+ * @param pStr the header string to format.
+ * @param pCategory a category/name to tag the log entry with.
+ * @param level the log level.
+ * @return the header.
+ */
+ const char* getDefaultHeader(char* pStr, const char* pCategory,
+ Logger::LoggerLevel level) const;
+
+ /**
+ * Returns a default formatted footer. Currently only returns a newline.
+ *
+ * @return the footer.
+ */
+ const char* getDefaultFooter() const;
+
+ /**
+ * Returns the date and time format used by ctime().
+ *
+ * @return the date and time format.
+ */
+ const char* getDateTimeFormat() const;
+
+ /**
+ * Sets the date and time format. It needs to have the same arguments
+ * a ctime().
+ *
+ * @param pFormat the date and time format.
+ */
+ void setDateTimeFormat(const char* pFormat);
+
+ /**
+ * Returns a string date and time string.
+ *
+ * @param pStr a string.
+ * @return a string with date and time.
+ */
+ char* getTimeAsString(char* pStr) const;
+
+ /**
+ * Returns the error code.
+ */
+ int getErrorCode() const;
+
+ /**
+ * Sets the error code.
+ *
+ * @param code the error code.
+ */
+ void setErrorCode(int code);
+
+ /**
+ * Parse logstring parameters
+ *
+ * @param params list of parameters, formatted as "param=value",
+ * entries separated by ","
+ * @return true on success, false on failure
+ */
+ bool parseParams(const BaseString &params);
+
+ /**
+ * Sets a parameters. What parameters are accepted depends on the subclass.
+ *
+ * @param param name of parameter
+ * @param value value of parameter
+ */
+ virtual bool setParam(const BaseString &param, const BaseString &value) = 0;
+
+ /**
+ * Checks that all necessary parameters have been set.
+ *
+ * @return true if all parameters are correctly set, false otherwise
+ */
+ virtual bool checkParams();
+
+protected:
+ /** Max length of the date and time header in the log. */
+ static const int MAX_DATE_TIME_HEADER_LENGTH = 64;
+ /** Max length of the header the log. */
+ static const int MAX_HEADER_LENGTH = 128;
+ /** Max lenght of footer in the log. */
+ static const int MAX_FOOTER_LENGTH = 128;
+
+ /**
+ * Write the header to the log.
+ *
+ * @param pCategory the category to tag the log with.
+ * @param level the log level.
+ */
+ virtual void writeHeader(const char* category, Logger::LoggerLevel level) = 0;
+
+ /**
+ * Write the message to the log.
+ *
+ * @param pMsg the message to log.
+ */
+ virtual void writeMessage(const char* pMsg) = 0;
+
+ /**
+ * Write the footer to the log.
+ *
+ */
+ virtual void writeFooter() = 0;
+
+private:
+ /** Prohibit */
+ LogHandler(const LogHandler&);
+ LogHandler* operator = (const LogHandler&);
+ bool operator == (const LogHandler&);
+
+ const char* m_pDateTimeFormat;
+ int m_errorCode;
+};
+
+#endif
diff --git a/ndb/include/logger/Logger.hpp b/ndb/include/logger/Logger.hpp
new file mode 100644
index 00000000000..2d12a5b8a6e
--- /dev/null
+++ b/ndb/include/logger/Logger.hpp
@@ -0,0 +1,294 @@
+/* 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 Logger_H
+#define Logger_H
+
+#include <BaseString.hpp>
+#include <stdarg.h>
+
+class LogHandler;
+class LogHandlerList;
+
+/**
+ * Logger should be used whenver you need to log a message like
+ * general information or debug messages. By creating/adding different
+ * log handlers, a single log message can be sent to
+ * different outputs (stdout, file or syslog).
+ *
+ * Each log entry is created with a log level (or severity) which is
+ * used to identity the type of the entry, e.g., if it is a debug
+ * or an error message.
+ *
+ * Example of a log entry:
+ *
+ * 09:17:39 2002-03-13 [myLogger] INFO -- Local checkpoint started.
+ *
+ * HOW TO USE
+ *
+ * 1) Create a new instance of the Logger.
+ *
+ * Logger myLogger = new Logger();
+ *
+ * 2) Add the log handlers that you want, i.e., where the log entries
+ * should be written/shown.
+ *
+ * myLogger->createConsoleHandler(); // Output to console/stdout
+ * myLogger->addHandler(new FileLogHandler("mylog.txt")); // use mylog.txt
+ *
+ * 3) Tag each log entry with a category/name.
+ *
+ * myLogger->setCategory("myLogger");
+ *
+ * 4) Start log messages.
+ *
+ * myLogger->alert("T-9 to lift off");
+ * myLogger->info("Here comes the sun, la la");
+ * myLogger->debug("Why does this not work!!!, We should not be here...")
+ *
+ * 5) Log only debug messages.
+ *
+ * myLogger->enable(Logger::LL_DEBUG);
+ *
+ * 6) Log only ALERTS and ERRORS.
+ *
+ * myLogger->enable(Logger::LL_ERROR, Logger::LL_ALERT);
+ *
+ * 7) Do not log any messages.
+ *
+ * myLogger->disable(Logger::LL_ALL);
+ *
+ *
+ * LOG LEVELS (Matches the severity levels of syslog)
+ * <pre>
+ *
+ * ALERT A condition that should be corrected
+ * immediately, such as a corrupted system
+ * database.
+ *
+ * CRITICAL Critical conditions, such as hard device
+ * errors.
+ *
+ * ERROR Errors.
+ *
+ * WARNING Warning messages.
+ *
+ * INFO Informational messages.
+ *
+ * DEBUG Messages that contain information nor-
+ * mally of use only when debugging a pro-
+ * gram.
+ * </pre>
+ *
+ * @version #@ $Id: Logger.hpp,v 1.7 2003/09/01 10:15:53 innpeno Exp $
+ */
+class Logger
+{
+public:
+ /** The log levels. NOTE: Could not use the name LogLevel since
+ * it caused conflicts with another class.
+ */
+ enum LoggerLevel {LL_OFF, LL_DEBUG, LL_INFO, LL_WARNING, LL_ERROR,
+ LL_CRITICAL, LL_ALERT, LL_ALL};
+
+ /**
+ * String representation of the the log levels.
+ */
+ static const char* LoggerLevelNames[];
+
+ /**
+ * Default constructor.
+ */
+ Logger();
+
+ /**
+ * Destructor.
+ */
+ virtual ~Logger();
+
+ /**
+ * Set a category/name that each log entry will have.
+ *
+ * @param pCategory the category.
+ */
+ void setCategory(const char* pCategory);
+
+ /**
+ * Create a default handler that logs to the console/stdout.
+ *
+ * @return true if successful.
+ */
+ bool createConsoleHandler();
+
+ /**
+ * Remove the default console handler.
+ */
+ void removeConsoleHandler();
+
+ /**
+ * Create a default handler that logs to a file called logger.log.
+ *
+ * @return true if successful.
+ */
+ bool createFileHandler();
+
+ /**
+ * Remove the default file handler.
+ */
+ void removeFileHandler();
+
+ /**
+ * Create a default handler that logs to the syslog.
+ *
+ * On OSE a ConsoleHandler will be created since there is no syslog support.
+ *
+ * @return true if successful.
+ */
+ bool createSyslogHandler();
+
+ /**
+ * Remove the default syslog handler.
+ */
+ void removeSyslogHandler();
+
+ /**
+ * Add a new log handler.
+ *
+ * @param pHandler a log handler.
+ * @return true if successful.
+ */
+ bool addHandler(LogHandler* pHandler);
+
+ /**
+ * Add a new handler
+ *
+ * @param logstring string describing the handler to add
+ */
+ bool addHandler(const BaseString &logstring);
+
+ /**
+ * Remove a log handler.
+ *
+ * @param pHandler log handler to remove.
+ * @return true if successful.
+ */
+ bool removeHandler(LogHandler* pHandler);
+
+ /**
+ * Remove all log handlers.
+ */
+ void removeAllHandlers();
+
+ /**
+ * Returns true if the specified log level is enabled.
+ *
+ * @return true if enabled.
+ */
+ bool isEnable(LoggerLevel logLevel) const;
+
+ /**
+ * Enable the specified log level.
+ *
+ * @param logLevel the loglevel to enable.
+ */
+ void enable(LoggerLevel logLevel);
+
+ /**
+ * Enable log levels.
+ *
+ * @param fromLogLevel enable from log level.
+ * @param toLogLevel enable to log level.
+ */
+ void enable (LoggerLevel fromLogLevel, LoggerLevel toLogLevel);
+
+ /**
+ * Disable log level.
+ *
+ * @param logLevel disable log level.
+ */
+ void disable(LoggerLevel logLevel);
+
+ /**
+ * Log an alert message.
+ *
+ * @param pMsg the message.
+ */
+ virtual void alert(const char* pMsg, ...) const;
+ virtual void alert(BaseString &pMsg) const { alert(pMsg.c_str()); };
+
+ /**
+ * Log a critical message.
+ *
+ * @param pMsg the message.
+ */
+ virtual void critical(const char* pMsg, ...) const;
+ virtual void critical(BaseString &pMsg) const { critical(pMsg.c_str()); };
+
+ /**
+ * Log an error message.
+ *
+ * @param pMsg the message.
+ */
+ virtual void error(const char* pMsg, ...) const;
+ virtual void error(BaseString &pMsg) const { error(pMsg.c_str()); };
+
+ /**
+ * Log a warning message.
+ *
+ * @param pMsg the message.
+ */
+ virtual void warning(const char* pMsg, ...) const;
+ virtual void warning(BaseString &pMsg) const { warning(pMsg.c_str()); };
+
+ /**
+ * Log an info message.
+ *
+ * @param pMsg the message.
+ */
+ virtual void info(const char* pMsg, ...) const;
+ virtual void info(BaseString &pMsg) const { info(pMsg.c_str()); };
+
+ /**
+ * Log a debug message.
+ *
+ * @param pMsg the message.
+ */
+ virtual void debug(const char* pMsg, ...) const;
+ virtual void debug(BaseString &pMsg) const { debug(pMsg.c_str()); };
+
+protected:
+
+ void log(LoggerLevel logLevel, const char* msg, va_list ap) const;
+
+private:
+ /** Prohibit */
+ Logger(const Logger&);
+ Logger operator = (const Logger&);
+ bool operator == (const Logger&);
+
+ static const int MAX_LOG_LEVELS = 8;
+
+ bool m_logLevels[MAX_LOG_LEVELS];
+
+ LogHandlerList* m_pHandlerList;
+ const char* m_pCategory;
+ /* Default handlers */
+ LogHandler* m_pConsoleHandler;
+ LogHandler* m_pFileHandler;
+ LogHandler* m_pSyslogHandler;
+};
+
+#endif
diff --git a/ndb/include/logger/SysLogHandler.hpp b/ndb/include/logger/SysLogHandler.hpp
new file mode 100644
index 00000000000..4f13308d61b
--- /dev/null
+++ b/ndb/include/logger/SysLogHandler.hpp
@@ -0,0 +1,97 @@
+/* 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 SYSLOGHANDLER_H
+#define SYSLOGHANDLER_H
+
+#include "LogHandler.hpp"
+#include <syslog.h>
+
+/**
+ * Logs messages to syslog. The default identity is 'NDB'.
+ * See 'man 3 syslog'.
+ *
+ * It logs the following severity levels.
+ * <pre>
+ *
+ * LOG_ALERT A condition that should be corrected
+ * immediately, such as a corrupted system
+ * database.
+ *
+ * LOG_CRIT Critical conditions, such as hard device
+ * errors.
+ *
+ * LOG_ERR Errors.
+ *
+ * LOG_WARNING Warning messages.
+ *
+ * LOG_INFO Informational messages.
+ *
+ * LOG_DEBUG Messages that contain information nor-
+ * mally of use only when debugging a pro-
+ * gram.
+ * </pre>
+ *
+ * @see LogHandler
+ * @version #@ $Id: SysLogHandler.hpp,v 1.2 2003/09/01 10:15:53 innpeno Exp $
+ */
+class SysLogHandler : public LogHandler
+{
+public:
+ /**
+ * Default constructor.
+ */
+ SysLogHandler();
+
+ /**
+ * Create a new syslog handler with the specified identity.
+ *
+ * @param pIdentity a syslog identity.
+ * @param facility syslog facility, defaults to LOG_USER
+ */
+ SysLogHandler(const char* pIdentity, int facility = LOG_USER);
+
+ /**
+ * Destructor.
+ */
+ virtual ~SysLogHandler();
+
+ virtual bool open();
+ virtual bool close();
+
+ virtual bool setParam(const BaseString &param, const BaseString &value);
+ bool setFacility(const BaseString &facility);
+
+protected:
+ virtual void writeHeader(const char* pCategory, Logger::LoggerLevel level);
+ virtual void writeMessage(const char* pMsg);
+ virtual void writeFooter();
+
+private:
+ /** Prohibit*/
+ SysLogHandler(const SysLogHandler&);
+ SysLogHandler operator = (const SysLogHandler&);
+ bool operator == (const SysLogHandler&);
+
+ int m_severity;
+ const char* m_pCategory;
+
+ /** Syslog identity for all log entries. */
+ const char* m_pIdentity;
+ int m_facility;
+};
+
+#endif
diff --git a/ndb/include/mgmapi/mgmapi.h b/ndb/include/mgmapi/mgmapi.h
new file mode 100644
index 00000000000..c74a046b7e7
--- /dev/null
+++ b/ndb/include/mgmapi/mgmapi.h
@@ -0,0 +1,663 @@
+/* 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 MGMAPI_H
+#define MGMAPI_H
+
+/**
+ * @mainpage NDB Cluster Management API
+ *
+ * The NDB Cluster Management API (MGM API) is a C API
+ * that is used to:
+ * - Start/stop database nodes (DB nodes)
+ * - Start/stop NDB Cluster backups
+ * - Control the NDB Cluster log
+ * - Other administrative tasks
+ *
+ * @section General Concepts
+ *
+ * Each MGM API function needs a management server handle
+ * (of type Mgm_C_Api::NdbMgmHandle).
+ * This handle is initally is created by calling the
+ * function ndb_mgm_create_handle().
+ *
+ * A function can return:
+ * -# An integer value.
+ * If it returns -1 then this indicates an error, and then
+ * -# A pointer value. If it returns NULL then check the latest error.
+ * If it didn't return NULL, then a "something" is returned.
+ * This "something" has to be free:ed by the user of the MGM API.
+ *
+ * If there are an error, then the get latest error functions
+ * can be used to check what the error was.
+ */
+
+/** @addtogroup MGM_C_API
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /**
+ * Format of statistical information from the NDB Cluster.
+ * STATISTIC_LINE is sent on the statistical port from the Management server,
+ * each line is timestamped with STATISTIC_DATE.
+ */
+#define STATISTIC_LINE "date=%s epochsecs=%d nodeid=%u trans=%u commit=%u " \
+ "read=%u insert=%u attrinfo=%u cops=%u abort=%u"
+ /**
+ * Format of statistical information from the NDB Cluster.
+ * STATISTIC_LINE is sent on the statistical port from the Management server,
+ * each line is timestamped with STATISTIC_DATE.
+ */
+#define STATISTIC_DATE "%d-%.2d-%.2d/%.2d:%.2d:%.2d"
+ /**
+ * Format of statistical information from the NDB Cluster.
+ */
+#define OP_STATISTIC_LINE "date=%s epochsecs=%d nodeid=%d operations=%u"
+
+ /**
+ * The NdbMgmHandle.
+ */
+ typedef struct ndb_mgm_handle * NdbMgmHandle;
+
+ /**
+ * NDB Cluster node types
+ */
+ enum ndb_mgm_node_type {
+ NDB_MGM_NODE_TYPE_UNKNOWN = -1, ///< Node type not known
+ 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_MIN = 0, ///< Min valid value
+ NDB_MGM_NODE_TYPE_MAX = 2 ///< Max valid value
+ };
+
+ /**
+ * Database node status
+ */
+ enum ndb_mgm_node_status {
+ NDB_MGM_NODE_STATUS_UNKNOWN = 0, ///< Node status not known
+ NDB_MGM_NODE_STATUS_NO_CONTACT = 1, ///< No contact with node
+ NDB_MGM_NODE_STATUS_NOT_STARTED = 2, ///< Has not run starting protocol
+ NDB_MGM_NODE_STATUS_STARTING = 3, ///< Is running starting protocol
+ NDB_MGM_NODE_STATUS_STARTED = 4, ///< Running
+ NDB_MGM_NODE_STATUS_SHUTTING_DOWN = 5, ///< Is shutting down
+ NDB_MGM_NODE_STATUS_RESTARTING = 6, ///< Is restarting
+ NDB_MGM_NODE_STATUS_SINGLEUSER = 7, ///< Maintenance mode
+ NDB_MGM_NODE_STATUS_RESUME = 8, ///< Resume mode
+
+ NDB_MGM_NODE_STATUS_MIN = 0, ///< Min valid value
+ NDB_MGM_NODE_STATUS_MAX = 6 ///< Max valid value
+ };
+
+ /**
+ * Error codes
+ */
+ enum ndb_mgm_error {
+ NDB_MGM_NO_ERROR = 0,
+
+ /* Request for service errors */
+ NDB_MGM_ILLEGAL_CONNECT_STRING = 1001,
+ NDB_MGM_ILLEGAL_PORT_NUMBER = 1002,
+ NDB_MGM_ILLEGAL_SOCKET = 1003,
+ NDB_MGM_ILLEGAL_IP_ADDRESS = 1004,
+ NDB_MGM_ILLEGAL_SERVER_HANDLE = 1005,
+ NDB_MGM_ILLEGAL_SERVER_REPLY = 1006,
+ NDB_MGM_ILLEGAL_NUMBER_OF_NODES = 1007,
+ NDB_MGM_ILLEGAL_NODE_STATUS = 1008,
+ NDB_MGM_OUT_OF_MEMORY = 1009,
+ NDB_MGM_SERVER_NOT_CONNECTED = 1010,
+ NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET = 1011,
+
+ /* Service errors - Start/Stop Node or System */
+ NDB_MGM_START_FAILED = 2001,
+ NDB_MGM_STOP_FAILED = 2002,
+ NDB_MGM_RESTART_FAILED = 2003,
+
+ /* Service errors - Backup */
+ NDB_MGM_COULD_NOT_START_BACKUP = 3001,
+ NDB_MGM_COULD_NOT_ABORT_BACKUP = 3002,
+
+ /* Service errors - Single User Mode */
+ NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE = 4001,
+ NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE = 4002
+ };
+
+ struct Ndb_Mgm_Error_Msg {
+ enum ndb_mgm_error code;
+ const char * msg;
+ };
+
+ const struct Ndb_Mgm_Error_Msg ndb_mgm_error_msgs[] = {
+ { NDB_MGM_NO_ERROR, "No error" },
+
+ { NDB_MGM_ILLEGAL_CONNECT_STRING, "Illegal connect string" },
+ { NDB_MGM_ILLEGAL_PORT_NUMBER, "Illegal port number" },
+ { NDB_MGM_ILLEGAL_SOCKET, "Illegal socket" },
+ { NDB_MGM_ILLEGAL_IP_ADDRESS, "Illegal IP address" },
+ { NDB_MGM_ILLEGAL_SERVER_HANDLE, "Illegal server handle" },
+ { NDB_MGM_ILLEGAL_SERVER_REPLY, "Illegal reply from server" },
+ { NDB_MGM_ILLEGAL_NUMBER_OF_NODES, "Illegal number of nodes" },
+ { NDB_MGM_ILLEGAL_NODE_STATUS, "Illegal node status" },
+ { NDB_MGM_OUT_OF_MEMORY, "Out of memory" },
+ { NDB_MGM_SERVER_NOT_CONNECTED, "Management server not connected" },
+ { NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, "Could not connect to socket" },
+
+ /* Service errors - Start/Stop Node or System */
+ { NDB_MGM_START_FAILED, "Start failed" },
+ { NDB_MGM_STOP_FAILED, "Stop failed" },
+ { NDB_MGM_RESTART_FAILED, "Restart failed" },
+
+ /* Service errors - Backup */
+ { NDB_MGM_COULD_NOT_START_BACKUP, "Could not start backup" },
+ { NDB_MGM_COULD_NOT_ABORT_BACKUP, "Could not abort backup" },
+
+ /* Service errors - Single User Mode */
+ { NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE,
+ "Could not enter single user mode" },
+ { NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE,
+ "Could not exit single user mode" }
+ };
+
+ const int ndb_mgm_noOfErrorMsgs =
+ sizeof(ndb_mgm_error_msgs)/sizeof(struct Ndb_Mgm_Error_Msg);
+
+ /**
+ * Structure returned by ndb_mgm_get_status
+ */
+ struct ndb_mgm_node_state {
+ int node_id; ///< NDB Cluster node id
+ enum ndb_mgm_node_type node_type; ///< Type of NDB Cluster node
+ enum ndb_mgm_node_status node_status; ///< State of node
+ int start_phase; ///< Start phase.
+ ///< @note Start phase is only
+ ///< valid if
+ ///< node_type is
+ ///< NDB_MGM_NODE_TYPE_NDB and
+ ///< node_status is
+ ///< NDB_MGM_NODE_STATUS_STARTING
+ int dynamic_id; ///< Id for heartbeats and
+ ///< master take-over
+ ///< (only valid for DB nodes)
+ int node_group; ///< Node group of node
+ ///< (only valid for DB nodes)
+ int version; ///< Internal version number
+ };
+
+ /**
+ * Cluster status
+ */
+ struct ndb_mgm_cluster_state {
+ int no_of_nodes; ///< No of entries in the
+ ///< node_states array
+ struct ndb_mgm_node_state ///< An array with node_states
+ node_states[1];
+ };
+
+ /**
+ * Default reply from the server
+ */
+ struct ndb_mgm_reply {
+ int return_code; ///< 0 if successful,
+ ///< otherwise error code.
+ char message[256]; ///< Error or reply message.
+ };
+
+ /**
+ * Default information types
+ */
+ enum ndb_mgm_info {
+ NDB_MGM_INFO_CLUSTER, ///< ?
+ NDB_MGM_INFO_CLUSTERLOG ///< Cluster log
+ };
+
+ /**
+ * Signal log modes
+ * (Used only in the development of NDB Cluster.)
+ */
+ enum ndb_mgm_signal_log_mode {
+ NDB_MGM_SIGNAL_LOG_MODE_IN, ///< Log receiving signals
+ NDB_MGM_SIGNAL_LOG_MODE_OUT, ///< Log sending signals
+ NDB_MGM_SIGNAL_LOG_MODE_INOUT, ///< Log both sending/receiving
+ NDB_MGM_SIGNAL_LOG_MODE_OFF ///< Log off
+ };
+
+ /**
+ * Log severities (used to filter the cluster log)
+ */
+ enum ndb_mgm_clusterlog_level {
+ NDB_MGM_CLUSTERLOG_OFF = 0, ///< Cluster log off
+ NDB_MGM_CLUSTERLOG_DEBUG = 1, ///< Used in NDB Cluster
+ ///< developement
+ NDB_MGM_CLUSTERLOG_INFO = 2, ///< Informational messages
+ NDB_MGM_CLUSTERLOG_WARNING = 3, ///< Conditions that are not
+ ///< error condition, but
+ ///< might require handling
+ NDB_MGM_CLUSTERLOG_ERROR = 4, ///< Conditions that should be
+ ///< corrected
+ NDB_MGM_CLUSTERLOG_CRITICAL = 5, ///< Critical conditions, like
+ ///< device errors or out of
+ ///< resources
+ NDB_MGM_CLUSTERLOG_ALERT = 6, ///< A condition that should be
+ ///< corrected immediately,
+ ///< such as a corrupted system
+ NDB_MGM_CLUSTERLOG_ALL = 7 ///< All severities on
+ };
+
+ /**
+ * Log categories
+ */
+ enum ndb_mgm_event_category {
+ NDB_MGM_EVENT_CATEGORY_STARTUP, ///< Events during all kinds
+ ///< of startups
+ NDB_MGM_EVENT_CATEGORY_SHUTDOWN, ///< Events during shutdown
+ NDB_MGM_EVENT_CATEGORY_STATISTIC, ///< Transaction statistics
+ ///< (Job level, TCP/IP speed)
+ NDB_MGM_EVENT_CATEGORY_CHECKPOINT, ///< Checkpoints
+ NDB_MGM_EVENT_CATEGORY_NODE_RESTART, ///< Events during node restart
+ NDB_MGM_EVENT_CATEGORY_CONNECTION, ///< Events related to connection
+ ///< and communication
+ NDB_MGM_EVENT_CATEGORY_ERROR ///< Assorted event w.r.t.
+ ///< unexpected happenings
+ };
+
+ /***************************************************************************/
+ /**
+ * @name Functions: Error Handling
+ * @{
+ */
+
+ /**
+ * Get latest error associated with a management server handle
+ *
+ * @param handle Management handle
+ * @return Latest error code
+ */
+ int ndb_mgm_get_latest_error(const NdbMgmHandle handle);
+
+ /**
+ * Get latest main error message associated with a handle
+ *
+ * @param handle Management handle.
+ * @return Latest error message
+ */
+ const char * ndb_mgm_get_latest_error_msg(const NdbMgmHandle handle);
+
+ /**
+ * Get latest error description associated with a handle
+ *
+ * The error description gives some additional information to
+ * the error message.
+ *
+ * @param handle Management handle.
+ * @return Latest error description
+ */
+ const char * ndb_mgm_get_latest_error_desc(const NdbMgmHandle handle);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * Get latest internal source code error line associated with a handle
+ *
+ * @param handle Management handle.
+ * @return Latest internal source code line of latest error
+ * @deprecated
+ */
+ int ndb_mgm_get_latest_error_line(const NdbMgmHandle handle);
+#endif
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Create/Destroy Management Server Handles
+ * @{
+ */
+
+ /**
+ * Create a handle to a management server
+ *
+ * @return A management handle<br>
+ * or NULL if no management handle could be created.
+ */
+ NdbMgmHandle ndb_mgm_create_handle();
+
+ /**
+ * Destroy a management server handle
+ *
+ * @param handle Management handle
+ */
+ void ndb_mgm_destroy_handle(NdbMgmHandle * handle);
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Connect/Disconnect Management Server
+ * @{
+ */
+
+ /**
+ * Connect to a management server
+ *
+ * @param handle Management handle.
+ * @param mgmsrv Hostname and port of the management server,
+ * "hostname:port".
+ * @return -1 on error.
+ */
+ int ndb_mgm_connect(NdbMgmHandle handle, const char * mgmsrv);
+
+ /**
+ * Disconnect from a management server
+ *
+ * @param handle Management handle.
+ * @return -1 on error.
+ */
+ int ndb_mgm_disconnect(NdbMgmHandle handle);
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Convert between different data formats
+ * @{
+ */
+
+ /**
+ * Convert a string to a ndb_mgm_node_type
+ *
+ * @param type Node type as string.
+ * @return NDB_MGM_NODE_TYPE_UNKNOWN if invalid string.
+ */
+ enum ndb_mgm_node_type ndb_mgm_match_node_type(const char * type);
+
+ /**
+ * Convert an ndb_mgm_node_type to a string
+ *
+ * @param type Node type.
+ * @return NULL if invalid id.
+ */
+ const char * ndb_mgm_get_node_type_string(enum ndb_mgm_node_type type);
+
+ /**
+ * Convert a string to a ndb_mgm_node_status
+ *
+ * @param status NDB node status string.
+ * @return NDB_MGM_NODE_STATUS_UNKNOWN if invalid string.
+ */
+ enum ndb_mgm_node_status ndb_mgm_match_node_status(const char * status);
+
+ /**
+ * Convert an id to a string
+ *
+ * @param status NDB node status.
+ * @return NULL if invalid id.
+ */
+ const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status);
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: State of cluster
+ * @{
+ */
+
+ /**
+ * Get status of the nodes in an NDB Cluster
+ *
+ * Note the caller must free the pointer returned.
+ *
+ * @param handle Management handle.
+ * @return Cluster state (or NULL on error).
+ */
+ struct ndb_mgm_cluster_state * ndb_mgm_get_status(NdbMgmHandle handle);
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Start/stop nodes
+ * @{
+ */
+
+ /**
+ * Stop database nodes
+ *
+ * @param handle Management handle.
+ * @param no_of_nodes no of database nodes<br>
+ * 0 - means all database nodes in cluster<br>
+ * n - Means stop n node(s) specified in the
+ * array node_list
+ * @param node_list List of node ids of database nodes to be stopped
+ * @return No of nodes stopped (or -1 on error)
+ *
+ * @note The function is equivalent
+ * to ndb_mgm_stop2(handle, no_of_nodes, node_list, 0)
+ */
+ int ndb_mgm_stop(NdbMgmHandle handle, int no_of_nodes,
+ const int * node_list);
+
+ /**
+ * Stop database nodes
+ *
+ * @param handle Management handle.
+ * @param no_of_nodes No of database nodes<br>
+ * 0 - means all database nodes in cluster<br>
+ * n - Means stop n node(s) specified in
+ * the array node_list
+ * @param node_list List of node ids of database nodes to be stopped
+ * @param abort Don't perform gracefull stop,
+ * but rather stop immediatly
+ * @return No of nodes stopped (or -1 on error).
+ */
+ int ndb_mgm_stop2(NdbMgmHandle handle, int no_of_nodes,
+ const int * node_list, int abort);
+
+ /**
+ * Restart database nodes
+ *
+ * @param handle Management handle.
+ * @param no_of_nodes No of database nodes<br>
+ * 0 - means all database nodes in cluster<br>
+ * n - Means stop n node(s) specified in the
+ * array node_list
+ * @param node_list List of node ids of database nodes to be stopped
+ * @return No of nodes stopped (or -1 on error).
+ *
+ * @note The function is equivalent to
+ * ndb_mgm_restart2(handle, no_of_nodes, node_list, 0, 0, 0);
+ */
+ int ndb_mgm_restart(NdbMgmHandle handle, int no_of_nodes,
+ const int * node_list);
+
+ /**
+ * Restart database nodes
+ *
+ * @param handle Management handle.
+ * @param no_of_nodes No of database nodes<br>
+ * 0 - means all database nodes in cluster<br>
+ * n - Means stop n node(s) specified in the
+ * array node_list
+ * @param node_list List of node ids of database nodes to be stopped
+ * @param initial Remove filesystem from node(s) restarting
+ * @param nostart Don't actually start node(s) but leave them
+ * waiting for start command
+ * @param abort Don't perform gracefull restart,
+ * but rather restart immediatly
+ * @return No of nodes stopped (or -1 on error).
+ */
+ int ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes,
+ const int * node_list, int initial,
+ int nostart, int abort);
+
+ /**
+ * Start database nodes
+ *
+ * @param handle Management handle.
+ * @param no_of_nodes No of database nodes<br>
+ * 0 - means all database nodes in cluster<br>
+ * n - Means start n node(s) specified in
+ * the array node_list
+ * @param node_list List of node ids of database nodes to be started
+ * @return No of nodes started (or -1 on error).
+ *
+ * @note The nodes to start must have been started with nostart(-n)
+ * argument.
+ * This means that the database node binary is started and
+ * waiting for a START management command which will
+ * actually start the database node functionality
+ */
+ int ndb_mgm_start(NdbMgmHandle handle,
+ int no_of_nodes,
+ const int * node_list);
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Logging and Statistics
+ * @{
+ */
+
+ /**
+ * Filter cluster log
+ *
+ * @param handle NDB management handle.
+ * @param level A cluster log level to filter.
+ * @param reply Reply message.
+ * @return -1 on error.
+ */
+ int ndb_mgm_filter_clusterlog(NdbMgmHandle handle,
+ enum ndb_mgm_clusterlog_level level,
+ struct ndb_mgm_reply* reply);
+
+ /**
+ * Get log filter
+ *
+ * @param handle NDB management handle
+ * @return A vector of seven elements,
+ * where each element contains
+ * 1 if a severity is enabled and 0 if not.
+ * A severity is stored at position
+ * ndb_mgm_clusterlog_level,
+ * for example the "error" level is stored in position
+ * [NDB_MGM_CLUSTERLOG_ERROR-1].
+ * The first element in the vector signals
+ * whether the clusterlog
+ * is disabled or enabled.
+ */
+ unsigned int *ndb_mgm_get_logfilter(NdbMgmHandle handle);
+
+ /**
+ * Set log category and levels for the cluster log
+ *
+ * @param handle NDB management handle.
+ * @param nodeId Node id.
+ * @param category Event category.
+ * @param level Log level (0-15).
+ * @param reply Reply message.
+ * @return -1 on error.
+ */
+ int ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle,
+ int nodeId,
+ /*enum ndb_mgm_event_category category*/
+ char * category,
+ int level,
+ struct ndb_mgm_reply* reply);
+
+ /**
+ * Set log category and levels for the Node
+ *
+ * @param handle NDB management handle.
+ * @param nodeId Node id.
+ * @param category Event category.
+ * @param level Log level (0-15).
+ * @param reply Reply message.
+ * @return -1 on error.
+ */
+ int ndb_mgm_set_loglevel_node(NdbMgmHandle handle,
+ int nodeId,
+ /*enum ndb_mgm_event_category category*/
+ char * category,
+ int level,
+ struct ndb_mgm_reply* reply);
+
+ /**
+ * Returns the port number where statistics information is sent
+ *
+ * @param handle NDB management handle.
+ * @param reply Reply message.
+ * @return -1 on error.
+ */
+ int ndb_mgm_get_stat_port(NdbMgmHandle handle,
+ struct ndb_mgm_reply* reply);
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Backup
+ * @{
+ */
+
+ /**
+ * Start backup
+ *
+ * @param handle NDB management handle.
+ * @param backup_id Backup id is returned from function.
+ * @param reply Reply message.
+ * @return -1 on error.
+ */
+ int ndb_mgm_start_backup(NdbMgmHandle handle, unsigned int* backup_id,
+ struct ndb_mgm_reply* reply);
+
+ /**
+ * Abort backup
+ *
+ * @param handle NDB management handle.
+ * @param backup_id Backup Id.
+ * @param reply Reply message.
+ * @return -1 on error.
+ */
+ int ndb_mgm_abort_backup(NdbMgmHandle handle, unsigned int backup_id,
+ struct ndb_mgm_reply* reply);
+
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Single User Mode
+ * @{
+ */
+
+ /**
+ * Enter Single user mode
+ *
+ * @param handle NDB management handle.
+ * @param nodeId Node Id of the single user node
+ * @param reply Reply message.
+ * @return -1 on error.
+ */
+ int ndb_mgm_enter_single_user(NdbMgmHandle handle, unsigned int nodeId,
+ struct ndb_mgm_reply* reply);
+
+ /**
+ * Exit Single user mode
+ *
+ * @param handle NDB management handle.
+ * @param nodeId Node Id of the single user node
+ * @param reply Reply message.
+ * @return -1 on error.
+ */
+ int ndb_mgm_exit_single_user(NdbMgmHandle handle,
+ struct ndb_mgm_reply* reply);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif
diff --git a/ndb/include/mgmapi/mgmapi_debug.h b/ndb/include/mgmapi/mgmapi_debug.h
new file mode 100644
index 00000000000..2723263e7a7
--- /dev/null
+++ b/ndb/include/mgmapi/mgmapi_debug.h
@@ -0,0 +1,114 @@
+/* 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 MGMAPI_DEBUG_H
+#define MGMAPI_DEBUG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /**
+ * Start signal logging.
+ *
+ * @param handle the NDB management handle.
+ * @param nodeId the node Id.
+ * @param reply the reply message.
+ * @return 0 if successful.
+ */
+ int ndb_mgm_start_signallog(NdbMgmHandle handle,
+ int nodeId,
+ struct ndb_mgm_reply* reply);
+
+ /**
+ * Stop signal logging.
+ *
+ * @param handle the NDB management handle.
+ * @param nodeId the node Id.
+ * @param reply the reply message.
+ * @return 0 if successful.
+ */
+ int ndb_mgm_stop_signallog(NdbMgmHandle handle,
+ int nodeId,
+ struct ndb_mgm_reply* reply);
+
+ /**
+ * Set the signals to log.
+ *
+ * @param handle the NDB management handle.
+ * @param nodeId the node id.
+ * @param mode the signal log mode.
+ * @param blockNames the block names (space separated).
+ * @param reply the reply message.
+ * @return 0 if successful or an error code.
+ */
+ int ndb_mgm_log_signals(NdbMgmHandle handle,
+ int nodeId,
+ enum ndb_mgm_signal_log_mode mode,
+ const char* blockNames,
+ struct ndb_mgm_reply* reply);
+
+ /**
+ * Set trace.
+ *
+ * @param handle the NDB management handle.
+ * @param nodeId the node id.
+ * @param traceNumber the trace number.
+ * @param reply the reply message.
+ * @return 0 if successful or an error code.
+ */
+ int ndb_mgm_set_trace(NdbMgmHandle handle,
+ int nodeId,
+ int traceNumber,
+ struct ndb_mgm_reply* reply);
+
+ /**
+ * Provoke an error.
+ *
+ * @param handle the NDB management handle.
+ * @param nodeId the node id.
+ * @param errrorCode the errorCode.
+ * @param reply the reply message.
+ * @return 0 if successful or an error code.
+ */
+ int ndb_mgm_insert_error(NdbMgmHandle handle,
+ int nodeId,
+ int errorCode,
+ struct ndb_mgm_reply* reply);
+
+ /**
+ * Dump state
+ *
+ * @param handle the NDB management handle.
+ * @param nodeId the node id.
+ * @param args integer array
+ * @param number of args in int array
+ * @param reply the reply message.
+ * @return 0 if successful or an error code.
+ */
+ int ndb_mgm_dump_state(NdbMgmHandle handle,
+ int nodeId,
+ int * args,
+ int num_args,
+ struct ndb_mgm_reply* reply);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/ndb/include/mgmcommon/ConfigRetriever.hpp b/ndb/include/mgmcommon/ConfigRetriever.hpp
new file mode 100644
index 00000000000..ff60e730d45
--- /dev/null
+++ b/ndb/include/mgmcommon/ConfigRetriever.hpp
@@ -0,0 +1,116 @@
+/* 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 ConfigRetriever_H
+#define ConfigRetriever_H
+
+#include <ndb_types.h>
+#include <Properties.hpp>
+
+/**
+ * @class ConfigRetriever
+ * @brief Used by nodes (DB, MGM, API) to get their config from MGM server.
+ */
+class ConfigRetriever {
+public:
+ ConfigRetriever();
+ ConfigRetriever(const int id, const char* remoteHost, const int port);
+ ~ConfigRetriever();
+
+ /**
+ * Read local config
+ * @return Own node id, -1 means fail
+ */
+ int init(bool onlyNodeId = false);
+
+ /**
+ * Get configuration for current (nodeId given in local config file) node.
+ *
+ * Configuration is fetched from one MGM server configured in local config
+ * file. The method loops over all the configured MGM servers and tries
+ * 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,
+ * NULL if erroneous local config file or configuration error.
+ */
+ class Properties * getConfig(const char * nodeType, int versionId);
+
+ const char * getErrorString();
+
+ /**
+ * Sets connectstring which can be used instead of local config file
+ */
+ void setConnectString(const char * connectString);
+
+ /**
+ * Sets name of local config file (usually not needed)
+ */
+ void setLocalConfigFileName(const char * connectString);
+
+ /**
+ * Sets connectstring which can be used instead of local config file
+ * environment variables and Ndb.cfg has precidence over this
+ */
+ void setDefaultConnectString(const char * defaultConnectString);
+
+ /**
+ * @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);
+ /**
+ * Get config from file
+ */
+ class Properties * getConfig(const char * filename, Uint32 nodeId,
+ int versionId);
+private:
+ char * errorString;
+ enum ErrorType {
+ CR_ERROR = 0,
+ CR_RETRY = 1
+ };
+ ErrorType latestErrorType;
+
+ 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;
+};
+
+#endif
+
+
diff --git a/ndb/include/mgmcommon/IPCConfig.hpp b/ndb/include/mgmcommon/IPCConfig.hpp
new file mode 100644
index 00000000000..626242865cb
--- /dev/null
+++ b/ndb/include/mgmcommon/IPCConfig.hpp
@@ -0,0 +1,79 @@
+/* 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 IPCConfig_H
+#define IPCConfig_H
+
+#include <ndb_types.h>
+#include <ndb_limits.h>
+#include <kernel_types.h>
+#include <Properties.hpp>
+
+/**
+ * @class IPCConfig
+ * @brief Config transporters in TransporterRegistry using Properties config
+ */
+class IPCConfig
+{
+public:
+ IPCConfig(Properties * props);
+ ~IPCConfig();
+
+ /** @return 0 for OK */
+ int init();
+
+ NodeId ownId() const;
+
+ /** @return No of transporters configured */
+ int configureTransporters(class TransporterRegistry * theTransporterRegistry);
+
+ /**
+ * Supply a nodeId,
+ * and get next higher node id
+ * @return false if none found, true otherwise
+ *
+ * getREPHBFrequency and getNodeType uses the last Id supplied to
+ * getNextRemoteNodeId.
+ */
+ bool getNextRemoteNodeId(NodeId & nodeId) const;
+ Uint32 getREPHBFrequency(NodeId id) const;
+ const char* getNodeType(NodeId id) const;
+
+ NodeId getNoOfRemoteNodes() const {
+ return theNoOfRemoteNodes;
+ }
+
+ void print() const { props->print(); }
+
+private:
+ NodeId the_ownId;
+ Properties * props;
+
+ bool addRemoteNodeId(NodeId nodeId);
+ NodeId theNoOfRemoteNodes;
+ NodeId theRemoteNodeIds[MAX_NODES];
+};
+
+inline
+NodeId
+IPCConfig::ownId() const
+{
+ return the_ownId;
+}
+
+
+
+#endif // IPCConfig_H
diff --git a/ndb/include/mgmcommon/MgmtErrorReporter.hpp b/ndb/include/mgmcommon/MgmtErrorReporter.hpp
new file mode 100644
index 00000000000..acc44b14d8e
--- /dev/null
+++ b/ndb/include/mgmcommon/MgmtErrorReporter.hpp
@@ -0,0 +1,74 @@
+/* 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 */
+
+//******************************************************************************
+// Description: This file contains the error reporting macros to be used
+// within management server.
+//
+// Author: Peter Lind
+//******************************************************************************
+
+
+#include <NdbOut.hpp>
+#include <stdlib.h> // exit
+
+#define REPORT_WARNING(message) \
+ ndbout << "WARNING: " << message << endl
+
+//****************************************************************************
+// Description: Report a warning, the message is printed on ndbout.
+// Parameters:
+// message: A text describing the warning.
+// Returns: -
+//****************************************************************************
+
+
+#define REPORT_ERROR(message) \
+ ndbout << "ERROR: " << message << endl
+
+//****************************************************************************
+// Description: Report an error, the message is printed on ndbout.
+// Parameters:
+// message: A text describing the error.
+// Returns: -
+//****************************************************************************
+
+
+#ifdef MGMT_TRACE
+
+#define TRACE(message) \
+ ndbout << "MGMT_TRACE: " << message << endl
+#else
+#define TRACE(message)
+
+#endif
+
+//****************************************************************************
+// Description: Print a message on ndbout.
+// Parameters:
+// message: The message
+// Returns: -
+//****************************************************************************
+
+#ifndef NDB_ASSERT
+#define NDB_ASSERT(trueToContinue, message) \
+ if ( !(trueToContinue) ) { \
+ndbout << "ASSERT FAILED. FILE: " << __FILE__ << ", LINE: " << __LINE__ << ", MSG: " << message << endl;exit(-1);}
+#endif
+
+#define MGM_REQUIRE(x) \
+ if (!(x)) { ndbout << __FILE__ << " " << __LINE__ \
+ << ": Warning! Requirement failed" << endl; }
diff --git a/ndb/include/mgmcommon/NdbConfig.h b/ndb/include/mgmcommon/NdbConfig.h
new file mode 100644
index 00000000000..d9b484edcc5
--- /dev/null
+++ b/ndb/include/mgmcommon/NdbConfig.h
@@ -0,0 +1,34 @@
+/* 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 NDB_CONFIG_H
+#define NDB_CONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const char* NdbConfig_HomePath(char* buf, int buflen);
+
+const char* NdbConfig_NdbCfgName(char* buf, int buflen, int with_ndb_home);
+const char* NdbConfig_ErrorFileName(char* buf, int buflen);
+const char* NdbConfig_ClusterLogFileName(char* buf, int buflen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ndb/include/ndb_types.h b/ndb/include/ndb_types.h
new file mode 100644
index 00000000000..40d73b0f230
--- /dev/null
+++ b/ndb/include/ndb_types.h
@@ -0,0 +1,51 @@
+/* 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 */
+
+/**
+ * @file ndb_types.h
+ */
+
+#ifndef SYS_TYPES_H
+#define SYS_TYPES_H
+
+#include <sys/types.h>
+#include <stddef.h>
+
+typedef char Int8;
+typedef unsigned char Uint8;
+typedef short Int16;
+typedef unsigned short Uint16;
+typedef int Int32;
+typedef unsigned int Uint32;
+
+typedef unsigned int UintR;
+
+#ifdef __SIZE_TYPE__
+typedef __SIZE_TYPE__ UintPtr;
+#else
+#include <stdint.h>
+typedef uintptr_t UintPtr;
+#endif
+
+#if defined(WIN32) || defined(NDB_WIN32)
+typedef unsigned __int64 Uint64;
+typedef __int64 Int64;
+#else
+typedef unsigned long long Uint64;
+typedef long long Int64;
+#endif
+
+#endif
diff --git a/ndb/include/ndb_version.h b/ndb/include/ndb_version.h
new file mode 100644
index 00000000000..958dd339f74
--- /dev/null
+++ b/ndb/include/ndb_version.h
@@ -0,0 +1,53 @@
+/* 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 NDB_VERSION_H
+#define NDB_VERSION_H
+
+#include <stdio.h>
+#include <string.h>
+
+#include <version.h>
+
+#define MAKE_VERSION(A,B,C) (((A) << 16) | ((B) << 8) | ((C) << 0))
+
+/**
+ * version of this build
+ */
+
+#define NDB_VERSION_MAJOR 3
+#define NDB_VERSION_MINOR 5
+#define NDB_VERSION_BUILD 0
+#define NDB_VERSION_STATUS "alpha"
+
+#define NDB_VERSION_D MAKE_VERSION(NDB_VERSION_MAJOR, NDB_VERSION_MINOR, NDB_VERSION_BUILD)
+
+#define NDB_VERSION_STRING (getVersionString(NDB_VERSION, NDB_VERSION_STATUS))
+
+#define NDB_VERSION_TAG_STRING "$Name: $"
+
+#define NDB_VERSION ndbGetOwnVersion()
+
+/**
+ * Version id
+ *
+ * Used by transporter and when communicating with
+ * managment server
+ */
+//#define NDB_VERSION_ID 0
+
+#endif
+
diff --git a/ndb/include/ndbapi/AttrType.hpp b/ndb/include/ndbapi/AttrType.hpp
new file mode 100644
index 00000000000..e6e00c77130
--- /dev/null
+++ b/ndb/include/ndbapi/AttrType.hpp
@@ -0,0 +1,329 @@
+/* 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 */
+
+/**
+ * @file AttrType.hpp
+ */
+
+#ifndef AttrType_H
+#define AttrType_H
+
+/**
+ * Max number of Ndb objects in different threads.
+ * (Ndb objects should not be shared by different threads.)
+ */
+const unsigned MAX_NO_THREADS = 4711;
+
+/**
+ * Max number of attributes in a table.
+ */
+const unsigned MAXNROFATTRIBUTES = 128;
+
+/**
+ * Max number of tuple keys for a table in NDB Cluster.
+ *
+ * A <em>tuple key</em> of a table is an attribute
+ * which is either part of the
+ * <em>primary key</em> or the <em>tuple id</em> of a table.
+ */
+const unsigned MAXNROFTUPLEKEY = 16;
+
+/**
+ * Max number of words in a tuple key attribute.
+ *
+ * Tuple keys can not have values larger than
+ * 4092 bytes (i.e. 1023 words).
+ */
+const unsigned MAXTUPLEKEYLENOFATTERIBUTEINWORD = 1023;
+
+/**
+ * Max number of ErrorCode in NDB Cluster range 0 - 1999.
+ */
+const unsigned MAXNDBCLUSTERERROR = 1999;
+
+/**
+ * Max number of theErrorCode NDB API range 4000 - 4999.
+ */
+const unsigned MAXNROFERRORCODE = 5000;
+
+/**
+ * <i>Missing explanation</i>
+ */
+enum ReturnType {
+ ReturnSuccess, ///< <i>Missing explanation</i>
+ ReturnFailure ///< <i>Missing explanation</i>
+};
+
+/**
+ *
+ */
+enum SendStatusType {
+ NotInit, ///< <i>Missing explanation</i>
+ InitState, ///< <i>Missing explanation</i>
+ sendOperations, ///< <i>Missing explanation</i>
+ sendCompleted, ///< <i>Missing explanation</i>
+ sendCOMMITstate, ///< <i>Missing explanation</i>
+ sendABORT, ///< <i>Missing explanation</i>
+ sendABORTfail, ///< <i>Missing explanation</i>
+ sendTC_ROLLBACK, ///< <i>Missing explanation</i>
+ sendTC_COMMIT, ///< <i>Missing explanation</i>
+ sendTC_OP ///< <i>Missing explanation</i>
+};
+
+/**
+ * <i>Missing explanation</i>
+ */
+enum ListState {
+ NotInList, ///< <i>Missing explanation</i>
+ InPreparedList, ///< <i>Missing explanation</i>
+ InSendList, ///< <i>Missing explanation</i>
+ InCompletedList ///< <i>Missing explanation</i>
+};
+
+/**
+ * Commit status of the transaction
+ */
+enum CommitStatusType {
+ NotStarted, ///< Transaction not yet started
+ Started, ///< <i>Missing explanation</i>
+ Committed, ///< Transaction has been committed
+ Aborted, ///< Transaction has been aborted
+ NeedAbort ///< <i>Missing explanation</i>
+};
+
+/**
+ * Commit type of transaction
+ */
+enum AbortOption {
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ CommitIfFailFree = 0,
+ CommitAsMuchAsPossible = 2, ///< Commit transaction with as many
+ TryCommit = 0, ///< <i>Missing explanation</i>
+#endif
+ AbortOnError = 0, ///< Abort transaction on failed operation
+ IgnoreError = 2 ///< Transaction continues on failed operation
+};
+
+typedef AbortOption CommitType;
+
+/**
+ * <i>Missing explanation</i>
+ */
+enum InitType {
+ NotConstructed, ///< <i>Missing explanation</i>
+ NotInitialised, ///< <i>Missing explanation</i>
+ StartingInit, ///< <i>Missing explanation</i>
+ Initialised, ///< <i>Missing explanation</i>
+ InitConfigError ///< <i>Missing explanation</i>
+};
+
+/**
+ * Type of attribute
+ */
+enum AttrType {
+ Signed, ///< Attributes of this type can be read with:
+ ///< NdbRecAttr::int64_value,
+ ///< NdbRecAttr::int32_value,
+ ///< NdbRecAttr::short_value,
+ ///< NdbRecAttr::char_value
+ UnSigned, ///< Attributes of this type can be read with:
+ ///< NdbRecAttr::u_64_value,
+ ///< NdbRecAttr::u_32_value,
+ ///< NdbRecAttr::u_short_value,
+ ///< NdbRecAttr::u_char_value
+ Float, ///< Attributes of this type can be read with:
+ ///< NdbRecAttr::float_value and
+ ///< NdbRecAttr::double_value
+ String, ///< Attributes of this type can be read with:
+ ///< NdbRecAttr::aRef,
+ ///< NdbRecAttr::getAttributeObject
+ NoAttrTypeDef ///< Used for debugging only
+};
+
+/**
+ * Execution type of transaction
+ */
+enum ExecType {
+ NoExecTypeDef = -1, ///< Erroneous type (Used for debugging only)
+ Prepare, ///< <i>Missing explanation</i>
+ NoCommit, ///< Execute the transaction as far as it has
+ ///< been defined, but do not yet commit it
+ Commit, ///< Execute and try to commit the transaction
+ Rollback ///< Rollback transaction
+};
+
+/**
+ * Indicates whether the attribute is part of a primary key or not
+ */
+enum KeyType {
+ Undefined = -1, ///< Used for debugging only
+ NoKey, ///< Attribute is not part of primary key
+ ///< or tuple identity
+ TupleKey, ///< Attribute is part of primary key
+ TupleId ///< Attribute is part of tuple identity
+ ///< (This type of attribute is created
+ ///< internally, and should not be
+ ///< manually created.)
+};
+
+/**
+ * Indicate whether the attribute should be stored on disk or not
+ */
+enum StorageMode {
+ MMBased = 0, ///< Main memory
+ DiskBased = 1, ///< Disk (Not yet supported.)
+ NoStorageTypeDef ///< Used for debugging only
+};
+
+/**
+ * Where attribute is stored.
+ *
+ * This is used to indicate whether a primary key
+ * should only be stored in the index storage and not in the data storage
+ * or if it should be stored in both places.
+ * The first alternative makes the attribute take less space,
+ * but makes it impossible to scan using attribute.
+ *
+ * @note Use NormalStorageAttribute for most cases.
+ * (IndexStorageAttribute should only be used on primary key
+ * attributes and only if you do not want to scan using the attribute.)
+ */
+enum StorageAttributeType {
+ NoStorageAttributeTypeDefined = -1, ///< <i>Missing explanation</i>
+ IndexStorageAttribute, ///< Attribute is only stored in
+ ///< index storage (ACC)
+ NormalStorageAttribute ///< Attribute values are stored
+ ///< both in the index (ACC) and
+ ///< in the data storage (TUP)
+};
+
+/**
+ * <i>Missing explanation</i>
+ */
+enum OperationStatus{
+ Init, ///< <i>Missing explanation</i>
+ OperationDefined, ///< <i>Missing explanation</i>
+ TupleKeyDefined, ///< <i>Missing explanation</i>
+ GetValue, ///< <i>Missing explanation</i>
+ SetValue, ///< <i>Missing explanation</i>
+ ExecInterpretedValue, ///< <i>Missing explanation</i>
+ SetValueInterpreted, ///< <i>Missing explanation</i>
+ FinalGetValue, ///< <i>Missing explanation</i>
+ SubroutineExec, ///< <i>Missing explanation</i>
+ SubroutineEnd, ///< <i>Missing explanation</i>
+ SetBound, ///< Setting bounds in range scan
+ WaitResponse, ///< <i>Missing explanation</i>
+ WaitCommitResponse, ///< <i>Missing explanation</i>
+ Finished, ///< <i>Missing explanation</i>
+ ReceiveFinished ///< <i>Missing explanation</i>
+};
+
+/**
+ * Type of operation
+ */
+enum OperationType {
+ ReadRequest = 0, ///< Read operation
+ UpdateRequest = 1, ///< Update Operation
+ InsertRequest = 2, ///< Insert Operation
+ DeleteRequest = 3, ///< Delete Operation
+ WriteRequest = 4, ///< Write Operation
+ ReadExclusive = 5, ///< Read exclusive
+ OpenScanRequest, ///< Scan Operation
+ OpenRangeScanRequest, ///< Range scan operation
+ NotDefined2, ///< <i>Missing explanation</i>
+ NotDefined ///< <i>Missing explanation</i>
+};
+
+/**
+ * <i>Missing explanation</i>
+ */
+enum ConStatusType {
+ NotConnected, ///< <i>Missing explanation</i>
+ Connecting, ///< <i>Missing explanation</i>
+ Connected, ///< <i>Missing explanation</i>
+ DisConnecting, ///< <i>Missing explanation</i>
+ ConnectFailure ///< <i>Missing explanation</i>
+};
+
+/**
+ * <i>Missing explanation</i>
+ */
+enum CompletionStatus {
+ NotCompleted, ///< <i>Missing explanation</i>
+ CompletedSuccess, ///< <i>Missing explanation</i>
+ CompletedFailure, ///< <i>Missing explanation</i>
+ DefinitionFailure ///< <i>Missing explanation</i>
+};
+
+/**
+ * Type of fragmentation used for a table
+ */
+enum FragmentType {
+ Default = 0, ///< (All is default!)
+ Single = 1, ///< Only one fragment
+ All = 2, ///< Default value. One fragment per node group
+ DistributionGroup = 3, ///< Distribution Group used for fragmentation.
+ ///< One fragment per node group
+ DistributionKey = 4, ///< Distribution Key used for fragmentation.
+ ///< One fragment per node group.
+ AllLarge = 5, ///< Sixten fragments per node group.
+ DGroupLarge = 6, ///< Distribution Group used for fragmentation.
+ ///< Sixten fragments per node group
+ DKeyLarge = 7 ///< Distribution Key used for fragmentation.
+ ///< Sixten fragments per node group
+};
+
+/**
+ * Type of table or index.
+ */
+enum TableType {
+ UndefTableType = 0,
+ SystemTable = 1, ///< Internal. Table cannot be updated by user
+ UserTable = 2, ///< Normal application table
+ UniqueHashIndex = 3, ///< Unique un-ordered hash index
+ HashIndex = 4, ///< Non-unique un-ordered hash index
+ UniqueOrderedIndex = 5, ///< Unique ordered index
+ OrderedIndex = 6 ///< Non-unique ordered index
+};
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+/**
+ * Different types of tampering with the NDB Cluster.
+ * <b>Only for debugging purposes only.</b>
+ */
+enum TamperType {
+ LockGlbChp = 1, ///< Lock GCP
+ UnlockGlbChp, ///< Unlock GCP
+ CrashNode, ///< Crash an NDB node
+ ReadRestartGCI, ///< Request the restart GCI id from NDB Cluster
+ InsertError ///< Execute an error in NDB Cluster
+ ///< (may crash system)
+};
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+/**
+ * @deprecated
+ */
+enum NullAttributeType {
+ NoNullTypeDefined = -1,
+ NotNullAttribute,
+ NullAttribute,
+ AttributeDefined
+};
+#endif
+
+#endif
diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp
new file mode 100644
index 00000000000..59bdd212919
--- /dev/null
+++ b/ndb/include/ndbapi/Ndb.hpp
@@ -0,0 +1,1702 @@
+/* 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 */
+
+/**
+ @mainpage NDB API Programmers' Guide
+
+ This guide assumes a basic familiarity with NDB Cluster concepts.
+ Some of the fundamental ones are described in section @ref secConcepts.
+
+ The <em>NDB API</em> is an NDB Cluster application interface
+ that implements both synchronous and asynchronous transactions.
+ The NDB API consists of the following fundamental classes:
+ - Ndb is the main class representing the database,
+ - NdbConnection represents a transaction,
+ - NdbOperation represents a transaction operation using primary key,
+ - NdbIndexOperation represents a transaction operation using a secondary
+ index,
+ - NdbRecAttr represents the value of an attribute, and
+ - NdbDictionary represents meta information about tables and attributes.
+ - NdbError represents an error condition
+ There are also some auxiliary classes.
+
+ The main structure of an application program is as follows:
+ -# Construct and initialize Ndb object(s).
+ -# Define and execute (synchronous or asynchronous) transactions.
+ -# Delete Ndb objects
+
+ The main structure of a transaction is as follows:
+ -# Start transaction
+ -# Add and define operations (associated with the transaction)
+ -# Execute transaction
+
+ The execute can be of two different types,
+ <em>Commit</em> or <em>NoCommit</em>.
+ (The execute can also be divided into three
+ steps: prepare, send, and poll to get asynchronous
+ transactions. More about this later.)
+
+ If the execute is of type NoCommit,
+ then the application program executes part of a transaction,
+ but without committing the transaction.
+ After a NoCommit type of execute, the program can continue
+ to add and define more operations to the transaction
+ for later execution.
+
+ If the execute is of type Commit, then the transaction is
+ committed and no further adding and defining of operations
+ is allowed.
+
+
+ @section secSync Synchronous Transactions
+
+ Synchronous transactions are defined and executed in the following way.
+
+ -# Start (create) transaction (the transaction will be
+ referred to by an NdbConnection object,
+ typically created by Ndb::startTransaction).
+ At this step the transaction is being defined.
+ It is not yet sent to the NDB kernel.
+ -# Add and define operations to the transaction
+ (using NdbConnection::getNdbOperation and
+ methods from class NdbOperation).
+ The transaction is still not sent to the NDB kernel.
+ -# Execute the transaction (using NdbConnection::execute).
+ -# Close the transaction (using Ndb::closeTransaction).
+
+ See example program in section @ref ndbapi_example1.cpp.
+
+ To execute several parallel synchronous transactions, one can either
+ use multiple Ndb objects in several threads or start multiple
+ applications programs.
+ Another way to execute several parallel transactions is to use
+ asynchronous transactions.
+
+
+ @section secNdbOperations Operations
+
+ Each transaction (NdbConnection object) consist of a list of
+ operations (NdbOperation or NdbIndexOperation objects.
+ NdbIndexOperation is used for accessing tables through secondary indexes).
+ Operations are of two different kinds:
+ -# standard operations, and
+ -# interpreted program operations.
+
+ <h3>Standard Operations</h3>
+ After the operation is created using NdbConnection::getNdbOperation
+ (or NdbConnection::getNdbIndexOperation),
+ it is defined in the following three steps:
+ -# Defining standard operation type
+ (e.g. using NdbOperation::readTuple)
+ -# Specifying search conditions
+ (e.g. using NdbOperation::equal)
+ -# Specify attribute actions
+ (e.g. using NdbOperation::getValue)
+
+ Example code (using an NdbOperation):
+ @code
+ MyOperation = MyConnection->getNdbOperation("MYTABLENAME"); // 1. Create
+ if (MyOperation == NULL) APIERROR(MyConnection->getNdbError());
+
+ MyOperation->readTuple(); // 2. Define type of operation
+ MyOperation->equal("ATTR1", i); // 3. Specify Search Conditions
+
+ MyRecAttr = MyOperation->getValue("ATTR2", NULL); // 4. Attribute Actions
+ if (MyRecAttr == NULL) APIERROR(MyConnection->getNdbError());
+ @endcode
+ For more examples, see @ref ndbapi_example1.cpp and @ref ndbapi_example2.cpp.
+
+ Example code using an NdbIndexOperation:
+ @code
+ MyOperation = // 1. Create
+ MyConnection->getNdbIndexOperation("MYINDEX", "MYTABLENAME");
+ if (MyOperation == NULL) APIERROR(MyConnection->getNdbError());
+
+ MyOperation->readTuple(); // 2. Define type of operation
+ MyOperation->equal("ATTR1", i); // 3. Specify Search Conditions
+
+ MyRecAttr = MyOperation->getValue("ATTR2", NULL); // 4. Attribute Actions
+ if (MyRecAttr == NULL) APIERROR(MyConnection->getNdbError());
+ @endcode
+ For more examples, see @ref ndbapi_example4.cpp.
+
+
+ <h4>Step 1: Define Standard Operation Type</h4>
+ The following types of standard operations exist:
+ -# NdbOperation::insertTuple :
+ inserts a non-existing tuple
+ -# NdbOperation::writeTuple :
+ updates an existing tuple if is exists,
+ otherwise inserts a new tuple
+ -# NdbOperation::updateTuple :
+ updates an existing tuple
+ -# NdbOperation::deleteTuple :
+ deletes an existing tuple
+ -# NdbOperation::readTuple :
+ reads an existing tuple
+ -# NdbOperation::readTupleExclusive :
+ reads an existing tuple using an exclusive lock
+ -# NdbOperation::simpleRead :
+ reads an existing tuple (using shared read lock),
+ but releases lock immediately after read
+ -# NdbOperation::committedRead :
+ reads committed tuple
+ -# NdbOperation::dirtyUpdate :
+ updates an existing tuple, but releases lock immediately
+ after read (uses dirty lock)
+ -# NdbOperation::dirtyWrite :
+ updates or writes a tuple, but releases lock immediately
+ after read (uses dirty lock)
+
+ All of these operations operate on the unique tuple key.
+ (When NdbIndexOperation is used then all of these operations
+ operate on a defined secondary index.)
+
+
+ Some comments:
+ - NdbOperation::simpleRead and
+ NdbOperation::committedRead can execute on the same transaction
+ as the above operations but will release its locks immediately
+ after reading the tuple.
+ NdbOperation::simpleRead will always read the latest version
+ of the tuple.
+ Thus it will wait until it can acquire a shared read lock on
+ the tuple.
+ NdbOperation::committedRead will read the latest committed
+ version of the tuple.
+ <br>
+ Both NdbOperation::simpleRead and NdbOperation::committedRead
+ are examples of consistent reads which are not repeatable.
+ All reads read the latest version if updates were made by the same
+ transaction.
+ Errors on simple read are only reported by the NdbOperation object.
+ These error codes are not transferred to the NdbConnection object.
+ - NdbOperation::dirtyUpdate and NdbOperation::dirtyWrite
+ will execute in the same transaction
+ but will release the lock immediately after updating the
+ tuple.
+ It will wait on the lock until it can acquire an exclusive
+ write lock.
+ In a replicated version of NDB Cluster NdbOperation::dirtyUpdate
+ can lead to inconsistency between the replicas.
+ Examples of when it could be used is
+ to update statistical counters on tuples which are "hot-spots".
+
+ @note If you want to define multiple operations within the same transaction,
+ then you need to call NdbConnection::getNdbOperation
+ (or NdbConnection::getNdbIndexOperation) for each
+ operation.
+
+
+ <h4>Step 2: Specify Search Conditions</h4>
+ The search condition is used to select tuples.
+ (In the current NdbIndexOperation implementation
+ this means setting the value of
+ the secondary index attributes of the wanted tuple.)
+
+ If a tuple identity is used, then NdbOperation::setTupleId
+ is used to define the search key when inserting new tuples.
+ Otherwise, NdbOperation::equal is used.
+
+ For NdbOperation::insertTuple it is also allowed to define the
+ search key by using NdbOperation::setValue.
+ The NDB API will automatically detect that it is
+ supposed to use NdbOperation::equal instead.
+ For NdbOperation::insertTuple it is not necessary to use
+ NdbOperation::setValue on key attributes before other attributes.
+
+
+ <h4>Step 3: Specify Attribute Actions</h4>
+ Now it is time to define which attributes should be read or updated.
+ Deletes can neither read nor set values, read can only read values and
+ updates can only set values.
+ Normally the attribute is defined by its name but it is
+ also possible to use the attribute identity to define the
+ attribute.
+ The mapping from name to identity is performed by the Table object.
+
+ NdbIndexOperation::getValue returns an NdbRecAttr object
+ containing the read value.
+ To get the value, there is actually two methods.
+ The application can either
+ - use its own memory (passed through a pointer aValue) to
+ NdbIndexOperation::getValue, or
+ - receive the attribute value in an NdbRecAttr object allocated
+ by the NDB API.
+
+ The NdbRecAttr object is released when Ndb::closeTransaction
+ is called.
+ Thus, the application can not reference this object after
+ Ndb::closeTransaction have been called.
+ The result of reading data from an NdbRecAttr object before
+ calling NdbConnection::execute is undefined.
+
+
+
+ <h3>Interpreted Program Operations</h3>
+ The following types of interpreted program operations exist:
+ -# NdbOperation::interpretedUpdateTuple :
+ updates a tuple using an interpreted program
+ -# NdbOperation::interpretedDeleteTuple :
+ delete a tuple using an interpreted program
+ -# NdbOperation::openScanRead :
+ scans a table with read lock on each tuple
+ -# NdbOperation::openScanExclusive :
+ scans a table with exclusive update lock on each tuple
+
+ The operations interpretedUpdateTuple and interpretedDeleteTuple both
+ work using the unique tuple key.
+
+ These <em>interpreted programs</em>
+ make it possible to perform computations
+ inside the NDB Cluster Kernel instead of in the application
+ program.
+ This is sometimes very effective, since no intermediate results
+ are sent to the application, only the final result.
+
+
+ <h3>Interpreted Update and Delete</h3>
+
+ Operations for interpreted updates and deletes must follow a
+ certain order when defining operations on a tuple.
+ As for read and write operations,
+ one must first define the operation type and then the search key.
+ -# The first step is to define the initial readings.
+ In this phase it is only allowed to use the
+ NdbOperation::getValue method.
+ This part might be empty.
+ -# The second step is to define the interpreted part.
+ The methods supported are the methods listed below except
+ NdbOperation::def_subroutine and NdbOperation::ret_sub
+ which can only be used in a subroutine.
+ NdbOperation::incValue and NdbOperation::subValue
+ increment and decrement attributes
+ (currently only unsigned integers supported).
+ This part can also be empty since interpreted updates
+ can be used for reading and updating the same tuple.
+ <p>
+ Even though getValue and setValue are not really interpreted
+ program instructions, it is still allowed to use them as
+ the last instruction of the program.
+ (If a getValue or setValue is found when an interpret_exit_ok
+ could have been issued then the interpreted_exit_ok
+ will be inserted.
+ A interpret_exit_ok should be viewed as a jump to the first
+ instruction after the interpreted instructions.)
+ -# The third step is to define all updates without any
+ interpreted program instructions.
+ Here a set of NdbOperation::setValue methods are called.
+ There might be zero such calls.
+ -# The fourth step is the final readings.
+ The initial readings reads the initial value of attributes
+ and the final readings reads them after their updates.
+ There might be zero NdbOperation::getValue calls.
+ -# The fifth step is possible subroutine definitions using
+ NdbOperation::def_subroutine and NdbOperation::ret_sub.
+
+
+ @subsection secScan Scanning
+ The most common use of interpreted programs is for scanning
+ tables. Scanning is a search of all tuples in a table.
+ Tuples which satisfy conditions (a search filter)
+ stated in the interpreted program
+ are sent to the application.
+
+ Reasons for using scan transactions include
+ need to use a search key different from the primary key
+ and any secondary index.
+ Or that the query needs to access so many tuples so that
+ it is more efficient to scan the entire table.
+
+ Scanning can also be used to update information.
+ The scanning transaction itself is however
+ not allowed to update any tuples.
+ To do updates via scanning transactions, the tuples
+ need to be handed over to another transaction which is
+ executing the actual update.
+
+ Even though a scan operation is part of a transaction,
+ the scan transaction is not a normal transaction.
+ The locks are <em>not</em> kept throughout the entire
+ scan transaction, since this would imply non-optimal performance.
+ <em>
+ A transaction containing a scan operation can only
+ contain that operation.
+ No other operations are allowed in the same transaction.
+ </em>
+
+ The NdbOperation::openScanRead operation
+ only sets a temporary read lock while
+ reading the tuple.
+ The tuple lock is released already when the
+ result of the read reaches the application.
+ The NdbOperation::openScanExclusive operation sets an
+ exclusive lock on the tuple
+ and sends the result to the application.
+ Thus when the application reads the data it is still
+ locked with the exclusive lock.
+
+ If the application desires to update the tuple it may transfer
+ the tuple to another transaction which updates the tuple.
+ The updating transaction can consist of a combination of tuples
+ received from the scan and normal operations.
+
+ For transferred operations it is not necessary to provide the
+ primary key. It is part of the transfer.
+ You only need to give the operation type and the
+ actions to perform on the tuple.
+
+ The scan transaction starts like a usual transaction,
+ but is of the following form:
+ -# Start transaction
+ -# Get NdbOperation for the table to be scanned
+ -# Set the operation type using NdbOperation::openScanRead or
+ NdbOperation::openScanExclusive
+ -# Search conditions are defined by an interpreted program
+ (setValue and write_attr are not allowed, since scan transactions
+ are only allowed to read information).
+ The instruction interpret_exit_nok does in this case
+ not abort the transaction, it only skips the tuple and
+ proceeds with the next.
+ The skipped tuple will not be reported to the application.
+ -# Call NdbConnection::executeScan to define (and start) the scan.
+ -# Call NdbConnection::nextScanResult to proceed with next tuple.
+ When calling NdbConnection::nextScanResult, the lock on any
+ previous tuples are released.
+ <br>
+ If the tuple should be updated then it must be transferred over
+ to another updating transaction.
+ This is performed by calling
+ NdbOperation::takeOverForUpdate or takeOverForDelete on
+ the scanning transactions NdbOperation object with the updating
+ transactions NdbConnection object as parameter.
+ <p>
+ If NdbOperation::takeOverFor* returns NULL then the
+ operation was not successful, otherwise it returns a reference
+ to the NdbOperation which the updating transaction has received
+ -# Use Ndb::closeTransaction as usual to close the transaction.
+ This can be performed even if there are more tuples to scan.
+
+ See also example program in section @ref select_all.cpp.
+
+ However, a new scan api is under development, using NdbScanOperation
+ and NdbScanFilter. NdbScanFilter makes it easier to define a search
+ criteria and is recommended instead of using Interpreted Programs.
+
+ The scan transaction starts like a usual transaction,
+ but is of the following form:
+ -# Start transaction
+ -# Get NdbScanOperation for the table to be scanned
+ -# NdbScanOperation::readTuplesExclusive returns a handle to a
+ NdbResultSet.
+ -# Search conditions are defined by NdbScanFilter
+ -# Call NdbConnection::execute(NoCommit) to start the scan.
+ -# Call NdbResultSet::nextResult to proceed with next tuple.
+ When calling NdbResultSet::nextResult(false), the lock on any
+ previous tuples are released and the next tuple cached in the API
+ is fetched.
+ <br>
+ If the tuple should be updated then define a new update operation
+ (NdbOperation) using NdbResultSet::updateTuple().
+ The new update operation can the be used to modify the tuple.
+ When nextResult(false) returns != 0, then no more tuples
+ are cached in the API. Updated tuples is now commit using
+ NdbConnection::execute(Commit).
+ After the commit, more tuples are fetched from NDB using
+ nextResult(true).
+ -# Use Ndb::closeTransaction as usual to close the transaction.
+ This can be performed even if there are more tuples to scan.
+
+ See the scan example program in @ref ndbapi_scan.cppn for example
+ usage of the new scan api.
+
+
+ <h3>Interpreted Programs</h3>
+ Interpretation programs are executed in a
+ register-based virtual machine.
+ The virtual machine has eight 64 bit registers numbered 0-7.
+ Each register contains type information which is used both
+ for type conversion and for type checking.
+
+ @note Arrays are currently <b>not</b> supported in the virtual machine.
+ Currently only unsigned integers are supported and of size
+ maximum 64 bits.
+
+ All errors in the interpretation program will cause a
+ transaction abort, but will not affect any other transactions.
+
+ The following are legal interpreted program instructions:
+ -# incValue : Add to an attribute
+ -# subValue : Subtract from an attribute
+ -# def_label : Define a label in the interpreted program
+ -# add_reg : Add two registers
+ -# sub_reg : Subtract one register from another
+ -# load_const_u32 : Load an unsigned 32 bit value into a register
+ -# load_const_u64 : Load an unsigned 64 bit value into a register
+ -# load_const_null : Load a NULL value into a register
+ -# read_attr : Read attribute value into a register
+ -# write_attr : Write a register value into an attribute
+ -# branch_ge : Compares registers and possibly jumps to specified label
+ -# branch_gt : Compares registers and possibly jumps to specified label
+ -# branch_le : Compares registers and possibly jumps to specified label
+ -# branch_lt : Compares registers and possibly jumps to specified label
+ -# branch_eq : Compares registers and possibly jumps to specified label
+ -# branch_ne : Compares registers and possibly jumps to specified label
+ -# branch_ne_null : Jumps if register does not contain NULL value
+ -# branch_eq_null : Jumps if register contains NULL value
+ -# branch_label : Unconditional jump to label
+ -# interpret_exit_ok : Exit interpreted program
+ (approving tuple if used in scan)
+ -# interpret_exit_nok : Exit interpreted program
+ (disqualifying tuple if used in scan)
+
+ There are also three instructions for subroutines, which
+ are described in the next section.
+
+ @subsection subsubSub Interpreted Programs: Subroutines
+
+ The following are legal interpreted program instructions for
+ subroutines:
+ -# NdbOperation::def_subroutine :
+ Defines start of subroutine in interpreted program code
+ -# NdbOperation::call_sub :
+ Calls a subroutine
+ -# NdbOperation::ret_sub :
+ Return from subroutine
+
+ The virtual machine executes subroutines using a stack for
+ its operation.
+ The stack allows for up to 24 subroutine calls in succession.
+ Deeper subroutine nesting will cause an abort of the transaction.
+
+ All subroutines starts with the instruction
+ NdbOperation::def_subroutine and ends with the instruction
+ NdbOperation::ret_sub.
+ If it is necessary to return earlier in the subroutine
+ it has to be done using a branch_label instruction
+ to a label defined right before the
+ NdbOperation::ret_sub instruction.
+
+ @note The subroutines are automatically numbered starting with 0.
+ The parameter used by NdbOperation::def_subroutine
+ should match the automatic numbering to make it easier to
+ debug the interpreted program.
+
+
+ @section secAsync Asynchronous Transactions
+ The asynchronous interface is used to increase the speed of
+ transaction executing by better utilizing the connection
+ between the application and the NDB Kernel.
+ The interface is used to send many transactions
+ at the same time to the NDB kernel.
+ This is often much more efficient than using synchronous transactions.
+ The main reason for using this method is to ensure that
+ Sending many transactions at the same time ensures that bigger
+ chunks of data are sent when actually sending and thus decreasing
+ the operating system overhead.
+
+ The synchronous call to NdbConnection::execute
+ normally performs three main steps:<br>
+ -# <b>Prepare</b>
+ Check transaction status
+ - if problems, abort the transaction
+ - if ok, proceed
+ -# <b>Send</b>
+ Send the defined operations since last execute
+ or since start of transaction.
+ -# <b>Poll</b>
+ Wait for response from NDB kernel.
+
+ The asynchronous method NdbConnection::executeAsynchPrepare
+ only perform step 1.
+ (The abort part in step 1 is only prepared for. The actual
+ aborting of the transaction is performed in a later step.)
+
+ Asynchronous transactions are defined and executed
+ in the following way.
+ -# Start (create) transactions (same way as for the
+ synchronous transactions)
+ -# Add and define operations (also as in the synchronous case)
+ -# <b>Prepare</b> transactions
+ (using NdbConnection::executeAsynchPrepare or
+ NdbConnection::executeAsynch)
+ -# <b>Send</b> transactions to NDB Kernel
+ (using Ndb::sendPreparedTransactions,
+ NdbConnection::executeAsynch, or Ndb::sendPollNdb)
+ -# <b>Poll</b> NDB kernel to find completed transactions
+ (using Ndb::pollNdb or Ndb::sendPollNdb)
+ -# Close transactions (same way as for the synchronous transactions)
+
+ See example program in section @ref ndbapi_example2.cpp.
+
+ This prepare-send-poll protocol actually exists in four variants:
+ - (Prepare-Send-Poll). This is the one-step variant provided
+ by synchronous transactions.
+ - (Prepare-Send)-Poll. This is the two-step variant using
+ NdbConnection::executeAsynch and Ndb::pollNdb.
+ - Prepare-(Send-Poll). This is the two-step variant using
+ NdbConnection::executeAsynchPrepare and Ndb::sendPollNdb.
+ - Prepare-Send-Poll. This is the three-step variant using
+ NdbConnection::executeAsynchPrepare, Ndb::sendPreparedTransactions, and
+ Ndb::pollNdb.
+
+ Transactions first has to be prepared by using method
+ NdbConnection::executeAsynchPrepare or NdbConnection::executeAsynch.
+ The difference between these is that
+ NdbConnection::executeAsynch also sends the transaction to
+ the NDB kernel.
+ One of the arguments to these methods is a callback method.
+ The callback method is executed during polling (item 5 above).
+
+ Note that NdbConnection::executeAsynchPrepare does not
+ send the transaction to the NDB kernel. When using
+ NdbConnection::executeAsynchPrepare, you either have to call
+ Ndb::sendPreparedTransactions or Ndb::sendPollNdb to send the
+ database operations.
+ (Ndb::sendPollNdb also polls Ndb for completed transactions.)
+
+ The methods Ndb::pollNdb and Ndb::sendPollNdb checks if any
+ sent transactions are completed. The method Ndb::sendPollNdb
+ also send all prepared transactions before polling NDB.
+ Transactions still in the definition phase (i.e. items 1-3 above,
+ transactions which has not yet been sent to the NDB kernel) are not
+ affected by poll-calls.
+ The poll method invoked (either Ndb::pollNdb or Ndb::sendPollNdb)
+ will return when:
+ -# at least 'minNoOfEventsToWakeup' of the transactions
+ are finished processing, and
+ -# all of these transactions have executed their
+ callback methods.
+
+ The poll method returns the number of transactions that
+ have finished processing and executed their callback methods.
+
+ @note When an asynchronous transaction has been started and sent to
+ the NDB kernel, it is not allowed to execute any methods on
+ objects belonging to this transaction until the transaction
+ callback method have been executed.
+ (The transaction is stated and sent by either
+ NdbConnection::executeAsynch or through the combination of
+ NdbConnection::executeAsynchPrepare and either
+ Ndb::sendPreparedTransactions or Ndb::sendPollNdb).
+
+ More about how transactions are send the NDB Kernel is
+ available in section @ref secAdapt.
+
+
+ @section secError Error Handling
+
+ Errors can occur when
+ -# operations are being defined, or when the
+ -# transaction is being executed.
+
+ One recommended way to handle a transaction failure
+ (i.e. an error is reported) is to:
+ -# Rollback transaction (NdbConnection::execute with a special parameter)
+ -# Close transaction
+ -# Restart transaction (if the error was temporary)
+
+ @note Transaction are not automatically closed when an error occur.
+
+ Several errors can occur when a transaction holds multiple
+ operations which are simultaneously executed.
+ In this case the application has to go through the operation
+ objects and query for their NdbError objects to find out what really
+ happened.
+
+ NdbConnection::getNdbErrorOperation returns a reference to the
+ operation causing the latest error.
+ NdbConnection::getNdbErrorLine delivers the method number of the
+ erroneous method in the operation.
+
+ @code
+ theConnection = theNdb->startTransaction();
+ theOperation = theConnection->getNdbOperation("TEST_TABLE");
+ if (theOperation == NULL) goto error;
+ theOperation->readTuple();
+ theOperation->setValue("ATTR_1", at1);
+ theOperation->setValue("ATTR_2", at1); //Here an error occurs
+ theOperation->setValue("ATTR_3", at1);
+ theOperation->setValue("ATTR_4", at1);
+
+ if (theConnection->execute(Commit) == -1) {
+ errorLine = theConnection->getNdbErrorLine();
+ errorOperation = theConnection->getNdbErrorOperation();
+ @endcode
+
+ Here errorLine will be 3 as the error occurred in the third method
+ on the operation object.
+ Getting errorLine == 0 means that the error occurred when executing the
+ operations.
+ Here errorOperation will be a pointer to the theOperation object.
+ NdbConnection::getNdbError will return the NdbError object
+ including holding information about the error.
+
+ Since errors could have occurred even when a commit was reported,
+ there is also a special method, NdbConnection::commitStatus,
+ to check the commit status of the transaction.
+
+*******************************************************************************/
+
+/**
+ * @page ndbapi_example1.cpp ndbapi_example1.cpp
+ * @include ndbapi_example1.cpp
+ */
+
+/**
+ * @page ndbapi_example2.cpp ndbapi_example2.cpp
+ * @include ndbapi_example2.cpp
+ */
+
+/**
+ * @page ndbapi_example3.cpp ndbapi_example3.cpp
+ * @include ndbapi_example3.cpp
+ */
+
+/**
+ * @page ndbapi_example4.cpp ndbapi_example4.cpp
+ * @include ndbapi_example4.cpp
+ */
+
+/**
+ * @page select_all.cpp select_all.cpp
+ * @include select_all.cpp
+ */
+
+/**
+ * @page ndbapi_async.cpp ndbapi_async.cpp
+ * @include ndbapi_async.cpp
+ */
+
+/**
+ * @page ndbapi_scan.cpp ndbapi_scan.cpp
+ * @include ndbapi_scan.cpp
+ */
+
+
+/**
+ @page secAdapt Adaptive Send Algorithm
+
+ At the time of "sending" the transaction
+ (using NdbConnection::execute, NdbConnection::executeAsynch,
+ Ndb::sendPreparedTransactions, or Ndb::sendPollNdb), the transactions
+ are in reality <em>not</em> immediately transfered to the NDB Kernel.
+ Instead, the "sent" transactions are only kept in a
+ special send list (buffer) in the Ndb object to which they belong.
+ The adaptive send algorithm decides when transactions should
+ be transfered to the NDB kernel.
+
+ For each of these "sent" transactions, there are three
+ possible states:
+ -# Waiting to be transfered to NDB Kernel.
+ -# Has been transfered to the NDB Kernel and is currently
+ being processed.
+ -# Has been transfered to the NDB Kernel and has
+ finished processing.
+ Now it is waiting for a call to a poll method.
+ (When the poll method is invoked,
+ then the transaction callback method will be executed.)
+
+ The poll method invoked (either Ndb::pollNdb or Ndb::sendPollNdb)
+ will return when:
+ -# at least 'minNoOfEventsToWakeup' of the transactions
+ in the send list have transitioned to state 3 as described above, and
+ -# all of these transactions have executed their callback methods.
+
+
+ Since the NDB API is designed as a multi-threaded interface,
+ it is desirable to transfer database operations from more than
+ one thread at a time.
+ The NDB API keeps track of which Ndb objects are active in transfering
+ information to the NDB kernel and the expected amount of threads to
+ interact with the NDB kernel.
+ Note that an Ndb object should be used in at most one thread.
+ Two different threads should <em>not</em> use the same Ndb object.
+
+ There are four reasons leading to transfering of database
+ operations:
+ -# The NDB Transporter (TCP/IP, OSE, SCI or shared memory)
+ decides that a buffer is full and sends it off.
+ The buffer size is implementation dependent and
+ might change between NDB Cluster releases.
+ On TCP/IP the buffer size is usually around 64 kByte and
+ on OSE/Delta it is usually less than 2000 bytes.
+ In each Ndb object there is one buffer per DB node,
+ so this criteria of a full buffer is only
+ local to the connection to one DB node.
+ -# Statistical information on the transfered information
+ may force sending of buffers to all DB nodes.
+ -# Every 10 ms a special send-thread checks whether
+ any send activity has occurred. If not, then the thread will
+ force sending to all nodes.
+ This means that 20 ms is the maximum time database operations
+ are waiting before being sent off. The 10 millisecond limit
+ is likely to become a configuration parameter in
+ later releases of NDB Cluster.
+ However, to support faster than 10 ms checks,
+ there has to be support from the operating system.
+ -# When calling NdbConnection::execute synchronously or calling any
+ of the poll-methods, there is a force parameter that overrides the
+ adaptive algorithm and forces the send to all nodes.
+
+ @note The times mentioned above are examples. These might
+ change in later releases of NDB Cluster.
+*/
+
+/**
+ @page secConcepts NDB Cluster Concepts
+
+ The <em>NDB Kernel</em> is the collection of database (DB) nodes
+ belonging to an NDB Cluster.
+ The application programmer can for most purposes view the
+ set of all DB nodes as one entity.
+ Each DB node has three main components:
+ - TC : The transaction coordinator
+ - ACC : The index storage
+ - TUP : The data storage
+
+ When the application program executes a transaction,
+ it connects to one TC on one DB node.
+ Usually, the programmer does not need to specify which TC to use,
+ but some cases when performance is important,
+ transactions can be hinted to use a certain TC.
+ (If the node with the TC is down, then another TC will
+ automatically take over the work.)
+
+ Every DB node has an ACC and a TUP which stores
+ the index and the data part of the database.
+ Even though one TC is responsible for the transaction,
+ several ACCs and TUPs on other DB nodes might be involved in the
+ execution of the transaction.
+
+
+ @section secNdbKernelConnection Selecting Transaction Coordinator
+ The default method is round robin,
+ where each new set of transactions
+ is placed on the next DB node.
+ The application chooses a TC for a number of transactions
+ and then lets the next TC (on the next DB node) carry out
+ the next set of transactions.
+
+ The application programmer can however hint the NDB API which
+ transaction coordinator to use
+ by providing a <em>distribution key</em> (usually the primary key).
+ By using the primary key as distribution key,
+ the transaction will be placed on the node where the primary replica
+ of that record resides.
+ Note that this is only a hint, the system can be
+ reconfigured and then the NDB API will choose a transaction
+ coordinator without using the hint.
+ For more information, see NdbDictionary::Column::setDistributionKey.
+
+
+ @section secRecordStruct Record Structure
+ NDB Cluster is a relational database with tables of records.
+ Table rows represent tuples of relational data stored as records.
+ When created, the attribute schema of the table is specified,
+ and thus each record of the table has the same schema.
+
+
+ @subsection secKeys Tuple Keys
+ Each record has from zero up to four attributes which belong
+ to the primary key of the table.
+ If no attribute belongs to the primary key, then
+ the NDB Cluster creates an attribute named <em>NDB$TID</em>
+ which stores a tuple identity.
+ The <em>tuple key</em> of a table is thus either
+ the primary key attributes or the special NDB$TID attribute.
+
+
+ @subsection secArrays Array Attributes
+ A table attribute in NDB Cluster can be of <em>array type</em>.
+ This means that the attribute consists of an array of
+ <em>elements</em>. The <em>attribute size</em> is the size
+ of one element of the array (expressed in bits) and the
+ <em>array size</em> is the number of elements of the array.
+
+
+ @section secTrans Transactions
+
+ Transactions are committed to main memory,
+ and are committed to disk after a global checkpoint, GCP.
+ Since all data is (in most NDB Cluster configurations)
+ synchronously replicated and stored on multiple NDB nodes,
+ the system can still handle processor failures without loss
+ of data.
+ However, in the case of a system failure (e.g. the whole system goes down),
+ then all (committed or not) transactions after the latest GCP are lost.
+
+
+ @subsection secConcur Concurrency Control
+ NDB Cluster uses pessimistic concurrency control based on locking.
+ If a requested lock (implicit and depending on database operation)
+ cannot be attained within a specified time,
+ then a timeout error occurs.
+
+ Concurrent transactions (parallel application programs, thread-based
+ applications, or applications with asynchronous transactions)
+ sometimes deadlock when they try to access the same information.
+ Applications need to be programmed so that timeout errors
+ occurring due to deadlocks are handled. This generally
+ means that the transaction encountering timeout
+ should be rolled back and restarted.
+*/
+
+#ifndef Ndb_H
+#define Ndb_H
+
+#include <ndb_types.h>
+#include <ndbapi_limits.h>
+#include "AttrType.hpp"
+#include <NdbError.hpp>
+#include "NdbDictionary.hpp"
+
+class NdbObjectIdMap;
+class NdbOperation;
+class NdbEventOperationImpl;
+class NdbScanOperation;
+class NdbIndexOperation;
+class NdbConnection;
+class NdbSchemaOp;
+class NdbSchemaCon;
+class NdbApiSignal;
+class NdbRecAttr;
+class NdbLabel;
+class NdbBranch;
+class NdbSubroutine;
+class NdbCall;
+class NdbScanReceiver;
+class Table;
+class BaseString;
+class NdbEventOperation;
+
+typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*);
+
+
+#if defined NDB_OSE
+/**
+ * Default time to wait for response after request has been sent to
+ * NDB Cluster (Set to 10 seconds usually, but to 100 s in
+ * the OSE operating system)
+ */
+#define WAITFOR_RESPONSE_TIMEOUT 100000 // Milliseconds
+#else
+#define WAITFOR_RESPONSE_TIMEOUT 120000 // Milliseconds
+#endif
+
+#define NDB_MAX_INTERNAL_TABLE_LENGTH NDB_MAX_DATABASE_NAME_SIZE + \
+ NDB_MAX_SCHEMA_NAME_SIZE + \
+ NDB_MAX_TAB_NAME_SIZE*2
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+class NdbWaiter {
+public:
+ NdbWaiter();
+ ~NdbWaiter();
+
+ void wait(int waitTime);
+ void nodeFail(Uint32 node);
+ void signal(Uint32 state);
+
+ Uint32 m_node;
+ Uint32 m_state;
+ void * m_mutex;
+ struct NdbCondition * m_condition;
+};
+#endif
+
+/**
+ * @class Ndb
+ * @brief Represents the NDB kernel and is the main class of the NDB API.
+ *
+ * Always start your application program by creating an Ndb object.
+ * By using several Ndb objects it is possible to design
+ * a multi-threaded application, but note that Ndb objects
+ * cannot be shared by several threads.
+ * Different threads should use different Ndb objects.
+ * A thread might however use multiple Ndb objects.
+ * Currently there is a limit of maximum 128 Ndb objects
+ * per application process.
+ *
+ * @note It is not allowed to call methods in the NDB API
+ * on the same Ndb object in different threads
+ * simultaneously (without special handling of the
+ * Ndb object).
+ *
+ * @note The Ndb object is multi-thread safe in the following manner.
+ * Each Ndb object can ONLY be handled in one thread.
+ * If an Ndb object is handed over to another thread then the
+ * application must ensure that a memory barrier is used to
+ * ensure that the new thread see all updates performed by
+ * the previous thread.
+ * Semaphores, mutexes and so forth are easy ways of issuing memory
+ * barriers without having to bother about the memory barrier concept.
+ *
+ * If one Ndb object is used to handle parallel transactions through the
+ * asynchronous programming interface, please read the notes regarding
+ * asynchronous transactions (Section @ref secAsync).
+ * The asynchronous interface provides much higher performance
+ * in some situations, but is more complicated for the application designer.
+ *
+ * @note Each Ndb object should either use the methods for
+ * asynchronous transaction or the methods for
+ * synchronous transactions but not both.
+ */
+class Ndb
+{
+ friend class NdbReceiver;
+ friend class NdbOperation;
+ friend class NdbEventOperationImpl;
+ friend class NdbConnection;
+ friend class NdbSchemaOp;
+ friend class NdbSchemaCon;
+ friend class Table;
+ friend class NdbApiSignal;
+ friend class NdbScanReceiver;
+ friend class NdbIndexOperation;
+ friend class NdbDictionaryImpl;
+ friend class NdbDictInterface;
+
+public:
+ /**
+ * @name General
+ * @{
+ */
+ /**
+ * The starting point of your application code is to create an
+ * Ndb object.
+ * This object represents the NDB kernel and is the main
+ * object used in interaction with the NDB kernel.
+ *
+ * @param aCatalogName is the name of the catalog you want to use.
+ * @note The catalog name provides a name space for the tables and
+ * indexes created in any connection from the Ndb object.
+ * @param aSchemaName is the name of the schema you
+ * want to use. It is optional and defaults to the "def" schema.
+ * @note The schema name provides an additional name space
+ * for the tables and indexes created in a given catalog.
+ * @note The methods get/setDatabaseName and get/setDatabaseSchemaName
+ * are equivalent to get/setCatalogName and get/setSchemaName.
+ * The get/setDatabaseName and get/setDatabaseSchemaName are
+ * deprecated.
+ */
+ Ndb(const char* aCatalogName = "", const char* aSchemaName = "def");
+
+ ~Ndb();
+
+ /**
+ * The current catalog name can be fetched by getCatalogName.
+ *
+ * @return the current catalog name
+ */
+ const char * getCatalogName() const;
+
+ /**
+ * The current catalog name can be set by setCatalogName.
+ *
+ * @param aCatalogName is the new name of the current catalog
+ */
+ void setCatalogName(const char * aCatalogName);
+
+ /**
+ * The current schema name can be fetched by getSchemaName.
+ *
+ * @return the current schema name
+ */
+ const char * getSchemaName() const;
+
+ /**
+ * The current schema name can be set by setSchemaName.
+ *
+ * @param aSchemaName is the new name of the current schema
+ */
+ void setSchemaName(const char * aSchemaName);
+
+
+ /**
+ * The current database name can be fetched by getDatabaseName.
+ *
+ * @return the current database name
+ */
+ const char * getDatabaseName() const;
+
+ /**
+ * The current database name can be set by setDatabaseName.
+ *
+ * @param aDatabaseName is the new name of the current database
+ */
+ void setDatabaseName(const char * aDatabaseName);
+
+ /**
+ * The current database schema name can be fetched by getDatabaseSchemaName.
+ *
+ * @return the current database schema name
+ */
+ const char * getDatabaseSchemaName() const;
+
+ /**
+ * The current database schema name can be set by setDatabaseSchemaName.
+ *
+ * @param aDatabaseSchemaName is the new name of the current database schema
+ */
+ void setDatabaseSchemaName(const char * aDatabaseSchemaName);
+
+ /**
+ * Before anything else it is necessary to initialize (start)
+ * the Ndb object.
+ *
+ * @param maxNoOfTransactions
+ * Maximum number of parallel
+ * NdbConnection objects that should be handled by the Ndb object.
+ * A value larger than 1024 will be downgraded to 1024.
+ * This means that one Ndb object can handle at most 1024 parallel
+ * transactions.
+ * There is a maximum of 128 simultaneous
+ * Ndb object within one application process.
+ * @return 0 if successful, -1 otherwise.
+ *
+ * @note The internal implementation multiplies this value
+ * with 3.
+ */
+ int init(int maxNoOfTransactions = 4);
+
+ /**
+ * Wait for Ndb object to successfully set-up connections to
+ * the NDB kernel.
+ * Starting to use the Ndb object without using this method
+ * gives unspecified behavior.
+ *
+ * @param timeout The maximum time we will wait for
+ * the initiation process to finish.
+ * Timeout is expressed in seconds.
+ * @return 0: Ndb is ready and timeout has not occurred.<br>
+ * -1: Timeout has expired
+ */
+ int waitUntilReady(int timeout = 60);
+
+ /** @} *********************************************************************/
+
+ /**
+ * @name Meta Information
+ * @{
+ */
+
+ /**
+ * Query the database for schema information
+ * (without performing any transaction).
+ *
+ * @return Object containing meta information about all tables
+ * in NDB Cluster.
+ */
+ class NdbDictionary::Dictionary* getDictionary() const;
+
+ NdbEventOperation* createEventOperation(const char* eventName,
+ const int bufferLength);
+ int dropEventOperation(NdbEventOperation*);
+ void monitorEvent(NdbEventOperation *, NdbEventCallback, void*);
+ int pollEvents(int aMillisecondNumber);
+
+ /**
+ * Get the application node identity.
+ *
+ * Each node (DB nodes, Applications, and Management Servers)
+ * has its own node identity in the NDB Cluster.
+ * See documentation for the management server configuration file.
+ *
+ * @return Node id of this application.
+ */
+ int getNodeId();
+
+ /** @} *********************************************************************/
+
+ /**
+ * @name Starting and Closing Transactions
+ * @{
+ */
+
+ /**
+ * This method returns an NdbConnection which caters for the transaction.
+ * When the transaction is completed it must be closed.
+ * The Ndb::closeTransaction also return the NdbConnection object
+ * and all other memory related to the transaction.
+ * Failure to close the transaction will lead to memory leakage.
+ * The transaction must be closed independent of its outcome, i.e.
+ * even if there is an error.
+ *
+ * NDB API can be hinted to select a particular transaction coordinator.
+ * The default method is round robin where each set of new transactions
+ * is placed on the next NDB kernel node.
+ * By providing a distribution key (usually the primary key
+ * of the mostly used table of the transaction) for a record
+ * the transaction will be placed on the node where the primary replica
+ * of that record resides.
+ * Note that this is only a hint, the system can
+ * be under reconfiguration and then the NDB API
+ * will use select the transaction coordinator without using
+ * this hint.
+ *
+ * Placing the transaction coordinator close
+ * to the actual data used in the transaction can in many cases
+ * improve performance significantly. This is particularly true for
+ * systems using TCP/IP. A system using Solaris and a 500 MHz processor
+ * has a cost model for TCP/IP communication which is:
+ *
+ * 30 microseconds + (100 nanoseconds * no of Bytes)
+ *
+ * This means that if we can ensure that we use "popular" links we increase
+ * buffering and thus drastically reduce the communication cost.
+ * Systems using SCI has a different cost model which is:
+ *
+ * 5 microseconds + (10 nanoseconds * no of Bytes)
+ *
+ * Thus SCI systems are much less dependent on selection of
+ * transaction coordinators.
+ * Typically TCP/IP systems spend 30-60% of the time during communication,
+ * whereas SCI systems typically spend 5-10% of the time during
+ * communication.
+ * Thus SCI means that less care from the NDB API programmer is
+ * needed and great scalability can be achieved even for applications using
+ * data from many parts of the database.
+ *
+ * A simple example is an application that uses many simple updates where
+ * a transaction needs to update one record.
+ * This record has a 32 bit primary key,
+ * which is also the distribution key.
+ * Then the keyData will be the address of the integer
+ * of the primary key and keyLen will be 4.
+ *
+ * @note Transaction priorities are not yet supported.
+ *
+ * @param prio The priority of the transaction.<br>
+ * Priority 0 is the highest priority and is used
+ * for short transactions with requirements on low delay.<br>
+ * Priority 1 is a medium priority for short transactions.
+ * <br>
+ * Priority 2 is a medium priority for long transactions.<br>
+ * Priority 3 is a low priority for long transactions.<br>
+ * <em>This parameter is not currently used,
+ * and can be set to any value</em>
+ * @param keyData Pointer to distribution key
+ * @param keyLen Length of distribution key expressed in bytes
+ *
+ * @return NdbConnection object, or NULL if method failed.
+ */
+ NdbConnection* startTransaction(Uint32 prio = 0,
+ const char * keyData = 0,
+ Uint32 keyLen = 0);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * This method is a modification of Ndb::startTransaction,
+ * in which we use only the first two chars of keyData to
+ * select transaction coordinator.
+ * This is referred to as a distribution group.
+ * There are two ways to use the method:
+ * - In the first, the two characters are used directly as
+ * the distribution key, and
+ * - in the second the distribution is calculated as:
+ * (10 * (char[0] - 0x30) + (char[1] - 0x30)).
+ * Thus, in the second way, the two ASCII digits '78'
+ * will provide the distribution key = 78.
+ *
+ * @note Transaction priorities are not yet supported.
+ *
+ * @param aPrio Priority of the transaction.<br>
+ * Priority 0 is the highest priority and is used for short transactions
+ * with requirements on low delay.<br>
+ * Priority 1 is a medium priority for short transactions.<br>
+ * Priority 2 is a medium priority for long transactions.<br>
+ * Priority 3 is a low priority for long transactions.
+ * @param keyData is a string of which the two first characters
+ * is used to compute which fragement the data is stored in.
+ * @param type is the type of distribution group.<br>
+ * 0 means direct usage of the two characters, and<br>
+ * 1 means the ASCII digit variant.
+ * @return NdbConnection, or NULL if it failed.
+ */
+ NdbConnection* startTransactionDGroup(Uint32 aPrio,
+ const char * keyData, int type);
+#endif
+
+ /**
+ * When a transactions is completed, the transaction has to be closed.
+ *
+ * @note It is not allowed to call Ndb::closeTransaction after sending the
+ * transaction asynchronously with either
+ * Ndb::sendPreparedTransactions or
+ * Ndb::sendPollNdb before the callback method has been called.
+ * (The application should keep track of the number of
+ * outstanding transactions and wait until all of them
+ * has completed before calling Ndb::closeTransaction).
+ * If the transaction is not committed it will be aborted.
+ */
+ void closeTransaction(NdbConnection* aConnection);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * To create a table it is necessary to obtain a schema transaction
+ * object.
+ * All schema transactions need to closed when they are
+ * completed.
+ *
+ * @return NdbSchemaCon
+ */
+ NdbSchemaCon* startSchemaTransaction();
+
+ /**
+ * Close schema transaction when finished.
+ */
+ void closeSchemaTransaction(NdbSchemaCon* aSchemaCon);
+#endif
+
+ /** @} *********************************************************************/
+
+ /**
+ * @name Asynchronous Transactions
+ * @{
+ */
+
+ /**
+ * Wait for prepared transactions.
+ * Will return as soon as at least 'minNoOfEventsToWakeUp'
+ * of them have completed, or the maximum time given as timeout has passed.
+ *
+ * @param aMillisecondNumber Maximum time to wait for transactions
+ * to complete.
+ * Polling without wait is achieved by setting the
+ * timer to zero.
+ * Time is expressed in milliseconds.
+ * @param minNoOfEventsToWakeup Minimum number of transactions
+ * which has to wake up before the poll-call will return.
+ * If minNoOfEventsToWakeup is
+ * set to a value larger than 1 then this is the minimum
+ * number of transactions that need to complete before the
+ * poll will return.
+ * Setting it to zero means that one should wait for all
+ * outstanding transactions to return before waking up.
+ * @return Number of transactions polled.
+ */
+ int pollNdb(int aMillisecondNumber = WAITFOR_RESPONSE_TIMEOUT,
+ int minNoOfEventsToWakeup = 1);
+
+ /**
+ * This send method will send all prepared database operations.
+ * The default method is to do it non-force and instead
+ * use the adaptive algorithm. (See Section @ref secAdapt.)
+ * The second option is to force the sending and
+ * finally there is the third alternative which is
+ * also non-force but also making sure that the
+ * adaptive algorithm do not notice the send.
+ * In this case the sending will be performed on a
+ * cyclical 10 millisecond event.
+ *
+ * @param forceSend When operations should be sent to NDB Kernel.
+ * (See @ref secAdapt.)
+ * - 0: non-force, adaptive algorithm notices it (default);
+ * - 1: force send, adaptive algorithm notices it;
+ * - 2: non-force, adaptive algorithm do not notice the send.
+ */
+ void sendPreparedTransactions(int forceSend = 0);
+
+ /**
+ * This is a send-poll variant that first calls
+ * Ndb::sendPreparedTransactions and then Ndb::pollNdb.
+ * It is however somewhat faster than calling the methods
+ * separately, since some mutex-operations are avoided.
+ * See documentation of Ndb::pollNdb and Ndb::sendPreparedTransactions
+ * for more details.
+ *
+ * @param aMillisecondNumber Timeout specifier
+ * Polling without wait is achieved by setting the
+ * millisecond timer to zero.
+ * @param minNoOfEventsToWakeup Minimum number of transactions
+ * which has to wake up before the poll-call will return.
+ * If minNoOfEventsToWakeup is
+ * set to a value larger than 1 then this is the minimum
+ * number of transactions that need to complete before the
+ * poll-call will return.
+ * Setting it to zero means that one should wait for all
+ * outstanding transactions to return before waking up.
+ * @param forceSend When operations should be sent to NDB Kernel.
+ * (See @ref secAdapt.)
+ * - 0: non-force, adaptive algorithm notices it (default);
+ * - 1: force send, adaptive algorithm notices it;
+ * - 2: non-force, adaptive algorithm does not notice the send.
+ * @return Number of transactions polled.
+ */
+ int sendPollNdb(int aMillisecondNumber = WAITFOR_RESPONSE_TIMEOUT,
+ int minNoOfEventsToWakeup = 1,
+ int forceSend = 0);
+
+ /** @} *********************************************************************/
+
+ /**
+ * @name Error Handling
+ * @{
+ */
+
+ /**
+ * Get the NdbError object
+ *
+ * The NdbError object is valid until you call a new NDB API method.
+ */
+ const NdbError & getNdbError() const;
+
+ /**
+ * Get a NdbError object for a specific error code
+ *
+ * The NdbError object is valid until you call a new NDB API method.
+ */
+ const NdbError & getNdbError(int errorCode);
+
+
+ /**
+ * setConnectString
+ * @param connectString - the connectString has the following format:
+ * @code
+ * "nodeid=<ID>;host=host://<HOSTNAME>:<PORT>;
+ * host=host://<HOSTNAME2>:<PORT>;..."
+ * @endcode
+ * or
+ * @code
+ * "nodeid=<ID>;host=<HOSTNAME>:<PORT>;host=<HOSTNAME2>:<PORT>;..."
+ * @endcode
+ */
+ static void setConnectString(const char * connectString);
+
+ /**
+ * useFullyQualifiedNames
+ * Enables unique name space for different databases and schemas
+ * by defining table names as DATABASENAME/SCHEMANAME/TABLENAME and
+ * index names as DATABASENAME/SCHEMANAME/TABLENAME/INDEXNAME
+ * @param turnNamingOn bool true - turn naming on, false - turn naming off
+ */
+ static void useFullyQualifiedNames(bool turnNamingOn = true);
+
+ static bool usingFullyQualifiedNames();
+
+ /** @} *********************************************************************/
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * For testing purposes it is possible to tamper with the NDB Cluster
+ * (i.e. send a special signal to DBDIH, the NDB distribution handler).
+ * <b>This feature should only used for debugging purposes.</b>
+ * In a release versions of NDB Cluster,
+ * this call always return -1 and does nothing.
+ *
+ * @param aAction Action to be taken
+ * - 1: Lock global checkpointing
+ * (Can only be sent to master DIH,
+ * Parameter aNode ignored).
+ * - 2: UnLock global checkpointing
+ * (Can only be sent to master DIH,
+ * Parameter aNode ignored).
+ * - 3: Crash node.
+ *
+ * @param aNode Which node the action will be taken
+ * -1: Master DIH.
+ * 0-16: Nodnumber.
+ * @return -1 indicates error, other values have meaning dependent
+ * on type of tampering.
+ */
+ int NdbTamper(TamperType aAction, int aNode);
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * Return a unique tuple id for a table. The id sequence is
+ * ascending but may contain gaps.
+ *
+ * @param aTableName table name
+ *
+ * @param cacheSize number of values to cache in this Ndb object
+ *
+ * @return tuple id or 0 on error
+ */
+ Uint64 getAutoIncrementValue(const char* aTableName, Uint32 cacheSize = 1);
+ bool setAutoIncrementValue(const char* aTableName, Uint64 val);
+ Uint64 getTupleIdFromNdb(const char* aTableName, Uint32 cacheSize = 1000 );
+ Uint64 getTupleIdFromNdb(Uint32 aTableId, Uint32 cacheSize = 1000 );
+ bool setTupleIdInNdb(const char* aTableName, Uint64 val);
+ bool setTupleIdInNdb(Uint32 aTableId, Uint64 val);
+ Uint64 opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op);
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ */
+ NdbConnection* hupp( NdbConnection* );
+ Uint32 getReference() const { return theMyRef;}
+#endif
+
+/*****************************************************************************
+ * These are service routines used by the other classes in the NDBAPI.
+ ****************************************************************************/
+private:
+
+ NdbConnection* startTransactionLocal(Uint32 aPrio, Uint32 aFragmentId);
+
+// Connect the connection object to the Database.
+ int NDB_connect(Uint32 tNode);
+ NdbConnection* doConnect(Uint32 nodeId);
+ void doDisconnect();
+
+ NdbScanReceiver* getNdbScanRec();// Get a NdbScanReceiver from idle list
+ NdbLabel* getNdbLabel(); // Get a NdbLabel from idle list
+ NdbBranch* getNdbBranch(); // Get a NdbBranch from idle list
+ NdbSubroutine* getNdbSubroutine();// Get a NdbSubroutine from idle
+ NdbCall* getNdbCall(); // Get a NdbCall from idle list
+ NdbApiSignal* getSignal(); // Get an operation from idle list
+ NdbRecAttr* getRecAttr(); // Get a receeive attribute object from
+ // idle list of the Ndb object.
+ NdbOperation* getOperation(); // Get an operation from idle list
+ NdbScanOperation* 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 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 check_send_timeout();
+ void remove_sent_list(Uint32);
+ Uint32 insert_completed_list(NdbConnection*);
+ Uint32 insert_sent_list(NdbConnection*);
+
+ // Handle a received signal. Used by both
+ // synchronous and asynchronous interface
+ void handleReceivedSignal(NdbApiSignal* anApiSignal, struct LinearSectionPtr ptr[3]);
+
+ // Receive response signals
+ int receiveResponse(int waitTime = WAITFOR_RESPONSE_TIMEOUT);
+
+ int sendRecSignal(Uint16 aNodeId,
+ Uint32 aWaitState,
+ NdbApiSignal* aSignal,
+ Uint32 nodeSequence);
+
+ // Sets Restart GCI in Ndb object
+ void RestartGCI(int aRestartGCI);
+
+ // Get block number of this NDBAPI object
+ int getBlockNumber();
+
+ /****************************************************************************
+ * These are local service routines used by this class.
+ ***************************************************************************/
+
+ int createConIdleList(int aNrOfCon);
+ int createOpIdleList( int nrOfOp );
+
+ void freeOperation(); // Free the first idle operation.
+ void freeScanOperation(); // Free the first idle scan operation.
+ void freeIndexOperation(); // Free the first idle index operation.
+ void freeNdbCon(); // Free the first idle connection.
+ void freeSignal(); // Free the first idle signal
+ void freeRecAttr(); // Free the first idle receive attr obj
+ void freeNdbLabel(); // Free the first idle NdbLabel obj
+ void freeNdbBranch();// Free the first idle NdbBranch obj
+ void freeNdbSubroutine();// Free the first idle NdbSubroutine obj
+ void freeNdbCall(); // Free the first idle NdbCall obj
+ void freeNdbScanRec(); // Free the first idle NdbScanRec obj
+
+ NdbConnection* getNdbCon(); // Get a connection from idle list
+
+ /**
+ * Get a connected NdbConnection to nodeId
+ * Returns NULL if none found
+ */
+ NdbConnection* getConnectedNdbConnection(Uint32 nodeId);
+
+ // Release and disconnect from DBTC a connection
+ // and seize it to theConIdleList
+ void releaseConnectToNdb (NdbConnection* aConnectConnection);
+
+ // Release a connection to idle list
+ void releaseNdbCon (NdbConnection* aConnection);
+
+ int checkInitState(); // Check that we are initialized
+ void report_node_failure(Uint32 node_id); // Report Failed node
+ void report_node_failure_completed(Uint32 node_id); // Report Failed node(NF comp.)
+
+ void checkFailedNode(); // Check for failed nodes
+
+ int NDB_connect(); // Perform connect towards NDB Kernel
+
+ // Release arrays of NdbConnection pointers
+ void releaseTransactionArrays();
+
+ Uint32 pollCompleted(NdbConnection** aCopyArray);
+ void sendPrepTrans(int forceSend);
+ void reportCallback(NdbConnection** aCopyArray, Uint32 aNoOfComplTrans);
+ void waitCompletedTransactions(int milliSecs, int noOfEventsToWaitFor);
+ void completedTransaction(NdbConnection* aTransaction);
+ void completedScanTransaction(NdbConnection* aTransaction);
+
+ void abortTransactionsAfterNodeFailure(Uint16 aNodeId);
+
+ static
+ const char * externalizeTableName(const char * internalTableName);
+ const char * internalizeTableName(const char * externalTableName);
+
+ static
+ const char * externalizeIndexName(const char * internalIndexName);
+ const char * internalizeIndexName(const NdbTableImpl * table,
+ const char * externalIndexName);
+
+ static
+ const BaseString getDatabaseFromInternalName(const char * internalName);
+ static
+ const BaseString getSchemaFromInternalName(const char * internalName);
+
+ 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);
+
+/******************************************************************************
+ * These are the private variables in this class.
+ *****************************************************************************/
+ NdbObjectIdMap* theNdbObjectIdMap;
+
+ NdbConnection** thePreparedTransactionsArray;
+ NdbConnection** theSentTransactionsArray;
+ NdbConnection** theCompletedTransactionsArray;
+
+ Uint32 theNoOfPreparedTransactions;
+ Uint32 theNoOfSentTransactions;
+ Uint32 theNoOfCompletedTransactions;
+ Uint32 theNoOfAllocatedTransactions;
+ Uint32 theMaxNoOfTransactions;
+ Uint32 theMinNoOfEventsToWakeUp;
+
+ Uint32 theNextConnectNode;
+
+ NdbWaiter theWaiter;
+
+ // Ndb database name.
+ char theDataBase[NDB_MAX_DATABASE_NAME_SIZE];
+ // Ndb database schema name.
+ char theDataBaseSchema[NDB_MAX_SCHEMA_NAME_SIZE];
+ char prefixName[NDB_MAX_INTERNAL_TABLE_LENGTH];
+ char * prefixEnd;
+
+ //Table* theTable; // The table object
+ class NdbImpl * theImpl;
+ class NdbDictionaryImpl* theDictionary;
+ class NdbGlobalEventBufferHandle* theGlobalEventBufferHandle;
+
+ NdbConnection* theConIdleList; // First connection in idle list.
+
+ NdbOperation* theOpIdleList; // First operation in the idle list.
+
+ NdbScanOperation* theScanOpIdleList; // First scan operation in the idle list.
+ NdbIndexOperation* theIndexOpIdleList; // First index operation in the idle list.
+ NdbSchemaCon* theSchemaConIdleList; // First schemaCon in idle list.
+
+ NdbSchemaCon* theSchemaConToNdbList; // Connected schemaCon object.
+ NdbConnection* theTransactionList;
+ NdbConnection** theConnectionArray;
+ NdbRecAttr* theRecAttrIdleList;
+ NdbApiSignal* theSignalIdleList; // First signal in idlelist.
+ NdbLabel* theLabelList; // First label descriptor in list
+ NdbBranch* theBranchList; // First branch descriptor in list
+ NdbSubroutine* theSubroutineList; // First subroutine descriptor in
+ NdbCall* theCallList; // First call descriptor in list
+ NdbScanReceiver* theScanList;
+
+ Uint32 theMyRef; // My block reference
+ Uint32 theNode; // The node number of our node
+
+ Uint32 theNoOfDBnodes; // The number of DB nodes
+ Uint32 * theDBnodes; // The node number of the DB nodes
+ Uint8 *the_release_ind;// 1 indicates to release all connections to node
+
+ Uint64 the_last_check_time;
+ Uint64 theFirstTransId;
+
+ // The tupleId is retreived from DB the
+ // tupleId is unique for each tableid.
+ Uint64 theFirstTupleId[2048];
+ Uint64 theLastTupleId[2048];
+
+ Uint32 theRestartGCI; // the Restart GCI used by DIHNDBTAMPER
+
+ NdbError theError;
+
+ Int32 theNdbBlockNumber;
+ InitType theInitState;
+
+ // Ensure good distribution of connects
+ Uint32 theCurrentConnectIndex;
+ Uint32 theCurrentConnectCounter;
+
+ /**
+ * Computes fragement id for primary key
+ *
+ * Note that keydata has to be "shaped" as it is being sent in KEYINFO
+ */
+ Uint32 computeFragmentId(const char * keyData, Uint32 keyLen);
+ Uint32 getFragmentId(Uint32 hashValue);
+
+ /**
+ * Make a guess to which node is the primary for the fragment
+ */
+ Uint32 guessPrimaryNode(Uint32 fragmentId);
+
+ /**
+ * Structure containing values for guessing primary node
+ */
+ struct StartTransactionNodeSelectionData {
+ StartTransactionNodeSelectionData():
+ fragment2PrimaryNodeMap(NULL) {};
+ Uint32 kValue;
+ Uint32 hashValueMask;
+ Uint32 hashpointerValue;
+ Uint32 noOfFragments;
+ Uint32 * fragment2PrimaryNodeMap;
+
+ void init(Uint32 noOfNodes, Uint32 nodeIds[]);
+ void release();
+ } startTransactionNodeSelectionData;
+
+ NdbApiSignal* theCommitAckSignal;
+
+ int cfreeSignals;
+ int cnewSignals;
+ int cgetSignals;
+ int creleaseSignals;
+
+ static void executeMessage(void*, NdbApiSignal *,
+ struct LinearSectionPtr ptr[3]);
+ static void statusMessage(void*, Uint16, bool, bool);
+#ifdef VM_TRACE
+ void printState(const char* fmt, ...);
+#endif
+};
+
+#endif
diff --git a/ndb/include/ndbapi/NdbApi.hpp b/ndb/include/ndbapi/NdbApi.hpp
new file mode 100644
index 00000000000..e5efc9756ce
--- /dev/null
+++ b/ndb/include/ndbapi/NdbApi.hpp
@@ -0,0 +1,33 @@
+/* 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 NdbApi_H
+#define NdbApi_H
+
+#include "Ndb.hpp"
+#include "AttrType.hpp"
+#include "NdbConnection.hpp"
+#include "NdbOperation.hpp"
+#include "NdbScanOperation.hpp"
+#include "NdbIndexOperation.hpp"
+#include "NdbSchemaCon.hpp"
+#include "NdbSchemaOp.hpp"
+#include "NdbRecAttr.hpp"
+#include "NdbResultSet.hpp"
+#include "NdbDictionary.hpp"
+#include "NdbEventOperation.hpp"
+#include "NdbPool.hpp"
+#endif
diff --git a/ndb/include/ndbapi/NdbConnection.hpp b/ndb/include/ndbapi/NdbConnection.hpp
new file mode 100644
index 00000000000..a1532bb2f0e
--- /dev/null
+++ b/ndb/include/ndbapi/NdbConnection.hpp
@@ -0,0 +1,885 @@
+/* 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 NdbConnection_H
+#define NdbConnection_H
+
+#include <ndb_types.h>
+#include "AttrType.hpp"
+#include <NdbError.hpp>
+#include <stdlib.h>
+
+class NdbConnection;
+class NdbOperation;
+class NdbCursorOperation;
+class NdbScanOperation;
+class NdbIndexOperation;
+class NdbApiSignal;
+class Ndb;
+class NdbScanReceiver;
+
+
+/**
+ * NdbAsynchCallback functions are used when executing asynchronous
+ * transactions (using NdbConnection::executeAsynchPrepare, or
+ * NdbConnection::executeAsynch).
+ * The functions are called when the execute has finished.
+ * See @ref secAsync for more information.
+ */
+typedef void (* NdbAsynchCallback)(int, NdbConnection*, void*);
+
+/**
+ * @class NdbConnection
+ * @brief Represents a transaction.
+ *
+ * A transaction (represented by an NdbConnection object)
+ * belongs to an Ndb object and is typically created using
+ * Ndb::startTransaction.
+ * A transaction consists of a list of operations
+ * (represented by NdbOperation objects).
+ * Each operation access exactly one table.
+ *
+ * After getting the NdbConnection object,
+ * the first step is to get (allocate) an operation given the table name.
+ * Then the operation is defined.
+ * Several operations can be defined in parallel on the same
+ * NdbConnection object.
+ * When all operations are defined, the NdbConnection::execute
+ * method sends them to the NDB kernel for execution.
+ *
+ * The NdbConnection::execute method returns when the NDB kernel has
+ * completed execution of all operations defined before the call to
+ * NdbConnection::execute.
+ * All allocated operations should be properly defined
+ * before calling NdbConnection::execute.
+ *
+ * A call to NdbConnection::execute uses one out of three types of execution:
+ * -# ExecType::NoCommit Executes operations without committing them.
+ * -# ExecType::Commit Executes remaining operation and commits the
+ * complete transaction
+ * -# ExecType::Rollback Rollbacks the entire transaction.
+ *
+ * NdbConnection::execute is equipped with an extra error handling parameter
+ * There are two alternatives:
+ * -# AbortOption::AbortOnError (default).
+ * The transaction is aborted if there are any error during the
+ * execution
+ * -# AbortOption::IgnoreError
+ * Continue execution of transaction even if operation fails
+ *
+ * NdbConnection::execute can sometimes indicate an error
+ * (return with -1) while the error code on the NdbConnection is 0.
+ * This is an indication that one of the operations found a record
+ * problem. The transaction is still ok and can continue as usual.
+ * The NdbConnection::execute returns -1 together with error code
+ * on NdbConnection object equal to 0 always means that an
+ * operation was not successful but that the total transaction was OK.
+ * By checking error codes on the individual operations it is possible
+ * to find out which operation was not successful.
+ *
+ * NdbConnection::executeScan is used to setup a scan in the NDB kernel
+ * after it has been defined.
+ * NdbConnection::nextScanResult is used to iterate through the
+ * scanned tuples.
+ * After each call to NdbConnection::nextScanResult, the pointers
+ * of NdbRecAttr objects defined in the NdbOperation::getValue
+ * operations are updated with the values of the new the scanned tuple.
+ */
+
+/* FUTURE IMPLEMENTATION:
+ * Later a prepare mode will be added when Ndb supports Prepare-To-Commit
+ * The NdbConnection can deliver the Transaction Id of the transaction.
+ * After committing a transaction it is also possible to retrieve the
+ * global transaction checkpoint which the transaction was put in.
+ *
+ * FUTURE IMPLEMENTATION:
+ * There are three methods for acquiring the NdbOperation.
+ * -# The first method is the normal where a table name is
+ * provided. In this case the primary key must be supplied through
+ * the use of the NdbOperation::equal methods on the NdbOperation object.
+ * -# The second method provides the tuple identity of the tuple to be
+ * read. The tuple identity contains a table identifier and will
+ * thus be possible to use to ensure the attribute names provided
+ * are correct. If an object-oriented layer is put on top of NDB
+ * Cluster it is essential that all tables derived from a base
+ * class has the same attributes with the same type and the same
+ * name. Thus the application can use the tuple identity and need
+ * not known the table of the tuple. As long as the table is
+ * derived from the known base class everything is ok.
+ * It is not possible to provide any primary key since it is
+ * already supplied with the call to NdbConnection::getNdbOperation.
+ * -# The third method is used when a scanned tuple is to be transferred to
+ * another transaction. In this case it is not possible to define the
+ * primary key since it came along from the scanned tuple.
+ *
+ */
+class NdbConnection
+{
+ friend class Ndb;
+ friend class NdbOperation;
+ friend class NdbScanOperation;
+ friend class NdbIndexOperation;
+ friend class NdbScanReceiver;
+
+public:
+
+ /**
+ * Get an NdbOperation for 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 aTableName The table name.
+ * @return Pointer to an NdbOperation object if successful, otherwise NULL.
+ */
+ 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
+
+
+ /**
+ * 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.
+ * @return Pointer to an NdbIndexOperation object if
+ * successful, otherwise NULL
+ */
+ NdbIndexOperation* getNdbIndexOperation(const char* indexName,
+ const char* tableName);
+
+ /**
+ * @name Execute Transaction
+ * @{
+ */
+
+ /**
+ * Executes transaction.
+ *
+ * @param execType Execution type:<br>
+ * ExecType::NoCommit executes operations without
+ * committing them.<br>
+ * ExecType::Commit executes remaining operations and
+ * commits the complete transaction.<br>
+ * ExecType::Rollback rollbacks the entire transaction.
+ * @param abortOption Handling of error while excuting
+ * AbortOnError - Abort transaction if an operation fail
+ * IgnoreError - Accept failing operations
+ * @param force When operations should be sent to NDB Kernel.
+ * (See @ref secAdapt.)
+ * - 0: non-force, adaptive algorithm notices it
+ * (default);
+ * - 1: force send, adaptive algorithm notices it;
+ * - 2: non-force, adaptive algorithm do not notice
+ * the send.
+ * @return 0 if successful otherwise -1.
+ */
+ int execute(ExecType execType,
+ AbortOption abortOption = AbortOnError,
+ int force = 0 );
+
+ /**
+ * Prepare an asynchronous transaction.
+ *
+ * See @ref secAsync for more information on
+ * how to use this method.
+ *
+ * @param execType Execution type:<br>
+ * ExecType::NoCommit executes operations without committing them.<br>
+ * ExecType::Commit executes remaining operations and commits the
+ * complete transaction.<br>
+ * ExecType::Rollback rollbacks the entire transaction.
+ * @param callback A callback method. This method gets
+ * called when the transaction has been
+ * executed. See @ref ndbapi_example2.cpp
+ * for an example on how to specify and use
+ * a callback method.
+ * @param anyObject A void pointer. This pointer is forwarded to the
+ * callback method and can be used to give
+ * the callback method some data to work on.
+ * It is up to the application programmer
+ * to decide on the use of this pointer.
+ * @param abortOption see @ref execute
+ */
+ void executeAsynchPrepare(ExecType execType,
+ NdbAsynchCallback callback,
+ void* anyObject,
+ AbortOption abortOption = AbortOnError);
+
+ /**
+ * Prepare and send an asynchronous transaction.
+ *
+ * This method perform the same action as
+ * NdbConnection::executeAsynchPrepare
+ * but also sends the operations to the NDB kernel.
+ *
+ * See NdbConnection::executeAsynchPrepare for information
+ * about the parameters of this method.
+ *
+ * See @ref secAsync for more information on
+ * how to use this method.
+ */
+ void executeAsynch(ExecType aTypeOfExec,
+ NdbAsynchCallback aCallback,
+ void* anyObject,
+ AbortOption abortOption = AbortOnError);
+
+ /**
+ * Refresh
+ * Update timeout counter of this transaction
+ * in the database. If you want to keep the transaction
+ * active in the database longer than the
+ * transaction abort timeout.
+ * @note It's not advised to take a lock on a record and keep it
+ * for a extended time since this can impact other transactions.
+ *
+ */
+ int refresh();
+
+ /**
+ * Close transaction
+ * @note It is not allowed to call NdbConnection::close after sending the
+ * transaction asynchronously before the callback method has
+ * been called.
+ * (The application should keep track of the number of
+ * outstanding transactions and wait until all of them
+ * has completed before calling NdbConnection::close).
+ * If the transaction is not committed it will be aborted.
+ */
+ void close();
+
+ /** @} *********************************************************************/
+
+ /**
+ * @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
+ * @{
+ */
+
+ /**
+ * Get global checkpoint identity (GCI) of transaction.
+ *
+ * Each committed transaction belong to a GCI.
+ * The log for the committed transaction is saved on
+ * disk when a global checkpoint occurs.
+ *
+ * Whether or not the global checkpoint with this GCI has been
+ * saved on disk or not cannot be determined by this method.
+ *
+ * By comparing the GCI of a transaction with the value
+ * last GCI restored in a restarted NDB Cluster one can determine
+ * whether the transaction was restored or not.
+ *
+ * @note Global Checkpoint Identity is undefined for scan transactions
+ * (This is because no updates are performed in scan transactions.)
+ *
+ * @return GCI of transaction or -1 if GCI is not available.
+ * (Note that there has to be an NdbConnection::execute call
+ * with Ndb::Commit for the GCI to be available.)
+ */
+ int getGCI();
+
+ /**
+ * Get transaction identity.
+ *
+ * @return Transaction id.
+ */
+ Uint64 getTransactionId();
+
+ /**
+ * Returns the commit status of the transaction.
+ *
+ * @return The commit status of the transaction, i.e. one of
+ * { NotStarted, Started, TimeOut, Committed, Aborted, NeedAbort }
+ */
+ CommitStatusType commitStatus();
+
+ /** @} *********************************************************************/
+
+ /**
+ * @name Error Handling
+ * @{
+ */
+
+ /**
+ * Get error object with information about the latest error.
+ *
+ * @return An error object with information about the latest error.
+ */
+ const NdbError & getNdbError() const;
+
+ /**
+ * Get the latest NdbOperation which had an error.
+ * This method is used on the NdbConnection object to find the
+ * NdbOperation causing an error.
+ * To find more information about the
+ * actual error, use method NdbOperation::getNdbError
+ * on the returned NdbOperation object.
+ *
+ * @return The NdbOperation causing the latest error.
+ */
+ NdbOperation* getNdbErrorOperation();
+
+ /**
+ * Get the method number where the latest error occured.
+ *
+ * @return Line number where latest error occured.
+ */
+ int getNdbErrorLine();
+
+ /**
+ * Get completed (i.e. executed) operations of a transaction
+ *
+ * This method should only be used <em>after</em> a transaction
+ * has been executed.
+ * - NdbConnection::getNextCompletedOperation(NULL) returns the
+ * first NdbOperation object.
+ * - NdbConnection::getNextCompletedOperation(op) returns the
+ * NdbOperation object defined after the NdbOperation "op".
+ *
+ * This method is typically used to fetch all NdbOperation:s of
+ * a transaction to check for errors (use NdbOperation::getNdbError
+ * to fetch the NdbError object of an NdbOperation).
+ *
+ * @note This method should only be used after the transaction has been
+ * executed and before the transaction has been closed.
+ *
+ * @param op Operation, NULL means get first operation
+ * @return Operation "after" op
+ */
+ const NdbOperation * getNextCompletedOperation(const NdbOperation * op)const;
+
+ /**
+ * Release completed operations
+ */
+ void releaseCompletedOperations();
+
+
+ /** @} *********************************************************************/
+
+private:
+
+ typedef Uint64 TimeMillis_t;
+ /**************************************************************************
+ * These methods are service methods to other classes in the NDBAPI. *
+ **************************************************************************/
+
+ /**************************************************************************
+ * These are the create and delete methods of this class. *
+ **************************************************************************/
+
+ NdbConnection(Ndb* aNdb);
+
+ ~NdbConnection();
+
+ void init(); // Initialize connection object for new transaction
+
+ /**
+ * Set Connected node id
+ * and sequence no
+ */
+ void setConnectedNodeId( Uint32 nodeId, Uint32 sequence);
+
+ Uint32 getConnectedNodeId(); // Get Connected node id
+ void setMyBlockReference( int ); // Set my block refrerence
+ void setTC_ConnectPtr( Uint32 ); // Sets TC Connect pointer
+ int getTC_ConnectPtr(); // Gets TC Connect pointer
+ void setBuddyConPtr(Uint32); // Sets Buddy Con Ptr
+ Uint32 getBuddyConPtr(); // Gets Buddy Con Ptr
+ NdbConnection* next(); // Returns the next pointer
+ void next(NdbConnection*); // Sets the next pointer
+ ConStatusType Status(); // Read the status information
+ void Status(ConStatusType); // Set the status information
+ Uint32 get_send_size(); // Get size to send
+ void set_send_size(Uint32); // Set size to send;
+
+ int receiveDIHNDBTAMPER(NdbApiSignal* anApiSignal);
+ int receiveTCSEIZECONF(NdbApiSignal* anApiSignal);
+ int receiveTCSEIZEREF(NdbApiSignal* anApiSignal);
+ int receiveTCRELEASECONF(NdbApiSignal* anApiSignal);
+ int receiveTCRELEASEREF(NdbApiSignal* anApiSignal);
+ int receiveTC_COMMITCONF(const class TcCommitConf *);
+ int receiveTCKEYCONF(const class TcKeyConf *, Uint32 aDataLength);
+ int receiveTCKEY_FAILCONF(const class TcKeyFailConf *);
+ int receiveTCKEY_FAILREF(NdbApiSignal* anApiSignal);
+ int receiveTC_COMMITREF(NdbApiSignal* anApiSignal);
+ int receiveTCROLLBACKCONF(NdbApiSignal* anApiSignal); // Rec TCPREPARECONF ?
+ int receiveTCROLLBACKREF(NdbApiSignal* anApiSignal); // Rec TCPREPAREREF ?
+ int receiveTCROLLBACKREP(NdbApiSignal* anApiSignal);
+ 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 doSend(); // Send all operations
+ int sendROLLBACK(); // Send of an ROLLBACK
+ int sendTC_HBREP(); // Send a TCHBREP signal;
+ int sendCOMMIT(); // Send a TC_COMMITREQ signal;
+ void setGCI(int GCI); // Set the global checkpoint identity
+
+ int OpCompleteFailure(); // Operation Completed with success
+ int OpCompleteSuccess(); // Operation Completed with success
+
+ void CompletedOperations(); // Move active ops to list of completed
+
+ void OpSent(); // Operation Sent with success
+
+ // Free connection related resources and close transaction
+ void release();
+
+ // Release all operations in connection
+ void releaseOperations();
+
+ // Release all cursor operations in connection
+ void releaseOps(NdbOperation*);
+ void releaseCursorOperations(NdbCursorOperation*);
+
+ // Set the transaction identity of the transaction
+ void setTransactionId(Uint64 aTransactionId);
+
+ // Indicate something went wrong in the definition phase
+ void setErrorCode(int anErrorCode);
+
+ // Indicate something went wrong in the definition phase
+ void setOperationErrorCode(int anErrorCode);
+
+ // Indicate something went wrong in the definition phase
+ void setOperationErrorCodeAbort(int anErrorCode);
+
+ int checkMagicNumber(); // Verify correct object
+ NdbOperation* getNdbOperation(class NdbTableImpl* aTable);
+ NdbScanOperation* getNdbScanOperation(class NdbTableImpl* aTable);
+ NdbIndexOperation* getNdbIndexOperation(class NdbIndexImpl* anIndex,
+ class NdbTableImpl* aTable);
+
+ void handleExecuteCompletion();
+
+ /****************************************************************************
+ * These are the private variables of this class.
+ ****************************************************************************/
+
+ Uint32 ptr2int();
+ Uint32 theId;
+
+ // Keeps track of what the send method should do.
+ SendStatusType theSendStatus;
+ NdbAsynchCallback theCallbackFunction; // Pointer to the callback function
+ void* theCallbackObject; // The callback object pointer
+ Uint32 theTransArrayIndex; // Current index in a transaction
+ // array for this object
+ TimeMillis_t theStartTransTime; // Start time of the transaction
+
+ NdbError theError; // Errorcode on transaction
+ int theErrorLine; // Method number of last error in NdbOperation
+ NdbOperation* theErrorOperation; // The NdbOperation where the error occurred
+
+ Ndb* theNdb; // Pointer to Ndb object
+ NdbConnection* theNext; // Next pointer. Used in idle list.
+
+ NdbOperation* theFirstOpInList; // First operation in defining list.
+ NdbOperation* theLastOpInList; // Last operation in defining list.
+
+ NdbOperation* theFirstExecOpInList; // First executing operation in list
+ NdbOperation* theLastExecOpInList; // Last executing operation in list.
+
+
+ NdbOperation* theCompletedFirstOp; // First operation in completed
+ // operation list.
+
+ 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
+ Uint32 theGlobalCheckpointId; // The gloabl checkpoint identity of the transaction
+ ConStatusType theStatus; // The status of the connection
+
+ CompletionStatus theCompletionStatus; // The Completion status of the transaction
+ CommitStatusType theCommitStatus; // The commit status of the transaction
+ Uint32 theMagicNumber; // Magic Number to verify correct object
+
+ Uint32 thePriority; // Transaction Priority
+ ReturnType theReturnStatus; // Did we have any read/update/delete failing
+ // to find the tuple.
+ bool theTransactionIsStarted;
+ bool theInUseState;
+ bool theSimpleState;
+ Uint8 m_abortOption; // Type of commit
+
+ ListState theListState;
+
+ Uint32 theDBnode; // The database node we are connected to
+ Uint32 theNodeSequence; // The sequence no of the db node
+ bool theReleaseOnClose;
+
+ // Cursor operations
+ bool m_waitForReply;
+ NdbCursorOperation* m_theFirstCursorOperation;
+ NdbCursorOperation* m_theLastCursorOperation;
+
+ NdbCursorOperation* m_firstExecutedCursorOp;
+ // Scan operations
+ bool theScanFinished;
+
+ 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
+ Uint32 theBuddyConPtr;
+
+ static void sendTC_COMMIT_ACK(NdbApiSignal *,
+ Uint32 transId1, Uint32 transId2,
+ Uint32 aBlockRef);
+
+ void completedFail(const char * s);
+#ifdef VM_TRACE
+ void printState();
+#endif
+};
+
+inline
+Uint32
+NdbConnection::get_send_size()
+{
+ return 0;
+}
+
+inline
+void
+NdbConnection::set_send_size(Uint32 send_size)
+{
+ return;
+}
+
+inline
+int
+NdbConnection::checkMagicNumber()
+{
+ if (theMagicNumber == 0x37412619)
+ return 0;
+ else {
+#ifdef NDB_NO_DROPPED_SIGNAL
+ abort();
+#endif
+ return -1;
+ }
+}
+
+/************************************************************************************************
+void setTransactionId(Uint64 aTransactionId);
+
+Remark: Set the transaction identity.
+************************************************************************************************/
+inline
+void
+NdbConnection::setTransactionId(Uint64 aTransactionId)
+{
+ theTransactionId = aTransactionId;
+}
+
+inline
+void
+NdbConnection::setConnectedNodeId(Uint32 aNode, Uint32 aSequenceNo)
+{
+ theDBnode = aNode;
+ theNodeSequence = aSequenceNo;
+}
+/******************************************************************************
+int getConnectedNodeId();
+
+Return Value: Return theDBnode.
+Remark: Get Connected node id.
+******************************************************************************/
+inline
+Uint32
+NdbConnection::getConnectedNodeId()
+{
+ return theDBnode;
+}
+/******************************************************************************
+void setMyBlockReference(int aBlockRef);
+
+Parameters: aBlockRef: The block refrerence.
+Remark: Set my block refrerence.
+******************************************************************************/
+inline
+void
+NdbConnection::setMyBlockReference(int aBlockRef)
+{
+ theMyRef = aBlockRef;
+}
+/******************************************************************************
+void setTC_ConnectPtr(Uint32 aTCConPtr);
+
+Parameters: aTCConPtr: The connection pointer.
+Remark: Sets TC Connect pointer.
+******************************************************************************/
+inline
+void
+NdbConnection::setTC_ConnectPtr(Uint32 aTCConPtr)
+{
+ theTCConPtr = aTCConPtr;
+}
+
+/******************************************************************************
+int getTC_ConnectPtr();
+
+Return Value: Return theTCConPtr.
+Remark: Gets TC Connect pointer.
+******************************************************************************/
+inline
+int
+NdbConnection::getTC_ConnectPtr()
+{
+ return theTCConPtr;
+}
+
+inline
+void
+NdbConnection::setBuddyConPtr(Uint32 aBuddyConPtr)
+{
+ theBuddyConPtr = aBuddyConPtr;
+}
+
+inline
+Uint32 NdbConnection::getBuddyConPtr()
+{
+ return theBuddyConPtr;
+}
+
+/******************************************************************************
+NdbConnection* next();
+
+inline
+void
+NdbConnection::setBuddyConPtr(Uint32 aBuddyConPtr)
+{
+ theBuddyConPtr = aBuddyConPtr;
+}
+
+inline
+Uint32 NdbConnection::getBuddyConPtr()
+{
+ return theBuddyConPtr;
+}
+
+Return Value: Return next pointer to NdbConnection object.
+Remark: Get the next pointer.
+******************************************************************************/
+inline
+NdbConnection*
+NdbConnection::next()
+{
+ return theNext;
+}
+
+/******************************************************************************
+void next(NdbConnection aConnection);
+
+Parameters: aConnection: The connection object.
+Remark: Sets the next pointer.
+******************************************************************************/
+inline
+void
+NdbConnection::next(NdbConnection* aConnection)
+{
+ theNext = aConnection;
+}
+
+/******************************************************************************
+ConStatusType Status();
+
+Return Value Return the ConStatusType.
+Parameters: aStatus: The status.
+Remark: Sets Connect status.
+******************************************************************************/
+inline
+ConStatusType
+NdbConnection::Status()
+{
+ return theStatus;
+}
+
+/******************************************************************************
+void Status(ConStatusType aStatus);
+
+Parameters: aStatus: The status.
+Remark: Sets Connect status.
+******************************************************************************/
+inline
+void
+NdbConnection::Status( ConStatusType aStatus )
+{
+ theStatus = aStatus;
+}
+
+/******************************************************************************
+ void setGCI();
+
+Remark: Set global checkpoint identity of the transaction
+******************************************************************************/
+inline
+void
+NdbConnection::setGCI(int aGlobalCheckpointId)
+{
+ theGlobalCheckpointId = aGlobalCheckpointId;
+}
+
+/******************************************************************************
+void OpSent();
+
+Remark: An operation was sent with success that expects a response.
+******************************************************************************/
+inline
+void
+NdbConnection::OpSent()
+{
+ theNoOfOpSent++;
+}
+
+inline
+Uint32
+NdbConnection::ptr2int(){
+ return theId;
+}
+
+#endif
+
+
diff --git a/ndb/include/ndbapi/NdbCursorOperation.hpp b/ndb/include/ndbapi/NdbCursorOperation.hpp
new file mode 100644
index 00000000000..cd76b045ea2
--- /dev/null
+++ b/ndb/include/ndbapi/NdbCursorOperation.hpp
@@ -0,0 +1,93 @@
+/* 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 NdbCursorOperation_H
+#define NdbCursorOperation_H
+
+#include <NdbOperation.hpp>
+
+class NdbResultSet;
+
+/**
+ * @class NdbCursorOperation
+ * @brief Operation using cursors
+ */
+class NdbCursorOperation : public NdbOperation
+{
+ friend class NdbResultSet;
+ friend class NdbConnection;
+
+public:
+ /**
+ * Type of cursor
+ */
+ enum CursorType {
+ NoCursor = 0,
+ ScanCursor = 1,
+ IndexCursor = 2
+ };
+
+ /**
+ * Lock when performing scan
+ */
+ enum LockMode {
+ LM_Read = 0,
+ LM_Exclusive = 1,
+ LM_CommittedRead = 2,
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ LM_Dirty = 2
+#endif
+ };
+
+ virtual CursorType cursorType() = 0;
+
+ /**
+ * readTuples returns a NdbResultSet where tuples are stored.
+ * Tuples are not stored in NdbResultSet until execute(NoCommit)
+ * has been executed and nextResult has been called.
+ *
+ * @param parallel Scan parallelism
+ * @param LockMode Scan lock handling
+ * @returns NdbResultSet.
+ */
+ virtual NdbResultSet* readTuples(unsigned parallel = 0,
+ LockMode = LM_Read ) = 0;
+
+ inline NdbResultSet* readTuplesExclusive(int parallell = 0){
+ return readTuples(parallell, LM_Exclusive);
+ }
+
+protected:
+ NdbCursorOperation(Ndb* aNdb);
+
+ ~NdbCursorOperation();
+
+ void cursInit();
+
+ virtual int executeCursor(int ProcessorId) = 0;
+
+ NdbResultSet* getResultSet();
+ NdbResultSet* m_resultSet;
+
+private:
+
+ virtual int nextResult(bool fetchAllowed) = 0;
+
+ virtual void closeScan() = 0;
+};
+
+
+#endif
diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp
new file mode 100644
index 00000000000..a8a3bc86786
--- /dev/null
+++ b/ndb/include/ndbapi/NdbDictionary.hpp
@@ -0,0 +1,1033 @@
+/* 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 */
+
+/*****************************************************************************
+ * Name: NdbDictionary.hpp
+ * Include:
+ * Link:
+ * Author: Jonas Oreland
+ * Date: 2003-05-14
+ * Version: 0.1
+ * Description: Data dictionary support
+ * Documentation:
+ * Adjust: 2003-05-14 Jonas Oreland First version.
+ ****************************************************************************/
+
+#ifndef NdbDictionary_H
+#define NdbDictionary_H
+
+#include <ndb_types.h>
+
+class Ndb;
+
+/**
+ * @class NdbDictionary
+ * @brief Data dictionary class
+ *
+ * This class supports all schema data definition and enquiry such as:
+ * -# Creating tables (Dictionary::createTable) and table columns
+ * -# Dropping tables (Dictionary::dropTable)
+ * -# Creating secondary indexes (Dictionary::createIndex)
+ * -# Dropping secondary indexes (Dictionary::dropIndex)
+ * -# Enquiries about tables
+ * (Dictionary::getTable, Table::getNoOfColumns,
+ * Table::getPrimaryKey, and Table::getNoOfPrimaryKeys)
+ * -# Enquiries about indexes
+ * (Dictionary::getIndex, Index::getNoOfColumns,
+ * and Index::getColumn)
+ *
+ * NdbDictionary has several help (inner) classes:
+ * -# NdbDictionary::Table for creating tables
+ * -# NdbDictionary::Column for creating table columns
+ * -# NdbDictionary::Index for creating secondary indexes
+ *
+ * See @ref ndbapi_example4.cpp for details of usage.
+ */
+class NdbDictionary {
+public:
+ /**
+ * @class Object
+ * @brief Meta information about a database object (a table, index, etc)
+ */
+ class Object {
+ public:
+ /**
+ * Status of object
+ */
+ enum Status {
+ New, ///< The object only exist in memory and
+ ///< has not been created in the NDB Kernel
+ Changed, ///< The object has been modified in memory
+ ///< and has to be commited in NDB Kernel for
+ ///< changes to take effect
+ Retrieved ///< The object exist and has been read
+ ///< into main memory from NDB Kernel
+ };
+
+ /**
+ * Get status of object
+ */
+ virtual Status getObjectStatus() const = 0;
+
+ /**
+ * Get version of object
+ */
+ virtual int getObjectVersion() const = 0;
+
+ /**
+ * Object type
+ */
+ enum Type {
+ TypeUndefined = 0, ///< Undefined
+ SystemTable = 1, ///< System table
+ UserTable = 2, ///< User table (may be temporary)
+ UniqueHashIndex = 3, ///< Unique un-ordered hash index
+ HashIndex = 4, ///< Non-unique un-ordered hash index
+ UniqueOrderedIndex = 5, ///< Unique ordered index
+ OrderedIndex = 6, ///< Non-unique ordered index
+ HashIndexTrigger = 7, ///< Index maintenance, internal
+ IndexTrigger = 8, ///< Index maintenance, internal
+ SubscriptionTrigger = 9,///< Backup or replication, internal
+ ReadOnlyConstraint = 10 ///< Trigger, internal
+ };
+
+ /**
+ * Object state
+ */
+ enum State {
+ StateUndefined = 0, ///< Undefined
+ StateOffline = 1, ///< Offline, not usable
+ StateBuilding = 2, ///< Building, not yet usable
+ StateDropping = 3, ///< Offlining or dropping, not usable
+ StateOnline = 4, ///< Online, usable
+ StateBroken = 9 ///< Broken, should be dropped and re-created
+ };
+
+ /**
+ * Object store
+ */
+ enum Store {
+ StoreUndefined = 0, ///< Undefined
+ StoreTemporary = 1, ///< Object or data deleted on system restart
+ StorePermanent = 2 ///< Permanent. logged to disk
+ };
+
+ /**
+ * Type of fragmentation.
+ *
+ * This parameter specifies how data in the table or index will
+ * be distributed among the db nodes in the cluster.<br>
+ * The bigger the table the more number of fragments should be used.
+ * Note that all replicas count as same "fragment".<br>
+ * For a table, default is FragAllMedium. For a unique hash index,
+ * default is taken from underlying table and cannot currently
+ * be changed.
+ */
+ enum FragmentType {
+ FragUndefined = 0, ///< Fragmentation type undefined or default
+ FragSingle = 1, ///< Only one fragment
+ FragAllSmall = 2, ///< One fragment per node group
+ FragAllMedium = 3, ///< Default value. Two fragments per node group.
+ FragAllLarge = 4 ///< Eight fragments per node group.
+ };
+ };
+
+ /**
+ * @class Column
+ * @brief Represents an column in an NDB Cluster table
+ *
+ * Each column has a type. The type of a column is determind by a number
+ * of type specifiers.
+ * The type specifiers are:
+ * - Builtin type
+ * - Array length or max length
+ * - Precision and scale
+ */
+ class Column {
+ public:
+ /**
+ * The builtin column types
+ */
+ enum Type {
+ Undefined=0,///< Undefined
+ Tinyint, ///< 8 bit. 1 byte signed integer, can be used in array
+ Tinyunsigned, ///< 8 bit. 1 byte unsigned integer, can be used in array
+ Smallint, ///< 16 bit. 2 byte signed integer, can be used in array
+ Smallunsigned, ///< 16 bit. 2 byte unsigned integer, can be used in array
+ Mediumint, ///< 24 bit. 3 byte signed integer, can be used in array
+ Mediumunsigned,///< 24 bit. 3 byte unsigned integer, can be used in array
+ Int, ///< 32 bit. 4 byte signed integer, can be used in array
+ Unsigned, ///< 32 bit. 4 byte unsigned integer, can be used in array
+ Bigint, ///< 64 bit. 8 byte signed integer, can be used in array
+ Bigunsigned, ///< 64 Bit. 8 byte signed integer, can be used in array
+ Float, ///< 32-bit float. 4 bytes float, can be used in array
+ Double, ///< 64-bit float. 8 byte float, can be used in array
+ Decimal, ///< Precision, Scale are applicable
+ Char, ///< Len. A fixed array of 1-byte chars
+ Varchar, ///< Max len
+ Binary, ///< Len
+ Varbinary, ///< Max len
+ Datetime, ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes )
+ Timespec, ///< Precision down to 1 nsec(sizeof(Datetime) == 12 bytes )
+ Blob ///< Binary large object (see NdbBlob)
+ };
+
+ /**
+ * @name General
+ * @{
+ */
+ /**
+ * Constructor
+ * @param name Name of column
+ */
+ Column(const char * name = "");
+ /**
+ * Copy constructor
+ * @param column Column to be copied
+ */
+ Column(const Column& column);
+ ~Column();
+
+ /**
+ * Set name of column
+ * @param name Name of the column
+ */
+ void setName(const char * name);
+
+ /**
+ * Get name of column
+ * @return Name of the column
+ */
+ const char* getName() const;
+
+ /**
+ * Set whether column is nullable or not
+ */
+ void setNullable(bool);
+
+ /**
+ * Get if the column is nullable or not
+ */
+ bool getNullable() const;
+
+ /**
+ * Set that column is part of primary key
+ */
+ void setPrimaryKey(bool);
+
+ /**
+ * Check if column is part of primary key
+ */
+ bool getPrimaryKey() const;
+
+ /**
+ * Get number of column (horizontal position within table)
+ */
+ int getColumnNo() const;
+
+ /**
+ * Check if column is equal to some other column
+ * @param column Column to compare with
+ * @return true if column is equal to some other column otherwise false.
+ */
+ bool equal(const Column& column) const;
+
+ /** @} *******************************************************************/
+ /**
+ * @name Type Specifiers
+ * @{
+ */
+
+ /**
+ * Set type of column
+ * @param type Type of column
+ */
+ void setType(Type type);
+
+ /**
+ * Get type of column
+ */
+ Type getType() const;
+
+ /**
+ * Set precision of column.
+ * @note Only applicable for builtin type Decimal
+ */
+ void setPrecision(int);
+
+ /**
+ * Get precision of column.
+ * @note Only applicable for builtin type Decimal
+ */
+ int getPrecision() const;
+
+ /**
+ * Set scale of column.
+ * @note Only applicable for builtin type Decimal
+ */
+ void setScale(int);
+
+ /**
+ * Get scale of column.
+ * @note Only applicable for builtin type Decimal
+ */
+ int getScale() const;
+
+ /**
+ * Set length for column
+ * Array length for column or max length for variable length arrays.
+ */
+ void setLength(int length);
+
+ /**
+ * Get length for column
+ * Array length for column or max length for variable length arrays.
+ */
+ int getLength() const;
+
+ /**
+ * Set distribution key
+ *
+ * A <em>distribution key</em> is a set of attributes which are used
+ * to distribute the tuples onto the NDB nodes.
+ * The distribution key uses the NDB Cluster hashing function.
+ *
+ * An example where this is useful is TPC-C where it might be
+ * good to use the warehouse id and district id as the distribution key.
+ * This would place all data for a specific district and warehouse
+ * in the same database node.
+ *
+ * Locally in the fragments the full primary key
+ * will still be used with the hashing algorithm.
+ *
+ * @param enable If set to true, then the column will be part of
+ * the distribution key.
+ */
+ void setDistributionKey(bool enable);
+
+ /**
+ * Check if column is part of distribution key
+ * @see setDistributionKey
+ */
+ bool getDistributionKey() const;
+ /** @} *******************************************************************/
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ void setTupleKey(bool);
+ bool getTupleKey() const;
+
+ void setDistributionGroup(bool, int bits = 16);
+ bool getDistributionGroup() const;
+ int getDistributionGroupBits() const;
+
+ void setIndexOnlyStorage(bool);
+ bool getIndexOnlyStorage() const;
+
+ /**
+ * @name ODBC Specific methods
+ * @{
+ */
+ void setAutoIncrement(bool);
+ bool getAutoIncrement() const;
+ void setAutoIncrementInitialValue(Uint64 val);
+ void setDefaultValue(const char*);
+ const char* getDefaultValue() const;
+ /** @} *******************************************************************/
+#endif
+
+ private:
+ friend class NdbColumnImpl;
+ class NdbColumnImpl & m_impl;
+ Column(NdbColumnImpl&);
+ Column& operator=(const Column&);
+ };
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * ???
+ */
+ typedef Column Attribute;
+#endif
+
+ /**
+ * @brief Represents a table in NDB Cluster
+ *
+ * <em>TableSize</em><br>
+ * When calculating the data storage one should add the size of all
+ * attributes (each attributeconsumes at least 4 bytes) and also an overhead
+ * of 12 byte. Variable size attributes (not supported yet) will have a
+ * size of 12 bytes plus the actual data storage parts where there is an
+ * additional overhead based on the size of the variable part.<br>
+ * An example table with 5 attributes:
+ * one 64 bit attribute, one 32 bit attribute,
+ * two 16 bit attributes and one array of 64 8 bits.
+ * This table will consume
+ * 12 (overhead) + 8 + 4 + 2*4 (4 is minimum) + 64 = 96 bytes per record.
+ * Additionally an overhead of about 2 % as page headers and waste should
+ * be allocated. Thus, 1 million records should consume 96 MBytes
+ * plus the overhead 2 MByte and rounded up to 100 000 kBytes.<br>
+ *
+ */
+ class Table : public Object {
+ public:
+ /**
+ * @name General
+ * @{
+ */
+ /**
+ * Constructor
+ * @param name Name of table
+ */
+ Table(const char * name = "");
+
+ /**
+ * Copy constructor
+ * @param table Table to be copied
+ */
+ Table(const Table& table);
+ virtual ~Table();
+
+ /**
+ * Assignment operator, deep copy
+ * @param table Table to be copied
+ */
+ Table& operator=(const Table&);
+
+ /**
+ * Name of table
+ * @param name Name of table
+ */
+ void setName(const char * name);
+
+ /**
+ * Get table name
+ */
+ const char * getName() const;
+
+ /**
+ * Get table id
+ */
+ int getTableId() const;
+
+ /**
+ * Add a column definition to a table
+ * @note creates a copy
+ */
+ void addColumn(const Column &);
+
+ /**
+ * Get column definition via name.
+ * @return null if none existing name
+ */
+ const Column* getColumn(const char * name) const;
+
+ /**
+ * Get column definition via index in table.
+ * @return null if none existing name
+ */
+ const Column* getColumn(const int attributeId) const;
+
+ /** @} *******************************************************************/
+ /**
+ * @name Storage
+ * @{
+ */
+
+ /**
+ * If set to false, then the table is a temporary
+ * table and is not logged to disk.
+ *
+ * In case of a system restart the table will still
+ * be defined and exist but will be empty.
+ * Thus no checkpointing and no logging is performed on the table.
+ *
+ * The default value is true and indicates a normal table
+ * with full checkpointing and logging activated.
+ */
+ void setLogging(bool);
+
+ /**
+ * @see NdbDictionary::Table::setLogging.
+ */
+ bool getLogging() const;
+
+ /**
+ * Set fragmentation type
+ */
+ void setFragmentType(FragmentType);
+
+ /**
+ * Get fragmentation type
+ */
+ FragmentType getFragmentType() const;
+
+ /**
+ * Set KValue (Hash parameter.)
+ * Only allowed value is 6.
+ * Later implementations might add flexibility in this parameter.
+ */
+ void setKValue(int kValue);
+
+ /**
+ * Get KValue (Hash parameter.)
+ * Only allowed value is 6.
+ * Later implementations might add flexibility in this parameter.
+ */
+ int getKValue() const;
+
+ /**
+ * Set MinLoadFactor (Hash parameter.)
+ * This value specifies the load factor when starting to shrink
+ * the hash table.
+ * It must be smaller than MaxLoadFactor.
+ * Both these factors are given in percentage.
+ */
+ void setMinLoadFactor(int);
+
+ /**
+ * Get MinLoadFactor (Hash parameter.)
+ * This value specifies the load factor when starting to shrink
+ * the hash table.
+ * It must be smaller than MaxLoadFactor.
+ * Both these factors are given in percentage.
+ */
+ int getMinLoadFactor() const;
+
+ /**
+ * Set MaxLoadFactor (Hash parameter.)
+ * This value specifies the load factor when starting to split
+ * the containers in the local hash tables.
+ * 100 is the maximum which will optimize memory usage.
+ * A lower figure will store less information in each container and thus
+ * find the key faster but consume more memory.
+ */
+ void setMaxLoadFactor(int);
+
+ /**
+ * Get MaxLoadFactor (Hash parameter.)
+ * This value specifies the load factor when starting to split
+ * the containers in the local hash tables.
+ * 100 is the maximum which will optimize memory usage.
+ * A lower figure will store less information in each container and thus
+ * find the key faster but consume more memory.
+ */
+ int getMaxLoadFactor() const;
+
+ /** @} *******************************************************************/
+ /**
+ * @name Other
+ * @{
+ */
+
+ /**
+ * Get number of columns in the table
+ */
+ int getNoOfColumns() const;
+
+ /**
+ * Get number of primary keys in the table
+ */
+ int getNoOfPrimaryKeys() const;
+
+ /**
+ * Get name of primary key
+ */
+ const char* getPrimaryKey(int no) const;
+
+ /**
+ * Check if table is equal to some other table
+ */
+ bool equal(const Table&) const;
+
+ /**
+ * Get frm file stored with this table
+ */
+ const void* getFrmData() const;
+ Uint32 getFrmLength() const;
+
+ /**
+ * Set frm file to store with this table
+ */
+ void setFrm(const void* data, Uint32 len);
+
+ /**
+ * Set table object type
+ */
+ void setObjectType(Object::Type type);
+
+ /**
+ * Get table object type
+ */
+ Object::Type getObjectType() const;
+
+ /**
+ * Get object status
+ */
+ virtual Object::Status getObjectStatus() const;
+
+ /**
+ * Get object version
+ */
+ virtual int getObjectVersion() const;
+
+ /** @} *******************************************************************/
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ void setStoredTable(bool x) { setLogging(x); }
+ bool getStoredTable() const { return getLogging(); }
+
+ int getRowSizeInBytes() const ;
+ int createTableInDb(Ndb*, bool existingEqualIsOk = true) const ;
+#endif
+
+ private:
+ friend class NdbTableImpl;
+ class NdbTableImpl & m_impl;
+ Table(NdbTableImpl&);
+ };
+
+ /**
+ * @class Index
+ * @brief Represents an index in an NDB Cluster
+ */
+ class Index : public Object {
+ public:
+ /**
+ * Constructor
+ * @param name Name of index
+ */
+ Index(const char * name = "");
+ virtual ~Index();
+
+ /**
+ * Set the name of an index
+ */
+ void setName(const char * name);
+
+ /**
+ * Get the name of an index
+ */
+ const char * getName() const;
+
+ /**
+ * Define the name of the table to be indexed
+ */
+ void setTable(const char * name);
+
+ /**
+ * Get the name of the table being indexed
+ */
+ const char * getTable() const;
+
+ /**
+ * Get the number of columns in the index
+ */
+ unsigned getNoOfColumns() const;
+
+ /**
+ * Get the number of columns in the index
+ * Depricated, use getNoOfColumns instead.
+ */
+ int getNoOfIndexColumns() const;
+
+ /**
+ * Get a specific column in the index
+ */
+ const NdbDictionary::Column * getColumn(unsigned no) const ;
+
+ /**
+ * Get a specific column name in the index
+ * Depricated, use getColumn instead.
+ */
+ const char * getIndexColumn(int no) const ;
+
+ /**
+ * Add a column to the index definition
+ * Note that the order of columns will be in
+ * the order they are added (only matters for ordered indexes).
+ */
+ void addColumn(const Column & c);
+
+ /**
+ * Add a column name to the index definition
+ * Note that the order of indexes will be in
+ * the order they are added (only matters for ordered indexes).
+ */
+ void addColumnName(const char * name);
+
+ /**
+ * Add a column name to the index definition
+ * Note that the order of indexes will be in
+ * the order they are added (only matters for ordered indexes).
+ * Depricated, use addColumnName instead.
+ */
+ void addIndexColumn(const char * name);
+
+ /**
+ * Add several column names to the index definition
+ * Note that the order of indexes will be in
+ * the order they are added (only matters for ordered indexes).
+ */
+ void addColumnNames(unsigned noOfNames, const char ** names);
+
+ /**
+ * Add several column names to the index definition
+ * Note that the order of indexes will be in
+ * the order they are added (only matters for ordered indexes).
+ * Depricated, use addColumnNames instead.
+ */
+ void addIndexColumns(int noOfNames, const char ** names);
+
+ /**
+ * Represents type of index
+ */
+ enum Type {
+ Undefined = 0, ///< Undefined object type (initial value)
+ UniqueHashIndex = 3, ///< Unique un-ordered hash index
+ ///< (only one currently supported)
+ HashIndex = 4, ///< Non-unique un-ordered hash index
+ UniqueOrderedIndex = 5, ///< Unique ordered index
+ OrderedIndex = 6 ///< Non-unique ordered index
+ };
+
+ /**
+ * Set index type of the index
+ */
+ void setType(Type type);
+
+ /**
+ * Get index type of the index
+ */
+ Type getType() const;
+
+ /**
+ * Enable/Disable index storage on disk
+ *
+ * @param enable If enable is set to true, then logging becomes enabled
+ *
+ * @see NdbDictionary::Table::setLogging
+ *
+ * @note Non-logged indexes are rebuilt at system restart.
+ * @note Ordered index does not currently support logging.
+ */
+ void setLogging(bool enable);
+
+ /**
+ * Check if index is set to be stored on disk
+ *
+ * @see NdbDictionary::Index::setLogging
+ */
+ bool getLogging() const;
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ void setStoredIndex(bool x) { setLogging(x); }
+ bool getStoredIndex() const { return getLogging(); }
+#endif
+
+ /**
+ * Get object status
+ */
+ virtual Object::Status getObjectStatus() const;
+
+ /**
+ * Get object version
+ */
+ virtual int getObjectVersion() const;
+
+ private:
+ friend class NdbIndexImpl;
+
+ class NdbIndexImpl & m_impl;
+ Index(NdbIndexImpl&);
+ };
+
+ /**
+ * @brief Represents an Event in NDB Cluster
+ *
+ */
+ class Event : public Object {
+ public:
+ enum TableEvent { TE_INSERT=1, TE_DELETE=2, TE_UPDATE=4, TE_ALL=7 };
+ enum EventDurability {
+ ED_UNDEFINED = 0,
+#if 0 // not supported
+ ED_SESSION = 1,
+ // Only this API can use it
+ // and it's deleted after api has disconnected or ndb has restarted
+
+ ED_TEMPORARY = 2,
+ // All API's can use it,
+ // But's its removed when ndb is restarted
+#endif
+ ED_PERMANENT = 3
+ // All API's can use it,
+ // It's still defined after a restart
+ };
+
+ Event(const char *name);
+ virtual ~Event();
+ void setName(const char *);
+ void setTable(const char *);
+ void addTableEvent(const TableEvent);
+ void setDurability(const EventDurability);
+ void addColumn(const Column &c);
+ void addEventColumn(unsigned attrId);
+ void addEventColumn(const char * columnName);
+ void addEventColumns(int n, const char ** columnNames);
+
+ /**
+ * Get object status
+ */
+ virtual Object::Status getObjectStatus() const;
+
+ /**
+ * Get object version
+ */
+ virtual int getObjectVersion() const;
+
+ void print();
+
+ private:
+ friend class NdbEventImpl;
+ friend class NdbEventOperationImpl;
+ class NdbEventImpl & m_impl;
+ Event(NdbEventImpl&);
+ };
+
+ /**
+ * @class Dictionary
+ * @brief Dictionary for defining and retreiving meta data
+ */
+ class Dictionary {
+ public:
+ /**
+ * @class List
+ * @brief Structure for retrieving lists of object names
+ */
+ struct List {
+ /**
+ * @struct Element
+ * @brief Object to be stored in an NdbDictionary::Dictionary::List
+ */
+ struct Element {
+ unsigned id; ///< Id of object
+ Object::Type type; ///< Type of object
+ Object::State state; ///< State of object
+ Object::Store store; ///< How object is stored
+ char * database; ///< In what database the object resides
+ char * schema; ///< What schema the object is defined in
+ char * name; ///< Name of object
+ Element() :
+ id(0),
+ type(Object::TypeUndefined),
+ state(Object::StateUndefined),
+ store(Object::StoreUndefined),
+ database(0),
+ schema(0),
+ name(0) {
+ }
+ };
+ unsigned count; ///< Number of elements in list
+ Element * elements; ///< Pointer to array of elements
+ List() : count(0), elements(0) {}
+ ~List() {
+ if (elements != 0) {
+ for (unsigned i = 0; i < count; i++) {
+ delete[] elements[i].database;
+ delete[] elements[i].schema;
+ delete[] elements[i].name;
+ elements[i].name = 0;
+ }
+ delete[] elements;
+ count = 0;
+ elements = 0;
+ }
+ }
+ };
+
+ /**
+ * @name General
+ * @{
+ */
+
+ /**
+ * Fetch list of all objects, optionally restricted to given type.
+ */
+ int listObjects(List & list, Object::Type type = Object::TypeUndefined);
+
+ /**
+ * Get the latest error
+ *
+ * @return Error object.
+ */
+ const struct NdbError & getNdbError() const;
+
+ /** @} *******************************************************************/
+ /**
+ * @name Tables
+ * @{
+ */
+
+ /**
+ * Create defined table given defined Table instance
+ * @param Table Table to create
+ * @return 0 if successful otherwise -1.
+ */
+ int createTable(const Table &);
+
+ /**
+ * Drop table given retrieved Table instance
+ * @param Table Table to drop
+ * @return 0 if successful otherwise -1.
+ */
+ int dropTable(Table &);
+
+ /**
+ * Drop table given table name
+ * @param name Name of table to drop
+ * @return 0 if successful otherwise -1.
+ */
+ int dropTable(const char * name);
+
+ /**
+ * Alter defined table given defined Table instance
+ * @param Table Table to alter
+ * @return -2 (incompatible version) <br>
+ * -1 general error <br>
+ * 0 success
+ */
+ int alterTable(const Table &);
+
+ /**
+ * Get table with given name, NULL if undefined
+ * @param name Name of table to get
+ * @return table if successful otherwise NULL.
+ */
+ const Table * getTable(const char * name);
+
+ /**
+ * Get table with given name for alteration.
+ * @param name Name of table to alter
+ * @return table if successful. NULL if undefined
+ */
+ Table getTableForAlteration(const char * name);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * Invalidate cached table object
+ * @param name Name of table to invalidate
+ */
+ void invalidateTable(const char * name);
+#endif
+
+ /**
+ * Remove table/index from local cache
+ */
+ void removeCachedTable(const char * table);
+ void removeCachedIndex(const char * index, const char * table);
+
+
+ /** @} *******************************************************************/
+ /**
+ * @name Indexes
+ * @{
+ */
+
+ /**
+ * Create index given defined Index instance
+ * @param Index to create
+ * @return 0 if successful otherwise -1.
+ */
+ int createIndex(const Index &);
+
+ /**
+ * Drop index with given name
+ * @param indexName Name of index to drop.
+ * @param tableName Name of table that index belongs to.
+ * @return 0 if successful otherwise -1.
+ */
+ int dropIndex(const char * indexName,
+ const char * tableName);
+
+ /**
+ * Get index with given name, NULL if undefined
+ * @param indexName Name of index to get.
+ * @param tableName Name of table that index belongs to.
+ * @return index if successful, otherwise 0.
+ */
+ const Index * getIndex(const char * indexName,
+ const char * tableName);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * Invalidate cached index object
+ */
+ void invalidateIndex(const char * indexName,
+ const char * tableName);
+#endif
+
+ /**
+ * Fetch list of indexes of given table.
+ * @param list Reference to list where to store the listed indexes
+ * @param tableName Name of table that index belongs to.
+ * @return 0 if successful, otherwise -1
+ */
+ int listIndexes(List & list, const char * tableName);
+
+ /** @} *******************************************************************/
+ /**
+ * @name Events
+ * @{
+ */
+
+ /**
+ * Create event given defined Event instance
+ * @param Event to create
+ * @return 0 if successful otherwise -1.
+ */
+ int createEvent(const Event &);
+
+ /**
+ * Drop event with given name
+ * @param eventName Name of event to drop.
+ * @return 0 if successful otherwise -1.
+ */
+ int dropEvent(const char * eventName);
+
+ /**
+ * Get event with given name.
+ * @param eventName Name of event to get.
+ * @return an Event if successful, otherwise NULL.
+ */
+ const Event * getEvent(const char * eventName);
+
+ /** @} *******************************************************************/
+
+ protected:
+ Dictionary(Ndb & ndb);
+ ~Dictionary();
+
+ private:
+ friend class NdbDictionaryImpl;
+ friend class UtilTransactions;
+ class NdbDictionaryImpl & m_impl;
+ Dictionary(NdbDictionaryImpl&);
+ const Table * getIndexTable(const char * indexName,
+ const char * tableName);
+ };
+};
+
+#endif
diff --git a/ndb/include/ndbapi/NdbError.hpp b/ndb/include/ndbapi/NdbError.hpp
new file mode 100644
index 00000000000..b08dd1041b2
--- /dev/null
+++ b/ndb/include/ndbapi/NdbError.hpp
@@ -0,0 +1,212 @@
+/* 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 NDB_ERROR_HPP
+#define NDB_ERROR_HPP
+
+/**
+ * @struct NdbError
+ * @brief Contains error information
+ *
+ * A NdbError consists of five parts:
+ * -# Error status : Application impact
+ * -# Error classification : Logical error group
+ * -# Error code : Internal error code
+ * -# Error message : Context independent description of error
+ * -# Error details : Context dependent information
+ * (not always available)
+ *
+ * <em>Error status</em> is usually used for programming against errors.
+ * If more detailed error control is needed, it is possible to
+ * use the <em>error classification</em>.
+ *
+ * It is not recommended to write application programs dependent on
+ * specific <em>error codes</em>.
+ *
+ * The <em>error messages</em> and <em>error details</em> may
+ * change without notice.
+ *
+ * For example of use, see @ref ndbapi_example3.cpp.
+ */
+struct NdbError {
+ /**
+ * Status categorizes error codes into status values reflecting
+ * what the application should do when encountering errors
+ */
+ enum Status {
+ /**
+ * The error code indicate success<br>
+ * (Includes classification: NdbError::NoError)
+ */
+ Success = 0,
+
+ /**
+ * The error code indicates a temporary error.
+ * The application should typically retry.<br>
+ * (Includes classifications: NdbError::InsufficientSpace,
+ * NdbError::TemporaryResourceError, NdbError::NodeRecoveryError,
+ * NdbError::OverloadError, NdbError::NodeShutdown
+ * and NdbError::TimeoutExpired.)
+ */
+ TemporaryError = 1,
+
+ /**
+ * The error code indicates a permanent error.<br>
+ * (Includes classificatons: NdbError::PermanentError,
+ * NdbError::ApplicationError, NdbError::NoDataFound,
+ * NdbError::ConstraintViolation, NdbError::SchemaError,
+ * NdbError::UserDefinedError, NdbError::InternalError, and,
+ * NdbError::FunctionNotImplemented.)
+ */
+ PermanentError = 2,
+
+ /**
+ * The result/status is unknown.<br>
+ * (Includes classifications: NdbError::UnknownResultError, and
+ * NdbError::UnknownErrorCode.)
+ */
+ UnknownResult = 3
+ };
+
+ /**
+ * Type of error
+ */
+ enum Classification {
+ /**
+ * Success. No error occurred.
+ */
+ NoError = 0,
+
+ /**
+ * Error in application program.
+ */
+ ApplicationError = 1,
+
+ /**
+ * Read operation failed due to missing record.
+ */
+ NoDataFound = 2,
+
+ /**
+ * E.g. inserting a tuple with a primary key already existing
+ * in the table.
+ */
+ ConstraintViolation = 3,
+
+ /**
+ * Error in creating table or usage of table.
+ */
+ SchemaError = 4,
+
+ /**
+ * Error occurred in interpreted program.
+ */
+ UserDefinedError = 5,
+
+ /**
+ * E.g. insufficient memory for data or indexes.
+ */
+ InsufficientSpace = 6,
+
+ /**
+ * E.g. too many active transactions.
+ */
+ TemporaryResourceError = 7,
+
+ /**
+ * Temporary failures which are probably inflicted by a node
+ * recovery in progress. Examples: information sent between
+ * application and NDB lost, distribution change.
+ */
+ NodeRecoveryError = 8,
+
+ /**
+ * E.g. out of log file space.
+ */
+ OverloadError = 9,
+
+ /**
+ * Timeouts, often inflicted by deadlocks in NDB.
+ */
+ TimeoutExpired = 10,
+
+ /**
+ * Is is unknown whether the transaction was committed or not.
+ */
+ UnknownResultError = 11,
+
+ /**
+ * A serious error in NDB has occurred.
+ */
+ InternalError = 12,
+
+ /**
+ * A function used is not yet implemented.
+ */
+ FunctionNotImplemented = 13,
+
+ /**
+ * Error handler could not determine correct error code.
+ */
+ UnknownErrorCode = 14,
+
+ /**
+ * Node shutdown
+ */
+ NodeShutdown = 15
+ };
+
+ /**
+ * Error status.
+ */
+ Status status;
+
+ /**
+ * Error type
+ */
+ Classification classification;
+
+ /**
+ * Error code
+ */
+ int code;
+
+ /**
+ * Error message
+ */
+ const char * message;
+
+ /**
+ * The detailed description. This is extra information regarding the
+ * error which is not included in the error message.
+ *
+ * @note Is NULL when no details specified
+ */
+ char * details;
+
+ NdbError(){
+ status = UnknownResult;
+ classification = NoError;
+ code = 0;
+ message = 0;
+ details = 0;
+ }
+};
+
+class NdbOut& operator <<(class NdbOut&, const NdbError &);
+class NdbOut& operator <<(class NdbOut&, const NdbError::Status&);
+class NdbOut& operator <<(class NdbOut&, const NdbError::Classification&);
+#endif
diff --git a/ndb/include/ndbapi/NdbEventOperation.hpp b/ndb/include/ndbapi/NdbEventOperation.hpp
new file mode 100644
index 00000000000..911b00b02c4
--- /dev/null
+++ b/ndb/include/ndbapi/NdbEventOperation.hpp
@@ -0,0 +1,205 @@
+/* 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 */
+
+/*****************************************************************************
+ * Name: NdbEventOperation.hpp
+ * Include:
+ * Link:
+ * Author: Tomas Ulin MySQL AB
+ * Date: 2003-11-21
+ * Version: 0.1
+ * Description: Event support
+ * Documentation:
+ * Adjust: 2003-11-21 Tomas Ulin First version.
+ * Adjust: 2003-12-11 Tomas Ulin Alpha Release.
+ ****************************************************************************/
+
+#ifndef NdbEventOperation_H
+#define NdbEventOperation_H
+
+class NdbGlobalEventBuffer;
+class NdbEventOperationImpl;
+
+/**
+ * @class NdbEventOperation
+ * @brief Class of operations for getting change events from database.
+ *
+ * An NdbEventOperation object is instantiated by
+ * NdbEventOperation *Ndb::createEventOperation(const char *eventName,
+ * int bufferLength)
+ *
+ * Prior to that an event must have been created in the Database through
+ * int NdbDictionary::createEvent(NdbDictionary::Event)
+ *
+ * bufferLength indicates size of circular buffer to store event info as
+ * they occur.
+ *
+ * The instance is removed by Ndb::dropEventOperation(NdbEventOperation*)
+ *
+ * For more info see:
+ * ndbapi_example5.cpp
+ * Ndb.hpp
+ * NdbDictionary.hpp
+ *
+ * Known limitations:
+ *
+ * Maximum number of active NdbEventOperations are now set at compile time.
+ * Today 100. This will become a configuration parameter later.
+ *
+ * Maximum number of NdbEventOperations tied to same event are maximum 16
+ * per process.
+ *
+ * Known issues:
+ *
+ * When several NdbEventOperation s are tied to the same event in the same
+ * process they will share the circular buffer. The BufferLength will then
+ * be the same for all and decided by the first NdbEventOperation
+ * instantiation. Just make sure to instantiate the "largest" one first.
+ *
+ * Today all events INSERT/DELETE/UPDATE and all changed attributes are
+ * sent to the API, even if only specific attributes have been specified.
+ * These are however hidden from the user and only relevant data is shown
+ * after next(). However false exits from pollEvents() may occur and thus
+ * the subsequent next() will return zero, since there was no available
+ * data. Just do pollEvents() again. Will be fixed in later versions.
+ *
+ * Event code does not check table schema version. Make sure to drop events
+ * after table is dropped. Will be fixed in later
+ * versions.
+ *
+ * On a replicated system one will receive each event 2 times, one for each
+ * replica. If a node fails events will not be received twice anymore
+ * for data in corresponding fragment. Will be optimized in later versions.
+ *
+ * If a nodefailiure has occured not all events will be recieved
+ * anymore. Drop NdbEventOperation and Create again after nodes are up
+ * again. Will be fixed in later versions.
+ *
+ * Test status:
+ * Tests have been run on 1-node and 2-node systems
+ *
+ * Known bugs:
+ *
+ * None, except if we can call some of the "isses" above bugs
+ *
+ * Useful API programs:
+ *
+ * select_all -d sys 'NDB$EVENTS_0'
+ * Will show contents in the system table containing created events.
+ *
+ */
+class NdbEventOperation {
+public:
+ enum State {CREATED,EXECUTING,ERROR};
+
+ State getState();
+
+ /**
+ * Activates the NdbEventOperation to start receiving events. The
+ * changed attribute values may be retrieved after next() has returned
+ * a value greater than zero. The getValue() methods below must be called
+ * prior to execute().
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int execute();
+
+ // about the event operation
+ // getting data
+ // NdbResultSet* getResultSet();
+
+ /**
+ * Defines a retrieval operation of an attribute value.
+ * The NDB API allocate memory for the NdbRecAttr object that
+ * will hold the returned attribute value.
+ *
+ * @note Note that it is the applications responsibility
+ * to allocate enough memory for aValue (if non-NULL).
+ * The buffer aValue supplied by the application must be
+ * aligned appropriately. The buffer is used directly
+ * (avoiding a copy penalty) only if it is aligned on a
+ * 4-byte boundary and the attribute size in bytes
+ * (i.e. NdbRecAttr::attrSize times NdbRecAttr::arraySize is
+ * a multiple of 4).
+ *
+ * @note There are two versions, NdbOperation::getValue and
+ * NdbOperation::getPreValue for retrieving the current and
+ * previous value repectively.
+ *
+ * @note This method does not fetch the attribute value from
+ * the database! The NdbRecAttr object returned by this method
+ * is <em>not</em> readable/printable before the
+ * NdbEventConnection::execute has been made and
+ * NdbEventConnection::next has returned a value greater than
+ * zero. If a specific attribute has not changed the corresponding
+ * NdbRecAttr will be in state UNDEFINED. This is checked by
+ * NdbRecAttr::isNull which then returns -1.
+ *
+ * @param anAttrName Attribute name
+ * @param aValue If this is non-NULL, then the attribute value
+ * will be returned in this parameter.<br>
+ * If NULL, then the attribute value will only
+ * be stored in the returned NdbRecAttr object.
+ * @return An NdbRecAttr object to hold the value of
+ * the attribute, or a NULL pointer
+ * (indicating error).
+ */
+ NdbRecAttr *getValue(const char *anAttrName, char *aValue = NULL);
+ NdbRecAttr *getPreValue(const char *anAttrName, char *aValue = NULL);
+
+ /**
+ * Retrieves event resultset if available, inserted into the NdbRecAttrs
+ * specified in getValue() and getPreValue(). To avoid polling for
+ * a resultset, one can use Ndb::pollEvents(int millisecond_timeout)
+ * which will wait on a mutex until an event occurs or the specified
+ * timeout occurs.
+ *
+ * @return >=0 if successful otherwise -1. Return value inicates number
+ * of available events. By sending pOverRun one may query for buffer
+ * overflow and *pOverRun will indicate the number of events that have
+ * overwritten.
+ */
+ int next(int *pOverRun=NULL);
+
+ /**
+ * In the current implementation a nodefailiure may cause loss of events,
+ * in which case isConsistent() will return false
+ */
+ bool isConsistent();
+
+ /**
+ * Query for occured event type.
+ * NdbDictionary::Event::{TE_INSERT,TE_UPDATE,TE_DELETE}
+ * Only valid after next() has returned value >= 0
+ */
+ NdbDictionary::Event::TableEvent getEventType();
+
+ Uint32 getGCI();
+ Uint32 getLatestGCI();
+ void print();
+
+private:
+ friend class NdbEventOperationImpl;
+ friend class Ndb;
+ NdbEventOperation(Ndb *theNdb, const char* eventName,int bufferLength);
+ ~NdbEventOperation();
+ static int wait(void *p, int aMillisecondNumber);
+ class NdbEventOperationImpl &m_impl;
+ NdbEventOperation(NdbEventOperationImpl& impl);
+};
+
+typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*);
+#endif
diff --git a/ndb/include/ndbapi/NdbIndexOperation.hpp b/ndb/include/ndbapi/NdbIndexOperation.hpp
new file mode 100644
index 00000000000..3b8e5f7a888
--- /dev/null
+++ b/ndb/include/ndbapi/NdbIndexOperation.hpp
@@ -0,0 +1,192 @@
+/* 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 */
+
+/*****************************************************************************
+ * Name: NdbIndexOperation.hpp
+ * Include:
+ * Link:
+ * Author: Martin Sköld
+ * Date: 2002-04-01
+ * Version: 0.1
+ * Description: Secondary index support
+ * Documentation:
+ * Adjust: 2002-04-01 Martin Sköld First version.
+ ****************************************************************************/
+
+#ifndef NdbIndexOperation_H
+#define NdbIndexOperation_H
+
+#include <NdbCursorOperation.hpp>
+
+class Index;
+class NdbResultSet;
+
+/**
+ * @class NdbIndexOperation
+ * @brief Class of index operations for use in transactions
+ */
+class NdbIndexOperation : public NdbOperation
+{
+ friend class Ndb;
+ friend class NdbConnection;
+
+public:
+ /**
+ * @name Define Standard Operation
+ * @{
+ */
+
+ /**
+ * Define the NdbIndexOperation to be a standard operation of type readTuple.
+ * When calling NdbConnection::execute, this operation
+ * reads a tuple.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int readTuple();
+
+ /**
+ * Define the NdbIndexOperation to be a standard operation of type
+ * readTupleExclusive.
+ * When calling NdbConnection::execute, this operation
+ * read a tuple using an exclusive lock.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int readTupleExclusive();
+
+ /**
+ * Define the NdbIndexOperation to be a standard operation of type simpleRead.
+ * When calling NdbConnection::execute, this operation
+ * reads an existing tuple (using shared read lock),
+ * but releases lock immediately after read.
+ *
+ * @note Using this operation twice in the same transaction
+ * may produce different results (e.g. if there is another
+ * transaction which updates the value between the
+ * simple reads).
+ *
+ * Note that simpleRead can read the value from any database node while
+ * standard read always read the value on the database node which is
+ * primary for the record.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int simpleRead();
+
+ /**
+ * Define the NdbOperation to be a standard operation of type committedRead.
+ * When calling NdbConnection::execute, this operation
+ * read latest committed value of the record.
+ *
+ * This means that if another transaction is updating the
+ * record, then the current transaction will not wait.
+ * It will instead use the latest committed value of the
+ * record.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int dirtyRead();
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ int committedRead();
+#endif
+
+ /**
+ * Define the NdbIndexOperation to be a standard operation of type
+ * updateTuple.
+ *
+ * When calling NdbConnection::execute, this operation
+ * updates a tuple in the table.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int updateTuple();
+
+ /**
+ * Define the NdbIndexOperation to be a standard operation of type
+ * deleteTuple.
+ *
+ * When calling NdbConnection::execute, this operation
+ * deletes a tuple.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int deleteTuple();
+
+ /**
+ * Define the NdbIndexOperation to be a standard operation of type
+ * dirtyUpdate.
+ *
+ * When calling NdbConnection::execute, this operation
+ * updates without two-phase commit.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int dirtyUpdate();
+
+ /** @} *********************************************************************/
+ /**
+ * @name Define Interpreted Program Operation
+ * @{
+ */
+
+ /**
+ * Update a tuple using an interpreted program.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int interpretedUpdateTuple();
+
+ /**
+ * Delete a tuple using an interpreted program.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int interpretedDeleteTuple();
+
+ /** @} *********************************************************************/
+
+private:
+ NdbIndexOperation(Ndb* aNdb);
+ ~NdbIndexOperation();
+
+ void closeScan();
+
+ int receiveTCINDXREF(NdbApiSignal* aSignal);
+
+ // Overloaded method from NdbOperation
+ void setLastFlag(NdbApiSignal* signal, Uint32 lastFlag);
+
+ // Overloaded methods from NdbCursorOperation
+ int executeCursor(int ProcessorId);
+
+ // Overloaded methods from NdbCursorOperation
+ int indxInit(class NdbIndexImpl* anIndex,
+ class NdbTableImpl* aTable,
+ NdbConnection* myConnection);
+
+ int equal_impl(const class NdbColumnImpl*, const char* aValue, Uint32 len);
+ int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId);
+
+ // Private attributes
+ NdbIndexImpl* m_theIndex;
+ Uint32 m_theIndexDefined[MAXNROFTUPLEKEY][3];
+ Uint32 m_theIndexLen; // Length of the index in words
+ Uint32 m_theNoOfIndexDefined; // The number of index attributes
+};
+
+#endif
diff --git a/ndb/include/ndbapi/NdbOperation.hpp b/ndb/include/ndbapi/NdbOperation.hpp
new file mode 100644
index 00000000000..4f5f4597937
--- /dev/null
+++ b/ndb/include/ndbapi/NdbOperation.hpp
@@ -0,0 +1,1338 @@
+/* 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 NdbOperation_H
+#define NdbOperation_H
+
+#include <stdlib.h>
+#include <assert.h>
+
+#include <ndb_types.h>
+#include "AttrType.hpp"
+#include "NdbError.hpp"
+#include "NdbReceiver.hpp"
+#include <stdlib.h>
+
+class Ndb;
+class NdbApiSignal;
+class NdbRecAttr;
+class NdbOperation;
+class NdbConnection;
+class NdbColumnImpl;
+
+/**
+ * @class NdbOperation
+ * @brief Class of operations for use in transactions.
+ */
+class NdbOperation
+{
+ friend class Ndb;
+ friend class NdbConnection;
+ friend class NdbScanOperation;
+ friend class NdbScanReceiver;
+ friend class NdbScanFilter;
+ friend class NdbScanFilterImpl;
+
+public:
+ /**
+ * @name Define Standard Operation Type
+ * @{
+ */
+
+ /**
+ * Define the NdbOperation to be a standard operation of type insertTuple.
+ * When calling NdbConnection::execute, this operation
+ * adds a new tuple to the table.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int insertTuple();
+
+ /**
+ * Define the NdbOperation to be a standard operation of type updateTuple.
+ * When calling NdbConnection::execute, this operation
+ * updates a tuple in the table.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int updateTuple();
+
+ /**
+ * Define the NdbOperation to be a standard operation of type writeTuple.
+ * When calling NdbConnection::execute, this operation
+ * writes a tuple to the table.
+ * If the tuple exists, it updates it, otherwise an insert takes place.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int writeTuple();
+
+ /**
+ * Define the NdbOperation to be a standard operation of type deleteTuple.
+ * When calling NdbConnection::execute, this operation
+ * delete a tuple.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int deleteTuple();
+
+ /**
+ * Define the NdbOperation to be a standard operation of type readTuple.
+ * When calling NdbConnection::execute, this operation
+ * reads a tuple.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int readTuple();
+
+ /**
+ * Define the NdbOperation to be a standard operation of type
+ * readTupleExclusive.
+ * When calling NdbConnection::execute, this operation
+ * read a tuple using an exclusive lock.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int readTupleExclusive();
+
+ /**
+ * Define the NdbOperation to be a standard operation of type
+ * simpleRead.
+ * When calling NdbConnection::execute, this operation
+ * reads an existing tuple (using shared read lock),
+ * but releases lock immediately after read.
+ *
+ * @note Using this operation twice in the same transaction
+ * may produce different results (e.g. if there is another
+ * transaction which updates the value between the
+ * simple reads).
+ *
+ * Note that simpleRead can read the value from any database node while
+ * standard read always read the value on the database node which is
+ * primary for the record.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int simpleRead();
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * Define the NdbOperation to be a standard operation of type committedRead.
+ * When calling NdbConnection::execute, this operation
+ * read latest committed value of the record.
+ *
+ * This means that if another transaction is updating the
+ * record, then the current transaction will not wait.
+ * It will instead use the latest committed value of the
+ * record.
+ * dirtyRead is a deprecated name for committedRead
+ *
+ * @return 0 if successful otherwise -1.
+ * @depricated
+ */
+ virtual int dirtyRead();
+#endif
+
+ /**
+ * Define the NdbOperation to be a standard operation of type committedRead.
+ * When calling NdbConnection::execute, this operation
+ * read latest committed value of the record.
+ *
+ * This means that if another transaction is updating the
+ * record, then the current transaction will not wait.
+ * It will instead use the latest committed value of the
+ * record.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int committedRead();
+
+ /**
+ * Define the NdbOperation to be a standard operation of type dirtyUpdate.
+ * When calling NdbConnection::execute, this operation
+ * updates without two-phase commit.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int dirtyUpdate();
+
+ /**
+ * Define the NdbOperation to be a standard operation of type dirtyWrite.
+ * When calling NdbConnection::execute, this operation
+ * writes without two-phase commit.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int dirtyWrite();
+
+ /** @} *********************************************************************/
+ /**
+ * @name Define Interpreted Program Operation Type
+ * @{
+ */
+
+ /**
+ * Update a tuple using an interpreted program.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int interpretedUpdateTuple();
+
+ /**
+ * Delete a tuple using an interpreted program.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int interpretedDeleteTuple();
+
+ /**
+ * Scan a table to read tuples.
+ *
+ * The operation only sets a temporary read lock while
+ * reading the tuple.
+ * The tuple lock is released when the result of the read reaches the
+ * application.
+ *
+ * @param Parallelism Number of parallel tuple reads are performed
+ * in the scan.
+ * Currently a maximum of 256 parallel tuple
+ * reads are allowed.
+ * The parallelism can in reality be lower
+ * than specified
+ * depending on the number of nodes
+ * in the cluster
+ * @return 0 if successful otherwise -1.
+ */
+ int openScanRead(Uint32 Parallelism = 16 );
+
+ /**
+ * Scan a table to write or update tuples.
+ *
+ * The operation sets an exclusive lock on the tuple and sends the result
+ * to the application.
+ * Thus when the application reads the data, the tuple is
+ * still locked with an exclusive lock.
+ *
+ * @param parallelism Number of parallel tuple reads are performed
+ * in the scan.
+ * Currently a maximum of 256 parallel tuple
+ * reads are allowed.
+ * The parallelism can in reality be lower
+ * than specified depending on the number
+ * of nodes in the cluster
+ * @return 0 if successful otherwise -1.
+ *
+ */
+ int openScanExclusive(Uint32 parallelism = 16);
+
+ /**
+ * Scan a table to read tuples.
+ *
+ * The operation only sets a read lock while
+ * reading the tuple.
+ * Thus when the application reads the data, the tuple is
+ * still locked with a read lock.
+ *
+ * @param parallelism Number of parallel tuple reads are performed
+ * in the scan.
+ * Currently a maximum of 256 parallel tuple
+ * reads are allowed.
+ * The parallelism can in reality be lower
+ * than specified
+ * depending on the number of nodes
+ * in the cluster
+ * @return 0 if successful otherwise -1.
+ */
+ int openScanReadHoldLock(Uint32 parallelism = 16);
+
+ /**
+ * Scan a table to read tuples.
+ *
+ * The operation does not wait for locks held by other transactions
+ * but returns the latest committed tuple instead.
+ *
+ * @param parallelism Number of parallel tuple reads are performed
+ * in the scan.
+ * Currently a maximum of 256 parallel tuple
+ * reads are allowed.
+ * The parallelism can in reality be lower
+ * than specified
+ * depending on the number of nodes
+ * in the cluster
+ * @return 0 if successful otherwise -1.
+ */
+ int openScanReadCommitted(Uint32 parallelism = 16);
+
+ /** @} *********************************************************************/
+
+ /**
+ * @name Define Range Scan
+ *
+ * A range scan is a scan on an ordered index. The operation is on
+ * the index table but tuples are returned from the primary table.
+ * The index contains all tuples where at least one index key has not
+ * null value.
+ *
+ * A range scan is currently opened via a normal open scan method.
+ * Bounds can be defined for each index key. After setting bounds,
+ * usual scan methods can be used (get value, interpreter, take over).
+ * These operate on the primary table.
+ *
+ * @{
+ */
+
+ /**
+ * Type of ordered index key bound. The values (0-4) will not change
+ * and can be used explicitly (e.g. they could be computed).
+ */
+ enum BoundType {
+ BoundLE = 0, ///< lower bound,
+ BoundLT = 1, ///< lower bound, strict
+ BoundGE = 2, ///< upper bound
+ BoundGT = 3, ///< upper bound, strict
+ BoundEQ = 4 ///< equality
+ };
+
+ /**
+ * Define bound on index key in range scan.
+ *
+ * Each index key can have not null lower and/or upper bound, or can
+ * be set equal to not null value. The bounds can be defined in any
+ * order but a duplicate definition is an error.
+ *
+ * The scan is most effective when bounds are given for an initial
+ * sequence of non-nullable index keys, and all but the last one is an
+ * equality. In this case the scan returns a contiguous range from
+ * each ordered index fragment.
+ *
+ * @note This release implements only the case described above,
+ * except for the non-nullable limitation. Other sets of
+ * bounds return error or empty result set.
+ *
+ * @note In this release a null key value satisfies any lower
+ * bound and no upper bound. This may change.
+ *
+ * @param attrName Attribute name, alternatively:
+ * @param anAttrId Index column id (starting from 0).
+ * @param type Type of bound
+ * @param value Pointer to bound value
+ * @param len Value length in bytes.
+ * Fixed per datatype and can be omitted
+ * @return 0 if successful otherwise -1
+ */
+ int setBound(const char* anAttrName, int type, const void* aValue, Uint32 len = 0);
+
+ /**
+ * Define bound on index key in range scan using index column id.
+ * See the other setBound() method for details.
+ */
+ int setBound(Uint32 anAttrId, int type, const void* aValue, Uint32 len = 0);
+
+ /** @} *********************************************************************/
+
+ /**
+ * Validate parallelism parameter by checking the number
+ * against number of executing Ndb nodes.
+ *
+ * @param Parallelism
+ * @return 0 if correct parallelism value, otherwise -1.
+ *
+ */
+ int checkParallelism(Uint32 Parallelism);
+
+ /**
+ * Transfer scan operation to an updating transaction. Use this function
+ * when a scan has found a record that you want to update.
+ * 1. Start a new transaction.
+ * 2. Call the function takeOverForUpdate using your new transaction
+ * as parameter, all the properties of the found record will be copied
+ * to the new transaction.
+ * 3. When you execute the new transaction, the lock held by the scan will
+ * be transferred to the new transaction(it's taken over).
+ *
+ * @note You must have started the scan with openScanExclusive
+ * to be able to update the found tuple.
+ *
+ * @param updateTrans the update transaction connection.
+ * @return an NdbOperation or NULL.
+ */
+ NdbOperation* takeOverForUpdate(NdbConnection* updateTrans);
+
+ /**
+ * Transfer scan operation to a deleting transaction. Use this function
+ * when a scan has found a record that you want to delete.
+ * 1. Start a new transaction.
+ * 2. Call the function takeOverForDelete using your new transaction
+ * as parameter, all the properties of the found record will be copied
+ * to the new transaction.
+ * 3. When you execute the new transaction, the lock held by the scan will
+ * be transferred to the new transaction(its taken over).
+ *
+ * @note You must have started the scan with openScanExclusive
+ * to be able to delete the found tuple.
+ *
+ * @param deleteTrans the delete transaction connection.
+ * @return an NdbOperation or NULL.
+ */
+ NdbOperation* takeOverForDelete(NdbConnection* deleteTrans);
+
+ /**
+ * @name Specify Search Conditions
+ * @{
+ */
+ /**
+ * Define a search condition with equality.
+ * The condition is true if the attribute has the given value.
+ * To set search conditions on multiple attributes,
+ * use several equals (then all of them must be satisfied for the
+ * tuple to be selected).
+ *
+ * @note There are 10 versions of NdbOperation::equal with
+ * slightly different parameters.
+ *
+ * @note When using NdbOperation::equal with a string (char *) as
+ * second argument, the string needs to be padded with
+ * zeros in the following sense:
+ * @code
+ * // Equal needs strings to be padded with zeros
+ * strncpy(buf, str, sizeof(buf));
+ * NdbOperation->equal("Attr1", buf);
+ * @endcode
+ *
+ * @param anAttrName Attribute name
+ * @param aValue Attribute value.
+ * @param len Attribute length expressed in bytes.
+ * @return -1 if unsuccessful.
+ */
+ int equal(const char* anAttrName, const char* aValue, Uint32 len = 0);
+ int equal(const char* anAttrName, Uint32 aValue);
+ int equal(const char* anAttrName, Int32 aValue);
+ int equal(const char* anAttrName, Int64 aValue);
+ int equal(const char* anAttrName, Uint64 aValue);
+ int equal(Uint32 anAttrId, const char* aValue, Uint32 len = 0);
+ int equal(Uint32 anAttrId, Int32 aValue);
+ int equal(Uint32 anAttrId, Uint32 aValue);
+ int equal(Uint32 anAttrId, Int64 aValue);
+ int equal(Uint32 anAttrId, Uint64 aValue);
+
+ /**
+ * Generate a tuple id and set it as search argument.
+ *
+ * The Tuple id has NDB$TID as attribute name and 0 as attribute id.
+ *
+ * The generated tuple id is returned by the method.
+ * If zero is returned there is an error.
+ *
+ * This is mostly used for tables without any primary key
+ * attributes.
+ *
+ * @return Generated tuple id if successful, otherwise 0.
+ */
+ Uint64 setTupleId();
+
+ /** @} *********************************************************************/
+ /**
+ * @name Specify Attribute Actions for Operations
+ * @{
+ */
+
+ /**
+ * Defines a retrieval operation of an attribute value.
+ * The NDB API allocate memory for the NdbRecAttr object that
+ * will hold the returned attribute value.
+ *
+ * @note Note that it is the applications responsibility
+ * to allocate enough memory for aValue (if non-NULL).
+ * The buffer aValue supplied by the application must be
+ * aligned appropriately. The buffer is used directly
+ * (avoiding a copy penalty) only if it is aligned on a
+ * 4-byte boundary and the attribute size in bytes
+ * (i.e. NdbRecAttr::attrSize times NdbRecAttr::arraySize is
+ * a multiple of 4).
+ *
+ * @note There are two versions of NdbOperation::getValue with
+ * slightly different parameters.
+ *
+ * @note This method does not fetch the attribute value from
+ * the database! The NdbRecAttr object returned by this method
+ * is <em>not</em> readable/printable before the
+ * transaction has been executed with NdbConnection::execute.
+ *
+ * @param anAttrName Attribute name
+ * @param aValue If this is non-NULL, then the attribute value
+ * will be returned in this parameter.<br>
+ * If NULL, then the attribute value will only
+ * be stored in the returned NdbRecAttr object.
+ * @return An NdbRecAttr object to hold the value of
+ * the attribute, or a NULL pointer
+ * (indicating error).
+ */
+ NdbRecAttr* getValue(const char* anAttrName, char* aValue = NULL);
+ NdbRecAttr* getValue(Uint32 anAttrId, char* aValue = NULL);
+
+ /**
+ * Define an attribute to set or update in query.
+ *
+ * To set a NULL value, use the following construct:
+ * @code
+ * setValue("ATTR_NAME", (char*)NULL);
+ * @endcode
+ *
+ * There are a number of NdbOperation::setValue methods that
+ * take a certain type as input
+ * (pass by value rather than passing a pointer).
+ * As the interface is currently implemented it is the responsibility
+ * of the application programmer to use the correct types.
+ *
+ * The NDB API will however check that the application sends
+ * a correct length to the interface as given in the length parameter.
+ * The passing of char* as the value can contain any type or
+ * any type of array.
+ * If length is not provided or set to zero,
+ * then the API will assume that the pointer
+ * is correct and not bother with checking it.
+ *
+ * @note There are 14 versions of NdbOperation::setValue with
+ * slightly different parameters.
+ *
+ * @param anAttrName Name (or Id) of attribute.
+ * @param aValue Attribute value to set.
+ * @param len Attribute length expressed in bytes.
+ * @return -1 if unsuccessful.
+ */
+ virtual int setValue(const char* anAttrName, const char* aValue,
+ Uint32 len = 0);
+ virtual int setValue(const char* anAttrName, Int32 aValue);
+ virtual int setValue(const char* anAttrName, Uint32 aValue);
+ virtual int setValue(const char* anAttrName, Uint64 aValue);
+ virtual int setValue(const char* anAttrName, Int64 aValue);
+ virtual int setValue(const char* anAttrName, float aValue);
+ virtual int setValue(const char* anAttrName, double aValue);
+
+ virtual int setValue(Uint32 anAttrId, const char* aValue, Uint32 len = 0);
+ virtual int setValue(Uint32 anAttrId, Int32 aValue);
+ virtual int setValue(Uint32 anAttrId, Uint32 aValue);
+ virtual int setValue(Uint32 anAttrId, Uint64 aValue);
+ virtual int setValue(Uint32 anAttrId, Int64 aValue);
+ virtual int setValue(Uint32 anAttrId, float aValue);
+ virtual int setValue(Uint32 anAttrId, double aValue);
+
+ /** @} *********************************************************************/
+ /**
+ * @name Specify Interpreted Program Instructions
+ * @{
+ */
+
+ /**
+ * Interpreted program instruction: Add a value to an attribute.
+ *
+ * @note Destroys the contents of registers 6 and 7.
+ * (The instruction uses these registers for its operation.)
+ *
+ * @note There are four versions of NdbOperation::incValue with
+ * slightly different parameters.
+ *
+ * @param anAttrName Attribute name.
+ * @param aValue Value to add.
+ * @return -1 if unsuccessful.
+ */
+ int incValue(const char* anAttrName, Uint32 aValue);
+ int incValue(const char* anAttrName, Uint64 aValue);
+ int incValue(Uint32 anAttrId, Uint32 aValue);
+ int incValue(Uint32 anAttrId, Uint64 aValue);
+
+ /**
+ * Interpreted program instruction:
+ * Subtract a value from an attribute in an interpreted operation.
+ *
+ * @note Destroys the contents of registers 6 and 7.
+ * (The instruction uses these registers for its operation.)
+ *
+ * @note There are four versions of NdbOperation::subValue with
+ * slightly different parameters.
+ *
+ * @param anAttrName Attribute name.
+ * @param aValue Value to subtract.
+ * @return -1 if unsuccessful.
+ */
+ int subValue(const char* anAttrName, Uint32 aValue);
+ int subValue(const char* anAttrName, Uint64 aValue);
+ int subValue(Uint32 anAttrId, Uint32 aValue);
+ int subValue(Uint32 anAttrId, Uint64 aValue);
+
+ /**
+ * Interpreted program instruction:
+ * Define a jump label in an interpreted operation.
+ *
+ * @note The labels are automatically numbered starting with 0.
+ * The parameter used by NdbOperation::def_label should
+ * match the automatic numbering to make it easier to
+ * debug the interpreted program.
+ *
+ * @param labelNumber Label number.
+ * @return -1 if unsuccessful.
+ */
+ int def_label(int labelNumber);
+
+ /**
+ * Interpreted program instruction:
+ * Add two registers into a third.
+ *
+ * @param RegSource1 First register.
+ * @param RegSource2 Second register.
+ * @param RegDest Destination register where the result will be stored.
+ * @return -1 if unsuccessful.
+ */
+ int add_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest);
+
+ /**
+ * Interpreted program instruction:
+ * Substract RegSource1 from RegSource2 and put the result in RegDest.
+ *
+ * @param RegSource1 First register.
+ * @param RegSource2 Second register.
+ * @param RegDest Destination register where the result will be stored.
+ * @return -1 if unsuccessful.
+ */
+ int sub_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest);
+
+ /**
+ * Interpreted program instruction:
+ * Load a constant into a register.
+ *
+ * @param RegDest Destination register.
+ * @param Constant Value to load.
+ * @return -1 if unsuccessful.
+ */
+ int load_const_u32(Uint32 RegDest, Uint32 Constant);
+ int load_const_u64(Uint32 RegDest, Uint64 Constant);
+
+ /**
+ * Interpreted program instruction:
+ * Load NULL value into a register.
+ *
+ * @param RegDest Destination register.
+ * @return -1 if unsuccessful.
+ */
+ int load_const_null(Uint32 RegDest);
+
+ /**
+ * Interpreted program instruction:
+ * Read an attribute into a register.
+ *
+ * @param anAttrName Attribute name.
+ * @param RegDest Destination register.
+ * @return -1 if unsuccessful.
+ */
+ int read_attr(const char* anAttrName, Uint32 RegDest);
+
+ /**
+ * Interpreted program instruction:
+ * Write an attribute from a register.
+ *
+ * @param anAttrName Attribute name.
+ * @param RegSource Source register.
+ * @return -1 if unsuccessful.
+ */
+ int write_attr(const char* anAttrName, Uint32 RegSource);
+
+ /**
+ * Interpreted program instruction:
+ * Read an attribute into a register.
+ *
+ * @param anAttrId the attribute id.
+ * @param RegDest the destination register.
+ * @return -1 if unsuccessful.
+ */
+ int read_attr(Uint32 anAttrId, Uint32 RegDest);
+
+ /**
+ * Interpreted program instruction:
+ * Write an attribute from a register.
+ *
+ * @param anAttrId the attribute id.
+ * @param RegSource the source register.
+ * @return -1 if unsuccessful.
+ */
+ int write_attr(Uint32 anAttrId, Uint32 RegSource);
+
+ /**
+ * Interpreted program instruction:
+ * Define a search condition. Last two letters in the function name
+ * describes the search condition.
+ * The condition compares RegR with RegL and therefore appears
+ * to be reversed.
+ *
+ * - ge RegR >= RegL
+ * - gt RegR > RegL
+ * - le RegR <= RegL
+ * - lt RegR < RegL
+ * - eq RegR = RegL
+ * - ne RegR <> RegL
+ *
+ * @param RegLvalue left value.
+ * @param RegRvalue right value.
+ * @param Label the label to jump to.
+ * @return -1 if unsuccessful.
+ */
+ int branch_ge(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
+ int branch_gt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
+ int branch_le(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
+ int branch_lt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
+ int branch_eq(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
+ int branch_ne(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
+
+ /**
+ * Interpreted program instruction:
+ * Jump to Label if RegLvalue is not NULL.
+ *
+ * @param RegLvalue the value to check.
+ * @param Label the label to jump to.
+ * @return -1 if unsuccessful.
+ */
+ int branch_ne_null(Uint32 RegLvalue, Uint32 Label);
+
+ /**
+ * Interpreted program instruction:
+ * Jump to Label if RegLvalue is equal to NULL.
+ *
+ * @param RegLvalue Value to check.
+ * @param Label Label to jump to.
+ * @return -1 if unsuccessful.
+ */
+ int branch_eq_null(Uint32 RegLvalue, Uint32 Label);
+
+ /**
+ * Interpreted program instruction:
+ * Jump to Label.
+ *
+ * @param Label Label to jump to.
+ * @return -1 if unsuccessful.
+ */
+ int branch_label(Uint32 Label);
+
+ /**
+ * Interpreted program instruction: branch after memcmp
+ * @param ColId Column to check
+ * @param Label Label to jump to
+ * @return -1 if unsuccessful
+ */
+ int branch_col_eq_null(Uint32 ColId, Uint32 Label);
+ int branch_col_ne_null(Uint32 ColId, Uint32 Label);
+
+ /**
+ * Interpreted program instruction: branch after memcmp
+ * @param ColId column to check
+ * @param val search value
+ * @param len length of search value
+ * @param nopad force non-padded comparison for a Char column
+ * @param Label label to jump to
+ * @return -1 if unsuccessful
+ */
+ int branch_col_eq(Uint32 ColId, const char * val, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_ne(Uint32 ColId, const char * val, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_lt(Uint32 ColId, const char * val, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_le(Uint32 ColId, const char * val, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_gt(Uint32 ColId, const char * val, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_ge(Uint32 ColId, const char * val, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_like(Uint32 ColId, const char *, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_notlike(Uint32 ColId, const char *, Uint32 len,
+ bool nopad, Uint32 Label);
+
+ /**
+ * Interpreted program instruction: Exit with Ok
+ *
+ * For scanning transactions,
+ * end interpreted operation and return the row to the application.
+ *
+ * For non-scanning transactions,
+ * exit interpreted program.
+ *
+ * @return -1 if unsuccessful.
+ */
+ int interpret_exit_ok();
+
+ /**
+ * Interpreted program instruction: Exit with Not Ok
+ *
+ * For scanning transactions,
+ * continue with the next row without returning the current row.
+ *
+ * For non-scanning transactions,
+ * abort the whole transaction.
+ *
+ * @note A method also exists without the error parameter.
+ *
+ * @param ErrorCode An error code given by the application programmer.
+ * @return -1 if unsuccessful.
+ */
+ int interpret_exit_nok(Uint32 ErrorCode);
+ int interpret_exit_nok();
+
+ /**
+ * Interpreted program instruction:
+ * Define a subroutine in an interpreted operation.
+ *
+ * @param SubroutineNumber the subroutine number.
+ * @return -1 if unsuccessful.
+ */
+ int def_subroutine(int SubroutineNumber);
+
+ /**
+ * Interpreted program instruction:
+ * Call a subroutine.
+ *
+ * @param Subroutine the subroutine to call.
+ * @return -1 if unsuccessful.
+ */
+ int call_sub(Uint32 Subroutine);
+
+ /**
+ * Interpreted program instruction:
+ * End a subroutine.
+ *
+ * @return -1 if unsuccessful.
+ */
+ int ret_sub();
+
+ /** @} *********************************************************************/
+
+ /**
+ * @name Error Handling
+ * @{
+ */
+
+ /**
+ * Get the latest error code.
+ *
+ * @return error code.
+ */
+ const NdbError & getNdbError() const;
+
+ /**
+ * Get the method number where the error occured.
+ *
+ * @return method number where the error occured.
+ */
+ int getNdbErrorLine();
+
+ /** @} *********************************************************************/
+
+protected:
+/******************************************************************************
+ * These are the methods used to create and delete the NdbOperation objects.
+ *****************************************************************************/
+ NdbOperation(Ndb* aNdb);
+ virtual ~NdbOperation();
+
+ bool needReply();
+/******************************************************************************
+ * These methods are service routines used by the other NDB API classes.
+ *****************************************************************************/
+//--------------------------------------------------------------
+// Initialise after allocating operation to a transaction
+//--------------------------------------------------------------
+ int init(class NdbTableImpl*, NdbConnection* aCon);
+
+ void initScan(); // Initialise after allocating operation
+ // to a scan transaction
+ virtual void releaseScan(); // Release scan parts of transaction
+ void releaseSignals();
+ void releaseScanSignals();
+ void prepareNextScanResult();
+
+ // Common part for Read and Exclusive
+ int openScan(Uint32 aParallelism, bool, bool, bool);
+
+ void next(NdbOperation*); // Set next pointer
+
+ NdbOperation* next(); // Get next pointer
+
+ OperationStatus Status(); // Read the status information
+
+ void Status(OperationStatus); // Set the status information
+
+ OperationType RequestType();
+
+ void NdbCon(NdbConnection*); // Set reference to connection
+ // object.
+
+ virtual void release(); // Release all operations
+ // connected to
+ // the operations object.
+ void setStartIndicator();
+
+ void setCommitIndicator(CommitType aCommitType);
+
+/******************************************************************************
+ * The methods below is the execution part of the NdbOperation
+ * class. This is where the NDB signals are sent and received. The
+ * operation can send TC[KEY/INDX]REQ, [INDX]ATTRINFO.
+ * It can receive TC[KEY/INDX]CONF, TC[KEY/INDX]REF, [INDX]ATTRINFO.
+ * When an operation is received in its fulness or a refuse message
+ * was sent, then the connection object is told about this situation.
+ *****************************************************************************/
+
+ int doSend(int ProcessorId, Uint32 lastFlag);
+ int doSendScan(int ProcessorId);
+
+ int prepareSendScan(Uint32 TC_ConnectPtr,
+ Uint64 TransactionId);
+
+ virtual int prepareSend(Uint32 TC_ConnectPtr,
+ Uint64 TransactionId);
+ virtual void setLastFlag(NdbApiSignal* signal, Uint32 lastFlag);
+
+ int prepareSendInterpreted(); // Help routine to prepare*
+
+ void TCOPCONF(Uint32 anNdbColumnImplLen); // Handle TC[KEY/INDX]CONF signal
+
+ int receiveTCKEYREF(NdbApiSignal*);
+
+
+ int receiveTRANSID_AI(const Uint32* aDataPtr, Uint32 aDataLength);
+ int receiveREAD_CONF(const Uint32* aDataPtr, Uint32 aDataLength);
+
+
+ int checkMagicNumber(); // Verify correct object
+
+ int checkState_TransId(NdbApiSignal* aSignal);
+
+/******************************************************************************
+ * These are support methods only used locally in this class.
+******************************************************************************/
+
+ virtual int equal_impl(const NdbColumnImpl* anAttrObject,
+ const char* aValue,
+ Uint32 len);
+ NdbRecAttr* getValue(const NdbColumnImpl* anAttrObject, char* aValue = NULL);
+ int setValue(const NdbColumnImpl* anAttrObject, const char* aValue, Uint32 len);
+ int incValue(const NdbColumnImpl* anAttrObject, Uint32 aValue);
+ int incValue(const NdbColumnImpl* anAttrObject, Uint64 aValue);
+ int subValue(const NdbColumnImpl* anAttrObject, Uint32 aValue);
+ int subValue(const NdbColumnImpl* anAttrObject, Uint64 aValue);
+ int read_attr(const NdbColumnImpl* anAttrObject, Uint32 RegDest);
+ int write_attr(const NdbColumnImpl* anAttrObject, Uint32 RegSource);
+ int branch_reg_reg(Uint32 type, Uint32, Uint32, Uint32);
+ int branch_col(Uint32 type, Uint32, const char *, Uint32, bool, Uint32 Label);
+ int branch_col_null(Uint32 type, Uint32 col, Uint32 Label);
+ int setBound(const NdbColumnImpl* anAttrObject, int type, const void* aValue, Uint32 len);
+
+ // Handle ATTRINFO signals
+ int receiveREAD_AI(Uint32* aDataPtr, Uint32 aLength);
+
+ int insertATTRINFO(Uint32 aData);
+ int insertATTRINFOloop(const Uint32* aDataPtr, Uint32 aLength);
+ int getFirstATTRINFOScan();
+ int saveBoundATTRINFO();
+
+ int insertKEYINFO(const char* aValue,
+ Uint32 aStartPosition,
+ Uint32 aKeyLenInByte,
+ Uint32 anAttrBitsInLastWord);
+
+ virtual void setErrorCode(int aErrorCode);
+ virtual void setErrorCodeAbort(int aErrorCode);
+
+ void handleFailedAI_ElemLen(); // When not all attribute data
+ // were received
+
+ int incCheck(const NdbColumnImpl* anAttrObject);
+ int initial_interpreterCheck();
+ int intermediate_interpreterCheck();
+ int read_attrCheck(const NdbColumnImpl* anAttrObject);
+ int write_attrCheck(const NdbColumnImpl* anAttrObject);
+ int labelCheck();
+ int insertCall(Uint32 aCall);
+ int insertBranch(Uint32 aBranch);
+
+ Uint32 ptr2int() { return theReceiver.getId(); };
+
+ NdbOperation*
+ takeOverScanOp(OperationType opType, NdbConnection* updateTrans);
+
+/******************************************************************************
+ * These are the private variables that are defined in the operation objects.
+ *****************************************************************************/
+
+ NdbReceiver theReceiver;
+
+ NdbError theError; // Errorcode
+ int theErrorLine; // Error line
+
+ Ndb* theNdb; // Point back to the Ndb object.
+ NdbConnection* theNdbCon; // Point back to the connection object.
+ NdbOperation* theNext; // Next pointer to operation.
+ NdbOperation* theNextScanOp;
+ NdbApiSignal* theTCREQ; // The TC[KEY/INDX]REQ signal object
+ NdbApiSignal* theFirstATTRINFO; // The first ATTRINFO signal object
+ NdbApiSignal* theCurrentATTRINFO; // The current ATTRINFO signal object
+ Uint32 theTotalCurrAI_Len; // The total number of attribute info
+ // words currently defined
+ Uint32 theAI_LenInCurrAI; // The number of words defined in the
+ // current ATTRINFO signal
+ NdbApiSignal* theFirstKEYINFO; // The first KEYINFO signal object
+ NdbApiSignal* theLastKEYINFO; // The first KEYINFO signal object
+
+ NdbRecAttr* theFirstRecAttr; // The first receive attribute object
+ NdbRecAttr* theCurrentRecAttr; // The current receive attribute object
+
+ class NdbLabel* theFirstLabel;
+ class NdbLabel* theLastLabel;
+ class NdbBranch* theFirstBranch;
+ class NdbBranch* theLastBranch;
+ class NdbCall* theFirstCall;
+ class NdbCall* theLastCall;
+ class NdbSubroutine* theFirstSubroutine;
+ class NdbSubroutine* theLastSubroutine;
+ Uint32 theNoOfLabels;
+ Uint32 theNoOfSubroutines;
+
+ Uint32* theKEYINFOptr; // Pointer to where to write KEYINFO
+ Uint32* theATTRINFOptr; // Pointer to where to write ATTRINFO
+
+ Uint32 theTotalRecAI_Len; // The total length received according
+ // to the TCKEYCONF signal
+ Uint32 theCurrRecAI_Len; // The currently received length
+ Uint32 theAI_ElementLen; // How many words long is this element
+ Uint32* theCurrElemPtr; // The current pointer to the element
+ //Uint32 theTableId; // Table id.
+ //Uint32 theAccessTableId; // The id of table for initial access,
+ // changed by NdbIndexOperation
+ //Uint32 theSchemaVersion; // The schema version on the table.
+ class NdbTableImpl* m_currentTable; // The current table
+ class NdbTableImpl* m_accessTable;
+
+ // Set to TRUE when a tuple key attribute has been defined.
+ // A tuple key is allowed to consist of 64 attributes.
+ Uint32 theTupleKeyDefined[MAXNROFTUPLEKEY][3];
+
+ Uint32 theTotalNrOfKeyWordInSignal; // The total number of
+ // keyword in signal.
+
+ Uint32 theTupKeyLen; // Length of the tuple key in words
+ Uint32 theNoOfTupKeyDefined; // The number of tuple key attributes
+ // currently defined
+ OperationType theOperationType; // Read Request, Update Req......
+
+ Uint8 theLockMode; // Can be set to WRITE if read operation
+ OperationStatus theStatus; // The status of the operation.
+ Uint32 theMagicNumber; // Magic number to verify that object
+ // is correct
+ Uint32 theScanInfo; // Scan info bits (take over flag etc)
+ Uint32 theDistrKeySize; // Distribution Key size if used
+ Uint32 theDistributionGroup; // Distribution Group if used
+
+ Uint32 theSubroutineSize; // Size of subroutines for interpretation
+ Uint32 theInitialReadSize; // Size of initial reads for interpretation
+ Uint32 theInterpretedSize; // Size of interpretation
+ Uint32 theFinalUpdateSize; // Size of final updates for interpretation
+ Uint32 theFinalReadSize; // Size of final reads for interpretation
+
+ Uint8 theStartIndicator; // Indicator of whether start operation
+ Uint8 theCommitIndicator; // Indicator of whether commit operation
+ Uint8 theSimpleIndicator; // Indicator of whether simple operation
+ Uint8 theDirtyIndicator; // Indicator of whether dirty operation
+ Uint8 theInterpretIndicator; // Indicator of whether interpreted operation
+ Uint8 theDistrGroupIndicator; // Indicates whether distribution grp is used
+ Uint8 theDistrGroupType; // Type of distribution group used
+ Uint8 theDistrKeyIndicator; // Indicates whether distr. key is used
+
+ Uint16 m_tcReqGSN;
+ Uint16 m_keyInfoGSN;
+ Uint16 m_attrInfoGSN;
+
+ // Scan related variables
+ Uint32 theParallelism;
+ NdbScanReceiver** theScanReceiversArray;
+ NdbApiSignal* theSCAN_TABREQ;
+ NdbApiSignal* theFirstSCAN_TABINFO_Send;
+ NdbApiSignal* theLastSCAN_TABINFO_Send;
+ NdbApiSignal* theFirstSCAN_TABINFO_Recv;
+ NdbApiSignal* theLastSCAN_TABINFO_Recv;
+ NdbApiSignal* theSCAN_TABCONF_Recv;
+ // saveBoundATTRINFO() moves ATTRINFO here when setBound() is ready
+ NdbApiSignal* theBoundATTRINFO;
+ Uint32 theTotalBoundAI_Len;
+
+};
+
+inline
+int
+NdbOperation::checkMagicNumber()
+{
+ if (theMagicNumber != 0xABCDEF01){
+#ifdef NDB_NO_DROPPED_SIGNAL
+ abort();
+#endif
+ return -1;
+ }
+ return 0;
+}
+
+inline
+void
+NdbOperation::setStartIndicator()
+{
+ theStartIndicator = 1;
+}
+
+#if 0
+inline
+void
+NdbOperation::setCommitIndicator(CommitType aTypeOfCommit)
+{
+ theCommitIndicator = 1;
+ theCommitType = (Uint8)aTypeOfCommit;
+}
+#endif
+
+inline
+int
+NdbOperation::getNdbErrorLine()
+{
+ return theErrorLine;
+}
+
+/******************************************************************************
+void next(NdbOperation* aNdbOperation);
+
+Parameters: aNdbOperation: Pointers to the NdbOperation object.
+Remark: Set the next variable of the operation object.
+******************************************************************************/
+inline
+void
+NdbOperation::next(NdbOperation* aNdbOperation)
+{
+ theNext = aNdbOperation;
+}
+
+/******************************************************************************
+NdbOperation* next();
+
+Return Value: Return next pointer to NdbOperation object.
+Remark: Get the next variable of the operation object.
+******************************************************************************/
+inline
+NdbOperation*
+NdbOperation::next()
+{
+ return theNext;
+}
+
+/******************************************************************************
+OperationStatus Status();
+
+Return Value Return the OperationStatus.
+Parameters: aStatus: The status.
+Remark: Sets Operation status.
+******************************************************************************/
+inline
+OperationStatus
+NdbOperation::Status()
+{
+ return theStatus;
+}
+
+/******************************************************************************
+void Status(OperationStatus aStatus);
+
+Parameters: aStatus: The status.
+Remark: Sets Operation
+ status.
+******************************************************************************/
+inline
+void
+NdbOperation::Status( OperationStatus aStatus )
+{
+ theStatus = aStatus;
+}
+
+/******************************************************************************
+void NdbCon(NdbConnection* aNdbCon);
+
+Parameters: aNdbCon: Pointers to NdbConnection object.
+Remark: Set the reference to the connection in the operation object.
+******************************************************************************/
+inline
+void
+NdbOperation::NdbCon(NdbConnection* aNdbCon)
+{
+ theNdbCon = aNdbCon;
+}
+
+/******************************************************************************
+OperationType RequestType();
+
+Remark: Return the request typ of the operation..
+******************************************************************************/
+inline
+OperationType
+NdbOperation::RequestType()
+{
+ return theOperationType;
+}
+
+inline
+int
+NdbOperation::equal(const char* anAttrName, Int32 aPar)
+{
+ return equal(anAttrName, (const char*)&aPar, (Uint32)4);
+}
+
+inline
+int
+NdbOperation::equal(const char* anAttrName, Uint32 aPar)
+{
+ return equal(anAttrName, (const char*)&aPar, (Uint32)4);
+}
+
+inline
+int
+NdbOperation::equal(const char* anAttrName, Int64 aPar)
+{
+ return equal(anAttrName, (const char*)&aPar, (Uint32)8);
+}
+
+inline
+int
+NdbOperation::equal(const char* anAttrName, Uint64 aPar)
+{
+ return equal(anAttrName, (const char*)&aPar, (Uint32)8);
+}
+
+inline
+int
+NdbOperation::equal(Uint32 anAttrId, Int32 aPar)
+{
+ return equal(anAttrId, (const char*)&aPar, (Uint32)4);
+}
+
+inline
+int
+NdbOperation::equal(Uint32 anAttrId, Uint32 aPar)
+{
+ return equal(anAttrId, (const char*)&aPar, (Uint32)4);
+}
+
+inline
+int
+NdbOperation::equal(Uint32 anAttrId, Int64 aPar)
+{
+ return equal(anAttrId, (const char*)&aPar, (Uint32)8);
+}
+
+inline
+int
+NdbOperation::equal(Uint32 anAttrId, Uint64 aPar)
+{
+ return equal(anAttrId, (const char*)&aPar, (Uint32)8);
+}
+
+inline
+int
+NdbOperation::setValue(const char* anAttrName, Int32 aPar)
+{
+ return setValue(anAttrName, (const char*)&aPar, (Uint32)4);
+}
+
+inline
+int
+NdbOperation::setValue(const char* anAttrName, Uint32 aPar)
+{
+ return setValue(anAttrName, (const char*)&aPar, (Uint32)4);
+}
+
+inline
+int
+NdbOperation::setValue(const char* anAttrName, Int64 aPar)
+{
+ return setValue(anAttrName, (const char*)&aPar, (Uint32)8);
+}
+
+inline
+int
+NdbOperation::setValue(const char* anAttrName, Uint64 aPar)
+{
+ return setValue(anAttrName, (const char*)&aPar, (Uint32)8);
+}
+
+inline
+int
+NdbOperation::setValue(const char* anAttrName, float aPar)
+{
+ return setValue(anAttrName, (const char*)&aPar, (Uint32)4);
+}
+
+inline
+int
+NdbOperation::setValue(const char* anAttrName, double aPar)
+{
+ return setValue(anAttrName, (const char*)&aPar, (Uint32)8);
+}
+
+inline
+int
+NdbOperation::setValue(Uint32 anAttrId, Int32 aPar)
+{
+ return setValue(anAttrId, (const char*)&aPar, (Uint32)4);
+}
+
+inline
+int
+NdbOperation::setValue(Uint32 anAttrId, Uint32 aPar)
+{
+ return setValue(anAttrId, (const char*)&aPar, (Uint32)4);
+}
+
+inline
+int
+NdbOperation::setValue(Uint32 anAttrId, Int64 aPar)
+{
+ return setValue(anAttrId, (const char*)&aPar, (Uint32)8);
+}
+
+inline
+int
+NdbOperation::setValue(Uint32 anAttrId, Uint64 aPar)
+{
+ return setValue(anAttrId, (const char*)&aPar, (Uint32)8);
+}
+
+inline
+int
+NdbOperation::setValue(Uint32 anAttrId, float aPar)
+{
+ return setValue(anAttrId, (char*)&aPar, (Uint32)4);
+}
+
+inline
+int
+NdbOperation::setValue(Uint32 anAttrId, double aPar)
+{
+ return setValue(anAttrId, (const char*)&aPar, (Uint32)8);
+}
+
+#endif
+
+
diff --git a/ndb/include/ndbapi/NdbPool.hpp b/ndb/include/ndbapi/NdbPool.hpp
new file mode 100644
index 00000000000..64cba5a008c
--- /dev/null
+++ b/ndb/include/ndbapi/NdbPool.hpp
@@ -0,0 +1,35 @@
+/* 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 */
+
+class Ndb;
+class NdbPool;
+
+bool
+create_instance(Uint32 max_ndb_objects,
+ Uint32 no_conn_obj,
+ Uint32 init_no_ndb_objects);
+
+void
+drop_instance();
+
+Ndb*
+get_ndb_object(Uint32 &hint_id,
+ const char* a_catalog_name,
+ const char* a_schema_name);
+
+void
+return_ndb_object(Ndb* returned_object, Uint32 id);
+
diff --git a/ndb/include/ndbapi/NdbRecAttr.hpp b/ndb/include/ndbapi/NdbRecAttr.hpp
new file mode 100644
index 00000000000..a5595096bf6
--- /dev/null
+++ b/ndb/include/ndbapi/NdbRecAttr.hpp
@@ -0,0 +1,512 @@
+/* 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 NdbRecAttr_H
+#define NdbRecAttr_H
+
+#include <stdlib.h>
+
+#include <ndb_types.h>
+#include <NdbDictionary.hpp>
+#include "AttrType.hpp"
+
+class NdbOperation;
+class AttrInfo;
+
+/**
+ * @class NdbRecAttr
+ * @brief Contains value of an attribute.
+ *
+ * NdbRecAttr objects are used to store the attribute value
+ * after retrieving the value from the NDB Cluster using the method
+ * NdbOperation::getValue. The objects are allocated by the NDB API.
+ * An example application program follows:
+ *
+ * @code
+ * MyRecAttr = MyOperation->getValue("ATTR2", NULL);
+ * if (MyRecAttr == NULL) goto error;
+ *
+ * if (MyConnection->execute(Commit) == -1) goto error;
+ *
+ * ndbout << MyRecAttr->u_32_value();
+ * @endcode
+ * For more examples, see
+ * @ref ndbapi_example1.cpp and
+ * @ref ndbapi_example2.cpp.
+ *
+ * @note The NdbRecAttr object is instantiated with its value when
+ * NdbConnection::execute is called. Before this, the value is
+ * undefined. (NdbRecAttr::isNULL can be used to check
+ * if the value is defined or not.)
+ * This means that an NdbRecAttr object only has valid information
+ * between the time of calling NdbConnection::execute and
+ * the time of Ndb::closeTransaction.
+ * The value of the null indicator is -1 until the
+ * NdbConnection::execute method have been called.
+ *
+ * For simple types, there are methods which directly getting the value
+ * from the NdbRecAttr object.
+ *
+ * To get a reference to the value, there are two methods:
+ * NdbRecAttr::aRef (memory is released by NDB API) and
+ * NdbRecAttr::getAttributeObject (memory must be released
+ * by application program).
+ * The two methods may return different pointers.
+ *
+ * There are also methods to check attribute type, attribute size and
+ * array size.
+ * The method NdbRecAttr::arraySize returns the number of elements in the
+ * array (where each element is of size given by NdbRecAttr::attrSize).
+ * The NdbRecAttr::arraySize method is needed when reading variable-sized
+ * attributes.
+ *
+ * @note Variable-sized attributes are not yet supported.
+ */
+class NdbRecAttr
+{
+ friend class NdbOperation;
+ friend class NdbEventOperationImpl;
+ friend class NdbScanReceiver;
+ friend class Ndb;
+
+public:
+ /**
+ * @name Getting meta information
+ * @{
+ */
+ const NdbDictionary::Column * getColumn() const;
+
+ /**
+ * Get attribute type.
+ *
+ * @return Type of attribute: { Signed, UnSigned, Float, String }
+ */
+ AttrType attrType() const ;
+ NdbDictionary::Column::Type getType() const;
+
+ /**
+ * Get attribute (element) size in bytes.
+ *
+ * @note For arrays, the method only gives the size of an element.
+ * The total attribute size is calculated by
+ * multiplying this value with the value
+ * returned by NdbRecAttr::arraySize.
+ *
+ * @return Attribute size in 32 bit unsigned int.
+ */
+ Uint32 attrSize() const ;
+
+ /**
+ * Get array size of attribute.
+ * For variable-sized arrays this method returns the
+ * size of the attribute read.
+ *
+ * @return array size in 32 unsigned int.
+ */
+ Uint32 arraySize() const ;
+ Uint32 getLength() const ;
+
+ /** @} *********************************************************************/
+ /**
+ * @name Getting stored value
+ * @{
+ */
+
+ /**
+ * Check if attribute value is NULL.
+ *
+ * @return -1 = Not defined (Failure or
+ * NdbConnection::execute not yet called).<br>
+ * 0 = Attribute value is defined, but not equal to NULL.<br>
+ * 1 = Attribute value is defined and equal to NULL.
+ */
+ int isNULL() const;
+
+ /**
+ * Get value stored in NdbRecAttr object.
+ *
+ * @return 64 bit long value.
+ */
+ Int64 int64_value() const;
+
+ /**
+ * Get value stored in NdbRecAttr object.
+ *
+ * @return 32 bit int value.
+ */
+ Int32 int32_value() const;
+
+ /**
+ * Get value stored in NdbRecAttr object.
+ *
+ * @return Short value.
+ */
+ short short_value() const;
+
+ /**
+ * Get value stored in NdbRecAttr object.
+ *
+ * @return Char value.
+ */
+ char char_value() const;
+
+ /**
+ * Get value stored in NdbRecAttr object.
+ *
+ * @return 64 bit unsigned value.
+ */
+ Uint64 u_64_value() const;
+
+ /**
+ * Get value stored in NdbRecAttr object.
+ *
+ * @return 32 bit unsigned value.
+ */
+ Uint32 u_32_value() const;
+
+ /**
+ * Get value stored in NdbRecAttr object.
+ *
+ * @return Unsigned short value.
+ */
+ Uint16 u_short_value() const;
+
+ /**
+ * Get value stored in NdbRecAttr object.
+ *
+ * @return Unsigned char value.
+ */
+ Uint8 u_char_value() const;
+
+ /**
+ * Get value stored in NdbRecAttr object.
+ *
+ * @return Float value.
+ */
+ float float_value() const;
+
+ /**
+ * Get value stored in NdbRecAttr object.
+ *
+ * @return Double value.
+ */
+ double double_value() const;
+
+ /** @} *********************************************************************/
+ /**
+ * @name Getting reference to stored value
+ * @{
+ */
+
+ /**
+ * Get reference to attribute value.
+ *
+ * Returns a char*-pointer to the value.
+ * The pointer is aligned appropriately for the data type.
+ * The memory is released when Ndb::closeTransaction is executed
+ * for the transaction which read the value.
+ *
+ * @note The memory is released by NDB API.
+ *
+ * @note The pointer to the attribute value stored in an NdbRecAttr
+ * object (i.e. the pointer returned by aRef) is constant.
+ * This means that this method can be called anytime after
+ * NdbOperation::getValue has been called.
+ *
+ * @return Pointer to attribute value.
+ */
+ char* aRef() const;
+
+ /** @} *********************************************************************/
+
+ /**
+ * Make a copy of RecAttr object including all data.
+ *
+ * @note Copy needs to be deleted by application program.
+ */
+ NdbRecAttr * clone() const;
+
+ /**
+ * Destructor
+ *
+ * @note You should only delete RecAttr-copies,
+ * i.e. objects that has been cloned.
+ */
+ ~NdbRecAttr();
+private:
+ NdbRecAttr();
+
+ Uint32 attrId() const; /* Get attribute id */
+ void setNULL(); /* Set NULL indicator */
+ void setNotNULL(); /* Set Not NULL indicator */
+ void setUNDEFINED(); /* Set UNDEFINED indicator */
+
+ void release(); /* Release memory if allocated */
+ void init(); /* Initialise object when allocated */
+
+ 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 */
+ void copyout(); /* Copy from storage to application */
+
+ Uint64 theStorage[4]; /* The data storage here if <= 32 bytes */
+ Uint64* theStorageX; /* The data storage here if > 32 bytes */
+ char* theValue; /* The data storage in the application */
+ void* theRef; /* Pointer to one of above */
+
+ NdbRecAttr* theNext; /* Next pointer */
+ Uint32 theAttrId; /* The attribute id */
+
+ int theNULLind;
+ Uint32 theAttrSize;
+ Uint32 theArraySize;
+ const NdbDictionary::Column* m_column;
+};
+
+inline
+NdbDictionary::Column::Type
+NdbRecAttr::getType() const {
+ return m_column->getType();
+}
+
+inline
+const NdbDictionary::Column *
+NdbRecAttr::getColumn() const {
+ return m_column;
+}
+
+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;
+ }
+}
+
+inline
+AttrType
+NdbRecAttr::attrType() const {
+ switch(getType()){
+ case NdbDictionary::Column::Bigint:
+ case NdbDictionary::Column::Int:
+ return Signed;
+ case NdbDictionary::Column::Bigunsigned:
+ case NdbDictionary::Column::Unsigned:
+ return UnSigned;
+ case NdbDictionary::Column::Float:
+ case NdbDictionary::Column::Decimal:
+ case NdbDictionary::Column::Double:
+ return Float;
+ case NdbDictionary::Column::Char:
+ case NdbDictionary::Column::Varchar:
+ case NdbDictionary::Column::Binary:
+ case NdbDictionary::Column::Varbinary:
+ return String;
+ case NdbDictionary::Column::Datetime:
+ case NdbDictionary::Column::Timespec:
+ case NdbDictionary::Column::Undefined:
+ default:
+ return NoAttrTypeDef;
+ }
+}
+
+inline
+Uint32
+NdbRecAttr::arraySize() const
+{
+ return theArraySize;
+}
+
+inline
+Int64
+NdbRecAttr::int64_value() const
+{
+ return *(Int64*)theRef;
+}
+
+inline
+Int32
+NdbRecAttr::int32_value() const
+{
+ return *(Int32*)theRef;
+}
+
+inline
+short
+NdbRecAttr::short_value() const
+{
+ return *(short*)theRef;
+}
+
+inline
+char
+NdbRecAttr::char_value() const
+{
+ return *(char*)theRef;
+}
+
+inline
+Uint64
+NdbRecAttr::u_64_value() const
+{
+ return *(Uint64*)theRef;
+}
+
+inline
+Uint32
+NdbRecAttr::u_32_value() const
+{
+ return *(Uint32*)theRef;
+}
+
+inline
+Uint16
+NdbRecAttr::u_short_value() const
+{
+ return *(Uint16*)theRef;
+}
+
+inline
+Uint8
+NdbRecAttr::u_char_value() const
+{
+ return *(Uint8*)theRef;
+}
+
+inline
+float
+NdbRecAttr::float_value() const
+{
+ return *(float*)theRef;
+}
+
+inline
+double
+NdbRecAttr::double_value() const
+{
+ return *(double*)theRef;
+}
+
+inline
+void
+NdbRecAttr::release()
+{
+ if (theStorageX != NULL) {
+ delete [] theStorageX;
+ theStorageX = NULL;
+ }
+}
+
+inline
+void
+NdbRecAttr::init()
+{
+ theStorageX = NULL;
+ theValue = NULL;
+ theRef = NULL;
+ theNext = NULL;
+ theAttrId = 0xFFFF;
+ theNULLind = -1;
+}
+
+inline
+void
+NdbRecAttr::next(NdbRecAttr* aRecAttr)
+{
+ theNext = aRecAttr;
+}
+
+inline
+NdbRecAttr*
+NdbRecAttr::next() const
+{
+ return theNext;
+}
+
+inline
+char*
+NdbRecAttr::aRef() const
+{
+ return (char*)theRef;
+}
+
+inline
+bool
+NdbRecAttr::copyoutRequired() const
+{
+ return theRef != theValue && theValue != NULL;
+}
+
+inline
+Uint32
+NdbRecAttr::attrId() const
+{
+ return theAttrId;
+}
+
+inline
+void
+NdbRecAttr::setNULL()
+{
+ theNULLind = 1;
+}
+
+inline
+void
+NdbRecAttr::setNotNULL()
+{
+ theNULLind = 0;
+}
+
+inline
+void
+NdbRecAttr::setUNDEFINED()
+{
+ theNULLind = -1;
+}
+
+inline
+int
+NdbRecAttr::isNULL() const
+{
+ return theNULLind;
+}
+
+#endif
+
diff --git a/ndb/include/ndbapi/NdbReceiver.hpp b/ndb/include/ndbapi/NdbReceiver.hpp
new file mode 100644
index 00000000000..952803f8e70
--- /dev/null
+++ b/ndb/include/ndbapi/NdbReceiver.hpp
@@ -0,0 +1,72 @@
+/* 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 NdbReceiver_H
+#define NdbReceiver_H
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL // Not part of public interface
+
+#include <stdlib.h>
+
+class Ndb;
+class NdbReceiver
+{
+public:
+ enum ReceiverType { NDB_UNINITIALIZED,
+ NDB_OPERATION = 1,
+ NDB_SCANRECEIVER = 2,
+ NDB_INDEX_OPERATION = 3
+ };
+
+ NdbReceiver(Ndb *aNdb);
+ void init(ReceiverType type, void* owner);
+ ~NdbReceiver();
+
+ Uint32 getId(){
+ return m_id;
+ }
+
+ ReceiverType getType(){
+ return m_type;
+ }
+
+ void* getOwner(){
+ return m_owner;
+ }
+
+ bool checkMagicNumber() const;
+
+private:
+ Uint32 theMagicNumber;
+ Ndb* m_ndb;
+ Uint32 m_id;
+ ReceiverType m_type;
+ void* m_owner;
+};
+
+inline
+bool
+NdbReceiver::checkMagicNumber() const {
+ bool retVal = (theMagicNumber == 0x11223344);
+#ifdef NDB_NO_DROPPED_SIGNAL
+ if(!retVal){
+ abort();
+ }
+#endif
+ return retVal;
+}
+
+#endif
+#endif
diff --git a/ndb/include/ndbapi/NdbResultSet.hpp b/ndb/include/ndbapi/NdbResultSet.hpp
new file mode 100644
index 00000000000..d48df01214e
--- /dev/null
+++ b/ndb/include/ndbapi/NdbResultSet.hpp
@@ -0,0 +1,114 @@
+/* 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 */
+
+/*****************************************************************************
+ * Name: NdbResultSet.hpp
+ * Include:
+ * Link:
+ * Author: Martin Sköld
+ * Date: 2002-04-01
+ * Version: 0.1
+ * Description: Cursor class
+ * Documentation:
+ * Adjust: 2002-04-01 Martin Sköld First version.
+ ****************************************************************************/
+
+#ifndef NdbResultSet_H
+#define NdbResultSet_H
+
+
+#include <NdbCursorOperation.hpp>
+#include <NdbIndexOperation.hpp>
+#include <NdbScanOperation.hpp>
+
+/**
+ * @class NdbResultSet
+ * @brief NdbResultSet contains a NdbCursorOperation.
+ */
+class NdbResultSet
+{
+ friend class NdbCursorOperation;
+
+public:
+
+ /**
+ * Get the next tuple in a scan transaction.
+ *
+ * After each call to NdbResult::nextResult
+ * 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 nextResult
+ * 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 nextResult(false)
+ * returns 0 take over the record to another transaction. When
+ * nextResult(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 nextResult(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.
+ *
+ * @note See ndb/examples/ndbapi_scan_example for usage.
+ *
+ * @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 nextResult(bool fetchAllowed = true);
+
+ void close();
+
+ NdbOperation* updateTuple();
+ NdbOperation* updateTuple(NdbConnection* takeOverTransaction);
+
+ int deleteTuple();
+ int deleteTuple(NdbConnection* takeOverTransaction);
+
+private:
+ NdbResultSet(NdbCursorOperation*);
+
+ ~NdbResultSet();
+
+ void init();
+
+ NdbCursorOperation* m_operation;
+};
+
+#endif
diff --git a/ndb/include/ndbapi/NdbScanFilter.hpp b/ndb/include/ndbapi/NdbScanFilter.hpp
new file mode 100644
index 00000000000..9f8a01b1059
--- /dev/null
+++ b/ndb/include/ndbapi/NdbScanFilter.hpp
@@ -0,0 +1,177 @@
+/* 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 NDB_SCAN_FILTER_HPP
+#define NDB_SCAN_FILTER_HPP
+
+#include <ndb_types.h>
+
+/**
+ * @class NdbScanFilter
+ * @brief A simple way to specify filters for scan operations
+ *
+ * @note This filter interface is under development and may change in
+ * the future!
+ *
+ */
+class NdbScanFilter {
+public:
+ /**
+ * Constructor
+ * @param op The NdbOperation that the filter belongs to (is applied to).
+ */
+ NdbScanFilter(class NdbOperation * op);
+ ~NdbScanFilter();
+
+ /**
+ * Group operators
+ */
+ enum Group {
+ AND = 1, ///< (x1 AND x2 AND x3)
+ OR = 2, ///< (x1 OR x2 OR X3)
+ NAND = 3, ///< NOT (x1 AND x2 AND x3)
+ NOR = 4 ///< NOT (x1 OR x2 OR x3)
+ };
+
+ /**
+ * @name Grouping
+ * @{
+ */
+
+ /**
+ * Begin of compound.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int begin(Group group = AND);
+
+ /**
+ * End of compound.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int end();
+
+ /** @} *********************************************************************/
+
+ /**
+ * <i>Explanation missing</i>
+ */
+ int istrue();
+
+ /**
+ * <i>Explanation missing</i>
+ */
+ int isfalse();
+
+ /**
+ * @name Integer Comparators
+ * @{
+ */
+ /** Compare column value with integer for equal
+ * ®return 0 if successful, -1 otherwize
+ */
+ int eq(int ColId, Uint32 value);
+ /** Compare column value with integer for not equal.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int ne(int ColId, Uint32 value);
+ /** Compare column value with integer for less than.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int lt(int ColId, Uint32 value);
+ /** Compare column value with integer for less than or equal.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int le(int ColId, Uint32 value);
+ /** Compare column value with integer for greater than.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int gt(int ColId, Uint32 value);
+ /** Compare column value with integer for greater than or equal.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int ge(int ColId, Uint32 value);
+
+ /** Compare column value with integer for equal. 64-bit.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int eq(int ColId, Uint64 value);
+ /** Compare column value with integer for not equal. 64-bit.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int ne(int ColId, Uint64 value);
+ /** Compare column value with integer for less than. 64-bit.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int lt(int ColId, Uint64 value);
+ /** Compare column value with integer for less than or equal. 64-bit.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int le(int ColId, Uint64 value);
+ /** Compare column value with integer for greater than. 64-bit.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int gt(int ColId, Uint64 value);
+ /** Compare column value with integer for greater than or equal. 64-bit.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int ge(int ColId, Uint64 value);
+ /** @} *********************************************************************/
+
+ /** Check if column value is NULL */
+ int isnull(int ColId);
+ /** Check if column value is non-NULL */
+ int isnotnull(int ColId);
+
+ /**
+ * @name String Comparators
+ * @{
+ */
+ /**
+ * Compare string against a Char or Varchar column.
+ *
+ * By default Char comparison blank-pads both sides to common length.
+ * Varchar comparison does not blank-pad.
+ *
+ * The extra <i>nopad</i> argument can be used to
+ * force non-padded comparison for a Char column.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int eq(int ColId, const char * val, Uint32 len, bool nopad=false);
+ int ne(int ColId, const char * val, Uint32 len, bool nopad=false);
+ int lt(int ColId, const char * val, Uint32 len, bool nopad=false);
+ int le(int ColId, const char * val, Uint32 len, bool nopad=false);
+ int gt(int ColId, const char * val, Uint32 len, bool nopad=false);
+ int ge(int ColId, const char * val, Uint32 len, bool nopad=false);
+
+ /**
+ * Like comparison operator.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int like(int ColId, const char * val, Uint32 len, bool nopad=false);
+ /**
+ * Notlike comparison operator.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int notlike(int ColId, const char * val, Uint32 len, bool nopad=false);
+ /** @} *********************************************************************/
+
+private:
+ friend class NdbScanFilterImpl;
+ class NdbScanFilterImpl & m_impl;
+ NdbScanFilter& operator=(const NdbScanFilter&); ///< Defined not implemented
+};
+
+#endif
diff --git a/ndb/include/ndbapi/NdbScanOperation.hpp b/ndb/include/ndbapi/NdbScanOperation.hpp
new file mode 100644
index 00000000000..e041c79d96f
--- /dev/null
+++ b/ndb/include/ndbapi/NdbScanOperation.hpp
@@ -0,0 +1,248 @@
+/* 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 */
+
+/*****************************************************************************
+ * Name: NdbScanOperation.hpp
+ * Include:
+ * Link:
+ * Author: Martin Sköld
+ * Date: 2002-04-01
+ * Version: 0.1
+ * Description: Table scan support
+ * Documentation:
+ * Adjust: 2002-04-01 Martin Sköld First version.
+ ****************************************************************************/
+
+#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
+{
+ friend class Ndb;
+ friend class NdbConnection;
+ friend class NdbResultSet;
+ friend class NdbOperation;
+
+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 LockMode Scan lock handling
+ * @returns NdbResultSet.
+ */
+ virtual NdbResultSet* readTuples(unsigned parallel = 0,
+ LockMode = LM_Read );
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+
+ 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);
+ virtual void release();
+
+ void closeScan();
+
+ // Overloaded methods from NdbCursorOperation
+ int executeCursor(int ProcessorId);
+
+ // Overloaded private methods from NdbOperation
+ int init(NdbTableImpl* tab, NdbConnection* myConnection);
+ int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId);
+ int doSend(int ProcessorId);
+
+ virtual void setErrorCode(int aErrorCode);
+ virtual void setErrorCodeAbort(int aErrorCode);
+
+ virtual int equal_impl(const NdbColumnImpl* anAttrObject,
+ const char* aValue,
+ Uint32 len);
+private:
+ 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;
+
+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
+ };
+
+ 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;
+};
+
+inline
+SetValueRec::SetValueRec() :
+ next(0)
+{
+}
+
+inline
+SetValueRec::~SetValueRec()
+{
+ if ((stype == SET_STRING_ATTR1) ||
+ (stype == SET_INT32_ATTR1) ||
+ (stype == SET_UINT32_ATTR1) ||
+ (stype == SET_INT64_ATTR1) ||
+ (stype == SET_UINT64_ATTR1) ||
+ (stype == SET_FLOAT_ATTR1) ||
+ (stype == SET_DOUBLE_ATTR1))
+ free(anAttrName);
+
+ if ((stype == SET_STRING_ATTR1) ||
+ (stype == SET_STRING_ATTR2))
+ free(stringStruct.aStringValue);
+ if (next) delete next;
+ next = 0;
+}
+
+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;
+};
+
+inline
+SetValueRecList::SetValueRecList() :
+ first(0),
+ last(0)
+{
+}
+
+inline
+SetValueRecList::~SetValueRecList() {
+ if (first) delete first;
+ first = last = 0;
+}
+
+
+inline
+void SetValueRecList::iterate(SetValueRecList::IterateFn nextfn, NdbOperation& oper)
+{
+ SetValueRec* recPtr = first;
+ while(recPtr) {
+ (*nextfn)(*recPtr, oper);
+ recPtr = recPtr->next; // Move to next in list - MASV
+ }
+}
+
+#endif
+
+#endif
diff --git a/ndb/include/ndbapi/NdbSchemaCon.hpp b/ndb/include/ndbapi/NdbSchemaCon.hpp
new file mode 100644
index 00000000000..9d6b49df8f9
--- /dev/null
+++ b/ndb/include/ndbapi/NdbSchemaCon.hpp
@@ -0,0 +1,132 @@
+/* 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 NdbSchemaCon_H
+#define NdbSchemaCon_H
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+
+#include <ndb_types.h>
+#include "AttrType.hpp"
+#include "NdbError.hpp"
+
+class NdbSchemaOp;
+class NdbApiSignal;
+class Ndb;
+
+/**
+ * @class NdbSchemaCon
+ * @brief Represents a schema transaction.
+ *
+ * When creating a new table,
+ * the first step is to get a NdbSchemaCon object to represent
+ * the schema transaction.
+ * This is done by calling Ndb::startSchemaTransaction.
+ *
+ * The next step is to get a NdbSchemaOp object by calling
+ * NdbSchemaCon::getNdbSchemaOp.
+ * The NdbSchemaOp object then has methods to define the table and
+ * its attributes.
+ *
+ * Finally, the NdbSchemaCon::execute method inserts the table
+ * into the database.
+ *
+ * @note Currently only one table can be added per transaction.
+ */
+class NdbSchemaCon
+{
+friend class Ndb;
+friend class NdbSchemaOp;
+
+public:
+ /**
+ * Execute a schema transaction.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int execute();
+
+ /**
+ * Get a schemaoperation.
+ *
+ * @note Currently, only one operation per transaction is allowed.
+ *
+ * @return Pointer to a NdbSchemaOp or NULL if unsuccessful.
+ */
+ NdbSchemaOp* getNdbSchemaOp();
+
+ /**
+ * Get the latest error
+ *
+ * @return Error object.
+ */
+ const NdbError & getNdbError() const;
+
+private:
+/******************************************************************************
+ * These are the create and delete methods of this class.
+ *****************************************************************************/
+
+ NdbSchemaCon(Ndb* aNdb);
+ ~NdbSchemaCon();
+
+/******************************************************************************
+ * These are the private methods of this class.
+ *****************************************************************************/
+ void init(); // Initialise connection object for new
+ // transaction.
+
+ void release(); // Release all schemaop in schemaCon
+
+ /***************************************************************************
+ * These methods are service methods to other classes in the NDBAPI.
+ ***************************************************************************/
+
+ int checkMagicNumber(); // Verify correct object
+ int receiveDICTTABCONF(NdbApiSignal* aSignal);
+ int receiveDICTTABREF(NdbApiSignal* aSignal);
+
+
+ int receiveCREATE_INDX_CONF(NdbApiSignal*);
+ int receiveCREATE_INDX_REF(NdbApiSignal*);
+ int receiveDROP_INDX_CONF(NdbApiSignal*);
+ int receiveDROP_INDX_REF(NdbApiSignal*);
+
+
+
+/*****************************************************************************
+ * These are the private variables of this class.
+ *****************************************************************************/
+
+
+ NdbError theError; // Errorcode
+ Ndb* theNdb; // Pointer to Ndb object
+
+ NdbSchemaOp* theFirstSchemaOpInList; // First operation in operation list.
+ int theMagicNumber; // Magic number
+};
+
+inline
+int
+NdbSchemaCon::checkMagicNumber()
+{
+ if (theMagicNumber != 0x75318642)
+ return -1;
+ return 0;
+}//NdbSchemaCon::checkMagicNumber()
+#endif
+#endif
+
+
diff --git a/ndb/include/ndbapi/NdbSchemaOp.hpp b/ndb/include/ndbapi/NdbSchemaOp.hpp
new file mode 100644
index 00000000000..90837bbc66b
--- /dev/null
+++ b/ndb/include/ndbapi/NdbSchemaOp.hpp
@@ -0,0 +1,458 @@
+/* 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 NdbSchemaOp_H
+#define NdbSchemaOp_H
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+
+#include <ndb_types.h>
+#include "AttrType.hpp"
+#include "NdbSchemaCon.hpp"
+#include <stdlib.h>
+#include "NdbDictionary.hpp"
+
+class NdbApiSignal;
+class Ndb;
+
+/**
+ * @class NdbSchemaOp
+ * @brief Represents various operations for use in schema transactions
+ *
+ * This class is used for schema operations, e.g. creating tables and
+ * attributes.
+ *
+ * The NdbSchemaOp object is created using NdbSchemaCon::getNdbSchemaOp.
+ *
+ * @note This class is depricated and is now replaced with the class
+ * NdbDictionary.
+ */
+class NdbSchemaOp
+{
+ friend class Ndb;
+ friend class NdbSchemaCon;
+
+public:
+ /**
+ * Create a new table in the database.
+ *
+ * @note The NdbSchemaCon should be closed with
+ * Ndb::closeSchemaTransaction, even if this method fails.
+ *
+ * @param aTableName Table name. Should not be NULL.
+ * @param aTableSize (Performance parameter.)
+ * Initial size of the data part of the table
+ * expressed in kByte.
+ * The database handles
+ * bad parameter setting but at a certain
+ * loss in performance.
+ * The size given here is
+ * the initial size allocated for the table
+ * storage (the data part).
+ * When calculating the data storage one should
+ * add the size of all attributes (each attribute
+ * consumes at least 4 bytes) and also an overhead
+ * of 12 byte.
+ * Variable size attributes (not supported yet)
+ * will have a size of 12 bytes plus the actual
+ * data storage parts where there is an
+ * additional overhead based on the size of the
+ * variable part.
+ * <br>
+ * An example table with 5 attributes:
+ * one 64 bit attribute, one 32 bit attribute,
+ * two 16 bit attributes and one array of 64 8 bits.
+ * This table will consume
+ * 12 (overhead) + 8 + 4 + 2*4 (4 is minimum) + 64 =
+ * 96 bytes per record.
+ * Additionally an overhead of about 2 % as page
+ * headers and waste should be allocated.
+ * Thus, 1 million records should consume 96 MBytes
+ * plus the overhead 2 MByte and rounded up to
+ * 100 000 kBytes.
+ * <br><em>
+ * This parameter is currently not used.
+ * </em>
+ * @param aTupleKey Indicates if the table has a primary key or not.
+ * <br>
+ * <b>TupleKey</b> means that a <em>primary key</em>
+ * consisting of one to four attributes
+ * (at most one of variable size)
+ * uniquely identifies each record in the created
+ * table.
+ * <br>
+ * <b>TupleId</b> means that a <em>tuple identity</em>
+ * is used. The tuple identity is
+ * a unique key indentifying each record of the
+ * created table.
+ * The tuple identity is a (non-stored)
+ * 64 bit attribute named <b>NDB$TID</b>.
+ * <br>
+ * When inserting a record (tuple), the method
+ * NdbOperation::setTupleId
+ * will generate a unique tuple identity
+ * and return it to the user.
+ * <br>
+ * When reading, updating or deleting a record
+ * in a table with <b>TupleId</b>,
+ * NdbOperation::equal("NDB$TID", value_Uint64)
+ * can be used to identify the record.
+ * <br>
+ * Legal values: TupleKey or TupleId.
+ * @param aNrOfPages (Performance parameter.)
+ * Specifies the initial size of the index storage.
+ * When calculating the index storage,
+ * each key has approximately 14 byte of
+ * overhead plus the size of the key.
+ * Each key attribute takes up at least 4 bytes
+ * of storage.
+ * Thus a mixed key consisting of a
+ * 64 bit attribute, a 32 bit attribute
+ * and a 16 bit attribute will
+ * consume approx. 30 bytes per key.
+ * Thus, the if initial size is to be 1 million rows,
+ * then aNrOfPages should be set to
+ * 30 M / 8k = 2670 pages.
+ * <br><em>
+ * This parameter is currently not used.
+ * </em>
+ * @param aFragmentType Type of fragmentation.<br>
+ * <b>All</b> (default) means that the
+ * table fragments are automatically
+ * distributed on all nodes in the system.<br>
+ * <b>DistributionGroup</b> and
+ * <b>DistributionKey</b> are
+ * also supported. For further details about
+ * these types see the documentation of
+ * Ndb::startTransaction.
+ * @param aKValue (Hash parameter.)
+ * Only allowed value is 6.
+ * Later implementations might add flexibility
+ * in this parameter.
+ * @param aMinLoadFactor (Hash parameter.)
+ * This value specifies the load factor when
+ * starting to shrink the hash table.
+ * It must be smaller than aMaxLoadFactor.
+ * Both these factors are given in percentage.
+ * @param aMaxLoadFactor (Hash parameter.)
+ * This value specifies the load factor when
+ * starting to split the containers in the local
+ * hash tables. 100 is the maximum which will
+ * optimize memory usage (this is the figure
+ * used for the above calculations).
+ * A lower figure will store less information in
+ * each container and thus
+ * find the key faster but consume more memory.
+ * @param aMemoryType Currently only 1 is allowed which specifies
+ * storage of table in main memory.
+ * Later 2 will be added where the table is stored
+ * completely on disk
+ * and 3 where the index is in main memory but
+ * data is on disk.
+ * If 1 is chosen an individual attribute can
+ * still be specified as a disk attribute.
+ * @param aStoredTable If set to false it indicates that the table is
+ * a temporary table and should not be logged
+ * to disk.
+ * In case of a system restart the table will still
+ * be defined and exist but will be empty.
+ * Thus no checkpointing and
+ * no logging is performed on the table.
+ * The default value is true and indicates a
+ * normal table with full checkpointing and
+ * logging activated.
+ * @return Returns 0 when successful and returns -1 otherwise.
+ */
+ int createTable( const char* aTableName,
+ Uint32 aTableSize = 8,
+ KeyType aTupleKey = TupleKey,
+ int aNrOfPages = 2,
+ FragmentType aFragmentType = All,
+ int aKValue = 6,
+ int aMinLoadFactor = 78,
+ int aMaxLoadFactor = 80,
+ int aMemoryType = 1,
+ bool aStoredTable = true);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * This is the old function declaration, don't use.
+ *
+ * @deprecated do not use!
+ */
+ inline int createTable( const char* aTableName,
+ Uint32 aTableSize,
+ KeyType aTupleKey,
+ int aNrOfPages,
+ FragmentType aFragmentType,
+ int aKValue,
+ int aMinLoadFactor,
+ int aMaxLoadFactor,
+ int aMemoryType,
+ int aStoredTable){
+ return createTable(aTableName,
+ aTableSize,
+ aTupleKey,
+ aNrOfPages,
+ aFragmentType,
+ aKValue,
+ aMinLoadFactor,
+ aMaxLoadFactor,
+ aMemoryType,
+ (aStoredTable == 1 ? true : false));
+ }
+#endif
+
+ /**
+ * Add a new attribute to a database table.
+ *
+ * Attributes can only be added to a table in the same transaction
+ * as the transaction creating the table.
+ *
+ * @note The NdbSchemaCon transaction should be closed with
+ * Ndb::closeSchemaTransaction, even if this method fails.
+ *
+ * Example creating an unsigned int attribute belonging to the primary key
+ * of the table it is created in:
+ * @code
+ * MySchemaOp->createAttribute("Attr1", // Attribute name
+ * TupleKey, // Belongs to primary key
+ * 32, // 32 bits
+ * 1, // Not an array attribute
+ * UnSigned, // Unsigned type
+ * );
+ * @endcode
+ *
+ * Example creating a string attribute belonging to the primary key
+ * of the table it is created in:
+ * @code
+ * MySchemaOp->createAttribute("Attr1", // Attribute name
+ * TupleKey, // Belongs to primary key
+ * 8, // Each character is 8 bits
+ * 12, // Max 12 chars in string
+ * String, // Attribute if of type string
+ * );
+ * @endcode
+ *
+ * A <em>distribution key</em> is a set of attributes which are used
+ * to distribute the tuples onto the NDB nodes.
+ * A <em>distribution group</em> is a part (currently 16 bits)
+ * of an attribute used to distribute the tuples onto the NDB nodes.
+ * The distribution key uses the NDB Cluster hashing function,
+ * while the distribution group uses a simpler function.
+ *
+ * @param aAttrName Attribute name. Should not be NULL.
+ * @param aTupleKey This parameter specifies whether the
+ * attribute is part of the primary key or not.
+ * Floats are not allowed in the primary key.
+ * <br>
+ * Legal values: NoKey, TupleKey
+ * @param aAttrSize Specifies the size of the elements of the
+ * attribute. (An attribute can consist
+ * of an array of elements.)
+ * <br>
+ * Legal values: 8, 16, 32, 64 and 128 bits.
+ * @param aArraySize Size of array.
+ * <br>
+ * Legal values:
+ * 0 = variable-sized array,
+ * 1 = no array, and
+ * 2- = fixed size array.
+ * <br>
+ * <em>
+ * Variable-sized array attributes are
+ * not yet supported.
+ * </em>
+ * <br>
+ * There is no upper limit of the array size
+ * for a single attribute.
+ * @param aAttrType The attribute type.
+ * This is only of interest if calculations are
+ * made within NDB.
+ * <br>
+ * Legal values: UnSigned, Signed, Float, String
+ * @param aStorageMode Main memory based or disk based attribute.<br>
+ * Legal values: MMBased, DiskBased
+ * <br>
+ * <em>
+ * Disk-based attributes are not yet supported.
+ * </em>
+ * @param nullable Set to true if NULL is a correct value for
+ * the attribute.
+ * <br>
+ * Legal values: true, false
+ * @param aStType Stored in both index and data storage or
+ * only store in index data storage.
+ * <br>
+ * This parameter is only of interest for tuple
+ * key attributes.
+ * All tuple key attributes values are always stored
+ * in the index storage part.
+ * If this parameter is set to
+ * IndexStorageAttribute, then the attribute values
+ * will <em>only</em> be stored in the index
+ * storage part and <em>not</em> in the data
+ * storage part.
+ * <br>
+ * If there will be no scans using the primary
+ * key attribute and if the size of the attribute
+ * is large, then this might be of interest.
+ * A typical example is a table where
+ * http-addresses are used as primary key.
+ * <br>
+ * Legal values: NormalStorageAttribute,
+ * IndexStorageAttribute
+ * @param aDistributionKey Sometimes it is preferable to use a subset
+ * of the primary key as the distribution key.
+ * An example is TPC-C where it might be
+ * good to use the warehouse id and district id
+ * as the distribution key.
+ * <br>
+ * Locally in the fragments the full primary key
+ * will still be used with the hashing algorithm.
+ * Set to 1 if this attribute is part of the
+ * distribution key.
+ * All distribution key attributes must be
+ * defined before
+ * any other attributes are defined.
+ * @param aDistributionGroup In other applications it is desirable to use
+ * only a part of an attribute to create the
+ * distribution key.
+ * This is applicable for some telecom
+ * applications.
+ * <br>
+ * In these situations one must provide how many
+ * bits of the attribute that is to
+ * be used as the distribution hash value.
+ * <br>
+ * This provides some control to the
+ * application of the distribution.
+ * It still needs to be part of a primary key
+ * the attribute and must be defined as the
+ * first attribute.
+ * @param aDistributionGroupNoOfBits
+ * Number of bits to use of the
+ * distribution group attribute in the
+ * distribution hash value.
+ * <br>
+ * Currently, only 16 bits is supported. It will
+ * always be the last 16 bits in the attribute
+ * which is used for the distribution group.
+ * @param aAutoIncrement Set to autoincrement attribute.
+ * @param aDefaultValue Set a default value of attribute.
+ *
+ * @return Returns 0 when successful and returns -1 otherwise.
+ ****************************************************************************/
+ int createAttribute(const char* aAttrName,
+ KeyType aTupleKey = NoKey,
+ int aAttrSize = 32,
+ int aArraySize = 1,
+ AttrType aAttrType = UnSigned,
+ StorageMode aStorageMode = MMBased,
+ bool nullable = false,
+ StorageAttributeType aStType= NormalStorageAttribute,
+ int aDistributionKey = 0,
+ int aDistributionGroup = 0,
+ int aDistributionGroupNoOfBits = 16,
+ bool aAutoIncrement = false,
+ const char* aDefaultValue = 0);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * @deprecated do not use!
+ */
+ int createAttribute(const char* aAttrName,
+ KeyType aTupleKey,
+ int aAttrSize,
+ int aArraySize,
+ AttrType aAttrType,
+ StorageMode aStorageMode,
+ NullAttributeType aNullAttr,
+ StorageAttributeType aStType = NormalStorageAttribute,
+ int aDistributionKey = 0,
+ int aDistributionGroup = 0,
+ int aDistributionGroupNoOfBits = 16){
+ return createAttribute(aAttrName,
+ aTupleKey,
+ aAttrSize,
+ aArraySize,
+ aAttrType,
+ aStorageMode,
+ aNullAttr == NullAttribute,
+ aStType,
+ aDistributionKey,
+ aDistributionGroup,
+ aDistributionGroupNoOfBits);
+ }
+#endif
+
+ /**
+ * Get the last error which occurred during the transaction.
+ *
+ * If an error occured (NdbSchemaCon::execute returned -1 or
+ * NdbSchemaCon::getNdbSchemaOp returned NULL), then this method
+ * retrieves the error object containing information about
+ * the error.
+ *
+ * @return Error object containing information about last error.
+ */
+ const NdbError & getNdbError() const;
+
+protected:
+
+/*****************************************************************************
+ * These are the methods used to create and delete the NdbOperation objects.
+ ****************************************************************************/
+ NdbSchemaOp(Ndb* aNdb);
+
+ ~NdbSchemaOp();
+
+/******************************************************************************
+ * These methods are service routines used by the other NDBAPI classes.
+ *****************************************************************************/
+
+ void release(); // Release all memory connected
+ // to the operations object.
+
+/****************************************************************************
+ * The methods below is the execution part of the NdbSchemaOp class.
+ *****************************************************************************/
+
+ int sendRec();
+ int sendSignals(Uint32 aNodeId, bool HaveMutex);
+
+ int init(NdbSchemaCon* aSchemaCon);
+
+ /**************************************************************************
+ * These are the private variables that are defined in the operation
+ * objects.
+ **************************************************************************/
+ Ndb* theNdb; // Point back to the Ndb object.
+ NdbSchemaCon* theSchemaCon; // Point back to the connection object.
+
+ class NdbDictionary::Table * m_currentTable;
+};
+
+inline
+const NdbError &
+NdbSchemaOp::getNdbError() const
+{
+ return theSchemaCon->getNdbError();
+}
+
+#endif
+#endif
+
+
diff --git a/ndb/include/ndbapi/ndbapi_limits.h b/ndb/include/ndbapi/ndbapi_limits.h
new file mode 100644
index 00000000000..bcfba7d3f9d
--- /dev/null
+++ b/ndb/include/ndbapi/ndbapi_limits.h
@@ -0,0 +1,47 @@
+/* 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 NDBAPI_LIMITS_H
+#define NDBAPI_LIMITS_H
+
+#define NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY 32
+#define NDB_MAX_TABLES 1600
+#define NDB_MAX_DATABASE_NAME_SIZE 128
+#define NDB_MAX_SCHEMA_NAME_SIZE 128
+#define NDB_MAX_TAB_NAME_SIZE 128
+#define NDB_MAX_ATTR_NAME_SIZE 32
+#define NDB_MAX_ATTR_DEFAULT_VALUE_SIZE 128
+#define NDB_MAX_ATTRIBUTES_IN_TABLE 91
+#define NDB_MAX_ATTRIBUTES_IN_INDEX NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY
+#define NDB_MAX_TUPLE_SIZE_IN_WORDS 1023
+#define NDB_MAX_FIXED_KEY_LENGTH_IN_WORDS 8
+#define NDB_MAX_KEYSIZE_IN_WORDS 1023
+#define NDB_MAX_KEY_SIZE NDB_MAX_KEYSIZE_IN_WORDS*sizeof(Uint32)
+#define NDB_MAX_TUPLE_SIZE 8191
+#define NDB_MAX_CONNECTIONS 127
+#define NDB_MAX_TRANSACTIONS 1024
+#define NDB_MAX_PARALLEL_SCANS 12
+#define NDB_MAX_ACTIVE_EVENTS 100
+
+#ifndef MIN
+#define MIN(x,y) (((x)<(y))?(x):(y))
+#endif
+
+#ifndef MAX
+#define MAX(x,y) (((x)>(y))?(x):(y))
+#endif
+
+#endif
diff --git a/ndb/include/newtonapi/dba.h b/ndb/include/newtonapi/dba.h
new file mode 100644
index 00000000000..eb5b3f9b5c2
--- /dev/null
+++ b/ndb/include/newtonapi/dba.h
@@ -0,0 +1,732 @@
+/* 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 */
+
+/**
+ * @mainpage DBA User Guide
+ *
+ * @section secIntro Introduction
+ * DBA is an API to access the NDB Cluster.
+ *
+ * DBA supports transactions using an asynchronous execution model.
+ * Everything but transactions is synchronous.
+ *
+ * DBA uses the concept of bindings to simplify database access.
+ * A <em>binding</em> is a relation between a database table and
+ * one or several C structs.
+ * A binding is created initially and then used multiple time during
+ * application execution.
+ *
+ * Each of the data accessing functions in DBA is implemented as a
+ * transaction, i.e. the call will either fully complete or
+ * nothing happens (the transaction fails).
+ *
+ * DBA also supports "read as much as possible" with bulk read.
+ * With bulk read the application can specify a set of primary keys and
+ * try to read all of the corresponding rows. The bulk read will not fail
+ * if a row does not exist but will instead inform the application using a
+ * RowFoundIndicator variable.
+ *
+ * A <em>request</em> is a transaction or a bulk read.
+ *
+ * @section secError Error Handling
+ * When a synchronous method in DBA fails these methods are applicable:
+ * -# DBA_GetLatestError()
+ * -# DBA_GetLatestNdbError()
+ * -# DBA_GetLatestErrorMsg()
+ *
+ * The DBA_GetLatestErrorMsg() will then return a description of
+ * what has failed.
+ *
+ * For asynchronous methods the application should:
+ * -# check that the RequestId returned by function is not
+ * @ref DBA_INVALID_REQID
+ * -# check Status supplied in callback (see @ref DBA_AsyncCallbackFn_t)
+ *
+ * If @ref DBA_INVALID_REQID is returned,
+ * the details of error can be found using
+ * "latest"-functions.
+ *
+ * If error is indicated in callback (using Status), when the
+ * "latest"-functions are <b>NOT</b> applicable.
+ *
+ * @section secExamples Example Programs
+ *
+ * - @ref common.hpp
+ * - @ref basic.cpp
+ * - @ref br_test.cpp
+ * - @ref ptr_binding_test.cpp
+ *
+ */
+
+/**
+ * @page basic.cpp basic.cpp
+ * @include basic.cpp
+ */
+
+/**
+ * @page common.hpp common.hpp
+ * @include common.hpp
+ */
+
+/**
+ * @page br_test.cpp br_test.cpp
+ * @include br_test.cpp
+ */
+
+/**
+ * @page ptr_binding_test.cpp ptr_binding_test.cpp
+ * @include ptr_binding_test.cpp
+ */
+
+/** @addtogroup DBA
+ * @{
+ */
+
+/****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/
+
+#ifndef DBA_H
+#define DBA_H
+
+/* --- Include files ---- */
+
+#include <defs/pcn_types.h>
+
+#include <stdio.h>
+
+
+/* --- Types and definitions --- */
+
+/**
+ * Possible error status for DBA functions.
+ */
+typedef enum {
+ DBA_NO_ERROR = 0, /**< Success */
+
+ DBA_NOT_IMPLEMENTED = -1, /**< Function not implemented */
+ DBA_NDB_ERROR = -2, /**< Uncategorised error from NDB */
+ DBA_ERROR = -3, /**< Uncategorised error from DBA implementation */
+
+ DBA_APPLICATION_ERROR = 1, /**< Function called with invalid argument(s)
+ or other application errors */
+ DBA_NO_DATA = 2, /**< No row with specified PK existed */
+ DBA_CONSTRAINT_VIOLATION = 3, /**< There already exists a row with that PK*/
+
+ DBA_SCHEMA_ERROR = 4, /**< Table already exists */
+ DBA_INSUFFICIENT_SPACE = 5, /**< The DB is full */
+ DBA_TEMPORARY_ERROR = 6, /**< Some temporary problem occured */
+ DBA_TIMEOUT = 7, /**< The request timed out, probably due to
+ dead-lock */
+ DBA_OVERLOAD = 8, /**< The DB is overloaded */
+ DBA_UNKNOWN_RESULT = 9 /**< It is unknown wheater transaction was
+ commited or aborted */
+} DBA_Error_t;
+
+/**
+ * Error code. This is the error code that is returned by NDB.
+ * Not to be confused by the status returned by the DBA implementation.
+ */
+typedef int DBA_ErrorCode_t;
+
+/**
+ * DBA column types
+ */
+typedef enum {
+ DBA_CHAR, /**< String */
+ DBA_INT /**< Integer */
+} DBA_DataTypes_t;
+
+
+/**
+ * Column description.
+ * Used for creating tables.
+ */
+typedef struct DBA_ColumnDesc {
+
+ const char* Name; /**< Name of table column */
+ DBA_DataTypes_t DataType; /**< Datatype of table column*/
+ Size_t Size; /**< Column size in bytes */
+ Boolean_t IsKey; /**< True if column is part of primary key */
+
+} DBA_ColumnDesc_t;
+
+/**
+ * Used to simplify binding definitions. See @ref DBA_ColumnBinding
+ * for example.
+ *
+ * @param ColName Name of column in db table
+ * @param Type Column/field type.
+ * @param Struct Structure
+ * @param Field Field in structure
+ * @return Arg list for defining binding of type @ref DBA_Binding_t
+ */
+#define DBA_BINDING( ColName, Type, Struct, Field ) \
+ { ColName, Type, PCN_SIZE_OF( Struct, Field ), \
+ PCN_OFFSET_OF( Struct, Field ), 0, 0 }
+
+/**
+ * Used to simplify ptr binding definitions. See @ref DBA_ColumnBinding
+ * for example.
+ *
+ * @param Struct Structure
+ * @param Field Field in structure
+ * @return Arg list for defining binding of type @ref DBA_Binding_t
+ */
+#define DBA_BINDING_PTR(Struct, Field, ColBindings, NbCBindings) \
+ { 0, DBA_CHAR, NbCBindings, PCN_OFFSET_OF( Struct, Field ), \
+ 1, ColBindings }
+
+/**
+ * The @ref DBA_ColumnBinding_t is used to describe a binding between one
+ * column and one field of a C struct.
+ *
+ *<pre>
+ * typedef struct Address {
+ * char StreetName[30];
+ * int StreetNumber;
+ * } Address_t;
+ *
+ * typdef struct Person {
+ * char Name[30];
+ * Address_t * AddressPtr;
+ * } Person_t; </pre>
+ *
+ *
+ * For example, if the field Name of a Person_t data structure is
+ * bound to the column "NAME", the corresponding binding would be
+ * defined as:
+ *
+ *<pre>
+ * DBA_ColumnBinding_t NameBinding =
+ * DBA_BINDING( "name", DBA_CHAR, Person_t, Name ); </pre>
+ *
+ *
+ * There is also the @ref DBA_BINDING_PTR which is used when
+ * several linked structures should be put into one table.
+ *
+ * For example, if data in a Person_t data structure should be saved
+ * in the same table as the Address_t data structure
+ * (as the address belongs to the person), the corresponding binding would be
+ * defined as:
+ *
+ *<pre>
+ * DBA_ColumnBinding_t AddrBinding[AddrLen]; This binding describes how the
+ * fields in the Address_t
+ * structure is linked to the
+ * table PERSON_ADDRESS
+ *
+ * DBA_ColumnBinding_t AddressBinding =
+ * DBA_BINDING_PTR(Person_t, AddressPtr, AddrBinding, AddrLen); </pre>
+ *
+ *
+ */
+struct DBA_ColumnBinding {
+ const char* Name; /**< Name of table column */
+ DBA_DataTypes_t DataType; /**< Type of member in structure */
+ Size_t Size; /**< Size in bytes of member
+ or no of @ref DBA_ColumnBinding's
+ when doing ptr binding */
+ Size_t Offset; /**< Offset of the member */
+
+ Boolean_t Ptr; /**< True if binding is of ptr type */
+ const struct DBA_ColumnBinding * SubBinding; /**< Address of Binding Ptr
+ valid if Ptr is true */
+};
+
+/**
+ * Typedef: @ref DBA_ColumnBinding
+ */
+typedef struct DBA_ColumnBinding DBA_ColumnBinding_t;
+
+/**
+ * A @ref DBA_Binding_t object is used to establish a binding between
+ * one or more columns of a table to the fields of C structs.
+ *
+ * It is used with insert, and update and read transactions to define
+ * on which columns of the table the operations is performed, and to
+ * which members of a C data structure they map.
+ *
+ * All key columns must be bound to a field of the struct.
+ *
+ * The function @ref DBA_CreateBinding is used to create this binding.
+ */
+typedef struct DBA_Binding DBA_Binding_t;
+
+/* --- Exported functions --- */
+
+/**
+ * Set DBA configuration parameter
+ *<pre>
+ * Id Description Default Min Max
+ * == =========================== ======= ==== ====
+ * 0 NBP Interval 10 4 -
+ * 1 Operations/Bulkread 1000 1 5000
+ * 2 Start transaction timeout 0 0 -
+ * 3 Force send algorithm 1 0 2
+ *</pre>
+ * @return Status
+ */
+DBA_Error_t DBA_SetParameter(int ParameterId, int Value);
+
+/**
+ * Set DBA configuration parameter.
+ * See @ref DBA_SetParameter for description of parameters.
+ *
+ * @return Status
+ */
+DBA_Error_t DBA_GetParameter(int ParameterId, int * Value);
+
+/**
+ * Initialize DBA library and connect to NDB Cluster.
+ *
+ * @return Status
+ */
+DBA_Error_t DBA_Open( );
+
+/**
+ * Close connection to NDB cluster and free allocated memory.
+ *
+ * @return Error status
+ */
+DBA_Error_t DBA_Close(void);
+
+/**
+ * Get latest DBA error.
+ *
+ * @note Only applicable to synchronous methods
+ */
+DBA_Error_t DBA_GetLatestError();
+
+/**
+ * Get latest NDB error.
+ *
+ * @note Only applicable to synchronous methods
+ */
+DBA_ErrorCode_t DBA_GetLatestNdbError();
+
+/**
+ * Get latest error string associated with DBA_GetLatestError().
+ *
+ * @note String must not be free by caller of this method.
+ * @note Only applicable to synchronous methods.
+ */
+const char * DBA_GetLatestErrorMsg();
+
+/**
+ * Get error msg associated with code
+ *
+ * @note String must not be free by caller of this method
+ */
+const char * DBA_GetErrorMsg(DBA_Error_t);
+
+/**
+ * Get error msg associated with code
+ *
+ * @note String must not be free by caller of this method
+ */
+const char * DBA_GetNdbErrorMsg(DBA_ErrorCode_t);
+
+/**
+ * Create a table.
+ *
+ * @param TableName Name of table to create.
+ * @param NbColumns numbers of columns.
+ * @param Columns Column descriptions.
+ * @return Status.
+ */
+DBA_Error_t
+DBA_CreateTable( const char* TableName, int NbColumns,
+ const DBA_ColumnDesc_t Columns[] );
+
+/**
+ * Destroy a table.
+ *
+ * @param TableName Table name.
+ * @return Status.
+ * @note Not implemented
+ */
+DBA_Error_t
+DBA_DropTable( const char* TableName );
+
+
+/**
+ * Test for existence of a table.
+ *
+ * @param TableName Table name.
+ * @return Boolean value indicating if table exists or not.
+ */
+Boolean_t
+DBA_TableExists( const char* TableName );
+
+/**
+ * Define a binding between the columns of a table and a C structure.
+ *
+ * @param TableName table
+ * @param NbCol number of columns bindings
+ * @param ColBinding bindings
+ * @param StructSz Sizeof structure.
+ * @return Created binding, or NULL if binding could not be created.
+ */
+DBA_Binding_t*
+DBA_CreateBinding( const char* TableName,
+ int NbCol, const DBA_ColumnBinding_t ColsBinding[],
+ Size_t StructSz );
+
+/**
+ * Destroys a @ref DBA_Binding_t allocated with @ref
+ * DBA_CreateBinding.
+ *
+ * @param pBinding Pointer to binding.
+ * @return Status.
+ */
+DBA_Error_t
+DBA_DestroyBinding( DBA_Binding_t* Binding );
+
+/**
+ * Used to identify a pending db request
+ */
+typedef long DBA_ReqId_t;
+
+/**
+ * An asynchronous call returning this means that the function was called
+ * with invalid arguments. The application should check error status
+ * with DBA_GetLatestError() etc.
+ */
+#define DBA_INVALID_REQID 0
+
+/**
+ * Callback function for transactions.
+ * Will be called in NBP process (Newton Batch Process).
+ *
+ * @note The implementation of the callback function is not allowed to
+ * make an asynchronous database call.
+ *
+ * @param ReqId Request identifier
+ * @param Status Status of the request
+ * @param ErrorCode Error code given by NDB
+ * @see DBA_Error_t
+ */
+typedef void (*DBA_AsyncCallbackFn_t)( DBA_ReqId_t ReqId,
+ DBA_Error_t Status,
+ DBA_ErrorCode_t ErrorCode );
+/**
+ * Insert row(s) in the table (one transaction)
+ *
+ * @param pBinding Binding between table columns and struct fields.
+ * @param pData Array of pointers to structures.
+ * @param NbRows No of rows to insert (i.e. length of pData array)
+ * @return Request identifier
+ *
+ * @note All the table columns must be part of the binding.
+ */
+DBA_ReqId_t
+DBA_InsertRows( const DBA_Binding_t* pBinding, const void * const pData[],
+ int NbRows,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Insert row(s) in the table (one transaction)
+ *
+ * @param pBinding Binding between table columns and struct fields.
+ * @param pData Array of structures.
+ * @param NbRows No of rows to insert (i.e. length of pData array)
+ * @return Request identifier
+ *
+ * @note All the table columns must be part of the binding.
+ */
+DBA_ReqId_t
+DBA_ArrayInsertRows( const DBA_Binding_t* pBinding, const void * pData,
+ int NbRows,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Update row(s) in the table (one transaction)
+ *
+ * @param pBinding Binding between table columns and struct fields.
+ * @param pData Array of pointers to structures. Fields that are part of the
+ * key are used to generate the where clause, the
+ * other fields are used to update the row.
+ * @param NbRows No of rows to update (i.e. length of pData array).
+ * @return Request identifier
+ */
+DBA_ReqId_t
+DBA_UpdateRows( const DBA_Binding_t* pBinding, const void * const pData[],
+ int NbRows,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Update row(s) in the table (one transaction)
+ *
+ * @param pBinding Binding between table columns and struct fields.
+ * @param pData Array of structures. Fields that are part of the
+ * key are used to generate the where clause, the
+ * other fields are used to update the row.
+ * @param NbRows No of rows to update (i.e. length of pData array).
+ * @return Request identifier
+ */
+DBA_ReqId_t
+DBA_ArrayUpdateRows( const DBA_Binding_t* pBinding, const void * pData,
+ int NbRows,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Delete row(s) from the table (one transaction)
+ *
+ * @param pBinding Binding between table columns and struct fields.
+ * @param pData Array of pointers to structures.
+ * Only fields part of the primary key needs to be set.
+ * @param NbRows No of rows to delete (i.e. length of pData array)
+ * @return Request identifier
+ */
+DBA_ReqId_t
+DBA_DeleteRows( const DBA_Binding_t* pBinding, const void * const pData[],
+ int NbRows,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+
+/**
+ * Delete row(s) from the table (one transaction)
+ *
+ * @param pBinding Binding between table columns and struct fields.
+ * @param pData Array of structures. Only fields part of the primary
+ * key needs to be set.
+ * @param NbRows No of rows to delete (i.e. length of pData array)
+ * @return Request identifier
+ */
+DBA_ReqId_t
+DBA_ArrayDeleteRows( const DBA_Binding_t* pBinding, const void * pData,
+ int NbRows,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Updates/Inserts row(s) in the table (one transaction)
+ *
+ * @param pBinding Binding between table columns and struct fields.
+ * @param pData Array of pointers to structures.
+ * @param NbRows No of rows to update/insert (i.e. length of pData array)
+ * @return Request identifier
+ * @note All the table columns must be part of the binding.
+ */
+DBA_ReqId_t
+DBA_WriteRows( const DBA_Binding_t* pBinding, const void * const pData[],
+ int NbRows,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Update/Insert row(s) in the table (one transaction)
+ *
+ * @param pBinding Binding between table columns and struct fields.
+ * @param pData Array of structures.
+ * @param NbRows No of rows to update/insert (i.e. length of pData array)
+ * @return Request identifier
+ * @note All the table columns must be part of the binding.
+ */
+DBA_ReqId_t
+DBA_ArrayWriteRows( const DBA_Binding_t* pBinding, const void * pData,
+ int NbRows,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Read row(s) from a table of the database (one transaction)
+ *
+ * @param pBinding Binding between table columns and struct fields.
+ * @param pData Array of pointers to structures.
+ * Only fields part of the primary key needs to be set.
+ * The other fields in the binding will be populated.
+ * @param NbRows No of rows to read (i.e. length of pData array)
+ * @return Request identifier
+ */
+DBA_ReqId_t
+DBA_ReadRows( const DBA_Binding_t* pBinding, void * const pData[],
+ int NbRows,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Read row(s) from a table of the database (one transaction)
+ *
+ * @param pBinding Binding between table columns and struct fields.
+ * @param pData Array of structures.
+ * Only fields part of the primary key needs to be set.
+ * The other fields in the binding will be populated.
+ * @param NbRows No of rows to read (i.e. length of pData array)
+ * @return Request identifier
+ */
+DBA_ReqId_t
+DBA_ArrayReadRows( const DBA_Binding_t* pBinding, void * pData,
+ int NbRows,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/
+
+/**
+ * Insert <b>one</b> row for each specified binding (as one transaction).
+ *
+ * @param pBindings Array of pointers to bindings.
+ * @param pData Array of pointers to structures.
+ * @param NbBindings No of bindings (tables) to insert into,
+ * i.e. length of arrays pBindings and pData
+ * @return Request identifier
+ * @note It is valid to specify the same binding twice
+ * (with corresponding data pointer) if you want to insert two
+ * rows in one table
+ */
+DBA_ReqId_t
+DBA_MultiInsertRow(const DBA_Binding_t * const pBindings[],
+ const void * const pData[],
+ int NbBindings,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Update <b>one</b> row for each specified binding (as one transaction).
+ *
+ * @param pBindings Array of pointers to bindings.
+ * @param pData Array of pointers to structures.
+ * @param NbBindings No of bindings (tables) to insert into
+ * i.e. length of arrays pBindings and pData
+ * @return Request identifier
+ * @note It is valid to specify the same binding twice
+ * (with corresponding data pointer) if you want to update two
+ * rows in one table
+ */
+DBA_ReqId_t
+DBA_MultiUpdateRow(const DBA_Binding_t * const pBindings[],
+ const void * const pData[],
+ int NbBindings,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Update/insert <b>one</b> row for each specified binding (as one transaction).
+ *
+ * @param pBindings Array of pointers to bindings.
+ * @param pData Array of pointers to structures.
+ * @param NbBindings No of bindings (tables) to insert into
+ * i.e. length of arrays pBindings and pData
+ * @return Request identifier
+ * @note It is valid to specify the same binding twice
+ * (with corresponding data pointer) if you want to update/insert two
+ * rows in one table
+ */
+DBA_ReqId_t
+DBA_MultiWriteRow(const DBA_Binding_t * const pBindings[],
+ const void * const pData[],
+ int NbBindings,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Delete <b>one</b> row for each specified binding (as one transaction).
+ *
+ * @param pBindings Array of pointers to bindings.
+ * @param pData Array of pointers to structures.
+ * @param NbBindings No of bindings (tables) to insert into
+ * i.e. length of arrays pBindings and pData
+ * @return Request identifier
+ * @note It is valid to specify the same binding twice
+ * (with corresponding data pointer) if you want to delete two
+ * rows in one table
+ */
+DBA_ReqId_t
+DBA_MultiDeleteRow(const DBA_Binding_t * const pBindings[],
+ const void * const pData[],
+ int NbBindings,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Read <b>one</b> row for each specified binding (as one transaction).
+ *
+ * @param pBindings Array of pointers to bindings.
+ * @param pData Array of pointers to structures.
+ * @param NbBindings No of bindings (tables) to insert into
+ * i.e. length of arrays pBindings and pData
+ * @return Request identifier
+ * @note It is valid to specify the same binding twice
+ * (with corresponding data pointer) if you want to read two
+ * rows in one table
+ */
+DBA_ReqId_t
+DBA_MultiReadRow(const DBA_Binding_t * const pBindings[],
+ void * const pData[],
+ int NbBindings,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/
+
+/**
+ * A structure used for bulk reads.
+ * The structure contains a pointer to the data and an indicator.
+ * After the bulk read has completed, the indicator is set to 1 if the row
+ * was found and to 0 if the row was not found.
+ *
+ */
+typedef struct DBA_BulkReadResultSet {
+ void * DataPtr; /**< Pointer to data. Only fields part of
+ primary key members needs
+ to be set before bulk read. */
+ Boolean_t RowFoundIndicator; /**< This indicator has a valid value
+ only after bulk read has completed.
+ If the value is 1 then the row was found */
+} DBA_BulkReadResultSet_t;
+
+/**
+ * Read rows from a table of the database (potentially multiple transactions)
+ * The users should for each NbRows specify the fields part of the primary key
+ *
+ * @param pBinding Binding between table columns and struct fields.
+ * @param pData Array of DBA_BulkReadResultSet_t, with DataPtr pointing to
+ * structure. Only the fields which are part of the
+ * primary key need be set.
+ * The RowFoundIndicator will be set when the request returns.
+ * @param NbRows No of rows to read (i.e. length of pData array)
+ * @return Request identifier
+ *
+ */
+DBA_ReqId_t
+DBA_BulkReadRows(const DBA_Binding_t * pBinding,
+ DBA_BulkReadResultSet_t pData[],
+ int NbRows,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/**
+ * Read rows from several tables of the database in potentially multiple
+ * transactions.
+ *
+ *<pre>
+ * The pData array <b>must</b> be organized as follows:
+ * NbRows with DataPtr pointing to structure of type pBindings[0]
+ * NbRows with DataPtr pointing to structure of type pBindings[1]
+ * ... </pre>
+ * Meaning that the pData array must be (NbBindings * NbRows) in length.
+ *
+ * The user should for each (NbRows * NbBindings) specify the primary key
+ * fields.
+ *
+ * @param pBindings Array of pointers to bindings
+ * @param pData Array of DBA_BulkReadResultSet_t.
+ * With DataPtr pointing to structure. Only the fields which
+ * are part of the key need be set.
+ * The RowFoundIndicator will be set when the operations returns.
+ * @param NbBindings No of bindings (i.e. length of pBindings array)
+ * @param NbRows No of rows per binding to read
+ * @return Request identifier
+ */
+DBA_ReqId_t
+DBA_BulkMultiReadRows(const DBA_Binding_t * const pBindings[],
+ DBA_BulkReadResultSet_t pData[],
+ int NbBindings,
+ int NbRows,
+ DBA_AsyncCallbackFn_t CbFunc );
+
+/** @} */
+
+#endif
diff --git a/ndb/include/newtonapi/defs/pcn_types.h b/ndb/include/newtonapi/defs/pcn_types.h
new file mode 100644
index 00000000000..a823846d7be
--- /dev/null
+++ b/ndb/include/newtonapi/defs/pcn_types.h
@@ -0,0 +1,41 @@
+/* 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 PCN_TYPES_H
+#define PCN_TYPES_H
+
+#include <stddef.h>
+#include <NdbUnistd.h>
+
+#ifdef NDB_MACOSX
+typedef unsigned int Size_t;
+#elif defined(NDB_SPARC_64)
+typedef unsigned int Size_t;
+#else
+typedef size_t Size_t;
+#endif
+
+typedef int Boolean_t;
+
+typedef unsigned UInt32_t;
+
+#define PCN_TRUE true
+#define PCN_FALSE false
+
+#define PCN_SIZE_OF(s, m ) sizeof(((s *)0)->m)
+#define PCN_OFFSET_OF(s, m) offsetof(s, m)
+
+#endif
diff --git a/ndb/include/portlib/NdbCondition.h b/ndb/include/portlib/NdbCondition.h
new file mode 100644
index 00000000000..fb1f2fcd69e
--- /dev/null
+++ b/ndb/include/portlib/NdbCondition.h
@@ -0,0 +1,94 @@
+/* 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 NDB_CONDITION_H
+#define NDB_CONDITION_H
+
+#include "NdbMutex.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct NdbCondition;
+
+
+/*
+// Create a condition
+//
+// * returnvalue: pointer to the condition structure
+*/
+struct NdbCondition* NdbCondition_Create(void);
+
+/*
+// Wait for a condition, allows a thread to wait for
+// a condition and atomically releases the associated mutex.
+//
+// * p_cond: pointer to the condition structure
+// * p_mutex: pointer to the mutex structure
+// * returnvalue: 0 = succeeded, 1 = failed
+*/
+int NdbCondition_Wait(struct NdbCondition* p_cond,
+ NdbMutex* p_mutex);
+
+/*
+ * Wait for a condition with timeout, allows a thread to
+ * wait for a condition and atomically releases the associated mutex.
+ *
+ * @param p_cond - pointer to the condition structure
+ * @param p_mutex - pointer to the mutex structure
+ * @param msec - Wait for msec milli seconds the most
+ * @return 0 = succeeded, 1 = failed
+ * @
+ */
+int
+NdbCondition_WaitTimeout(struct NdbCondition* p_cond,
+ NdbMutex* p_mutex,
+ int msec);
+
+
+/*
+// Signal a condition
+//
+// * p_cond: pointer to the condition structure
+// * returnvalue: 0 = succeeded, 1 = failed
+*/
+int NdbCondition_Signal(struct NdbCondition* p_cond);
+
+
+/*
+// Broadcast a condition
+//
+// * p_cond: pointer to the condition structure
+// * returnvalue: 0 = succeeded, 1 = failed
+*/
+int NdbCondition_Broadcast(struct NdbCondition* p_cond);
+
+/*
+// Destroy a condition
+//
+// * p_cond: pointer to the condition structure
+// * returnvalue: 0 = succeeded, 1 = failed
+*/
+int NdbCondition_Destroy(struct NdbCondition* p_cond);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/ndb/include/portlib/NdbConstant.hpp b/ndb/include/portlib/NdbConstant.hpp
new file mode 100644
index 00000000000..bd45209d2b5
--- /dev/null
+++ b/ndb/include/portlib/NdbConstant.hpp
@@ -0,0 +1,28 @@
+/* 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 NDB_CONSTANT_HPP
+#define NDB_CONSTANT_HPP
+
+#include <ndb_types.h>
+
+#ifdef NDB_VC98
+#define STATIC_CONST(x) enum { x }
+#else
+#define STATIC_CONST(x) static const Uint32 x
+#endif
+
+#endif
diff --git a/ndb/include/portlib/NdbDaemon.h b/ndb/include/portlib/NdbDaemon.h
new file mode 100644
index 00000000000..74ea3f06419
--- /dev/null
+++ b/ndb/include/portlib/NdbDaemon.h
@@ -0,0 +1,72 @@
+/* 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 NDB_DAEMON_H
+#define NDB_DAEMON_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Become a daemon.
+ * lockfile the "pid file" or other resource to lock exclusively
+ * logfile daemon output is directed here (input is set to /dev/null)
+ * if NULL, output redirection is not done
+ * flags none currently
+ * returns 0 on success, on error -1
+ */
+extern int
+NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags);
+
+/*
+ * Test if the daemon is running (file is locked).
+ * lockfile the "pid file"
+ * flags none currently
+ * return 0 no, 1 yes, -1
+ */
+extern int
+NdbDaemon_Test(const char* lockfile, unsigned flags);
+
+/*
+ * Kill the daemon.
+ * lockfile the "pid file"
+ * flags none currently
+ * return 0 killed, 1 not running, -1 other error
+ */
+extern int
+NdbDaemon_Kill(const char* lockfile, unsigned flags);
+
+/*
+ * Pid from last call, either forked off or found in lock file.
+ */
+extern long NdbDaemon_DaemonPid;
+
+/*
+ * Error code from last failed call.
+ */
+extern int NdbDaemon_ErrorCode;
+
+/*
+ * Error text from last failed call.
+ */
+extern char NdbDaemon_ErrorText[];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ndb/include/portlib/NdbEnv.h b/ndb/include/portlib/NdbEnv.h
new file mode 100644
index 00000000000..1611bf3152e
--- /dev/null
+++ b/ndb/include/portlib/NdbEnv.h
@@ -0,0 +1,34 @@
+/* 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 NDB_ENV_H
+#define NDB_ENV_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ const char* NdbEnv_GetEnv(const char* name, char * buf, int buflen);
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif
+
+
+
diff --git a/ndb/include/portlib/NdbHost.h b/ndb/include/portlib/NdbHost.h
new file mode 100644
index 00000000000..90e7b781137
--- /dev/null
+++ b/ndb/include/portlib/NdbHost.h
@@ -0,0 +1,43 @@
+/* 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 NDB_HOST_H
+#define NDB_HOST_H
+
+#ifndef NDB_WIN32
+#include <sys/param.h>
+#include <netdb.h>
+#endif
+
+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 255
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ int NdbHost_GetHostName(char*);
+ int NdbHost_GetProcessId();
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif
+
+
+
diff --git a/ndb/include/portlib/NdbMain.h b/ndb/include/portlib/NdbMain.h
new file mode 100644
index 00000000000..7cc7a877750
--- /dev/null
+++ b/ndb/include/portlib/NdbMain.h
@@ -0,0 +1,66 @@
+/* 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 NDBMAIN_H
+#define NDBMAIN_H
+
+#if defined NDB_SOFTOSE || defined NDB_OSE
+#include <ose.h>
+#include <shell.h>
+
+/* Define an OSE_PROCESS that can be started from osemain.con */
+#define NDB_MAIN(name) \
+int main_ ## name(int argc, const char** argv); \
+OS_PROCESS(name){ \
+ main_ ## name(0, 0); \
+ stop(current_process()); \
+ exit(0); \
+} \
+int main_ ## name(int argc, const char** argv)
+
+/* Define an function that can be started from the command line */
+#define NDB_COMMAND(name, str_name, syntax, description, stacksize) \
+int main_ ## name(int argc, const char** argv); \
+ \
+static int run_ ## name(int argc, char *argv[]){ \
+ return main_ ## name (argc, argv); \
+} \
+ \
+OS_PROCESS(init_ ## name){ \
+ shell_add_cmd_attrs(str_name, syntax, description, \
+ run_ ## name, OS_PRI_PROC, 25, stacksize); \
+ stop(current_process()); \
+ return; \
+} \
+ \
+int main_ ## name(int argc, const char** argv)
+
+
+
+
+#else
+
+#define NDB_MAIN(name) \
+int main(int argc, const char** argv)
+
+#define NDB_COMMAND(name, str_name, syntax, description, stacksize) \
+int main(int argc, const char** argv)
+
+
+#endif
+
+
+#endif
diff --git a/ndb/include/portlib/NdbMem.h b/ndb/include/portlib/NdbMem.h
new file mode 100644
index 00000000000..38ad3f60448
--- /dev/null
+++ b/ndb/include/portlib/NdbMem.h
@@ -0,0 +1,82 @@
+/* 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 NDB_MEM_H
+#define NDB_MEM_H
+
+#include <stddef.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * NdbMem_Create
+ * Create and initalise internal data structures for Ndb
+ */
+void NdbMem_Create(void);
+
+
+/**
+ * NdbMem_Destroy
+ * Destroy all memory allocated by NdbMem
+ */
+void NdbMem_Destroy(void);
+
+/**
+ * NdbMem_Allocate
+ * Allocate size of memory
+ * @parameter size - size in bytes of memory to allocate
+ * @returns - pointer to memory if succesful otherwise NULL
+ */
+void* NdbMem_Allocate(size_t size);
+
+/**
+ * NdbMem_AllocateAlign
+ * Allocate size of memory
+ * @parameter size - size in bytes of memory to allocate
+ * @paramter alignment - byte boundary to align the data at
+ * @returns - pointer to memory if succesful otherwise NULL
+ */
+void* NdbMem_AllocateAlign(size_t size, size_t alignment);
+
+
+/**
+ * NdbMem_Free
+ * Free the memory that ptr points to
+ * @parameter ptr - pointer to the memory to free
+ */
+void NdbMem_Free(void* ptr);
+
+/**
+ * NdbMem_MemLockAll
+ * Locks virtual memory in main memory
+ */
+int NdbMem_MemLockAll(void);
+
+/**
+ * NdbMem_MemUnlockAll
+ * Unlocks virtual memory
+ */
+int NdbMem_MemUnlockAll(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ndb/include/portlib/NdbMutex.h b/ndb/include/portlib/NdbMutex.h
new file mode 100644
index 00000000000..d2cb6328b03
--- /dev/null
+++ b/ndb/include/portlib/NdbMutex.h
@@ -0,0 +1,114 @@
+/* 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 NDB_MUTEX_H
+#define NDB_MUTEX_H
+
+#ifdef NDB_WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <windows.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined NDB_OSE || defined NDB_SOFTOSE
+#include <ose.h>
+typedef SEMAPHORE NdbMutex;
+#define NDB_MUTEX_INITIALIZER { 1, 0, 0 }
+#elif defined NDB_WIN32
+typedef CRITICAL_SECTION NdbMutex;
+#else
+#include <pthread.h>
+typedef pthread_mutex_t NdbMutex;
+#define NDB_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#endif
+
+/**
+ * Create a mutex
+ *
+ * p_mutex: pointer to the mutex structure
+ * returnvalue: pointer to the mutex structure
+ */
+NdbMutex* NdbMutex_Create(void);
+
+/**
+ * Destroy a mutex
+ *
+ * * p_mutex: pointer to the mutex structure
+ * * returnvalue: 0 = succeeded, -1 = failed
+ */
+int NdbMutex_Destroy(NdbMutex* p_mutex);
+
+/**
+ * Lock a mutex
+ *
+ * * p_mutex: pointer to the mutex structure
+ * * returnvalue: 0 = succeeded, -1 = failed
+ */
+int NdbMutex_Lock(NdbMutex* p_mutex);
+
+/**
+ * Unlock a mutex
+ *
+ * * p_mutex: pointer to the mutex structure
+ * * returnvalue: 0 = succeeded, -1 = failed
+ */
+int NdbMutex_Unlock(NdbMutex* p_mutex);
+
+/**
+ * Try to lock a mutex
+ *
+ * * p_mutex: pointer to the mutex structure
+ * * returnvalue: 0 = succeeded, -1 = failed
+ */
+int NdbMutex_Trylock(NdbMutex* p_mutex);
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+class NdbLockable {
+ friend class Guard;
+public:
+ NdbLockable() { m_mutex = NdbMutex_Create(); }
+ ~NdbLockable() { NdbMutex_Destroy(m_mutex); }
+
+ void lock() { NdbMutex_Lock(m_mutex); }
+ void unlock(){ NdbMutex_Unlock(m_mutex);}
+ bool tryLock(){ return NdbMutex_Trylock(m_mutex) == 0;}
+
+ NdbMutex* getMutex() {return m_mutex;};
+
+protected:
+ NdbMutex * m_mutex;
+};
+
+class Guard {
+public:
+ Guard(NdbMutex *mtx) : m_mtx(mtx) { NdbMutex_Lock(m_mtx); };
+ Guard(NdbLockable & l) : m_mtx(l.m_mutex) { NdbMutex_Lock(m_mtx); };
+ ~Guard() { NdbMutex_Unlock(m_mtx); };
+private:
+ NdbMutex *m_mtx;
+};
+
+#endif
+
+#endif
diff --git a/ndb/include/portlib/NdbSleep.h b/ndb/include/portlib/NdbSleep.h
new file mode 100644
index 00000000000..3b26710154f
--- /dev/null
+++ b/ndb/include/portlib/NdbSleep.h
@@ -0,0 +1,38 @@
+/* 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 NDBSLEEP_H
+#define NDBSLEEP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Sleep for some time
+ *
+ * returnvalue: true = time is up, false = failed
+ */
+int NdbSleep_MicroSleep(int microseconds);
+int NdbSleep_MilliSleep(int milliseconds);
+int NdbSleep_SecSleep(int seconds);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/ndb/include/portlib/NdbStdio.h b/ndb/include/portlib/NdbStdio.h
new file mode 100644
index 00000000000..163b7eeef6f
--- /dev/null
+++ b/ndb/include/portlib/NdbStdio.h
@@ -0,0 +1,36 @@
+/* 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 */
+
+/*
+ * NdbStdio.h - stdio.h for ndb
+ *
+ *
+ */
+
+
+#if defined NDB_OSE || defined NDB_SOFTOSE
+/* On OSE Delta the snprintf is declare in outfmt.h */
+#include <outfmt.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef NDB_WIN32
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#define strtok_r(s1, s2, l) strtok(s1, s2)
+#endif
+
diff --git a/ndb/include/portlib/NdbTCP.h b/ndb/include/portlib/NdbTCP.h
new file mode 100644
index 00000000000..6e2f18b61b2
--- /dev/null
+++ b/ndb/include/portlib/NdbTCP.h
@@ -0,0 +1,137 @@
+/* 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 NDB_TCP_H
+#define NDB_TCP_H
+
+#if defined NDB_OSE || defined NDB_SOFTOSE
+/**
+ * Include files needed
+ */
+#include "inet.h"
+
+#include <netdb.h>
+#include <errno.h>
+
+#define NDB_NONBLOCK FNDELAY
+#define NDB_SOCKET_TYPE int
+#define NDB_INVALID_SOCKET -1
+#define NDB_CLOSE_SOCKET(x) close(x)
+
+/**
+ * socklen_t not defined in the header files of OSE
+ */
+typedef int socklen_t;
+
+#define InetErrno (* inet_errno())
+
+#endif
+
+#if defined NDB_SOLARIS || defined NDB_HPUX || defined NDB_IBMAIX || defined NDB_TRU64X
+/**
+ * Include files needed
+ */
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+
+#include <netdb.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#define NDB_NONBLOCK O_NONBLOCK
+#define NDB_SOCKET_TYPE int
+#define NDB_INVALID_SOCKET -1
+#define NDB_CLOSE_SOCKET(x) close(x)
+
+#define InetErrno errno
+
+#endif
+
+#if defined NDB_LINUX || defined NDB_MACOSX
+/**
+ * Include files needed
+ */
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+
+#include <netdb.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#define NDB_NONBLOCK O_NONBLOCK
+#define NDB_SOCKET_TYPE int
+#define NDB_INVALID_SOCKET -1
+#define NDB_CLOSE_SOCKET(x) close(x)
+
+#define InetErrno errno
+
+#endif
+
+
+#ifdef NDB_WIN32
+/**
+ * Include files needed
+ */
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <errno.h>
+
+#define InetErrno WSAGetLastError()
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define NDB_SOCKET_TYPE SOCKET
+#define NDB_INVALID_SOCKET INVALID_SOCKET
+#define NDB_CLOSE_SOCKET(x) closesocket(x)
+
+#endif
+
+#ifndef NDB_MACOSX
+#define NDB_SOCKLEN_T socklen_t
+#else
+#define NDB_SOCKLEN_T int
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Convert host name or ip address to in_addr
+ *
+ * Returns 0 on success
+ * -1 on failure
+ *
+ * Implemented as:
+ * gethostbyname
+ * if not success
+ * inet_addr
+ */
+int Ndb_getInAddr(struct in_addr * dst, const char *address);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ndb/include/portlib/NdbThread.h b/ndb/include/portlib/NdbThread.h
new file mode 100644
index 00000000000..516022903e3
--- /dev/null
+++ b/ndb/include/portlib/NdbThread.h
@@ -0,0 +1,103 @@
+/* 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 NDB_THREAD_H
+#define NDB_THREAD_H
+
+#include <sys/types.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum NDB_THREAD_PRIO_ENUM {
+ NDB_THREAD_PRIO_HIGHEST,
+ NDB_THREAD_PRIO_HIGH,
+ NDB_THREAD_PRIO_MEAN,
+ NDB_THREAD_PRIO_LOW,
+ NDB_THREAD_PRIO_LOWEST
+} NDB_THREAD_PRIO;
+
+typedef void* (NDB_THREAD_FUNC)(void*);
+typedef void* NDB_THREAD_ARG;
+typedef size_t NDB_THREAD_STACKSIZE;
+
+struct NdbThread;
+
+/**
+ * Create a thread
+ *
+ * * p_thread_func: pointer of the function to run in the thread
+ * * p_thread_arg: pointer to argument to be passed to the thread
+ * * thread_stack_size: stack size for this thread
+ * * p_thread_name: pointer to name of this thread
+ * * returnvalue: pointer to the created thread
+ */
+struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
+ NDB_THREAD_ARG *p_thread_arg,
+ const NDB_THREAD_STACKSIZE thread_stack_size,
+ const char* p_thread_name,
+ NDB_THREAD_PRIO thread_prio);
+
+/**
+ * Destroy a thread
+ * Deallocates memory for thread
+ * And NULL the pointer
+ *
+ */
+void NdbThread_Destroy(struct NdbThread** p_thread);
+
+
+/**
+ * Waitfor a thread, suspend the execution of the calling thread
+ * until the wait_thread_id completes
+ *
+ * * p_wait_thread, pointer to the thread to wait for
+ * * status: exit code from thread waited for
+ * * returnvalue: true = succeded, false = failed
+ */
+int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status);
+
+/**
+ * Exit thread, terminates the calling thread
+ *
+ * * status: exit code
+ */
+void NdbThread_Exit(int status);
+
+/**
+ * Set thread concurrency level
+ *
+ * *
+ */
+int NdbThread_SetConcurrencyLevel(int level);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
+
+
+
+
+
+
+
diff --git a/ndb/include/portlib/NdbTick.h b/ndb/include/portlib/NdbTick.h
new file mode 100644
index 00000000000..762f65331cc
--- /dev/null
+++ b/ndb/include/portlib/NdbTick.h
@@ -0,0 +1,69 @@
+/* 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 NDB_TICK_H
+#define NDB_TICK_H
+
+#include <ndb_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined NDB_OSE || defined NDB_SOFTOSE
+typedef unsigned long NDB_TICKS;
+#else
+typedef Uint64 NDB_TICKS;
+#endif
+
+/**
+ * Returns the current millisecond since 1970
+ */
+NDB_TICKS NdbTick_CurrentMillisecond(void);
+
+/**
+ * Get current micro second
+ * Second method is simply abstraction on top of the first
+ *
+ * Returns 0 - Success
+ */
+int NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros);
+
+//#define TIME_MEASUREMENT
+#ifdef TIME_MEASUREMENT
+
+struct MicroSecondTimer {
+ NDB_TICKS seconds;
+ NDB_TICKS micro_seconds;
+};
+
+/**
+ * Get time between start and stop time in microseconds
+ * Abstraction to get time in struct
+ *
+ * 0 means stop happened at or before start time
+ */
+NDB_TICKS NdbTick_getMicrosPassed(struct MicroSecondTimer start,
+ struct MicroSecondTimer stop);
+int NdbTick_getMicroTimer(struct MicroSecondTimer* time_now);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/ndb/include/portlib/NdbUnistd.h b/ndb/include/portlib/NdbUnistd.h
new file mode 100644
index 00000000000..42f67e2aeb3
--- /dev/null
+++ b/ndb/include/portlib/NdbUnistd.h
@@ -0,0 +1,39 @@
+/* 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 NDB_UNISTD_H
+#define NDB_UNISTD_H
+
+#ifdef NDB_WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <windows.h>
+#include <limits.h>
+
+#define DIR_SEPARATOR "\\"
+#define PATH_MAX 256
+
+#pragma warning(disable: 4503 4786)
+
+#else
+#include <unistd.h>
+#include <limits.h>
+
+#define DIR_SEPARATOR "/"
+
+#endif
+
+#endif
diff --git a/ndb/include/portlib/PortDefs.h b/ndb/include/portlib/PortDefs.h
new file mode 100644
index 00000000000..6cd5be0149f
--- /dev/null
+++ b/ndb/include/portlib/PortDefs.h
@@ -0,0 +1,96 @@
+/* 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 PORT_DEFS_H
+#define PORT_DEFS_H
+/*
+ This file contains varoius declarations/definitions needed in the port of AXEVM to NT, as well as backporting
+ to Solaris...
+
+ $Id: PortDefs.h,v 1.5 2003/10/07 07:59:59 mikael Exp $
+*/
+#ifdef NDB_WIN32
+#include <time.h>
+
+
+struct tms
+{
+ time_t tms_utime; // user time
+ time_t tms_stime; // system time
+ time_t tms_cutime; // user time of children
+ time_t tms_cstime; // system time of children
+};
+
+struct timespec
+{
+ long tv_sec; // Seconds
+ long tv_nsec; // Nanoseconds
+};
+
+#define strcasecmp(a,b) _strcmpi(a,b)
+
+ // Exports a WIN32 getopt function
+extern int optind;
+extern char *optarg;
+int getopt(int, char **, char *opts);
+#endif // NDB_WIN32
+
+#ifdef NDB_ALPHA
+#ifdef NDB_GCC
+extern int gnuShouldNotUseRPCC();
+#define RPCC() gnuShouldNotUseRPCC();
+#else
+#ifdef NDB_WIN32
+#ifdef __cplusplus
+extern "C" {
+#endif //__cplusplus
+ u_int64 __asm(char *, ...);
+ double __dasm(char *, ...);
+ float __fasm(char *, ...);
+ void _AcquireSpinLock(long *);
+ void _ReleaseSpinLock(long *);
+ int __ADD_ATOMIC_LONG2(void *, int);
+#ifdef __cplusplus
+};
+#endif //__cplusplus
+#pragma intrinsic (__asm, __dasm, __fasm)
+#pragma intrinsic(_ReleaseSpinLock, _AcquireSpinLock)
+#pragma intrinsic(__ADD_ATOMIC_LONG2)
+#endif // NDB_WIN32
+
+#define RPCC() ((int)__asm(" rpcc v0;"))
+#define MB() __asm(" mb;");
+#define WMB() __asm(" wmb;");
+#ifdef USE_INITIALSP
+#define IS_IP() (__asm(" mov sp,v0;") < IPinitialSP)
+#else // USE_INITIALSP
+#define IS_IP() (((__asm(" rpcc v0;") >> 32) & 0x7) == IP_CPU)
+#endif
+#endif //NDB_GCC
+#else // NDB_ALPHA
+#if defined NDB_SPARC
+#define MB() asm ("membar 0x0;"); // LoadLoad
+#define WMB() asm ("membar 0x3;"); // StoreStore
+#else // NDB_SPARC
+#define MB()
+#define WMB()
+#endif // NDB_SPARC
+#define IS_IP() (1==1)
+extern int shouldNotUseRPCC();
+#define RPCC() shouldNotUseRPCC();
+#endif // NDB_ALPHA
+
+#endif
diff --git a/ndb/include/portlib/prefetch.h b/ndb/include/portlib/prefetch.h
new file mode 100644
index 00000000000..d663dd4c40d
--- /dev/null
+++ b/ndb/include/portlib/prefetch.h
@@ -0,0 +1,69 @@
+/* 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 PREFETCH_H
+#define PREFETCH_H
+
+#ifdef NDB_FORTE6
+#include <sun_prefetch.h>
+#endif
+
+#ifdef USE_PREFETCH
+#define PREFETCH(addr) prefetch(addr)
+#else
+#define PREFETCH(addr)
+#endif
+
+#ifdef USE_PREFETCH
+#define WRITEHINT(addr) writehint(addr)
+#else
+#define WRITEHINT(addr)
+#endif
+
+#include "PortDefs.h"
+
+#ifdef NDB_FORTE6
+#pragma optimize("", off)
+#endif
+inline void prefetch(void* p)
+{
+#ifdef NDB_ALPHA
+ __asm(" ldl r31,0(a0);", p);
+#endif // NDB_ALPHA
+#ifdef NDB_FORTE6
+ sparc_prefetch_read_once(p);
+#else
+ (void)p;
+#endif
+}
+
+inline void writehint(void* p)
+{
+#ifdef NDB_ALPHA
+ __asm(" wh64 (a0);", p);
+#endif // NDB_ALPHA
+#ifdef NDB_FORTE6
+ sparc_prefetch_write_once(p);
+#else
+ (void)p;
+#endif
+}
+#ifdef NDB_FORTE6
+#pragma optimize("", on)
+#endif
+
+#endif
+
diff --git a/ndb/include/transporter/TransporterCallback.hpp b/ndb/include/transporter/TransporterCallback.hpp
new file mode 100644
index 00000000000..9f910f31728
--- /dev/null
+++ b/ndb/include/transporter/TransporterCallback.hpp
@@ -0,0 +1,345 @@
+/* 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 */
+
+//****************************************************************************
+//
+// AUTHOR
+// Åsa Fransson
+//
+// NAME
+// TransporterCallback
+//
+//
+//***************************************************************************/
+#ifndef TRANSPORTER_CALLBACK_H
+#define TRANSPORTER_CALLBACK_H
+
+#include <kernel_types.h>
+#include "TransporterDefinitions.hpp"
+
+
+/**
+ * Call back functions
+ */
+
+/**
+ * The execute function
+ */
+void
+execute(void * callbackObj,
+ SignalHeader * const header,
+ Uint8 prio,
+ Uint32 * const signalData,
+ LinearSectionPtr ptr[3]);
+
+/**
+ * A function to avoid job buffer overflow in NDB kernel, empty in API
+ * Non-zero return means we executed signals. This is necessary information
+ * to the transporter to ensure that it properly uses the transporter after
+ * coming back again.
+ */
+int
+checkJobBuffer();
+
+/**
+ * Report send length
+ */
+void
+reportSendLen(void * callbackObj,
+ NodeId nodeId, Uint32 count, Uint64 bytes);
+
+/**
+ * Report average receive length
+ */
+void
+reportReceiveLen(void * callbackObj,
+ NodeId nodeId, Uint32 count, Uint64 bytes);
+
+/**
+ * Report connection established
+ */
+void
+reportConnect(void * callbackObj, NodeId nodeId);
+
+/**
+ * Report connection broken
+ */
+
+void
+reportDisconnect(void * callbackObj,
+ NodeId nodeId, Uint32 errNo);
+
+enum TransporterError {
+ TE_NO_ERROR = 0,
+ /**
+ * TE_ERROR_CLOSING_SOCKET
+ *
+ * Error found during closing of socket
+ *
+ * Recommended behavior: Ignore
+ */
+ TE_ERROR_CLOSING_SOCKET = 0x1,
+
+ /**
+ * TE_ERROR_IN_SELECT_BEFORE_ACCEPT
+ *
+ * Error found during accept (just before)
+ * The transporter will retry.
+ *
+ * Recommended behavior: Ignore
+ * (or possible do setPerformState(PerformDisconnect)
+ */
+ TE_ERROR_IN_SELECT_BEFORE_ACCEPT = 0x2,
+
+ /**
+ * TE_INVALID_MESSAGE_LENGTH
+ *
+ * Error found in message (message length)
+ *
+ * Recommended behavior: setPerformState(PerformDisconnect)
+ */
+ TE_INVALID_MESSAGE_LENGTH = 0x8003,
+
+ /**
+ * TE_INVALID_CHECKSUM
+ *
+ * Error found in message (checksum)
+ *
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ TE_INVALID_CHECKSUM = 0x8004,
+
+ /**
+ * TE_COULD_NOT_CREATE_SOCKET
+ *
+ * Error found while creating socket
+ *
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ TE_COULD_NOT_CREATE_SOCKET = 0x8005,
+
+ /**
+ * TE_COULD_NOT_BIND_SOCKET
+ *
+ * Error found while binding server socket
+ *
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ TE_COULD_NOT_BIND_SOCKET = 0x8006,
+
+ /**
+ * TE_LISTEN_FAILED
+ *
+ * Error found while listening to server socket
+ *
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ TE_LISTEN_FAILED = 0x8007,
+
+ /**
+ * TE_ACCEPT_RETURN_ERROR
+ *
+ * Error found during accept
+ * The transporter will retry.
+ *
+ * Recommended behavior: Ignore
+ * (or possible do setPerformState(PerformDisconnect)
+ */
+ TE_ACCEPT_RETURN_ERROR = 0x8008
+
+ /**
+ * TE_SHM_DISCONNECT
+ *
+ * The remote node has disconnected
+ *
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SHM_DISCONNECT = 0x800b
+
+ /**
+ * TE_SHM_IPC_STAT
+ *
+ * Unable to check shm segment
+ * probably because remote node
+ * has disconnected and removed it
+ *
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SHM_IPC_STAT = 0x800c
+
+ /**
+ * TE_SHM_UNABLE_TO_CREATE_SEGMENT
+ *
+ * Unable to create shm segment
+ * probably os something error
+ *
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SHM_UNABLE_TO_CREATE_SEGMENT = 0x800d
+
+ /**
+ * TE_SHM_UNABLE_TO_ATTACH_SEGMENT
+ *
+ * Unable to attach shm segment
+ * probably invalid group / user
+ *
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SHM_UNABLE_TO_ATTACH_SEGMENT = 0x800e
+
+ /**
+ * TE_SHM_UNABLE_TO_REMOVE_SEGMENT
+ *
+ * Unable to remove shm segment
+ *
+ * Recommended behavior: Ignore (not much to do)
+ * Print warning to logfile
+ */
+ ,TE_SHM_UNABLE_TO_REMOVE_SEGMENT = 0x800f
+
+ ,TE_TOO_SMALL_SIGID = 0x0010
+ ,TE_TOO_LARGE_SIGID = 0x0011
+ ,TE_WAIT_STACK_FULL = 0x8012
+ ,TE_RECEIVE_BUFFER_FULL = 0x8013
+
+ /**
+ * TE_SIGNAL_LOST_SEND_BUFFER_FULL
+ *
+ * Send buffer is full, and trying to force send fails
+ * a signal is dropped!! very bad very bad
+ *
+ */
+ ,TE_SIGNAL_LOST_SEND_BUFFER_FULL = 0x8014
+
+ /**
+ * TE_SIGNAL_LOST
+ *
+ * Send failed for unknown reason
+ * a signal is dropped!! very bad very bad
+ *
+ */
+ ,TE_SIGNAL_LOST = 0x8015
+
+ /**
+ * TE_SEND_BUFFER_FULL
+ *
+ * The send buffer was full, but sleeping for a while solved it
+ */
+ ,TE_SEND_BUFFER_FULL = 0x0016
+
+ /**
+ * TE_SCI_UNABLE_TO_CLOSE_CHANNEL
+ *
+ * Unable to close the sci channel and the resources allocated by
+ * the sisci api.
+ */
+ ,TE_SCI_UNABLE_TO_CLOSE_CHANNEL = 0x8016
+
+ /**
+ * TE_SCI_LINK_ERROR
+ *
+ * There is no link from this node to the switch.
+ * No point in continuing. Must check the connections.
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SCI_LINK_ERROR = 0x8017
+
+ /**
+ * TE_SCI_UNABLE_TO_START_SEQUENCE
+ *
+ * Could not start a sequence, because system resources
+ * are exumed or no sequence has been created.
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SCI_UNABLE_TO_START_SEQUENCE = 0x8018
+
+ /**
+ * TE_SCI_UNABLE_TO_REMOVE_SEQUENCE
+ *
+ * Could not remove a sequence
+ */
+ ,TE_SCI_UNABLE_TO_REMOVE_SEQUENCE = 0x8019
+
+ /**
+ * TE_SCI_UNABLE_TO_CREATE_SEQUENCE
+ *
+ * Could not create a sequence, because system resources are
+ * exempted. Must reboot.
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SCI_UNABLE_TO_CREATE_SEQUENCE = 0x801a
+
+ /**
+ * TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR
+ *
+ * Tried to send data on redundant link but failed.
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR = 0x801b
+
+ /**
+ * TE_SCI_CANNOT_INIT_LOCALSEGMENT
+ *
+ * Cannot initialize local segment. A whole lot of things has
+ * gone wrong (no system resources). Must reboot.
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SCI_CANNOT_INIT_LOCALSEGMENT = 0x801c
+
+ /**
+ * TE_SCI_CANNOT_MAP_REMOTESEGMENT
+ *
+ * Cannot map remote segment. No system resources are left.
+ * Must reboot system.
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SCI_CANNOT_MAP_REMOTESEGMENT = 0x801d
+
+ /**
+ * TE_SCI_UNABLE_TO_UNMAP_SEGMENT
+ *
+ * Cannot free the resources used by this segment (step 1).
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SCI_UNABLE_TO_UNMAP_SEGMENT = 0x801e
+
+ /**
+ * TE_SCI_UNABLE_TO_REMOVE_SEGMENT
+ *
+ * Cannot free the resources used by this segment (step 2).
+ * Cannot guarantee that enough resources exist for NDB
+ * to map more segment
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SCI_UNABLE_TO_REMOVE_SEGMENT = 0x801f
+
+ /**
+ * TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT
+ *
+ * Cannot disconnect from a remote segment.
+ * Recommended behavior: setPerformState(PerformDisonnect)
+ */
+ ,TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT = 0x8020
+
+};
+
+/**
+ * Report error
+ */
+void
+reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode);
+
+#endif
diff --git a/ndb/include/transporter/TransporterDefinitions.hpp b/ndb/include/transporter/TransporterDefinitions.hpp
new file mode 100644
index 00000000000..5bbf7c79491
--- /dev/null
+++ b/ndb/include/transporter/TransporterDefinitions.hpp
@@ -0,0 +1,152 @@
+/* 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 TransporterDefinitions_H
+#define TransporterDefinitions_H
+
+#include <kernel_types.h>
+#include <string.h>
+#include <NdbOut.hpp>
+
+/**
+ * The maximum number of transporters allowed
+ * A maximum is needed to be able to allocate the array of transporters
+ */
+const int MAX_NTRANSPORTERS = 128;
+
+/**
+ * The sendbuffer limit after which the contents of the buffer is sent
+ */
+const int TCP_SEND_LIMIT = 64000;
+
+enum SendStatus {
+ SEND_OK = 0,
+ SEND_BLOCKED = 1,
+ SEND_DISCONNECTED = 2,
+ SEND_BUFFER_FULL = 3,
+ SEND_MESSAGE_TOO_BIG = 4,
+ SEND_UNKNOWN_NODE = 5
+};
+
+/**
+ * Protocol6 Header +
+ * (optional signal id) + (optional checksum) + (signal data)
+ */
+//const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25));
+const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25)+(3*4)+4*4096);
+
+/**
+ * TCP Transporter Configuration
+ */
+struct TCP_TransporterConfiguration {
+ Uint32 port;
+ const char *remoteHostName;
+ const char *localHostName;
+ NodeId remoteNodeId;
+ NodeId localNodeId;
+ Uint32 sendBufferSize; // Size of SendBuffer of priority B
+ Uint32 maxReceiveSize; // Maximum no of bytes to receive
+ Uint32 byteOrder;
+ bool compression;
+ bool checksum;
+ bool signalId;
+};
+
+/**
+ * SHM Transporter Configuration
+ */
+struct SHM_TransporterConfiguration {
+ NodeId remoteNodeId;
+ NodeId localNodeId;
+ bool compression;
+ bool checksum;
+ bool signalId;
+ int byteOrder;
+
+ Uint32 shmKey;
+ Uint32 shmSize;
+};
+
+/**
+ * OSE Transporter Configuration
+ */
+struct OSE_TransporterConfiguration {
+ const char *remoteHostName;
+ const char *localHostName;
+ NodeId remoteNodeId;
+ NodeId localNodeId;
+ bool compression;
+ bool checksum;
+ bool signalId;
+ int byteOrder;
+
+ Uint32 prioASignalSize;
+ Uint32 prioBSignalSize;
+ Uint32 receiveBufferSize; // In number of signals
+};
+
+/**
+ * SCI Transporter Configuration
+ */
+struct SCI_TransporterConfiguration {
+ Uint32 sendLimit; // Packet size
+ Uint32 bufferSize; // Buffer size
+
+ Uint32 nLocalAdapters; // 1 or 2, the number of adapters on local host
+
+ Uint32 nRemoteAdapters;
+ Uint32 remoteSciNodeId0; // SCInodeId for adapter 1
+ Uint32 remoteSciNodeId1; // SCInodeId for adapter 2
+
+ NodeId localNodeId; // Local node Id
+ NodeId remoteNodeId; // Remote node Id
+
+ Uint32 byteOrder;
+ bool compression;
+ bool checksum;
+ bool signalId;
+
+};
+
+struct SignalHeader {
+ Uint32 theVerId_signalNumber; // 4 bit ver id - 16 bit gsn
+ Uint32 theReceiversBlockNumber; // Only 16 bit blocknum
+ Uint32 theSendersBlockRef;
+ Uint32 theLength;
+ Uint32 theSendersSignalId;
+ Uint32 theSignalId;
+ Uint16 theTrace;
+ Uint8 m_noOfSections;
+ Uint8 m_fragmentInfo;
+}; /** 7x4 = 32 Bytes */
+
+struct LinearSectionPtr {
+ Uint32 sz;
+ Uint32 * p;
+};
+
+struct SegmentedSectionPtr {
+ Uint32 sz;
+ Uint32 i;
+ struct SectionSegment * p;
+
+ void setNull() { p = 0;}
+ bool isNull() const { return p == 0;}
+};
+
+class NdbOut & operator <<(class NdbOut & out, SignalHeader & sh);
+
+#endif // Define of TransporterDefinitions_H
diff --git a/ndb/include/transporter/TransporterRegistry.hpp b/ndb/include/transporter/TransporterRegistry.hpp
new file mode 100644
index 00000000000..6c979777f18
--- /dev/null
+++ b/ndb/include/transporter/TransporterRegistry.hpp
@@ -0,0 +1,281 @@
+/* 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 */
+
+//****************************************************************************
+//
+// NAME
+// TransporterRegistry
+//
+// DESCRIPTION
+// TransporterRegistry (singelton) is the interface to the
+// transporter layer. It handles transporter states and
+// holds the transporter arrays.
+//
+//***************************************************************************/
+#ifndef TransporterRegistry_H
+#define TransporterRegistry_H
+
+#include "TransporterDefinitions.hpp"
+
+#include <NdbTCP.h>
+
+// A transporter is always in a PerformState.
+// PerformIO is used initially and as long as any of the events
+// PerformConnect, ...
+enum PerformState {
+ PerformNothing = 4, // Does nothing
+ PerformIO = 0, // Is connected
+ PerformConnect = 1, // Is trying to connect
+ PerformDisconnect = 2, // Trying to disconnect
+ RemoveTransporter = 3 // Will be removed
+};
+
+// A transporter is always in an IOState.
+// NoHalt is used initially and as long as it is no restrictions on
+// sending or receiving.
+enum IOState {
+ NoHalt = 0,
+ HaltInput = 1,
+ HaltOutput = 2,
+ HaltIO = 3
+};
+
+enum TransporterType {
+ tt_TCP_TRANSPORTER = 1,
+ tt_SCI_TRANSPORTER = 2,
+ tt_SHM_TRANSPORTER = 3,
+ tt_OSE_TRANSPORTER = 4
+};
+
+class Transporter;
+class TCP_Transporter;
+class SCI_Transporter;
+class SHM_Transporter;
+class OSE_Transporter;
+
+/**
+ * @class TransporterRegistry
+ * @brief ...
+ */
+class TransporterRegistry {
+ friend class OSE_Receiver;
+public:
+ /**
+ * Constructor
+ */
+ TransporterRegistry(void * callback = 0 ,
+ unsigned maxTransporters = MAX_NTRANSPORTERS,
+ unsigned sizeOfLongSignalMemory = 100);
+
+ bool init(NodeId localNodeId);
+
+ /**
+ * Remove all transporters
+ */
+ void removeAll();
+
+ /**
+ * Disconnect all transporters
+ */
+ void disconnectAll();
+
+ /**
+ * Stops the server, disconnects all the transporter
+ * and deletes them and remove it from the transporter arrays
+ */
+ ~TransporterRegistry();
+
+ /**
+ * Start/Stop receiving
+ */
+ void startReceiving();
+ void stopReceiving();
+
+ /**
+ * Start/Stop sending
+ */
+ void startSending();
+ void stopSending();
+
+ /**
+ * Get and set methods for PerformState
+ */
+ PerformState performState(NodeId nodeId);
+ void setPerformState(NodeId nodeId, PerformState state);
+
+ /**
+ * Set perform state for all transporters
+ */
+ void setPerformState(PerformState state);
+
+ /**
+ * Get and set methods for IOState
+ */
+ IOState ioState(NodeId nodeId);
+ void setIOState(NodeId nodeId, IOState state);
+
+ /**
+ * createTransporter
+ *
+ * If the config object indicates that the transporter
+ * to be created will act as a server and no server is
+ * started, startServer is called. A transporter of the selected kind
+ * is created and it is put in the transporter arrays.
+ */
+ bool createTransporter(struct TCP_TransporterConfiguration * config);
+ bool createTransporter(struct SCI_TransporterConfiguration * config);
+ bool createTransporter(struct SHM_TransporterConfiguration * config);
+ bool createTransporter(struct OSE_TransporterConfiguration * config);
+
+ /**
+ * prepareSend
+ *
+ * When IOState is HaltOutput or HaltIO do not send or insert any
+ * signals in the SendBuffer, unless it is intended for the remote
+ * CMVMI block (blockno 252)
+ * Perform prepareSend on the transporter.
+ *
+ * NOTE signalHeader->xxxBlockRef should contain block numbers and
+ * not references
+ */
+ SendStatus prepareSend(const SignalHeader * const signalHeader, Uint8 prio,
+ const Uint32 * const signalData,
+ NodeId nodeId,
+ const LinearSectionPtr ptr[3]);
+
+ SendStatus prepareSend(const SignalHeader * const signalHeader, Uint8 prio,
+ const Uint32 * const signalData,
+ NodeId nodeId,
+ class SectionSegmentPool & pool,
+ const SegmentedSectionPtr ptr[3]);
+
+ /**
+ * external_IO
+ *
+ * Equal to: poll(...); perform_IO()
+ *
+ */
+ void external_IO(Uint32 timeOutMillis);
+
+ Uint32 pollReceive(Uint32 timeOutMillis);
+ void performReceive();
+ void performSend();
+
+ void checkConnections();
+
+ /**
+ * Force sending if more than or equal to sendLimit
+ * number have asked for send. Returns 0 if not sending
+ * and 1 if sending.
+ */
+ int forceSendCheck(int sendLimit);
+
+#ifdef DEBUG_TRANSPORTER
+ void printState();
+#endif
+
+protected:
+
+private:
+ void * callbackObj;
+
+ int sendCounter;
+ NodeId localNodeId;
+ bool nodeIdSpecified;
+ unsigned maxTransporters;
+ int nTransporters;
+ int nTCPTransporters;
+ int nSCITransporters;
+ int nSHMTransporters;
+ int nOSETransporters;
+
+ int m_ccCount;
+ int m_ccIndex;
+ int m_ccStep;
+ int m_nTransportersPerformConnect;
+ bool m_ccReady;
+ /**
+ * Arrays holding all transporters in the order they are created
+ */
+ TCP_Transporter** theTCPTransporters;
+ SCI_Transporter** theSCITransporters;
+ SHM_Transporter** theSHMTransporters;
+ OSE_Transporter** theOSETransporters;
+
+ /**
+ * Array, indexed by nodeId, holding all transporters
+ */
+ TransporterType* theTransporterTypes;
+ Transporter** theTransporters;
+
+ /**
+ * OSE Receiver
+ */
+ class OSE_Receiver * theOSEReceiver;
+
+ /**
+ * In OSE you for some bizar reason needs to create a socket
+ * the first thing you do when using inet functions.
+ *
+ * Furthermore a process doing select has to "own" a socket
+ *
+ */
+ int theOSEJunkSocketSend;
+ int theOSEJunkSocketRecv;
+#if defined NDB_OSE || defined NDB_SOFTOSE
+ PROCESS theReceiverPid;
+#endif
+
+ /**
+ * State arrays, index by host id
+ */
+ PerformState* performStates;
+ IOState* ioStates;
+
+ /**
+ * Unpack signal data
+ */
+ Uint32 unpack(Uint32 * readPtr,
+ Uint32 bufferSize,
+ NodeId remoteNodeId,
+ IOState state);
+
+ Uint32 * unpack(Uint32 * readPtr,
+ Uint32 * eodPtr,
+ NodeId remoteNodeId,
+ IOState state);
+
+ /**
+ * Disconnect the transporter and remove it from
+ * theTransporters array. Do not allow any holes
+ * in theTransporters. Delete the transporter
+ * and remove it from theIndexedTransporters array
+ */
+ void removeTransporter(NodeId nodeId);
+
+ /**
+ * Used in polling if exists TCP_Transporter
+ */
+ int tcpReadSelectReply;
+ fd_set tcpReadset;
+
+ Uint32 poll_OSE(Uint32 timeOutMillis);
+ Uint32 poll_TCP(Uint32 timeOutMillis);
+ Uint32 poll_SCI(Uint32 timeOutMillis);
+ Uint32 poll_SHM(Uint32 timeOutMillis);
+};
+
+#endif // Define of TransporterRegistry_H
diff --git a/ndb/include/util/Base64.hpp b/ndb/include/util/Base64.hpp
new file mode 100644
index 00000000000..a8678da946c
--- /dev/null
+++ b/ndb/include/util/Base64.hpp
@@ -0,0 +1,26 @@
+/* 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 __BASE64_HPP_INCLUDED__
+#define __BASE64_HPP_INCLUDED__
+
+#include <UtilBuffer.hpp>
+#include <BaseString.hpp>
+
+int base64_encode(UtilBuffer &src, BaseString &dst);
+int base64_decode(BaseString &src, UtilBuffer &dst);
+
+#endif /* !__BASE64_HPP_INCLUDED__ */
diff --git a/ndb/include/util/BaseString.hpp b/ndb/include/util/BaseString.hpp
new file mode 100644
index 00000000000..a88bd97ffc5
--- /dev/null
+++ b/ndb/include/util/BaseString.hpp
@@ -0,0 +1,260 @@
+/* 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 __UTIL_BASESTRING_HPP_INCLUDED__
+#define __UTIL_BASESTRING_HPP_INCLUDED__
+
+#include <ctype.h>
+#include <stdlib.h>
+
+#include <Vector.hpp>
+
+/**
+ * @class BaseString
+ * @brief Null terminated strings
+ */
+class BaseString {
+public:
+ /** @brief Constructs an empty string */
+ BaseString();
+
+ /** @brief Constructs a copy of a char * */
+ BaseString(const char* s);
+
+ /** @brief Constructs a copy of another BaseString */
+ BaseString(const BaseString& str);
+
+ /** @brief Destructor */
+ ~BaseString();
+
+ /** @brief Returns a C-style string */
+ const char* c_str() const;
+
+ /** @brief Returns the length of the string */
+ unsigned length() const;
+
+ /** @brief Checks if the string is empty */
+ bool empty() const;
+
+ /** @brief Convert to uppercase */
+ void ndb_toupper();
+
+ /** @brief Convert to lowercase */
+ void ndb_tolower();
+
+ /** @brief Assigns from a char * */
+ BaseString& assign(const char* s);
+
+ /** @brief Assigns from another BaseString */
+ BaseString& assign(const BaseString& str);
+
+ /** @brief Assigns from char *s, with maximum length n */
+ BaseString& assign(const char* s, size_t n);
+
+ /** @brief Assigns from another BaseString, with maximum length n */
+ BaseString& assign(const BaseString& str, size_t n);
+
+ /**
+ * Assings from a Vector of BaseStrings, each Vector entry
+ * separated by separator.
+ *
+ * @param vector Vector of BaseStrings to append
+ * @param separator Separation between appended strings
+ */
+ BaseString& assign(const Vector<BaseString> &vector,
+ const BaseString &separator = BaseString(" "));
+
+ /** @brief Appends a char * to the end */
+ BaseString& append(const char* s);
+
+ /** @brief Appends a char to the end */
+ BaseString& append(char c);
+
+ /** @brief Appends another BaseString to the end */
+ BaseString& append(const BaseString& str);
+
+ /**
+ * Appends a Vector of BaseStrings to the end, each Vector entry
+ * separated by separator.
+ *
+ * @param vector Vector of BaseStrings to append
+ * @param separator Separation between appended strings
+ */
+ BaseString& append(const Vector<BaseString> &vector,
+ const BaseString &separator = BaseString(" "));
+
+ /** @brief Assigns from a format string a la printf() */
+ BaseString& assfmt(const char* ftm, ...);
+
+ /** @brief Appends a format string a la printf() to the end */
+ BaseString& appfmt(const char* ftm, ...);
+
+ /**
+ * Split a string into a vector of strings. Separate the string where
+ * any character included in separator exists.
+ * Maximally maxSize entries are added to the vector, if more separators
+ * exist in the string, the remainder of the string will be appended
+ * to the last entry in the vector.
+ * The vector will not be cleared, so any existing strings in the
+ * vector will remain.
+ *
+ * @param separator characters separating the entries
+ * @param vector where the separated strings will be stored
+ * @param maximum number of strings extracted
+ *
+ * @returns the number of string added to the vector
+ */
+ int split(Vector<BaseString> &vector,
+ const BaseString &separator = BaseString(" "),
+ int maxSize = -1) const;
+
+ /**
+ * Returns the index of the first occurance of the character c.
+ *
+ * @params c character to look for
+ * @returns index of character, of -1 if no character found
+ */
+ ssize_t indexOf(char c);
+
+ /**
+ * Returns the index of the last occurance of the character c.
+ *
+ * @params c character to look for
+ * @returns index of character, of -1 if no character found
+ */
+ ssize_t lastIndexOf(char c);
+
+ /**
+ * Returns a subset of a string
+ *
+ * @param start index of first character
+ * @param stop index of last character
+ * @return a new string
+ */
+ BaseString substr(ssize_t start, ssize_t stop = -1);
+
+ /**
+ * @brief Assignment operator
+ */
+ BaseString& operator=(const BaseString& str);
+
+ /** @brief Compare two strings */
+ bool operator<(const BaseString& str) const;
+ /** @brief Are two strings equal? */
+ bool operator==(const BaseString& str) const;
+ /** @brief Are two strings equal? */
+ bool operator==(const char *str) const;
+ /** @brief Are two strings not equal? */
+ bool operator!=(const BaseString& str) const;
+ /** @brief Are two strings not equal? */
+ bool operator!=(const char *str) const;
+
+ /**
+ * Trim string from <i>delim</i>
+ */
+ BaseString& trim(const char * delim = " \t");
+
+ /**
+ * Return c-array with strings suitable for execve
+ * When whitespace is detected, the characters '"' and '\' are honored,
+ * to make it possible to give arguments containing whitespace.
+ * The semantics of '"' and '\' match that of most Unix shells.
+ */
+ static char** argify(const char *argv0, const char *src);
+
+ /**
+ * Trim string from <i>delim</i>
+ */
+ static char* trim(char * src, const char * delim = " \t");
+private:
+ char* m_chr;
+ unsigned m_len;
+};
+
+inline const char*
+BaseString::c_str() const
+{
+ return m_chr;
+}
+
+inline unsigned
+BaseString::length() const
+{
+ return m_len;
+}
+
+inline bool
+BaseString::empty() const
+{
+ return m_len == 0;
+}
+
+inline void
+BaseString::ndb_toupper() {
+ for(unsigned i = 0; i < length(); i++)
+ m_chr[i] = ::toupper(m_chr[i]);
+}
+
+inline void
+BaseString::ndb_tolower() {
+ for(unsigned i = 0; i < length(); i++)
+ m_chr[i] = ::tolower(m_chr[i]);
+}
+
+inline bool
+BaseString::operator<(const BaseString& str) const
+{
+ return strcmp(m_chr, str.m_chr) < 0;
+}
+
+inline bool
+BaseString::operator==(const BaseString& str) const
+{
+ return strcmp(m_chr, str.m_chr) == 0;
+}
+
+inline bool
+BaseString::operator==(const char *str) const
+{
+ return strcmp(m_chr, str) == 0;
+}
+
+inline bool
+BaseString::operator!=(const BaseString& str) const
+{
+ return strcmp(m_chr, str.m_chr) != 0;
+}
+
+inline bool
+BaseString::operator!=(const char *str) const
+{
+ return strcmp(m_chr, str) != 0;
+}
+
+inline BaseString&
+BaseString::assign(const BaseString& str)
+{
+ return assign(str.m_chr);
+}
+
+inline BaseString&
+BaseString::assign(const Vector<BaseString> &vector,
+ const BaseString &separator) {
+ assign("");
+ return append(vector, separator);
+}
+
+#endif /* !__UTIL_BASESTRING_HPP_INCLUDED__ */
diff --git a/ndb/include/util/Bitmask.hpp b/ndb/include/util/Bitmask.hpp
new file mode 100644
index 00000000000..1f95d62bcb6
--- /dev/null
+++ b/ndb/include/util/Bitmask.hpp
@@ -0,0 +1,755 @@
+/* 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 NDB_BITMASK_H
+#define NDB_BITMASK_H
+
+#include <ndb_types.h>
+#include <NdbConstant.hpp>
+
+#ifndef NDB_ASSERT
+#include <stdio.h>
+#include <stdlib.h>
+#define NDB_ASSERT(x, s) \
+ do { if (!(x)) { printf("%s\n", s); abort(); } } while (0)
+#endif
+
+/**
+ * Bitmask implementation. Size is given explicitly
+ * (as first argument). All methods are static.
+ */
+class BitmaskImpl {
+public:
+ STATIC_CONST( NotFound = (unsigned)-1 );
+
+ /**
+ * get - Check if bit n is set.
+ */
+ static bool get(unsigned size, const Uint32 data[], unsigned n);
+
+ /**
+ * set - Set bit n to given value (true/false).
+ */
+ static void set(unsigned size, Uint32 data[], unsigned n, bool value);
+
+ /**
+ * set - Set bit n.
+ */
+ static void set(unsigned size, Uint32 data[], unsigned n);
+
+ /**
+ * set - Set all bits.
+ */
+ static void set(unsigned size, Uint32 data[]);
+
+ /**
+ * assign - Set all bits in <em>dst</em> to corresponding in <em>src/<em>
+ */
+ static void assign(unsigned size, Uint32 dst[], const Uint32 src[]);
+
+ /**
+ * clear - Clear bit n.
+ */
+ static void clear(unsigned size, Uint32 data[], unsigned n);
+
+ /**
+ * clear - Clear all bits.
+ */
+ static void clear(unsigned size, Uint32 data[]);
+
+ /**
+ * isclear - Check if all bits are clear. This is faster
+ * than checking count() == 0.
+ */
+ static bool isclear(unsigned size, const Uint32 data[]);
+
+ /**
+ * count - Count number of set bits.
+ */
+ static unsigned count(unsigned size, const Uint32 data[]);
+
+ /**
+ * find - Find first set bit, starting at given position.
+ * Returns NotFound when not found.
+ */
+ static unsigned find(unsigned size, const Uint32 data[], unsigned n);
+
+ /**
+ * equal - Bitwise equal.
+ */
+ static bool equal(unsigned size, const Uint32 data[], const Uint32 data2[]);
+
+ /**
+ * bitOR - Bitwise (x | y) into first operand.
+ */
+ static void bitOR(unsigned size, Uint32 data[], const Uint32 data2[]);
+
+ /**
+ * bitAND - Bitwise (x & y) into first operand.
+ */
+ static void bitAND(unsigned size, Uint32 data[], const Uint32 data2[]);
+
+ /**
+ * bitANDC - Bitwise (x & ~y) into first operand.
+ */
+ static void bitANDC(unsigned size, Uint32 data[], const Uint32 data2[]);
+
+ /**
+ * bitXOR - Bitwise (x ^ y) into first operand.
+ */
+ static void bitXOR(unsigned size, Uint32 data[], const Uint32 data2[]);
+
+ /**
+ * contains - Check if all bits set in data2 are set in data
+ */
+ static bool contains(unsigned size, Uint32 data[], const Uint32 data2[]);
+
+ /**
+ * overlaps - Check if any bit set in data is set in data2
+ */
+ static bool overlaps(unsigned size, Uint32 data[], const Uint32 data2[]);
+
+ /**
+ * getField - Get bitfield at given position and length (max 32 bits)
+ */
+ static Uint32 getField(unsigned size, const Uint32 data[],
+ unsigned pos, unsigned len);
+
+ /**
+ * setField - Set bitfield at given position and length (max 32 bits)
+ */
+ static void setField(unsigned size, Uint32 data[],
+ unsigned pos, unsigned len, Uint32 val);
+
+ /**
+ * getText - Return as hex-digits (only for debug routines).
+ */
+ static void getText(unsigned size, const Uint32 data[], char* buf);
+};
+
+inline bool
+BitmaskImpl::get(unsigned size, const Uint32 data[], unsigned n)
+{
+ NDB_ASSERT(n < (size << 5), "bit get out of range");
+ return (data[n >> 5] & (1 << (n & 31))) != 0;
+}
+
+inline void
+BitmaskImpl::set(unsigned size, Uint32 data[], unsigned n, bool value)
+{
+ value ? set(size, data, n) : clear(size, data, n);
+}
+
+inline void
+BitmaskImpl::set(unsigned size, Uint32 data[], unsigned n)
+{
+ NDB_ASSERT(n < (size << 5), "bit set out of range");
+ data[n >> 5] |= (1 << (n & 31));
+}
+
+inline void
+BitmaskImpl::set(unsigned size, Uint32 data[])
+{
+ for (unsigned i = 0; i < size; i++) {
+ data[i] = ~0;
+ }
+}
+
+inline void
+BitmaskImpl::assign(unsigned size, Uint32 dst[], const Uint32 src[])
+{
+ for (unsigned i = 0; i < size; i++) {
+ dst[i] = src[i];
+ }
+}
+
+inline void
+BitmaskImpl::clear(unsigned size, Uint32 data[], unsigned n)
+{
+ NDB_ASSERT(n < (size << 5), "bit clear out of range");
+ data[n >> 5] &= ~(1 << (n & 31));
+}
+
+inline void
+BitmaskImpl::clear(unsigned size, Uint32 data[])
+{
+ for (unsigned i = 0; i < size; i++) {
+ data[i] = 0;
+ }
+}
+
+inline bool
+BitmaskImpl::isclear(unsigned size, const Uint32 data[])
+{
+ for (unsigned i = 0; i < size; i++) {
+ if (data[i] != 0)
+ return false;
+ }
+ return true;
+}
+
+inline unsigned
+BitmaskImpl::count(unsigned size, const Uint32 data[])
+{
+ unsigned cnt = 0;
+ for (unsigned i = 0; i < size; i++) {
+ Uint32 x = data[i];
+ while (x) {
+ x &= (x - 1);
+ cnt++;
+ }
+ }
+ return cnt;
+}
+
+inline unsigned
+BitmaskImpl::find(unsigned size, const Uint32 data[], unsigned n)
+{
+ while (n < (size << 5)) { // XXX make this smarter
+ if (get(size, data, n)) {
+ return n;
+ }
+ n++;
+ }
+ return NotFound;
+}
+
+inline bool
+BitmaskImpl::equal(unsigned size, const Uint32 data[], const Uint32 data2[])
+{
+ for (unsigned i = 0; i < size; i++) {
+ if (data[i] != data2[i])
+ return false;
+ }
+ return true;
+}
+
+inline void
+BitmaskImpl::bitOR(unsigned size, Uint32 data[], const Uint32 data2[])
+{
+ for (unsigned i = 0; i < size; i++) {
+ data[i] |= data2[i];
+ }
+}
+
+inline void
+BitmaskImpl::bitAND(unsigned size, Uint32 data[], const Uint32 data2[])
+{
+ for (unsigned i = 0; i < size; i++) {
+ data[i] &= data2[i];
+ }
+}
+
+inline void
+BitmaskImpl::bitANDC(unsigned size, Uint32 data[], const Uint32 data2[])
+{
+ for (unsigned i = 0; i < size; i++) {
+ data[i] &= ~data2[i];
+ }
+}
+
+inline void
+BitmaskImpl::bitXOR(unsigned size, Uint32 data[], const Uint32 data2[])
+{
+ for (unsigned i = 0; i < size; i++) {
+ data[i] ^= data2[i];
+ }
+}
+
+inline bool
+BitmaskImpl::contains(unsigned size, Uint32 data[], const Uint32 data2[])
+{
+ for (unsigned int i = 0; i < size; i++)
+ if ((data[i] & data2[i]) != data2[i])
+ return false;
+ return true;
+}
+
+inline bool
+BitmaskImpl::overlaps(unsigned size, Uint32 data[], const Uint32 data2[])
+{
+ for (unsigned int i = 0; i < size; i++)
+ if ((data[i] & data2[i]) != 0)
+ return true;
+ return false;
+}
+
+inline Uint32
+BitmaskImpl::getField(unsigned size, const Uint32 data[],
+ unsigned pos, unsigned len)
+{
+ Uint32 val = 0;
+ for (unsigned i = 0; i < len; i++)
+ val |= get(size, data, pos + i) << i;
+ return val;
+}
+
+inline void
+BitmaskImpl::setField(unsigned size, Uint32 data[],
+ unsigned pos, unsigned len, Uint32 val)
+{
+ for (unsigned i = 0; i < len; i++)
+ set(size, data, pos + i, val & (1 << i));
+}
+
+inline void
+BitmaskImpl::getText(unsigned size, const Uint32 data[], char* buf)
+{
+ const char* const hex = "0123456789abcdef";
+ for (int i = (size-1); i >= 0; i--) {
+ Uint32 x = data[i];
+ for (unsigned j = 0; j < 8; j++) {
+ buf[7-j] = hex[x & 0xf];
+ x >>= 4;
+ }
+ buf += 8;
+ }
+ *buf = 0;
+}
+
+/**
+ * Bitmasks. The size is number of 32-bit words (Uint32).
+ * Unused bits in the last word must be zero.
+ *
+ * XXX replace size by length in bits
+ */
+template <unsigned size>
+class Bitmask {
+public:
+ /**
+ * POD data representation
+ */
+ struct Data {
+ Uint32 data[size];
+
+ Data & operator=(const Bitmask<size> & src) {
+ src.assign(size, data);
+ return *this;
+ }
+ };
+private:
+
+ Data rep;
+public:
+ STATIC_CONST( Size = size );
+ STATIC_CONST( NotFound = BitmaskImpl::NotFound );
+ STATIC_CONST( TextLength = size * 8 );
+
+ /**
+ * assign - Set all bits in <em>dst</em> to corresponding in <em>src/<em>
+ */
+ void assign(const Bitmask<size>::Data & src);
+
+ /**
+ * assign - Set all bits in <em>dst</em> to corresponding in <em>src/<em>
+ */
+ static void assign(Uint32 dst[], const Uint32 src[]);
+ void assign(const Bitmask<size> & src);
+
+ /**
+ * assign <em>dst</em> of size <em>sz</em> to <em>this</em>
+ */
+ void assign(unsigned sz, Uint32 dst[]) const;
+
+ /**
+ * assign <em>this</em> according to <em>src/em>
+ */
+ void assign(unsigned sz, const Uint32 src[]);
+
+ /**
+ * get - Check if bit n is set.
+ */
+ static bool get(const Uint32 data[], unsigned n);
+ bool get(unsigned n) const;
+
+ /**
+ * set - Set bit n to given value (true/false).
+ */
+ static void set(Uint32 data[], unsigned n, bool value);
+ void set(unsigned n, bool value);
+
+ /**
+ * set - Set bit n.
+ */
+ static void set(Uint32 data[], unsigned n);
+ void set(unsigned n);
+
+ /**
+ * set - set all bits.
+ */
+ static void set(Uint32 data[]);
+ void set();
+
+ /**
+ * clear - Clear bit n.
+ */
+ static void clear(Uint32 data[], unsigned n);
+ void clear(unsigned n);
+
+ /**
+ * clear - Clear all bits.
+ */
+ static void clear(Uint32 data[]);
+ void clear();
+
+ /**
+ * isclear - Check if all bits are clear. This is faster
+ * than checking count() == 0.
+ */
+ static bool isclear(const Uint32 data[]);
+ bool isclear() const;
+
+ /**
+ * count - Count number of set bits.
+ */
+ static unsigned count(const Uint32 data[]);
+ unsigned count() const;
+
+ /**
+ * find - Find first set bit, starting at given position.
+ * Returns NotFound when not found.
+ */
+ static unsigned find(const Uint32 data[], unsigned n);
+ unsigned find(unsigned n) const;
+
+ /**
+ * equal - Bitwise equal.
+ */
+ static bool equal(const Uint32 data[], const Uint32 data2[]);
+ bool equal(const Bitmask<size>& mask2) const;
+
+ /**
+ * bitOR - Bitwise (x | y) into first operand.
+ */
+ static void bitOR(Uint32 data[], const Uint32 data2[]);
+ Bitmask<size>& bitOR(const Bitmask<size>& mask2);
+
+ /**
+ * bitAND - Bitwise (x & y) into first operand.
+ */
+ static void bitAND(Uint32 data[], const Uint32 data2[]);
+ Bitmask<size>& bitAND(const Bitmask<size>& mask2);
+
+ /**
+ * bitANDC - Bitwise (x & ~y) into first operand.
+ */
+ static void bitANDC(Uint32 data[], const Uint32 data2[]);
+ Bitmask<size>& bitANDC(const Bitmask<size>& mask2);
+
+ /**
+ * bitXOR - Bitwise (x ^ y) into first operand.
+ */
+ static void bitXOR(Uint32 data[], const Uint32 data2[]);
+ Bitmask<size>& bitXOR(const Bitmask<size>& mask2);
+
+ /**
+ * contains - Check if all bits set in data2 (that) are also set in data (this)
+ */
+ static bool contains(Uint32 data[], const Uint32 data2[]);
+ bool contains(Bitmask<size> that);
+
+ /**
+ * overlaps - Check if any bit set in this Bitmask (data) is also set in that (data2)
+ */
+ static bool overlaps(Uint32 data[], const Uint32 data2[]);
+ bool overlaps(Bitmask<size> that);
+
+ /**
+ * getText - Return as hex-digits (only for debug routines).
+ */
+ static void getText(const Uint32 data[], char* buf);
+ char* getText(char* buf) const;
+};
+
+template <unsigned size>
+inline void
+Bitmask<size>::assign(Uint32 dst[], const Uint32 src[])
+{
+ BitmaskImpl::assign(size, dst, src);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::assign(const Bitmask<size>::Data & src)
+{
+ assign(rep.data, src.data);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::assign(const Bitmask<size> & src)
+{
+ assign(rep.data, src);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::assign(unsigned sz, Uint32 dst[]) const
+{
+ BitmaskImpl::assign(sz, dst, rep.data);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::assign(unsigned sz, const Uint32 src[])
+{
+ BitmaskImpl::assign(sz, rep.data, src);
+}
+
+template <unsigned size>
+inline bool
+Bitmask<size>::get(const Uint32 data[], unsigned n)
+{
+ return BitmaskImpl::get(size, data, n);
+}
+
+template <unsigned size>
+inline bool
+Bitmask<size>::get(unsigned n) const
+{
+ return get(rep.data, n);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::set(Uint32 data[], unsigned n, bool value)
+{
+ BitmaskImpl::set(size, data, n, value);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::set(unsigned n, bool value)
+{
+ set(rep.data, n, value);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::set(Uint32 data[], unsigned n)
+{
+ BitmaskImpl::set(size, data, n);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::set(unsigned n)
+{
+ set(rep.data, n);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::set(Uint32 data[])
+{
+ BitmaskImpl::set(size, data);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::set()
+{
+ set(rep.data);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::clear(Uint32 data[], unsigned n)
+{
+ BitmaskImpl::clear(size, data, n);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::clear(unsigned n)
+{
+ clear(rep.data, n);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::clear(Uint32 data[])
+{
+ BitmaskImpl::clear(size, data);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::clear()
+{
+ clear(rep.data);
+}
+
+template <unsigned size>
+inline bool
+Bitmask<size>::isclear(const Uint32 data[])
+{
+ return BitmaskImpl::isclear(size, data);
+}
+
+template <unsigned size>
+inline bool
+Bitmask<size>::isclear() const
+{
+ return isclear(rep.data);
+}
+
+template <unsigned size>
+unsigned
+Bitmask<size>::count(const Uint32 data[])
+{
+ return BitmaskImpl::count(size, data);
+}
+
+template <unsigned size>
+inline unsigned
+Bitmask<size>::count() const
+{
+ return count(rep.data);
+}
+
+template <unsigned size>
+unsigned
+Bitmask<size>::find(const Uint32 data[], unsigned n)
+{
+ return BitmaskImpl::find(size, data, n);
+}
+
+template <unsigned size>
+inline unsigned
+Bitmask<size>::find(unsigned n) const
+{
+ return find(rep.data, n);
+}
+
+template <unsigned size>
+inline bool
+Bitmask<size>::equal(const Uint32 data[], const Uint32 data2[])
+{
+ return BitmaskImpl::equal(size, data, data2);
+}
+
+template <unsigned size>
+inline bool
+Bitmask<size>::equal(const Bitmask<size>& mask2) const
+{
+ return equal(rep.data, mask2.rep.data);
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::bitOR(Uint32 data[], const Uint32 data2[])
+{
+ BitmaskImpl::bitOR(size,data, data2);
+}
+
+template <unsigned size>
+inline Bitmask<size>&
+Bitmask<size>::bitOR(const Bitmask<size>& mask2)
+{
+ bitOR(rep.data, mask2.rep.data);
+ return *this;
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::bitAND(Uint32 data[], const Uint32 data2[])
+{
+ BitmaskImpl::bitAND(size,data, data2);
+}
+
+template <unsigned size>
+inline Bitmask<size>&
+Bitmask<size>::bitAND(const Bitmask<size>& mask2)
+{
+ bitAND(rep.data, mask2.rep.data);
+ return *this;
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::bitANDC(Uint32 data[], const Uint32 data2[])
+{
+ BitmaskImpl::bitANDC(size,data, data2);
+}
+
+template <unsigned size>
+inline Bitmask<size>&
+Bitmask<size>::bitANDC(const Bitmask<size>& mask2)
+{
+ bitANDC(rep.data, mask2.rep.data);
+ return *this;
+}
+
+template <unsigned size>
+inline void
+Bitmask<size>::bitXOR(Uint32 data[], const Uint32 data2[])
+{
+ BitmaskImpl::bitXOR(size,data, data2);
+}
+
+template <unsigned size>
+inline Bitmask<size>&
+Bitmask<size>::bitXOR(const Bitmask<size>& mask2)
+{
+ bitXOR(rep.data, mask2.rep.data);
+ return *this;
+}
+
+template <unsigned size>
+void
+Bitmask<size>::getText(const Uint32 data[], char* buf)
+{
+ BitmaskImpl::getText(size, data, buf);
+}
+
+template <unsigned size>
+inline char *
+Bitmask<size>::getText(char* buf) const
+{
+ getText(rep.data, buf);
+ return buf;
+}
+
+template <unsigned size>
+inline bool
+Bitmask<size>::contains(Uint32 data[], const Uint32 data2[])
+{
+ return BitmaskImpl::contains(size, data, data2);
+}
+
+template <unsigned size>
+inline bool
+Bitmask<size>::contains(Bitmask<size> that)
+{
+ return contains(this->rep.data, that.rep.data);
+}
+
+template <unsigned size>
+inline bool
+Bitmask<size>::overlaps(Uint32 data[], const Uint32 data2[])
+{
+ return BitmaskImpl::overlaps(size, data, data2);
+}
+
+template <unsigned size>
+inline bool
+Bitmask<size>::overlaps(Bitmask<size> that)
+{
+ return overlaps(this->rep.data, that.rep.data);
+}
+
+#endif
diff --git a/ndb/include/util/File.hpp b/ndb/include/util/File.hpp
new file mode 100644
index 00000000000..fe3d2642b18
--- /dev/null
+++ b/ndb/include/util/File.hpp
@@ -0,0 +1,206 @@
+/* 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 FILE_H
+#define FILE_H
+
+#include <NdbStdio.h>
+#include <NdbConstant.hpp>
+
+/**
+ * This class provides a file abstraction . It has operations
+ * to create, read, write and delete a file.
+ *
+ * @version #@ $Id: File.hpp,v 1.5 2002/04/26 13:15:38 ejonore Exp $
+ */
+class File
+{
+public:
+ /**
+ * Returns true if the file exist.
+ *
+ * @param aFileName a filename to check.
+ * @return true if the file exists.
+ */
+ static bool exists(const char* aFileName);
+
+ /**
+ * Returns the size of a file.
+ *
+ * @param f a pointer to a FILE descriptor.
+ * @return the size of the file.
+ */
+ static long size(FILE* f);
+
+ /**
+ * Renames a file.
+ *
+ * @param currFileName the current name of the file.
+ * @param newFileName the new name of the file.
+ * @return true if successful.
+ */
+ static bool rename(const char* currFileName, const char* newFileName);
+
+ /**
+ * Removes/deletes a file.
+ *
+ * @param aFileName the file to remove.
+ * @return true if successful.
+ */
+ static bool remove(const char* aFileName);
+
+ /**
+ * Default constructor.
+ */
+ File();
+
+ /**
+ * Creates a new File with the specified filename and file mode.
+ * The real file itself will not be created unless open() is called!
+ *
+ * To see the available file modes use 'man 3 fopen'.
+ *
+ * @param aFileName a filename.
+ * @param mode the mode which the file should be opened/created with, default "r".
+ */
+ File(const char* aFileName, const char* mode = "r");
+
+ /**
+ * Destructor.
+ */
+ ~File();
+
+ /**
+ * Opens/creates the file. If open() fails then 'errno' and perror()
+ * should be used to determine the exact failure cause.
+ *
+ * @return true if successful. Check errno if unsuccessful.
+ */
+ bool open();
+
+ /**
+ * Opens/creates the file with the specified name and mode.
+ * If open() fails then 'errno' and perror() should be used to
+ * determine the exact failure cause.
+ *
+ * @param aFileName the file to open.
+ * @param mode the file mode to use.
+ * @return true if successful. Check errno if unsuccessful.
+ */
+ bool open(const char* aFileName, const char* mode);
+
+ /**
+ * Removes the file.
+ *
+ * @return true if successful.
+ */
+ bool remove();
+
+ /**
+ * Closes the file, i.e., the FILE descriptor is closed.
+ */
+ bool close();
+
+ /**
+ * Read from the file. See fread() for more info.
+ *
+ * @param buf the buffer to read into.
+ * @param itemSize the size of each item.
+ * @param nitems read max n number of items.
+ * @return 0 if successful.
+ */
+ int read(void* buf, size_t itemSize, size_t nitems) const;
+
+ /**
+ * Read char from the file. See fread() for more info.
+ *
+ * @param buf the buffer to read into.
+ * @param start the start index of the buf.
+ * @param length the length of the buffer.
+ * @return 0 if successful.
+ */
+ int readChar(char* buf, long start, long length) const;
+
+ /**
+ * Read chars from the file. See fread() for more info.
+ *
+ * @param buf the buffer to read into.
+ * @return 0 if successful.
+ */
+ int readChar(char* buf);
+
+ /**
+ * Write to file. See fwrite() for more info.
+ *
+ * @param buf the buffer to read from.
+ * @param itemSize the size of each item.
+ * @param nitems write max n number of items.
+ * @return 0 if successful.
+ */
+ int write(const void* buf, size_t itemSize, size_t nitems);
+
+ /**
+ * Write chars to file. See fwrite() for more info.
+ *
+ * @param buf the buffer to read from.
+ * @param start the start index of the buf.
+ * @param length the length of the buffer.
+ * @return 0 if successful.
+ */
+ int writeChar(const char* buf, long start, long length);
+
+ /**
+ * Write chars to file. See fwrite() for more info.
+ *
+ * @param buf the buffer to read from.
+ * @return 0 if successful.
+ */
+ int writeChar(const char* buf);
+
+ /**
+ * Returns the file size.
+ *
+ * @return the file size.
+ */
+ long size() const;
+
+ /**
+ * Returns the filename.
+ *
+ * @return the filename.
+ */
+ const char* getName() const;
+
+ /**
+ * Flush the buffer.
+ *
+ * @return 0 if successful.
+ */
+ int flush() const;
+
+private:
+ STATIC_CONST( MAX_FILE_NAME_SIZE = 128 );
+
+ FILE* m_file;
+ char m_fileName[MAX_FILE_NAME_SIZE];
+ const char* m_fileMode;
+ /* Prohibit */
+ File(const File& aCopy);
+ File operator = (const File&);
+ bool operator == (const File&);
+};
+#endif
+
diff --git a/ndb/include/util/InputStream.hpp b/ndb/include/util/InputStream.hpp
new file mode 100644
index 00000000000..6b4cf262db4
--- /dev/null
+++ b/ndb/include/util/InputStream.hpp
@@ -0,0 +1,48 @@
+/* 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 INPUT_STREAM_HPP
+#define INPUT_STREAM_HPP
+
+#include <stdio.h>
+#include <NdbTCP.h>
+
+/**
+ * Input stream
+ */
+class InputStream {
+public:
+ virtual char* gets(char * buf, int bufLen) = 0;
+};
+
+class FileInputStream : public InputStream {
+ FILE * f;
+public:
+ FileInputStream(FILE * file = stdin);
+ char* gets(char * buf, int bufLen);
+};
+
+extern FileInputStream Stdin;
+
+class SocketInputStream : public InputStream {
+ NDB_SOCKET_TYPE m_socket;
+ unsigned m_timeout;
+public:
+ SocketInputStream(NDB_SOCKET_TYPE socket, unsigned readTimeout = 1000);
+ char* gets(char * buf, int bufLen);
+};
+
+#endif
diff --git a/ndb/include/util/NdbAutoPtr.hpp b/ndb/include/util/NdbAutoPtr.hpp
new file mode 100644
index 00000000000..2078714d98d
--- /dev/null
+++ b/ndb/include/util/NdbAutoPtr.hpp
@@ -0,0 +1,49 @@
+/* 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 __NDB_AUTO_PTR_HPP
+#define __NDB_AUTO_PTR_HPP
+
+#include <stdlib.h>
+
+template<typename T>
+class NdbAutoPtr {
+ T * m_obj;
+public:
+ NdbAutoPtr(T * obj = 0){ m_obj = obj;}
+ void reset(T * obj = 0) { if (m_obj) free(m_obj); m_obj = obj; }
+ ~NdbAutoPtr() { if (m_obj) free(m_obj);}
+};
+
+template<typename T>
+class NdbAutoObjPtr {
+ T * m_obj;
+public:
+ NdbAutoObjPtr(T * obj = 0){ m_obj = obj;}
+ void reset(T * obj = 0) { if (m_obj) delete m_obj; m_obj = obj; }
+ ~NdbAutoObjPtr() { if (m_obj) delete m_obj;}
+};
+
+template<typename T>
+class NdbAutoObjArrayPtr {
+ T * m_obj;
+public:
+ NdbAutoObjArrayPtr(T * obj = 0){ m_obj = obj;}
+ void reset(T * obj = 0) { if (m_obj) delete[] m_obj; m_obj = obj; }
+ ~NdbAutoObjArrayPtr() { if (m_obj) delete[] m_obj;}
+};
+
+#endif
diff --git a/ndb/include/util/NdbOut.hpp b/ndb/include/util/NdbOut.hpp
new file mode 100644
index 00000000000..d85d5cc6305
--- /dev/null
+++ b/ndb/include/util/NdbOut.hpp
@@ -0,0 +1,132 @@
+/* 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 NDBOUT_H
+#define NDBOUT_H
+
+#ifdef __cplusplus
+
+#include <ndb_types.h>
+#include <util/BaseString.hpp>
+
+/**
+ * Class used for outputting logging messages to screen.
+ * Since the output capabilities are different on different platforms
+ * this middle layer class should be used for all output messages
+ */
+
+/*
+ Example usage:
+
+ #include "NdbOut.hpp"
+
+ / * Use ndbout as you would use cout:
+
+ ndbout << "Hello World! "<< 1 << " Hello again"
+ << 67 << anIntegerVar << "Hup << endl;
+
+
+ / * Use ndbout_c as you would use printf:
+
+ ndbout_c("Hello World %d\n", 1);
+*/
+
+class NdbOut;
+class OutputStream;
+class NullOutputStream;
+
+/* Declare a static variable of NdbOut as ndbout */
+extern NdbOut ndbout;
+
+class NdbOut
+{
+public:
+ NdbOut& operator<<(NdbOut& (* _f)(NdbOut&));
+ NdbOut& operator<<(Int8);
+ NdbOut& operator<<(Uint8);
+ NdbOut& operator<<(Int16);
+ NdbOut& operator<<(Uint16);
+ NdbOut& operator<<(Int32);
+ NdbOut& operator<<(Uint32);
+ NdbOut& operator<<(Int64);
+ NdbOut& operator<<(Uint64);
+ NdbOut& operator<<(long unsigned int);
+ NdbOut& operator<<(const char*);
+ NdbOut& operator<<(const unsigned char*);
+ NdbOut& operator<<(BaseString &);
+ NdbOut& operator<<(const void*);
+ NdbOut& operator<<(float);
+ NdbOut& operator<<(double);
+ NdbOut& endline(void);
+ NdbOut& flushline(void);
+ NdbOut& setHexFormat(int _format);
+
+ NdbOut(OutputStream &);
+ virtual ~NdbOut();
+
+ void print(const char * fmt, ...);
+ void println(const char * fmt, ...);
+
+ OutputStream * m_out;
+private:
+ int isHex;
+};
+
+inline NdbOut& NdbOut::operator<<(NdbOut& (* _f)(NdbOut&)) {
+ (* _f)(*this);
+ return * this;
+}
+
+inline NdbOut& endl(NdbOut& _NdbOut) {
+ return _NdbOut.endline();
+}
+
+inline NdbOut& flush(NdbOut& _NdbOut) {
+ return _NdbOut.flushline();
+}
+
+inline NdbOut& hex(NdbOut& _NdbOut) {
+ return _NdbOut.setHexFormat(1);
+}
+
+inline NdbOut& dec(NdbOut& _NdbOut) {
+ return _NdbOut.setHexFormat(0);
+}
+extern "C"
+void ndbout_c(const char * fmt, ...);
+
+class FilteredNdbOut : public NdbOut {
+public:
+ FilteredNdbOut(OutputStream &, int threshold = 0, int level = 0);
+ virtual ~FilteredNdbOut();
+
+ void setLevel(int i);
+ void setThreshold(int i);
+
+ int getLevel() const;
+ int getThreshold() const;
+
+private:
+ int m_threshold, m_level;
+ OutputStream * m_org;
+ NullOutputStream * m_null;
+};
+
+#else
+void ndbout_c(const char * fmt, ...);
+#endif
+
+#endif
diff --git a/ndb/include/util/NdbSqlUtil.hpp b/ndb/include/util/NdbSqlUtil.hpp
new file mode 100644
index 00000000000..bb573eea17b
--- /dev/null
+++ b/ndb/include/util/NdbSqlUtil.hpp
@@ -0,0 +1,357 @@
+/* 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 NDB_SQL_UTIL_HPP
+#define NDB_SQL_UTIL_HPP
+
+#include <string.h>
+#include <ndb_types.h>
+
+class NdbSqlUtil {
+public:
+ /**
+ * Compare strings, optionally with padded semantics. Returns
+ * negative (less), zero (equal), or positive (greater).
+ */
+ static int char_compare(const char* s1, unsigned n1,
+ const char* s2, unsigned n2, bool padded);
+
+ /**
+ * Like operator, optionally with padded semantics. Returns true or
+ * false.
+ */
+ static bool char_like(const char* s1, unsigned n1,
+ const char* s2, unsigned n2, bool padded);
+
+ /**
+ * Compare kernel attribute values. Returns -1, 0, +1 for less,
+ * equal, greater, respectively. Parameters are pointers to values,
+ * full attribute size in words, and size of available data in words.
+ * There are 2 special return values to check first. All values fit
+ * into a signed char.
+ */
+ typedef int Cmp(const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size);
+
+ enum CmpResult {
+ CmpLess = -1,
+ CmpEqual = 0,
+ CmpGreater = 1,
+ CmpUnknown = 126, // insufficient partial data
+ CmpError = 127 // bad data format or unimplemented comparison
+ };
+
+ /**
+ * Kernel data types. Must match m_typeList in NdbSqlUtil.cpp.
+ */
+ struct Type {
+ enum Enum {
+ Undefined = 0, // Undefined
+ Tinyint, // 8 bit
+ Tinyunsigned, // 8 bit
+ Smallint, // 16 bit
+ Smallunsigned, // 16 bit
+ Mediumint, // 24 bit
+ Mediumunsigned, // 24 bit
+ Int, // 32 bit
+ Unsigned, // 32 bit
+ Bigint, // 64 bit
+ Bigunsigned, // 64 Bit
+ Float, // 32-bit float
+ Double, // 64-bit float
+ Decimal, // Precision, Scale
+ Char, // Len
+ Varchar, // Max len
+ Binary, // Len
+ Varbinary, // Max len
+ Datetime, // Precision down to 1 sec (size 8 bytes)
+ Timespec // Precision down to 1 nsec (size 12 bytes)
+ };
+ Enum m_typeId;
+ Cmp* m_cmp; // set to NULL if cmp not implemented
+ };
+
+ /**
+ * Get type by id. Can return the Undefined type.
+ */
+ static const Type& type(Uint32 typeId);
+
+ /**
+ * Inline comparison method. Most or all real methods Type::m_cmp are
+ * implemented via this (trusting dead code elimination).
+ */
+ static int cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size);
+
+private:
+ /**
+ * List of all types. Must match Type::Enum.
+ */
+ static const Type m_typeList[];
+ /**
+ * Comparison methods.
+ */
+ static Cmp cmpTinyint;
+ static Cmp cmpTinyunsigned;
+ static Cmp cmpSmallint;
+ static Cmp cmpSmallunsigned;
+ static Cmp cmpMediumint;
+ static Cmp cmpMediumunsigned;
+ static Cmp cmpInt;
+ static Cmp cmpUnsigned;
+ static Cmp cmpBigint;
+ static Cmp cmpBigunsigned;
+ static Cmp cmpFloat;
+ static Cmp cmpDouble;
+ static Cmp cmpDecimal;
+ static Cmp cmpChar;
+ static Cmp cmpVarchar;
+ static Cmp cmpBinary;
+ static Cmp cmpVarbinary;
+ static Cmp cmpDatetime;
+ static Cmp cmpTimespec;
+};
+
+inline int
+NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size)
+{
+ if (size > full)
+ return CmpError;
+ switch ((Type::Enum)typeId) {
+ case Type::Undefined:
+ break;
+ case Type::Tinyint:
+ {
+ if (size >= 1) {
+ union { Uint32 p[1]; Int8 v; } u1, u2;
+ u1.p[0] = p1[0];
+ u2.p[0] = p2[0];
+ if (u1.v < u2.v)
+ return -1;
+ if (u1.v > u2.v)
+ return +1;
+ return 0;
+ }
+ return CmpUnknown;
+ }
+ break;
+ case Type::Tinyunsigned:
+ {
+ if (size >= 1) {
+ union { Uint32 p[1]; Uint8 v; } u1, u2;
+ u1.p[0] = p1[0];
+ u2.p[0] = p2[0];
+ if (u1.v < u2.v)
+ return -1;
+ if (u1.v > u2.v)
+ return +1;
+ return 0;
+ }
+ return CmpUnknown;
+ }
+ break;
+ case Type::Smallint:
+ {
+ if (size >= 1) {
+ union { Uint32 p[1]; Int16 v; } u1, u2;
+ u1.p[0] = p1[0];
+ u2.p[0] = p2[0];
+ if (u1.v < u2.v)
+ return -1;
+ if (u1.v > u2.v)
+ return +1;
+ return 0;
+ }
+ return CmpUnknown;
+ }
+ break;
+ case Type::Smallunsigned:
+ {
+ if (size >= 1) {
+ union { Uint32 p[1]; Uint16 v; } u1, u2;
+ u1.p[0] = p1[0];
+ u2.p[0] = p2[0];
+ if (u1.v < u2.v)
+ return -1;
+ if (u1.v > u2.v)
+ return +1;
+ return 0;
+ }
+ return CmpUnknown;
+ }
+ break;
+ case Type::Mediumint: // XXX fix these
+ break;
+ case Type::Mediumunsigned:
+ break;
+ case Type::Int:
+ {
+ if (size >= 1) {
+ union { Uint32 p[1]; Int32 v; } u1, u2;
+ u1.p[0] = p1[0];
+ u2.p[0] = p2[0];
+ if (u1.v < u2.v)
+ return -1;
+ if (u1.v > u2.v)
+ return +1;
+ return 0;
+ }
+ return CmpUnknown;
+ }
+ break;
+ case Type::Unsigned:
+ {
+ if (size >= 1) {
+ union { Uint32 p[1]; Uint32 v; } u1, u2;
+ u1.v = p1[0];
+ u2.v = p2[0];
+ if (u1.v < u2.v)
+ return -1;
+ if (u1.v > u2.v)
+ return +1;
+ return 0;
+ }
+ return CmpUnknown;
+ }
+ break;
+ case Type::Bigint:
+ {
+ if (size >= 2) {
+ union { Uint32 p[2]; Int64 v; } u1, u2;
+ u1.p[0] = p1[0];
+ u1.p[1] = p1[1];
+ u2.p[0] = p2[0];
+ u2.p[1] = p2[1];
+ if (u1.v < u2.v)
+ return -1;
+ if (u1.v > u2.v)
+ return +1;
+ return 0;
+ }
+ return CmpUnknown;
+ }
+ break;
+ case Type::Bigunsigned:
+ {
+ if (size >= 2) {
+ union { Uint32 p[2]; Uint64 v; } u1, u2;
+ u1.p[0] = p1[0];
+ u1.p[1] = p1[1];
+ u2.p[0] = p2[0];
+ u2.p[1] = p2[1];
+ if (u1.v < u2.v)
+ return -1;
+ if (u1.v > u2.v)
+ return +1;
+ return 0;
+ }
+ return CmpUnknown;
+ }
+ break;
+ case Type::Float:
+ {
+ if (size >= 1) {
+ union { Uint32 p[1]; float v; } u1, u2;
+ u1.p[0] = p1[0];
+ u2.p[0] = p2[0];
+ if (u1.v < u2.v)
+ return -1;
+ if (u1.v > u2.v)
+ return +1;
+ return 0;
+ }
+ return CmpUnknown;
+ }
+ break;
+ case Type::Double:
+ {
+ if (size >= 2) {
+ union { Uint32 p[2]; double v; } u1, u2;
+ u1.p[0] = p1[0];
+ u1.p[1] = p1[1];
+ u2.p[0] = p2[0];
+ u2.p[1] = p2[1];
+ if (u1.v < u2.v)
+ return -1;
+ if (u1.v > u2.v)
+ return +1;
+ return 0;
+ }
+ return CmpUnknown;
+ }
+ break;
+ case Type::Decimal:
+ break;
+ case Type::Char:
+ {
+ /*
+ * Char is blank-padded to length and null-padded to word size.
+ * There is no terminator so we must compare the full values.
+ */
+ union { const Uint32* p; const char* v; } u1, u2;
+ u1.p = p1;
+ u2.p = p2;
+ int k = memcmp(u1.v, u2.v, size << 2);
+ return k < 0 ? -1 : k > 0 ? +1 : full == size ? 0 : CmpUnknown;
+ }
+ break;
+ case Type::Varchar:
+ {
+ /*
+ * Varchar is not allowed to contain a null byte and the stored
+ * value is null-padded. Therefore comparison does not need to
+ * use the length.
+ */
+ if (size >= 1) {
+ union { const Uint32* p; const char* v; } u1, u2;
+ u1.p = p1;
+ u2.p = p2;
+ // length in first 2 bytes
+ int k = strncmp(u1.v + 2, u2.v + 2, (size << 2) - 2);
+ return k < 0 ? -1 : k > 0 ? +1 : full == size ? 0 : CmpUnknown;
+ }
+ return CmpUnknown;
+ }
+ break;
+ case Type::Binary: // XXX fix these
+ break;
+ case Type::Varbinary:
+ break;
+ case Type::Datetime:
+ {
+ /*
+ * Datetime is CC YY MM DD hh mm ss \0
+ */
+ if (size >= 1) {
+ union { const Uint32* p; const char* v; } u1, u2;
+ u1.p = p1;
+ u2.p = p2;
+ // skip format check
+ int k = strncmp(u1.v, u2.v, 4);
+ if (k != 0)
+ return k;
+ if (size >= 2) {
+ return strncmp(u1.v + 4, u2.v + 4, 4);
+ }
+ }
+ return CmpUnknown;
+ }
+ break;
+ case Type::Timespec: // XXX fix this
+ break;
+ }
+ return CmpError;
+}
+
+#endif
diff --git a/ndb/include/util/NdbString.h b/ndb/include/util/NdbString.h
new file mode 100644
index 00000000000..97646f813ac
--- /dev/null
+++ b/ndb/include/util/NdbString.h
@@ -0,0 +1,48 @@
+/* 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 __NDBSTRING_H_INCLUDED__
+#define __NDBSTRING_H_INCLUDED__
+
+#include <sys/types.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef HAVE_STRDUP
+extern char * strdup(const char *s);
+#endif
+
+#ifndef HAVE_STRLCPY
+extern size_t strlcpy (char *dst, const char *src, size_t dst_sz);
+#endif
+
+#ifndef HAVE_STRLCAT
+extern size_t strlcat (char *dst, const char *src, size_t dst_sz);
+#endif
+
+#ifndef HAVE_STRCASECMP
+extern int strcasecmp(const char *s1, const char *s2);
+extern int strncasecmp(const char *s1, const char *s2, size_t n);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !__NDBSTRING_H_INCLUDED__ */
diff --git a/ndb/include/util/OutputStream.hpp b/ndb/include/util/OutputStream.hpp
new file mode 100644
index 00000000000..9d33ead7eb9
--- /dev/null
+++ b/ndb/include/util/OutputStream.hpp
@@ -0,0 +1,67 @@
+/* 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 OUTPUT_STREAM_HPP
+#define OUTPUT_STREAM_HPP
+
+#include <stdio.h>
+#include <NdbTCP.h>
+
+/**
+ * Output stream
+ */
+class OutputStream {
+public:
+ virtual int print(const char * fmt, ...) = 0;
+ virtual int println(const char * fmt, ...) = 0;
+ virtual void flush() {};
+};
+
+class FileOutputStream : public OutputStream {
+ FILE * f;
+public:
+ FileOutputStream(FILE * file = stdout);
+
+ int print(const char * fmt, ...);
+ int println(const char * fmt, ...);
+ void flush() { fflush(f); }
+};
+
+class SocketOutputStream : public OutputStream {
+ NDB_SOCKET_TYPE m_socket;
+ unsigned m_timeout;
+public:
+ SocketOutputStream(NDB_SOCKET_TYPE socket, unsigned writeTimeout = 1000);
+
+ int print(const char * fmt, ...);
+ int println(const char * fmt, ...);
+};
+
+class SoftOseOutputStream : public OutputStream {
+public:
+ SoftOseOutputStream();
+
+ int print(const char * fmt, ...);
+ int println(const char * fmt, ...);
+};
+
+class NullOutputStream : public OutputStream {
+public:
+ int print(const char * /* unused */, ...) { return 1;}
+ int println(const char * /* unused */, ...) { return 1;}
+};
+
+#endif
diff --git a/ndb/include/util/Parser.hpp b/ndb/include/util/Parser.hpp
new file mode 100644
index 00000000000..9c2f02b6024
--- /dev/null
+++ b/ndb/include/util/Parser.hpp
@@ -0,0 +1,290 @@
+/* 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 CPCD_PARSER_HPP
+#define CPCD_PARSER_HPP
+
+#include "Vector.hpp"
+#include "Properties.hpp"
+#include "InputStream.hpp"
+#include "NdbOut.hpp"
+
+class ParserImpl;
+template<class T> class ParserRow;
+
+//#define PARSER_DEBUG
+#ifdef PARSER_DEBUG
+#define DEBUG(x) \
+ ndbout_c("%s:%d:%s", __FILE__, __LINE__, x);
+#else
+#define DEBUG(x)
+#endif
+
+/**
+ * A generic parser
+ */
+template<class T>
+class Parser {
+public:
+ /**
+ * Status for parser
+ */
+ enum ParserStatus {
+ Ok = 0,
+ Eof = 1,
+ NoLine = 2,
+ EmptyLine = 3,
+ UnknownCommand = 4,
+ UnknownArgument = 5,
+ TypeMismatch = 6,
+ InvalidArgumentFormat = 7,
+ UnknownArgumentType = 8,
+ CommandWithoutFunction = 9,
+ ArgumentGivenTwice = 10,
+ ExternalStop = 11,
+ MissingMandatoryArgument = 12
+ };
+
+ /**
+ * Context for parse
+ */
+ struct Context {
+ ParserStatus m_status;
+ const ParserRow<T> * m_currentCmd;
+ const ParserRow<T> * m_currentArg;
+ char * m_currentToken;
+ char m_tokenBuffer[512];
+
+ Vector<const ParserRow<T> *> m_aliasUsed;
+ };
+
+ /**
+ * Initialize parser
+ */
+ Parser(const ParserRow<T> rows[], class InputStream & in = Stdin,
+ bool breakOnCommand = false,
+ bool breakOnEmptyLine = true,
+ bool breakOnInvalidArg = false);
+ ~Parser();
+
+ /**
+ * Run parser
+ */
+ bool run(Context &, T &, volatile bool * stop = 0) const;
+
+ /**
+ * Parse only one entry and return Properties object representing
+ * the message
+ */
+ const Properties *parse(Context &, T &);
+
+ bool getBreakOnCommand() const;
+ void setBreakOnCommand(bool v);
+
+ bool getBreakOnEmptyLine() const;
+ void setBreakOnEmptyLine(bool v);
+
+ bool getBreakOnInvalidArg() const;
+ void setBreakOnInvalidArg(bool v);
+
+private:
+ ParserImpl * impl;
+};
+
+template<class T>
+struct ParserRow {
+public:
+ enum Type { Cmd, Arg, CmdAlias, ArgAlias };
+ enum ArgType { String, Int, Properties };
+ enum ArgRequired { Mandatory, Optional };
+ enum ArgMinMax { CheckMinMax, IgnoreMinMax };
+
+ const char * name;
+ const char * realName;
+ Type type;
+ ArgType argType;
+ ArgRequired argRequired;
+ ArgMinMax argMinMax;
+ int minVal;
+ int maxVal;
+ void (T::* function)(typename Parser<T>::Context & ctx,
+ const class Properties& args);
+ const char * description;
+ void *user_value;
+};
+
+/**
+ * The void* equivalent implementation
+ */
+class ParserImpl {
+ class Dummy {};
+ typedef ParserRow<Dummy> DummyRow;
+ typedef Parser<Dummy>::Context Context;
+ template<class T> friend class Parser;
+private:
+
+ ParserImpl(const DummyRow rows[], class InputStream & in,
+ bool b_cmd, bool b_empty, bool b_iarg);
+ ~ParserImpl();
+
+ bool run(Context *ctx, const class Properties **, volatile bool *) const ;
+
+ static const DummyRow* matchCommand(Context*, const char*, const DummyRow*);
+ static const DummyRow* matchArg(Context*, const char *, const DummyRow *);
+ static bool parseArg(Context*, char*, const DummyRow*, Properties*);
+ static bool checkMandatory(Context*, const Properties*);
+private:
+ const DummyRow * const m_rows;
+ class ParseInputStream & input;
+ bool m_breakOnEmpty;
+ bool m_breakOnCmd;
+ bool m_breakOnInvalidArg;
+};
+
+template<class T>
+inline
+Parser<T>::Parser(const ParserRow<T> rows[], class InputStream & in,
+ bool b_cmd, bool b_empty, bool b_iarg){
+ impl = new ParserImpl((ParserImpl::DummyRow *)rows, in,
+ b_cmd, b_empty, b_iarg);
+}
+
+template<class T>
+inline
+Parser<T>::~Parser(){
+}
+
+template<class T>
+inline
+bool
+Parser<T>::run(Context & ctx, T & t, volatile bool * stop) const {
+ const Properties * p;
+ DEBUG("Executing Parser<T>::run");
+ if(impl->run((ParserImpl::Context*)&ctx, &p, stop)){
+ const ParserRow<T> * cmd = ctx.m_currentCmd; // Cast to correct type
+ if(cmd == 0){
+ /**
+ * Should happen if run returns true
+ */
+ abort();
+ }
+
+ for(unsigned i = 0; i<ctx.m_aliasUsed.size(); i++){
+ const ParserRow<T> * alias = ctx.m_aliasUsed[i];
+ if(alias->function != 0){
+ /**
+ * Report alias usage with callback (if specified by user)
+ */
+ DEBUG("Alias usage with callback");
+ (t.* alias->function)(ctx, * p);
+ }
+ }
+
+ if(cmd->function == 0){
+ ctx.m_status = CommandWithoutFunction;
+ DEBUG("CommandWithoutFunction");
+ delete p;
+ return false;
+ }
+ (t.* cmd->function)(ctx, * p); // Call the function
+ delete p;
+ return true;
+ }
+ DEBUG("");
+ return false;
+}
+
+template<class T>
+inline
+const Properties *
+Parser<T>::parse(Context &ctx, T &t) {
+ const Properties * p;
+ volatile bool stop = false;
+ DEBUG("Executing Parser<T>::parse");
+
+ if(impl->run((ParserImpl::Context*)&ctx, &p, &stop)){
+ const ParserRow<T> * cmd = ctx.m_currentCmd; // Cast to correct type
+ if(cmd == 0){
+ /**
+ * Should happen if run returns true
+ */
+ abort();
+ }
+
+ for(unsigned i = 0; i<ctx.m_aliasUsed.size(); i++){
+ const ParserRow<T> * alias = ctx.m_aliasUsed[i];
+ if(alias->function != 0){
+ /**
+ * Report alias usage with callback (if specified by user)
+ */
+ DEBUG("Alias usage with callback");
+ (t.* alias->function)(ctx, * p);
+ }
+ }
+
+ if(cmd->function == 0){
+ DEBUG("CommandWithoutFunction");
+ ctx.m_status = CommandWithoutFunction;
+ return p;
+ }
+ return p;
+ }
+ DEBUG("");
+ return NULL;
+}
+
+template<class T>
+inline
+bool
+Parser<T>::getBreakOnCommand() const{
+ return impl->m_breakOnCmd;
+}
+
+template<class T>
+inline
+void
+Parser<T>::setBreakOnCommand(bool v){
+ impl->m_breakOnCmd = v;
+}
+
+template<class T>
+inline
+bool
+Parser<T>::getBreakOnEmptyLine() const{
+ return impl->m_breakOnEmpty;
+}
+template<class T>
+inline
+void
+Parser<T>::setBreakOnEmptyLine(bool v){
+ impl->m_breakOnEmpty = v;
+}
+
+template<class T>
+inline
+bool
+Parser<T>::getBreakOnInvalidArg() const{
+ return impl->m_breakOnInvalidArg;
+}
+
+template<class T>
+inline
+void
+Parser<T>::setBreakOnInvalidArg(bool v){
+ impl->m_breakOnInvalidArg;
+}
+
+#endif
diff --git a/ndb/include/util/Properties.hpp b/ndb/include/util/Properties.hpp
new file mode 100644
index 00000000000..dbdc5f2b480
--- /dev/null
+++ b/ndb/include/util/Properties.hpp
@@ -0,0 +1,246 @@
+/* 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 PROPERTIES_HPP
+#define PROPERTIES_HPP
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ndb_types.h>
+#include <BaseString.hpp>
+#include <UtilBuffer.hpp>
+
+enum PropertiesType {
+ PropertiesType_Uint32,
+ PropertiesType_char,
+ PropertiesType_Properties
+};
+
+/**
+ * @struct Property
+ * @brief Stores one (name, value)-pair
+ *
+ * Value can be of type Properties, i.e. a Property may contain
+ * a Properties object.
+ */
+struct Property {
+ Property(const char* name, Uint32 val);
+ Property(const char* name, const char * value);
+ Property(const char* name, const class Properties * value);
+ ~Property();
+private:
+ friend class Properties;
+ struct PropertyImpl * impl;
+};
+
+/**
+ * @class Properties
+ * @brief Stores information in (name, value)-pairs
+ */
+class Properties {
+public:
+ static const char delimiter = ':';
+ static const char version[];
+
+ Properties();
+ Properties(const Properties &);
+ Properties(const Property *, int len);
+ virtual ~Properties();
+
+ /**
+ * Set/Get wheather names in the Properties should be compared
+ * w/o case.
+ * NOTE: The property is automatically applied to all propoerties put
+ * into this after a called to setCaseInsensitiveNames has been made
+ * But properties already in when calling setCaseInsensitiveNames will
+ * not be affected
+ */
+ void setCaseInsensitiveNames(bool value);
+ bool getCaseInsensitiveNames() const;
+
+ /**
+ * Insert an array of value(s)
+ */
+ void put(const Property *, int len);
+
+ bool put(const char * name, Uint32 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);
+
+ /**
+ * Same as put above,
+ * except that _%d (where %d is a number) is added to the name
+ * Compare get(name, no)
+ */
+ bool put(const char *, Uint32 no, Uint32, bool replace = false);
+ bool put(const char *, Uint32 no, const char *, bool replace = false);
+ bool put(const char *, Uint32 no, const Properties *, bool replace = false);
+
+
+ bool getTypeOf(const char * name, PropertiesType * type) const;
+
+ /** @return true if Properties object contains name */
+ bool contains(const char * name) const;
+
+ bool get(const char * name, Uint32 * 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;
+
+ bool getCopy(const char * name, char ** value) const;
+ bool getCopy(const char * name, Properties ** value) const;
+
+ /**
+ * Same as get above
+ * except that _%d (where %d = no) is added to the name
+ */
+ bool getTypeOf(const char * name, Uint32 no, PropertiesType * type) const;
+ bool contains(const char * name, Uint32 no) const;
+
+ bool get(const char * name, Uint32 no, Uint32 * value) const;
+ bool get(const char * name, Uint32 no, const char ** value) const;
+ bool get(const char * name, Uint32 no, const Properties ** value) const;
+
+ bool getCopy(const char * name, Uint32 no, char ** value) const;
+ bool getCopy(const char * name, Uint32 no, Properties ** value) const;
+
+ void clear();
+
+ void remove(const char * name);
+
+ void print(FILE * file = stdout, const char * prefix = 0) const;
+ /**
+ * Iterator over names
+ */
+ class Iterator {
+ public:
+ Iterator(const Properties* prop);
+
+ const char* first();
+ const char* next();
+ private:
+ const Properties* m_prop;
+ Uint32 m_iterator;
+ };
+ friend class Properties::Iterator;
+
+ Uint32 getPackedSize() const;
+ bool pack(Uint32 * buf) const;
+ bool pack(UtilBuffer &buf) const;
+ bool unpack(const Uint32 * buf, Uint32 bufLen);
+ bool unpack(UtilBuffer &buf);
+
+ Uint32 getPropertiesErrno() const { return propErrno; }
+ Uint32 getOSErrno() const { return osErrno; }
+private:
+ Uint32 propErrno;
+ Uint32 osErrno;
+
+ friend class PropertiesImpl;
+ class PropertiesImpl * impl;
+ class Properties * parent;
+
+ void setErrno(Uint32 pErr, Uint32 osErr = 0) const ;
+};
+
+/**
+ * Error code for properties
+ */
+
+/**
+ * No error
+ */
+extern const Uint32 E_PROPERTIES_OK;
+
+/**
+ * Invalid name in put, names can not contain Properties::delimiter
+ */
+extern const Uint32 E_PROPERTIES_INVALID_NAME;
+
+/**
+ * Element did not exist when using get
+ */
+extern const Uint32 E_PROPERTIES_NO_SUCH_ELEMENT;
+
+/**
+ * Element had wrong type when using get
+ */
+extern const Uint32 E_PROPERTIES_INVALID_TYPE;
+
+/**
+ * Element already existed when using put, and replace was not specified
+ */
+extern const Uint32 E_PROPERTIES_ELEMENT_ALREADY_EXISTS;
+
+/**
+ * Invalid version on properties file you are trying to read
+ */
+extern const Uint32 E_PROPERTIES_INVALID_VERSION_WHILE_UNPACKING;
+
+/**
+ * When unpacking an buffer
+ * found that buffer is to short
+ *
+ * Probably an invlaid buffer
+ */
+extern const Uint32 E_PROPERTIES_INVALID_BUFFER_TO_SHORT;
+
+/**
+ * Error when packing, can not allocate working buffer
+ *
+ * Note: OS error is set
+ */
+extern const Uint32 E_PROPERTIES_ERROR_MALLOC_WHILE_PACKING;
+
+/**
+ * Error when unpacking, can not allocate working buffer
+ *
+ * Note: OS error is set
+ */
+extern const Uint32 E_PROPERTIES_ERROR_MALLOC_WHILE_UNPACKING;
+
+/**
+ * Error when unpacking, invalid checksum
+ *
+ */
+extern const Uint32 E_PROPERTIES_INVALID_CHECKSUM;
+
+/**
+ * Error when unpacking
+ * No of items > 0 while size of buffer (left) <= 0
+ */
+extern const Uint32 E_PROPERTIES_BUFFER_TO_SMALL_WHILE_UNPACKING;
+
+inline bool
+Properties::unpack(UtilBuffer &buf) {
+ return unpack((const Uint32 *)buf.get_data(), buf.length());
+}
+
+inline bool
+Properties::pack(UtilBuffer &buf) const {
+ Uint32 size = getPackedSize();
+ char *tmp_buf = new char[size];
+ bool ret = pack((Uint32 *)tmp_buf);
+ if(ret == false)
+ return false;
+ buf.append(tmp_buf, size);
+ return true;
+}
+
+
+
+#endif
diff --git a/ndb/include/util/SimpleProperties.hpp b/ndb/include/util/SimpleProperties.hpp
new file mode 100644
index 00000000000..37e28ea91d8
--- /dev/null
+++ b/ndb/include/util/SimpleProperties.hpp
@@ -0,0 +1,290 @@
+/* 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 SIMPLE_PROPERTIES_HPP
+#define SIMPLE_PROPERTIES_HPP
+
+#include <ndb_types.h>
+#include <stddef.h> // offsetof
+#include <NdbOut.hpp>
+
+/**
+ * @class SimpleProperties
+ * @brief Key-value-pair container. Actully a list of named elements.
+ *
+ * SimpleProperties:
+ * - The keys are Uint16
+ * - The values are either Uint32 or null terminated c-strings
+ *
+ * @note Keys may be repeated.
+ *
+ * Examples of things that can be stored in a SimpleProperties object:
+ * - Lists like: ((1, "foo"), (2, "bar"), (3, 32), (2, "baz"))
+ */
+class SimpleProperties {
+public:
+ /**
+ * Value types
+ */
+ enum ValueType {
+ Uint32Value = 0,
+ StringValue = 1,
+ BinaryValue = 2,
+ InvalidValue = 3
+ };
+
+ /**
+ * Struct for defining mapping to be used with unpack
+ */
+ struct SP2StructMapping {
+ Uint16 Key;
+ Uint32 Offset;
+ SimpleProperties::ValueType Type;
+ Uint32 minValue;
+ Uint32 maxValue;
+ Uint32 Length_Offset; // Offset used for looking up length of
+ // data if Type = BinaryValue
+ };
+
+ /**
+ * UnpackStatus - Value returned from unpack
+ */
+ enum UnpackStatus {
+ Eof = 0, // Success, end of SimpleProperties object reached
+ Break = 1, // Success
+ TypeMismatch = 2,
+ ValueTooLow = 3,
+ ValueTooHigh = 4,
+ UnknownKey = 5,
+ OutOfMemory = 6 // Only used when packing
+ };
+
+ /**
+ * Unpack
+ */
+ class Reader;
+ static UnpackStatus unpack(class Reader & it,
+ void * dst,
+ const SP2StructMapping[], Uint32 mapSz,
+ bool ignoreMinMax,
+ bool ignoreUnknownKeys);
+
+ class Writer;
+ static UnpackStatus pack(class Writer &,
+ const void * src,
+ const SP2StructMapping[], Uint32 mapSz,
+ bool ignoreMinMax);
+
+ /**
+ * Reader class
+ */
+ class Reader {
+ public:
+ /**
+ * Move to first element
+ * Return true if element exist
+ */
+ bool first();
+
+ /**
+ * Move to next element
+ * Return true if element exist
+ */
+ bool next();
+
+ /**
+ * Is this valid
+ */
+ bool valid() const;
+
+ /**
+ * Get key
+ * Note only valid is valid() == true
+ */
+ Uint16 getKey() const;
+
+ /**
+ * Get value length in bytes - (including terminating 0 for strings)
+ * Note only valid is valid() == true
+ */
+ Uint16 getValueLen() const;
+
+ /**
+ * Get value type
+ * Note only valid is valid() == true
+ */
+ ValueType getValueType() const;
+
+ /**
+ * Get value
+ * Note only valid is valid() == true
+ */
+ Uint32 getUint32() const;
+ char * getString(char * dst) const;
+
+ /**
+ * Print the complete simple properties (for debugging)
+ */
+ void printAll(NdbOut& ndbout);
+
+ private:
+ bool readValue();
+
+ Uint16 m_key;
+ Uint16 m_itemLen;
+ union {
+ Uint32 m_ui32_value;
+ Uint32 m_strLen; // Including 0-byte in words
+ };
+ ValueType m_type;
+ protected:
+ Reader();
+ virtual void reset() = 0;
+
+ virtual bool step(Uint32 len) = 0;
+ virtual bool getWord(Uint32 * dst) = 0;
+ virtual bool peekWord(Uint32 * dst) const = 0;
+ virtual bool peekWords(Uint32 * dst, Uint32 len) const = 0;
+ };
+
+ /**
+ * Writer class
+ */
+ class Writer {
+ public:
+ bool first();
+ bool add(Uint16 key, Uint32 value);
+ bool add(Uint16 key, const char * value);
+ bool add(Uint16 key, const void* value, int len);
+ protected:
+ virtual bool reset() = 0;
+ virtual bool putWord(Uint32 val) = 0;
+ virtual bool putWords(const Uint32 * src, Uint32 len) = 0;
+ };
+};
+
+/**
+ * Reader for linear memory
+ */
+class SimplePropertiesLinearReader : public SimpleProperties::Reader {
+public:
+ SimplePropertiesLinearReader(const Uint32 * src, Uint32 len);
+
+ virtual void reset();
+ virtual bool step(Uint32 len);
+ virtual bool getWord(Uint32 * dst);
+ virtual bool peekWord(Uint32 * dst) const ;
+ virtual bool peekWords(Uint32 * dst, Uint32 len) const;
+private:
+ Uint32 m_len;
+ Uint32 m_pos;
+ const Uint32 * m_src;
+};
+
+/**
+ * Writer for linear memory
+ */
+class LinearWriter : public SimpleProperties::Writer {
+public:
+ LinearWriter(Uint32 * src, Uint32 len);
+
+ virtual bool reset();
+ virtual bool putWord(Uint32 val);
+ virtual bool putWords(const Uint32 * src, Uint32 len);
+ Uint32 getWordsUsed() const;
+private:
+ Uint32 m_len;
+ Uint32 m_pos;
+ Uint32 * m_src;
+};
+
+/**
+ * Writer for linear memory
+ */
+class UtilBufferWriter : public SimpleProperties::Writer {
+public:
+ UtilBufferWriter(class UtilBuffer & buf);
+
+ virtual bool reset();
+ virtual bool putWord(Uint32 val);
+ virtual bool putWords(const Uint32 * src, Uint32 len);
+ Uint32 getWordsUsed() const;
+private:
+ class UtilBuffer & m_buf;
+};
+
+/**
+ * Reader for long signal section memory
+ *
+ *
+ * Implemented in kernel/vm/SimplePropertiesSection.cpp
+ */
+class SimplePropertiesSectionReader : public SimpleProperties::Reader {
+public:
+ SimplePropertiesSectionReader(class SegmentedSectionPtr &,
+ class SectionSegmentPool &);
+
+ virtual void reset();
+ virtual bool step(Uint32 len);
+ virtual bool getWord(Uint32 * dst);
+ virtual bool peekWord(Uint32 * dst) const ;
+ virtual bool peekWords(Uint32 * dst, Uint32 len) const;
+ Uint32 getSize() const;
+ bool getWords(Uint32 * dst, Uint32 len);
+
+private:
+ Uint32 m_pos;
+ Uint32 m_len;
+ class SectionSegmentPool & m_pool;
+ class SectionSegment * m_head;
+ class SectionSegment * m_currentSegment;
+};
+
+inline
+Uint32 SimplePropertiesSectionReader::getSize() const
+{
+ return m_len;
+}
+
+/**
+ * Writer for long signal section memory
+ *
+ *
+ * Implemented in kernel/vm/SimplePropertiesSection.cpp
+ */
+class SimplePropertiesSectionWriter : public SimpleProperties::Writer {
+public:
+ SimplePropertiesSectionWriter(class SectionSegmentPool &);
+
+ virtual bool reset();
+ virtual bool putWord(Uint32 val);
+ virtual bool putWords(const Uint32 * src, Uint32 len);
+
+ /**
+ * This "unlinks" the writer from the memory
+ */
+ void getPtr(class SegmentedSectionPtr & dst);
+
+private:
+ Int32 m_pos;
+ Uint32 m_sz;
+ class SectionSegmentPool & m_pool;
+ class SectionSegment * m_head;
+ Uint32 m_prevPtrI; // Prev to m_currentSegment
+ class SectionSegment * m_currentSegment;
+};
+
+#endif
diff --git a/ndb/include/util/SocketServer.hpp b/ndb/include/util/SocketServer.hpp
new file mode 100644
index 00000000000..334fa575e47
--- /dev/null
+++ b/ndb/include/util/SocketServer.hpp
@@ -0,0 +1,131 @@
+/* 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 SOCKET_SERVER_HPP
+#define SOCKET_SERVER_HPP
+
+#include <NdbTCP.h>
+#include <NdbMutex.h>
+#include <NdbThread.h>
+#include <Vector.hpp>
+
+extern "C" void* sessionThread_C(void*);
+extern "C" void* socketServerThread_C(void*);
+
+/**
+ * Socket Server
+ */
+class SocketServer {
+public:
+ /**
+ * A Session
+ */
+ class Session {
+ public:
+ virtual ~Session() {}
+ virtual void runSession(){}
+ virtual void stopSession(){}
+ protected:
+ friend class SocketServer;
+ friend void* sessionThread_C(void*);
+ Session(NDB_SOCKET_TYPE sock): m_socket(sock){ m_stop = m_stopped = false;}
+
+ bool m_stop; // Has the session been ordered to stop?
+ bool m_stopped; // Has the session stopped?
+
+ NDB_SOCKET_TYPE m_socket;
+ };
+
+ /**
+ * A service i.e. a session factory
+ */
+ class Service {
+ public:
+ virtual ~Service(){}
+
+ /**
+ * Returned Session will be ran in own thread
+ *
+ * To manage threads self, just return NULL
+ */
+ virtual Session * newSession(NDB_SOCKET_TYPE theSock) = 0;
+ virtual void stopSessions(){}
+ };
+
+ /**
+ * Constructor / Destructor
+ */
+ SocketServer(int maxSessions = 32);
+ ~SocketServer();
+
+ /**
+ * Setup socket and bind it
+ * then close the socket
+ * Returns true if succeding in binding
+ */
+ bool tryBind(unsigned short port, const char * intface = 0) const;
+
+ /**
+ * Setup socket
+ * bind & listen
+ * Returns false if no success
+ */
+ bool setup(Service *, unsigned short port, const char * pinterface = 0);
+
+ /**
+ * start/stop the server
+ */
+ void startServer();
+ void stopServer();
+
+ /**
+ * stop sessions
+ *
+ * Note: Implies stopServer
+ */
+ void stopSessions(bool wait = false);
+
+private:
+ struct SessionInstance {
+ Service * m_service;
+ Session * m_session;
+ NdbThread * m_thread;
+ };
+ struct ServiceInstance {
+ Service * m_service;
+ NDB_SOCKET_TYPE m_socket;
+ };
+ MutexVector<SessionInstance> m_sessions;
+ MutexVector<ServiceInstance> m_services;
+ unsigned m_maxSessions;
+
+ void doAccept();
+ void checkSessions();
+ void startSession(SessionInstance &);
+
+ /**
+ * Note, this thread is only used when running interactive
+ *
+ */
+ bool m_stopThread;
+ struct NdbThread * m_thread;
+ NdbLockable m_threadLock;
+ void doRun();
+ friend void* socketServerThread_C(void*);
+ friend void* sessionThread_C(void*);
+};
+
+#endif
diff --git a/ndb/include/util/UtilBuffer.hpp b/ndb/include/util/UtilBuffer.hpp
new file mode 100644
index 00000000000..97821ee3f9b
--- /dev/null
+++ b/ndb/include/util/UtilBuffer.hpp
@@ -0,0 +1,90 @@
+/* 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 __BUFFER_HPP_INCLUDED__
+#define __BUFFER_HPP_INCLUDED__
+
+#include <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* This class represents a buffer of binary data, where you can append
+ * data at the end, and later read the entire bunch.
+ * It will take care of the hairy details of realloc()ing the space
+ * for you
+ */
+class UtilBuffer {
+public:
+ UtilBuffer() { data = NULL; len = 0; alloc_size = 0; };
+ ~UtilBuffer() { if(data) free(data); data = NULL; len = 0; alloc_size = 0; };
+
+
+ int reallocate(size_t newsize) {
+ if(newsize < len) {
+ errno = EINVAL;
+ return -1;
+ }
+ void *newdata;
+ if((newdata = realloc(data, newsize)) == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ alloc_size = newsize;
+ data = newdata;
+ return 0;
+ };
+
+ int grow(size_t l) {
+ if(l > alloc_size)
+ return reallocate(l);
+ return 0;
+ };
+
+ int append(const void *d, size_t l) {
+ int ret;
+ ret = grow(len+l);
+ if(ret != 0)
+ return ret;
+
+ memcpy((char *)data+len, d, l);
+ len+=l;
+
+ return 0;
+ };
+
+ int assign(const void * d, size_t l) {
+ if (data) free(data);
+ data = NULL;
+ len = 0;
+ alloc_size = 0;
+ return append(d, l);
+ }
+
+ void clear() {
+ len = 0;
+ }
+
+ int length() const { return len; };
+
+ void *get_data() const { return data; };
+private:
+ void *data; /* Pointer to data storage */
+ size_t len; /* Size of the stored data */
+ size_t alloc_size; /* Size of the allocated space,
+ * i.e. len can grow to this size */
+};
+
+#endif /* !__BUFFER_HPP_INCLUDED__ */
diff --git a/ndb/include/util/Vector.hpp b/ndb/include/util/Vector.hpp
new file mode 100644
index 00000000000..a717dfecd7e
--- /dev/null
+++ b/ndb/include/util/Vector.hpp
@@ -0,0 +1,289 @@
+/* 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 NDB_VECTOR_HPP
+#define NDB_VECTOR_HPP
+
+#include <stdlib.h>
+#include <NdbMutex.h>
+#include <string.h>
+
+template<class T>
+struct Vector {
+public:
+ Vector(int sz = 10);
+ ~Vector();
+
+ T& operator[](unsigned i);
+ const T& operator[](unsigned i) const;
+ unsigned size() const { return m_size; };
+
+ void push_back(const T &);
+ T& back();
+
+ void erase(unsigned index);
+
+ void clear();
+
+ void fill(unsigned new_size, T & obj);
+
+ Vector<T>& operator=(const Vector<T>&);
+
+ T* getBase() { return m_items;}
+ const T* getBase() const { return m_items;}
+private:
+ T * m_items;
+ unsigned m_size;
+ unsigned m_incSize;
+ unsigned m_arraySize;
+};
+
+template<class T>
+Vector<T>::Vector(int i){
+ m_items = new T[i];
+ m_size = 0;
+ m_arraySize = i;
+ m_incSize = 50;
+}
+
+template<class T>
+Vector<T>::~Vector(){
+ delete[] m_items;
+}
+
+template<class T>
+T &
+Vector<T>::operator[](unsigned i){
+ if(i >= m_size)
+ abort();
+ return m_items[i];
+}
+
+template<class T>
+const T &
+Vector<T>::operator[](unsigned i) const {
+ if(i >= m_size)
+ abort();
+ return m_items[i];
+}
+
+template<class T>
+T &
+Vector<T>::back(){
+ return (* this)[m_size - 1];
+}
+
+template<class T>
+void
+Vector<T>::push_back(const T & t){
+ if(m_size == m_arraySize){
+ T * tmp = new T [m_arraySize + m_incSize];
+ for (unsigned k = 0; k < m_size; k++)
+ tmp[k] = m_items[k];
+ delete[] m_items;
+ m_items = tmp;
+ m_arraySize = m_arraySize + m_incSize;
+ }
+ m_items[m_size] = t;
+ m_size++;
+}
+
+template<class T>
+void
+Vector<T>::erase(unsigned i){
+ if(i >= m_size)
+ abort();
+
+ for (unsigned k = i; k + 1 < m_size; k++)
+ m_items[k] = m_items[k + 1];
+ m_size--;
+}
+
+template<class T>
+void
+Vector<T>::clear(){
+ m_size = 0;
+}
+
+template<class T>
+void
+Vector<T>::fill(unsigned new_size, T & obj){
+ while(m_size <= new_size)
+ push_back(obj);
+}
+
+template<class T>
+Vector<T>&
+Vector<T>::operator=(const Vector<T>& obj){
+ if(this != &obj){
+ clear();
+ for(size_t i = 0; i<obj.size(); i++){
+ push_back(obj[i]);
+ }
+ }
+ return * this;
+}
+
+template<class T>
+struct MutexVector : public NdbLockable {
+ MutexVector(int sz = 10);
+ ~MutexVector();
+
+ T& operator[](unsigned i);
+ const T& operator[](unsigned i) const;
+ unsigned size() const { return m_size; };
+
+ void push_back(const T &);
+ void push_back(const T &, bool lockMutex);
+ T& back();
+
+ void erase(unsigned index);
+ void erase(unsigned index, bool lockMutex);
+
+ void clear();
+ void clear(bool lockMutex);
+
+ void fill(unsigned new_size, T & obj);
+private:
+ T * m_items;
+ unsigned m_size;
+ unsigned m_incSize;
+ unsigned m_arraySize;
+};
+
+template<class T>
+MutexVector<T>::MutexVector(int i){
+ m_items = new T[i];
+ m_size = 0;
+ m_arraySize = i;
+ m_incSize = 50;
+}
+
+template<class T>
+MutexVector<T>::~MutexVector(){
+ delete[] m_items;
+}
+
+template<class T>
+T &
+MutexVector<T>::operator[](unsigned i){
+ if(i >= m_size)
+ abort();
+ return m_items[i];
+}
+
+template<class T>
+const T &
+MutexVector<T>::operator[](unsigned i) const {
+ if(i >= m_size)
+ abort();
+ return m_items[i];
+}
+
+template<class T>
+T &
+MutexVector<T>::back(){
+ return (* this)[m_size - 1];
+}
+
+template<class T>
+void
+MutexVector<T>::push_back(const T & t){
+ lock();
+ if(m_size == m_arraySize){
+ T * tmp = new T [m_arraySize + m_incSize];
+ for (unsigned k = 0; k < m_size; k++)
+ tmp[k] = m_items[k];
+ delete[] m_items;
+ m_items = tmp;
+ m_arraySize = m_arraySize + m_incSize;
+ }
+ m_items[m_size] = t;
+ m_size++;
+ unlock();
+}
+
+template<class T>
+void
+MutexVector<T>::push_back(const T & t, bool lockMutex){
+ if(lockMutex)
+ lock();
+ if(m_size == m_arraySize){
+ T * tmp = new T [m_arraySize + m_incSize];
+ for (unsigned k = 0; k < m_size; k++)
+ tmp[k] = m_items[k];
+ delete[] m_items;
+ m_items = tmp;
+ m_arraySize = m_arraySize + m_incSize;
+ }
+ m_items[m_size] = t;
+ m_size++;
+ if(lockMutex)
+ unlock();
+}
+
+template<class T>
+void
+MutexVector<T>::erase(unsigned i){
+ if(i >= m_size)
+ abort();
+
+ lock();
+ for (unsigned k = i; k + 1 < m_size; k++)
+ m_items[k] = m_items[k + 1];
+ m_size--;
+ unlock();
+}
+
+template<class T>
+void
+MutexVector<T>::erase(unsigned i, bool _lock){
+ if(i >= m_size)
+ abort();
+
+ if(_lock)
+ lock();
+ for (unsigned k = i; k + 1 < m_size; k++)
+ m_items[k] = m_items[k + 1];
+ m_size--;
+ if(_lock)
+ unlock();
+}
+
+template<class T>
+void
+MutexVector<T>::clear(){
+ lock();
+ m_size = 0;
+ unlock();
+}
+
+template<class T>
+void
+MutexVector<T>::clear(bool l){
+ if(l) lock();
+ m_size = 0;
+ if(l) unlock();
+}
+
+template<class T>
+void
+MutexVector<T>::fill(unsigned new_size, T & obj){
+ while(m_size <= new_size)
+ push_back(obj);
+}
+
+#endif
diff --git a/ndb/include/util/getarg.h b/ndb/include/util/getarg.h
new file mode 100644
index 00000000000..713cf6e4b32
--- /dev/null
+++ b/ndb/include/util/getarg.h
@@ -0,0 +1,115 @@
+/* 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 */
+
+/*
+ * Copyright (c) 1997, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* $KTH: getarg.h,v 1.9 2000/09/01 21:25:55 lha Exp $ */
+
+#ifndef __GETARG_H__
+#define __GETARG_H__
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ arg_integer,
+ arg_string,
+ arg_flag,
+ arg_negative_flag,
+ arg_strings,
+ arg_double,
+ arg_collect,
+ arg_counter
+} arg_type;
+
+struct getargs{
+ const char *long_name;
+ char short_name;
+ arg_type type;
+ void *value;
+ const char *help;
+ const char *arg_help;
+};
+
+enum {
+ ARG_ERR_NO_MATCH = 1,
+ ARG_ERR_BAD_ARG,
+ ARG_ERR_NO_ARG
+};
+
+typedef struct getarg_strings {
+ int num_strings;
+ char **strings;
+} getarg_strings;
+
+typedef int (*getarg_collect_func)(int short_opt,
+ int argc,
+ const char **argv,
+ int *optind,
+ int *optarg,
+ void *data);
+
+typedef struct getarg_collect_info {
+ getarg_collect_func func;
+ void *data;
+} getarg_collect_info;
+
+int getarg(struct getargs *args, size_t num_args,
+ int argc, const char **argv, int *optind);
+
+void arg_printusage (struct getargs *args,
+ size_t num_args,
+ const char *progname,
+ const char *extra_string);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __GETARG_H__ */
diff --git a/ndb/include/util/md5_hash.hpp b/ndb/include/util/md5_hash.hpp
new file mode 100644
index 00000000000..4c3cf239881
--- /dev/null
+++ b/ndb/include/util/md5_hash.hpp
@@ -0,0 +1,25 @@
+/* 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 MD5_HASH_H
+#define MD5_HASH_H
+
+#include <ndb_types.h>
+
+// External declaration of hash function
+Uint32 md5_hash(const Uint64* keybuf, Uint32 no_of_32_words);
+
+#endif
diff --git a/ndb/include/util/random.h b/ndb/include/util/random.h
new file mode 100644
index 00000000000..1b83e5fec93
--- /dev/null
+++ b/ndb/include/util/random.h
@@ -0,0 +1,84 @@
+/* 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 RANDOM_H
+#define RANDOM_H
+
+/***************************************************************
+* I N C L U D E D F I L E S *
+***************************************************************/
+
+/***************************************************************
+* M A C R O S *
+***************************************************************/
+
+/***************************************************************/
+/* C O N S T A N T S */
+/***************************************************************/
+
+
+/***************************************************************
+* D A T A S T R U C T U R E S *
+***************************************************************/
+
+typedef struct {
+ unsigned int length;
+ unsigned int *values;
+ unsigned int currentIndex;
+}RandomSequence;
+
+typedef struct {
+ unsigned int length;
+ unsigned int value;
+}SequenceValues;
+
+/***************************************************************
+* P U B L I C F U N C T I O N S *
+***************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern double getTps(unsigned int count, double timeValue);
+
+/*----------------------------*/
+/* Random Sequences Functions */
+/*----------------------------*/
+extern int initSequence(RandomSequence *seq, SequenceValues *inputValues);
+extern unsigned int getNextRandom(RandomSequence *seq);
+extern void printSequence(RandomSequence *seq, unsigned int numPerRow);
+
+/*---------------------------------------------------*/
+/* Code from the glibc, to make sure the same random */
+/* number generator is used by all */
+/*---------------------------------------------------*/
+extern void myRandom48Init(long int seedval);
+extern long int myRandom48(unsigned int maxValue);
+
+#ifdef __cplusplus
+}
+#endif
+
+/***************************************************************
+* E X T E R N A L D A T A *
+***************************************************************/
+
+
+
+#endif /* RANDOM_H */
+
diff --git a/ndb/include/util/socket_io.h b/ndb/include/util/socket_io.h
new file mode 100644
index 00000000000..bbd1bf115ae
--- /dev/null
+++ b/ndb/include/util/socket_io.h
@@ -0,0 +1,40 @@
+/* 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 _SOCKET_IO_H
+#define _SOCKET_IO_H
+
+#include <NdbTCP.h>
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ int read_socket(NDB_SOCKET_TYPE, int timeout_ms, char *, int len);
+ int readln_socket(NDB_SOCKET_TYPE, int timeout_ms, char *, int len);
+ int write_socket(NDB_SOCKET_TYPE, int timeout_ms, const char[], int len);
+
+ int print_socket(NDB_SOCKET_TYPE, int timeout_ms, const char *, ...);
+ int println_socket(NDB_SOCKET_TYPE, int timeout_ms, const char *, ...);
+ int vprint_socket(NDB_SOCKET_TYPE, int timeout_ms, const char *, va_list);
+ int vprintln_socket(NDB_SOCKET_TYPE, int timeout_ms, const char *, va_list);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ndb/include/util/uucode.h b/ndb/include/util/uucode.h
new file mode 100644
index 00000000000..138a79fa3ae
--- /dev/null
+++ b/ndb/include/util/uucode.h
@@ -0,0 +1,36 @@
+/* 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 UUCODE_H
+#define UUCODE_H
+
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ void uuencode(const char * data, int dataLen, FILE * out);
+ int uudecode(FILE * input, char * outBuf, int bufLen);
+
+ int uuencode_mem(char * dst, const char * src, int src_len);
+ int uudecode_mem(char * dst, int dst_len, const char * src);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ndb/include/util/version.h b/ndb/include/util/version.h
new file mode 100644
index 00000000000..a82ae4b8b52
--- /dev/null
+++ b/ndb/include/util/version.h
@@ -0,0 +1,50 @@
+/* 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 VERSION_H
+#define VERSION_H
+#include <ndb_types.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ Uint32 getMajor(Uint32 version);
+
+ Uint32 getMinor(Uint32 version);
+
+ Uint32 getBuild(Uint32 version);
+
+ Uint32 makeVersion(Uint32 major, Uint32 minor, Uint32 build);
+
+ char* getVersionString(Uint32 version, char * status);
+
+ void ndbPrintVersion();
+ Uint32 ndbGetOwnVersion();
+
+ int ndbCompatible_mgmt_ndb(Uint32 ownVersion, Uint32 otherVersion);
+ int ndbCompatible_ndb_mgmt(Uint32 ownVersion, Uint32 otherVersion);
+ int ndbCompatible_mgmt_api(Uint32 ownVersion, Uint32 otherVersion);
+ int ndbCompatible_api_mgmt(Uint32 ownVersion, Uint32 otherVersion);
+ int ndbCompatible_api_ndb(Uint32 ownVersion, Uint32 otherVersion);
+ int ndbCompatible_ndb_api(Uint32 ownVersion, Uint32 otherVersion);
+ int ndbCompatible_ndb_ndb(Uint32 ownVersion, Uint32 otherVersion);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif