summaryrefslogtreecommitdiff
path: root/storage/ndb/include
diff options
context:
space:
mode:
Diffstat (limited to 'storage/ndb/include')
-rw-r--r--storage/ndb/include/Makefile.am51
-rw-r--r--storage/ndb/include/debugger/DebuggerNames.hpp71
-rw-r--r--storage/ndb/include/debugger/EventLogger.hpp180
-rw-r--r--storage/ndb/include/debugger/GrepError.hpp94
-rw-r--r--storage/ndb/include/debugger/SignalLoggerManager.hpp174
-rw-r--r--storage/ndb/include/editline/editline.h38
-rw-r--r--storage/ndb/include/kernel/AttributeDescriptor.hpp208
-rw-r--r--storage/ndb/include/kernel/AttributeHeader.hpp215
-rw-r--r--storage/ndb/include/kernel/AttributeList.hpp32
-rw-r--r--storage/ndb/include/kernel/BlockNumbers.h82
-rw-r--r--storage/ndb/include/kernel/GlobalSignalNumbers.h949
-rw-r--r--storage/ndb/include/kernel/GrepEvent.hpp59
-rw-r--r--storage/ndb/include/kernel/Interpreter.hpp284
-rw-r--r--storage/ndb/include/kernel/LogLevel.hpp163
-rw-r--r--storage/ndb/include/kernel/NodeBitmask.hpp89
-rw-r--r--storage/ndb/include/kernel/NodeInfo.hpp95
-rw-r--r--storage/ndb/include/kernel/NodeState.hpp319
-rw-r--r--storage/ndb/include/kernel/RefConvert.hpp47
-rw-r--r--storage/ndb/include/kernel/kernel_config_parameters.h51
-rw-r--r--storage/ndb/include/kernel/kernel_types.h43
-rw-r--r--storage/ndb/include/kernel/ndb_limits.h130
-rw-r--r--storage/ndb/include/kernel/signaldata/AbortAll.hpp88
-rw-r--r--storage/ndb/include/kernel/signaldata/AccFrag.hpp89
-rw-r--r--storage/ndb/include/kernel/signaldata/AccLock.hpp65
-rw-r--r--storage/ndb/include/kernel/signaldata/AccScan.hpp163
-rw-r--r--storage/ndb/include/kernel/signaldata/AccSizeAltReq.hpp53
-rw-r--r--storage/ndb/include/kernel/signaldata/AlterIndx.hpp271
-rw-r--r--storage/ndb/include/kernel/signaldata/AlterTab.hpp125
-rw-r--r--storage/ndb/include/kernel/signaldata/AlterTable.hpp179
-rw-r--r--storage/ndb/include/kernel/signaldata/AlterTrig.hpp288
-rw-r--r--storage/ndb/include/kernel/signaldata/ApiRegSignalData.hpp92
-rw-r--r--storage/ndb/include/kernel/signaldata/ApiVersion.hpp60
-rw-r--r--storage/ndb/include/kernel/signaldata/ArbitSignalData.hpp155
-rw-r--r--storage/ndb/include/kernel/signaldata/AttrInfo.hpp53
-rw-r--r--storage/ndb/include/kernel/signaldata/BackupContinueB.hpp38
-rw-r--r--storage/ndb/include/kernel/signaldata/BackupImpl.hpp366
-rw-r--r--storage/ndb/include/kernel/signaldata/BackupSignalData.hpp253
-rw-r--r--storage/ndb/include/kernel/signaldata/BlockCommitOrd.hpp62
-rw-r--r--storage/ndb/include/kernel/signaldata/BuildIndx.hpp308
-rw-r--r--storage/ndb/include/kernel/signaldata/CheckNodeGroups.hpp61
-rw-r--r--storage/ndb/include/kernel/signaldata/CloseComReqConf.hpp53
-rw-r--r--storage/ndb/include/kernel/signaldata/CmInit.hpp48
-rw-r--r--storage/ndb/include/kernel/signaldata/CmRegSignalData.hpp192
-rw-r--r--storage/ndb/include/kernel/signaldata/CmvmiCfgConf.hpp49
-rw-r--r--storage/ndb/include/kernel/signaldata/CntrMasterConf.hpp47
-rw-r--r--storage/ndb/include/kernel/signaldata/CntrMasterReq.hpp50
-rw-r--r--storage/ndb/include/kernel/signaldata/CntrStart.hpp69
-rw-r--r--storage/ndb/include/kernel/signaldata/ConfigParamId.hpp71
-rw-r--r--storage/ndb/include/kernel/signaldata/ContinueFragmented.hpp36
-rw-r--r--storage/ndb/include/kernel/signaldata/CopyActive.hpp84
-rw-r--r--storage/ndb/include/kernel/signaldata/CopyFrag.hpp87
-rw-r--r--storage/ndb/include/kernel/signaldata/CopyGCIReq.hpp63
-rw-r--r--storage/ndb/include/kernel/signaldata/CreateEvnt.hpp487
-rw-r--r--storage/ndb/include/kernel/signaldata/CreateFrag.hpp61
-rw-r--r--storage/ndb/include/kernel/signaldata/CreateFragmentation.hpp101
-rw-r--r--storage/ndb/include/kernel/signaldata/CreateIndx.hpp295
-rw-r--r--storage/ndb/include/kernel/signaldata/CreateTab.hpp108
-rw-r--r--storage/ndb/include/kernel/signaldata/CreateTable.hpp142
-rw-r--r--storage/ndb/include/kernel/signaldata/CreateTrig.hpp417
-rw-r--r--storage/ndb/include/kernel/signaldata/DiAddTab.hpp90
-rw-r--r--storage/ndb/include/kernel/signaldata/DiGetNodes.hpp62
-rw-r--r--storage/ndb/include/kernel/signaldata/DictSchemaInfo.hpp45
-rw-r--r--storage/ndb/include/kernel/signaldata/DictSizeAltReq.hpp51
-rw-r--r--storage/ndb/include/kernel/signaldata/DictStart.hpp54
-rw-r--r--storage/ndb/include/kernel/signaldata/DictTabInfo.hpp515
-rw-r--r--storage/ndb/include/kernel/signaldata/DihAddFrag.hpp62
-rw-r--r--storage/ndb/include/kernel/signaldata/DihContinueB.hpp76
-rw-r--r--storage/ndb/include/kernel/signaldata/DihSizeAltReq.hpp50
-rw-r--r--storage/ndb/include/kernel/signaldata/DihStartTab.hpp65
-rw-r--r--storage/ndb/include/kernel/signaldata/DihSwitchReplica.hpp72
-rw-r--r--storage/ndb/include/kernel/signaldata/DisconnectRep.hpp61
-rw-r--r--storage/ndb/include/kernel/signaldata/DropIndx.hpp255
-rw-r--r--storage/ndb/include/kernel/signaldata/DropTab.hpp115
-rw-r--r--storage/ndb/include/kernel/signaldata/DropTabFile.hpp64
-rw-r--r--storage/ndb/include/kernel/signaldata/DropTable.hpp80
-rw-r--r--storage/ndb/include/kernel/signaldata/DropTrig.hpp300
-rw-r--r--storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp138
-rw-r--r--storage/ndb/include/kernel/signaldata/EmptyLcp.hpp77
-rw-r--r--storage/ndb/include/kernel/signaldata/EndTo.hpp49
-rw-r--r--storage/ndb/include/kernel/signaldata/EventReport.hpp88
-rw-r--r--storage/ndb/include/kernel/signaldata/EventSubscribeReq.hpp66
-rw-r--r--storage/ndb/include/kernel/signaldata/ExecFragReq.hpp43
-rw-r--r--storage/ndb/include/kernel/signaldata/FailRep.hpp56
-rw-r--r--storage/ndb/include/kernel/signaldata/FireTrigOrd.hpp200
-rw-r--r--storage/ndb/include/kernel/signaldata/FsAppendReq.hpp57
-rw-r--r--storage/ndb/include/kernel/signaldata/FsCloseReq.hpp85
-rw-r--r--storage/ndb/include/kernel/signaldata/FsConf.hpp77
-rw-r--r--storage/ndb/include/kernel/signaldata/FsOpenReq.hpp267
-rw-r--r--storage/ndb/include/kernel/signaldata/FsReadWriteReq.hpp152
-rw-r--r--storage/ndb/include/kernel/signaldata/FsRef.hpp116
-rw-r--r--storage/ndb/include/kernel/signaldata/FsRemoveReq.hpp78
-rw-r--r--storage/ndb/include/kernel/signaldata/GCPSave.hpp98
-rw-r--r--storage/ndb/include/kernel/signaldata/GetTabInfo.hpp126
-rw-r--r--storage/ndb/include/kernel/signaldata/GetTableId.hpp93
-rw-r--r--storage/ndb/include/kernel/signaldata/GrepImpl.hpp891
-rw-r--r--storage/ndb/include/kernel/signaldata/HotSpareRep.hpp48
-rwxr-xr-xstorage/ndb/include/kernel/signaldata/IndxAttrInfo.hpp56
-rwxr-xr-xstorage/ndb/include/kernel/signaldata/IndxKeyInfo.hpp56
-rw-r--r--storage/ndb/include/kernel/signaldata/InvalidateNodeLCPConf.hpp41
-rw-r--r--storage/ndb/include/kernel/signaldata/InvalidateNodeLCPReq.hpp42
-rw-r--r--storage/ndb/include/kernel/signaldata/KeyInfo.hpp47
-rw-r--r--storage/ndb/include/kernel/signaldata/LCP.hpp154
-rw-r--r--storage/ndb/include/kernel/signaldata/ListTables.hpp166
-rw-r--r--storage/ndb/include/kernel/signaldata/LqhFrag.hpp252
-rw-r--r--storage/ndb/include/kernel/signaldata/LqhKey.hpp534
-rw-r--r--storage/ndb/include/kernel/signaldata/LqhSizeAltReq.hpp53
-rw-r--r--storage/ndb/include/kernel/signaldata/LqhTransConf.hpp218
-rw-r--r--storage/ndb/include/kernel/signaldata/ManagementServer.hpp87
-rw-r--r--storage/ndb/include/kernel/signaldata/MasterGCP.hpp84
-rw-r--r--storage/ndb/include/kernel/signaldata/MasterLCP.hpp86
-rw-r--r--storage/ndb/include/kernel/signaldata/NFCompleteRep.hpp80
-rw-r--r--storage/ndb/include/kernel/signaldata/NdbSttor.hpp85
-rw-r--r--storage/ndb/include/kernel/signaldata/NdbfsContinueB.hpp36
-rw-r--r--storage/ndb/include/kernel/signaldata/NextScan.hpp67
-rw-r--r--storage/ndb/include/kernel/signaldata/NodeFailRep.hpp68
-rw-r--r--storage/ndb/include/kernel/signaldata/NodeStateSignalData.hpp94
-rw-r--r--storage/ndb/include/kernel/signaldata/PackedSignal.hpp43
-rw-r--r--storage/ndb/include/kernel/signaldata/PrepDropTab.hpp172
-rw-r--r--storage/ndb/include/kernel/signaldata/PrepFailReqRef.hpp49
-rw-r--r--storage/ndb/include/kernel/signaldata/ReadConfig.hpp24
-rw-r--r--storage/ndb/include/kernel/signaldata/ReadNodesConf.hpp85
-rw-r--r--storage/ndb/include/kernel/signaldata/RelTabMem.hpp69
-rw-r--r--storage/ndb/include/kernel/signaldata/RepImpl.hpp500
-rw-r--r--storage/ndb/include/kernel/signaldata/ResumeReq.hpp69
-rw-r--r--storage/ndb/include/kernel/signaldata/ScanFrag.hpp348
-rw-r--r--storage/ndb/include/kernel/signaldata/ScanTab.hpp424
-rw-r--r--storage/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp85
-rw-r--r--storage/ndb/include/kernel/signaldata/SetVarReq.hpp84
-rw-r--r--storage/ndb/include/kernel/signaldata/SignalData.hpp226
-rw-r--r--storage/ndb/include/kernel/signaldata/SignalDataPrint.hpp36
-rw-r--r--storage/ndb/include/kernel/signaldata/SignalDroppedRep.hpp44
-rw-r--r--storage/ndb/include/kernel/signaldata/SrFragidConf.hpp43
-rw-r--r--storage/ndb/include/kernel/signaldata/StartFragReq.hpp47
-rw-r--r--storage/ndb/include/kernel/signaldata/StartInfo.hpp84
-rw-r--r--storage/ndb/include/kernel/signaldata/StartMe.hpp63
-rw-r--r--storage/ndb/include/kernel/signaldata/StartOrd.hpp48
-rw-r--r--storage/ndb/include/kernel/signaldata/StartPerm.hpp68
-rw-r--r--storage/ndb/include/kernel/signaldata/StartRec.hpp61
-rw-r--r--storage/ndb/include/kernel/signaldata/StartTo.hpp50
-rw-r--r--storage/ndb/include/kernel/signaldata/StopMe.hpp70
-rw-r--r--storage/ndb/include/kernel/signaldata/StopPerm.hpp96
-rw-r--r--storage/ndb/include/kernel/signaldata/StopReq.hpp202
-rw-r--r--storage/ndb/include/kernel/signaldata/SumaImpl.hpp619
-rw-r--r--storage/ndb/include/kernel/signaldata/SystemError.hpp60
-rw-r--r--storage/ndb/include/kernel/signaldata/TamperOrd.hpp40
-rw-r--r--storage/ndb/include/kernel/signaldata/TcCommit.hpp75
-rw-r--r--storage/ndb/include/kernel/signaldata/TcContinueB.hpp51
-rw-r--r--storage/ndb/include/kernel/signaldata/TcHbRep.hpp64
-rw-r--r--storage/ndb/include/kernel/signaldata/TcIndx.hpp126
-rw-r--r--storage/ndb/include/kernel/signaldata/TcKeyConf.hpp132
-rw-r--r--storage/ndb/include/kernel/signaldata/TcKeyFailConf.hpp53
-rw-r--r--storage/ndb/include/kernel/signaldata/TcKeyRef.hpp52
-rw-r--r--storage/ndb/include/kernel/signaldata/TcKeyReq.hpp548
-rw-r--r--storage/ndb/include/kernel/signaldata/TcRollbackRep.hpp50
-rw-r--r--storage/ndb/include/kernel/signaldata/TcSizeAltReq.hpp52
-rw-r--r--storage/ndb/include/kernel/signaldata/TestOrd.hpp229
-rwxr-xr-xstorage/ndb/include/kernel/signaldata/TransIdAI.hpp59
-rw-r--r--storage/ndb/include/kernel/signaldata/TrigAttrInfo.hpp138
-rw-r--r--storage/ndb/include/kernel/signaldata/TupCommit.hpp51
-rw-r--r--storage/ndb/include/kernel/signaldata/TupFrag.hpp198
-rw-r--r--storage/ndb/include/kernel/signaldata/TupKey.hpp125
-rw-r--r--storage/ndb/include/kernel/signaldata/TupSizeAltReq.hpp58
-rw-r--r--storage/ndb/include/kernel/signaldata/TuxBound.hpp59
-rw-r--r--storage/ndb/include/kernel/signaldata/TuxContinueB.hpp30
-rw-r--r--storage/ndb/include/kernel/signaldata/TuxMaint.hpp67
-rw-r--r--storage/ndb/include/kernel/signaldata/TuxSizeAltReq.hpp48
-rw-r--r--storage/ndb/include/kernel/signaldata/UpdateTo.hpp59
-rw-r--r--storage/ndb/include/kernel/signaldata/UpgradeStartup.hpp38
-rw-r--r--storage/ndb/include/kernel/signaldata/UtilDelete.hpp121
-rw-r--r--storage/ndb/include/kernel/signaldata/UtilExecute.hpp136
-rw-r--r--storage/ndb/include/kernel/signaldata/UtilLock.hpp334
-rw-r--r--storage/ndb/include/kernel/signaldata/UtilPrepare.hpp161
-rw-r--r--storage/ndb/include/kernel/signaldata/UtilRelease.hpp83
-rw-r--r--storage/ndb/include/kernel/signaldata/UtilSequence.hpp101
-rw-r--r--storage/ndb/include/kernel/signaldata/WaitGCP.hpp109
-rw-r--r--storage/ndb/include/kernel/trigger_definitions.h68
-rw-r--r--storage/ndb/include/logger/ConsoleLogHandler.hpp57
-rw-r--r--storage/ndb/include/logger/FileLogHandler.hpp110
-rw-r--r--storage/ndb/include/logger/LogHandler.hpp208
-rw-r--r--storage/ndb/include/logger/Logger.hpp296
-rw-r--r--storage/ndb/include/logger/SysLogHandler.hpp99
-rw-r--r--storage/ndb/include/mgmapi/mgmapi.h1054
-rw-r--r--storage/ndb/include/mgmapi/mgmapi_config_parameters.h170
-rw-r--r--storage/ndb/include/mgmapi/mgmapi_config_parameters_debug.h8
-rw-r--r--storage/ndb/include/mgmapi/mgmapi_debug.h140
-rw-r--r--storage/ndb/include/mgmapi/ndb_logevent.h618
-rw-r--r--storage/ndb/include/mgmcommon/ConfigRetriever.hpp106
-rw-r--r--storage/ndb/include/mgmcommon/IPCConfig.hpp83
-rw-r--r--storage/ndb/include/mgmcommon/MgmtErrorReporter.hpp68
-rw-r--r--storage/ndb/include/ndb_constants.h72
-rw-r--r--storage/ndb/include/ndb_global.h.in139
-rw-r--r--storage/ndb/include/ndb_init.h32
-rw-r--r--storage/ndb/include/ndb_net.h7
-rw-r--r--storage/ndb/include/ndb_types.h.in81
-rw-r--r--storage/ndb/include/ndb_version.h.in53
-rw-r--r--storage/ndb/include/ndbapi/Ndb.hpp1700
-rw-r--r--storage/ndb/include/ndbapi/NdbApi.hpp35
-rw-r--r--storage/ndb/include/ndbapi/NdbBlob.hpp334
-rw-r--r--storage/ndb/include/ndbapi/NdbDictionary.hpp1331
-rw-r--r--storage/ndb/include/ndbapi/NdbError.hpp237
-rw-r--r--storage/ndb/include/ndbapi/NdbEventOperation.hpp225
-rw-r--r--storage/ndb/include/ndbapi/NdbIndexOperation.hpp186
-rw-r--r--storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp155
-rw-r--r--storage/ndb/include/ndbapi/NdbOperation.hpp1226
-rw-r--r--storage/ndb/include/ndbapi/NdbPool.hpp35
-rw-r--r--storage/ndb/include/ndbapi/NdbRecAttr.hpp445
-rw-r--r--storage/ndb/include/ndbapi/NdbReceiver.hpp150
-rw-r--r--storage/ndb/include/ndbapi/NdbScanFilter.hpp178
-rw-r--r--storage/ndb/include/ndbapi/NdbScanOperation.hpp256
-rw-r--r--storage/ndb/include/ndbapi/NdbTransaction.hpp1053
-rw-r--r--storage/ndb/include/ndbapi/ndb_cluster_connection.hpp100
-rw-r--r--storage/ndb/include/ndbapi/ndb_opt_defaults.h23
-rw-r--r--storage/ndb/include/ndbapi/ndbapi_limits.h34
-rw-r--r--storage/ndb/include/ndbapi/ndberror.h104
-rw-r--r--storage/ndb/include/newtonapi/dba.h730
-rw-r--r--storage/ndb/include/newtonapi/defs/pcn_types.h34
-rw-r--r--storage/ndb/include/portlib/NdbCondition.h94
-rw-r--r--storage/ndb/include/portlib/NdbConfig.h39
-rw-r--r--storage/ndb/include/portlib/NdbDaemon.h72
-rw-r--r--storage/ndb/include/portlib/NdbEnv.h34
-rw-r--r--storage/ndb/include/portlib/NdbHost.h43
-rw-r--r--storage/ndb/include/portlib/NdbMain.h66
-rw-r--r--storage/ndb/include/portlib/NdbMem.h81
-rw-r--r--storage/ndb/include/portlib/NdbMutex.h113
-rw-r--r--storage/ndb/include/portlib/NdbSleep.h38
-rw-r--r--storage/ndb/include/portlib/NdbTCP.h96
-rw-r--r--storage/ndb/include/portlib/NdbThread.h102
-rw-r--r--storage/ndb/include/portlib/NdbTick.h69
-rw-r--r--storage/ndb/include/portlib/PortDefs.h53
-rw-r--r--storage/ndb/include/portlib/prefetch.h69
-rw-r--r--storage/ndb/include/transporter/TransporterCallback.hpp345
-rw-r--r--storage/ndb/include/transporter/TransporterDefinitions.hpp126
-rw-r--r--storage/ndb/include/transporter/TransporterRegistry.hpp357
-rw-r--r--storage/ndb/include/util/Base64.hpp28
-rw-r--r--storage/ndb/include/util/BaseString.hpp266
-rw-r--r--storage/ndb/include/util/Bitmask.hpp854
-rw-r--r--storage/ndb/include/util/ConfigValues.hpp254
-rw-r--r--storage/ndb/include/util/File.hpp205
-rw-r--r--storage/ndb/include/util/InputStream.hpp48
-rw-r--r--storage/ndb/include/util/NdbAutoPtr.hpp59
-rw-r--r--storage/ndb/include/util/NdbOut.hpp132
-rw-r--r--storage/ndb/include/util/NdbSqlUtil.hpp188
-rw-r--r--storage/ndb/include/util/OutputStream.hpp67
-rw-r--r--storage/ndb/include/util/Parser.hpp291
-rw-r--r--storage/ndb/include/util/Properties.hpp250
-rw-r--r--storage/ndb/include/util/SimpleProperties.hpp289
-rw-r--r--storage/ndb/include/util/SocketAuthenticator.hpp39
-rw-r--r--storage/ndb/include/util/SocketClient.hpp44
-rw-r--r--storage/ndb/include/util/SocketServer.hpp133
-rw-r--r--storage/ndb/include/util/UtilBuffer.hpp97
-rw-r--r--storage/ndb/include/util/Vector.hpp296
-rw-r--r--storage/ndb/include/util/basestring_vsnprintf.h29
-rw-r--r--storage/ndb/include/util/md5_hash.hpp34
-rw-r--r--storage/ndb/include/util/ndb_opts.h167
-rw-r--r--storage/ndb/include/util/random.h84
-rw-r--r--storage/ndb/include/util/socket_io.h41
-rw-r--r--storage/ndb/include/util/uucode.h36
-rw-r--r--storage/ndb/include/util/version.h50
258 files changed, 40765 insertions, 0 deletions
diff --git a/storage/ndb/include/Makefile.am b/storage/ndb/include/Makefile.am
new file mode 100644
index 00000000000..10f297492e9
--- /dev/null
+++ b/storage/ndb/include/Makefile.am
@@ -0,0 +1,51 @@
+
+include $(top_srcdir)/ndb/config/common.mk.am
+
+ndbinclude_HEADERS = \
+ndb_constants.h \
+ndb_init.h \
+ndb_types.h \
+ndb_version.h
+
+ndbapiinclude_HEADERS = \
+ndbapi/ndbapi_limits.h \
+ndbapi/ndb_opt_defaults.h \
+ndbapi/Ndb.hpp \
+ndbapi/NdbApi.hpp \
+ndbapi/NdbTransaction.hpp \
+ndbapi/NdbDictionary.hpp \
+ndbapi/NdbError.hpp \
+ndbapi/NdbEventOperation.hpp \
+ndbapi/NdbIndexOperation.hpp \
+ndbapi/NdbOperation.hpp \
+ndbapi/ndb_cluster_connection.hpp \
+ndbapi/NdbBlob.hpp \
+ndbapi/NdbPool.hpp \
+ndbapi/NdbRecAttr.hpp \
+ndbapi/NdbReceiver.hpp \
+ndbapi/NdbScanFilter.hpp \
+ndbapi/NdbScanOperation.hpp \
+ndbapi/NdbIndexScanOperation.hpp \
+ndbapi/ndberror.h
+
+mgmapiinclude_HEADERS = \
+mgmapi/mgmapi.h \
+mgmapi/mgmapi_debug.h \
+mgmapi/mgmapi_config_parameters.h \
+mgmapi/mgmapi_config_parameters_debug.h \
+mgmapi/ndb_logevent.h
+
+noinst_HEADERS = \
+ndb_global.h \
+ndb_net.h
+
+EXTRA_DIST = debugger editline kernel logger mgmcommon \
+portlib transporter util
+
+dist-hook:
+ -rm -rf `find $(distdir) -type d -name SCCS`
+
+windoze-dsp:
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/storage/ndb/include/debugger/DebuggerNames.hpp b/storage/ndb/include/debugger/DebuggerNames.hpp
new file mode 100644
index 00000000000..cf9b1b57226
--- /dev/null
+++ b/storage/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/storage/ndb/include/debugger/EventLogger.hpp b/storage/ndb/include/debugger/EventLogger.hpp
new file mode 100644
index 00000000000..6308cf25465
--- /dev/null
+++ b/storage/ndb/include/debugger/EventLogger.hpp
@@ -0,0 +1,180 @@
+/* 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/Logger.hpp>
+#include <logger/FileLogHandler.hpp>
+#include "GrepError.hpp"
+#include <kernel/kernel_types.h>
+#include <kernel/LogLevel.hpp>
+#include <kernel/signaldata/EventReport.hpp>
+
+class EventLoggerBase {
+public:
+ virtual ~EventLoggerBase();
+
+ /**
+ * LogLevel settings
+ */
+ LogLevel m_logLevel;
+
+ /**
+ * This matrix defines which event should be printed when
+ *
+ * threshold - is in range [0-15]
+ * severity - DEBUG to ALERT (Type of log message)
+ */
+ typedef void (* EventTextFunction)(char *,size_t,const Uint32*);
+
+ struct EventRepLogLevelMatrix {
+ Ndb_logevent_type eventType;
+ LogLevel::EventCategory eventCategory;
+ Uint32 threshold;
+ Logger::LoggerLevel severity;
+ EventTextFunction textF;
+ };
+
+ static const EventRepLogLevelMatrix matrix[];
+ static const Uint32 matrixSize;
+ static int event_lookup(int eventType,
+ LogLevel::EventCategory &cat,
+ Uint32 &threshold,
+ Logger::LoggerLevel &severity,
+ EventTextFunction &textF);
+};
+
+/**
+ * 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 EventLoggerBase, public Logger
+{
+public:
+ /**
+ * Default constructor. Enables default log levels and
+ * sets the log category to 'EventLogger'.
+ */
+ EventLogger();
+
+ /**
+ * Destructor.
+ */
+ virtual ~EventLogger();
+
+ /**
+ * 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 eventType the type of event.
+ * @param theData the event data.
+ * @param nodeId the node id of event origin.
+ */
+ virtual void log(int, const Uint32*, NodeId = 0,const class LogLevel * = 0);
+
+
+ /**
+ * Returns the event text for the specified event report type.
+ *
+ * @param textF print function for the event
+ * @param theData the event data.
+ * @param nodeId a node id.
+ * @return the event report text.
+ */
+ static const char* getText(char * dst, size_t dst_len,
+ EventTextFunction textF,
+ const Uint32* theData, NodeId nodeId = 0);
+
+ /**
+ * 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);
+
+private:
+ /** Prohibit */
+ EventLogger(const EventLogger&);
+ EventLogger operator = (const EventLogger&);
+ bool operator == (const EventLogger&);
+
+ Uint32 m_filterLevel;
+
+ STATIC_CONST(MAX_TEXT_LENGTH = 256);
+ char m_text[MAX_TEXT_LENGTH];
+};
+
+
+#endif
diff --git a/storage/ndb/include/debugger/GrepError.hpp b/storage/ndb/include/debugger/GrepError.hpp
new file mode 100644
index 00000000000..beedbd95c80
--- /dev/null
+++ b/storage/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 GE_Code {
+ GE_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 {
+ GE_Code errCode;
+ const char * name;
+ };
+ static const ErrorDescription errorDescriptions[];
+ static const Uint32 noOfErrorDescs;
+ static const char * getErrorDesc(GrepError::GE_Code err);
+
+};
+
+#endif
diff --git a/storage/ndb/include/debugger/SignalLoggerManager.hpp b/storage/ndb/include/debugger/SignalLoggerManager.hpp
new file mode 100644
index 00000000000..742bf7d294e
--- /dev/null
+++ b/storage/ndb/include/debugger/SignalLoggerManager.hpp
@@ -0,0 +1,174 @@
+/* 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 <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;
+ Uint32 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/storage/ndb/include/editline/editline.h b/storage/ndb/include/editline/editline.h
new file mode 100644
index 00000000000..2757e385968
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/AttributeDescriptor.hpp b/storage/ndb/include/kernel/AttributeDescriptor.hpp
new file mode 100644
index 00000000000..af28e777213
--- /dev/null
+++ b/storage/ndb/include/kernel/AttributeDescriptor.hpp
@@ -0,0 +1,208 @@
+/* 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 Dbtc;
+ friend class Dbacc;
+ 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 setNullable(Uint32 &, Uint32 nullable);
+ static void setDKey(Uint32 &, Uint32 dkey);
+ static void setPrimaryKey(Uint32 &, Uint32 dkey);
+ static void setDynamic(Uint32 &, Uint32 dynamicInd);
+
+ static Uint32 getType(const Uint32 &);
+ static Uint32 getSize(const Uint32 &);
+ static Uint32 getSizeInBytes(const Uint32 &);
+ static Uint32 getSizeInWords(const Uint32 &);
+ static Uint32 getArrayType(const Uint32 &);
+ static Uint32 getArraySize(const Uint32 &);
+ static Uint32 getNullable(const Uint32 &);
+ static Uint32 getDKey(const Uint32 &);
+ static Uint32 getPrimaryKey(const Uint32 &);
+ static Uint32 getDynamic(const Uint32 &);
+};
+
+/**
+ *
+ * a = Array type - 2 Bits -> Max 3 (Bit 0-1)
+ * t = Attribute type - 5 Bits -> Max 31 (Bit 2-6)
+ * s = Attribute size - 3 Bits -> Max 7 (Bit 8-10)
+ * d = Disk based - 1 Bit 11
+ * n = Nullable - 1 Bit 12
+ * k = Distribution Key Ind - 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
+ * aattttt sssdnkpyzzzzzzzzzzzzzzzz
+ * aattsss n d k pyzzzzzzzzzzzzzzzz [ old format ]
+ *
+ */
+
+#define AD_ARRAY_TYPE_SHIFT (0)
+#define AD_ARRAY_TYPE_MASK (3)
+
+#define AD_TYPE_SHIFT (2)
+#define AD_TYPE_MASK (31)
+
+#define AD_SIZE_SHIFT (8)
+#define AD_SIZE_MASK (7)
+
+#define AD_SIZE_IN_BYTES_SHIFT (3)
+#define AD_SIZE_IN_WORDS_OFFSET (31)
+#define AD_SIZE_IN_WORDS_SHIFT (5)
+
+#define AD_NULLABLE_SHIFT (12)
+#define AD_DISTR_KEY_SHIFT (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::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::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::getSizeInBytes(const Uint32 & desc){
+ return (getArraySize(desc) << getSize(desc))
+ >> AD_SIZE_IN_BYTES_SHIFT;
+}
+
+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::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;
+}
+
+#endif
diff --git a/storage/ndb/include/kernel/AttributeHeader.hpp b/storage/ndb/include/kernel/AttributeHeader.hpp
new file mode 100644
index 00000000000..3cb432067eb
--- /dev/null
+++ b/storage/ndb/include/kernel/AttributeHeader.hpp
@@ -0,0 +1,215 @@
+/* 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
+
+/**
+ * @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:
+ /**
+ * Psuedo columns
+ */
+ STATIC_CONST( PSUEDO = 0x8000 );
+ STATIC_CONST( FRAGMENT = 0xFFFE ); // Read fragment no
+ STATIC_CONST( ROW_COUNT = 0xFFFD ); // Read row count (committed)
+ STATIC_CONST( COMMIT_COUNT = 0xFFFC ); // Read commit count
+ STATIC_CONST( RANGE_NO = 0xFFFB ); // Read range no (when batched ranges)
+
+ STATIC_CONST( ROW_SIZE = 0xFFFA );
+ STATIC_CONST( FRAGMENT_MEMORY= 0xFFF9 );
+
+ /** 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/storage/ndb/include/kernel/AttributeList.hpp b/storage/ndb/include/kernel/AttributeList.hpp
new file mode 100644
index 00000000000..7c6f71df3d2
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/BlockNumbers.h b/storage/ndb/include/kernel/BlockNumbers.h
new file mode 100644
index 00000000000..cb3cc697eee
--- /dev/null
+++ b/storage/ndb/include/kernel/BlockNumbers.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 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 CNTR 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/storage/ndb/include/kernel/GlobalSignalNumbers.h b/storage/ndb/include/kernel/GlobalSignalNumbers.h
new file mode 100644
index 00000000000..9413f4ef56a
--- /dev/null
+++ b/storage/ndb/include/kernel/GlobalSignalNumbers.h
@@ -0,0 +1,949 @@
+/* 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
+/* 30 unused */
+#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_CNTR_START_REQ 115
+/* 116 not unused */
+#define GSN_CNTR_START_REF 117
+#define GSN_CNTR_START_CONF 118
+#define GSN_CNTR_START_REP 119
+/* 120 unused */
+/* 121 unused */
+/* 122 unused */
+/* 123 unused */
+/* 124 unused */
+#define GSN_CHECK_LCP_STOP 125
+#define GSN_CLOSE_COMCONF 126 /* local */
+#define GSN_CLOSE_COMREQ 127 /* local */
+#define GSN_CM_ACKADD 128 /* distr. */
+/* 129 unused */
+#define GSN_CM_ADD 130 /* distr. */
+/* 131 unused */
+/* 132 not unused */
+/* 133 not unused */
+#define GSN_CM_HEARTBEAT 134 /* distr. */
+/* 135 unused */
+/* 136 unused */
+/* 137 unused */
+#define GSN_CM_NODEINFOCONF 138 /* distr. */
+#define GSN_CM_NODEINFOREF 139 /* distr. */
+#define GSN_CM_NODEINFOREQ 140 /* distr. */
+#define GSN_CM_REGCONF 141 /* distr. */
+#define GSN_CM_REGREF 142 /* distr. */
+#define GSN_CM_REGREQ 143 /* distr. */
+/* 144 unused */
+/* 145 unused */
+/* 146 unused */
+#define GSN_CM_ADD_REP 147 /* local */
+/* 148 unused */
+/* 149 unused */
+/* 150 unused */
+#define GSN_CNTR_WAITREP 151 /* distr. */
+#define GSN_COMMIT 152
+#define GSN_COMMIT_FAILCONF 153
+#define GSN_COMMIT_FAILREQ 154
+#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_READ_CONFIG_REQ 334 /* new name for sizealt, local */
+#define GSN_READ_CONFIG_CONF 335 /* new name for sizealt, local */
+
+/* 336 unused */
+/* 337 unused */
+/* 338 unused */
+#define GSN_OPEN_COMCONF 339
+#define GSN_OPEN_COMREF 340
+#define GSN_OPEN_COMREQ 341
+#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
+/* 410 unused */
+/* 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
+
+/* 473 unused */
+#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
+
+/* not used 680 */
+/* not used 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
+#define GSN_READ_PSUEDO_REQ 712
+
+#endif
diff --git a/storage/ndb/include/kernel/GrepEvent.hpp b/storage/ndb/include/kernel/GrepEvent.hpp
new file mode 100644
index 00000000000..2073a7072c9
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/Interpreter.hpp b/storage/ndb/include/kernel/Interpreter.hpp
new file mode 100644
index 00000000000..69c952ea7c3
--- /dev/null
+++ b/storage/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( READ_ATTR_INTO_REG = 1 );
+ STATIC_CONST( WRITE_ATTR_FROM_REG = 2 );
+ STATIC_CONST( LOAD_CONST_NULL = 3 );
+ STATIC_CONST( LOAD_CONST16 = 4 );
+ STATIC_CONST( LOAD_CONST32 = 5 );
+ STATIC_CONST( LOAD_CONST64 = 6 );
+ STATIC_CONST( ADD_REG_REG = 7 );
+ STATIC_CONST( SUB_REG_REG = 8 );
+ STATIC_CONST( BRANCH = 9 );
+ STATIC_CONST( BRANCH_REG_EQ_NULL = 10 );
+ STATIC_CONST( BRANCH_REG_NE_NULL = 11 );
+ STATIC_CONST( BRANCH_EQ_REG_REG = 12 );
+ STATIC_CONST( BRANCH_NE_REG_REG = 13 );
+ STATIC_CONST( BRANCH_LT_REG_REG = 14 );
+ STATIC_CONST( BRANCH_LE_REG_REG = 15 );
+ STATIC_CONST( BRANCH_GT_REG_REG = 16 );
+ STATIC_CONST( BRANCH_GE_REG_REG = 17 );
+ STATIC_CONST( EXIT_OK = 18 );
+ STATIC_CONST( EXIT_REFUSE = 19 );
+ STATIC_CONST( CALL = 20 );
+ STATIC_CONST( RETURN = 21 );
+ STATIC_CONST( EXIT_OK_LAST = 22 );
+ STATIC_CONST( BRANCH_ATTR_OP_ARG = 23 );
+ STATIC_CONST( BRANCH_ATTR_EQ_NULL = 24 );
+ STATIC_CONST( 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 Reg1, Uint32 Reg2);
+ 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 Reg1, Uint32 Reg2){
+ return (Reg1 << 9) + (Reg2 << 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/storage/ndb/include/kernel/LogLevel.hpp b/storage/ndb/include/kernel/LogLevel.hpp
new file mode 100644
index 00000000000..60dcd36ab56
--- /dev/null
+++ b/storage/ndb/include/kernel/LogLevel.hpp
@@ -0,0 +1,163 @@
+/* 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_global.h>
+#include <mgmapi_config_parameters.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 {
+ llInvalid = -1,
+ llStartUp = CFG_LOGLEVEL_STARTUP - CFG_MIN_LOGLEVEL,
+ llShutdown = CFG_LOGLEVEL_SHUTDOWN - CFG_MIN_LOGLEVEL,
+ llStatistic = CFG_LOGLEVEL_STATISTICS - CFG_MIN_LOGLEVEL,
+ llCheckpoint = CFG_LOGLEVEL_CHECKPOINT - CFG_MIN_LOGLEVEL,
+ llNodeRestart = CFG_LOGLEVEL_NODERESTART - CFG_MIN_LOGLEVEL,
+ llConnection = CFG_LOGLEVEL_CONNECTION - CFG_MIN_LOGLEVEL,
+ llInfo = CFG_LOGLEVEL_INFO - CFG_MIN_LOGLEVEL,
+ llWarning = CFG_LOGLEVEL_WARNING - CFG_MIN_LOGLEVEL,
+ llError = CFG_LOGLEVEL_ERROR - CFG_MIN_LOGLEVEL,
+ llCongestion = CFG_LOGLEVEL_CONGESTION - CFG_MIN_LOGLEVEL,
+ llDebug = CFG_LOGLEVEL_DEBUG - CFG_MIN_LOGLEVEL
+ ,llBackup = CFG_LOGLEVEL_BACKUP - CFG_MIN_LOGLEVEL
+ };
+
+ /**
+ * No of categories
+ */
+#define _LOGLEVEL_CATEGORIES (CFG_MAX_LOGLEVEL - CFG_MIN_LOGLEVEL + 1)
+ STATIC_CONST( LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES );
+
+ void clear();
+
+ /**
+ * Note level is valid as 0-15
+ */
+ int setLogLevel(EventCategory ec, Uint32 level = 7);
+
+ /**
+ * Get the loglevel (0-15) for a category
+ */
+ Uint32 getLogLevel(EventCategory ec) const;
+
+ /**
+ * Set this= max(this, ll) per category
+ */
+ LogLevel& set_max(const LogLevel& ll);
+
+ bool operator==(const LogLevel& l) const {
+ return memcmp(this, &l, sizeof(* this)) == 0;
+ }
+
+ LogLevel& operator=(const struct EventSubscribeReq & req);
+
+private:
+ /**
+ * The actual data
+ */
+ Uint8 logLevelData[LOGLEVEL_CATEGORIES];
+};
+
+inline
+LogLevel::LogLevel(){
+ clear();
+}
+
+inline
+LogLevel &
+LogLevel::operator= (const LogLevel & org){
+ memcpy(logLevelData, org.logLevelData, sizeof(logLevelData));
+ return * this;
+}
+
+inline
+void
+LogLevel::clear(){
+ for(Uint32 i = 0; i<LOGLEVEL_CATEGORIES; i++){
+ logLevelData[i] = 0;
+ }
+}
+
+inline
+int
+LogLevel::setLogLevel(EventCategory ec, Uint32 level){
+ if (ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES)
+ {
+ logLevelData[ec] = (Uint8)level;
+ return 0;
+ }
+ return 1;
+}
+
+inline
+Uint32
+LogLevel::getLogLevel(EventCategory ec) const{
+ assert(ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES);
+
+ return (Uint32)logLevelData[ec];
+}
+
+inline
+LogLevel &
+LogLevel::set_max(const LogLevel & org){
+ for(Uint32 i = 0; i<LOGLEVEL_CATEGORIES; i++){
+ if(logLevelData[i] < org.logLevelData[i])
+ logLevelData[i] = org.logLevelData[i];
+ }
+ return * this;
+}
+
+#include "signaldata/EventSubscribeReq.hpp"
+
+inline
+LogLevel&
+LogLevel::operator=(const EventSubscribeReq& req)
+{
+ clear();
+ for(size_t i = 0; i<req.noOfEntries; i++){
+ logLevelData[(req.theData[i] >> 16)] = req.theData[i] & 0xFFFF;
+ }
+ return * this;
+}
+
+#endif
diff --git a/storage/ndb/include/kernel/NodeBitmask.hpp b/storage/ndb/include/kernel/NodeBitmask.hpp
new file mode 100644
index 00000000000..423c01cd841
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/NodeInfo.hpp b/storage/ndb/include/kernel/NodeInfo.hpp
new file mode 100644
index 00000000000..5377f001949
--- /dev/null
+++ b/storage/ndb/include/kernel/NodeInfo.hpp
@@ -0,0 +1,95 @@
+/* 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>
+#include <mgmapi_config_parameters.h>
+
+class NodeInfo {
+public:
+ NodeInfo();
+
+ /**
+ * NodeType
+ */
+ enum NodeType {
+ DB = NODE_TYPE_DB, ///< Database node
+ API = NODE_TYPE_API, ///< NDB API node
+ MGM = NODE_TYPE_MGM, ///< Management node (incl. NDB API)
+ REP = NODE_TYPE_REP, ///< 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/storage/ndb/include/kernel/NodeState.hpp b/storage/ndb/include/kernel/NodeState.hpp
new file mode 100644
index 00000000000..16784ecde79
--- /dev/null
+++ b/storage/ndb/include/kernel/NodeState.hpp
@@ -0,0 +1,319 @@
+/* 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>
+#include <NodeBitmask.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( DataLength = 8 + NdbNodeBitmask::Size );
+
+ /**
+ * Constructor(s)
+ */
+ NodeState();
+ NodeState(StartLevel);
+ NodeState(StartLevel, bool systemShutdown);
+ NodeState(StartLevel, Uint32 startPhase, StartType);
+ void init();
+
+ /**
+ * 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
+
+ BitmaskPOD<NdbNodeBitmask::Size> m_connected_nodes;
+
+ 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(){
+ init();
+}
+
+inline
+void
+NodeState::init(){
+ startLevel = SL_CMVMI;
+ nodeGroup = 0xFFFFFFFF;
+ dynamicId = 0xFFFFFFFF;
+ singleUserMode = 0;
+ singleUserApi = 0xFFFFFFFF;
+ m_connected_nodes.clear();
+}
+
+inline
+NodeState::NodeState(StartLevel sl){
+ init();
+ startLevel = sl;
+ singleUserMode = 0;
+ singleUserApi = 0xFFFFFFFF;
+}
+
+inline
+NodeState::NodeState(StartLevel sl, Uint32 sp, StartType typeOfStart){
+ init();
+ startLevel = sl;
+ starting.startPhase = sp;
+ starting.restartType = typeOfStart;
+ singleUserMode = 0;
+ singleUserApi = 0xFFFFFFFF;
+}
+
+inline
+NodeState::NodeState(StartLevel sl, bool sys){
+ init();
+ 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/storage/ndb/include/kernel/RefConvert.hpp b/storage/ndb/include/kernel/RefConvert.hpp
new file mode 100644
index 00000000000..7604b1cf224
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/kernel_config_parameters.h b/storage/ndb/include/kernel/kernel_config_parameters.h
new file mode 100644
index 00000000000..bb7c6ebd42c
--- /dev/null
+++ b/storage/ndb/include/kernel/kernel_config_parameters.h
@@ -0,0 +1,51 @@
+#ifndef DB_CONFIG_PARAMTERS_H
+#define DB_CONFIG_PARAMTERS_H
+
+#define PRIVATE_BASE 14000
+
+#define CFG_ACC_DIR_RANGE (PRIVATE_BASE + 1)
+#define CFG_ACC_DIR_ARRAY (PRIVATE_BASE + 2)
+#define CFG_ACC_FRAGMENT (PRIVATE_BASE + 3)
+#define CFG_ACC_OP_RECS (PRIVATE_BASE + 4)
+#define CFG_ACC_OVERFLOW_RECS (PRIVATE_BASE + 5)
+#define CFG_ACC_PAGE8 (PRIVATE_BASE + 6)
+#define CFG_ACC_ROOT_FRAG (PRIVATE_BASE + 7)
+#define CFG_ACC_TABLE (PRIVATE_BASE + 8)
+#define CFG_ACC_SCAN (PRIVATE_BASE + 9)
+
+#define CFG_DICT_ATTRIBUTE (PRIVATE_BASE + 10)
+#define CFG_DICT_TABLE (PRIVATE_BASE + 13)
+
+#define CFG_DIH_API_CONNECT (PRIVATE_BASE + 15)
+#define CFG_DIH_CONNECT (PRIVATE_BASE + 16)
+#define CFG_DIH_FRAG_CONNECT (PRIVATE_BASE + 17)
+#define CFG_DIH_MORE_NODES (PRIVATE_BASE + 18)
+#define CFG_DIH_REPLICAS (PRIVATE_BASE + 19)
+#define CFG_DIH_TABLE (PRIVATE_BASE + 20)
+
+#define CFG_LQH_FRAG (PRIVATE_BASE + 21)
+#define CFG_LQH_TABLE (PRIVATE_BASE + 23)
+#define CFG_LQH_TC_CONNECT (PRIVATE_BASE + 24)
+#define CFG_LQH_LOG_FILES (PRIVATE_BASE + 26)
+#define CFG_LQH_SCAN (PRIVATE_BASE + 27)
+
+#define CFG_TC_API_CONNECT (PRIVATE_BASE + 28)
+#define CFG_TC_TC_CONNECT (PRIVATE_BASE + 29)
+#define CFG_TC_TABLE (PRIVATE_BASE + 30)
+#define CFG_TC_SCAN (PRIVATE_BASE + 31)
+#define CFG_TC_LOCAL_SCAN (PRIVATE_BASE + 32)
+
+#define CFG_TUP_FRAG (PRIVATE_BASE + 33)
+#define CFG_TUP_OP_RECS (PRIVATE_BASE + 34)
+#define CFG_TUP_PAGE (PRIVATE_BASE + 35)
+#define CFG_TUP_PAGE_RANGE (PRIVATE_BASE + 36)
+#define CFG_TUP_TABLE (PRIVATE_BASE + 37)
+#define CFG_TUP_TABLE_DESC (PRIVATE_BASE + 38)
+#define CFG_TUP_STORED_PROC (PRIVATE_BASE + 39)
+
+#define CFG_TUX_INDEX (PRIVATE_BASE + 40)
+#define CFG_TUX_FRAGMENT (PRIVATE_BASE + 41)
+#define CFG_TUX_ATTRIBUTE (PRIVATE_BASE + 42)
+#define CFG_TUX_SCAN_OP (PRIVATE_BASE + 43)
+
+#endif
diff --git a/storage/ndb/include/kernel/kernel_types.h b/storage/ndb/include/kernel/kernel_types.h
new file mode 100644
index 00000000000..b176d20798c
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/ndb_limits.h b/storage/ndb/include/kernel/ndb_limits.h
new file mode 100644
index 00000000000..2646b54fa02
--- /dev/null
+++ b/storage/ndb/include/kernel/ndb_limits.h
@@ -0,0 +1,130 @@
+/* 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_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_KEY_SIZE_IN_WORDS 1023
+#define MAX_FRM_DATA_SIZE 6000
+#define MAX_NULL_BITS 4096
+#define MAX_FRAGMENT_DATA_BYTES (4+(2 * 8 * MAX_REPLICAS * MAX_NDB_NODES))
+
+#define MIN_ATTRBUF ((MAX_ATTRIBUTES_IN_TABLE/24) + 1)
+/*
+ * Max 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 992
+/*
+* The default batch size. Configurable parameter.
+*/
+#define DEF_BATCH_SIZE 64
+/*
+* When calculating the number of records sent from LQH in each batch
+* one uses SCAN_BATCH_SIZE divided by the expected size of signals
+* per row. This gives the batch size used for the scan. The NDB API
+* will receive one batch from each node at a time so there has to be
+* some care taken also so that the NDB API is not overloaded with
+* signals.
+* This parameter is configurable, this is the default value.
+*/
+#define SCAN_BATCH_SIZE 32768
+/*
+* To protect the NDB API from overload we also define a maximum total
+* batch size from all nodes. This parameter should most likely be
+* configurable, or dependent on sendBufferSize.
+* This parameter is configurable, this is the default value.
+*/
+#define MAX_SCAN_BATCH_SIZE 262144
+/*
+ * 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 prefix */
+#define MAX_TTREE_NODE_SLACK 2 /* diff between max and min occupancy */
+
+/*
+ * Blobs.
+ */
+#define NDB_BLOB_HEAD_SIZE 2 /* sizeof(NdbBlob::Head) >> 2 */
+
+/*
+ * Character sets.
+ */
+#define MAX_XFRM_MULTIPLY 8 /* max expansion when normalizing */
+
+/*
+ * Long signals
+ */
+#define NDB_SECTION_SEGMENT_SZ 60
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/AbortAll.hpp b/storage/ndb/include/kernel/signaldata/AbortAll.hpp
new file mode 100644
index 00000000000..a3d7f483953
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/AccFrag.hpp b/storage/ndb/include/kernel/signaldata/AccFrag.hpp
new file mode 100644
index 00000000000..e28ab0d1ee6
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/AccLock.hpp b/storage/ndb/include/kernel/signaldata/AccLock.hpp
new file mode 100644
index 00000000000..1a41b4c9334
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/AccScan.hpp b/storage/ndb/include/kernel/signaldata/AccScan.hpp
new file mode 100644
index 00000000000..d1ca4424d1a
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/AccScan.hpp
@@ -0,0 +1,163 @@
+/* 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 getReadCommittedFlag(const Uint32 & requestInfo);
+ static Uint32 getDescendingFlag(const Uint32 & requestInfo);
+
+ static void setLockMode(Uint32 & requestInfo, Uint32 lockMode);
+ static void setReadCommittedFlag(Uint32 & requestInfo, Uint32 readCommitted);
+ static void setDescendingFlag(Uint32 & requestInfo, Uint32 descending);
+};
+
+/**
+ * Request Info
+ *
+ * l = Lock Mode - 1 Bit 2
+ * h = Read Committed - 1 Bit 5
+ * z = Descending (TUX) - 1 Bit 6
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * l hz
+ */
+#define AS_LOCK_MODE_SHIFT (2)
+#define AS_LOCK_MODE_MASK (1)
+#define AS_READ_COMMITTED_SHIFT (5)
+#define AS_DESCENDING_SHIFT (6)
+
+inline
+Uint32
+AccScanReq::getLockMode(const Uint32 & requestInfo){
+ return (requestInfo >> AS_LOCK_MODE_SHIFT) & AS_LOCK_MODE_MASK;
+}
+
+inline
+Uint32
+AccScanReq::getReadCommittedFlag(const Uint32 & requestInfo){
+ return (requestInfo >> AS_READ_COMMITTED_SHIFT) & 1;
+}
+
+inline
+Uint32
+AccScanReq::getDescendingFlag(const Uint32 & requestInfo){
+ return (requestInfo >> AS_DESCENDING_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::setReadCommittedFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "AccScanReq::setReadCommittedFlag");
+ requestInfo |= (val << AS_READ_COMMITTED_SHIFT);
+}
+
+inline
+void
+AccScanReq::setDescendingFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "AccScanReq::setDescendingFlag");
+ requestInfo |= (val << AS_DESCENDING_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/storage/ndb/include/kernel/signaldata/AccSizeAltReq.hpp b/storage/ndb/include/kernel/signaldata/AccSizeAltReq.hpp
new file mode 100644
index 00000000000..ac348444826
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/AlterIndx.hpp b/storage/ndb/include/kernel/signaldata/AlterIndx.hpp
new file mode 100644
index 00000000000..f5ad835b6f3
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/AlterIndx.hpp
@@ -0,0 +1,271 @@
+/* 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,
+ NotMaster = 702,
+ 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;
+ union {
+ Uint32 m_errorNode;
+ Uint32 masterNodeId; // if NotMaster
+ };
+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/storage/ndb/include/kernel/signaldata/AlterTab.hpp b/storage/ndb/include/kernel/signaldata/AlterTab.hpp
new file mode 100644
index 00000000000..02d4eb95d2e
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/AlterTable.hpp b/storage/ndb/include/kernel/signaldata/AlterTable.hpp
new file mode 100644
index 00000000000..30f8727551d
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/AlterTrig.hpp b/storage/ndb/include/kernel/signaldata/AlterTrig.hpp
new file mode 100644
index 00000000000..a97c1fd0196
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/ApiRegSignalData.hpp b/storage/ndb/include/kernel/signaldata/ApiRegSignalData.hpp
new file mode 100644
index 00000000000..84dca8fb260
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/ApiVersion.hpp b/storage/ndb/include/kernel/signaldata/ApiVersion.hpp
new file mode 100644
index 00000000000..28281e7d186
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/ArbitSignalData.hpp b/storage/ndb/include/kernel/signaldata/ArbitSignalData.hpp
new file mode 100644
index 00000000000..34b73644a13
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/ArbitSignalData.hpp
@@ -0,0 +1,155 @@
+/* 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 {
+ BaseString::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
+ WinNodes = 42, // win on ndb node count
+ WinGroups = 43, // we win, no need for arbitration
+ LoseGroups = 44, // we lose, missing node group
+ Partitioning = 45, // possible network partitioning
+ WinChoose = 46, // positive reply
+ LoseChoose = 47, // negative reply
+ LoseNorun = 48, // arbitrator required but not running
+ LoseNocfg = 49, // 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:
+ BaseString::snprintf(buf, buf_len, "invalid arbitrator-ticket");
+ break;
+ case ErrToomany:
+ BaseString::snprintf(buf, buf_len, "too many requests");
+ break;
+ case ErrState:
+ BaseString::snprintf(buf, buf_len, "invalid state");
+ break;
+ case ErrTimeout:
+ BaseString::snprintf(buf, buf_len, "timeout");
+ break;
+ default:
+ BaseString::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/storage/ndb/include/kernel/signaldata/AttrInfo.hpp b/storage/ndb/include/kernel/signaldata/AttrInfo.hpp
new file mode 100644
index 00000000000..c87470db8b0
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/AttrInfo.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 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 class NdbScanOperation;
+
+ 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/storage/ndb/include/kernel/signaldata/BackupContinueB.hpp b/storage/ndb/include/kernel/signaldata/BackupContinueB.hpp
new file mode 100644
index 00000000000..d3d3f79f310
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/BackupImpl.hpp b/storage/ndb/include/kernel/signaldata/BackupImpl.hpp
new file mode 100644
index 00000000000..2ac91570aad
--- /dev/null
+++ b/storage/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 = 1340,
+ FailedToAllocateBuffers = 1342,
+ FailedToSetupFsBuffers = 1343,
+ FailedToAllocateTables = 1344,
+ FailedInsertFileHeader = 1345,
+ FailedInsertTableList = 1346,
+ FailedAllocateTableMem = 1347,
+ FailedToAllocateFileRecord = 1348,
+ FailedToAllocateAttributeRecord = 1349
+ };
+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/storage/ndb/include/kernel/signaldata/BackupSignalData.hpp b/storage/ndb/include/kernel/signaldata/BackupSignalData.hpp
new file mode 100644
index 00000000000..fb018026a49
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/BackupSignalData.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 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 = 1300,
+ IAmNotMaster = 1301,
+ OutOfBackupRecord = 1302,
+ OutOfResources = 1303,
+ SequenceFailure = 1304,
+ BackupDefinitionNotImplemented = 1305,
+ CannotBackupDiskless = 1306
+ };
+ 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 = 1321,
+ BackupComplete = 1322,
+ BackupFailure = 1323, // General backup failure coordinator -> slave
+ LogBufferFull = 1324, // slave -> coordinator
+ FileOrScanError = 1325, // slave -> coordinator
+ BackupFailureDueToNodeFail = 1326, // slave -> slave
+ OkToClean = 1327 // master -> slave
+ };
+private:
+ Uint32 requestType;
+ Uint32 backupId;
+ union {
+ Uint32 backupPtr;
+ Uint32 senderData;
+ };
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/BlockCommitOrd.hpp b/storage/ndb/include/kernel/signaldata/BlockCommitOrd.hpp
new file mode 100644
index 00000000000..3b33dceb758
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/BuildIndx.hpp b/storage/ndb/include/kernel/signaldata/BuildIndx.hpp
new file mode 100644
index 00000000000..a6ea84c5ea0
--- /dev/null
+++ b/storage/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 <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,
+ NotMaster = 702,
+ BadRequestType = 4247,
+ InvalidPrimaryTable = 4249,
+ InvalidIndexType = 4250,
+ IndexNotUnique = 4251,
+ AllocationFailure = 4252,
+ InternalError = 4346
+ };
+ STATIC_CONST( SignalLength = BuildIndxConf::SignalLength + 2 );
+
+ //Uint32 m_userRef;
+ //Uint32 m_connectionPtr;
+ //Uint32 m_requestInfo;
+ //Uint32 m_tableId;
+ //Uint32 m_indexType;
+ //Uint32 m_indexId;
+ BuildIndxConf m_conf;
+ Uint32 m_errorCode;
+ Uint32 masterNodeId;
+
+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/storage/ndb/include/kernel/signaldata/CheckNodeGroups.hpp b/storage/ndb/include/kernel/signaldata/CheckNodeGroups.hpp
new file mode 100644
index 00000000000..b3e79949c68
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/CheckNodeGroups.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 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;
+ };
+
+ 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 = 3 + NodeBitmask::Size );
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/CloseComReqConf.hpp b/storage/ndb/include/kernel/signaldata/CloseComReqConf.hpp
new file mode 100644
index 00000000000..3d3dc54ba64
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/CmInit.hpp b/storage/ndb/include/kernel/signaldata/CmInit.hpp
new file mode 100644
index 00000000000..b59547b767b
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/CmRegSignalData.hpp b/storage/ndb/include/kernel/signaldata/CmRegSignalData.hpp
new file mode 100644
index 00000000000..f33c991249f
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/CmvmiCfgConf.hpp b/storage/ndb/include/kernel/signaldata/CmvmiCfgConf.hpp
new file mode 100644
index 00000000000..12b785723d9
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/CntrMasterConf.hpp b/storage/ndb/include/kernel/signaldata/CntrMasterConf.hpp
new file mode 100644
index 00000000000..e6bf363ea68
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/CntrMasterReq.hpp b/storage/ndb/include/kernel/signaldata/CntrMasterReq.hpp
new file mode 100644
index 00000000000..caf9efb1243
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/CntrStart.hpp b/storage/ndb/include/kernel/signaldata/CntrStart.hpp
new file mode 100644
index 00000000000..abdd1003c0f
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/CntrStart.hpp
@@ -0,0 +1,69 @@
+#ifndef CNTR_START_HPP
+#define CNTR_START_HPP
+
+#include <NodeBitmask.hpp>
+
+/**
+ *
+ */
+class CntrStartReq {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+
+ friend bool printCNTR_START_REQ(FILE*, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 3 );
+private:
+
+ Uint32 nodeId;
+ Uint32 startType;
+ Uint32 lastGci;
+};
+
+class CntrStartRef {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+
+ friend bool printCNTR_START_REF(FILE*, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ enum ErrorCode {
+ OK = 0,
+ NotMaster = 1,
+ StopInProgress = 2
+ };
+private:
+
+ Uint32 errorCode;
+ Uint32 masterNodeId;
+};
+
+class CntrStartConf {
+ /**
+ * Sender(s) / Reciver(s)
+ */
+ friend class Ndbcntr;
+ friend struct UpgradeStartup;
+
+ friend bool printCNTR_START_CONF(FILE*, const Uint32 *, Uint32, Uint16);
+
+public:
+ STATIC_CONST( SignalLength = 4 + 2 * NdbNodeBitmask::Size );
+
+private:
+
+ Uint32 startType;
+ Uint32 startGci;
+ Uint32 masterNodeId;
+ Uint32 noStartNodes;
+ Uint32 startedNodes[NdbNodeBitmask::Size];
+ Uint32 startingNodes[NdbNodeBitmask::Size];
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/ConfigParamId.hpp b/storage/ndb/include/kernel/signaldata/ConfigParamId.hpp
new file mode 100644
index 00000000000..9d9e04957ab
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/ContinueFragmented.hpp b/storage/ndb/include/kernel/signaldata/ContinueFragmented.hpp
new file mode 100644
index 00000000000..3d12b9e51eb
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/CopyActive.hpp b/storage/ndb/include/kernel/signaldata/CopyActive.hpp
new file mode 100644
index 00000000000..19b05bda072
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/CopyFrag.hpp b/storage/ndb/include/kernel/signaldata/CopyFrag.hpp
new file mode 100644
index 00000000000..67b935dda64
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/CopyGCIReq.hpp b/storage/ndb/include/kernel/signaldata/CopyGCIReq.hpp
new file mode 100644
index 00000000000..4b401654de3
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/CreateEvnt.hpp b/storage/ndb/include/kernel/signaldata/CreateEvnt.hpp
new file mode 100644
index 00000000000..8712ce8890c
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/CreateEvnt.hpp
@@ -0,0 +1,487 @@
+/* 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 <ndberror.h>
+#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 = 4710,
+ 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) {
+ AttributeMask::assign(m_attrListBitmask.data, 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,
+ TooManyEvents = 4707,
+ EventNameTooLong = 4708,
+ EventNameExists = 746,
+ EventNotFound = 4731,
+ AttributeNullable = 4246,
+ BadRequestType = 4247,
+ InvalidName = 4248,
+ InvalidPrimaryTable = 4249,
+ InvalidEventType = 4250,
+ NotUnique = 4251,
+ AllocationError = 4252,
+ CreateEventTableFailed = 4711,
+ 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/storage/ndb/include/kernel/signaldata/CreateFrag.hpp b/storage/ndb/include/kernel/signaldata/CreateFrag.hpp
new file mode 100644
index 00000000000..a7b3f836353
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/CreateFragmentation.hpp b/storage/ndb/include/kernel/signaldata/CreateFragmentation.hpp
new file mode 100644
index 00000000000..7d53dd91154
--- /dev/null
+++ b/storage/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 = 4 );
+ SECTION( FRAGMENTS = 0 );
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 noOfReplicas;
+ Uint32 noOfFragments;
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/CreateIndx.hpp b/storage/ndb/include/kernel/signaldata/CreateIndx.hpp
new file mode 100644
index 00000000000..a9dc653f349
--- /dev/null
+++ b/storage/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.
+ */
+struct 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,
+ AttributeNullable = 4246,
+ BadRequestType = 4247,
+ InvalidName = 4248,
+ InvalidPrimaryTable = 4249,
+ InvalidIndexType = 4250,
+ NotUnique = 4251,
+ AllocationError = 4252,
+ CreateIndexTableFailed = 4253,
+ DuplicateAttributes = 4258
+ };
+
+ 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;
+ union {
+ Uint32 m_errorNode;
+ Uint32 masterNodeId; // If NotMaster
+ };
+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/storage/ndb/include/kernel/signaldata/CreateTab.hpp b/storage/ndb/include/kernel/signaldata/CreateTab.hpp
new file mode 100644
index 00000000000..b2ef52a6bf7
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/CreateTable.hpp b/storage/ndb/include/kernel/signaldata/CreateTable.hpp
new file mode 100644
index 00000000000..481b323fdb0
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/CreateTable.hpp
@@ -0,0 +1,142 @@
+/* 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,
+ InvalidArraySize = 736,
+ ArraySizeTooBig = 737,
+ RecordTooBig = 738,
+ InvalidPrimaryKeySize = 739,
+ NullablePrimaryKey = 740,
+ InvalidCharset = 743
+ };
+
+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/storage/ndb/include/kernel/signaldata/CreateTrig.hpp b/storage/ndb/include/kernel/signaldata/CreateTrig.hpp
new file mode 100644
index 00000000000..62627256dcf
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/CreateTrig.hpp
@@ -0,0 +1,417 @@
+/* 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,
+ NotMaster = 702,
+ 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;
+ union {
+ Uint32 m_errorNode;
+ Uint32 masterNodeId; // When NotMaster
+ };
+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/storage/ndb/include/kernel/signaldata/DiAddTab.hpp b/storage/ndb/include/kernel/signaldata/DiAddTab.hpp
new file mode 100644
index 00000000000..6b17515eb6f
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/DiGetNodes.hpp b/storage/ndb/include/kernel/signaldata/DiGetNodes.hpp
new file mode 100644
index 00000000000..05ab6bfebb3
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/DictSchemaInfo.hpp b/storage/ndb/include/kernel/signaldata/DictSchemaInfo.hpp
new file mode 100644
index 00000000000..c15dcf2fd7a
--- /dev/null
+++ b/storage/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( HeaderLength = 3 );
+ STATIC_CONST( 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/storage/ndb/include/kernel/signaldata/DictSizeAltReq.hpp b/storage/ndb/include/kernel/signaldata/DictSizeAltReq.hpp
new file mode 100644
index 00000000000..b40f0c8c1af
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/DictStart.hpp b/storage/ndb/include/kernel/signaldata/DictStart.hpp
new file mode 100644
index 00000000000..59310601f48
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/DictTabInfo.hpp b/storage/ndb/include/kernel/signaldata/DictTabInfo.hpp
new file mode 100644
index 00000000000..09b00cf8993
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/DictTabInfo.hpp
@@ -0,0 +1,515 @@
+/* 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>
+
+#ifndef my_decimal_h
+
+// sql/my_decimal.h requires many more sql/*.h new to ndb
+// for now, copy the bit we need TODO proper fix
+
+#define DECIMAL_MAX_LENGTH ((8 * 9) - 8)
+
+#ifndef NOT_FIXED_DEC
+#define NOT_FIXED_DEC 31
+#endif
+
+C_MODE_START
+extern int decimal_bin_size(int, int);
+C_MODE_END
+
+inline int my_decimal_get_binary_size(uint precision, uint scale)
+{
+ return decimal_bin_size((int)precision, (int)scale);
+}
+
+#endif
+
+#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, 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 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
+ 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,
+ FragmentCount = 128, // No of fragments in table (!fragment replicas)
+ FragmentDataLen = 129,
+ FragmentData = 130, // CREATE_FRAGMENTATION reply
+ TableEnd = 999,
+
+ AttributeName = 1000, // String, Mandatory
+ AttributeId = 1001, //Mandatory between DICT's otherwise not allowed
+ AttributeType = 1002, //for osu 4.1->5.0.x
+ AttributeSize = 1003, //Default DictTabInfo::a32Bit
+ AttributeArraySize = 1005, //Default 1
+ AttributeKeyFlag = 1006, //Default noKey
+ AttributeStorage = 1007, //Default MainMemory
+ AttributeNullableFlag = 1008, //Default NotNullable
+ AttributeDKey = 1010, //Default NotDKey
+ AttributeExtType = 1013, //Default ExtUnsigned
+ 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.
+ // ----------------------------------------------------------------------
+
+
+
+ // FragmentType constants
+ enum FragmentType {
+ AllNodesSmallTable = 0,
+ AllNodesMediumTable = 1,
+ AllNodesLargeTable = 2,
+ SingleFragment = 3
+ };
+
+ // 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
+ };
+
+ // AttributeSize constants
+ STATIC_CONST( aBit = 0 );
+ STATIC_CONST( an8Bit = 3 );
+ STATIC_CONST( a16Bit = 4 );
+ STATIC_CONST( a32Bit = 5 );
+ STATIC_CONST( a64Bit = 6 );
+ STATIC_CONST( a128Bit = 7 );
+
+ // Table data interpretation
+ struct Table {
+ char TableName[MAX_TAB_NAME_SIZE];
+ Uint32 TableId;
+ 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 TableType;
+ Uint32 TableVersion;
+ Uint32 IndexState;
+ Uint32 InsertTriggerId;
+ Uint32 UpdateTriggerId;
+ Uint32 DeleteTriggerId;
+ Uint32 CustomTriggerId;
+ Uint32 FrmLen;
+ char FrmData[MAX_FRM_DATA_SIZE];
+ Uint32 FragmentCount;
+ Uint32 FragmentDataLen;
+ Uint16 FragmentData[(MAX_FRAGMENT_DATA_BYTES+1)/2];
+
+ 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,
+ ExtOlddecimal = NdbSqlUtil::Type::Olddecimal,
+ ExtOlddecimalunsigned = NdbSqlUtil::Type::Olddecimalunsigned,
+ ExtDecimal = NdbSqlUtil::Type::Decimal,
+ ExtDecimalunsigned = NdbSqlUtil::Type::Decimalunsigned,
+ ExtChar = NdbSqlUtil::Type::Char,
+ ExtVarchar = NdbSqlUtil::Type::Varchar,
+ ExtBinary = NdbSqlUtil::Type::Binary,
+ ExtVarbinary = NdbSqlUtil::Type::Varbinary,
+ ExtDatetime = NdbSqlUtil::Type::Datetime,
+ ExtDate = NdbSqlUtil::Type::Date,
+ ExtBlob = NdbSqlUtil::Type::Blob,
+ ExtText = NdbSqlUtil::Type::Text,
+ ExtBit = NdbSqlUtil::Type::Bit,
+ ExtLongvarchar = NdbSqlUtil::Type::Longvarchar,
+ ExtLongvarbinary = NdbSqlUtil::Type::Longvarbinary,
+ ExtTime = NdbSqlUtil::Type::Time,
+ ExtYear = NdbSqlUtil::Type::Year,
+ ExtTimestamp = NdbSqlUtil::Type::Timestamp
+ };
+
+ // Attribute data interpretation
+ struct Attribute {
+ char AttributeName[MAX_TAB_NAME_SIZE];
+ Uint32 AttributeId;
+ Uint32 AttributeType; // for osu 4.1->5.0.x
+ Uint32 AttributeSize;
+ Uint32 AttributeArraySize;
+ Uint32 AttributeKeyFlag;
+ Uint32 AttributeNullableFlag;
+ Uint32 AttributeDKey;
+ 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;
+ }
+
+ // compute old-sty|e attribute size and array size
+ inline bool
+ translateExtType() {
+ switch (AttributeExtType) {
+ case DictTabInfo::ExtUndefined:
+ return false;
+ case DictTabInfo::ExtTinyint:
+ case DictTabInfo::ExtTinyunsigned:
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = AttributeExtLength;
+ break;
+ case DictTabInfo::ExtSmallint:
+ case DictTabInfo::ExtSmallunsigned:
+ AttributeSize = DictTabInfo::a16Bit;
+ AttributeArraySize = AttributeExtLength;
+ break;
+ case DictTabInfo::ExtMediumint:
+ case DictTabInfo::ExtMediumunsigned:
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 3 * AttributeExtLength;
+ break;
+ case DictTabInfo::ExtInt:
+ case DictTabInfo::ExtUnsigned:
+ AttributeSize = DictTabInfo::a32Bit;
+ AttributeArraySize = AttributeExtLength;
+ break;
+ case DictTabInfo::ExtBigint:
+ case DictTabInfo::ExtBigunsigned:
+ AttributeSize = DictTabInfo::a64Bit;
+ AttributeArraySize = AttributeExtLength;
+ break;
+ case DictTabInfo::ExtFloat:
+ AttributeSize = DictTabInfo::a32Bit;
+ AttributeArraySize = AttributeExtLength;
+ break;
+ case DictTabInfo::ExtDouble:
+ AttributeSize = DictTabInfo::a64Bit;
+ AttributeArraySize = AttributeExtLength;
+ break;
+ case DictTabInfo::ExtOlddecimal:
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize =
+ (1 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) *
+ AttributeExtLength;
+ break;
+ case DictTabInfo::ExtOlddecimalunsigned:
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize =
+ (0 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) *
+ AttributeExtLength;
+ break;
+ case DictTabInfo::ExtDecimal:
+ case DictTabInfo::ExtDecimalunsigned:
+ {
+ // copy from Field_new_decimal ctor
+ uint precision = AttributeExtPrecision;
+ uint scale = AttributeExtScale;
+ if (precision > DECIMAL_MAX_LENGTH || scale >= NOT_FIXED_DEC)
+ precision = DECIMAL_MAX_LENGTH;
+ uint bin_size = my_decimal_get_binary_size(precision, scale);
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = bin_size * AttributeExtLength;
+ }
+ break;
+ case DictTabInfo::ExtChar:
+ case DictTabInfo::ExtBinary:
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = AttributeExtLength;
+ break;
+ case DictTabInfo::ExtVarchar:
+ case DictTabInfo::ExtVarbinary:
+ if (AttributeExtLength > 0xff)
+ return false;
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = AttributeExtLength + 1;
+ break;
+ case DictTabInfo::ExtDatetime:
+ // to fix
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 8 * AttributeExtLength;
+ break;
+ case DictTabInfo::ExtDate:
+ // to fix
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 3 * AttributeExtLength;
+ break;
+ case DictTabInfo::ExtBlob:
+ case DictTabInfo::ExtText:
+ AttributeSize = DictTabInfo::an8Bit;
+ // head + inline part (length in precision lower half)
+ AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF);
+ break;
+ case DictTabInfo::ExtBit:
+ AttributeSize = DictTabInfo::aBit;
+ AttributeArraySize = AttributeExtLength;
+ break;
+ case DictTabInfo::ExtLongvarchar:
+ case DictTabInfo::ExtLongvarbinary:
+ if (AttributeExtLength > 0xffff)
+ return false;
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = AttributeExtLength + 2;
+ break;
+ case DictTabInfo::ExtTime:
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 3 * AttributeExtLength;
+ break;
+ case DictTabInfo::ExtYear:
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 1 * AttributeExtLength;
+ break;
+ case DictTabInfo::ExtTimestamp:
+ AttributeSize = DictTabInfo::an8Bit;
+ AttributeArraySize = 4 * AttributeExtLength;
+ break;
+ default:
+ return false;
+ };
+ return true;
+ }
+
+ 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, "AttributeDKey = %d\n", AttributeDKey);
+ 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];
+
+public:
+ enum Depricated
+ {
+ AttributeDGroup = 1009, //Default NotDGroup
+ AttributeStoredInd = 1011, //Default NotStored
+ SecondTableId = 17, //Mandatory between DICT's otherwise not allowed
+ FragmentKeyTypeVal = 16 //Default PrimaryKey
+ };
+
+ enum Unimplemented
+ {
+ TableStorageVal = 14, //Default StorageType::MainMemory
+ ScanOptimised = 15, //Default updateOptimised
+ AttributeGroup = 1012 //Default 0
+ };
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/DihAddFrag.hpp b/storage/ndb/include/kernel/signaldata/DihAddFrag.hpp
new file mode 100644
index 00000000000..6e5a24ee413
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/DihContinueB.hpp b/storage/ndb/include/kernel/signaldata/DihContinueB.hpp
new file mode 100644
index 00000000000..77ecf360601
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/DihContinueB.hpp
@@ -0,0 +1,76 @@
+/* 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, Uint16);
+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/storage/ndb/include/kernel/signaldata/DihSizeAltReq.hpp b/storage/ndb/include/kernel/signaldata/DihSizeAltReq.hpp
new file mode 100644
index 00000000000..73279447859
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/DihStartTab.hpp b/storage/ndb/include/kernel/signaldata/DihStartTab.hpp
new file mode 100644
index 00000000000..75443e6070e
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/DihSwitchReplica.hpp b/storage/ndb/include/kernel/signaldata/DihSwitchReplica.hpp
new file mode 100644
index 00000000000..d4212f510f3
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/DisconnectRep.hpp b/storage/ndb/include/kernel/signaldata/DisconnectRep.hpp
new file mode 100644
index 00000000000..d7fcdc4fb35
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/DropIndx.hpp b/storage/ndb/include/kernel/signaldata/DropIndx.hpp
new file mode 100644
index 00000000000..fd2ea7f0b7b
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/DropIndx.hpp
@@ -0,0 +1,255 @@
+/* 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.
+ */
+struct DropIndxRef {
+ friend bool printDROP_INDX_REF(FILE*, const Uint32*, Uint32, Uint16);
+
+public:
+ enum ErrorCode {
+ NoError = 0,
+ InvalidIndexVersion = 241,
+ Busy = 701,
+ NotMaster = 702,
+ IndexNotFound = 4243,
+ BadRequestType = 4247,
+ InvalidName = 4248,
+ NotAnIndex = 4254
+ };
+ STATIC_CONST( SignalLength = DropIndxConf::SignalLength + 3 );
+
+ 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;
+ union {
+ Uint32 m_errorNode;
+ Uint32 masterNodeId;
+ };
+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/storage/ndb/include/kernel/signaldata/DropTab.hpp b/storage/ndb/include/kernel/signaldata/DropTab.hpp
new file mode 100644
index 00000000000..dd3946d8cc0
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/DropTab.hpp
@@ -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 */
+
+#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,
+ NF_FakeErrorREF = 5
+ };
+
+private:
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 tableId;
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/DropTabFile.hpp b/storage/ndb/include/kernel/signaldata/DropTabFile.hpp
new file mode 100644
index 00000000000..9ae4dae41c1
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/DropTable.hpp b/storage/ndb/include/kernel/signaldata/DropTable.hpp
new file mode 100644
index 00000000000..7a5b96e4cd1
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/DropTrig.hpp b/storage/ndb/include/kernel/signaldata/DropTrig.hpp
new file mode 100644
index 00000000000..7c5049f3de8
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp b/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp
new file mode 100644
index 00000000000..7368a0ec40d
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/DumpStateOrd.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 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,
+ TcSetApplTransactionTimeout = 2508,
+ StartTcTimer = 2509,
+ StopTcTimer = 2510,
+ StartPeriodicTcTimer = 2511,
+ 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/storage/ndb/include/kernel/signaldata/EmptyLcp.hpp b/storage/ndb/include/kernel/signaldata/EmptyLcp.hpp
new file mode 100644
index 00000000000..32ea6c13231
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/EndTo.hpp b/storage/ndb/include/kernel/signaldata/EndTo.hpp
new file mode 100644
index 00000000000..944cca3ca98
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/EventReport.hpp b/storage/ndb/include/kernel/signaldata/EventReport.hpp
new file mode 100644
index 00000000000..9822a0539cf
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/EventReport.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 SD_EVENT_REPORT_H
+#define SD_EVENT_REPORT_H
+
+#include <ndb_logevent.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()
+
+ */
+ void setEventType(Ndb_logevent_type type);
+ Ndb_logevent_type getEventType() const;
+ UintR eventType; // DATA 0
+};
+
+inline
+void
+EventReport::setEventType(Ndb_logevent_type type){
+ eventType = (UintR) type;
+}
+
+inline
+Ndb_logevent_type
+EventReport::getEventType() const {
+ return (Ndb_logevent_type)eventType;
+}
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/EventSubscribeReq.hpp b/storage/ndb/include/kernel/signaldata/EventSubscribeReq.hpp
new file mode 100644
index 00000000000..84a1717b1de
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/EventSubscribeReq.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 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
+ */
+
+struct EventSubscribeReq {
+ /**
+ * Receiver(s)
+ */
+ friend class Cmvmi;
+
+ /**
+ * Sender(s)
+ */
+ friend class MgmtSrvr;
+
+ STATIC_CONST( SignalLength = 2 + LogLevel::LOGLEVEL_CATEGORIES );
+
+ /**
+ * 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 theData[LogLevel::LOGLEVEL_CATEGORIES];
+
+ EventSubscribeReq& operator= (const LogLevel& ll){
+ noOfEntries = LogLevel::LOGLEVEL_CATEGORIES;
+ for(size_t i = 0; i<noOfEntries; i++){
+ theData[i] = (i << 16) | ll.getLogLevel((LogLevel::EventCategory)i);
+ }
+ return * this;
+ }
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/ExecFragReq.hpp b/storage/ndb/include/kernel/signaldata/ExecFragReq.hpp
new file mode 100644
index 00000000000..e40213d6e29
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/FailRep.hpp b/storage/ndb/include/kernel/signaldata/FailRep.hpp
new file mode 100644
index 00000000000..44577f07fdc
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/FireTrigOrd.hpp b/storage/ndb/include/kernel/signaldata/FireTrigOrd.hpp
new file mode 100644
index 00000000000..20a0a863094
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/FsAppendReq.hpp b/storage/ndb/include/kernel/signaldata/FsAppendReq.hpp
new file mode 100644
index 00000000000..e2fd61f8a11
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/FsCloseReq.hpp b/storage/ndb/include/kernel/signaldata/FsCloseReq.hpp
new file mode 100644
index 00000000000..10d094fb30b
--- /dev/null
+++ b/storage/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)
+ fileflag = 1;
+ else
+ fileflag = 0;
+}
+
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/FsConf.hpp b/storage/ndb/include/kernel/signaldata/FsConf.hpp
new file mode 100644
index 00000000000..f66d9feea49
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/FsOpenReq.hpp b/storage/ndb/include/kernel/signaldata/FsOpenReq.hpp
new file mode 100644
index 00000000000..906bb947128
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/FsOpenReq.hpp
@@ -0,0 +1,267 @@
+/* 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...
+ friend class Dbdih;
+
+ /**
+ * 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/storage/ndb/include/kernel/signaldata/FsReadWriteReq.hpp b/storage/ndb/include/kernel/signaldata/FsReadWriteReq.hpp
new file mode 100644
index 00000000000..6e4fa4d260e
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/FsRef.hpp b/storage/ndb/include/kernel/signaldata/FsRef.hpp
new file mode 100644
index 00000000000..650f6520fb5
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/FsRemoveReq.hpp b/storage/ndb/include/kernel/signaldata/FsRemoveReq.hpp
new file mode 100644
index 00000000000..efb566d883a
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/GCPSave.hpp b/storage/ndb/include/kernel/signaldata/GCPSave.hpp
new file mode 100644
index 00000000000..2b4a25e6bb2
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/GetTabInfo.hpp b/storage/ndb/include/kernel/signaldata/GetTabInfo.hpp
new file mode 100644
index 00000000000..cb6e38872d3
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/GetTableId.hpp b/storage/ndb/include/kernel/signaldata/GetTableId.hpp
new file mode 100644
index 00000000000..fb91c2e10d7
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/GrepImpl.hpp b/storage/ndb/include/kernel/signaldata/GrepImpl.hpp
new file mode 100644
index 00000000000..95b93df0a58
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/HotSpareRep.hpp b/storage/ndb/include/kernel/signaldata/HotSpareRep.hpp
new file mode 100644
index 00000000000..fb9d338be1b
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/IndxAttrInfo.hpp b/storage/ndb/include/kernel/signaldata/IndxAttrInfo.hpp
new file mode 100755
index 00000000000..ec5790d84f3
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/IndxKeyInfo.hpp b/storage/ndb/include/kernel/signaldata/IndxKeyInfo.hpp
new file mode 100755
index 00000000000..7cd7795ec71
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/InvalidateNodeLCPConf.hpp b/storage/ndb/include/kernel/signaldata/InvalidateNodeLCPConf.hpp
new file mode 100644
index 00000000000..2497af354ce
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/InvalidateNodeLCPReq.hpp b/storage/ndb/include/kernel/signaldata/InvalidateNodeLCPReq.hpp
new file mode 100644
index 00000000000..e55a58710b4
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/KeyInfo.hpp b/storage/ndb/include/kernel/signaldata/KeyInfo.hpp
new file mode 100644
index 00000000000..686f3ae053d
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/KeyInfo.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 KEY_INFO_HPP
+#define KEY_INFO_HPP
+
+#include "SignalData.hpp"
+
+class KeyInfo {
+ /**
+ * Sender(s)
+ */
+ friend class DbUtil;
+ friend class NdbOperation;
+ friend class NdbScanOperation;
+ friend class NdbIndexScanOperation;
+
+ /**
+ * 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/storage/ndb/include/kernel/signaldata/LCP.hpp b/storage/ndb/include/kernel/signaldata/LCP.hpp
new file mode 100644
index 00000000000..7d3fb71ae7e
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/ListTables.hpp b/storage/ndb/include/kernel/signaldata/ListTables.hpp
new file mode 100644
index 00000000000..7fbfab1294c
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/LqhFrag.hpp b/storage/ndb/include/kernel/signaldata/LqhFrag.hpp
new file mode 100644
index 00000000000..13dfafcc653
--- /dev/null
+++ b/storage/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; // noOfCharsets in upper half
+ 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/storage/ndb/include/kernel/signaldata/LqhKey.hpp b/storage/ndb/include/kernel/signaldata/LqhKey.hpp
new file mode 100644
index 00000000000..e937180e3f7
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/LqhSizeAltReq.hpp b/storage/ndb/include/kernel/signaldata/LqhSizeAltReq.hpp
new file mode 100644
index 00000000000..e47ce39897a
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/LqhTransConf.hpp b/storage/ndb/include/kernel/signaldata/LqhTransConf.hpp
new file mode 100644
index 00000000000..f62dfd07f51
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/ManagementServer.hpp b/storage/ndb/include/kernel/signaldata/ManagementServer.hpp
new file mode 100644
index 00000000000..ce14e30c81d
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/MasterGCP.hpp b/storage/ndb/include/kernel/signaldata/MasterGCP.hpp
new file mode 100644
index 00000000000..ebe6857a107
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/MasterLCP.hpp b/storage/ndb/include/kernel/signaldata/MasterLCP.hpp
new file mode 100644
index 00000000000..bf84ac73309
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/NFCompleteRep.hpp b/storage/ndb/include/kernel/signaldata/NFCompleteRep.hpp
new file mode 100644
index 00000000000..c8bde705a86
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/NdbSttor.hpp b/storage/ndb/include/kernel/signaldata/NdbSttor.hpp
new file mode 100644
index 00000000000..edd93ef96a8
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/NdbfsContinueB.hpp b/storage/ndb/include/kernel/signaldata/NdbfsContinueB.hpp
new file mode 100644
index 00000000000..6154e5c19b1
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/NdbfsContinueB.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 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, Uint16);
+private:
+ enum {
+ ZSCAN_MEMORYCHANNEL_10MS_DELAY = 0,
+ ZSCAN_MEMORYCHANNEL_NO_DELAY = 1
+ };
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/NextScan.hpp b/storage/ndb/include/kernel/signaldata/NextScan.hpp
new file mode 100644
index 00000000000..3a1882f94e8
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/NodeFailRep.hpp b/storage/ndb/include/kernel/signaldata/NodeFailRep.hpp
new file mode 100644
index 00000000000..060acd6a3e2
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/NodeStateSignalData.hpp b/storage/ndb/include/kernel/signaldata/NodeStateSignalData.hpp
new file mode 100644
index 00000000000..391d8f89566
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/PackedSignal.hpp b/storage/ndb/include/kernel/signaldata/PackedSignal.hpp
new file mode 100644
index 00000000000..ea0ff6db526
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/PrepDropTab.hpp b/storage/ndb/include/kernel/signaldata/PrepDropTab.hpp
new file mode 100644
index 00000000000..c54b2474aa3
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/PrepDropTab.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 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,
+ NF_FakeErrorREF = 5
+ };
+
+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,
+ NF_FakeErrorREF = 4
+ };
+
+ 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/storage/ndb/include/kernel/signaldata/PrepFailReqRef.hpp b/storage/ndb/include/kernel/signaldata/PrepFailReqRef.hpp
new file mode 100644
index 00000000000..90b568237b8
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/ReadConfig.hpp b/storage/ndb/include/kernel/signaldata/ReadConfig.hpp
new file mode 100644
index 00000000000..0835b252a32
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/ReadConfig.hpp
@@ -0,0 +1,24 @@
+#ifndef READ_CONFIG_HPP
+#define READ_CONFIG_HPP
+
+/**
+ */
+class ReadConfigReq {
+public:
+ STATIC_CONST( SignalLength = 3 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 noOfParameters; // 0 Means read all relevant for block
+ Uint32 parameters[1]; // see mgmapi_config_parameters.h
+};
+
+class ReadConfigConf {
+public:
+ STATIC_CONST( SignalLength = 2 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/ReadNodesConf.hpp b/storage/ndb/include/kernel/signaldata/ReadNodesConf.hpp
new file mode 100644
index 00000000000..0507007f71a
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/ReadNodesConf.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 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;
+
+ friend bool printREAD_NODES_CONF(FILE*, const Uint32 *, Uint32, Uint16);
+public:
+ STATIC_CONST( SignalLength = 3 + 5*NdbNodeBitmask::Size );
+private:
+
+ Uint32 noOfNodes;
+ Uint32 ndynamicId;
+
+ /**
+ *
+ * NOTE Not valid when send from Qmgr
+ */
+ Uint32 masterNodeId;
+
+ /**
+ * This array defines all the ndb nodes in the system
+ */
+ union {
+ Uint32 allNodes[NdbNodeBitmask::Size];
+ Uint32 definedNodes[NdbNodeBitmask::Size];
+ };
+
+ /**
+ * This array describes wheather the nodes are currently active
+ *
+ * NOTE Not valid when send from Qmgr
+ */
+ Uint32 inactiveNodes[NdbNodeBitmask::Size];
+
+ Uint32 clusterNodes[NdbNodeBitmask::Size]; // From Qmgr
+ Uint32 startingNodes[NdbNodeBitmask::Size]; // From Cntr
+ Uint32 startedNodes[NdbNodeBitmask::Size]; // From Cntr
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/RelTabMem.hpp b/storage/ndb/include/kernel/signaldata/RelTabMem.hpp
new file mode 100644
index 00000000000..9cf1787bba4
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/RepImpl.hpp b/storage/ndb/include/kernel/signaldata/RepImpl.hpp
new file mode 100644
index 00000000000..0de1389a4a9
--- /dev/null
+++ b/storage/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::GE_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::GE_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::GE_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::GE_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::GE_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::GE_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/storage/ndb/include/kernel/signaldata/ResumeReq.hpp b/storage/ndb/include/kernel/signaldata/ResumeReq.hpp
new file mode 100644
index 00000000000..a4880474ca8
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/ScanFrag.hpp b/storage/ndb/include/kernel/signaldata/ScanFrag.hpp
new file mode 100644
index 00000000000..e4b774f1416
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/ScanFrag.hpp
@@ -0,0 +1,348 @@
+/* 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 = 12 );
+
+ friend bool printSCAN_FRAGREQ(FILE *, const Uint32*, Uint32, Uint16);
+
+public:
+ Uint32 senderData;
+ Uint32 resultRef; // Where to send the result
+ Uint32 savePointId;
+ Uint32 requestInfo;
+ Uint32 tableId;
+ Uint32 fragmentNoKeyLen;
+ Uint32 schemaVersion;
+ Uint32 transId1;
+ Uint32 transId2;
+ Uint32 clientOpPtr;
+ Uint32 batch_size_rows;
+ Uint32 batch_size_bytes;
+
+ 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 getDescendingFlag(const Uint32 & requestInfo);
+ static Uint32 getAttrLen(const Uint32 & requestInfo);
+ static Uint32 getScanPrio(const Uint32 & requestInfo);
+
+ 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 setDescendingFlag(Uint32 & requestInfo, Uint32 descending);
+ 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( 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 = 6 );
+
+public:
+ Uint32 senderData;
+ Uint32 completedOps;
+ Uint32 fragmentCompleted;
+ Uint32 transId1;
+ Uint32 transId2;
+ Uint32 total_len;
+};
+
+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,
+ ZWRONG_BATCH_SIZE = 1230,
+ 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 = 6 );
+
+public:
+ Uint32 senderData;
+ Uint32 closeFlag;
+ Uint32 transId1;
+ Uint32 transId2;
+ Uint32 batch_size_rows;
+ Uint32 batch_size_bytes;
+};
+
+/**
+ * Request Info
+ *
+ * a = Length of attrinfo - 16 Bits (16-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
+ * z = descending - 1 Bit 10
+ * p = Scan prio - 4 Bits (12-15) -> max 15
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * lxhkrz ppppaaaaaaaaaaaaaaaa
+ */
+#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_DESCENDING_SHIFT (10)
+
+#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::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::getDescendingFlag(const Uint32 & requestInfo){
+ return (requestInfo >> SF_DESCENDING_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::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::setDescendingFlag(UintR & requestInfo, UintR val){
+ ASSERT_BOOL(val, "ScanFragReq::setDescendingFlag");
+ requestInfo |= (val << SF_DESCENDING_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, 1023, "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) & 0x3FF;
+}
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/ScanTab.hpp b/storage/ndb/include/kernel/signaldata/ScanTab.hpp
new file mode 100644
index 00000000000..894f973145c
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/ScanTab.hpp
@@ -0,0 +1,424 @@
+/* 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 NdbTransaction;
+ friend class NdbScanOperation;
+ friend class NdbIndexScanOperation;
+
+ /**
+ * For printing
+ */
+ friend bool printSCANTABREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( StaticLength = 11 );
+
+private:
+
+ // Type definitions
+
+ /**
+ * DATA VARIABLES
+ */
+ UintR apiConnectPtr; // DATA 0
+ UintR attrLenKeyLen; // 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 batch_byte_size; // DATA 9
+ UintR first_batch_size; // DATA 10
+
+ /**
+ * Optional
+ */
+ Uint32 distributionKey;
+
+ /**
+ * 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);
+ static Uint8 getDescendingFlag(const UintR & requestInfo);
+ static Uint8 getKeyinfoFlag(const UintR & requestInfo);
+ static Uint16 getScanBatch(const UintR & requestInfo);
+ static Uint8 getDistributionKeyFlag(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);
+ static void setDescendingFlag(UintR & requestInfo, Uint32 flag);
+ static void setKeyinfoFlag(UintR & requestInfo, Uint32 flag);
+ static void setScanBatch(Uint32& requestInfo, Uint32 sz);
+ static void setDistributionKeyFlag(Uint32& 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
+ k = Keyinfo - 1 Bit 12
+ z = Descending (TUX) - 1 Bit 14
+ x = Range Scan (TUX) - 1 Bit 15
+ b = Scan batch - 10 Bit 16-25 (max 1023)
+ d = Distribution key flag
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+ ppppppppl hck zxbbbbbbbbbb
+*/
+
+#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 KEYINFO_SHIFT (12)
+#define KEYINFO_MASK (1)
+
+#define READ_COMMITTED_SHIFT (11)
+#define READ_COMMITTED_MASK (1)
+
+#define RANGE_SCAN_SHIFT (15)
+#define RANGE_SCAN_MASK (1)
+
+#define DESCENDING_SHIFT (14)
+#define DESCENDING_MASK (1)
+
+#define SCAN_BATCH_SHIFT (16)
+#define SCAN_BATCH_MASK (1023)
+
+#define SCAN_DISTR_KEY_SHIFT (26)
+
+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
+Uint8
+ScanTabReq::getDescendingFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> DESCENDING_SHIFT) & DESCENDING_MASK);
+}
+
+inline
+Uint16
+ScanTabReq::getScanBatch(const Uint32 & requestInfo){
+ return (Uint16)((requestInfo >> SCAN_BATCH_SHIFT) & SCAN_BATCH_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);
+}
+
+inline
+void
+ScanTabReq::setDescendingFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "ScanTabReq::setDescendingFlag");
+ requestInfo |= (flag << DESCENDING_SHIFT);
+}
+
+inline
+void
+ScanTabReq::setScanBatch(Uint32 & requestInfo, Uint32 flag){
+ ASSERT_MAX(flag, SCAN_BATCH_MASK, "ScanTabReq::setScanBatch");
+ requestInfo &= ~(SCAN_BATCH_MASK << SCAN_BATCH_SHIFT);
+ requestInfo |= (flag << SCAN_BATCH_SHIFT);
+}
+
+inline
+Uint8
+ScanTabReq::getKeyinfoFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> KEYINFO_SHIFT) & KEYINFO_MASK);
+}
+
+inline
+void
+ScanTabReq::setKeyinfoFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "ScanTabReq::setKeyinfoFlag");
+ requestInfo |= (flag << KEYINFO_SHIFT);
+}
+
+inline
+Uint8
+ScanTabReq::getDistributionKeyFlag(const UintR & requestInfo){
+ return (Uint8)((requestInfo >> SCAN_DISTR_KEY_SHIFT) & 1);
+}
+
+inline
+void
+ScanTabReq::setDistributionKeyFlag(UintR & requestInfo, Uint32 flag){
+ ASSERT_BOOL(flag, "ScanTabReq::setKeyinfoFlag");
+ requestInfo |= (flag << SCAN_DISTR_KEY_SHIFT);
+}
+
+/**
+ *
+ * SENDER: Dbtc
+ * RECIVER: API
+ */
+class ScanTabConf {
+ /**
+ * Reciver(s)
+ */
+ friend class NdbTransaction; // 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 );
+ STATIC_CONST( EndOfData = (1 << 31) );
+
+private:
+
+ // Type definitions
+
+ /**
+ * DATA VARIABLES
+ */
+ UintR apiConnectPtr; // DATA 0
+ UintR requestInfo; // DATA 1
+ UintR transId1; // DATA 2
+ UintR transId2; // DATA 3
+
+ struct OpData {
+ Uint32 apiPtrI;
+ Uint32 tcPtrI;
+ Uint32 info;
+ };
+
+ static Uint32 getLength(Uint32 opDataInfo) { return opDataInfo >> 10; };
+ static Uint32 getRows(Uint32 opDataInfo) { return opDataInfo & 1023;}
+};
+
+/**
+ * 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)
+
+
+/**
+ *
+ * SENDER: Dbtc
+ * RECIVER: API
+ */
+class ScanTabRef {
+ /**
+ * Reciver(s)
+ */
+ friend class NdbTransaction; // 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 = 5 );
+
+private:
+
+ // Type definitions
+
+ /**
+ * DATA VARIABLES
+ */
+ UintR apiConnectPtr; // DATA 0
+ UintR transId1; // DATA 1
+ UintR transId2; // DATA 2
+ UintR errorCode; // DATA 3
+ UintR closeNeeded; // 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/storage/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp b/storage/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp
new file mode 100644
index 00000000000..2923029f8f6
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/SetLogLevelOrd.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 SET_LOGLEVEL_ORD_HPP
+#define SET_LOGLEVEL_ORD_HPP
+
+#include <LogLevel.hpp>
+#include "EventSubscribeReq.hpp"
+#include "SignalData.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 = 1 + LogLevel::LOGLEVEL_CATEGORIES );
+
+ Uint32 noOfEntries;
+ Uint32 theData[LogLevel::LOGLEVEL_CATEGORIES];
+
+ void clear();
+
+ /**
+ * Note level is valid as 0-15
+ */
+ void setLogLevel(LogLevel::EventCategory ec, int level = 7);
+
+ SetLogLevelOrd& operator= (const LogLevel& ll){
+ noOfEntries = LogLevel::LOGLEVEL_CATEGORIES;
+ for(size_t i = 0; i<noOfEntries; i++){
+ theData[i] = (i << 16) | ll.getLogLevel((LogLevel::EventCategory)i);
+ }
+ return * this;
+ }
+
+ SetLogLevelOrd& operator= (const EventSubscribeReq& ll){
+ noOfEntries = ll.noOfEntries;
+ for(size_t i = 0; i<noOfEntries; i++){
+ theData[i] = ll.theData[i];
+ }
+ return * this;
+ }
+};
+
+inline
+void
+SetLogLevelOrd::clear(){
+ noOfEntries = 0;
+}
+
+inline
+void
+SetLogLevelOrd::setLogLevel(LogLevel::EventCategory ec, int level){
+ theData[noOfEntries] = (ec << 16) | level;
+ noOfEntries++;
+}
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/SetVarReq.hpp b/storage/ndb/include/kernel/signaldata/SetVarReq.hpp
new file mode 100644
index 00000000000..8cb3e78be8b
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/SignalData.hpp b/storage/ndb/include/kernel/signaldata/SignalData.hpp
new file mode 100644
index 00000000000..f825b0feb7b
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/SignalData.hpp
@@ -0,0 +1,226 @@
+/* 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_global.h>
+#include <kernel/ndb_limits.h>
+#include <kernel/kernel_types.h>
+#include <BaseString.hpp>
+
+#define ASSERT_BOOL(flag, message) assert(flag<=1)
+#define ASSERT_RANGE(value, min, max, message) \
+ assert((value) >= (min) && (value) <= (max))
+#define ASSERT_MAX(value, max, message) assert((value) <= (max))
+
+#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; };
+
+#define GSN_PRINT_SIGNATURE(f) bool f(FILE *, const Uint32 *, Uint32, Uint16)
+
+GSN_PRINT_SIGNATURE(printTCKEYREQ);
+GSN_PRINT_SIGNATURE(printTCKEYCONF);
+GSN_PRINT_SIGNATURE(printTCKEYREF);
+GSN_PRINT_SIGNATURE(printLQHKEYREQ);
+GSN_PRINT_SIGNATURE(printLQHKEYCONF);
+GSN_PRINT_SIGNATURE(printLQHKEYREF);
+GSN_PRINT_SIGNATURE(printTUPKEYREQ);
+GSN_PRINT_SIGNATURE(printTUPKEYCONF);
+GSN_PRINT_SIGNATURE(printTUPKEYREF);
+GSN_PRINT_SIGNATURE(printTUPCOMMITREQ);
+GSN_PRINT_SIGNATURE(printCONTINUEB);
+GSN_PRINT_SIGNATURE(printFSOPENREQ);
+GSN_PRINT_SIGNATURE(printFSCLOSEREQ);
+GSN_PRINT_SIGNATURE(printFSREADWRITEREQ);
+GSN_PRINT_SIGNATURE(printFSREADWRITEREQ);
+GSN_PRINT_SIGNATURE(printFSREF);
+GSN_PRINT_SIGNATURE(printFSREF);
+GSN_PRINT_SIGNATURE(printFSREF);
+GSN_PRINT_SIGNATURE(printFSREF);
+GSN_PRINT_SIGNATURE(printFSREF);
+GSN_PRINT_SIGNATURE(printFSCONF);
+GSN_PRINT_SIGNATURE(printFSCONF);
+GSN_PRINT_SIGNATURE(printFSCONF);
+GSN_PRINT_SIGNATURE(printFSCONF);
+GSN_PRINT_SIGNATURE(printFSCONF);
+GSN_PRINT_SIGNATURE(printCLOSECOMREQCONF);
+GSN_PRINT_SIGNATURE(printCLOSECOMREQCONF);
+GSN_PRINT_SIGNATURE(printPACKED_SIGNAL);
+GSN_PRINT_SIGNATURE(printPREPFAILREQREF);
+GSN_PRINT_SIGNATURE(printPREPFAILREQREF);
+GSN_PRINT_SIGNATURE(printALTER_TABLE_REQ);
+GSN_PRINT_SIGNATURE(printALTER_TABLE_CONF);
+GSN_PRINT_SIGNATURE(printALTER_TABLE_REF);
+GSN_PRINT_SIGNATURE(printALTER_TAB_REQ);
+GSN_PRINT_SIGNATURE(printALTER_TAB_CONF);
+GSN_PRINT_SIGNATURE(printALTER_TAB_REF);
+GSN_PRINT_SIGNATURE(printCREATE_TRIG_REQ);
+GSN_PRINT_SIGNATURE(printCREATE_TRIG_CONF);
+GSN_PRINT_SIGNATURE(printCREATE_TRIG_REF);
+GSN_PRINT_SIGNATURE(printALTER_TRIG_REQ);
+GSN_PRINT_SIGNATURE(printALTER_TRIG_CONF);
+GSN_PRINT_SIGNATURE(printALTER_TRIG_REF);
+GSN_PRINT_SIGNATURE(printDROP_TRIG_REQ);
+GSN_PRINT_SIGNATURE(printDROP_TRIG_CONF);
+GSN_PRINT_SIGNATURE(printDROP_TRIG_REF);
+GSN_PRINT_SIGNATURE(printFIRE_TRIG_ORD);
+GSN_PRINT_SIGNATURE(printTRIG_ATTRINFO);
+GSN_PRINT_SIGNATURE(printCREATE_INDX_REQ);
+GSN_PRINT_SIGNATURE(printCREATE_INDX_CONF);
+GSN_PRINT_SIGNATURE(printCREATE_INDX_REF);
+GSN_PRINT_SIGNATURE(printDROP_INDX_REQ);
+GSN_PRINT_SIGNATURE(printDROP_INDX_CONF);
+GSN_PRINT_SIGNATURE(printDROP_INDX_REF);
+GSN_PRINT_SIGNATURE(printALTER_INDX_REQ);
+GSN_PRINT_SIGNATURE(printALTER_INDX_CONF);
+GSN_PRINT_SIGNATURE(printALTER_INDX_REF);
+GSN_PRINT_SIGNATURE(printTCINDXREQ);
+GSN_PRINT_SIGNATURE(printTCINDXCONF);
+GSN_PRINT_SIGNATURE(printTCINDXREF);
+GSN_PRINT_SIGNATURE(printINDXKEYINFO);
+GSN_PRINT_SIGNATURE(printINDXATTRINFO);
+GSN_PRINT_SIGNATURE(printFSAPPENDREQ);
+GSN_PRINT_SIGNATURE(printBACKUP_REQ);
+GSN_PRINT_SIGNATURE(printBACKUP_DATA);
+GSN_PRINT_SIGNATURE(printBACKUP_REF);
+GSN_PRINT_SIGNATURE(printBACKUP_CONF);
+GSN_PRINT_SIGNATURE(printABORT_BACKUP_ORD);
+GSN_PRINT_SIGNATURE(printBACKUP_ABORT_REP);
+GSN_PRINT_SIGNATURE(printBACKUP_COMPLETE_REP);
+GSN_PRINT_SIGNATURE(printBACKUP_NF_COMPLETE_REP);
+GSN_PRINT_SIGNATURE(printDEFINE_BACKUP_REQ);
+GSN_PRINT_SIGNATURE(printDEFINE_BACKUP_REF);
+GSN_PRINT_SIGNATURE(printDEFINE_BACKUP_CONF);
+GSN_PRINT_SIGNATURE(printSTART_BACKUP_REQ);
+GSN_PRINT_SIGNATURE(printSTART_BACKUP_REF);
+GSN_PRINT_SIGNATURE(printSTART_BACKUP_CONF);
+GSN_PRINT_SIGNATURE(printBACKUP_FRAGMENT_REQ);
+GSN_PRINT_SIGNATURE(printBACKUP_FRAGMENT_REF);
+GSN_PRINT_SIGNATURE(printBACKUP_FRAGMENT_CONF);
+GSN_PRINT_SIGNATURE(printSTOP_BACKUP_REQ);
+GSN_PRINT_SIGNATURE(printSTOP_BACKUP_REF);
+GSN_PRINT_SIGNATURE(printSTOP_BACKUP_CONF);
+GSN_PRINT_SIGNATURE(printBACKUP_STATUS_REQ);
+GSN_PRINT_SIGNATURE(printBACKUP_STATUS_CONF);
+GSN_PRINT_SIGNATURE(printUTIL_SEQUENCE_REQ);
+GSN_PRINT_SIGNATURE(printUTIL_SEQUENCE_REF);
+GSN_PRINT_SIGNATURE(printUTIL_SEQUENCE_CONF);
+GSN_PRINT_SIGNATURE(printUTIL_PREPARE_REQ);
+GSN_PRINT_SIGNATURE(printUTIL_PREPARE_REF);
+GSN_PRINT_SIGNATURE(printUTIL_PREPARE_CONF);
+GSN_PRINT_SIGNATURE(printUTIL_EXECUTE_REQ);
+GSN_PRINT_SIGNATURE(printUTIL_EXECUTE_REF);
+GSN_PRINT_SIGNATURE(printUTIL_EXECUTE_CONF);
+GSN_PRINT_SIGNATURE(printSCANTABREQ);
+GSN_PRINT_SIGNATURE(printSCANTABCONF);
+GSN_PRINT_SIGNATURE(printSCANTABREF);
+GSN_PRINT_SIGNATURE(printSCANNEXTREQ);
+GSN_PRINT_SIGNATURE(printLQH_FRAG_REQ);
+GSN_PRINT_SIGNATURE(printLQH_FRAG_REF);
+GSN_PRINT_SIGNATURE(printLQH_FRAG_CONF);
+GSN_PRINT_SIGNATURE(printPREP_DROP_TAB_REQ);
+GSN_PRINT_SIGNATURE(printPREP_DROP_TAB_REF);
+GSN_PRINT_SIGNATURE(printPREP_DROP_TAB_CONF);
+GSN_PRINT_SIGNATURE(printDROP_TAB_REQ);
+GSN_PRINT_SIGNATURE(printDROP_TAB_REF);
+GSN_PRINT_SIGNATURE(printDROP_TAB_CONF);
+GSN_PRINT_SIGNATURE(printLCP_FRAG_ORD);
+GSN_PRINT_SIGNATURE(printLCP_FRAG_REP);
+GSN_PRINT_SIGNATURE(printLCP_COMPLETE_REP);
+GSN_PRINT_SIGNATURE(printSTART_LCP_REQ);
+GSN_PRINT_SIGNATURE(printSTART_LCP_CONF);
+GSN_PRINT_SIGNATURE(printMASTER_LCP_REQ);
+GSN_PRINT_SIGNATURE(printMASTER_LCP_REF);
+GSN_PRINT_SIGNATURE(printMASTER_LCP_CONF);
+GSN_PRINT_SIGNATURE(printCOPY_GCI_REQ);
+GSN_PRINT_SIGNATURE(printSYSTEM_ERROR);
+GSN_PRINT_SIGNATURE(printSTART_REC_REQ);
+GSN_PRINT_SIGNATURE(printSTART_REC_CONF);
+GSN_PRINT_SIGNATURE(printNF_COMPLETE_REP);
+GSN_PRINT_SIGNATURE(printSIGNAL_DROPPED_REP);
+GSN_PRINT_SIGNATURE(printFAIL_REP);
+GSN_PRINT_SIGNATURE(printDISCONNECT_REP);
+GSN_PRINT_SIGNATURE(printSUB_CREATE_REQ);
+GSN_PRINT_SIGNATURE(printSUB_CREATE_CONF);
+GSN_PRINT_SIGNATURE(printSUB_CREATE_REF);
+GSN_PRINT_SIGNATURE(printSUB_REMOVE_REQ);
+GSN_PRINT_SIGNATURE(printSUB_REMOVE_CONF);
+GSN_PRINT_SIGNATURE(printSUB_REMOVE_REF);
+GSN_PRINT_SIGNATURE(printSUB_START_REQ);
+GSN_PRINT_SIGNATURE(printSUB_START_REF);
+GSN_PRINT_SIGNATURE(printSUB_START_CONF);
+GSN_PRINT_SIGNATURE(printSUB_STOP_REQ);
+GSN_PRINT_SIGNATURE(printSUB_STOP_REF);
+GSN_PRINT_SIGNATURE(printSUB_STOP_CONF);
+GSN_PRINT_SIGNATURE(printSUB_SYNC_REQ);
+GSN_PRINT_SIGNATURE(printSUB_SYNC_REF);
+GSN_PRINT_SIGNATURE(printSUB_SYNC_CONF);
+GSN_PRINT_SIGNATURE(printSUB_META_DATA);
+GSN_PRINT_SIGNATURE(printSUB_TABLE_DATA);
+GSN_PRINT_SIGNATURE(printSUB_SYNC_CONTINUE_REQ);
+GSN_PRINT_SIGNATURE(printSUB_SYNC_CONTINUE_REF);
+GSN_PRINT_SIGNATURE(printSUB_SYNC_CONTINUE_CONF);
+GSN_PRINT_SIGNATURE(printSUB_GCP_COMPLETE_REP);
+GSN_PRINT_SIGNATURE(printCREATE_FRAGMENTATION_REQ);
+GSN_PRINT_SIGNATURE(printCREATE_FRAGMENTATION_REF);
+GSN_PRINT_SIGNATURE(printCREATE_FRAGMENTATION_CONF);
+GSN_PRINT_SIGNATURE(printUTIL_CREATE_LOCK_REQ);
+GSN_PRINT_SIGNATURE(printUTIL_CREATE_LOCK_REF);
+GSN_PRINT_SIGNATURE(printUTIL_CREATE_LOCK_CONF);
+GSN_PRINT_SIGNATURE(printUTIL_DESTROY_LOCK_REQ);
+GSN_PRINT_SIGNATURE(printUTIL_DESTROY_LOCK_REF);
+GSN_PRINT_SIGNATURE(printUTIL_DESTROY_LOCK_CONF);
+GSN_PRINT_SIGNATURE(printUTIL_LOCK_REQ);
+GSN_PRINT_SIGNATURE(printUTIL_LOCK_REF);
+GSN_PRINT_SIGNATURE(printUTIL_LOCK_CONF);
+GSN_PRINT_SIGNATURE(printUTIL_UNLOCK_REQ);
+GSN_PRINT_SIGNATURE(printUTIL_UNLOCK_REF);
+GSN_PRINT_SIGNATURE(printUTIL_UNLOCK_CONF);
+GSN_PRINT_SIGNATURE(printCNTR_START_REQ);
+GSN_PRINT_SIGNATURE(printCNTR_START_REF);
+GSN_PRINT_SIGNATURE(printCNTR_START_CONF);
+GSN_PRINT_SIGNATURE(printREAD_NODES_CONF);
+GSN_PRINT_SIGNATURE(printTUX_MAINT_REQ);
+GSN_PRINT_SIGNATURE(printACC_LOCKREQ);
+GSN_PRINT_SIGNATURE(printLQH_TRANSCONF);
+GSN_PRINT_SIGNATURE(printSCAN_FRAGREQ);
+
+GSN_PRINT_SIGNATURE(printCONTINUEB_NDBFS);
+GSN_PRINT_SIGNATURE(printCONTINUEB_DBDIH);
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/SignalDataPrint.hpp b/storage/ndb/include/kernel/signaldata/SignalDataPrint.hpp
new file mode 100644
index 00000000000..17ab07acd4e
--- /dev/null
+++ b/storage/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 <ndb_global.h>
+#include <kernel_types.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/storage/ndb/include/kernel/signaldata/SignalDroppedRep.hpp b/storage/ndb/include/kernel/signaldata/SignalDroppedRep.hpp
new file mode 100644
index 00000000000..20863524358
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/SrFragidConf.hpp b/storage/ndb/include/kernel/signaldata/SrFragidConf.hpp
new file mode 100644
index 00000000000..9a6088ad57f
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/StartFragReq.hpp b/storage/ndb/include/kernel/signaldata/StartFragReq.hpp
new file mode 100644
index 00000000000..ec05c1ee366
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/StartInfo.hpp b/storage/ndb/include/kernel/signaldata/StartInfo.hpp
new file mode 100644
index 00000000000..d0850b13ef4
--- /dev/null
+++ b/storage/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 = 3 );
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/StartMe.hpp b/storage/ndb/include/kernel/signaldata/StartMe.hpp
new file mode 100644
index 00000000000..6593a9e9741
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/StartOrd.hpp b/storage/ndb/include/kernel/signaldata/StartOrd.hpp
new file mode 100644
index 00000000000..43a48f70ba9
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/StartPerm.hpp b/storage/ndb/include/kernel/signaldata/StartPerm.hpp
new file mode 100644
index 00000000000..38be72835a3
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/StartRec.hpp b/storage/ndb/include/kernel/signaldata/StartRec.hpp
new file mode 100644
index 00000000000..f8a4e01a094
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/StartTo.hpp b/storage/ndb/include/kernel/signaldata/StartTo.hpp
new file mode 100644
index 00000000000..5aecef6275d
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/StopMe.hpp b/storage/ndb/include/kernel/signaldata/StopMe.hpp
new file mode 100644
index 00000000000..51d944a3b96
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/StopPerm.hpp b/storage/ndb/include/kernel/signaldata/StopPerm.hpp
new file mode 100644
index 00000000000..95fb82c8cde
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/StopReq.hpp b/storage/ndb/include/kernel/signaldata/StopReq.hpp
new file mode 100644
index 00000000000..ea453ae115d
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/SumaImpl.hpp b/storage/ndb/include/kernel/signaldata/SumaImpl.hpp
new file mode 100644
index 00000000000..75fb65e1ad2
--- /dev/null
+++ b/storage/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;
+ union { // Haven't decide what to call it
+ Uint32 senderData;
+ Uint32 subscriberData;
+ };
+ Uint32 err;
+};
+
+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/storage/ndb/include/kernel/signaldata/SystemError.hpp b/storage/ndb/include/kernel/signaldata/SystemError.hpp
new file mode 100644
index 00000000000..7b4d47c5c2e
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/TamperOrd.hpp b/storage/ndb/include/kernel/signaldata/TamperOrd.hpp
new file mode 100644
index 00000000000..eb6cd47b093
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/TcCommit.hpp b/storage/ndb/include/kernel/signaldata/TcCommit.hpp
new file mode 100644
index 00000000000..9499b20ada3
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/TcCommit.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 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;
+ friend class NdbTransaction;
+
+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 NdbTransaction;
+
+public:
+ STATIC_CONST( SignalLength = 4 );
+private:
+
+ Uint32 apiConnectPtr;
+ Uint32 transId1;
+ Uint32 transId2;
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/TcContinueB.hpp b/storage/ndb/include/kernel/signaldata/TcContinueB.hpp
new file mode 100644
index 00000000000..85213791b2a
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/TcContinueB.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 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,
+
+ DelayTCKEYCONF = 18
+ };
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/TcHbRep.hpp b/storage/ndb/include/kernel/signaldata/TcHbRep.hpp
new file mode 100644
index 00000000000..7e701b510f9
--- /dev/null
+++ b/storage/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 NdbTransaction;
+
+ /**
+ * 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/storage/ndb/include/kernel/signaldata/TcIndx.hpp b/storage/ndb/include/kernel/signaldata/TcIndx.hpp
new file mode 100644
index 00000000000..c5e7d2489ba
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/TcIndx.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 TC_INDX_H
+#define TC_INDX_H
+
+#include "SignalData.hpp"
+#include "TcKeyReq.hpp"
+
+class TcIndxConf {
+
+ /**
+ * Reciver(s)
+ */
+ friend class Ndb;
+ friend class NdbTransaction;
+
+ /**
+ * 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);
+}
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/TcKeyConf.hpp b/storage/ndb/include/kernel/signaldata/TcKeyConf.hpp
new file mode 100644
index 00000000000..c23e94951dc
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/TcKeyConf.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 TC_KEY_CONF_H
+#define TC_KEY_CONF_H
+
+#include "SignalData.hpp"
+
+/**
+ *
+ */
+class TcKeyConf {
+ /**
+ * Reciver(s)
+ */
+ friend class Ndb;
+ friend class NdbTransaction;
+ 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 );
+ STATIC_CONST( SimpleReadBit = (((Uint32)1) << 31) );
+
+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 = (confInfo & 0xFFFF0000) | 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/storage/ndb/include/kernel/signaldata/TcKeyFailConf.hpp b/storage/ndb/include/kernel/signaldata/TcKeyFailConf.hpp
new file mode 100644
index 00000000000..7c0a766df40
--- /dev/null
+++ b/storage/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 NdbTransaction;
+
+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/storage/ndb/include/kernel/signaldata/TcKeyRef.hpp b/storage/ndb/include/kernel/signaldata/TcKeyRef.hpp
new file mode 100644
index 00000000000..c773920713a
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/TcKeyReq.hpp b/storage/ndb/include/kernel/signaldata/TcKeyReq.hpp
new file mode 100644
index 00000000000..d7c11ca773c
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/TcKeyReq.hpp
@@ -0,0 +1,548 @@
+/* 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 NdbScanOperation;
+ 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 getTakeOverScanFragment(const UintR & scanInfo);
+ static Uint32 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 setTakeOverScanFragment(UintR & scanInfo, Uint16 fragment);
+ static void setTakeOverScanInfo(UintR & scanInfo, Uint32 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 - 12 Bits -> max 65535
+ p = Scan Info - 18 Bits -> max 4095
+
+ 1111111111222222222233
+ 01234567890123456789012345678901
+ tpppppppppppppppppp nnnnnnnnnnnn
+*/
+
+#define TAKE_OVER_SHIFT (0)
+
+#define TAKE_OVER_FRAG_SHIFT (20)
+#define TAKE_OVER_FRAG_MASK (4095)
+
+#define SCAN_INFO_SHIFT (1)
+#define SCAN_INFO_MASK (262143)
+
+/**
+ * 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::getTakeOverScanFragment(const UintR & scanInfo){
+ return (Uint16)((scanInfo >> TAKE_OVER_FRAG_SHIFT) & TAKE_OVER_FRAG_MASK);
+}
+
+inline
+Uint32
+TcKeyReq::getTakeOverScanInfo(const UintR & scanInfo){
+ return (Uint32)((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::setTakeOverScanFragment(UintR & scanInfo, Uint16 node){
+// ASSERT_MAX(node, TAKE_OVER_NODE_MASK, "TcKeyReq::setTakeOverScanNode");
+ scanInfo |= (node << TAKE_OVER_FRAG_SHIFT);
+}
+
+inline
+void
+TcKeyReq::setTakeOverScanInfo(UintR & scanInfo, Uint32 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/storage/ndb/include/kernel/signaldata/TcRollbackRep.hpp b/storage/ndb/include/kernel/signaldata/TcRollbackRep.hpp
new file mode 100644
index 00000000000..febbd4f86b1
--- /dev/null
+++ b/storage/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 NdbTransaction;
+ 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/storage/ndb/include/kernel/signaldata/TcSizeAltReq.hpp b/storage/ndb/include/kernel/signaldata/TcSizeAltReq.hpp
new file mode 100644
index 00000000000..34eacfe5a93
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/TestOrd.hpp b/storage/ndb/include/kernel/signaldata/TestOrd.hpp
new file mode 100644
index 00000000000..1600df08884
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/TransIdAI.hpp b/storage/ndb/include/kernel/signaldata/TransIdAI.hpp
new file mode 100755
index 00000000000..5beaf6eba4b
--- /dev/null
+++ b/storage/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 NdbTransaction;
+ 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/storage/ndb/include/kernel/signaldata/TrigAttrInfo.hpp b/storage/ndb/include/kernel/signaldata/TrigAttrInfo.hpp
new file mode 100644
index 00000000000..e2c029b9033
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/TupCommit.hpp b/storage/ndb/include/kernel/signaldata/TupCommit.hpp
new file mode 100644
index 00000000000..7c5a7931e6c
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/TupFrag.hpp b/storage/ndb/include/kernel/signaldata/TupFrag.hpp
new file mode 100644
index 00000000000..8acb3d28bd6
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/TupFrag.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 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 = 14 );
+private:
+ Uint32 userPtr;
+ Uint32 userRef;
+ Uint32 reqInfo;
+ Uint32 tableId;
+ Uint32 noOfAttr;
+ Uint32 fragId;
+ Uint32 fragOff;
+ Uint32 tableType;
+ Uint32 primaryTableId;
+ Uint32 tupIndexFragPtrI;
+ Uint32 tupTableFragPtrI[2];
+ Uint32 accTableFragPtrI[2];
+};
+
+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 = 903,
+ NoFreeFragment = 904,
+ NoFreeAttributes = 905
+ };
+private:
+ Uint32 userPtr;
+ Uint32 errorCode;
+};
+
+// TUP: add attribute
+
+class TupAddAttrReq {
+ friend class Dblqh;
+ friend class Dbtux;
+public:
+ STATIC_CONST( SignalLength = 5 );
+private:
+ Uint32 tupConnectPtr;
+ Uint32 notused1;
+ Uint32 attrId;
+ Uint32 attrDescriptor;
+ Uint32 extTypeInfo;
+};
+
+class TupAddAttrConf {
+ friend class Dblqh;
+ friend class Dbtup;
+public:
+ STATIC_CONST( SignalLength = 2 );
+private:
+ Uint32 userPtr;
+ Uint32 lastAttr; // bool: got last attr and closed frag op
+};
+
+class TupAddAttrRef {
+ friend class Dblqh;
+ friend class Dbtup;
+public:
+ STATIC_CONST( SignalLength = 2 );
+ enum ErrorCode {
+ NoError = 0,
+ InvalidCharset = 743,
+ TooManyBitsUsed = 831
+ };
+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 = 2 );
+private:
+ Uint32 userPtr;
+ Uint32 lastAttr; // bool: got last attr and closed frag op
+};
+
+class TuxAddAttrRef {
+ friend class Dblqh;
+ friend class Dbtux;
+public:
+ STATIC_CONST( SignalLength = 2 );
+ enum ErrorCode {
+ NoError = 0,
+ InvalidAttributeType = 906,
+ InvalidCharset = 907,
+ InvalidNodeSize = 908
+ };
+private:
+ Uint32 userPtr;
+ Uint32 errorCode;
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/TupKey.hpp b/storage/ndb/include/kernel/signaldata/TupKey.hpp
new file mode 100644
index 00000000000..ffd57d81e64
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/TupKey.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 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 = 5 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+ Uint32 userPtr;
+ Uint32 readLength;
+ Uint32 writeLength;
+ Uint32 noFiredTriggers;
+ Uint32 lastRow;
+};
+
+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/storage/ndb/include/kernel/signaldata/TupSizeAltReq.hpp b/storage/ndb/include/kernel/signaldata/TupSizeAltReq.hpp
new file mode 100644
index 00000000000..215493bc188
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/TuxBound.hpp b/storage/ndb/include/kernel/signaldata/TuxBound.hpp
new file mode 100644
index 00000000000..7e12897407b
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/TuxBound.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 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,
+ InvalidCharFormat = 744,
+ TooMuchAttrInfo = 823
+ };
+ 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.
+ */
+ Uint32 boundAiLength;
+
+ Uint32 data[1];
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/TuxContinueB.hpp b/storage/ndb/include/kernel/signaldata/TuxContinueB.hpp
new file mode 100644
index 00000000000..385d85715e2
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/TuxMaint.hpp b/storage/ndb/include/kernel/signaldata/TuxMaint.hpp
new file mode 100644
index 00000000000..4518f0531ea
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/TuxMaint.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 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 = 901, // add + found or remove + not found
+ NoMemError = 902
+ };
+ STATIC_CONST( SignalLength = 8 );
+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 physical address of "original" tuple
+ * and version number.
+ */
+ Uint32 pageId;
+ Uint32 pageOffset;
+ Uint32 tupVersion;
+ /*
+ * Operation code and flags.
+ */
+ Uint32 opInfo;
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/TuxSizeAltReq.hpp b/storage/ndb/include/kernel/signaldata/TuxSizeAltReq.hpp
new file mode 100644
index 00000000000..5d5a0e102ba
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/UpdateTo.hpp b/storage/ndb/include/kernel/signaldata/UpdateTo.hpp
new file mode 100644
index 00000000000..0fa5f31b6b4
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/UpgradeStartup.hpp b/storage/ndb/include/kernel/signaldata/UpgradeStartup.hpp
new file mode 100644
index 00000000000..93fef323789
--- /dev/null
+++ b/storage/ndb/include/kernel/signaldata/UpgradeStartup.hpp
@@ -0,0 +1,38 @@
+#ifndef NDB_UPGRADE_STARTUP
+#define NDB_UPGRADE_STARTUP
+
+class Ndbcntr;
+
+struct UpgradeStartup {
+
+ static void installEXEC(SimulatedBlock*);
+
+ STATIC_CONST( GSN_CM_APPCHG = 131 );
+ STATIC_CONST( GSN_CNTR_MASTERCONF = 148 );
+ STATIC_CONST( GSN_CNTR_MASTERREF = 149 );
+ STATIC_CONST( GSN_CNTR_MASTERREQ = 150 );
+
+ static void sendCmAppChg(Ndbcntr&, Signal *, Uint32 startLevel);
+ static void execCM_APPCHG(SimulatedBlock& block, Signal*);
+ static void sendCntrMasterReq(Ndbcntr& cntr, Signal* signal, Uint32 n);
+ static void execCNTR_MASTER_REPLY(SimulatedBlock & block, Signal* signal);
+
+ struct CntrMasterReq {
+ STATIC_CONST( SignalLength = 4 + NdbNodeBitmask::Size );
+
+ Uint32 userBlockRef;
+ Uint32 userNodeId;
+ Uint32 typeOfStart;
+ Uint32 noRestartNodes;
+ Uint32 theNodes[NdbNodeBitmask::Size];
+ };
+
+ struct CntrMasterConf {
+ STATIC_CONST( SignalLength = 1 + NdbNodeBitmask::Size );
+
+ Uint32 noStartNodes;
+ Uint32 theNodes[NdbNodeBitmask::Size];
+ };
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/UtilDelete.hpp b/storage/ndb/include/kernel/signaldata/UtilDelete.hpp
new file mode 100644
index 00000000000..67c13b8c2d5
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/UtilExecute.hpp b/storage/ndb/include/kernel/signaldata/UtilExecute.hpp
new file mode 100644
index 00000000000..551fb172cac
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/UtilLock.hpp b/storage/ndb/include/kernel/signaldata/UtilLock.hpp
new file mode 100644
index 00000000000..318024fd706
--- /dev/null
+++ b/storage/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
+ };
+public:
+ 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 );
+
+public:
+ 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
+
+ };
+public:
+ 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 );
+
+public:
+ 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 );
+
+public:
+ 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
+ };
+public:
+ 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 );
+
+public:
+ 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 );
+
+public:
+ 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 );
+
+public:
+ 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 );
+
+public:
+ 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 );
+
+public:
+ 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 );
+
+public:
+ Uint32 senderData;
+ Uint32 senderRef;
+ Uint32 lockId;
+};
+
+#endif
diff --git a/storage/ndb/include/kernel/signaldata/UtilPrepare.hpp b/storage/ndb/include/kernel/signaldata/UtilPrepare.hpp
new file mode 100644
index 00000000000..8508487ce15
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/UtilRelease.hpp b/storage/ndb/include/kernel/signaldata/UtilRelease.hpp
new file mode 100644
index 00000000000..d2864f02f47
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/UtilSequence.hpp b/storage/ndb/include/kernel/signaldata/UtilSequence.hpp
new file mode 100644
index 00000000000..50e5d673e99
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/signaldata/WaitGCP.hpp b/storage/ndb/include/kernel/signaldata/WaitGCP.hpp
new file mode 100644
index 00000000000..ebed28714d2
--- /dev/null
+++ b/storage/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/storage/ndb/include/kernel/trigger_definitions.h b/storage/ndb/include/kernel/trigger_definitions.h
new file mode 100644
index 00000000000..11410654a15
--- /dev/null
+++ b/storage/ndb/include/kernel/trigger_definitions.h
@@ -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 NDB_TRIGGER_DEFINITIONS_H
+#define NDB_TRIGGER_DEFINITIONS_H
+
+#include <ndb_global.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 {
+ /** TableEvent must match 1 << TriggerEvent */
+ enum Value {
+ TE_INSERT = 0,
+ TE_DELETE = 1,
+ TE_UPDATE = 2,
+ TE_CUSTOM = 3 /* Hardcoded per TriggerType */
+ };
+};
+
+#endif
diff --git a/storage/ndb/include/logger/ConsoleLogHandler.hpp b/storage/ndb/include/logger/ConsoleLogHandler.hpp
new file mode 100644
index 00000000000..ae77b13d3b7
--- /dev/null
+++ b/storage/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/storage/ndb/include/logger/FileLogHandler.hpp b/storage/ndb/include/logger/FileLogHandler.hpp
new file mode 100644
index 00000000000..8fb25e72be7
--- /dev/null
+++ b/storage/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_class;
+
+/**
+ * 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( MAX_NO_FILES = 6 );
+ /** Max file size of the log before archiving. */
+ STATIC_CONST( MAX_FILE_SIZE = 1024000 );
+ /** Max number of log entries before archiving. */
+ STATIC_CONST( 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_class* m_pLogFile;
+};
+
+#endif
diff --git a/storage/ndb/include/logger/LogHandler.hpp b/storage/ndb/include/logger/LogHandler.hpp
new file mode 100644
index 00000000000..7df6ad864e5
--- /dev/null
+++ b/storage/ndb/include/logger/LogHandler.hpp
@@ -0,0 +1,208 @@
+/* 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"
+
+/**
+ * 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. Append checks for repeated messages.
+ * append_impl() does not check for repeats.
+ *
+ * @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);
+ void append_impl(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 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( MAX_DATE_TIME_HEADER_LENGTH = 64 );
+ /** Max length of the header the log. */
+ STATIC_CONST( MAX_HEADER_LENGTH = 128 );
+ /** Max lenght of footer in the log. */
+ STATIC_CONST( 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:
+ /**
+ * Returns a string date and time string.
+ * @note does not update time, uses m_now as time
+ * @param pStr a string.
+ * @return a string with date and time.
+ */
+ char* getTimeAsString(char* pStr) const;
+ time_t m_now;
+
+ /** Prohibit */
+ LogHandler(const LogHandler&);
+ LogHandler* operator = (const LogHandler&);
+ bool operator == (const LogHandler&);
+
+ const char* m_pDateTimeFormat;
+ int m_errorCode;
+
+ // for handling repeated messages
+ unsigned m_count_repeated_messages;
+ unsigned m_max_repeat_frequency;
+ time_t m_last_log_time;
+ char m_last_category[MAX_HEADER_LENGTH];
+ char m_last_message[MAX_LOG_MESSAGE_SIZE];
+ Logger::LoggerLevel m_last_level;
+};
+
+#endif
diff --git a/storage/ndb/include/logger/Logger.hpp b/storage/ndb/include/logger/Logger.hpp
new file mode 100644
index 00000000000..ee762098fb6
--- /dev/null
+++ b/storage/ndb/include/logger/Logger.hpp
@@ -0,0 +1,296 @@
+/* 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 <ndb_global.h>
+#include <BaseString.hpp>
+
+#define MAX_LOG_MESSAGE_SIZE 1024
+
+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_ON, 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( 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/storage/ndb/include/logger/SysLogHandler.hpp b/storage/ndb/include/logger/SysLogHandler.hpp
new file mode 100644
index 00000000000..0dfc1cb2d43
--- /dev/null
+++ b/storage/ndb/include/logger/SysLogHandler.hpp
@@ -0,0 +1,99 @@
+/* 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"
+#ifndef NDB_WIN32
+#include <syslog.h>
+#endif
+
+/**
+ * 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);
+
+ /**
+ * 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/storage/ndb/include/mgmapi/mgmapi.h b/storage/ndb/include/mgmapi/mgmapi.h
new file mode 100644
index 00000000000..dca88e4950e
--- /dev/null
+++ b/storage/ndb/include/mgmapi/mgmapi.h
@@ -0,0 +1,1054 @@
+/* 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 MySQL Cluster Management API
+ *
+ * The MySQL Cluster Management API (MGM API) is a C language API
+ * that is used for:
+ * - Starting and stopping database nodes (ndbd processes)
+ * - Starting and stopping Cluster backups
+ * - Controlling the NDB Cluster log
+ * - Performing other administrative tasks
+ *
+ * @section secMgmApiGeneral General Concepts
+ *
+ * Each MGM API function needs a management server handle
+ * of type @ref NdbMgmHandle.
+ * This handle is created by calling the function
+ * function ndb_mgm_create_handle() and freed by calling
+ * ndb_mgm_destroy_handle().
+ *
+ * A function can return any of the following:
+ * -# An integer value, with
+ * a value of <b>-1</b> indicating an error.
+ * -# A non-constant pointer value. A <var>NULL</var> value indicates an error;
+ * otherwise, the return value must be freed
+ * by the programmer
+ * -# A constant pointer value, with a <var>NULL</var> value indicating an error.
+ * The returned value should <em>not</em> be freed.
+ *
+ * Error conditions can be identified by using the appropriate
+ * error-reporting functions ndb_mgm_get_latest_error() and
+ * @ref ndb_mgm_error.
+ *
+ * Here is an example using the MGM API (without error handling for brevity's sake).
+ * @code
+ * NdbMgmHandle handle= ndb_mgm_create_handle();
+ * ndb_mgm_connect(handle,0,0,0);
+ * struct ndb_mgm_cluster_state *state= ndb_mgm_get_status(handle);
+ * for(int i=0; i < state->no_of_nodes; i++)
+ * {
+ * struct ndb_mgm_node_state *node_state= &state->node_states[i];
+ * printf("node with ID=%d ", node_state->node_id);
+ * if(node_state->version != 0)
+ * printf("connected\n");
+ * else
+ * printf("not connected\n");
+ * }
+ * free((void*)state);
+ * ndb_mgm_destroy_handle(&handle);
+ * @endcode
+ *
+ * @section secLogEvents Log Events
+ *
+ * The database nodes and management server(s) regularly and on specific
+ * occations report on various log events that occurs in the cluster. These
+ * log events are written to the cluster log. Optionally a mgmapi client
+ * may listen to these events by using the method ndb_mgm_listen_event().
+ * Each log event belongs to a category, @ref ndb_mgm_event_category, and
+ * has a severity, @ref ndb_mgm_event_severity, associated with it. Each
+ * log event also has a level (0-15) associated with it.
+ *
+ * Which log events that come out is controlled with ndb_mgm_listen_event(),
+ * ndb_mgm_set_clusterlog_loglevel(), and
+ * ndb_mgm_set_clusterlog_severity_filter().
+ *
+ * Below is an example of how to listen to events related to backup.
+ *
+ * @code
+ * int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0 };
+ * int fd = ndb_mgm_listen_event(handle, filter);
+ * @endcode
+ *
+ *
+ * @section secSLogEvents Structured Log Events
+ *
+ * The following steps are involved:
+ * - Create a NdbEventLogHandle using ndb_mgm_create_logevent_handle()
+ * - Wait and store log events using ndb_logevent_get_next()
+ * - The log event data is available in the struct ndb_logevent. The
+ * data which is specific to a particular event is stored in a union
+ * between structs so use ndb_logevent::type to decide which struct
+ * is valid.
+ *
+ * Sample code for listening to Backup related events. The availaable log
+ * events are listed in @ref ndb_logevent.h
+ *
+ * @code
+ * int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0 };
+ * NdbEventLogHandle le_handle= ndb_mgm_create_logevent_handle(handle, filter);
+ * struct ndb_logevent le;
+ * int r= ndb_logevent_get_next(le_handle,&le,0);
+ * if (r < 0) error
+ * else if (r == 0) no event
+ *
+ * switch (le.type)
+ * {
+ * case NDB_LE_BackupStarted:
+ * ... le.BackupStarted.starting_node;
+ * ... le.BackupStarted.backup_id;
+ * break;
+ * case NDB_LE_BackupFailedToStart:
+ * ... le.BackupFailedToStart.error;
+ * break;
+ * case NDB_LE_BackupCompleted:
+ * ... le.BackupCompleted.stop_gci;
+ * break;
+ * case NDB_LE_BackupAborted:
+ * ... le.BackupStarted.backup_id;
+ * break;
+ * default:
+ * break;
+ * }
+ * @endcode
+ */
+
+/*
+ * @page ndb_logevent.h ndb_logevent.h
+ * @include ndb_logevent.h
+ */
+
+/** @addtogroup MGM_C_API
+ * @{
+ */
+
+#include <ndb_types.h>
+#include "ndb_logevent.h"
+#include "mgmapi_config_parameters.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /**
+ * 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 /** An application (NdbApi) node */
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ = NODE_TYPE_API
+#endif
+ ,NDB_MGM_NODE_TYPE_NDB /** A database node */
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ = NODE_TYPE_DB
+#endif
+ ,NDB_MGM_NODE_TYPE_MGM /** A management server node */
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ = NODE_TYPE_MGM
+#endif
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ ,NDB_MGM_NODE_TYPE_REP = NODE_TYPE_REP /** A replication node */
+ ,NDB_MGM_NODE_TYPE_MIN = 0 /** Min valid value*/
+ ,NDB_MGM_NODE_TYPE_MAX = 3 /** Max valid value*/
+#endif
+ };
+
+ /**
+ * Database node status
+ */
+ enum ndb_mgm_node_status {
+ /** Node status not known*/
+ NDB_MGM_NODE_STATUS_UNKNOWN = 0,
+ /** No contact with node*/
+ NDB_MGM_NODE_STATUS_NO_CONTACT = 1,
+ /** Has not run starting protocol*/
+ NDB_MGM_NODE_STATUS_NOT_STARTED = 2,
+ /** Is running starting protocol*/
+ NDB_MGM_NODE_STATUS_STARTING = 3,
+ /** Running*/
+ NDB_MGM_NODE_STATUS_STARTED = 4,
+ /** Is shutting down*/
+ NDB_MGM_NODE_STATUS_SHUTTING_DOWN = 5,
+ /** Is restarting*/
+ NDB_MGM_NODE_STATUS_RESTARTING = 6,
+ /** Maintenance mode*/
+ NDB_MGM_NODE_STATUS_SINGLEUSER = 7,
+ /** Resume mode*/
+ NDB_MGM_NODE_STATUS_RESUME = 8,
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /** Min valid value*/
+ NDB_MGM_NODE_STATUS_MIN = 0,
+ /** Max valid value*/
+ NDB_MGM_NODE_STATUS_MAX = 8
+#endif
+ };
+
+ /**
+ * Error codes
+ */
+ enum ndb_mgm_error {
+ /** Not an error */
+ NDB_MGM_NO_ERROR = 0,
+
+ /* Request for service errors */
+ /** Supplied connectstring is illegal */
+ NDB_MGM_ILLEGAL_CONNECT_STRING = 1001,
+ /** Supplied NdbMgmHandle is illegal */
+ NDB_MGM_ILLEGAL_SERVER_HANDLE = 1005,
+ /** Illegal reply from server */
+ NDB_MGM_ILLEGAL_SERVER_REPLY = 1006,
+ /** Illegal number of nodes */
+ NDB_MGM_ILLEGAL_NUMBER_OF_NODES = 1007,
+ /** Illegal node status */
+ NDB_MGM_ILLEGAL_NODE_STATUS = 1008,
+ /** Memory allocation error */
+ NDB_MGM_OUT_OF_MEMORY = 1009,
+ /** Management server not connected */
+ NDB_MGM_SERVER_NOT_CONNECTED = 1010,
+ /** Could not connect to socker */
+ NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET = 1011,
+
+ /* Service errors - Start/Stop Node or System */
+ /** Start failed */
+ NDB_MGM_START_FAILED = 2001,
+ /** Stop failed */
+ NDB_MGM_STOP_FAILED = 2002,
+ /** Restart failed */
+ NDB_MGM_RESTART_FAILED = 2003,
+
+ /* Service errors - Backup */
+ /** Unable to start backup */
+ NDB_MGM_COULD_NOT_START_BACKUP = 3001,
+ /** Unable to abort backup */
+ NDB_MGM_COULD_NOT_ABORT_BACKUP = 3002,
+
+ /* Service errors - Single User Mode */
+ /** Unable to enter single user mode */
+ NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE = 4001,
+ /** Unable to exit single user mode */
+ NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE = 4002,
+
+ /* Usage errors */
+ /** Usage error */
+ NDB_MGM_USAGE_ERROR = 5001
+ };
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ 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" },
+
+ /* Request for service errors */
+ { NDB_MGM_ILLEGAL_CONNECT_STRING, "Illegal connect string" },
+ { 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" },
+
+ /* Usage errors */
+ { NDB_MGM_USAGE_ERROR,
+ "Usage error" }
+ };
+ const int ndb_mgm_noOfErrorMsgs =
+ sizeof(ndb_mgm_error_msgs)/sizeof(struct Ndb_Mgm_Error_Msg);
+#endif
+
+ /**
+ * Status of a node in the cluster.
+ *
+ * Sub-structure in enum ndb_mgm_cluster_state
+ * returned by ndb_mgm_get_status().
+ *
+ * @note <var>node_status</var>, <var>start_phase</var>,
+ * <var>dynamic_id</var>
+ * and <var>node_group</var> are relevant only for database nodes,
+ * i.e. <var>node_type</var> == @ref NDB_MGM_NODE_TYPE_NDB.
+ */
+ struct ndb_mgm_node_state {
+ /** NDB Cluster node ID*/
+ int node_id;
+ /** Type of NDB Cluster node*/
+ enum ndb_mgm_node_type node_type;
+ /** State of node*/
+ enum ndb_mgm_node_status node_status;
+ /** Start phase.
+ *
+ * @note Start phase is only valid if the <var>node_type</var> is
+ * NDB_MGM_NODE_TYPE_NDB and the <var>node_status</var> is
+ * NDB_MGM_NODE_STATUS_STARTING
+ */
+ int start_phase;
+ /** ID for heartbeats and master take-over (only valid for DB nodes)
+ */
+ int dynamic_id;
+ /** Node group of node (only valid for DB nodes)*/
+ int node_group;
+ /** Internal version number*/
+ int version;
+ /** Number of times node has connected or disconnected to the
+ * management server
+ */
+ int connect_count;
+ /** IP address of node when it connected to the management server.
+ * @note This value will be empty if the management server has restarted
+ * since the node last connected.
+ */
+ char connect_address[
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ sizeof("000.000.000.000")+1
+#endif
+ ];
+ };
+
+ /**
+ * State of all nodes in the cluster; returned from
+ * ndb_mgm_get_status()
+ */
+ struct ndb_mgm_cluster_state {
+ /** Number of entries in the node_states array */
+ int no_of_nodes;
+ /** An array with node_states*/
+ struct ndb_mgm_node_state node_states[
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ 1
+#endif
+ ];
+ };
+
+ /**
+ * Default reply from the server (reserved for future use)
+ */
+ struct ndb_mgm_reply {
+ /** 0 if successful, otherwise error code. */
+ int return_code;
+ /** Error or reply message.*/
+ char message[256];
+ };
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * Default information types
+ */
+ enum ndb_mgm_info {
+ /** ?*/
+ NDB_MGM_INFO_CLUSTER,
+ /** Cluster log*/
+ NDB_MGM_INFO_CLUSTERLOG
+ };
+
+ /**
+ * Signal log modes
+ * (Used only in the development of NDB Cluster.)
+ */
+ enum ndb_mgm_signal_log_mode {
+ /** Log receiving signals */
+ NDB_MGM_SIGNAL_LOG_MODE_IN,
+ /** Log sending signals*/
+ NDB_MGM_SIGNAL_LOG_MODE_OUT,
+ /** Log both sending/receiving*/
+ NDB_MGM_SIGNAL_LOG_MODE_INOUT,
+ /** Log off*/
+ NDB_MGM_SIGNAL_LOG_MODE_OFF
+ };
+#endif
+
+ /***************************************************************************/
+ /**
+ * @name Functions: Error Handling
+ * @{
+ */
+
+ /**
+ * Get the most recent error associated with the management server whose handle
+ * is used as the value of <var>handle</var>.
+ *
+ * @param handle Management handle
+ * @return Latest error code
+ */
+ int ndb_mgm_get_latest_error(const NdbMgmHandle handle);
+
+ /**
+ * Get the most recent general 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 the most recent error description associated with a handle
+ *
+ * The error description gives some additional information regarding
+ * 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 the most recent 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 <var>NULL</var> 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
+ * @{
+ */
+
+ /**
+ * Sets the connectstring for a management server
+ *
+ * @param handle Management handle
+ * @param connect_string Connect string to the management server,
+ *
+ * @return -1 on error.
+ *
+ * @code
+ * <connectstring> := [<nodeid-specification>,]<host-specification>[,<host-specification>]
+ * <nodeid-specification> := nodeid=<id>
+ * <host-specification> := <host>[:<port>]
+ * <id> is an integer greater than 0 identifying a node in config.ini
+ * <port> is an integer referring to a regular unix port
+ * <host> is a string containing a valid network host address
+ * @endcode
+ */
+ int ndb_mgm_set_connectstring(NdbMgmHandle handle,
+ const char *connect_string);
+
+ int ndb_mgm_set_configuration_nodeid(NdbMgmHandle handle, int nodeid);
+ int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle);
+ int ndb_mgm_get_connected_port(NdbMgmHandle handle);
+ const char *ndb_mgm_get_connected_host(NdbMgmHandle handle);
+ const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz);
+
+ /**
+ * Gets the connectstring used for a connection
+ *
+ * @note This function returns the default connectstring if no call to
+ * ndb_mgm_set_connectstring() has been performed. Also, the
+ * returned connectstring may be formatted differently.
+ *
+ * @param handle Management handle
+ * @param buf Buffer to hold result
+ * @param buf_sz Size of buffer.
+ *
+ * @return connectstring (same as <var>buf</var>)
+ */
+ const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz);
+
+ /**
+ * Connects to a management server. Connectstring is set by
+ * ndb_mgm_set_connectstring().
+ *
+ * @param handle Management handle.
+ * @param no_retries Number of retries to connect
+ * (0 means connect once).
+ * @param retry_delay_in_seconds
+ * How long to wait until retry is performed.
+ * @param verbose Make printout regarding connect retries.
+ *
+ * @return -1 on error.
+ */
+ int ndb_mgm_connect(NdbMgmHandle handle, int no_retries,
+ int retry_delay_in_seconds, int verbose);
+ /**
+ * Return true if connected.
+ *
+ * @param handle Management handle
+ * @return 0 if not connected, non-zero if connected.
+ */
+ int ndb_mgm_is_connected(NdbMgmHandle handle);
+
+ /**
+ * Disconnects from a management server
+ *
+ * @param handle Management handle.
+ * @return -1 on error.
+ */
+ int ndb_mgm_disconnect(NdbMgmHandle handle);
+
+ /**
+ * Gets connection node ID
+ *
+ * @param handle Management handle
+ *
+ * @return Node ID; 0 indicates that no node ID has been
+ * specified
+ */
+ int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle);
+
+ /**
+ * Gets connection port
+ *
+ * @param handle Management handle
+ *
+ * @return port
+ */
+ int ndb_mgm_get_connected_port(NdbMgmHandle handle);
+
+ /**
+ * Gets connection host
+ *
+ * @param handle Management handle
+ *
+ * @return hostname
+ */
+ const char *ndb_mgm_get_connected_host(NdbMgmHandle handle);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Used to convert between different data formats
+ * @{
+ */
+
+ /**
+ * Converts a string to an <var>ndb_mgm_node_type</var> value
+ *
+ * @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);
+
+ /**
+ * Converts an ndb_mgm_node_type to a string
+ *
+ * @param type Node type.
+ * @return <var>NULL</var> if invalid ID.
+ */
+ const char * ndb_mgm_get_node_type_string(enum ndb_mgm_node_type type);
+
+ /**
+ * Converts an ndb_mgm_node_type to a alias string
+ *
+ * @param type Node type.
+ * @return <var>NULL</var> if the ID is invalid.
+ */
+ const char * ndb_mgm_get_node_type_alias_string(enum ndb_mgm_node_type type,
+ const char **str);
+
+ /**
+ * Converts a string to a <var>ndb_mgm_node_status</var> value
+ *
+ * @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);
+
+ /**
+ * Converts an ID to a string
+ *
+ * @param status NDB node status.
+ * @return <var>NULL</var> if invalid ID.
+ */
+ const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status);
+
+ const char * ndb_mgm_get_event_severity_string(enum ndb_mgm_event_severity);
+ ndb_mgm_event_category ndb_mgm_match_event_category(const char *);
+ const char * ndb_mgm_get_event_category_string(enum ndb_mgm_event_category);
+#endif
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Cluster status
+ * @{
+ */
+
+ /**
+ * Gets status of the nodes in an NDB Cluster
+ *
+ * @note The caller must free the pointer returned by this function.
+ *
+ * @param handle Management handle.
+ *
+ * @return Cluster state (or <var>NULL</var> on error).
+ */
+ struct ndb_mgm_cluster_state * ndb_mgm_get_status(NdbMgmHandle handle);
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Start/stop nodes
+ * @{
+ */
+
+ /**
+ * Stops database nodes
+ *
+ * @param handle Management handle.
+ * @param no_of_nodes Number of database nodes to be stopped<br>
+ * 0: All database nodes in cluster<br>
+ * n: Stop the <var>n</var> node(s) specified in the
+ * array node_list
+ * @param node_list List of node IDs for database nodes to be stopped
+ *
+ * @return Number of nodes stopped (-1 on error)
+ *
+ * @note This function is equivalent
+ * to calling ndb_mgm_stop2(handle, no_of_nodes, node_list, 0)
+ */
+ int ndb_mgm_stop(NdbMgmHandle handle, int no_of_nodes,
+ const int * node_list);
+
+ /**
+ * Stops database nodes
+ *
+ * @param handle Management handle.
+ * @param no_of_nodes Number of database nodes to stop<br>
+ * 0: All database nodes in cluster<br>
+ * n: Stop the <var>n</var> 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 graceful stop,
+ * but rather stop immediately
+ *
+ * @return Number of nodes stopped (-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 Number of database nodes to restart<br>
+ * 0: All database nodes in cluster<br>
+ * n: Restart the <var>n</var> node(s) specified in the
+ * array node_list
+ * @param node_list List of node IDs of database nodes to be restarted
+ *
+ * @return Number of nodes restarted (-1 on error).
+ *
+ * @note This function is equivalent to calling
+ * 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 Number of database nodes to be restarted:<br>
+ * 0: Restart all database nodes in the cluster<br>
+ * n: Restart the <var>n</var> node(s) specified in the
+ * array node_list
+ * @param node_list List of node IDs of database nodes to be restarted
+ * @param initial Remove filesystem from restarting node(s)
+ * @param nostart Don't actually start node(s) but leave them
+ * waiting for start command
+ * @param abort Don't perform graceful restart,
+ * but rather restart immediately
+ *
+ * @return Number of nodes stopped (-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 Number of database nodes to be started<br>
+ * 0: Start all database nodes in the cluster<br>
+ * n: Start the <var>n</var> node(s) specified in
+ * the array node_list
+ * @param node_list List of node IDs of database nodes to be started
+ *
+ * @return Number of nodes actually started (-1 on error).
+ *
+ * @note The nodes to be started 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 enable the database node
+ */
+ int ndb_mgm_start(NdbMgmHandle handle,
+ int no_of_nodes,
+ const int * node_list);
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Controlling Clusterlog output
+ * @{
+ */
+
+ /**
+ * Filter cluster log severities
+ *
+ * @param handle NDB management handle.
+ * @param severity A cluster log severity to filter.
+ * @param enable set 1=enable o 0=disable
+ * @param reply Reply message.
+ *
+ * @return -1 on error.
+ */
+ int ndb_mgm_set_clusterlog_severity_filter(NdbMgmHandle handle,
+ enum ndb_mgm_event_severity severity,
+ int enable,
+ struct ndb_mgm_reply* reply);
+ /**
+ * Get clusterlog severity filter
+ *
+ * @param handle NDB management handle
+ *
+ * @return A vector of seven elements,
+ * where each element contains
+ * 1 if a severity indicator is enabled and 0 if not.
+ * A severity level is stored at position
+ * ndb_mgm_clusterlog_level;
+ * for example the "error" level is stored in position
+ * [NDB_MGM_EVENT_SEVERITY_ERROR].
+ * The first element [NDB_MGM_EVENT_SEVERITY_ON] in
+ * the vector signals
+ * whether the cluster log
+ * is disabled or enabled.
+ */
+ const unsigned int *ndb_mgm_get_clusterlog_severity_filter(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_clusterlog_loglevel(NdbMgmHandle handle,
+ int nodeId,
+ enum ndb_mgm_event_category category,
+ int level,
+ struct ndb_mgm_reply* reply);
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Listening to log events
+ * @{
+ */
+
+ /**
+ * Listen to log events. They are read from the return file descriptor
+ * and the format is textual, and the same as in the cluster log.
+ *
+ * @param handle NDB management handle.
+ * @param filter pairs of { level, ndb_mgm_event_category } that will be
+ * pushed to fd, level=0 ends list.
+ *
+ * @return fd filedescriptor to read events from
+ */
+ int ndb_mgm_listen_event(NdbMgmHandle handle, const int filter[]);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * 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,
+ 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);
+#endif
+
+ /**
+ * The NdbLogEventHandle
+ */
+ typedef struct ndb_logevent_handle * NdbLogEventHandle;
+
+ /**
+ * Listen to log events.
+ *
+ * @param handle NDB management handle.
+ * @param filter pairs of { level, ndb_mgm_event_category } that will be
+ * pushed to fd, level=0 ends list.
+ *
+ * @return NdbLogEventHandle
+ */
+ NdbLogEventHandle ndb_mgm_create_logevent_handle(NdbMgmHandle,
+ const int filter[]);
+ void ndb_mgm_destroy_logevent_handle(NdbLogEventHandle*);
+
+ /**
+ * Retrieve filedescriptor from NdbLogEventHandle. May be used in
+ * e.g. an application select() statement.
+ *
+ * @note Do not attemt to read from it, it will corrupt the parsing.
+ *
+ * @return filedescriptor, -1 on failure.
+ */
+ int ndb_logevent_get_fd(const NdbLogEventHandle);
+
+ /**
+ * Attempt to retrieve next log event and will fill in the supplied
+ * struct dst
+ *
+ * @param dst Pointer to struct to fill in event information
+ * @param timeout_in_milliseconds Timeout for waiting for event
+ *
+ * @return >0 if event exists, 0 no event (timed out), or -1 on error.
+ *
+ * @note Return value <=0 will leave dst untouched
+ */
+ int ndb_logevent_get_next(const NdbLogEventHandle,
+ struct ndb_logevent *dst,
+ unsigned timeout_in_milliseconds);
+
+ /**
+ * Retrieve laterst error code
+ *
+ * @return error code
+ */
+ int ndb_logevent_get_latest_error(const NdbLogEventHandle);
+
+ /**
+ * Retrieve laterst error message
+ *
+ * @return error message
+ */
+ const char *ndb_logevent_get_latest_error_msg(const NdbLogEventHandle);
+
+
+ /** @} *********************************************************************/
+ /**
+ * @name Functions: Backup
+ * @{
+ */
+
+ /**
+ * Start backup
+ *
+ * @param handle NDB management handle.
+ * @param wait_completed 0: Don't wait for confirmation<br>
+ * 1: Wait for backup to be started<br>
+ * 2: Wait for backup to be completed
+ * @param backup_id Backup ID is returned from function.
+ * @param reply Reply message.
+ * @return -1 on error.
+ */
+ int ndb_mgm_start_backup(NdbMgmHandle handle, int wait_completed,
+ 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 reply Reply message.
+ *
+ * @return -1 on error.
+ */
+ int ndb_mgm_exit_single_user(NdbMgmHandle handle,
+ struct ndb_mgm_reply* reply);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /** @} *********************************************************************/
+ /**
+ * @name Configuration handling
+ * @{
+ */
+
+ /**
+ * Get configuration
+ * @param handle NDB management handle.
+ * @param version Version of configuration, 0 means latest
+ * (Currently this is the only supported value for this parameter)
+ *
+ * @return configuration
+ *
+ * @note The caller is responsible for calling ndb_mgm_destroy_configuration()
+ */
+ struct ndb_mgm_configuration * ndb_mgm_get_configuration(NdbMgmHandle handle,
+ unsigned version);
+ void ndb_mgm_destroy_configuration(struct ndb_mgm_configuration *);
+
+ int ndb_mgm_alloc_nodeid(NdbMgmHandle handle,
+ unsigned version, int nodetype);
+
+
+ /**
+ * Get the node id of the mgm server we're connected to
+ */
+ Uint32 ndb_mgm_get_mgmd_nodeid(NdbMgmHandle handle);
+
+ /**
+ * Config iterator
+ */
+ typedef struct ndb_mgm_configuration_iterator ndb_mgm_configuration_iterator;
+
+ ndb_mgm_configuration_iterator* ndb_mgm_create_configuration_iterator
+ (struct ndb_mgm_configuration *, unsigned type_of_section);
+ void ndb_mgm_destroy_iterator(ndb_mgm_configuration_iterator*);
+
+ int ndb_mgm_first(ndb_mgm_configuration_iterator*);
+ int ndb_mgm_next(ndb_mgm_configuration_iterator*);
+ int ndb_mgm_valid(const ndb_mgm_configuration_iterator*);
+ int ndb_mgm_find(ndb_mgm_configuration_iterator*,
+ int param, unsigned value);
+
+ int ndb_mgm_get_int_parameter(const ndb_mgm_configuration_iterator*,
+ int param, unsigned * value);
+ int ndb_mgm_get_int64_parameter(const ndb_mgm_configuration_iterator*,
+ int param, Uint64 * value);
+ int ndb_mgm_get_string_parameter(const ndb_mgm_configuration_iterator*,
+ int param, const char ** value);
+ int ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **);
+ int ndb_mgm_check_connection(NdbMgmHandle handle);
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ enum ndb_mgm_clusterlog_level {
+ NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL = -1,
+ NDB_MGM_CLUSTERLOG_ON = 0,
+ NDB_MGM_CLUSTERLOG_DEBUG = 1,
+ NDB_MGM_CLUSTERLOG_INFO = 2,
+ NDB_MGM_CLUSTERLOG_WARNING = 3,
+ NDB_MGM_CLUSTERLOG_ERROR = 4,
+ NDB_MGM_CLUSTERLOG_CRITICAL = 5,
+ NDB_MGM_CLUSTERLOG_ALERT = 6,
+ NDB_MGM_CLUSTERLOG_ALL = 7
+ };
+ inline
+ int ndb_mgm_filter_clusterlog(NdbMgmHandle h,
+ enum ndb_mgm_clusterlog_level s,
+ int e, struct ndb_mgm_reply* r)
+ { return ndb_mgm_set_clusterlog_severity_filter(h,(ndb_mgm_event_severity)s,
+ e,r); }
+
+ inline
+ const unsigned int *ndb_mgm_get_logfilter(NdbMgmHandle h)
+ { return ndb_mgm_get_clusterlog_severity_filter(h); }
+
+ inline
+ int ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle h, int n,
+ enum ndb_mgm_event_category c,
+ int l, struct ndb_mgm_reply* r)
+ { return ndb_mgm_set_clusterlog_loglevel(h,n,c,l,r); }
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif
diff --git a/storage/ndb/include/mgmapi/mgmapi_config_parameters.h b/storage/ndb/include/mgmapi/mgmapi_config_parameters.h
new file mode 100644
index 00000000000..33134899d1e
--- /dev/null
+++ b/storage/ndb/include/mgmapi/mgmapi_config_parameters.h
@@ -0,0 +1,170 @@
+#ifndef MGMAPI_CONFIG_PARAMTERS_H
+#define MGMAPI_CONFIG_PARAMTERS_H
+
+#define CFG_SYS_NAME 3
+#define CFG_SYS_PRIMARY_MGM_NODE 1
+#define CFG_SYS_CONFIG_GENERATION 2
+#define CFG_SYS_REPLICATION_ROLE 7
+#define CFG_SYS_PORT_BASE 8
+
+#define CFG_NODE_ID 3
+#define CFG_NODE_BYTE_ORDER 4
+#define CFG_NODE_HOST 5
+#define CFG_NODE_SYSTEM 6
+#define CFG_NODE_DATADIR 7
+
+/**
+ * DB config parameters
+ */
+#define CFG_DB_NO_SAVE_MSGS 100
+
+#define CFG_DB_NO_REPLICAS 101
+#define CFG_DB_NO_TABLES 102
+#define CFG_DB_NO_ATTRIBUTES 103
+#define CFG_DB_NO_INDEXES 104
+#define CFG_DB_NO_TRIGGERS 105
+
+#define CFG_DB_NO_TRANSACTIONS 106
+#define CFG_DB_NO_OPS 107
+#define CFG_DB_NO_SCANS 108
+#define CFG_DB_NO_TRIGGER_OPS 109
+#define CFG_DB_NO_INDEX_OPS 110
+
+#define CFG_DB_TRANS_BUFFER_MEM 111
+#define CFG_DB_DATA_MEM 112
+#define CFG_DB_INDEX_MEM 113
+#define CFG_DB_MEMLOCK 114
+
+#define CFG_DB_START_PARTIAL_TIMEOUT 115
+#define CFG_DB_START_PARTITION_TIMEOUT 116
+#define CFG_DB_START_FAILURE_TIMEOUT 117
+
+#define CFG_DB_HEARTBEAT_INTERVAL 118
+#define CFG_DB_API_HEARTBEAT_INTERVAL 119
+#define CFG_DB_LCP_INTERVAL 120
+#define CFG_DB_GCP_INTERVAL 121
+#define CFG_DB_ARBIT_TIMEOUT 122
+
+#define CFG_DB_WATCHDOG_INTERVAL 123
+#define CFG_DB_STOP_ON_ERROR 124
+
+#define CFG_DB_FILESYSTEM_PATH 125
+#define CFG_DB_NO_REDOLOG_FILES 126
+#define CFG_DB_DISC_BANDWIDTH 127
+#define CFG_DB_SR_DISC_BANDWITH 128
+
+#define CFG_DB_TRANSACTION_CHECK_INTERVAL 129
+#define CFG_DB_TRANSACTION_INACTIVE_TIMEOUT 130
+#define CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT 131
+
+#define CFG_DB_PARALLEL_BACKUPS 132
+#define CFG_DB_BACKUP_MEM 133
+#define CFG_DB_BACKUP_DATA_BUFFER_MEM 134
+#define CFG_DB_BACKUP_LOG_BUFFER_MEM 135
+#define CFG_DB_BACKUP_WRITE_SIZE 136
+
+#define CFG_LOG_DESTINATION 147
+
+#define CFG_DB_DISCLESS 148
+
+#define CFG_DB_NO_ORDERED_INDEXES 149
+#define CFG_DB_NO_UNIQUE_HASH_INDEXES 150
+#define CFG_DB_NO_LOCAL_OPS 151
+#define CFG_DB_NO_LOCAL_SCANS 152
+#define CFG_DB_BATCH_SIZE 153
+
+#define CFG_DB_UNDO_INDEX_BUFFER 154
+#define CFG_DB_UNDO_DATA_BUFFER 155
+#define CFG_DB_REDO_BUFFER 156
+
+#define CFG_DB_LONG_SIGNAL_BUFFER 157
+
+#define CFG_DB_BACKUP_DATADIR 158
+
+#define CFG_DB_MAX_OPEN_FILES 159
+
+#define CFG_NODE_ARBIT_RANK 200
+#define CFG_NODE_ARBIT_DELAY 201
+
+#define CFG_MIN_LOGLEVEL 250
+#define CFG_LOGLEVEL_STARTUP 250
+#define CFG_LOGLEVEL_SHUTDOWN 251
+#define CFG_LOGLEVEL_STATISTICS 252
+#define CFG_LOGLEVEL_CHECKPOINT 253
+#define CFG_LOGLEVEL_NODERESTART 254
+#define CFG_LOGLEVEL_CONNECTION 255
+#define CFG_LOGLEVEL_INFO 256
+#define CFG_LOGLEVEL_WARNING 257
+#define CFG_LOGLEVEL_ERROR 258
+#define CFG_LOGLEVEL_CONGESTION 259
+#define CFG_LOGLEVEL_DEBUG 260
+#define CFG_LOGLEVEL_BACKUP 261
+#define CFG_MAX_LOGLEVEL 261
+
+#define CFG_MGM_PORT 300
+
+#define CFG_CONNECTION_NODE_1 400
+#define CFG_CONNECTION_NODE_2 401
+#define CFG_CONNECTION_SEND_SIGNAL_ID 402
+#define CFG_CONNECTION_CHECKSUM 403
+#define CFG_CONNECTION_NODE_1_SYSTEM 404
+#define CFG_CONNECTION_NODE_2_SYSTEM 405
+#define CFG_CONNECTION_SERVER_PORT 406
+#define CFG_CONNECTION_HOSTNAME_1 407
+#define CFG_CONNECTION_HOSTNAME_2 408
+#define CFG_CONNECTION_GROUP 409
+
+#define CFG_TCP_SERVER 452
+#define CFG_TCP_SEND_BUFFER_SIZE 454
+#define CFG_TCP_RECEIVE_BUFFER_SIZE 455
+#define CFG_TCP_PROXY 456
+
+#define CFG_SHM_SEND_SIGNAL_ID 500
+#define CFG_SHM_CHECKSUM 501
+#define CFG_SHM_KEY 502
+#define CFG_SHM_BUFFER_MEM 503
+#define CFG_SHM_SIGNUM 504
+
+#define CFG_SCI_HOST1_ID_0 550
+#define CFG_SCI_HOST1_ID_1 551
+#define CFG_SCI_HOST2_ID_0 552
+#define CFG_SCI_HOST2_ID_1 553
+#define CFG_SCI_SEND_LIMIT 554
+#define CFG_SCI_BUFFER_MEM 555
+
+#define CFG_OSE_PRIO_A_SIZE 602
+#define CFG_OSE_PRIO_B_SIZE 603
+#define CFG_OSE_RECEIVE_ARRAY_SIZE 604
+
+#define CFG_REP_HEARTBEAT_INTERVAL 700
+
+/**
+ * API Config variables
+ *
+ */
+#define CFG_MAX_SCAN_BATCH_SIZE 800
+#define CFG_BATCH_BYTE_SIZE 801
+#define CFG_BATCH_SIZE 802
+
+/**
+ * Internal
+ */
+#define CFG_DB_STOP_ON_ERROR_INSERT 1
+
+#define CFG_TYPE_OF_SECTION 999
+#define CFG_SECTION_SYSTEM 1000
+#define CFG_SECTION_NODE 2000
+#define CFG_SECTION_CONNECTION 3000
+
+#define NODE_TYPE_DB 0
+#define NODE_TYPE_API 1
+#define NODE_TYPE_MGM 2
+#define NODE_TYPE_REP 3
+#define NODE_TYPE_EXT_REP 4
+
+#define CONNECTION_TYPE_TCP 0
+#define CONNECTION_TYPE_SHM 1
+#define CONNECTION_TYPE_SCI 2
+#define CONNECTION_TYPE_OSE 3
+
+#endif
diff --git a/storage/ndb/include/mgmapi/mgmapi_config_parameters_debug.h b/storage/ndb/include/mgmapi/mgmapi_config_parameters_debug.h
new file mode 100644
index 00000000000..0241dca90ef
--- /dev/null
+++ b/storage/ndb/include/mgmapi/mgmapi_config_parameters_debug.h
@@ -0,0 +1,8 @@
+#ifndef MGMAPI_CONFIG_PARAMTERS_DEBUG_H
+#define MGMAPI_CONFIG_PARAMTERS_DEBUG_H
+
+#include "mgmapi_config_parameters.h"
+
+#define CFG_DB_STOP_ON_ERROR_INSERT 1
+
+#endif
diff --git a/storage/ndb/include/mgmapi/mgmapi_debug.h b/storage/ndb/include/mgmapi/mgmapi_debug.h
new file mode 100644
index 00000000000..e86d9d4b768
--- /dev/null
+++ b/storage/ndb/include/mgmapi/mgmapi_debug.h
@@ -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 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);
+
+
+ /**
+ *
+ * @param handle the NDB management handle.
+ * @param nodeId the node id. 0 = all db nodes
+ * @param errrorCode the errorCode.
+ * @param reply the reply message.
+ * @return 0 if successful or an error code.
+ */
+ int ndb_mgm_set_int_parameter(NdbMgmHandle handle,
+ int node,
+ int param,
+ unsigned value,
+ struct ndb_mgm_reply* reply);
+
+ int ndb_mgm_set_int64_parameter(NdbMgmHandle handle,
+ int node,
+ int param,
+ unsigned long long value,
+ struct ndb_mgm_reply* reply);
+
+ int ndb_mgm_set_string_parameter(NdbMgmHandle handle,
+ int node,
+ int param,
+ const char * value,
+ struct ndb_mgm_reply* reply);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/storage/ndb/include/mgmapi/ndb_logevent.h b/storage/ndb/include/mgmapi/ndb_logevent.h
new file mode 100644
index 00000000000..d5744b0fffe
--- /dev/null
+++ b/storage/ndb/include/mgmapi/ndb_logevent.h
@@ -0,0 +1,618 @@
+/* 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_LOGEVENT_H
+#define NDB_LOGEVENT_H
+
+/** @addtogroup MGM_C_API
+ * @{
+ */
+
+#include "mgmapi_config_parameters.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /**
+ * Available log events grouped by @ref ndb_mgm_event_category
+ */
+
+ enum Ndb_logevent_type {
+
+ NDB_LE_ILLEGAL_TYPE = -1,
+
+ /** NDB_MGM_EVENT_CATEGORY_CONNECTION */
+ NDB_LE_Connected = 0,
+ /** NDB_MGM_EVENT_CATEGORY_CONNECTION */
+ NDB_LE_Disconnected = 1,
+ /** NDB_MGM_EVENT_CATEGORY_CONNECTION */
+ NDB_LE_CommunicationClosed = 2,
+ /** NDB_MGM_EVENT_CATEGORY_CONNECTION */
+ NDB_LE_CommunicationOpened = 3,
+ /** NDB_MGM_EVENT_CATEGORY_CONNECTION */
+ NDB_LE_ConnectedApiVersion = 51,
+
+ /** NDB_MGM_EVENT_CATEGORY_CHECKPOINT */
+ NDB_LE_GlobalCheckpointStarted = 4,
+ /** NDB_MGM_EVENT_CATEGORY_CHECKPOINT */
+ NDB_LE_GlobalCheckpointCompleted = 5,
+ /** NDB_MGM_EVENT_CATEGORY_CHECKPOINT */
+ NDB_LE_LocalCheckpointStarted = 6,
+ /** NDB_MGM_EVENT_CATEGORY_CHECKPOINT */
+ NDB_LE_LocalCheckpointCompleted = 7,
+ /** NDB_MGM_EVENT_CATEGORY_CHECKPOINT */
+ NDB_LE_LCPStoppedInCalcKeepGci = 8,
+ /** NDB_MGM_EVENT_CATEGORY_CHECKPOINT */
+ NDB_LE_LCPFragmentCompleted = 9,
+
+ /** NDB_MGM_EVENT_CATEGORY_STARTUP */
+ NDB_LE_NDBStartStarted = 10,
+ /** NDB_MGM_EVENT_CATEGORY_STARTUP */
+ NDB_LE_NDBStartCompleted = 11,
+ /** NDB_MGM_EVENT_CATEGORY_STARTUP */
+ NDB_LE_STTORRYRecieved = 12,
+ /** NDB_MGM_EVENT_CATEGORY_STARTUP */
+ NDB_LE_StartPhaseCompleted = 13,
+ /** NDB_MGM_EVENT_CATEGORY_STARTUP */
+ NDB_LE_CM_REGCONF = 14,
+ /** NDB_MGM_EVENT_CATEGORY_STARTUP */
+ NDB_LE_CM_REGREF = 15,
+ /** NDB_MGM_EVENT_CATEGORY_STARTUP */
+ NDB_LE_FIND_NEIGHBOURS = 16,
+ /** NDB_MGM_EVENT_CATEGORY_STARTUP */
+ NDB_LE_NDBStopStarted = 17,
+ /** NDB_MGM_EVENT_CATEGORY_STARTUP */
+ NDB_LE_NDBStopAborted = 18,
+ /** NDB_MGM_EVENT_CATEGORY_STARTUP */
+ NDB_LE_StartREDOLog = 19,
+ /** NDB_MGM_EVENT_CATEGORY_STARTUP */
+ NDB_LE_StartLog = 20,
+ /** NDB_MGM_EVENT_CATEGORY_STARTUP */
+ NDB_LE_UNDORecordsExecuted = 21,
+
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_NR_CopyDict = 22,
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_NR_CopyDistr = 23,
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_NR_CopyFragsStarted = 24,
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_NR_CopyFragDone = 25,
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_NR_CopyFragsCompleted = 26,
+
+ /* NODEFAIL */
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_NodeFailCompleted = 27,
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_NODE_FAILREP = 28,
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_ArbitState = 29,
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_ArbitResult = 30,
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_GCP_TakeoverStarted = 31,
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_GCP_TakeoverCompleted = 32,
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_LCP_TakeoverStarted = 33,
+ /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
+ NDB_LE_LCP_TakeoverCompleted = 34,
+
+ /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
+ NDB_LE_TransReportCounters = 35,
+ /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
+ NDB_LE_OperationReportCounters = 36,
+ /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
+ NDB_LE_TableCreated = 37,
+ /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
+ NDB_LE_UndoLogBlocked = 38,
+ /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
+ NDB_LE_JobStatistic = 39,
+ /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
+ NDB_LE_SendBytesStatistic = 40,
+ /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
+ NDB_LE_ReceiveBytesStatistic = 41,
+ /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
+ NDB_LE_MemoryUsage = 50,
+
+ /** NDB_MGM_EVENT_CATEGORY_ERROR */
+ NDB_LE_TransporterError = 42,
+ /** NDB_MGM_EVENT_CATEGORY_ERROR */
+ NDB_LE_TransporterWarning = 43,
+ /** NDB_MGM_EVENT_CATEGORY_ERROR */
+ NDB_LE_MissedHeartbeat = 44,
+ /** NDB_MGM_EVENT_CATEGORY_ERROR */
+ NDB_LE_DeadDueToHeartbeat = 45,
+ /** NDB_MGM_EVENT_CATEGORY_ERROR */
+ NDB_LE_WarningEvent = 46,
+
+ /** NDB_MGM_EVENT_CATEGORY_INFO */
+ NDB_LE_SentHeartbeat = 47,
+ /** NDB_MGM_EVENT_CATEGORY_INFO */
+ NDB_LE_CreateLogBytes = 48,
+ /** NDB_MGM_EVENT_CATEGORY_INFO */
+ NDB_LE_InfoEvent = 49,
+
+ /* GREP */
+ NDB_LE_GrepSubscriptionInfo = 52,
+ NDB_LE_GrepSubscriptionAlert = 53,
+
+ /** NDB_MGM_EVENT_CATEGORY_BACKUP */
+ NDB_LE_BackupStarted = 54,
+ /** NDB_MGM_EVENT_CATEGORY_BACKUP */
+ NDB_LE_BackupFailedToStart = 55,
+ /** NDB_MGM_EVENT_CATEGORY_BACKUP */
+ NDB_LE_BackupCompleted = 56,
+ /** NDB_MGM_EVENT_CATEGORY_BACKUP */
+ NDB_LE_BackupAborted = 57
+ };
+
+ /**
+ * Log event severities (used to filter the cluster log,
+ * ndb_mgm_set_clusterlog_severity_filter(), and filter listening to events
+ * ndb_mgm_listen_event())
+ */
+ enum ndb_mgm_event_severity {
+ NDB_MGM_ILLEGAL_EVENT_SEVERITY = -1,
+ /* Must be a nonnegative integer (used for array indexing) */
+ /** Cluster log on */
+ NDB_MGM_EVENT_SEVERITY_ON = 0,
+ /** Used in NDB Cluster developement */
+ NDB_MGM_EVENT_SEVERITY_DEBUG = 1,
+ /** Informational messages*/
+ NDB_MGM_EVENT_SEVERITY_INFO = 2,
+ /** Conditions that are not error condition, but might require handling.
+ */
+ NDB_MGM_EVENT_SEVERITY_WARNING = 3,
+ /** Conditions that, while not fatal, should be corrected. */
+ NDB_MGM_EVENT_SEVERITY_ERROR = 4,
+ /** Critical conditions, like device errors or out of resources */
+ NDB_MGM_EVENT_SEVERITY_CRITICAL = 5,
+ /** A condition that should be corrected immediately,
+ * such as a corrupted system
+ */
+ NDB_MGM_EVENT_SEVERITY_ALERT = 6,
+ /* must be next number, works as bound in loop */
+ /** All severities */
+ NDB_MGM_EVENT_SEVERITY_ALL = 7
+ };
+
+ /**
+ * Log event categories, used to set filter level on the log events using
+ * ndb_mgm_set_clusterlog_loglevel() and ndb_mgm_listen_event()
+ */
+ enum ndb_mgm_event_category {
+ /**
+ * Invalid log event category
+ */
+ NDB_MGM_ILLEGAL_EVENT_CATEGORY = -1,
+ /**
+ * Log events during all kinds of startups
+ */
+ NDB_MGM_EVENT_CATEGORY_STARTUP = CFG_LOGLEVEL_STARTUP,
+ /**
+ * Log events during shutdown
+ */
+ NDB_MGM_EVENT_CATEGORY_SHUTDOWN = CFG_LOGLEVEL_SHUTDOWN,
+ /**
+ * Statistics log events
+ */
+ NDB_MGM_EVENT_CATEGORY_STATISTIC = CFG_LOGLEVEL_STATISTICS,
+ /**
+ * Log events related to checkpoints
+ */
+ NDB_MGM_EVENT_CATEGORY_CHECKPOINT = CFG_LOGLEVEL_CHECKPOINT,
+ /**
+ * Log events during node restart
+ */
+ NDB_MGM_EVENT_CATEGORY_NODE_RESTART = CFG_LOGLEVEL_NODERESTART,
+ /**
+ * Log events related to connections between cluster nodes
+ */
+ NDB_MGM_EVENT_CATEGORY_CONNECTION = CFG_LOGLEVEL_CONNECTION,
+ /**
+ * Backup related log events
+ */
+ NDB_MGM_EVENT_CATEGORY_BACKUP = CFG_LOGLEVEL_BACKUP,
+ /**
+ * Congestion related log events
+ */
+ NDB_MGM_EVENT_CATEGORY_CONGESTION = CFG_LOGLEVEL_CONGESTION,
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * Loglevel debug
+ */
+ NDB_MGM_EVENT_CATEGORY_DEBUG = CFG_LOGLEVEL_DEBUG,
+#endif
+ /**
+ * Uncategorized log events (severity info)
+ */
+ NDB_MGM_EVENT_CATEGORY_INFO = CFG_LOGLEVEL_INFO,
+ /**
+ * Uncategorized log events (severity warning or higher)
+ */
+ NDB_MGM_EVENT_CATEGORY_ERROR = CFG_LOGLEVEL_ERROR,
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ NDB_MGM_MIN_EVENT_CATEGORY = CFG_MIN_LOGLEVEL,
+ NDB_MGM_MAX_EVENT_CATEGORY = CFG_MAX_LOGLEVEL
+#endif
+ };
+
+ /**
+ * Structure to store and retrieve log event information.
+ * @see @ref secSLogEvents
+ */
+ struct ndb_logevent {
+ /** NdbLogEventHandle (to be used for comparing only)
+ * set in ndb_logevent_get_next()
+ */
+ void *handle;
+
+ /** Which event */
+ enum Ndb_logevent_type type;
+
+ /** Time when log event was registred at the management server */
+ unsigned time;
+
+ /** Category of log event */
+ enum ndb_mgm_event_category category;
+
+ /** Severity of log event */
+ enum ndb_mgm_event_severity severity;
+
+ /** Level (0-15) of log event */
+ unsigned level;
+
+ /** Node ID of the node that reported the log event */
+ unsigned source_nodeid;
+
+ /** Union of log event specific data. Use @ref type to decide
+ * which struct to use
+ */
+ union {
+ /* CONNECT */
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned node;
+ } Connected;
+
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned node;
+ } Disconnected;
+
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned node;
+ } CommunicationClosed;
+
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned node;
+ } CommunicationOpened;
+
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned node;
+ unsigned version;
+ } ConnectedApiVersion;
+
+ /* CHECKPOINT */
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned gci;
+ } GlobalCheckpointStarted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned gci;
+ } GlobalCheckpointCompleted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned lci;
+ unsigned keep_gci;
+ unsigned restore_gci;
+ } LocalCheckpointStarted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned lci;
+ } LocalCheckpointCompleted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned data;
+ } LCPStoppedInCalcKeepGci;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned node;
+ unsigned table_id;
+ unsigned fragment_id;
+ } LCPFragmentCompleted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned acc_count;
+ unsigned tup_count;
+ } UndoLogBlocked;
+
+ /* STARTUP */
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned version;
+ } NDBStartStarted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned version;
+ } NDBStartCompleted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ } STTORRYRecieved;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned phase;
+ unsigned starttype;
+ } StartPhaseCompleted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned own_id;
+ unsigned president_id;
+ unsigned dynamic_id;
+ } CM_REGCONF;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned own_id;
+ unsigned other_id;
+ unsigned cause;
+ } CM_REGREF;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned own_id;
+ unsigned left_id;
+ unsigned right_id;
+ unsigned dynamic_id;
+ } FIND_NEIGHBOURS;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned stoptype;
+ } NDBStopStarted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ } NDBStopAborted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned node;
+ unsigned keep_gci;
+ unsigned completed_gci;
+ unsigned restorable_gci;
+ } StartREDOLog;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned log_part;
+ unsigned start_mb;
+ unsigned stop_mb;
+ unsigned gci;
+ } StartLog;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned block;
+ unsigned data1;
+ unsigned data2;
+ unsigned data3;
+ unsigned data4;
+ unsigned data5;
+ unsigned data6;
+ unsigned data7;
+ unsigned data8;
+ unsigned data9;
+ unsigned data10;
+ } UNDORecordsExecuted;
+
+ /* NODERESTART */
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ } NR_CopyDict;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ } NR_CopyDistr;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned dest_node;
+ } NR_CopyFragsStarted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned dest_node;
+ unsigned table_id;
+ unsigned fragment_id;
+ } NR_CopyFragDone;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned dest_node;
+ } NR_CopyFragsCompleted;
+
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned block; /* 0 = all */
+ unsigned failed_node;
+ unsigned completing_node; /* 0 = all */
+ } NodeFailCompleted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned failed_node;
+ unsigned failure_state;
+ } NODE_FAILREP;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned code; /* code & state << 16 */
+ unsigned arbit_node;
+ unsigned ticket_0;
+ unsigned ticket_1;
+ /* TODO */
+ } ArbitState;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned code; /* code & state << 16 */
+ unsigned arbit_node;
+ unsigned ticket_0;
+ unsigned ticket_1;
+ /* TODO */
+ } ArbitResult;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ } GCP_TakeoverStarted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ } GCP_TakeoverCompleted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ } LCP_TakeoverStarted;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned state;
+ } LCP_TakeoverCompleted;
+
+ /* STATISTIC */
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned trans_count;
+ unsigned commit_count;
+ unsigned read_count;
+ unsigned simple_read_count;
+ unsigned write_count;
+ unsigned attrinfo_count;
+ unsigned conc_op_count;
+ unsigned abort_count;
+ unsigned scan_count;
+ unsigned range_scan_count;
+ } TransReportCounters;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned ops;
+ } OperationReportCounters;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned table_id;
+ } TableCreated;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned mean_loop_count;
+ } JobStatistic;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned to_node;
+ unsigned mean_sent_bytes;
+ } SendBytesStatistic;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned from_node;
+ unsigned mean_received_bytes;
+ } ReceiveBytesStatistic;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ int gth;
+ unsigned page_size_kb;
+ unsigned pages_used;
+ unsigned pages_total;
+ unsigned block;
+ } MemoryUsage;
+
+ /* ERROR */
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned to_node;
+ unsigned code;
+ } TransporterError;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned to_node;
+ unsigned code;
+ } TransporterWarning;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned node;
+ unsigned count;
+ } MissedHeartbeat;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned node;
+ } DeadDueToHeartbeat;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ /* TODO */
+ } WarningEvent;
+
+ /* INFO */
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned node;
+ } SentHeartbeat;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned node;
+ } CreateLogBytes;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ /* TODO */
+ } InfoEvent;
+
+ /** Log event data for @ref NDB_LE_BackupStarted */
+ struct {
+ unsigned starting_node;
+ unsigned backup_id;
+ } BackupStarted;
+ /** Log event data @ref NDB_LE_BackupFailedToStart */
+ struct {
+ unsigned starting_node;
+ unsigned error;
+ } BackupFailedToStart;
+ /** Log event data @ref NDB_LE_BackupCompleted */
+ struct {
+ unsigned starting_node;
+ unsigned backup_id;
+ unsigned start_gci;
+ unsigned stop_gci;
+ unsigned n_records;
+ unsigned n_log_records;
+ unsigned n_bytes;
+ unsigned n_log_bytes;
+ } BackupCompleted;
+ /** Log event data @ref NDB_LE_BackupAborted */
+ struct {
+ unsigned starting_node;
+ unsigned backup_id;
+ unsigned error;
+ } BackupAborted;
+#ifndef DOXYGEN_FIX
+ };
+#else
+ } <union>;
+#endif
+ };
+
+enum ndb_logevent_handle_error {
+ NDB_LEH_NO_ERROR,
+ NDB_LEH_READ_ERROR,
+ NDB_LEH_MISSING_EVENT_SPECIFIER,
+ NDB_LEH_UNKNOWN_EVENT_TYPE,
+ NDB_LEH_UNKNOWN_EVENT_VARIABLE,
+ NDB_LEH_INTERNAL_ERROR
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif
diff --git a/storage/ndb/include/mgmcommon/ConfigRetriever.hpp b/storage/ndb/include/mgmcommon/ConfigRetriever.hpp
new file mode 100644
index 00000000000..95d257dea23
--- /dev/null
+++ b/storage/ndb/include/mgmcommon/ConfigRetriever.hpp
@@ -0,0 +1,106 @@
+/* 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 <mgmapi.h>
+#include <BaseString.hpp>
+
+/**
+ * @class ConfigRetriever
+ * @brief Used by nodes (DB, MGM, API) to get their config from MGM server.
+ */
+class ConfigRetriever {
+public:
+ ConfigRetriever(const char * _connect_string,
+ Uint32 version, Uint32 nodeType);
+ ~ConfigRetriever();
+
+ int do_connect(int no_retries, int retry_delay_in_seconds, int verbose);
+
+ /**
+ * Get configuration for current 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 ndb_mgm_configuration object if succeeded,
+ * NULL if erroneous local config file or configuration error.
+ */
+ struct ndb_mgm_configuration * getConfig();
+
+ void resetError();
+ int hasError();
+ const char * getErrorString();
+
+ /**
+ * @return Node id of this node (as stated in local config or connectString)
+ */
+ Uint32 allocNodeId(int no_retries, int retry_delay_in_seconds);
+
+ int setNodeId(Uint32 nodeid);
+
+ /**
+ * Get config using socket
+ */
+ struct ndb_mgm_configuration * getConfig(NdbMgmHandle handle);
+
+ /**
+ * Get config from file
+ */
+ struct ndb_mgm_configuration * getConfig(const char * file);
+
+ /**
+ * Verify config
+ */
+ bool verifyConfig(const struct ndb_mgm_configuration *, Uint32 nodeid);
+
+ Uint32 get_mgmd_port() const;
+ const char *get_mgmd_host() const;
+ const char *get_connectstring(char *buf, int buf_sz) const;
+ NdbMgmHandle get_mgmHandle() { return m_handle; };
+ NdbMgmHandle* get_mgmHandlePtr() { return &m_handle; };
+
+ Uint32 get_configuration_nodeid() const;
+private:
+ BaseString errorString;
+ enum ErrorType {
+ CR_NO_ERROR = 0,
+ CR_ERROR = 1,
+ CR_RETRY = 2
+ };
+ ErrorType latestErrorType;
+
+ void setError(ErrorType, const char * errorMsg);
+
+ Uint32 _ownNodeId;
+ /*
+ Uint32 m_mgmd_port;
+ const char *m_mgmd_host;
+ */
+
+ Uint32 m_version;
+ Uint32 m_node_type;
+ NdbMgmHandle m_handle;
+};
+
+#endif
+
+
diff --git a/storage/ndb/include/mgmcommon/IPCConfig.hpp b/storage/ndb/include/mgmcommon/IPCConfig.hpp
new file mode 100644
index 00000000000..1e23cdf9807
--- /dev/null
+++ b/storage/ndb/include/mgmcommon/IPCConfig.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 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(); }
+
+ static Uint32 configureTransporters(Uint32 nodeId,
+ const struct ndb_mgm_configuration &,
+ class TransporterRegistry &);
+
+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/storage/ndb/include/mgmcommon/MgmtErrorReporter.hpp b/storage/ndb/include/mgmcommon/MgmtErrorReporter.hpp
new file mode 100644
index 00000000000..0d980aa7245
--- /dev/null
+++ b/storage/ndb/include/mgmcommon/MgmtErrorReporter.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 */
+
+//******************************************************************************
+// Description: This file contains the error reporting macros to be used
+// within management server.
+//
+// Author: Peter Lind
+//******************************************************************************
+
+
+#include <ndb_global.h> // exit
+#include <NdbOut.hpp>
+
+#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: -
+//****************************************************************************
+
+#define MGM_REQUIRE(x) \
+ if (!(x)) { ndbout << __FILE__ << " " << __LINE__ \
+ << ": Warning! Requirement failed" << endl; }
diff --git a/storage/ndb/include/ndb_constants.h b/storage/ndb/include/ndb_constants.h
new file mode 100644
index 00000000000..c292880749b
--- /dev/null
+++ b/storage/ndb/include/ndb_constants.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 */
+
+/**
+ * @file ndb_constants.h
+ *
+ * Constants common to NDB API and NDB kernel.
+ * Changing the values makes database upgrade impossible.
+ *
+ * New or removed definitions must be replicated to
+ * NdbDictionary.hpp and NdbSqlUtil.hpp.
+ *
+ * Not for use by application programs.
+ * Use the enums provided by NdbDictionary instead.
+ */
+
+#ifndef NDB_CONSTANTS_H
+#define NDB_CONSTANTS_H
+
+/*
+ * Data type constants.
+ */
+
+#define NDB_TYPE_UNDEFINED 0
+
+#define NDB_TYPE_TINYINT 1
+#define NDB_TYPE_TINYUNSIGNED 2
+#define NDB_TYPE_SMALLINT 3
+#define NDB_TYPE_SMALLUNSIGNED 4
+#define NDB_TYPE_MEDIUMINT 5
+#define NDB_TYPE_MEDIUMUNSIGNED 6
+#define NDB_TYPE_INT 7
+#define NDB_TYPE_UNSIGNED 8
+#define NDB_TYPE_BIGINT 9
+#define NDB_TYPE_BIGUNSIGNED 10
+#define NDB_TYPE_FLOAT 11
+#define NDB_TYPE_DOUBLE 12
+#define NDB_TYPE_OLDDECIMAL 13
+#define NDB_TYPE_CHAR 14
+#define NDB_TYPE_VARCHAR 15
+#define NDB_TYPE_BINARY 16
+#define NDB_TYPE_VARBINARY 17
+#define NDB_TYPE_DATETIME 18
+#define NDB_TYPE_DATE 19
+#define NDB_TYPE_BLOB 20
+#define NDB_TYPE_TEXT 21
+#define NDB_TYPE_BIT 22
+#define NDB_TYPE_LONGVARCHAR 23
+#define NDB_TYPE_LONGVARBINARY 24
+#define NDB_TYPE_TIME 25
+#define NDB_TYPE_YEAR 26
+#define NDB_TYPE_TIMESTAMP 27
+#define NDB_TYPE_OLDDECIMALUNSIGNED 28
+#define NDB_TYPE_DECIMAL 29
+#define NDB_TYPE_DECIMALUNSIGNED 30
+
+#define NDB_TYPE_MAX 31
+
+#endif
diff --git a/storage/ndb/include/ndb_global.h.in b/storage/ndb/include/ndb_global.h.in
new file mode 100644
index 00000000000..43f90e1f8b5
--- /dev/null
+++ b/storage/ndb/include/ndb_global.h.in
@@ -0,0 +1,139 @@
+/* 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_GLOBAL_H
+#define NDB_GLOBAL_H
+
+#include <ndb_types.h>
+
+#define NDB_PORT "@ndb_port@"
+#define NDB_TCP_BASE_PORT "@ndb_port_base@"
+
+#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
+#define NDB_WIN32
+#include <winsock2.h>
+#define PATH_MAX 256
+#define DIR_SEPARATOR "\\"
+#define MYSQLCLUSTERDIR "c:\\mysql\\mysql-cluster"
+#define HAVE_STRCASECMP
+#define strcasecmp _strcmpi
+#pragma warning(disable: 4503 4786)
+#else
+#undef NDB_WIN32
+#define DIR_SEPARATOR "/"
+#endif
+
+#include <my_global.h>
+
+#if ! (NDB_SIZEOF_CHAR == SIZEOF_CHAR)
+#error "Invalid define for Uint8"
+#endif
+
+#if ! (NDB_SIZEOF_INT == SIZEOF_INT)
+#error "Invalid define for Uint32"
+#endif
+
+#if ! (NDB_SIZEOF_LONG_LONG == SIZEOF_LONG_LONG)
+#error "Invalid define for Uint64"
+#endif
+
+#include <my_alarm.h>
+
+#ifdef _AIX
+#undef _H_STRINGS
+#endif
+#include <m_string.h>
+#include <m_ctype.h>
+#include <ctype.h>
+
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+
+#ifdef TIME_WITH_SYS_TIME
+#include <time.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+ #if defined(__cplusplus) && defined(_APP32_64BIT_OFF_T) && defined(_INCLUDE_AES_SOURCE)
+ #undef _INCLUDE_AES_SOURCE
+ #include <sys/stat.h>
+ #define _INCLUDE_AES_SOURCE
+ #else
+ #include <sys/stat.h>
+ #endif
+#endif
+
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
+#ifndef HAVE_STRDUP
+extern char * strdup(const char *s);
+#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
+
+static const char table_name_separator = '/';
+
+#if defined(_AIX) || defined(WIN32) || defined(NDB_VC98)
+#define STATIC_CONST(x) enum { x }
+#else
+#define STATIC_CONST(x) static const Uint32 x
+#endif
+
+#ifdef __cplusplus
+inline void* operator new(size_t, void* __p) { return __p; }
+inline void* operator new[](size_t, void* __p) { return __p; }
+extern "C" {
+#endif
+
+#include <assert.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#include "ndb_init.h"
+
+#ifdef SCO
+
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
+#endif /* SCO */
+
+#endif
diff --git a/storage/ndb/include/ndb_init.h b/storage/ndb/include/ndb_init.h
new file mode 100644
index 00000000000..0ff53e6a2af
--- /dev/null
+++ b/storage/ndb/include/ndb_init.h
@@ -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 NDB_INIT_H
+#define NDB_INIT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* call in main() - does not return on error */
+extern int ndb_init(void);
+extern void ndb_end(int);
+#define NDB_INIT(prog_name) {my_progname=(prog_name); ndb_init();}
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/storage/ndb/include/ndb_net.h b/storage/ndb/include/ndb_net.h
new file mode 100644
index 00000000000..279beb471a7
--- /dev/null
+++ b/storage/ndb/include/ndb_net.h
@@ -0,0 +1,7 @@
+
+#ifndef NDBNET_H
+#define NDBNET_H
+
+#include <my_net.h>
+
+#endif
diff --git a/storage/ndb/include/ndb_types.h.in b/storage/ndb/include/ndb_types.h.in
new file mode 100644
index 00000000000..2a5d576ffea
--- /dev/null
+++ b/storage/ndb/include/ndb_types.h.in
@@ -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 */
+
+/**
+ * @file ndb_types.h
+ */
+
+#ifndef NDB_TYPES_H
+#define NDB_TYPES_H
+
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(_WIN64)
+#define NDB_SIZEOF_CHARP SIZEOF_CHARP
+#define NDB_SIZEOF_CHAR SIZEOF_CHAR
+#define NDB_SIZEOF_SHORT 2
+#define NDB_SIZEOF_INT SIZEOF_INT
+#define NDB_SIZEOF_LONG SIZEOF_LONG
+#define NDB_SIZEOF_LONG_LONG SIZEOF_LONG_LONG
+typedef unsigned __int64 Uint64;
+typedef signed __int64 Int64;
+#else
+#define NDB_SIZEOF_CHARP @NDB_SIZEOF_CHARP@
+#define NDB_SIZEOF_CHAR @NDB_SIZEOF_CHAR@
+#define NDB_SIZEOF_INT @NDB_SIZEOF_INT@
+#define NDB_SIZEOF_SHORT @NDB_SIZEOF_SHORT@
+#define NDB_SIZEOF_LONG @NDB_SIZEOF_LONG@
+#define NDB_SIZEOF_LONG_LONG @NDB_SIZEOF_LONG_LONG@
+typedef unsigned long long Uint64;
+typedef signed long long Int64;
+#endif
+
+typedef signed char Int8;
+typedef unsigned char Uint8;
+typedef signed short Int16;
+typedef unsigned short Uint16;
+typedef signed int Int32;
+typedef unsigned int Uint32;
+
+typedef unsigned int UintR;
+
+#ifdef __SIZE_TYPE__
+ typedef __SIZE_TYPE__ UintPtr;
+#elif NDB_SIZEOF_CHARP == 4
+ typedef Uint32 UintPtr;
+#elif NDB_SIZEOF_CHARP == 8
+ typedef Uint64 UintPtr;
+#else
+ #error "Unknown size of (char *)"
+#endif
+
+#if ! (NDB_SIZEOF_CHAR == 1)
+#error "Invalid define for Uint8"
+#endif
+
+#if ! (NDB_SIZEOF_SHORT == 2)
+#error "Invalid define for Uint16"
+#endif
+
+#if ! (NDB_SIZEOF_INT == 4)
+#error "Invalid define for Uint32"
+#endif
+
+#if ! (NDB_SIZEOF_LONG_LONG == 8)
+#error "Invalid define for Uint64"
+#endif
+
+#include "ndb_constants.h"
+
+#endif
diff --git a/storage/ndb/include/ndb_version.h.in b/storage/ndb/include/ndb_version.h.in
new file mode 100644
index 00000000000..d7f43eae40a
--- /dev/null
+++ b/storage/ndb/include/ndb_version.h.in
@@ -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 <ndb_global.h>
+#include <version.h>
+
+/* NDB build version */
+#define NDB_VERSION_BUILD @NDB_VERSION_BUILD@
+
+/* NDB major version */
+#define NDB_VERSION_MAJOR @NDB_VERSION_MAJOR@
+
+/* NDB minor version */
+#define NDB_VERSION_MINOR @NDB_VERSION_MINOR@
+
+/* NDB status version */
+#define NDB_VERSION_STATUS "@NDB_VERSION_STATUS@"
+
+
+#define MAKE_VERSION(A,B,C) (((A) << 16) | ((B) << 8) | ((C) << 0))
+
+#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 ndbGetOwnVersion()
+
+/**
+ * Version id
+ *
+ * Used by transporter and when communicating with
+ * managment server
+ */
+/*#define NDB_VERSION_ID 0*/
+
+#endif
+
diff --git a/storage/ndb/include/ndbapi/Ndb.hpp b/storage/ndb/include/ndbapi/Ndb.hpp
new file mode 100644
index 00000000000..41085e6e06a
--- /dev/null
+++ b/storage/ndb/include/ndbapi/Ndb.hpp
@@ -0,0 +1,1700 @@
+/* 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 MySQL Cluster concepts found
+ on http://dev.mysql.com/doc/mysql/en/NDBCluster.html .
+ Some of the fundamental ones are also described in section @ref secConcepts.
+
+ The NDB API is a MySQL Cluster application interface
+ that implements transactions.
+ The NDB API consists of the following fundamental classes:
+ - Ndb_cluster_connection, representing a connection to a cluster,
+ - Ndb is the main class, representing a connection to a database,
+ - NdbTransaction represents a transaction,
+ - NdbOperation represents an operation using a primary key,
+ - NdbScanOperation represents an operation performing a full table scan.
+ - NdbIndexOperation represents an operation using a unique hash index,
+ - NdbIndexScanOperation represents an operation performing a scan using
+ an ordered index,
+ - NdbRecAttr represents an attribute value
+ - NdbDictionary represents meta information about tables and attributes.
+
+ In addition, the NDB API defines a structure NdbError, which contains the
+ specification for an error.
+
+ It is also possible to receive "events" triggered when data in the database in changed.
+ This is done through the NdbEventOperation class.
+
+ There are also some auxiliary classes, which are listed in the class hierarchy.
+
+ The main structure of an application program is as follows:
+ -# Connect to a cluster using the Ndb_cluster_connection
+ object.
+ -# Initiate a database connection by constructing and initialising one or more Ndb objects.
+ -# Define and execute transactions using the NdbTransaction class.
+ -# Delete Ndb objects.
+ -# Terminate the connection to the cluster (terminate instance of Ndb_cluster_connection).
+
+ The procedure for using transactions is as follows:
+ -# Start transaction (instantiate an NdbTransaction object)
+ -# Add and define operations associated with the transaction using instances of one or more of the
+ NdbOperation, NdbScanOperation, NdbIndexOperation, and NdbIndexScanOperation classes
+ -# Execute transaction (call NdbTransaction::execute())
+
+ The operation can be of two different types,
+ <var>Commit</var> or <var>NoCommit</var>.
+ If the operation is of type <var>NoCommit</var>,
+ then the application program executes the operation part of a transaction,
+ but without actually committing the transaction.
+ After executing a <var>NoCommit</var> operation, the program can continue
+ to add and define more operations to the transaction
+ for later execution.
+
+ If the operation is of type <var>Commit</var>, then the transaction is
+ immediately committed. The transaction <em>must</em> be closed after it has been
+ commited (event if commit fails), and no further addition or definition of
+ operations for this transaction is allowed.
+
+ @section secSync Synchronous Transactions
+
+ Synchronous transactions are defined and executed as follows:
+
+ -# Start (create) the transaction, which is
+ referenced by an NdbTransaction object
+ (typically created using Ndb::startTransaction()).
+ At this point, the transaction is only being defined,
+ and is not yet sent to the NDB kernel.
+ -# Define operations and add them to the transaction, using one or more of
+ - NdbTransaction::getNdbOperation()
+ - NdbTransaction::getNdbScanOperation()
+ - NdbTransaction::getNdbIndexOperation()
+ - NdbTransaction::getNdbIndexScanOperation()
+ along with the appropriate methods of the respective NdbOperation class
+ (or one possiblt one or more of its subclasses).
+ Note that the transaction has still not yet been sent to the NDB kernel.
+ -# Execute the transaction, using the NdbTransaction::execute() method.
+ -# Close the transaction (call Ndb::closeTransaction()).
+
+ For an example of this process, see the program listing in
+ @ref ndbapi_simple.cpp.
+
+ To execute several parallel synchronous transactions, one can either
+ use multiple Ndb objects in several threads, or start multiple
+ application programs.
+
+ @section secNdbOperations Operations
+
+ A NdbTransaction consists of a list of operations, each of which is represented
+ by an instance of NdbOperation, NdbScanOperation, NdbIndexOperation, or
+ NdbIndexScanOperation.
+
+ <h3>Single row operations</h3>
+ After the operation is created using NdbTransaction::getNdbOperation()
+ (or NdbTransaction::getNdbIndexOperation()), it is defined in the following
+ three steps:
+ -# Define the standard operation type, using NdbOperation::readTuple()
+ -# Specify search conditions, using NdbOperation::equal()
+ -# Specify attribute actions, using NdbOperation::getValue()
+
+ Here are two brief examples illustrating this process. For the sake of
+ brevity, we omit error handling.
+
+ This first example uses an NdbOperation:
+ @code
+ // 1. Retrieve table object
+ myTable= myDict->getTable("MYTABLENAME");
+
+ // 2. Create
+ myOperation= myTransaction->getNdbOperation(myTable);
+
+ // 3. Define type of operation and lock mode
+ myOperation->readTuple(NdbOperation::LM_Read);
+
+ // 4. Specify Search Conditions
+ myOperation->equal("ATTR1", i);
+
+ // 5. Attribute Actions
+ myRecAttr= myOperation->getValue("ATTR2", NULL);
+ @endcode
+ For additional examples of this sort, see @ref ndbapi_simple.cpp.
+
+ The second example uses an NdbIndexOperation:
+ @code
+ // 1. Retrieve index object
+ myIndex= myDict->getIndex("MYINDEX", "MYTABLENAME");
+
+ // 2. Create
+ myOperation= myTransaction->getNdbIndexOperation(myIndex);
+
+ // 3. Define type of operation and lock mode
+ myOperation->readTuple(NdbOperation::LM_Read);
+
+ // 4. Specify Search Conditions
+ myOperation->equal("ATTR1", i);
+
+ // 5. Attribute Actions
+ myRecAttr = myOperation->getValue("ATTR2", NULL);
+ @endcode
+ Another example of this second type can be found in
+ @ref ndbapi_simple_index.cpp.
+
+ We will now discuss in somewhat greater detail each step involved in the
+ creation and use of synchronous transactions.
+
+ <h4>Step 1: Define single row operation type</h4>
+ The following operation types are supported:
+ -# 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 with specified lock mode
+
+ All of these operations operate on the unique tuple key.
+ (When NdbIndexOperation is used then all of these operations
+ operate on a defined unique hash index.)
+
+ @note If you want to define multiple operations within the same transaction,
+ then you need to call NdbTransaction::getNdbOperation() or
+ NdbTransaction::getNdbIndexOperation() for each operation.
+
+ <h4>Step 2: Specify Search Conditions</h4>
+ The search condition is used to select tuples. Search conditions are set using NdbOperation::equal().
+
+ <h4>Step 3: Specify Attribute Actions</h4>
+ Next, it is necessary to determine which attributes should be read or updated.
+ It is important to remember that:
+ - Deletes can neither read nor set values, but only delete them
+ - Reads can only read values
+ - Updates can only set values
+ Normally the attribute is identified by name, but it is
+ also possible to use the attribute's identity to determine the
+ attribute.
+
+ NdbOperation::getValue() returns an NdbRecAttr object
+ containing the read value.
+ To obtain the actual value, one of two methods can be used;
+ the application can either
+ - use its own memory (passed through a pointer aValue) to
+ NdbOperation::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 cannot reference this object following
+ any subsequent call to Ndb::closeTransaction().
+ Attempting to read data from an NdbRecAttr object before
+ calling NdbTransaction::execute() yields an undefined result.
+
+
+ @subsection secScan Scan Operations
+
+ Scans are roughly the equivalent of SQL cursors, providing a means to
+ preform high-speed row processing. A scan can be performed
+ on either a table (using @ref NdbScanOperation) or
+ an ordered index (by means of an @ref NdbIndexScanOperation).
+
+ Scan operations are characterised by the following:
+ - They can perform only reads (shared, exclusive or dirty)
+ - They can potentially work with multiple rows
+ - They can be used to update or delete multiple rows
+ - They can operate on several nodes in parallel
+
+ After the operation is created using NdbTransaction::getNdbScanOperation()
+ (or NdbTransaction::getNdbIndexScanOperation()),
+ it is carried out in the following three steps:
+ -# Define the standard operation type, using NdbScanOperation::readTuples()
+ -# Specify search conditions, using @ref NdbScanFilter and/or
+ @ref NdbIndexScanOperation::setBound()
+ -# Specify attribute actions, using NdbOperation::getValue()
+ -# Executing the transaction, using NdbTransaction::execute()
+ -# Traversing the result set by means of succssive calls to
+ NdbScanOperation::nextResult()
+
+ Here are two brief examples illustrating this process. Once again, in order
+ to keep things relatively short and simple, we will forego any error handling.
+
+ This first example performs a table scan, using an NdbScanOperation:
+ @code
+ // 1. Retrieve table object
+ myTable= myDict->getTable("MYTABLENAME");
+
+ // 2. Create
+ myOperation= myTransaction->getNdbScanOperation(myTable);
+
+ // 3. Define type of operation and lock mode
+ myOperation->readTuples(NdbOperation::LM_Read);
+
+ // 4. Specify Search Conditions
+ NdbScanFilter sf(myOperation);
+ sf.begin(NdbScanFilter::OR);
+ sf.eq(0, i); // Return rows with column 0 equal to i or
+ sf.eq(1, i+1); // column 1 equal to (i+1)
+ sf.end();
+
+ // 5. Attribute Actions
+ myRecAttr= myOperation->getValue("ATTR2", NULL);
+ @endcode
+
+ Our second example uses an NdbIndexScanOperation to perform an index scan:
+ @code
+ // 1. Retrieve index object
+ myIndex= myDict->getIndex("MYORDEREDINDEX", "MYTABLENAME");
+
+ // 2. Create
+ myOperation= myTransaction->getNdbIndexScanOperation(myIndex);
+
+ // 3. Define type of operation and lock mode
+ myOperation->readTuples(NdbOperation::LM_Read);
+
+ // 4. Specify Search Conditions
+ // All rows with ATTR1 between i and (i+1)
+ myOperation->setBound("ATTR1", NdbIndexScanOperation::BoundGE, i);
+ myOperation->setBound("ATTR1", NdbIndexScanOperation::BoundLE, i+1);
+
+ // 5. Attribute Actions
+ myRecAttr = MyOperation->getValue("ATTR2", NULL);
+ @endcode
+
+ Some additional discussion of each step required to perform a scan follows:
+
+ <h4>Step 1: Define Scan Operation Type</h4>
+ It is important to remember that only a single operation is supported for each scan operation
+ (@ref NdbScanOperation::readTuples() or @ref NdbIndexScanOperation::readTuples()).
+
+ @note If you want to define multiple scan operations within the same
+ transaction, then you need to call
+ NdbTransaction::getNdbScanOperation() or
+ NdbTransaction::getNdbIndexScanOperation() separately for <b>each</b> operation.
+
+ <h4>Step 2: Specify Search Conditions</h4>
+ The search condition is used to select tuples.
+ If no search condition is specified, the scan will return all rows
+ in the table.
+
+ The search condition can be an @ref NdbScanFilter (which can be used on both
+ @ref NdbScanOperation and @ref NdbIndexScanOperation) or bounds which
+ can only be used on index scans (@ref NdbIndexScanOperation::setBound()).
+ An index scan can use both NdbScanFilter and bounds.
+
+ @note When NdbScanFilter is used, each row is examined, whether or not it is
+ actually returned. However, when using bounds, only rows within the bounds will be examined.
+
+ <h4>Step 3: Specify Attribute Actions</h4>
+
+ Next, it is necessary to define which attributes should be read.
+ As with transaction attributes, scan attributes are defined by name but it is
+ also possible to use the attributes' identities to define attributes.
+
+ As previously discussed (see @ref secSync), the value read is returned as
+ an NdbRecAttr object by the NdbOperation::getValue() method.
+
+ <h3>Using Scan to Update/Delete</h3>
+ Scanning can also be used to update or delete rows.
+ This is performed by
+ -# Scanning using exclusive locks (using NdbOperation::LM_Exclusive)
+ -# When iterating through the result set, for each row optionally calling
+ either NdbScanOperation::updateCurrentTuple() or
+ NdbScanOperation::deleteCurrentTuple()
+ -# (If performing NdbScanOperation::updateCurrentTuple():)
+ Setting new values for records simply by using @ref NdbOperation::setValue().
+ NdbOperation::equal() should <em>not</em> be called in such cases, as the primary
+ key is retrieved from the scan.
+
+ @note The actual update or delete will not be performed until the next
+ call to NdbTransaction::execute(), just as with single row operations.
+ NdbTransaction::execute() also must be called before any locks are released;
+ see @ref secScanLocks for more information.
+
+ <h4>Features Specific to Index Scans</h4>
+
+ When performing an index scan, it is possible to
+ scan only a subset of a table using @ref NdbIndexScanOperation::setBound().
+ In addition, result sets can be sorted in either ascending or descending order, using
+ @ref NdbIndexScanOperation::readTuples(). Note that rows are returned unordered
+ by default, that is, unless <var>sorted</var> is set to <b>true</b>.
+ It is also important to note that, when using NdbIndexScanOperation::BoundEQ
+ on a partition key, only fragments containing rows will actually be scanned.
+
+ @note When performing a sorted scan, any value passed as the
+ NdbIndexScanOperation::readTuples() method's <code>parallel</code> argument
+ will be ignored and maximum parallelism will be used instead. In other words, all
+ fragments which it is possible to scan will be scanned simultaneously and in parallel
+ in such cases.
+
+ @subsection secScanLocks Lock handling with scans
+
+ Performing scans on either a tables or an index has the potential
+ return a great many records; however, Ndb will lock only a predetermined
+ number of rows per fragment at a time.
+ How many rows will be locked per fragment is controlled by the
+ <var>batch</var> parameter passed to NdbScanOperation::readTuples().
+
+ In order to allow the application to handle how locks are released,
+ NdbScanOperation::nextResult() has a Boolean parameter <var>fetch_allow</var>.
+ If NdbScanOperation::nextResult() is called with <var>fetch_allow</var> equal to
+ <b>false</b>, then no locks may be released as result of the function call.
+ Otherwise the locks for the current batch may be released.
+
+ This next example shows a scan delete that handle locks in an efficient manner.
+ For the sake of brevity, we omit error-handling.
+ @code
+ int check;
+
+ // Outer loop for each batch of rows
+ while((check = MyScanOperation->nextResult(true)) == 0)
+ {
+ do
+ {
+ // Inner loop for each row within batch
+ MyScanOperation->deleteCurrentTuple();
+ } while((check = MyScanOperation->nextResult(false)) == 0);
+
+ // When no more rows in batch, exeute all defined deletes
+ MyTransaction->execute(NoCommit);
+ }
+ @endcode
+
+ See @ref ndbapi_scan.cpp for a more complete example of a scan.
+
+ @section secError Error Handling
+
+ Errors can occur either when operations making up a transaction are being
+ defined, or when the transaction is actually being executed. Catching and
+ handling either sort of error requires testing the value returned by
+ NdbTransaction::execute(), and then, if an error is indicated (that is,
+ if this value is equal to -1), using the following two methods in order to
+ identify the error's type and location:
+
+ - NdbTransaction::getNdbErrorOperation() returns a reference to the
+ operation causing the most recent error.
+ - NdbTransaction::getNdbErrorLine() yields the method number of the
+ erroneous method in the operation.
+
+ This short example illustrates how to detect an error and to use these
+ two methods to identify it:
+
+ @code
+ theTransaction = theNdb->startTransaction();
+ theOperation = theTransaction->getNdbOperation("TEST_TABLE");
+ if (theOperation == NULL) goto error;
+ theOperation->readTuple(NdbOperation::LM_Read);
+ theOperation->setValue("ATTR_1", at1);
+ theOperation->setValue("ATTR_2", at1); // Error occurs here
+ theOperation->setValue("ATTR_3", at1);
+ theOperation->setValue("ATTR_4", at1);
+
+ if (theTransaction->execute(Commit) == -1) {
+ errorLine = theTransaction->getNdbErrorLine();
+ errorOperation = theTransaction->getNdbErrorOperation();
+ }
+ @endcode
+
+ Here <code>errorLine</code> will be 3, as the error occurred in the
+ third method called on the NdbOperation object (in this case,
+ <code>theOperation</code>); if the result of
+ NdbTransaction::getNdbErrorLine() is 0, this means that the error
+ occurred when the operations were executed. In this example,
+ <code>errorOperation</code> will be a pointer to the <code>theOperation</code>
+ object. The NdbTransaction::getNdbError() method returns an NdbError
+ object providing information about the error.
+
+ @note Transactions are <b>not</b> automatically closed when an error occurs. Call
+ Ndb::closeTransaction() to close the transaction.
+
+ One recommended way to handle a transaction failure
+ (i.e. an error is reported) is to:
+ -# Rollback transaction (call NdbTransaction::execute() with a special parameter)
+ -# Close transaction (call NdbTransaction::closeTransaction())
+ -# If the error was temporary, attempt to restart the transaction
+
+ Several errors can occur when a transaction contains multiple
+ operations which are simultaneously executed.
+ In this case the application has to go through all operations
+ and query their NdbError objects to find out what really happened.
+
+ It is also important to note that errors can occur even when a commit is
+ reported as successful. In order to handle such situations, the NDB API
+ provides an additional NdbTransaction::commitStatus() method to check the
+ transactions's commit status.
+
+******************************************************************************/
+
+/**
+ * @page ndbapi_simple.cpp ndbapi_simple.cpp
+ * @include ndbapi_simple.cpp
+ */
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+/**
+ * @page ndbapi_async.cpp ndbapi_async.cpp
+ * @include ndbapi_async.cpp
+ */
+/**
+ * @page ndbapi_async1.cpp ndbapi_async1.cpp
+ * @include ndbapi_async1.cpp
+ */
+#endif
+
+/**
+ * @page ndbapi_retries.cpp ndbapi_retries.cpp
+ * @include ndbapi_retries.cpp
+ */
+
+/**
+ * @page ndbapi_simple_index.cpp ndbapi_simple_index.cpp
+ * @include ndbapi_simple_index.cpp
+ */
+
+/**
+ * @page ndbapi_scan.cpp ndbapi_scan.cpp
+ * @include ndbapi_scan.cpp
+ */
+
+/**
+ * @page ndbapi_event.cpp ndbapi_event.cpp
+ * @include ndbapi_event.cpp
+ */
+
+
+/**
+ @page secAdapt Adaptive Send Algorithm
+
+ At the time of "sending" a transaction
+ (using NdbTransaction::execute()), 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
+ actually be transferred to the NDB kernel.
+
+ The NDB API is designed as a multi-threaded interface and so
+ it is often 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 transferring
+ information to the NDB kernel and the expected amount of threads to
+ interact with the NDB kernel.
+ Note that a given instance of Ndb should be used in at most one thread;
+ different threads should <em>not</em> use the same Ndb object.
+
+ There are four conditions leading to the transfer of database
+ operations from Ndb object buffers to the NDB kernel:
+ -# 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
+ may change between MySQL Cluster releases.
+ On TCP/IP the buffer size is usually around 64 KB;
+ on OSE/Delta it is usually less than 2000 bytes.
+ Since each Ndb object provides a single buffer per storage node,
+ the notion of a "full" buffer is local to this storage node.
+ -# The accumulation of statistical data on transferred information
+ may force sending of buffers to all storage nodes.
+ -# Every 10 ms, a special transmission thread checks whether or not
+ any send activity has occurred. If not, then the thread will
+ force transmission to all nodes.
+ This means that 20 ms is the maximum time database operations
+ are kept waiting before being sent off. The 10-millisecond limit
+ is likely to become a configuration parameter in
+ future releases of MySQL Cluster; however, for checks that
+ are more frequent than each 10 ms,
+ additional support from the operating system is required.
+ -# For methods that are affected by the adaptive send alorithm
+ (such as NdbTransaction::execute()), there is a <var>force</var>
+ parameter
+ that overrides its default behaviour in this regard and forces
+ immediate transmission to all nodes. See the inidvidual NDB API class
+ listings for more information.
+
+ @note The conditions listed above are subject to change in future releases
+ of MySQL Cluster.
+*/
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+/**
+
+ For each of these "sent" transactions, there are three
+ possible states:
+ -# Waiting to be transferred to NDB Kernel.
+ -# Has been transferred to the NDB Kernel and is currently
+ being processed.
+ -# Has been transferred 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.
+*/
+#endif
+
+/**
+ @page secConcepts MySQL Cluster Concepts
+
+ The <em>NDB Kernel</em> is the collection of storage nodes
+ belonging to a MySQL Cluster.
+ The application programmer can for most purposes view the
+ set of all storage nodes as a single entity.
+ Each storage node is made up of three main components:
+ - TC : The transaction co-ordinator
+ - ACC : Index storage component
+ - TUP : Data storage component
+
+ When an application program executes a transaction,
+ it connects to one transaction co-ordinator on one storage node.
+ Usually, the programmer does not need to specify which TC should be used,
+ but in some cases when performance is important, the programmer can
+ provide "hints" to use a certain TC.
+ (If the node with the desired transaction co-ordinator is down, then another TC will
+ automatically take over the work.)
+
+ Every storage node has an ACC and a TUP which store
+ the indexes and data portions of the database table fragment.
+ Even though one TC is responsible for the transaction,
+ several ACCs and TUPs on other storage nodes might be involved in the
+ execution of the transaction.
+
+
+ @section secNdbKernelConnection Selecting a Transaction Co-ordinator
+
+ The default method is to select the transaction co-ordinator (TC) determined to be
+ the "closest" storage node, using a heuristic for proximity based on
+ the type of transporter connection. In order of closest to most distant, these are
+ - SCI
+ - SHM
+ - TCP/IP (localhost)
+ - TCP/IP (remote host)
+ If there are several connections available with the same proximity, they will each be
+ selected in a round robin fashion for every transaction. Optionally
+ one may set the method for TC selection to round-robin mode, where each new set of
+ transactions is placed on the next DB node. The pool of connections from which this
+ selection is made consists of all available connections.
+
+ As noted previously, the application programmer can provide hints to the NDB API as to
+ which transaction co-ordinator it should use. This is done by
+ providing a <em>table</em> and <em>partition key</em>
+ (usually the primary key).
+ By using the primary key as the partition 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 at any time, in which case the NDB API will choose a transaction
+ co-ordinator without using the hint.
+ For more information, see NdbDictionary::Column::getPartitionKey() and
+ Ndb::startTransaction(). The application programmer can specify
+ the partition key from SQL by using the construct,
+ <code>CREATE TABLE ... ENGINE=NDB PARTITION BY KEY (<var>attribute-list</var>);</code>.
+
+
+ @section secRecordStruct NDB Record Structure
+ The NDB Cluster engine used by MySQL Cluster is a relational database engine
+ storing records in tables just as with any other RDBMS.
+ Table rows represent records as tuples of relational data.
+ When a new table is created, its attribute schema is specified for the table as a whole,
+ and thus each record of the table has the same structure. Again, this is typical
+ of relational databases, and NDB is no different in this regard.
+
+
+ @subsection secKeys Primary Keys
+ Each record has from 1 up to 32 attributes which belong
+ to the primary key of the table.
+
+ @section secTrans Transactions
+
+ Transactions are committed first to main memory,
+ and then to disk after a global checkpoint (GCP) is issued.
+ 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 occurring since 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 as requested by parallel application programs and
+ thread-based applications can sometimes deadlock when they try to access
+ the same information simultaneously.
+ Thus, applications need to be written in a manner so that timeout errors
+ occurring due to such deadlocks are handled gracefully. This generally
+ means that the transaction encountering a timeout should be rolled back
+ and restarted.
+
+
+ @section secHint Hints and Performance
+
+ Placing the transaction co-ordinator in close proximity
+ to the actual data used in the transaction can in many cases
+ improve performance significantly. This is particularly true for
+ systems using TCP/IP. For example, a Solaris system using a single 500 MHz processor
+ has a cost model for TCP/IP communication which can be represented by the formula
+
+ <code>[30 microseconds] + ([100 nanoseconds] * [<var>number of bytes</var>])</code>
+
+ This means that if we can ensure that we use "popular" links we increase
+ buffering and thus drastically reduce the communication cost.
+ The same system using SCI has a different cost model:
+
+ <code>[5 microseconds] + ([10 nanoseconds] * [<var>number of bytes</var>])</code>
+
+ Thus, the efficiency of an SCI system is much less dependent on selection of
+ transaction co-ordinators.
+ Typically, TCP/IP systems spend 30-60% of their working time on communication,
+ whereas for SCI systems this figure is closer to 5-10%.
+ Thus, employing SCI for data transport means that less care from the NDB API
+ programmer is required and greater scalability can be achieved, even for
+ applications using data from many different 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 partition key.
+ Then the keyData will be the address of the integer
+ of the primary key and keyLen will be 4.
+*/
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+/**
+ (A transaction's execution can also be divided into three
+ steps: prepare, send, and poll. This allows us to perform asynchronous
+ transactions. More about this later.)
+*/
+#endif
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+/**
+ Another way to execute several parallel transactions is to use
+ asynchronous transactions.
+*/
+#endif
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+/**
+ Operations are of two different kinds:
+ -# standard operations, and
+ -# interpreted program operations.
+*/
+#endif
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+/**
+ <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
+
+ 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.
+*/
+#endif
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+/**
+ <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.
+*/
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+/**
+ @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 NdbTransaction::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 NdbTransaction::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 NdbTransaction::executeAsynchPrepare or
+ NdbTransaction::executeAsynch)
+ -# <b>Send</b> transactions to NDB Kernel
+ (using Ndb::sendPreparedTransactions,
+ NdbTransaction::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
+ NdbTransaction::executeAsynch and Ndb::pollNdb.
+ - Prepare-(Send-Poll). This is the two-step variant using
+ NdbTransaction::executeAsynchPrepare and Ndb::sendPollNdb.
+ - Prepare-Send-Poll. This is the three-step variant using
+ NdbTransaction::executeAsynchPrepare, Ndb::sendPreparedTransactions, and
+ Ndb::pollNdb.
+
+ Transactions first has to be prepared by using method
+ NdbTransaction::executeAsynchPrepare or NdbTransaction::executeAsynch.
+ The difference between these is that
+ NdbTransaction::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 NdbTransaction::executeAsynchPrepare does not
+ send the transaction to the NDB kernel. When using
+ NdbTransaction::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
+ NdbTransaction::executeAsynch or through the combination of
+ NdbTransaction::executeAsynchPrepare and either
+ Ndb::sendPreparedTransactions or Ndb::sendPollNdb).
+
+ More about how transactions are sent the NDB Kernel is
+ available in section @ref secAdapt.
+*/
+#endif
+
+
+/**
+
+ Put this back when real array ops are supported
+ i.e. get/setValue("kalle[3]");
+
+ @subsection secArrays Array Attributes
+ A table attribute in NDB Cluster can be of type <var>Array</var>,
+ meaning that the attribute consists of an ordered sequence of
+ elements. In such cases, <var>attribute size</var> is the size
+ (expressed in bits) of any one element making up the array; the
+ <var>array size</var> is the number of elements in the array.
+
+*/
+
+#ifndef Ndb_H
+#define Ndb_H
+
+#include <ndb_types.h>
+#include <ndbapi_limits.h>
+#include <ndb_cluster_connection.hpp>
+#include <NdbError.hpp>
+#include <NdbDictionary.hpp>
+
+class NdbObjectIdMap;
+class NdbOperation;
+class NdbEventOperationImpl;
+class NdbScanOperation;
+class NdbIndexScanOperation;
+class NdbIndexOperation;
+class NdbTransaction;
+class NdbApiSignal;
+class NdbRecAttr;
+class NdbLabel;
+class NdbBranch;
+class NdbSubroutine;
+class NdbCall;
+class Table;
+class BaseString;
+class NdbEventOperation;
+class NdbBlob;
+class NdbReceiver;
+
+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
+
+/**
+ * @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.
+ *
+ */
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+// to be documented later
+/*
+ * 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.
+ */
+#endif
+
+class Ndb
+{
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class NdbReceiver;
+ friend class NdbOperation;
+ friend class NdbEventOperationImpl;
+ friend class NdbTransaction;
+ friend class Table;
+ friend class NdbApiSignal;
+ friend class NdbIndexOperation;
+ friend class NdbScanOperation;
+ friend class NdbIndexScanOperation;
+ friend class NdbDictionaryImpl;
+ friend class NdbDictInterface;
+ friend class NdbBlob;
+#endif
+
+public:
+ /**
+ * @name General
+ * @{
+ */
+ /**
+ * The Ndb object represents a connection to a database.
+ *
+ * @note The init() method must be called before the Ndb object may actually be used.
+ *
+ * @param ndb_cluster_connection is a connection to the cluster containing
+ * the database to be used
+ * @param aCatalogName is the name of the catalog to be used.
+ * @note The catalog name provides a namespace 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.
+ * @note The schema name provides an additional namespace
+ * for the tables and indexes created in a given catalog.
+ */
+ Ndb(Ndb_cluster_connection *ndb_cluster_connection,
+ const char* aCatalogName = "", const char* aSchemaName = "def");
+
+ ~Ndb();
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * 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);
+#endif
+
+ /**
+ * 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);
+
+ /**
+ * Initializes the Ndb object
+ *
+ * @param maxNoOfTransactions
+ * Maximum number of parallel
+ * NdbTransaction objects that can be handled by the Ndb object.
+ * Maximum value is 1024.
+ *
+ * @note each scan or index scan operation uses one extra
+ * NdbTransaction object
+ *
+ * @return 0 if successful, -1 otherwise.
+ */
+ int init(int maxNoOfTransactions = 4);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * 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);
+#endif
+
+ /** @} *********************************************************************/
+
+ /**
+ * @name Meta Information
+ * @{
+ */
+
+ /**
+ * Get an object for retrieving or manipulating database schema information
+ *
+ * @note this object operates outside any transaction
+ *
+ * @return Object containing meta information about all tables
+ * in NDB Cluster.
+ */
+ class NdbDictionary::Dictionary* getDictionary() const;
+
+
+ /** @} *********************************************************************/
+
+ /**
+ * @name Event subscriptions
+ * @{
+ */
+
+ /**
+ * Create a subcription to an event defined in the database
+ *
+ * @param eventName
+ * unique identifier of the event
+ * @param bufferLength
+ * circular buffer size for storing event data
+ *
+ * @return Object representing an event, NULL on failure
+ */
+ NdbEventOperation* createEventOperation(const char* eventName,
+ const int bufferLength);
+ /**
+ * Drop a subscription to an event
+ *
+ * @param eventOp
+ * Event operation
+ *
+ * @return 0 on success
+ */
+ int dropEventOperation(NdbEventOperation* eventOp);
+
+ /**
+ * Wait for an event to occur. Will return as soon as an event
+ * is detected on any of the created events.
+ *
+ * @param aMillisecondNumber
+ * maximum time to wait
+ *
+ * @return the number of events that has occured, -1 on failure
+ */
+ int pollEvents(int aMillisecondNumber);
+
+ /** @} *********************************************************************/
+
+ /**
+ * @name Starting and Closing Transactions
+ * @{
+ */
+
+ /**
+ * Start a transaction
+ *
+ * @note When the transaction is completed it must be closed using
+ * Ndb::closeTransaction or NdbTransaction::close.
+ * The transaction must be closed independent of its outcome, i.e.
+ * even if there is an error.
+ *
+ * @param table Pointer to table object used for deciding
+ * which node to run the Transaction Coordinator on
+ * @param keyData Pointer to partition key corresponding to
+ * <var>table</var>
+ * @param keyLen Length of partition key expressed in bytes
+ *
+ * @return NdbTransaction object, or NULL on failure.
+ */
+ NdbTransaction* startTransaction(const NdbDictionary::Table *table= 0,
+ const char *keyData = 0,
+ Uint32 keyLen = 0);
+
+ /**
+ * Close a transaction.
+ *
+ * @note should be called after the transaction has completed, irrespective
+ * of success or failure
+ */
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * @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.
+ */
+#endif
+ void closeTransaction(NdbTransaction*);
+
+ /** @} *********************************************************************/
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ // to be documented later
+ /**
+ * @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);
+ /** @} *********************************************************************/
+#endif
+
+ /**
+ * @name Error Handling
+ * @{
+ */
+
+ /**
+ * Get the NdbError object
+ *
+ * @note The NdbError object is valid until a new NDB API method is called.
+ */
+ 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);
+
+
+ /** @} *********************************************************************/
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * Get the application node identity.
+ *
+ * @return Node id of this application.
+ */
+ int getNodeId();
+
+ bool usingFullyQualifiedNames();
+
+ /**
+ * 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)
+ };
+
+ /**
+ * 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 according to TamperType above
+ *
+ * @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);
+
+ /**
+ * 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);
+ Uint64 getAutoIncrementValue(const NdbDictionary::Table * aTable,
+ Uint32 cacheSize = 1);
+ Uint64 readAutoIncrementValue(const char* aTableName);
+ Uint64 readAutoIncrementValue(const NdbDictionary::Table * aTable);
+ bool setAutoIncrementValue(const char* aTableName, Uint64 val,
+ bool increase = false);
+ bool setAutoIncrementValue(const NdbDictionary::Table * aTable, Uint64 val,
+ bool increase = false);
+ Uint64 getTupleIdFromNdb(const char* aTableName,
+ Uint32 cacheSize = 1000);
+ Uint64 getTupleIdFromNdb(Uint32 aTableId,
+ Uint32 cacheSize = 1000);
+ Uint64 readTupleIdFromNdb(Uint32 aTableId);
+ bool setTupleIdInNdb(const char* aTableName, Uint64 val,
+ bool increase);
+ bool setTupleIdInNdb(Uint32 aTableId, Uint64 val, bool increase);
+ Uint64 opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op);
+
+ /**
+ */
+ NdbTransaction* hupp( NdbTransaction* );
+ Uint32 getReference() const { return theMyRef;}
+#endif
+
+/*****************************************************************************
+ * These are service routines used by the other classes in the NDBAPI.
+ ****************************************************************************/
+private:
+
+ void setup(Ndb_cluster_connection *ndb_cluster_connection,
+ const char* aCatalogName, const char* aSchemaName);
+
+ void connected(Uint32 block_reference);
+
+
+ NdbTransaction* startTransactionLocal(Uint32 aPrio, Uint32 aFragmentId);
+
+// Connect the connection object to the Database.
+ int NDB_connect(Uint32 tNode);
+ NdbTransaction* doConnect(Uint32 nodeId);
+ void doDisconnect();
+
+ NdbReceiver* getNdbScanRec();// Get a NdbScanReceiver from idle list
+ NdbLabel* getNdbLabel(); // Get a NdbLabel from idle list
+ NdbBranch* getNdbBranch(); // Get a NdbBranch from idle list
+ NdbSubroutine* getNdbSubroutine();// Get a NdbSubroutine from idle
+ 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
+ NdbIndexScanOperation* getScanOperation(); // Get a scan operation from idle
+ NdbIndexOperation* getIndexOperation();// Get an index operation from idle
+
+ class NdbGlobalEventBufferHandle* getGlobalEventBufferHandle();
+ NdbBlob* getNdbBlob();// Get a blob handle etc
+
+ void releaseSignal(NdbApiSignal* anApiSignal);
+ void releaseSignalsInList(NdbApiSignal** pList);
+ void releaseNdbScanRec(NdbReceiver* aNdbScanRec);
+ void releaseNdbLabel(NdbLabel* anNdbLabel);
+ void releaseNdbBranch(NdbBranch* anNdbBranch);
+ void releaseNdbSubroutine(NdbSubroutine* anNdbSubroutine);
+ void releaseNdbCall(NdbCall* anNdbCall);
+ void releaseRecAttr (NdbRecAttr* aRecAttr);
+ void releaseOperation(NdbOperation* anOperation);
+ void releaseScanOperation(NdbIndexScanOperation*);
+ void releaseNdbBlob(NdbBlob* aBlob);
+
+ void check_send_timeout();
+ void remove_sent_list(Uint32);
+ Uint32 insert_completed_list(NdbTransaction*);
+ Uint32 insert_sent_list(NdbTransaction*);
+
+ // 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
+ void freeNdbBlob(); // Free the first etc
+
+ NdbTransaction* getNdbCon(); // Get a connection from idle list
+
+ /**
+ * Get a connected NdbTransaction to nodeId
+ * Returns NULL if none found
+ */
+ NdbTransaction* getConnectedNdbTransaction(Uint32 nodeId);
+
+ // Release and disconnect from DBTC a connection
+ // and seize it to theConIdleList
+ void releaseConnectToNdb (NdbTransaction*);
+
+ // Release a connection to idle list
+ void releaseNdbCon (NdbTransaction*);
+
+ 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 NdbTransaction pointers
+ void releaseTransactionArrays();
+
+ Uint32 pollCompleted(NdbTransaction** aCopyArray);
+ void sendPrepTrans(int forceSend);
+ void reportCallback(NdbTransaction** aCopyArray, Uint32 aNoOfComplTrans);
+ void waitCompletedTransactions(int milliSecs, int noOfEventsToWaitFor);
+ void completedTransaction(NdbTransaction* aTransaction);
+ void completedScanTransaction(NdbTransaction* aTransaction);
+
+ void abortTransactionsAfterNodeFailure(Uint16 aNodeId);
+
+ static
+ const char * externalizeTableName(const char * internalTableName, bool fullyQualifiedNames);
+ const char * externalizeTableName(const char * internalTableName);
+ const char * internalizeTableName(const char * externalTableName);
+
+ static
+ const char * externalizeIndexName(const char * internalIndexName, bool fullyQualifiedNames);
+ 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);
+ NdbTransaction* void2con (void* val);
+ NdbOperation* void2rec_op (void* val);
+ NdbIndexOperation* void2rec_iop (void* val);
+
+/******************************************************************************
+ * These are the private variables in this class.
+ *****************************************************************************/
+ NdbTransaction** thePreparedTransactionsArray;
+ NdbTransaction** theSentTransactionsArray;
+ NdbTransaction** theCompletedTransactionsArray;
+
+ Uint32 theNoOfPreparedTransactions;
+ Uint32 theNoOfSentTransactions;
+ Uint32 theNoOfCompletedTransactions;
+ Uint32 theNoOfAllocatedTransactions;
+ Uint32 theMaxNoOfTransactions;
+ Uint32 theMinNoOfEventsToWakeUp;
+
+ Uint32 theNextConnectNode;
+
+ bool fullyQualifiedNames;
+
+ // 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;
+
+ class NdbImpl * theImpl;
+ class NdbDictionaryImpl* theDictionary;
+ class NdbGlobalEventBufferHandle* theGlobalEventBufferHandle;
+
+ NdbTransaction* theConIdleList; // First connection in idle list.
+
+ NdbOperation* theOpIdleList; // First operation in the idle list.
+
+ NdbIndexScanOperation* theScanOpIdleList; // First scan operation in the idle list.
+ NdbIndexOperation* theIndexOpIdleList; // First index operation in the idle list.
+ NdbTransaction* theTransactionList;
+ NdbTransaction** 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
+ NdbReceiver* theScanList;
+ NdbBlob* theNdbBlobIdleList;
+
+ Uint32 theMyRef; // My block reference
+ Uint32 theNode; // The node number of our 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;
+
+ enum InitType {
+ NotConstructed,
+ NotInitialised,
+ StartingInit,
+ Initialised,
+ InitConfigError
+ } theInitState;
+
+ NdbApiSignal* theCommitAckSignal;
+
+
+#ifdef POORMANSPURIFY
+ int cfreeSignals;
+ int cnewSignals;
+ int cgetSignals;
+ int creleaseSignals;
+#endif
+
+ static void executeMessage(void*, NdbApiSignal *,
+ struct LinearSectionPtr ptr[3]);
+ static void statusMessage(void*, Uint32, bool, bool);
+#ifdef VM_TRACE
+ void printState(const char* fmt, ...);
+#endif
+};
+
+#endif
diff --git a/storage/ndb/include/ndbapi/NdbApi.hpp b/storage/ndb/include/ndbapi/NdbApi.hpp
new file mode 100644
index 00000000000..aed4d5efbd7
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbApi.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 NdbApi_H
+#define NdbApi_H
+
+#include "ndb_init.h"
+#include "ndb_cluster_connection.hpp"
+#include "ndbapi_limits.h"
+#include "Ndb.hpp"
+#include "NdbTransaction.hpp"
+#include "NdbOperation.hpp"
+#include "NdbScanOperation.hpp"
+#include "NdbIndexOperation.hpp"
+#include "NdbIndexScanOperation.hpp"
+#include "NdbScanFilter.hpp"
+#include "NdbRecAttr.hpp"
+#include "NdbDictionary.hpp"
+#include "NdbEventOperation.hpp"
+#include "NdbPool.hpp"
+#include "NdbBlob.hpp"
+#endif
diff --git a/storage/ndb/include/ndbapi/NdbBlob.hpp b/storage/ndb/include/ndbapi/NdbBlob.hpp
new file mode 100644
index 00000000000..271287b765c
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbBlob.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 NdbBlob_H
+#define NdbBlob_H
+
+#include <ndb_types.h>
+#include <NdbDictionary.hpp>
+#include <NdbTransaction.hpp>
+#include <NdbError.hpp>
+
+class Ndb;
+class NdbTransaction;
+class NdbOperation;
+class NdbRecAttr;
+class NdbTableImpl;
+class NdbColumnImpl;
+
+/**
+ * @class NdbBlob
+ * @brief Blob handle
+ *
+ * Blob data is stored in 2 places:
+ *
+ * - "header" and "inline bytes" stored in the blob attribute
+ * - "blob parts" stored in a separate table NDB$BLOB_<tid>_<cid>
+ *
+ * Inline and part sizes can be set via NdbDictionary::Column methods
+ * when the table is created.
+ *
+ * NdbBlob is a blob handle. To access blob data, the handle must be
+ * created using NdbOperation::getBlobHandle in operation prepare phase.
+ * The handle has following states:
+ *
+ * - prepared: before the operation is executed
+ * - active: after execute or next result but before transaction commit
+ * - closed: after transaction commit
+ * - invalid: after rollback or transaction close
+ *
+ * NdbBlob supports 3 styles of data access:
+ *
+ * - in prepare phase, NdbBlob methods getValue and setValue are used to
+ * prepare a read or write of a blob value of known size
+ *
+ * - in prepare phase, setActiveHook is used to define a routine which
+ * is invoked as soon as the handle becomes active
+ *
+ * - in active phase, readData and writeData are used to read or write
+ * blob data of arbitrary size
+ *
+ * The styles can be applied in combination (in above order).
+ *
+ * Blob operations take effect at next transaction execute. In some
+ * cases NdbBlob is forced to do implicit executes. To avoid this,
+ * operate on complete blob parts.
+ *
+ * Use NdbTransaction::executePendingBlobOps to flush your reads and
+ * writes. It avoids execute penalty if nothing is pending. It is not
+ * needed after execute (obviously) or after next scan result.
+ *
+ * NdbBlob methods return -1 on error and 0 on success, and use output
+ * parameters when necessary.
+ *
+ * Operation types:
+ * - insertTuple must use setValue if blob column is non-nullable
+ * - readTuple with exclusive lock can also update existing value
+ * - updateTuple can overwrite with setValue or update existing value
+ * - writeTuple always overwrites and must use setValue if non-nullable
+ * - deleteTuple creates implicit non-accessible blob handles
+ * - scan with exclusive lock can also update existing value
+ * - scan "lock takeover" update op must do its own getBlobHandle
+ *
+ * Bugs / limitations:
+ * - lock mode upgrade should be handled automatically
+ * - lock mode vs allowed operation is not checked
+ * - too many pending blob ops can blow up i/o buffers
+ * - table and its blob part tables are not created atomically
+ */
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+/**
+ * - there is no support for an asynchronous interface
+ */
+#endif
+
+class NdbBlob {
+public:
+ /**
+ * State.
+ */
+ enum State {
+ Idle = 0,
+ Prepared = 1,
+ Active = 2,
+ Closed = 3,
+ Invalid = 9
+ };
+ /**
+ * Get the state of a NdbBlob object.
+ */
+ State getState();
+ /**
+ * Inline blob header.
+ */
+ struct Head {
+ Uint64 length;
+ };
+ /**
+ * Prepare to read blob value. The value is available after execute.
+ * Use getNull() to check for NULL and getLength() to get the real length
+ * and to check for truncation. Sets current read/write position to
+ * after the data read.
+ */
+ int getValue(void* data, Uint32 bytes);
+ /**
+ * Prepare to insert or update blob value. An existing longer blob
+ * value will be truncated. The data buffer must remain valid until
+ * execute. Sets current read/write position to after the data. Set
+ * data to null pointer (0) to create a NULL value.
+ */
+ int setValue(const void* data, Uint32 bytes);
+ /**
+ * Callback for setActiveHook(). Invoked immediately when the prepared
+ * operation has been executed (but not committed). Any getValue() or
+ * setValue() is done first. The blob handle is active so readData or
+ * writeData() etc can be used to manipulate blob value. A user-defined
+ * argument is passed along. Returns non-zero on error.
+ */
+ typedef int ActiveHook(NdbBlob* me, void* arg);
+ /**
+ * Define callback for blob handle activation. The queue of prepared
+ * operations will be executed in no commit mode up to this point and
+ * then the callback is invoked.
+ */
+ int setActiveHook(ActiveHook* activeHook, void* arg);
+ /**
+ * Check if blob is null.
+ */
+ int getNull(bool& isNull);
+ /**
+ * Set blob to NULL.
+ */
+ int setNull();
+ /**
+ * Get current length in bytes. Use getNull to distinguish between
+ * length 0 blob and NULL blob.
+ */
+ int getLength(Uint64& length);
+ /**
+ * Truncate blob to given length. Has no effect if the length is
+ * larger than current length.
+ */
+ int truncate(Uint64 length = 0);
+ /**
+ * Get current read/write position.
+ */
+ int getPos(Uint64& pos);
+ /**
+ * Set read/write position. Must be between 0 and current length.
+ * "Sparse blobs" are not supported.
+ */
+ int setPos(Uint64 pos);
+ /**
+ * Read at current position and set new position to first byte after
+ * the data read. A read past blob end returns actual number of bytes
+ * read in the in/out bytes parameter.
+ */
+ int readData(void* data, Uint32& bytes);
+ /**
+ * Write at current position and set new position to first byte after
+ * the data written. A write past blob end extends the blob value.
+ */
+ int writeData(const void* data, Uint32 bytes);
+ /**
+ * Return the blob column.
+ */
+ const NdbDictionary::Column* getColumn();
+ /**
+ * Get blob parts table name. Useful only to test programs.
+ */
+ static int getBlobTableName(char* btname, Ndb* anNdb, const char* tableName, const char* columnName);
+ /**
+ * Return error object. The error may be blob specific (below) or may
+ * be copied from a failed implicit operation.
+ */
+ const NdbError& getNdbError() const;
+ /**
+ * Return info about all blobs in this operation.
+ *
+ * Get first blob in list.
+ */
+ NdbBlob* blobsFirstBlob();
+ /**
+ * Return info about all blobs in this operation.
+ *
+ * Get next blob in list. Initialize with blobsFirstBlob().
+ */
+ NdbBlob* blobsNextBlob();
+
+private:
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class Ndb;
+ friend class NdbTransaction;
+ friend class NdbOperation;
+ friend class NdbScanOperation;
+ friend class NdbDictionaryImpl;
+ friend class NdbResultSet; // atNextResult
+#endif
+ // state
+ State theState;
+ void setState(State newState);
+ // define blob table
+ static void getBlobTableName(char* btname, const NdbTableImpl* t, const NdbColumnImpl* c);
+ static void getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnImpl* c);
+ // ndb api stuff
+ Ndb* theNdb;
+ NdbTransaction* theNdbCon;
+ NdbOperation* theNdbOp;
+ const NdbTableImpl* theTable;
+ const NdbTableImpl* theAccessTable;
+ const NdbTableImpl* theBlobTable;
+ const NdbColumnImpl* theColumn;
+ char theFillChar;
+ // sizes
+ Uint32 theInlineSize;
+ Uint32 thePartSize;
+ Uint32 theStripeSize;
+ // getValue/setValue
+ bool theGetFlag;
+ char* theGetBuf;
+ bool theSetFlag;
+ const char* theSetBuf;
+ Uint32 theGetSetBytes;
+ // pending ops
+ Uint8 thePendingBlobOps;
+ // activation callback
+ ActiveHook* theActiveHook;
+ void* theActiveHookArg;
+ // buffers
+ struct Buf {
+ char* data;
+ unsigned size;
+ unsigned maxsize;
+ Buf();
+ ~Buf();
+ void alloc(unsigned n);
+ void copyfrom(const Buf& src);
+ };
+ Buf theKeyBuf;
+ Buf theAccessKeyBuf;
+ Buf theHeadInlineBuf;
+ Buf theHeadInlineCopyBuf; // for writeTuple
+ Buf thePartBuf;
+ Head* theHead;
+ char* theInlineData;
+ NdbRecAttr* theHeadInlineRecAttr;
+ NdbOperation* theHeadInlineReadOp;
+ bool theHeadInlineUpdateFlag;
+ // length and read/write position
+ int theNullFlag;
+ Uint64 theLength;
+ Uint64 thePos;
+ // errors
+ NdbError theError;
+ // for keeping in lists
+ NdbBlob* theNext;
+ // initialization
+ NdbBlob();
+ void init();
+ void release();
+ // classify operations
+ bool isTableOp();
+ bool isIndexOp();
+ bool isKeyOp();
+ bool isReadOp();
+ bool isInsertOp();
+ bool isUpdateOp();
+ bool isWriteOp();
+ bool isDeleteOp();
+ bool isScanOp();
+ // computations
+ Uint32 getPartNumber(Uint64 pos);
+ Uint32 getPartCount();
+ Uint32 getDistKey(Uint32 part);
+ // getters and setters
+ int getTableKeyValue(NdbOperation* anOp);
+ int setTableKeyValue(NdbOperation* anOp);
+ int setAccessKeyValue(NdbOperation* anOp);
+ int setPartKeyValue(NdbOperation* anOp, Uint32 part);
+ int getHeadInlineValue(NdbOperation* anOp);
+ void getHeadFromRecAttr();
+ int setHeadInlineValue(NdbOperation* anOp);
+ // data operations
+ int readDataPrivate(char* buf, Uint32& bytes);
+ int writeDataPrivate(const char* buf, Uint32 bytes);
+ int readParts(char* buf, Uint32 part, Uint32 count);
+ int insertParts(const char* buf, Uint32 part, Uint32 count);
+ int updateParts(const char* buf, Uint32 part, Uint32 count);
+ int deleteParts(Uint32 part, Uint32 count);
+ int deletePartsUnknown(Uint32 part);
+ // pending ops
+ int executePendingBlobReads();
+ int executePendingBlobWrites();
+ // callbacks
+ int invokeActiveHook();
+ // blob handle maintenance
+ int atPrepare(NdbTransaction* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn);
+ int preExecute(NdbTransaction::ExecType anExecType, bool& batch);
+ int postExecute(NdbTransaction::ExecType anExecType);
+ int preCommit();
+ int atNextResult();
+ // errors
+ void setErrorCode(int anErrorCode, bool invalidFlag = true);
+ void setErrorCode(NdbOperation* anOp, bool invalidFlag = true);
+ void setErrorCode(NdbTransaction* aCon, bool invalidFlag = true);
+#ifdef VM_TRACE
+ int getOperationType() const;
+ friend class NdbOut& operator<<(NdbOut&, const NdbBlob&);
+#endif
+};
+
+#endif
diff --git a/storage/ndb/include/ndbapi/NdbDictionary.hpp b/storage/ndb/include/ndbapi/NdbDictionary.hpp
new file mode 100644
index 00000000000..7a945c1c22e
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbDictionary.hpp
@@ -0,0 +1,1331 @@
+/* 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 NdbDictionary_H
+#define NdbDictionary_H
+
+#include <ndb_types.h>
+
+class Ndb;
+struct charset_info_st;
+typedef struct charset_info_st CHARSET_INFO;
+
+/**
+ * @class NdbDictionary
+ * @brief Data dictionary class
+ *
+ * The preferred and supported way to create and drop tables and indexes
+ * in ndb is through the
+ * MySQL Server (see MySQL reference Manual, section MySQL Cluster).
+ *
+ * Tables and indexes that are created directly through the
+ * NdbDictionary class
+ * can not be viewed from the MySQL Server.
+ * Dropping indexes directly via the NdbApi will cause inconsistencies
+ * if they were originally created from a MySQL Cluster.
+ *
+ * This class supports schema data enquiries such as:
+ * -# Enquiries about tables
+ * (Dictionary::getTable, Table::getNoOfColumns,
+ * Table::getPrimaryKey, and Table::getNoOfPrimaryKeys)
+ * -# Enquiries about indexes
+ * (Dictionary::getIndex, Index::getNoOfColumns,
+ * and Index::getColumn)
+ *
+ * This class supports schema data definition such as:
+ * -# Creating tables (Dictionary::createTable) and table columns
+ * -# Dropping tables (Dictionary::dropTable)
+ * -# Creating secondary indexes (Dictionary::createIndex)
+ * -# Dropping secondary indexes (Dictionary::dropIndex)
+ *
+ * NdbDictionary has several help (inner) classes to support this:
+ * -# NdbDictionary::Dictionary the dictionary handling dictionary objects
+ * -# NdbDictionary::Table for creating tables
+ * -# NdbDictionary::Column for creating table columns
+ * -# NdbDictionary::Index for creating secondary indexes
+ *
+ * See @ref ndbapi_simple_index.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
+ 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, default
+ FragAllMedium = 3, ///< two fragments per node
+ FragAllLarge = 4 ///< Four fragments per node.
+ };
+ };
+
+ class Table; // forward declaration
+
+ /**
+ * @class Column
+ * @brief Represents a column in an NDB Cluster table
+ *
+ * Each column has a type. The type of a column is determined by a number
+ * of type specifiers.
+ * The type specifiers are:
+ * - Builtin type
+ * - Array length or max length
+ * - Precision and scale (not used yet)
+ * - Character set for string types
+ * - Inline and part sizes for blobs
+ *
+ * Types in general correspond to MySQL types and their variants.
+ * Data formats are same as in MySQL. NDB API provides no support for
+ * constructing such formats. NDB kernel checks them however.
+ */
+ class Column {
+ public:
+ /**
+ * The builtin column types
+ */
+ enum Type {
+ Undefined = NDB_TYPE_UNDEFINED, ///< Undefined
+ Tinyint = NDB_TYPE_TINYINT, ///< 8 bit. 1 byte signed integer, can be used in array
+ Tinyunsigned = NDB_TYPE_TINYUNSIGNED, ///< 8 bit. 1 byte unsigned integer, can be used in array
+ Smallint = NDB_TYPE_SMALLINT, ///< 16 bit. 2 byte signed integer, can be used in array
+ Smallunsigned = NDB_TYPE_SMALLUNSIGNED, ///< 16 bit. 2 byte unsigned integer, can be used in array
+ Mediumint = NDB_TYPE_MEDIUMINT, ///< 24 bit. 3 byte signed integer, can be used in array
+ Mediumunsigned = NDB_TYPE_MEDIUMUNSIGNED,///< 24 bit. 3 byte unsigned integer, can be used in array
+ Int = NDB_TYPE_INT, ///< 32 bit. 4 byte signed integer, can be used in array
+ Unsigned = NDB_TYPE_UNSIGNED, ///< 32 bit. 4 byte unsigned integer, can be used in array
+ Bigint = NDB_TYPE_BIGINT, ///< 64 bit. 8 byte signed integer, can be used in array
+ Bigunsigned = NDB_TYPE_BIGUNSIGNED, ///< 64 Bit. 8 byte signed integer, can be used in array
+ Float = NDB_TYPE_FLOAT, ///< 32-bit float. 4 bytes float, can be used in array
+ Double = NDB_TYPE_DOUBLE, ///< 64-bit float. 8 byte float, can be used in array
+ Olddecimal = NDB_TYPE_OLDDECIMAL, ///< MySQL < 5.0 signed decimal, Precision, Scale
+ Olddecimalunsigned = NDB_TYPE_OLDDECIMALUNSIGNED,
+ Decimal = NDB_TYPE_DECIMAL, ///< MySQL >= 5.0 signed decimal, Precision, Scale
+ Decimalunsigned = NDB_TYPE_DECIMALUNSIGNED,
+ Char = NDB_TYPE_CHAR, ///< Len. A fixed array of 1-byte chars
+ Varchar = NDB_TYPE_VARCHAR, ///< Length bytes: 1, Max: 255
+ Binary = NDB_TYPE_BINARY, ///< Len
+ Varbinary = NDB_TYPE_VARBINARY, ///< Length bytes: 1, Max: 255
+ Datetime = NDB_TYPE_DATETIME, ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes )
+ Date = NDB_TYPE_DATE, ///< Precision down to 1 day(sizeof(Date) == 4 bytes )
+ Blob = NDB_TYPE_BLOB, ///< Binary large object (see NdbBlob)
+ Text = NDB_TYPE_TEXT, ///< Text blob
+ Bit = NDB_TYPE_BIT, ///< Bit, length specifies no of bits
+ Longvarchar = NDB_TYPE_LONGVARCHAR, ///< Length bytes: 2, little-endian
+ Longvarbinary = NDB_TYPE_LONGVARBINARY, ///< Length bytes: 2, little-endian
+ Time = NDB_TYPE_TIME, ///< Time without date
+ Year = NDB_TYPE_YEAR, ///< Year 1901-2155 (1 byte)
+ Timestamp = NDB_TYPE_TIMESTAMP ///< Unix time
+ };
+
+ /**
+ * @name General
+ * @{
+ */
+
+ /**
+ * Get name of column
+ * @return Name of the column
+ */
+ const char* getName() const;
+
+ /**
+ * Get if the column is nullable or not
+ */
+ bool getNullable() const;
+
+ /**
+ * 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 Get Type Specifiers
+ * @{
+ */
+
+ /**
+ * Get type of column
+ */
+ Type getType() const;
+
+ /**
+ * Get precision of column.
+ * @note Only applicable for decimal types
+ */
+ int getPrecision() const;
+
+ /**
+ * Get scale of column.
+ * @note Only applicable for decimal types
+ */
+ int getScale() const;
+
+ /**
+ * Get length for column
+ * Array length for column or max length for variable length arrays.
+ */
+ int getLength() const;
+
+ /**
+ * For Char or Varchar or Text, get MySQL CHARSET_INFO. This
+ * specifies both character set and collation. See get_charset()
+ * etc in MySQL. (The cs is not "const" in MySQL).
+ */
+ CHARSET_INFO* getCharset() const;
+
+
+ /**
+ * For blob, get "inline size" i.e. number of initial bytes
+ * to store in table's blob attribute. This part is normally in
+ * main memory and can be indexed and interpreted.
+ */
+ int getInlineSize() const;
+
+ /**
+ * For blob, get "part size" i.e. number of bytes to store in
+ * each tuple of the "blob table". Can be set to zero to omit parts
+ * and to allow only inline bytes ("tinyblob").
+ */
+ int getPartSize() const;
+
+ /**
+ * For blob, set or get "stripe size" i.e. number of consecutive
+ * <em>parts</em> to store in each node group.
+ */
+ int getStripeSize() const;
+
+ /**
+ * Get size of element
+ */
+ int getSize() const;
+
+ /**
+ * Check if column is part of partition key
+ *
+ * A <em>partition key</em> is a set of attributes which are used
+ * to distribute the tuples onto the NDB nodes.
+ * The partition 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 partition 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.
+ *
+ * @return true then the column is part of
+ * the partition key.
+ */
+ bool getPartitionKey() const;
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ inline bool getDistributionKey() const { return getPartitionKey(); };
+#endif
+
+ /** @} *******************************************************************/
+
+
+ /**
+ * @name Column creation
+ * @{
+ *
+ * These operations should normally not be performed in an NbdApi program
+ * as results will not be visable in the MySQL Server
+ *
+ */
+
+ /**
+ * 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);
+
+ /**
+ * Set whether column is nullable or not
+ */
+ void setNullable(bool);
+
+ /**
+ * Set that column is part of primary key
+ */
+ void setPrimaryKey(bool);
+
+ /**
+ * Set type of column
+ * @param type Type of column
+ *
+ * @note setType resets <em>all</em> column attributes
+ * to (type dependent) defaults and should be the first
+ * method to call. Default type is Unsigned.
+ */
+ void setType(Type type);
+
+ /**
+ * Set precision of column.
+ * @note Only applicable for decimal types
+ */
+ void setPrecision(int);
+
+ /**
+ * Set scale of column.
+ * @note Only applicable for decimal types
+ */
+ void setScale(int);
+
+ /**
+ * Set length for column
+ * Array length for column or max length for variable length arrays.
+ */
+ void setLength(int length);
+
+ /**
+ * For Char or Varchar or Text, get MySQL CHARSET_INFO. This
+ * specifies both character set and collation. See get_charset()
+ * etc in MySQL. (The cs is not "const" in MySQL).
+ */
+ void setCharset(CHARSET_INFO* cs);
+
+ /**
+ * For blob, get "inline size" i.e. number of initial bytes
+ * to store in table's blob attribute. This part is normally in
+ * main memory and can be indexed and interpreted.
+ */
+ void setInlineSize(int size);
+
+ /**
+ * For blob, get "part size" i.e. number of bytes to store in
+ * each tuple of the "blob table". Can be set to zero to omit parts
+ * and to allow only inline bytes ("tinyblob").
+ */
+ void setPartSize(int size);
+
+ /**
+ * For blob, get "stripe size" i.e. number of consecutive
+ * <em>parts</em> to store in each node group.
+ */
+ void setStripeSize(int size);
+
+ /**
+ * Set partition key
+ * @see getPartitionKey
+ *
+ * @param enable If set to true, then the column will be part of
+ * the partition key.
+ */
+ void setPartitionKey(bool enable);
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ inline void setDistributionKey(bool enable)
+ { setPartitionKey(enable); };
+#endif
+
+ /** @} *******************************************************************/
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ const Table * getBlobTable() const;
+
+ void setAutoIncrement(bool);
+ bool getAutoIncrement() const;
+ void setAutoIncrementInitialValue(Uint64 val);
+ void setDefaultValue(const char*);
+ const char* getDefaultValue() const;
+
+ static const Column * FRAGMENT;
+ static const Column * FRAGMENT_MEMORY;
+ static const Column * ROW_COUNT;
+ static const Column * COMMIT_COUNT;
+ static const Column * ROW_SIZE;
+ static const Column * RANGE_NO;
+
+ int getSizeInBytes() const;
+#endif
+
+ private:
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class NdbRecAttr;
+ friend class NdbColumnImpl;
+#endif
+ 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
+ * @{
+ */
+
+ /**
+ * Get table name
+ */
+ const char * getName() const;
+
+ /**
+ * Get table id
+ */
+ int getTableId() const;
+
+ /**
+ * 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
+ */
+ Column* getColumn(const int attributeId);
+
+ /**
+ * Get column definition via name.
+ * @return null if none existing name
+ */
+ Column* getColumn(const char * name);
+
+ /**
+ * 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.
+ */
+ bool getLogging() const;
+
+ /**
+ * Get fragmentation type
+ */
+ FragmentType getFragmentType() const;
+
+ /**
+ * Get KValue (Hash parameter.)
+ * Only allowed value is 6.
+ * Later implementations might add flexibility in this parameter.
+ */
+ int getKValue() const;
+
+ /**
+ * 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;
+
+ /**
+ * 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;
+
+ /** @} *******************************************************************/
+
+ /**
+ * @name Table creation
+ * @{
+ *
+ * These methods should normally not be used in an application as
+ * the result is not accessible from the MySQL Server
+ *
+ */
+
+ /**
+ * 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& table);
+
+ /**
+ * Name of table
+ * @param name Name of table
+ */
+ void setName(const char * name);
+
+ /**
+ * Add a column definition to a table
+ * @note creates a copy
+ */
+ void addColumn(const Column &);
+
+ /**
+ * @see NdbDictionary::Table::getLogging.
+ */
+ void setLogging(bool);
+
+ /**
+ * Set fragmentation type
+ */
+ void setFragmentType(FragmentType);
+
+ /**
+ * Set KValue (Hash parameter.)
+ * Only allowed value is 6.
+ * Later implementations might add flexibility in this parameter.
+ */
+ void setKValue(int kValue);
+
+ /**
+ * 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);
+
+ /**
+ * 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 table object type
+ */
+ Object::Type getObjectType() const;
+
+ /**
+ * Get object status
+ */
+ virtual Object::Status getObjectStatus() const;
+
+ /**
+ * Get object version
+ */
+ virtual int getObjectVersion() 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);
+
+ /** @} *******************************************************************/
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ void setStoredTable(bool x) { setLogging(x); }
+ bool getStoredTable() const { return getLogging(); }
+
+ int getRowSizeInBytes() const ;
+ int createTableInDb(Ndb*, bool existingEqualIsOk = true) const ;
+
+ int getReplicaCount() const ;
+#endif
+
+ private:
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class NdbTableImpl;
+#endif
+ class NdbTableImpl & m_impl;
+ Table(NdbTableImpl&);
+ };
+
+ /**
+ * @class Index
+ * @brief Represents an index in an NDB Cluster
+ */
+ class Index : public Object {
+ public:
+
+ /**
+ * @name Getting Index properties
+ * @{
+ */
+
+ /**
+ * Get the name of an index
+ */
+ const char * getName() const;
+
+ /**
+ * Get the name of the table being indexed
+ */
+ const char * getTable() const;
+
+ /**
+ * Get the number of columns in the index
+ */
+ unsigned getNoOfColumns() const;
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * Get the number of columns in the index
+ * Depricated, use getNoOfColumns instead.
+ */
+ int getNoOfIndexColumns() const;
+#endif
+
+ /**
+ * Get a specific column in the index
+ */
+ const Column * getColumn(unsigned no) const ;
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * Get a specific column name in the index
+ * Depricated, use getColumn instead.
+ */
+ const char * getIndexColumn(int no) const ;
+#endif
+
+ /**
+ * Represents type of index
+ */
+ enum Type {
+ Undefined = 0, ///< Undefined object type (initial value)
+ UniqueHashIndex = 3, ///< Unique un-ordered hash index
+ ///< (only one currently supported)
+ OrderedIndex = 6 ///< Non-unique ordered index
+ };
+
+ /**
+ * Get index type of the index
+ */
+ Type getType() const;
+
+ /**
+ * Check if index is set to be stored on disk
+ *
+ * @return if true then logging id enabled
+ *
+ * @note Non-logged indexes are rebuilt at system restart.
+ * @note Ordered index does not currently support logging.
+ */
+ bool getLogging() const;
+
+ /**
+ * Get object status
+ */
+ virtual Object::Status getObjectStatus() const;
+
+ /**
+ * Get object version
+ */
+ virtual int getObjectVersion() const;
+
+ /** @} *******************************************************************/
+
+ /**
+ * @name Index creation
+ * @{
+ *
+ * These methods should normally not be used in an application as
+ * the result will not be visible from the MySQL Server
+ *
+ */
+
+ /**
+ * Constructor
+ * @param name Name of index
+ */
+ Index(const char * name = "");
+ virtual ~Index();
+
+ /**
+ * Set the name of an index
+ */
+ void setName(const char * name);
+
+ /**
+ * Define the name of the table to be indexed
+ */
+ void setTable(const char * name);
+
+ /**
+ * 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);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * 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);
+#endif
+
+ /**
+ * 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);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * 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);
+#endif
+
+ /**
+ * Set index type of the index
+ */
+ void setType(Type type);
+
+ /**
+ * Enable/Disable index storage on disk
+ *
+ * @param enable If enable is set to true, then logging becomes enabled
+ *
+ * @see NdbDictionary::Index::getLogging
+ */
+ void setLogging(bool enable);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ void setStoredIndex(bool x) { setLogging(x); }
+ bool getStoredIndex() const { return getLogging(); }
+#endif
+
+ /** @} *******************************************************************/
+
+ private:
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class NdbIndexImpl;
+#endif
+ class NdbIndexImpl & m_impl;
+ Index(NdbIndexImpl&);
+ };
+
+ /**
+ * @brief Represents an Event in NDB Cluster
+ *
+ */
+ class Event : public Object {
+ public:
+ /**
+ * Specifies the type of database operations an Event listens to
+ */
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /** TableEvent must match 1 << TriggerEvent */
+#endif
+ enum TableEvent {
+ TE_INSERT=1, ///< Insert event on table
+ TE_DELETE=2, ///< Delete event on table
+ TE_UPDATE=4, ///< Update event on table
+ TE_ALL=7 ///< Any/all event on table (not relevant when
+ ///< events are received)
+ };
+ /**
+ * Specifies the durability of an event
+ * (future version may supply other types)
+ */
+ enum EventDurability {
+ ED_UNDEFINED
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ = 0
+#endif
+#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 ///< All API's can use it.
+ ///< It's still defined after a cluster system restart
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ = 3
+#endif
+ };
+
+ /**
+ * Constructor
+ * @param name Name of event
+ */
+ Event(const char *name);
+ /**
+ * Constructor
+ * @param name Name of event
+ * @param table Reference retrieved from NdbDictionary
+ */
+ Event(const char *name, const NdbDictionary::Table& table);
+ virtual ~Event();
+ /**
+ * Set unique identifier for the event
+ */
+ void setName(const char *name);
+ /**
+ * Get unique identifier for the event
+ */
+ const char *getName() const;
+ /**
+ * Define table on which events should be detected
+ *
+ * @note calling this method will default to detection
+ * of events on all columns. Calling subsequent
+ * addEventColumn calls will override this.
+ *
+ * @param table reference retrieved from NdbDictionary
+ */
+ void setTable(const NdbDictionary::Table& table);
+ /**
+ * Set table for which events should be detected
+ *
+ * @note preferred way is using setTable(const NdbDictionary::Table&)
+ * or constructor with table object parameter
+ */
+ void setTable(const char *tableName);
+ /**
+ * Get table name for events
+ *
+ * @return table name
+ */
+ const char* getTableName() const;
+ /**
+ * Add type of event that should be detected
+ */
+ void addTableEvent(const TableEvent te);
+ /**
+ * Set durability of the event
+ */
+ void setDurability(EventDurability);
+ /**
+ * Get durability of the event
+ */
+ EventDurability getDurability() const;
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ void addColumn(const Column &c);
+#endif
+ /**
+ * Add a column on which events should be detected
+ *
+ * @param attrId Column id
+ *
+ * @note errors will mot be detected until createEvent() is called
+ */
+ void addEventColumn(unsigned attrId);
+ /**
+ * Add a column on which events should be detected
+ *
+ * @param columnName Column name
+ *
+ * @note errors will not be detected until createEvent() is called
+ */
+ void addEventColumn(const char * columnName);
+ /**
+ * Add several columns on which events should be detected
+ *
+ * @param n Number of columns
+ * @param columnNames Column names
+ *
+ * @note errors will mot be detected until
+ * NdbDictionary::Dictionary::createEvent() is called
+ */
+ void addEventColumns(int n, const char ** columnNames);
+
+ /**
+ * Get no of columns defined in an Event
+ *
+ * @return Number of columns, -1 on error
+ */
+ int getNoOfEventColumns() const;
+
+ /**
+ * Get object status
+ */
+ virtual Object::Status getObjectStatus() const;
+
+ /**
+ * Get object version
+ */
+ virtual int getObjectVersion() const;
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ void print();
+#endif
+
+ private:
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class NdbEventImpl;
+ friend class NdbEventOperationImpl;
+#endif
+ 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.
+ *
+ * @param list List of objects returned in the dictionary
+ * @param type Restrict returned list to only contain objects of
+ * this type
+ *
+ * @return -1 if error.
+ *
+ */
+ int listObjects(List & list, Object::Type type = Object::TypeUndefined);
+ int listObjects(List & list,
+ Object::Type type = Object::TypeUndefined) const;
+
+ /**
+ * Get the latest error
+ *
+ * @return Error object.
+ */
+ const struct NdbError & getNdbError() const;
+
+ /** @} *******************************************************************/
+
+ /**
+ * @name Retrieving references to Tables and Indexes
+ * @{
+ */
+
+ /**
+ * 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) const;
+
+ /**
+ * 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) const;
+
+ /**
+ * 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);
+ int listIndexes(List & list, const char * tableName) const;
+
+ /** @} *******************************************************************/
+ /**
+ * @name Events
+ * @{
+ */
+
+ /**
+ * Create event given defined Event instance
+ * @param event Event to create
+ * @return 0 if successful otherwise -1.
+ */
+ int createEvent(const Event &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);
+
+ /** @} *******************************************************************/
+
+ /**
+ * @name Table creation
+ * @{
+ *
+ * These methods should normally not be used in an application as
+ * the result will not be visible from the MySQL Server
+ */
+
+ /**
+ * Create defined table given defined Table instance
+ * @param table Table to create
+ * @return 0 if successful otherwise -1.
+ */
+ int createTable(const Table &table);
+
+ /**
+ * Drop table given retrieved Table instance
+ * @param table Table to drop
+ * @return 0 if successful otherwise -1.
+ */
+ int dropTable(Table & table);
+
+ /**
+ * Drop table given table name
+ * @param name Name of table to drop
+ * @return 0 if successful otherwise -1.
+ */
+ int dropTable(const char * name);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * 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 &table);
+
+ /**
+ * Invalidate cached table object
+ * @param name Name of table to invalidate
+ */
+ void invalidateTable(const char * name);
+#endif
+
+ /**
+ * Remove table from local cache
+ */
+ void removeCachedTable(const char * table);
+ /**
+ * Remove index from local cache
+ */
+ void removeCachedIndex(const char * index, const char * table);
+
+
+ /** @} *******************************************************************/
+ /**
+ * @name Index creation
+ * @{
+ *
+ * These methods should normally not be used in an application as
+ * the result will not be visible from the MySQL Server
+ *
+ */
+
+ /**
+ * Create index given defined Index instance
+ * @param index Index to create
+ * @return 0 if successful otherwise -1.
+ */
+ int createIndex(const Index &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);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * Invalidate cached index object
+ */
+ void invalidateIndex(const char * indexName,
+ const char * tableName);
+#endif
+
+ /** @} *******************************************************************/
+
+ protected:
+ Dictionary(Ndb & ndb);
+ ~Dictionary();
+
+ private:
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class NdbDictionaryImpl;
+ friend class UtilTransactions;
+ friend class NdbBlob;
+#endif
+ class NdbDictionaryImpl & m_impl;
+ Dictionary(NdbDictionaryImpl&);
+ const Table * getIndexTable(const char * indexName,
+ const char * tableName) const;
+ public:
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ const Table * getTable(const char * name, void **data) const;
+ void set_local_table_data_size(unsigned sz);
+#endif
+ };
+};
+
+class NdbOut& operator <<(class NdbOut& out, const NdbDictionary::Column& col);
+
+#endif
diff --git a/storage/ndb/include/ndbapi/NdbError.hpp b/storage/ndb/include/ndbapi/NdbError.hpp
new file mode 100644
index 00000000000..f67b3c4ccaa
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbError.hpp
@@ -0,0 +1,237 @@
+/* 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
+
+#include <ndberror.h>
+
+/**
+ * @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_retries.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 = ndberror_st_success,
+
+ /**
+ * 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 = ndberror_st_temporary,
+
+ /**
+ * 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 = ndberror_st_permanent,
+
+ /**
+ * The result/status is unknown.<br>
+ * (Includes classifications: NdbError::UnknownResultError, and
+ * NdbError::UnknownErrorCode.)
+ */
+ UnknownResult = ndberror_st_unknown
+ };
+
+ /**
+ * Type of error
+ */
+ enum Classification {
+ /**
+ * Success. No error occurred.
+ */
+ NoError = ndberror_cl_none,
+
+ /**
+ * Error in application program.
+ */
+ ApplicationError = ndberror_cl_application,
+
+ /**
+ * Read operation failed due to missing record.
+ */
+ NoDataFound = ndberror_cl_no_data_found,
+
+ /**
+ * E.g. inserting a tuple with a primary key already existing
+ * in the table.
+ */
+ ConstraintViolation = ndberror_cl_constraint_violation,
+
+ /**
+ * Error in creating table or usage of table.
+ */
+ SchemaError = ndberror_cl_schema_error,
+
+ /**
+ * Error occurred in interpreted program.
+ */
+ UserDefinedError = ndberror_cl_user_defined,
+
+ /**
+ * E.g. insufficient memory for data or indexes.
+ */
+ InsufficientSpace = ndberror_cl_insufficient_space,
+
+ /**
+ * E.g. too many active transactions.
+ */
+ TemporaryResourceError = ndberror_cl_temporary_resource,
+
+ /**
+ * Temporary failures which are probably inflicted by a node
+ * recovery in progress. Examples: information sent between
+ * application and NDB lost, distribution change.
+ */
+ NodeRecoveryError = ndberror_cl_node_recovery,
+
+ /**
+ * E.g. out of log file space.
+ */
+ OverloadError = ndberror_cl_overload,
+
+ /**
+ * Timeouts, often inflicted by deadlocks in NDB.
+ */
+ TimeoutExpired = ndberror_cl_timeout_expired,
+
+ /**
+ * Is is unknown whether the transaction was committed or not.
+ */
+ UnknownResultError = ndberror_cl_unknown_result,
+
+ /**
+ * A serious error in NDB has occurred.
+ */
+ InternalError = ndberror_cl_internal_error,
+
+ /**
+ * A function used is not yet implemented.
+ */
+ FunctionNotImplemented = ndberror_cl_function_not_implemented,
+
+ /**
+ * Error handler could not determine correct error code.
+ */
+ UnknownErrorCode = ndberror_cl_unknown_error_code,
+
+ /**
+ * Node shutdown
+ */
+ NodeShutdown = ndberror_cl_node_shutdown,
+
+ /**
+ * Schema object already exists
+ */
+ SchemaObjectExists = ndberror_cl_schema_object_already_exists
+ };
+
+ /**
+ * 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;
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ NdbError(){
+ status = UnknownResult;
+ classification = NoError;
+ code = 0;
+ message = 0;
+ details = 0;
+ }
+ NdbError(const ndberror_struct & ndberror){
+ status = (NdbError::Status) ndberror.status;
+ classification = (NdbError::Classification) ndberror.classification;
+ code = ndberror.code;
+ message = ndberror.message;
+ details = ndberror.details;
+ }
+ operator ndberror_struct() const {
+ ndberror_struct ndberror;
+ ndberror.status = (ndberror_status_enum) status;
+ ndberror.classification = (ndberror_classification_enum) classification;
+ ndberror.code = code;
+ ndberror.message = message;
+ ndberror.details = details;
+ return ndberror;
+ }
+#endif
+};
+
+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/storage/ndb/include/ndbapi/NdbEventOperation.hpp b/storage/ndb/include/ndbapi/NdbEventOperation.hpp
new file mode 100644
index 00000000000..55ee96b3144
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbEventOperation.hpp
@@ -0,0 +1,225 @@
+/* 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 NdbEventOperation_H
+#define NdbEventOperation_H
+
+class NdbGlobalEventBuffer;
+class NdbEventOperationImpl;
+
+/**
+ * @class NdbEventOperation
+ * @brief Class of operations for getting change events from database.
+ *
+ * Brief description on how to work with events:
+ *
+ * - An event, represented by an NdbDictionary::Event, i created in the
+ * Database through
+ * NdbDictionary::Dictionary::createEvent() (note that this can be done
+ * by any application or thread and not necessarily by the "listener")
+ * - To listen to events, an NdbEventOperation object is instantiated by
+ * Ndb::createEventOperation()
+ * - execute() starts the event flow. Use Ndb::pollEvents() to wait
+ * for an event to occur. Use next() to iterate
+ * through the events that have occured.
+ * - The instance is removed by Ndb::dropEventOperation()
+ *
+ * For more info see:
+ * @ref ndbapi_event.cpp
+ *
+ * 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().
+ * - "False" exits from Ndb::pollEvents() may occur and thus
+ * the subsequent next() will return zero,
+ * since there was no available data. Just do Ndb::pollEvents() again.
+ * - Event code does not check table schema version. Make sure to drop events
+ * after table is dropped. Will be fixed in later
+ * versions.
+ * - If a node failure 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
+ *
+ * Useful API programs:
+ *
+ * - ndb_select_all -d sys 'NDB$EVENTS_0'
+ * shows contents in the system table containing created events.
+ *
+ * @note this is an inteface to viewing events that is subject to change
+ */
+class NdbEventOperation {
+public:
+ /**
+ * State of the NdbEventOperation object
+ */
+ enum State {
+ EO_CREATED, ///< Created but execute() not called
+ EO_EXECUTING, ///< execute() called
+ EO_ERROR ///< An error has occurred. Object unusable.
+ };
+ /**
+ * Retrieve current state of the NdbEventOperation object
+ */
+ 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 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, getValue() and
+ * 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
+ * execute() has been made and
+ * 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 = 0);
+ /**
+ * See getValue().
+ */
+ NdbRecAttr *getPreValue(const char *anAttrName, char *aValue = 0);
+
+ /**
+ * 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()
+ * which will wait on a mutex until an event occurs or the specified
+ * timeout occurs.
+ *
+ * @return >=0 if successful otherwise -1. Return value indicates number
+ * of available events. By sending pOverRun one may query for buffer
+ * overflow and *pOverRun will indicate the number of events that have
+ * overwritten.
+ *
+ * @return number of available events, -1 on failure
+ */
+ int next(int *pOverRun=0);
+
+ /**
+ * 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.
+ *
+ * @note Only valid after next() has been called and returned value >= 0
+ *
+ * @return type of event
+ */
+ NdbDictionary::Event::TableEvent getEventType();
+
+ /**
+ * Retrieve the GCI of the latest retrieved event
+ *
+ * @return GCI number
+ */
+ Uint32 getGCI();
+
+ /**
+ * Retrieve the complete GCI in the cluster (not necessarily
+ * associated with an event)
+ *
+ * @return GCI number
+ */
+ Uint32 getLatestGCI();
+
+ /**
+ * Get the latest error
+ *
+ * @return Error object.
+ */
+ const struct NdbError & getNdbError() const;
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /*
+ *
+ */
+ void print();
+#endif
+
+private:
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class NdbEventOperationImpl;
+ friend class Ndb;
+#endif
+ 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/storage/ndb/include/ndbapi/NdbIndexOperation.hpp b/storage/ndb/include/ndbapi/NdbIndexOperation.hpp
new file mode 100644
index 00000000000..3de6835238e
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbIndexOperation.hpp
@@ -0,0 +1,186 @@
+/* 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 NdbIndexOperation_H
+#define NdbIndexOperation_H
+
+#include "NdbOperation.hpp"
+
+class Index;
+class NdbResultSet;
+
+/**
+ * @class NdbIndexOperation
+ * @brief Class of index operations for use in transactions
+ */
+class NdbIndexOperation : public NdbOperation
+{
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class Ndb;
+ friend class NdbTransaction;
+#endif
+
+public:
+ /**
+ * @name Define Standard Operation
+ * @{
+ */
+
+ /** insert is not allowed */
+ int insertTuple();
+
+ /**
+ * Define the NdbIndexOperation to be a standard operation of type readTuple.
+ * When calling NdbTransaction::execute, this operation
+ * reads a tuple.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int readTuple(LockMode);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * Define the NdbIndexOperation to be a standard operation of type readTuple.
+ * When calling NdbTransaction::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 NdbTransaction::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 NdbTransaction::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 NdbTransaction::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();
+
+ int committedRead();
+#endif
+
+ /**
+ * Define the NdbIndexOperation to be a standard operation of type
+ * updateTuple.
+ *
+ * When calling NdbTransaction::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 NdbTransaction::execute, this operation
+ * deletes a tuple.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int deleteTuple();
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * Define the NdbIndexOperation to be a standard operation of type
+ * dirtyUpdate.
+ *
+ * When calling NdbTransaction::execute, this operation
+ * updates without two-phase commit.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int dirtyUpdate();
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /** @} *********************************************************************/
+ /**
+ * @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();
+#endif
+
+ /** @} *********************************************************************/
+
+private:
+ NdbIndexOperation(Ndb* aNdb);
+ ~NdbIndexOperation();
+
+ int receiveTCINDXREF(NdbApiSignal* aSignal);
+
+ // Overloaded methods from NdbCursorOperation
+ int indxInit(const class NdbIndexImpl* anIndex,
+ const class NdbTableImpl* aTable,
+ NdbTransaction*);
+
+ int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId);
+
+ // Private attributes
+ const NdbIndexImpl* m_theIndex;
+};
+
+#endif
diff --git a/storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp b/storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp
new file mode 100644
index 00000000000..b91a2a90d11
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp
@@ -0,0 +1,155 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef NdbIndexScanOperation_H
+#define NdbIndexScanOperation_H
+
+#include <NdbScanOperation.hpp>
+
+/**
+ * @class NdbIndexScanOperation
+ * @brief Class of scan operations for use to scan ordered index
+ */
+class NdbIndexScanOperation : public NdbScanOperation {
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class Ndb;
+ friend class NdbTransaction;
+ friend class NdbResultSet;
+ friend class NdbOperation;
+ friend class NdbScanOperation;
+#endif
+
+public:
+ /**
+ * readTuples using ordered index
+ *
+ * @param lock_mode Lock mode
+ * @param batch No of rows to fetch from each fragment at a time
+ * @param parallel No of fragments to scan in parallel
+ * @param order_by Order result set in index order
+ * @param order_desc Order descending, ignored unless order_by
+ * @param read_range_no Enable reading of range no using @ref get_range_no
+ * @returns 0 for success and -1 for failure
+ * @see NdbScanOperation::readTuples
+ */
+ int readTuples(LockMode lock_mode = LM_Read,
+ Uint32 batch = 0,
+ Uint32 parallel = 0,
+ bool order_by = false,
+ bool order_desc = false,
+ bool read_range_no = false);
+
+ /**
+ * 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 lower and/or upper bound. Setting the key
+ * equal to a value defines both upper and lower bounds. The bounds
+ * can be defined in any order. Conflicting definitions is an error.
+ *
+ * For equality, it is better to use BoundEQ instead of the equivalent
+ * pair of BoundLE and BoundGE. This is especially true when table
+ * partition key is an initial part of the index key.
+ *
+ * The sets of lower and upper bounds must be on initial sequences of
+ * index keys. All but possibly the last bound must be non-strict.
+ * So "a >= 2 and b > 3" is ok but "a > 2 and b >= 3" is not.
+ *
+ * The scan may currently return tuples for which the bounds are not
+ * satisfied. For example, "a <= 2 and b <= 3" scans the index up to
+ * (a=2, b=3) but also returns any (a=1, b=4).
+ *
+ * NULL is treated like a normal value which is less than any not-NULL
+ * value and equal to another NULL value. To compare against NULL use
+ * setBound with null pointer (0).
+ *
+ * An index stores also all-NULL keys. Doing index scan with empty
+ * bound set returns all table tuples.
+ *
+ * @param attr Attribute name, alternatively:
+ * @param type Type of bound
+ * @param value Pointer to bound value, 0 for NULL
+ * @param len Value length in bytes.
+ * Fixed per datatype and can be omitted
+ * @return 0 if successful otherwise -1
+ */
+ int setBound(const char* attr, int type, const void* value, 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);
+
+ /**
+ * Reset bounds and put operation in list that will be
+ * sent on next execute
+ */
+ int reset_bounds(bool forceSend = false);
+
+ /**
+ * Marks end of a bound,
+ * used when batching index reads (multiple ranges)
+ */
+ int end_of_bound(Uint32 range_no);
+
+ /**
+ * Return range no for current row
+ */
+ int get_range_no();
+
+ /**
+ * Is current scan sorted
+ */
+ bool getSorted() const { return m_ordered; }
+
+ /**
+ * Is current scan sorted descending
+ */
+ bool getDescending() const { return m_descending; }
+private:
+ NdbIndexScanOperation(Ndb* aNdb);
+ virtual ~NdbIndexScanOperation();
+
+ int setBound(const NdbColumnImpl*, int type, const void* aValue, Uint32 len);
+ int insertBOUNDS(Uint32 * data, Uint32 sz);
+
+ virtual int equal_impl(const NdbColumnImpl*, const char*, Uint32);
+ virtual NdbRecAttr* getValue_impl(const NdbColumnImpl*, char*);
+
+ void fix_get_values();
+ int next_result_ordered(bool fetchAllowed, bool forceSend = false);
+ int send_next_scan_ordered(Uint32 idx, bool forceSend = false);
+ int compare(Uint32 key, Uint32 cols, const NdbReceiver*, const NdbReceiver*);
+
+ Uint32 m_sort_columns;
+
+ Uint32 m_this_bound_start;
+ Uint32 * m_first_bound_word;
+};
+
+#endif
diff --git a/storage/ndb/include/ndbapi/NdbOperation.hpp b/storage/ndb/include/ndbapi/NdbOperation.hpp
new file mode 100644
index 00000000000..fca610772cc
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbOperation.hpp
@@ -0,0 +1,1226 @@
+/* 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 <ndb_types.h>
+#include "ndbapi_limits.h"
+#include "NdbError.hpp"
+#include "NdbReceiver.hpp"
+#include "NdbDictionary.hpp"
+
+class Ndb;
+class NdbApiSignal;
+class NdbRecAttr;
+class NdbOperation;
+class NdbTransaction;
+class NdbColumnImpl;
+class NdbBlob;
+
+/**
+ * @class NdbOperation
+ * @brief Class of operations for use in transactions.
+ */
+class NdbOperation
+{
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class Ndb;
+ friend class NdbTransaction;
+ friend class NdbScanOperation;
+ friend class NdbScanReceiver;
+ friend class NdbScanFilter;
+ friend class NdbScanFilterImpl;
+ friend class NdbReceiver;
+ friend class NdbBlob;
+#endif
+
+public:
+ /**
+ * @name Define Standard Operation Type
+ * @{
+ */
+
+ /**
+ * Lock when performing read
+ */
+
+ enum LockMode {
+ LM_Read ///< Read with shared lock
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ = 0
+#endif
+ ,LM_Exclusive ///< Read with exclusive lock
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ = 1
+#endif
+ ,LM_CommittedRead ///< Ignore locks, read last committed value
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ = 2,
+ LM_Dirty = 2
+#endif
+ };
+
+ /**
+ * Define the NdbOperation to be a standard operation of type insertTuple.
+ * When calling NdbTransaction::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 NdbTransaction::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 NdbTransaction::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 NdbTransaction::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 NdbTransaction::execute, this operation
+ * reads a tuple.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int readTuple(LockMode);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * Define the NdbOperation to be a standard operation of type readTuple.
+ * When calling NdbTransaction::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 NdbTransaction::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 NdbTransaction::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();
+
+ /**
+ * Define the NdbOperation to be a standard operation of type committedRead.
+ * When calling NdbTransaction::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();
+
+ /**
+ * Define the NdbOperation to be a standard operation of type committedRead.
+ * When calling NdbTransaction::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 NdbTransaction::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 NdbTransaction::execute, this operation
+ * writes without two-phase commit.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ virtual int dirtyWrite();
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /** @} *********************************************************************/
+ /**
+ * @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();
+#endif
+
+ /** @} *********************************************************************/
+
+ /**
+ * @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 For insertTuple() it is also allowed to define the
+ * search key by using setValue().
+ *
+ * @note There are 10 versions of equal() with
+ * slightly different parameters.
+ *
+ * @note When using 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);
+
+ /** @} *********************************************************************/
+ /**
+ * @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 NdbTransaction::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 = 0);
+ NdbRecAttr* getValue(Uint32 anAttrId, char* aValue = 0);
+ NdbRecAttr* getValue(const NdbDictionary::Column*, char* val = 0);
+
+ /**
+ * 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 For insertTuple() the NDB API will automatically detect that
+ * it is supposed to use equal() instead.
+ *
+ * @note For insertTuple() it is not necessary to use
+ * setValue() on key attributes before other attributes.
+ *
+ * @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);
+
+ /**
+ * This method replaces getValue/setValue for blobs. It creates
+ * a blob handle NdbBlob. A second call with same argument returns
+ * the previously created handle. The handle is linked to the
+ * operation and is maintained automatically.
+ *
+ * See NdbBlob for details.
+ */
+ virtual NdbBlob* getBlobHandle(const char* anAttrName);
+ virtual NdbBlob* getBlobHandle(Uint32 anAttrId);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /** @} *********************************************************************/
+ /**
+ * @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 void * val, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_ne(Uint32 ColId, const void * val, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_lt(Uint32 ColId, const void * val, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_le(Uint32 ColId, const void * val, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_gt(Uint32 ColId, const void * val, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_ge(Uint32 ColId, const void * val, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_like(Uint32 ColId, const void *, Uint32 len,
+ bool nopad, Uint32 Label);
+ int branch_col_notlike(Uint32 ColId, const void *, 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:
+ *
+ * For scanning transactions,
+ * return this row, but no more from this fragment
+ *
+ * For non-scanning transactions,
+ * abort the whole transaction.
+ *
+ * @return -1 if unsuccessful.
+ */
+ int interpret_exit_last_row();
+
+ /**
+ * 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();
+#endif
+
+ /** @} *********************************************************************/
+
+ /**
+ * @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();
+
+ /**
+ * Get table name of this operation.
+ */
+ const char* getTableName() const;
+
+ /**
+ * Get table object for this operation
+ */
+ const NdbDictionary::Table * getTable() const;
+
+ /** @} *********************************************************************/
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * 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, ///< Internal for debugging
+ NotDefined ///< Internal for debugging
+ };
+#endif
+
+ /**
+ * Return lock mode for operation
+ */
+ LockMode getLockMode() const { return theLockMode; }
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ void setAbortOption(Int8 ao) { m_abortOption = ao; }
+
+ /**
+ * Set/get partition key
+ */
+ void setPartitionId(Uint32 id);
+ void setPartitionHash(Uint32 key);
+ void setPartitionHash(const Uint64 *, Uint32 len);
+ Uint32 getPartitionId() const;
+#endif
+protected:
+ int handle_distribution_key(const Uint64 *, Uint32 len);
+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(const class NdbTableImpl*, NdbTransaction* aCon);
+ void initInterpreter();
+
+ void next(NdbOperation*); // Set next pointer
+ NdbOperation* next(); // Get next pointer
+public:
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ const NdbOperation* next() const;
+ const NdbRecAttr* getFirstRecAttr() const;
+#endif
+protected:
+
+ enum OperationStatus
+ {
+ Init,
+ OperationDefined,
+ TupleKeyDefined,
+ GetValue,
+ SetValue,
+ ExecInterpretedValue,
+ SetValueInterpreted,
+ FinalGetValue,
+ SubroutineExec,
+ SubroutineEnd,
+ WaitResponse,
+ WaitCommitResponse,
+ Finished,
+ ReceiveFinished
+ };
+
+ OperationStatus Status(); // Read the status information
+
+ void Status(OperationStatus); // Set the status information
+
+ void NdbCon(NdbTransaction*); // Set reference to connection
+ // object.
+
+ virtual void release(); // Release all operations
+ // connected to
+ // the operations object.
+ void setStartIndicator();
+
+/******************************************************************************
+ * 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);
+ virtual int prepareSend(Uint32 TC_ConnectPtr,
+ Uint64 TransactionId);
+ virtual void setLastFlag(NdbApiSignal* signal, Uint32 lastFlag);
+
+ int prepareSendInterpreted(); // Help routine to prepare*
+
+ int receiveTCKEYREF(NdbApiSignal*);
+
+ int checkMagicNumber(bool b = true); // Verify correct object
+
+ int checkState_TransId(NdbApiSignal* aSignal);
+
+/******************************************************************************
+ * These are support methods only used locally in this class.
+******************************************************************************/
+
+ virtual int equal_impl(const NdbColumnImpl*,const char* aValue, Uint32 len);
+ virtual NdbRecAttr* getValue_impl(const NdbColumnImpl*, char* aValue = 0);
+ int setValue(const NdbColumnImpl* anAttrObject, const char* aValue, Uint32 len);
+ NdbBlob* getBlobHandle(NdbTransaction* aCon, const NdbColumnImpl* anAttrObject);
+ 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 void *, Uint32, bool, Uint32 Label);
+ int branch_col_null(Uint32 type, Uint32 col, Uint32 Label);
+
+ // Handle ATTRINFO signals
+ int insertATTRINFO(Uint32 aData);
+ int insertATTRINFOloop(const Uint32* aDataPtr, Uint32 aLength);
+
+ int insertKEYINFO(const char* aValue,
+ Uint32 aStartPosition,
+ Uint32 aKeyLenInByte);
+
+ 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(); };
+
+ // get table or index key from prepared signals
+ int getKeyFromTCREQ(Uint32* data, unsigned size);
+
+/******************************************************************************
+ * 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.
+ NdbTransaction* theNdbCon; // Point back to the connection object.
+ NdbOperation* theNext; // Next pointer to operation.
+
+ union {
+ NdbApiSignal* theTCREQ; // The TC[KEY/INDX]REQ signal object
+ NdbApiSignal* theSCAN_TABREQ;
+ };
+
+ 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* theLastKEYINFO; // The first KEYINFO signal 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
+
+ const class NdbTableImpl* m_currentTable; // The current table
+ const class NdbTableImpl* m_accessTable; // Index table (== current for pk)
+
+ // Set to TRUE when a tuple key attribute has been defined.
+ Uint32 theTupleKeyDefined[NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY][3];
+
+ Uint32 theTotalNrOfKeyWordInSignal; // The total number of
+ // keyword in signal.
+
+ Uint32 theTupKeyLen; // Length of the tuple key in words
+ // left until done
+ Uint8 theNoOfTupKeyLeft; // The number of tuple key attributes
+ OperationType theOperationType; // Read Request, Update Req......
+
+ LockMode 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 theDistributionKey; // Distribution Key size 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
+ Int8 theDistrKeyIndicator_; // Indicates whether distr. key is used
+
+ Uint16 m_tcReqGSN;
+ Uint16 m_keyInfoGSN;
+ Uint16 m_attrInfoGSN;
+
+ // Blobs in this operation
+ NdbBlob* theBlobList;
+
+ /*
+ * Abort option per operation, used by blobs. Default -1. If set,
+ * overrides abort option on connection level. If set to IgnoreError,
+ * does not cause execute() to return failure. This is different from
+ * IgnoreError on connection level.
+ */
+ Int8 m_abortOption;
+};
+
+#ifdef NDB_NO_DROPPED_SIGNAL
+#include <stdlib.h>
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+
+inline
+int
+NdbOperation::checkMagicNumber(bool b)
+{
+ if (theMagicNumber != 0xABCDEF01){
+#ifdef NDB_NO_DROPPED_SIGNAL
+ if(b) abort();
+#endif
+ return -1;
+ }
+ return 0;
+}
+
+inline
+void
+NdbOperation::setStartIndicator()
+{
+ theStartIndicator = 1;
+}
+
+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;
+}
+
+inline
+const NdbOperation*
+NdbOperation::next() const
+{
+ return theNext;
+}
+
+inline
+const NdbRecAttr*
+NdbOperation::getFirstRecAttr() const
+{
+ return theReceiver.theFirstRecAttr;
+}
+
+/******************************************************************************
+OperationStatus Status();
+
+Return Value Return the OperationStatus.
+Parameters: aStatus: The status.
+Remark: Sets Operation status.
+******************************************************************************/
+inline
+NdbOperation::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(NdbTransaction* aNdbCon);
+
+Parameters: aNdbCon: Pointers to NdbTransaction object.
+Remark: Set the reference to the connection in the operation object.
+******************************************************************************/
+inline
+void
+NdbOperation::NdbCon(NdbTransaction* aNdbCon)
+{
+ theNdbCon = aNdbCon;
+}
+
+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 // doxygen
+
+#endif
diff --git a/storage/ndb/include/ndbapi/NdbPool.hpp b/storage/ndb/include/ndbapi/NdbPool.hpp
new file mode 100644
index 00000000000..64cba5a008c
--- /dev/null
+++ b/storage/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/storage/ndb/include/ndbapi/NdbRecAttr.hpp b/storage/ndb/include/ndbapi/NdbRecAttr.hpp
new file mode 100644
index 00000000000..50de4f3277e
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbRecAttr.hpp
@@ -0,0 +1,445 @@
+/* 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 <NdbDictionary.hpp>
+
+class NdbOperation;
+
+/**
+ * @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 (MyTransaction->execute(Commit) == -1) goto error;
+ *
+ * ndbout << MyRecAttr->u_32_value();
+ * @endcode
+ * For more examples, see
+ * @ref ndbapi_simple.cpp.
+ *
+ * @note The NdbRecAttr object is instantiated with its value when
+ * NdbTransaction::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 NdbTransaction::execute and
+ * the time of Ndb::closeTransaction.
+ * The value of the null indicator is -1 until the
+ * NdbTransaction::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
+{
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class NdbOperation;
+ friend class NdbIndexScanOperation;
+ friend class NdbEventOperationImpl;
+ friend class NdbReceiver;
+ friend class Ndb;
+ friend class NdbOut& operator<<(class NdbOut&, const class AttributeS&);
+#endif
+
+public:
+ /**
+ * @name Getting meta information
+ * @{
+ */
+ const NdbDictionary::Column * getColumn() const;
+
+ /**
+ * Get type of column
+ * @return Data type of the column
+ */
+ 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
+ * NdbTransaction::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();
+
+public:
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ const NdbRecAttr* next() const;
+#endif
+private:
+ NdbRecAttr();
+
+ Uint32 attrId() const; /* Get attribute id */
+ bool setNULL(); /* Set NULL indicator */
+ void setUNDEFINED(); /* Set UNDEFINED indicator */
+ bool receive_data(const Uint32*, Uint32);
+
+ void release(); /* Release memory if allocated */
+ void init(); /* Initialise object when allocated */
+
+ void next(NdbRecAttr* aRecAttr);
+ NdbRecAttr* next();
+
+ int setup(const class NdbDictionary::Column* col, char* aValue);
+ 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;
+ bool m_nullable;
+ Uint32 theAttrSize;
+ Uint32 theArraySize;
+ const NdbDictionary::Column* m_column;
+};
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+
+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 {
+ return theAttrSize;
+}
+
+inline
+Uint32
+NdbRecAttr::arraySize() const
+{
+ return theArraySize;
+}
+
+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
+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
+void
+NdbRecAttr::release()
+{
+ if (theStorageX != 0) {
+ delete [] theStorageX;
+ theStorageX = 0;
+ }
+}
+
+inline
+void
+NdbRecAttr::init()
+{
+ theStorageX = 0;
+ theValue = 0;
+ theRef = 0;
+ theNext = 0;
+ theAttrId = 0xFFFF;
+ theNULLind = -1;
+}
+
+inline
+void
+NdbRecAttr::next(NdbRecAttr* aRecAttr)
+{
+ theNext = aRecAttr;
+}
+
+inline
+NdbRecAttr*
+NdbRecAttr::next()
+{
+ return theNext;
+}
+
+inline
+const NdbRecAttr*
+NdbRecAttr::next() const
+{
+ return theNext;
+}
+
+inline
+char*
+NdbRecAttr::aRef() const
+{
+ return (char*)theRef;
+}
+
+inline
+bool
+NdbRecAttr::copyoutRequired() const
+{
+ return theRef != theValue && theValue != 0;
+}
+
+inline
+Uint32
+NdbRecAttr::attrId() const
+{
+ return theAttrId;
+}
+
+inline
+bool
+NdbRecAttr::setNULL()
+{
+ theNULLind = 1;
+ return m_nullable;
+}
+
+inline
+void
+NdbRecAttr::setUNDEFINED()
+{
+ theNULLind = -1;
+}
+
+inline
+int
+NdbRecAttr::isNULL() const
+{
+ return theNULLind;
+}
+
+class NdbOut& operator <<(class NdbOut&, const NdbRecAttr &);
+
+#endif // ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+
+#endif
+
diff --git a/storage/ndb/include/ndbapi/NdbReceiver.hpp b/storage/ndb/include/ndbapi/NdbReceiver.hpp
new file mode 100644
index 00000000000..ff6debc7fd3
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbReceiver.hpp
@@ -0,0 +1,150 @@
+/* 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 <ndb_types.h>
+
+class Ndb;
+class NdbTransaction;
+
+class NdbReceiver
+{
+ friend class Ndb;
+ friend class NdbOperation;
+ friend class NdbScanOperation;
+ friend class NdbIndexOperation;
+ friend class NdbIndexScanOperation;
+ friend class NdbTransaction;
+public:
+ enum ReceiverType { NDB_UNINITIALIZED,
+ NDB_OPERATION = 1,
+ NDB_SCANRECEIVER = 2,
+ NDB_INDEX_OPERATION = 3
+ };
+
+ NdbReceiver(Ndb *aNdb);
+ void init(ReceiverType type, void* owner);
+ void release();
+ ~NdbReceiver();
+
+ Uint32 getId(){
+ return m_id;
+ }
+
+ ReceiverType getType(){
+ return m_type;
+ }
+
+ inline NdbTransaction * getTransaction();
+ void* getOwner(){
+ return m_owner;
+ }
+
+ bool checkMagicNumber() const;
+
+ inline void next(NdbReceiver* next) { m_next = next;}
+ inline NdbReceiver* next() { return m_next; }
+
+ void setErrorCode(int);
+private:
+ Uint32 theMagicNumber;
+ Ndb* m_ndb;
+ Uint32 m_id;
+ Uint32 m_tcPtrI;
+ Uint32 m_hidden_count;
+ ReceiverType m_type;
+ void* m_owner;
+ NdbReceiver* m_next;
+
+ /**
+ * At setup
+ */
+ class NdbRecAttr * getValue(const class NdbColumnImpl*, char * user_dst_ptr);
+ void do_get_value(NdbReceiver*, Uint32 rows, Uint32 key_size, Uint32 range);
+ void prepareSend();
+ void calculate_batch_size(Uint32, Uint32, Uint32&, Uint32&, Uint32&);
+
+ int execKEYINFO20(Uint32 info, const Uint32* ptr, Uint32 len);
+ int execTRANSID_AI(const Uint32* ptr, Uint32 len);
+ int execTCOPCONF(Uint32 len);
+ int execSCANOPCONF(Uint32 tcPtrI, Uint32 len, Uint32 rows);
+ class NdbRecAttr* theFirstRecAttr;
+ class NdbRecAttr* theCurrentRecAttr;
+ class NdbRecAttr** m_rows;
+
+ Uint32 m_list_index; // When using multiple
+ Uint32 m_current_row;
+ Uint32 m_result_rows;
+ Uint32 m_defined_rows;
+
+ Uint32 m_expected_result_length;
+ Uint32 m_received_result_length;
+
+ bool nextResult() const { return m_current_row < m_result_rows; }
+ NdbRecAttr* copyout(NdbReceiver&);
+};
+
+#ifdef NDB_NO_DROPPED_SIGNAL
+#include <stdlib.h>
+#endif
+
+inline
+bool
+NdbReceiver::checkMagicNumber() const {
+ bool retVal = (theMagicNumber == 0x11223344);
+#ifdef NDB_NO_DROPPED_SIGNAL
+ if(!retVal){
+ abort();
+ }
+#endif
+ return retVal;
+}
+
+inline
+void
+NdbReceiver::prepareSend(){
+ m_current_row = 0;
+ m_received_result_length = 0;
+ m_expected_result_length = 0;
+ theCurrentRecAttr = theFirstRecAttr;
+}
+
+inline
+int
+NdbReceiver::execTCOPCONF(Uint32 len){
+ Uint32 tmp = m_received_result_length;
+ m_expected_result_length = len;
+#ifdef assert
+ assert(!(tmp && !len));
+#endif
+ return ((bool)len ^ (bool)tmp ? 0 : 1);
+}
+
+inline
+int
+NdbReceiver::execSCANOPCONF(Uint32 tcPtrI, Uint32 len, Uint32 rows){
+ m_tcPtrI = tcPtrI;
+ m_result_rows = rows;
+ Uint32 tmp = m_received_result_length;
+ m_expected_result_length = len;
+ return (tmp == len ? 1 : 0);
+}
+
+#endif // DOXYGEN_SHOULD_SKIP_INTERNAL
+#endif
diff --git a/storage/ndb/include/ndbapi/NdbScanFilter.hpp b/storage/ndb/include/ndbapi/NdbScanFilter.hpp
new file mode 100644
index 00000000000..b5457bab99b
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbScanFilter.hpp
@@ -0,0 +1,178 @@
+/* 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)
+ };
+
+ enum BinaryCondition
+ {
+ COND_LE = 0, ///< lower bound
+ COND_LT = 1, ///< lower bound, strict
+ COND_GE = 2, ///< upper bound
+ COND_GT = 3, ///< upper bound, strict
+ COND_EQ = 4, ///< equality
+ COND_NE = 5, ///< not equal
+ COND_LIKE = 6, ///< like
+ COND_NOT_LIKE = 7 ///< not like
+ };
+
+ /**
+ * @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();
+
+ /**
+ * Compare column <b>ColId</b> with <b>val</b>
+ */
+ int cmp(BinaryCondition cond, int ColId, const void *val, Uint32 len = 0);
+
+ /**
+ * @name Integer Comparators
+ * @{
+ */
+ /** Compare column value with integer for equal
+ * ®return 0 if successful, -1 otherwize
+ */
+ int eq(int ColId, Uint32 value) { return cmp(COND_EQ, ColId, &value, 4);}
+
+ /** Compare column value with integer for not equal.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int ne(int ColId, Uint32 value) { return cmp(COND_NE, ColId, &value, 4);}
+ /** Compare column value with integer for less than.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int lt(int ColId, Uint32 value) { return cmp(COND_LT, ColId, &value, 4);}
+ /** Compare column value with integer for less than or equal.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int le(int ColId, Uint32 value) { return cmp(COND_LE, ColId, &value, 4);}
+ /** Compare column value with integer for greater than.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int gt(int ColId, Uint32 value) { return cmp(COND_GT, ColId, &value, 4);}
+ /** Compare column value with integer for greater than or equal.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int ge(int ColId, Uint32 value) { return cmp(COND_GE, ColId, &value, 4);}
+
+ /** Compare column value with integer for equal. 64-bit.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int eq(int ColId, Uint64 value) { return cmp(COND_EQ, ColId, &value, 8);}
+ /** Compare column value with integer for not equal. 64-bit.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int ne(int ColId, Uint64 value) { return cmp(COND_NE, ColId, &value, 8);}
+ /** Compare column value with integer for less than. 64-bit.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int lt(int ColId, Uint64 value) { return cmp(COND_LT, ColId, &value, 8);}
+ /** Compare column value with integer for less than or equal. 64-bit.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int le(int ColId, Uint64 value) { return cmp(COND_LE, ColId, &value, 8);}
+ /** Compare column value with integer for greater than. 64-bit.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int gt(int ColId, Uint64 value) { return cmp(COND_GT, ColId, &value, 8);}
+ /** Compare column value with integer for greater than or equal. 64-bit.
+ * ®return 0 if successful, -1 otherwize
+ */
+ int ge(int ColId, Uint64 value) { return cmp(COND_GE, ColId, &value, 8);}
+ /** @} *********************************************************************/
+
+ /** Check if column value is NULL */
+ int isnull(int ColId);
+ /** Check if column value is non-NULL */
+ int isnotnull(int ColId);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * 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);
+ /** @} *********************************************************************/
+#endif
+
+private:
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class NdbScanFilterImpl;
+#endif
+ class NdbScanFilterImpl & m_impl;
+ NdbScanFilter& operator=(const NdbScanFilter&); ///< Defined not implemented
+};
+
+#endif
diff --git a/storage/ndb/include/ndbapi/NdbScanOperation.hpp b/storage/ndb/include/ndbapi/NdbScanOperation.hpp
new file mode 100644
index 00000000000..5da717148b5
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbScanOperation.hpp
@@ -0,0 +1,256 @@
+/* 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 NdbScanOperation_H
+#define NdbScanOperation_H
+
+#include <NdbOperation.hpp>
+
+class NdbBlob;
+class NdbResultSet;
+
+/**
+ * @class NdbScanOperation
+ * @brief Class of scan operations for use in transactions.
+ */
+class NdbScanOperation : public NdbOperation {
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class Ndb;
+ friend class NdbTransaction;
+ friend class NdbResultSet;
+ friend class NdbOperation;
+ friend class NdbBlob;
+#endif
+
+public:
+ /**
+ * readTuples
+ *
+ * @param lock_mode Lock mode
+ * @param batch No of rows to fetch from each fragment at a time
+ * @param parallel No of fragments to scan in parallell
+ * @note specifying 0 for batch and parallall means max performance
+ */
+ int readTuples(LockMode lock_mode = LM_Read,
+ Uint32 batch = 0, Uint32 parallel = 0);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ inline int readTuples(int parallell){
+ return readTuples(LM_Read, 0, parallell);
+ }
+
+ inline int readTuplesExclusive(int parallell = 0){
+ return readTuples(LM_Exclusive, 0, parallell);
+ }
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ NdbBlob* getBlobHandle(const char* anAttrName);
+ NdbBlob* getBlobHandle(Uint32 anAttrId);
+#endif
+
+ /**
+ * Get the next tuple in a scan transaction.
+ *
+ * After each call to 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
+ * @param forceSend If true send will occur immediately (see @ref secAdapt)
+ *
+ * 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, bool forceSend = false);
+
+ /**
+ * Close scan
+ */
+ void close(bool forceSend = false);
+
+ /**
+ * Update current tuple
+ *
+ * @return an NdbOperation or NULL.
+ */
+ NdbOperation* updateCurrentTuple();
+ /**
+ * Update current tuple
+ *
+ * @param updateTrans Transaction that should perform the update
+ *
+ * @return an NdbOperation or NULL.
+ */
+ NdbOperation* updateCurrentTuple(NdbTransaction* updateTrans);
+
+ /**
+ * Delete current tuple
+ * @return 0 on success or -1 on failure
+ */
+ int deleteCurrentTuple();
+ /**
+ * Delete current tuple
+ *
+ * @param takeOverTransaction Transaction that should perform the delete
+ *
+ * @return 0 on success or -1 on failure
+ */
+ int deleteCurrentTuple(NdbTransaction* takeOverTransaction);
+
+ /**
+ * Restart scan with exactly the same
+ * getValues and search conditions
+ */
+ int restart(bool forceSend = false);
+
+protected:
+ NdbScanOperation(Ndb* aNdb);
+ virtual ~NdbScanOperation();
+
+ int nextResultImpl(bool fetchAllowed = true, bool forceSend = false);
+ virtual void release();
+
+ int close_impl(class TransporterFacade*, bool forceSend = false);
+
+ // Overloaded methods from NdbCursorOperation
+ int executeCursor(int ProcessorId);
+
+ // Overloaded private methods from NdbOperation
+ int init(const NdbTableImpl* tab, NdbTransaction*);
+ int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId);
+ int doSend(int ProcessorId);
+ void checkForceSend(bool forceSend);
+
+ virtual void setErrorCode(int aErrorCode);
+ virtual void setErrorCodeAbort(int aErrorCode);
+
+ NdbTransaction *m_transConnection;
+
+ // Scan related variables
+ Uint32 theParallelism;
+ Uint32 m_keyInfo;
+
+ int getFirstATTRINFOScan();
+ int doSendScan(int ProcessorId);
+ int prepareSendScan(Uint32 TC_ConnectPtr, Uint64 TransactionId);
+
+ int fix_receivers(Uint32 parallel);
+ void reset_receivers(Uint32 parallel, Uint32 ordered);
+ Uint32* m_array; // containing all arrays below
+ Uint32 m_allocated_receivers;
+ NdbReceiver** m_receivers; // All receivers
+
+ Uint32* m_prepared_receivers; // These are to be sent
+
+ /**
+ * owned by API/user thread
+ */
+ Uint32 m_current_api_receiver;
+ Uint32 m_api_receivers_count;
+ NdbReceiver** m_api_receivers; // These are currently used by api
+
+ /**
+ * owned by receiver thread
+ */
+ Uint32 m_conf_receivers_count; // NOTE needs mutex to access
+ NdbReceiver** m_conf_receivers; // receive thread puts them here
+
+ /**
+ * owned by receiver thread
+ */
+ Uint32 m_sent_receivers_count; // NOTE needs mutex to access
+ NdbReceiver** m_sent_receivers; // receive thread puts them here
+
+ int send_next_scan(Uint32 cnt, bool close, bool forceSend = false);
+ void receiver_delivered(NdbReceiver*);
+ void receiver_completed(NdbReceiver*);
+ void execCLOSE_SCAN_REP();
+
+ int getKeyFromKEYINFO20(Uint32* data, unsigned size);
+ NdbOperation* takeOverScanOp(OperationType opType, NdbTransaction*);
+
+ bool m_ordered;
+ bool m_descending;
+ Uint32 m_read_range_no;
+ NdbRecAttr *m_curr_row; // Pointer to last returned row
+};
+
+inline
+NdbOperation*
+NdbScanOperation::updateCurrentTuple(){
+ return updateCurrentTuple(m_transConnection);
+}
+
+inline
+NdbOperation*
+NdbScanOperation::updateCurrentTuple(NdbTransaction* takeOverTrans){
+ return takeOverScanOp(NdbOperation::UpdateRequest,
+ takeOverTrans);
+}
+
+inline
+int
+NdbScanOperation::deleteCurrentTuple(){
+ return deleteCurrentTuple(m_transConnection);
+}
+
+inline
+int
+NdbScanOperation::deleteCurrentTuple(NdbTransaction * takeOverTrans){
+ void * res = takeOverScanOp(NdbOperation::DeleteRequest,
+ takeOverTrans);
+ if(res == 0)
+ return -1;
+ return 0;
+}
+
+#endif
diff --git a/storage/ndb/include/ndbapi/NdbTransaction.hpp b/storage/ndb/include/ndbapi/NdbTransaction.hpp
new file mode 100644
index 00000000000..50e4e766803
--- /dev/null
+++ b/storage/ndb/include/ndbapi/NdbTransaction.hpp
@@ -0,0 +1,1053 @@
+/* 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 NdbTransaction_H
+#define NdbTransaction_H
+
+#include <ndb_types.h>
+#include <NdbError.hpp>
+#include <NdbDictionary.hpp>
+
+class NdbTransaction;
+class NdbOperation;
+class NdbScanOperation;
+class NdbIndexScanOperation;
+class NdbIndexOperation;
+class NdbApiSignal;
+class Ndb;
+class NdbBlob;
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+// to be documented later
+/**
+ * NdbAsynchCallback functions are used when executing asynchronous
+ * transactions (using NdbTransaction::executeAsynchPrepare, or
+ * NdbTransaction::executeAsynch).
+ * The functions are called when the execute has finished.
+ * See @ref secAsync for more information.
+ */
+typedef void (* NdbAsynchCallback)(int, NdbTransaction*, void*);
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+enum AbortOption {
+ CommitIfFailFree= 0,
+ TryCommit= 0,
+ AbortOnError= 0,
+ CommitAsMuchAsPossible= 2,
+ AO_IgnoreError= 2
+};
+enum ExecType {
+ NoExecTypeDef = -1,
+ Prepare,
+ NoCommit,
+ Commit,
+ Rollback
+};
+#endif
+
+/**
+ * @class NdbTransaction
+ * @brief Represents a transaction.
+ *
+ * A transaction (represented by an NdbTransaction object)
+ * belongs to an Ndb object and is created using
+ * Ndb::startTransaction().
+ * A transaction consists of a list of operations
+ * (represented by NdbOperation, NdbScanOperation, NdbIndexOperation,
+ * and NdbIndexScanOperation objects).
+ * Each operation access exactly one table.
+ *
+ * After getting the NdbTransaction object,
+ * the first step is to get (allocate) an operation given the table name using
+ * one of the methods getNdbOperation(), getNdbScanOperation(),
+ * getNdbIndexOperation(), or getNdbIndexScanOperation().
+ * Then the operation is defined.
+ * Several operations can be defined on the same
+ * NdbTransaction object, they will in that case be executed in parallell.
+ * When all operations are defined, the execute()
+ * method sends them to the NDB kernel for execution.
+ *
+ * The execute() method returns when the NDB kernel has
+ * completed execution of all operations defined before the call to
+ * execute(). All allocated operations should be properly defined
+ * before calling execute().
+ *
+ * A call to execute() uses one out of three types of execution:
+ * -# NdbTransaction::NoCommit Executes operations without committing them.
+ * -# NdbTransaction::Commit Executes remaining operation and commits the
+ * complete transaction
+ * -# NdbTransaction::Rollback Rollbacks the entire transaction.
+ *
+ * execute() is equipped with an extra error handling parameter.
+ * There are two alternatives:
+ * -# NdbTransaction::AbortOnError (default).
+ * The transaction is aborted if there are any error during the
+ * execution
+ * -# NdbTransaction::AO_IgnoreError
+ * Continue execution of transaction even if operation fails
+ *
+ */
+
+/* FUTURE IMPLEMENTATION:
+ * Later a prepare mode will be added when Ndb supports Prepare-To-Commit
+ * The NdbTransaction 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 NdbTransaction::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 NdbTransaction
+{
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ friend class Ndb;
+ friend class NdbOperation;
+ friend class NdbScanOperation;
+ friend class NdbIndexOperation;
+ friend class NdbIndexScanOperation;
+ friend class NdbBlob;
+#endif
+
+public:
+
+ /**
+ * Commit type of transaction
+ */
+ enum AbortOption {
+ AbortOnError= ///< Abort transaction on failed operation
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ ::AbortOnError
+#endif
+ ,AO_IgnoreError= ///< Transaction continues on failed operation
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ ::AO_IgnoreError
+#endif
+ };
+
+ /**
+ * Execution type of transaction
+ */
+ enum ExecType {
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ NoExecTypeDef=
+ ::NoExecTypeDef, ///< Erroneous type (Used for debugging only)
+ Prepare= ::Prepare, ///< <i>Missing explanation</i>
+#endif
+ NoCommit= ///< Execute the transaction as far as it has
+ ///< been defined, but do not yet commit it
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ ::NoCommit
+#endif
+ ,Commit= ///< Execute and try to commit the transaction
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ ::Commit
+#endif
+ ,Rollback ///< Rollback transaction
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ = ::Rollback
+#endif
+ };
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * 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);
+#endif
+
+ /**
+ * 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 aTable
+ * A table object (fetched by NdbDictionary::Dictionary::getTable)
+ * @return Pointer to an NdbOperation object if successful, otherwise NULL.
+ */
+ NdbOperation* getNdbOperation(const NdbDictionary::Table * aTable);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * Get an operation from NdbScanOperation idlelist and
+ * get the NdbTransaction object which
+ * was fetched by startTransaction pointing to this operation.
+ *
+ * @param aTableName The table name.
+ * @return pointer to an NdbOperation object if successful, otherwise NULL
+ */
+ NdbScanOperation* getNdbScanOperation(const char* aTableName);
+#endif
+
+ /**
+ * Get an operation from NdbScanOperation idlelist and
+ * get the NdbTransaction object which
+ * was fetched by startTransaction pointing to this operation.
+ *
+ * @param aTable
+ * A table object (fetched by NdbDictionary::Dictionary::getTable)
+ * @return pointer to an NdbOperation object if successful, otherwise NULL
+ */
+ NdbScanOperation* getNdbScanOperation(const NdbDictionary::Table * aTable);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * Get an operation from NdbIndexScanOperation idlelist and
+ * get the NdbTransaction object which
+ * was fetched by startTransaction pointing to this operation.
+ *
+ * @param anIndexName The index name.
+ * @param aTableName The table name.
+ * @return pointer to an NdbOperation object if successful, otherwise NULL
+ */
+ NdbIndexScanOperation* getNdbIndexScanOperation(const char* anIndexName,
+ const char* aTableName);
+ NdbIndexScanOperation* getNdbIndexScanOperation
+ (const NdbDictionary::Index *anIndex, const NdbDictionary::Table *aTable);
+#endif
+
+ /**
+ * Get an operation from NdbIndexScanOperation idlelist and
+ * get the NdbTransaction object which
+ * was fetched by startTransaction pointing to this operation.
+ *
+ * @param anIndex
+ An index object (fetched by NdbDictionary::Dictionary::getIndex).
+ * @return pointer to an NdbOperation object if successful, otherwise NULL
+ */
+ NdbIndexScanOperation* getNdbIndexScanOperation
+ (const NdbDictionary::Index *anIndex);
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ /**
+ * Get an operation from NdbIndexOperation idlelist and
+ * get the NdbTransaction object that
+ * was fetched by startTransaction pointing to this operation.
+ *
+ * @param anIndexName The index name (as created by createIndex).
+ * @param aTableName The table name.
+ * @return Pointer to an NdbIndexOperation object if
+ * successful, otherwise NULL
+ */
+ NdbIndexOperation* getNdbIndexOperation(const char* anIndexName,
+ const char* aTableName);
+ NdbIndexOperation* getNdbIndexOperation(const NdbDictionary::Index *anIndex,
+ const NdbDictionary::Table *aTable);
+#endif
+
+ /**
+ * Get an operation from NdbIndexOperation idlelist and
+ * get the NdbTransaction object that
+ * was fetched by startTransaction pointing to this operation.
+ *
+ * @param anIndex
+ * An index object (fetched by NdbDictionary::Dictionary::getIndex).
+ * @return Pointer to an NdbIndexOperation object if
+ * successful, otherwise NULL
+ */
+ NdbIndexOperation* getNdbIndexOperation(const NdbDictionary::Index *anIndex);
+
+ /**
+ * @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 );
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ int execute(::ExecType execType,
+ ::AbortOption abortOption = ::AbortOnError,
+ int force = 0 )
+ { return execute ((ExecType)execType,(AbortOption)abortOption,force); }
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ // to be documented later
+ /**
+ * 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_async1.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);
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ void executeAsynchPrepare(::ExecType execType,
+ NdbAsynchCallback callback,
+ void* anyObject,
+ ::AbortOption abortOption = ::AbortOnError)
+ { executeAsynchPrepare((ExecType)execType, callback, anyObject,
+ (AbortOption)abortOption); }
+#endif
+
+ /**
+ * Prepare and send an asynchronous transaction.
+ *
+ * This method perform the same action as
+ * NdbTransaction::executeAsynchPrepare
+ * but also sends the operations to the NDB kernel.
+ *
+ * See NdbTransaction::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);
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+ void executeAsynch(::ExecType aTypeOfExec,
+ NdbAsynchCallback aCallback,
+ void* anyObject,
+ ::AbortOption abortOption= ::AbortOnError)
+ { executeAsynch((ExecType)aTypeOfExec, aCallback, anyObject,
+ (AbortOption)abortOption); }
+#endif
+#endif
+ /**
+ * 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 Equivalent to to calling Ndb::closeTransaction()
+ */
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * @note It is not allowed to call NdbTransaction::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 NdbTransaction::close).
+ * If the transaction is not committed it will be aborted.
+ */
+#endif
+ void close();
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * Restart transaction
+ *
+ * Once a transaction has been completed successfully
+ * it can be started again wo/ calling closeTransaction/startTransaction
+ *
+ * @note This method also releases completed operations
+ *
+ * @note This method does not close open scans,
+ * c.f. NdbScanOperation::close()
+ *
+ * @note This method can only be called _directly_ after commit
+ * and only if commit is successful
+ */
+ int restart();
+#endif
+
+ /** @} *********************************************************************/
+
+ /**
+ * @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 NdbTransaction::execute call
+ * with Ndb::Commit for the GCI to be available.)
+ */
+ int getGCI();
+
+ /**
+ * Get transaction identity.
+ *
+ * @return Transaction id.
+ */
+ Uint64 getTransactionId();
+
+ /**
+ * The 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>
+ };
+
+ /**
+ * Get the commit status of the transaction.
+ *
+ * @return The commit status of the transaction
+ */
+ 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 NdbTransaction 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.
+ * - NdbTransaction::getNextCompletedOperation(NULL) returns the
+ * first NdbOperation object.
+ * - NdbTransaction::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;
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ const NdbOperation* getFirstDefinedOperation()const{return theFirstOpInList;}
+ const NdbOperation* getLastDefinedOperation()const{return theLastOpInList;}
+
+ /** @} *********************************************************************/
+
+ /**
+ * Execute the transaction in NoCommit mode if there are any not-yet
+ * executed blob part operations of given types. Otherwise do
+ * nothing. The flags argument is bitwise OR of (1 << optype) where
+ * optype comes from NdbOperation::OperationType. Only the basic PK
+ * ops are used (read, insert, update, delete).
+ */
+ int executePendingBlobOps(Uint8 flags = 0xFF);
+
+ /**
+ * Get nodeId of TC for this transaction
+ */
+ Uint32 getConnectedNodeId(); // Get Connected node id
+#endif
+
+private:
+ /**
+ * Release completed operations
+ */
+ void releaseCompletedOperations();
+
+ 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. *
+ **************************************************************************/
+
+ NdbTransaction(Ndb* aNdb);
+
+ ~NdbTransaction();
+
+ void init(); // Initialize connection object for new transaction
+
+ int executeNoBlobs(ExecType execType,
+ AbortOption abortOption = AbortOnError,
+ int force = 0 );
+
+ /**
+ * Set Connected node id
+ * and sequence no
+ */
+ void setConnectedNodeId( Uint32 nodeId, Uint32 sequence);
+
+ 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
+ NdbTransaction* next(); // Returns the next pointer
+ void next(NdbTransaction*); // Sets the next pointer
+
+ enum ConStatusType {
+ NotConnected,
+ Connecting,
+ Connected,
+ DisConnecting,
+ ConnectFailure
+ };
+ 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*, const Uint32*, Uint32 len);
+
+ 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(Uint8 abortoption, bool setFailure = true);
+ int OpCompleteSuccess();
+ 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 releaseScanOperations(NdbIndexScanOperation*);
+
+ // 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 abortOption = -1);
+
+ int checkMagicNumber(); // Verify correct object
+ NdbOperation* getNdbOperation(const class NdbTableImpl* aTable,
+ NdbOperation* aNextOp = 0);
+ NdbIndexScanOperation* getNdbScanOperation(const class NdbTableImpl* aTable);
+ NdbIndexOperation* getNdbIndexOperation(const class NdbIndexImpl* anIndex,
+ const class NdbTableImpl* aTable,
+ NdbOperation* aNextOp = 0);
+ NdbIndexScanOperation* getNdbIndexScanOperation(const NdbIndexImpl* index,
+ const NdbTableImpl* table);
+
+ void handleExecuteCompletion();
+
+ /****************************************************************************
+ * These are the private variables of this class.
+ ****************************************************************************/
+
+ Uint32 ptr2int();
+ Uint32 theId;
+
+ // Keeps track of what the send method should do.
+ enum SendStatusType {
+ NotInit,
+ InitState,
+ sendOperations,
+ sendCompleted,
+ sendCOMMITstate,
+ sendABORT,
+ sendABORTfail,
+ sendTC_ROLLBACK,
+ sendTC_COMMIT,
+ sendTC_OP
+ };
+ 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
+ NdbTransaction* 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 & last operation in completed
+ NdbOperation* theCompletedLastOp; // 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 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
+ enum CompletionStatus {
+ NotCompleted,
+ CompletedSuccess,
+ CompletedFailure,
+ DefinitionFailure
+ } 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
+
+ enum ReturnType { ReturnSuccess, ReturnFailure };
+ 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
+
+ enum ListState {
+ NotInList,
+ InPreparedList,
+ InSendList,
+ InCompletedList
+ } theListState;
+
+ Uint32 theDBnode; // The database node we are connected to
+ Uint32 theNodeSequence; // The sequence no of the db node
+ bool theReleaseOnClose;
+
+ /**
+ * handle transaction spanning
+ * multiple TC/db nodes
+ *
+ * 1) Bitmask with used nodes
+ * 2) Bitmask with nodes failed during op
+ */
+ Uint32 m_db_nodes[2];
+ Uint32 m_failed_db_nodes[2];
+
+ int report_node_failure(Uint32 id);
+
+ // Scan operations
+ bool m_waitForReply;
+ NdbIndexScanOperation* m_theFirstScanOperation;
+ NdbIndexScanOperation* m_theLastScanOperation;
+
+ NdbIndexScanOperation* m_firstExecutedScanOp;
+
+ // Scan operations
+ // The operation actually performing the scan
+ NdbScanOperation* theScanningOp;
+ Uint32 theBuddyConPtr;
+ // optim: any blobs
+ bool theBlobFlag;
+ Uint8 thePendingBlobOps;
+
+ static void sendTC_COMMIT_ACK(NdbApiSignal *,
+ Uint32 transId1, Uint32 transId2,
+ Uint32 aBlockRef);
+
+ void completedFail(const char * s);
+#ifdef VM_TRACE
+ void printState();
+#endif
+ bool checkState_TransId(const Uint32 * transId) const;
+
+ void remove_list(NdbOperation*& head, NdbOperation*);
+ void define_scan_op(NdbIndexScanOperation*);
+
+ friend class HugoOperations;
+};
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+
+inline
+Uint32
+NdbTransaction::get_send_size()
+{
+ return 0;
+}
+
+inline
+void
+NdbTransaction::set_send_size(Uint32 send_size)
+{
+ return;
+}
+
+#ifdef NDB_NO_DROPPED_SIGNAL
+#include <stdlib.h>
+#endif
+
+inline
+int
+NdbTransaction::checkMagicNumber()
+{
+ if (theMagicNumber == 0x37412619)
+ return 0;
+ else {
+#ifdef NDB_NO_DROPPED_SIGNAL
+ abort();
+#endif
+ return -1;
+ }
+}
+
+inline
+bool
+NdbTransaction::checkState_TransId(const Uint32 * transId) const {
+ const Uint32 tTmp1 = transId[0];
+ const Uint32 tTmp2 = transId[1];
+ Uint64 tRecTransId = (Uint64)tTmp1 + ((Uint64)tTmp2 << 32);
+ bool b = theStatus == Connected && theTransactionId == tRecTransId;
+ return b;
+}
+
+/************************************************************************************************
+void setTransactionId(Uint64 aTransactionId);
+
+Remark: Set the transaction identity.
+************************************************************************************************/
+inline
+void
+NdbTransaction::setTransactionId(Uint64 aTransactionId)
+{
+ theTransactionId = aTransactionId;
+}
+
+inline
+void
+NdbTransaction::setConnectedNodeId(Uint32 aNode, Uint32 aSequenceNo)
+{
+ theDBnode = aNode;
+ theNodeSequence = aSequenceNo;
+}
+/******************************************************************************
+int getConnectedNodeId();
+
+Return Value: Return theDBnode.
+Remark: Get Connected node id.
+******************************************************************************/
+inline
+Uint32
+NdbTransaction::getConnectedNodeId()
+{
+ return theDBnode;
+}
+/******************************************************************************
+void setMyBlockReference(int aBlockRef);
+
+Parameters: aBlockRef: The block refrerence.
+Remark: Set my block refrerence.
+******************************************************************************/
+inline
+void
+NdbTransaction::setMyBlockReference(int aBlockRef)
+{
+ theMyRef = aBlockRef;
+}
+/******************************************************************************
+void setTC_ConnectPtr(Uint32 aTCConPtr);
+
+Parameters: aTCConPtr: The connection pointer.
+Remark: Sets TC Connect pointer.
+******************************************************************************/
+inline
+void
+NdbTransaction::setTC_ConnectPtr(Uint32 aTCConPtr)
+{
+ theTCConPtr = aTCConPtr;
+}
+
+/******************************************************************************
+int getTC_ConnectPtr();
+
+Return Value: Return theTCConPtr.
+Remark: Gets TC Connect pointer.
+******************************************************************************/
+inline
+int
+NdbTransaction::getTC_ConnectPtr()
+{
+ return theTCConPtr;
+}
+
+inline
+void
+NdbTransaction::setBuddyConPtr(Uint32 aBuddyConPtr)
+{
+ theBuddyConPtr = aBuddyConPtr;
+}
+
+inline
+Uint32 NdbTransaction::getBuddyConPtr()
+{
+ return theBuddyConPtr;
+}
+
+/******************************************************************************
+NdbTransaction* next();
+
+inline
+void
+NdbTransaction::setBuddyConPtr(Uint32 aBuddyConPtr)
+{
+ theBuddyConPtr = aBuddyConPtr;
+}
+
+inline
+Uint32 NdbTransaction::getBuddyConPtr()
+{
+ return theBuddyConPtr;
+}
+
+Return Value: Return next pointer to NdbTransaction object.
+Remark: Get the next pointer.
+******************************************************************************/
+inline
+NdbTransaction*
+NdbTransaction::next()
+{
+ return theNext;
+}
+
+/******************************************************************************
+void next(NdbTransaction aTransaction);
+
+Parameters: aTransaction: The connection object.
+Remark: Sets the next pointer.
+******************************************************************************/
+inline
+void
+NdbTransaction::next(NdbTransaction* aTransaction)
+{
+ theNext = aTransaction;
+}
+
+/******************************************************************************
+ConStatusType Status();
+
+Return Value Return the ConStatusType.
+Parameters: aStatus: The status.
+Remark: Sets Connect status.
+******************************************************************************/
+inline
+NdbTransaction::ConStatusType
+NdbTransaction::Status()
+{
+ return theStatus;
+}
+
+/******************************************************************************
+void Status(ConStatusType aStatus);
+
+Parameters: aStatus: The status.
+Remark: Sets Connect status.
+******************************************************************************/
+inline
+void
+NdbTransaction::Status( ConStatusType aStatus )
+{
+ theStatus = aStatus;
+}
+
+
+/******************************************************************************
+ void setGCI();
+
+Remark: Set global checkpoint identity of the transaction
+******************************************************************************/
+inline
+void
+NdbTransaction::setGCI(int aGlobalCheckpointId)
+{
+ theGlobalCheckpointId = aGlobalCheckpointId;
+}
+
+/******************************************************************************
+void OpSent();
+
+Remark: An operation was sent with success that expects a response.
+******************************************************************************/
+inline
+void
+NdbTransaction::OpSent()
+{
+ theNoOfOpSent++;
+}
+
+/******************************************************************************
+void executePendingBlobOps();
+******************************************************************************/
+#include <stdlib.h>
+inline
+int
+NdbTransaction::executePendingBlobOps(Uint8 flags)
+{
+ if (thePendingBlobOps & flags) {
+ // not executeNoBlobs because there can be new ops with blobs
+ return execute(NoCommit);
+ }
+ return 0;
+}
+
+inline
+Uint32
+NdbTransaction::ptr2int(){
+ return theId;
+}
+
+typedef NdbTransaction NdbConnection;
+
+#endif // ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+
+#endif
diff --git a/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp b/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp
new file mode 100644
index 00000000000..97db76563aa
--- /dev/null
+++ b/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp
@@ -0,0 +1,100 @@
+/* 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 CLUSTER_CONNECTION_HPP
+#define CLUSTER_CONNECTION_HPP
+
+/**
+ * @class Ndb_cluster_connection
+ * @brief Represents a connection to a cluster of storage nodes.
+ *
+ * Any NDB application program should begin with the creation of a
+ * single Ndb_cluster_connection object, and should make use of one
+ * and only one Ndb_cluster_connection. The application connects to
+ * a cluster management server when this object's connect() method is called.
+ * By using the wait_until_ready() method it is possible to wait
+ * for the connection to reach one or more storage nodes.
+ */
+class Ndb_cluster_connection {
+public:
+ /**
+ * Create a connection to a cluster of storage nodes
+ *
+ * @param connectstring The connectstring for where to find the
+ * management server
+ */
+ Ndb_cluster_connection(const char * connectstring = 0);
+ ~Ndb_cluster_connection();
+
+ /**
+ * Connect to a cluster management server
+ *
+ * @param no_retries specifies the number of retries to attempt
+ * in the event of connection failure; a negative value
+ * will result in the attempt to connect being repeated
+ * indefinitely
+ *
+ * @param retry_delay_in_seconds specifies how often retries should
+ * be performed
+ *
+ * @param verbose specifies if the method should print a report of its progess
+ *
+ * @return 0 = success,
+ * 1 = recoverable error,
+ * -1 = non-recoverable error
+ */
+ int connect(int no_retries=0, int retry_delay_in_seconds=1, int verbose=0);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ int start_connect_thread(int (*connect_callback)(void)= 0);
+#endif
+
+ /**
+ * Wait until the requested connection with one or more storage nodes is successful
+ *
+ * @param timeout_for_first_alive Number of seconds to wait until
+ * first live node is detected
+ * @param timeout_after_first_alive Number of seconds to wait after
+ * first live node is detected
+ *
+ * @return = 0 all nodes live,
+ * > 0 at least one node live,
+ * < 0 error
+ */
+ int wait_until_ready(int timeout_for_first_alive,
+ int timeout_after_first_alive);
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ const char *get_connectstring(char *buf, int buf_sz) const;
+ int get_connected_port() const;
+ const char *get_connected_host() const;
+
+ void set_optimized_node_selection(int val);
+
+ unsigned no_db_nodes();
+ unsigned node_id();
+#endif
+
+private:
+ friend class Ndb;
+ friend class NdbImpl;
+ friend class Ndb_cluster_connection_impl;
+ class Ndb_cluster_connection_impl & m_impl;
+ Ndb_cluster_connection(Ndb_cluster_connection_impl&);
+};
+
+#endif
diff --git a/storage/ndb/include/ndbapi/ndb_opt_defaults.h b/storage/ndb/include/ndbapi/ndb_opt_defaults.h
new file mode 100644
index 00000000000..d03a9dcc36f
--- /dev/null
+++ b/storage/ndb/include/ndbapi/ndb_opt_defaults.h
@@ -0,0 +1,23 @@
+/* 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_OPT_DEFAULTS_H
+#define NDB_OPT_DEFAULTS_H
+
+#define OPT_NDB_SHM_SIGNUM_DEFAULT 0
+#define OPT_NDB_SHM_DEFAULT 0
+
+#endif
diff --git a/storage/ndb/include/ndbapi/ndbapi_limits.h b/storage/ndb/include/ndbapi/ndbapi_limits.h
new file mode 100644
index 00000000000..d1cb135b39d
--- /dev/null
+++ b/storage/ndb/include/ndbapi/ndbapi_limits.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 NDBAPI_LIMITS_H
+#define NDBAPI_LIMITS_H
+
+#define NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY 32
+#define NDB_MAX_ATTRIBUTES_IN_INDEX NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY
+#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_ATTRIBUTES_IN_TABLE 128
+
+#define NDB_MAX_TUPLE_SIZE_IN_WORDS 2013
+#define NDB_MAX_KEYSIZE_IN_WORDS 1023
+#define NDB_MAX_KEY_SIZE (NDB_MAX_KEYSIZE_IN_WORDS*4)
+#define NDB_MAX_TUPLE_SIZE (NDB_MAX_TUPLE_SIZE_IN_WORDS*4)
+#define NDB_MAX_ACTIVE_EVENTS 100
+
+#endif
diff --git a/storage/ndb/include/ndbapi/ndberror.h b/storage/ndb/include/ndbapi/ndberror.h
new file mode 100644
index 00000000000..2225f68f08d
--- /dev/null
+++ b/storage/ndb/include/ndbapi/ndberror.h
@@ -0,0 +1,104 @@
+/* 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 NDBERROR_H
+#define NDBERROR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+
+typedef enum
+{
+ ndberror_st_success = 0,
+ ndberror_st_temporary = 1,
+ ndberror_st_permanent = 2,
+ ndberror_st_unknown = 3
+} ndberror_status_enum;
+
+typedef enum
+{
+ ndberror_cl_none = 0,
+ ndberror_cl_application = 1,
+ ndberror_cl_no_data_found = 2,
+ ndberror_cl_constraint_violation = 3,
+ ndberror_cl_schema_error = 4,
+ ndberror_cl_user_defined = 5,
+ ndberror_cl_insufficient_space = 6,
+ ndberror_cl_temporary_resource = 7,
+ ndberror_cl_node_recovery = 8,
+ ndberror_cl_overload = 9,
+ ndberror_cl_timeout_expired = 10,
+ ndberror_cl_unknown_result = 11,
+ ndberror_cl_internal_error = 12,
+ ndberror_cl_function_not_implemented = 13,
+ ndberror_cl_unknown_error_code = 14,
+ ndberror_cl_node_shutdown = 15,
+ ndberror_cl_configuration = 16,
+ ndberror_cl_schema_object_already_exists = 17
+} ndberror_classification_enum;
+
+
+typedef struct {
+
+ /**
+ * Error status.
+ */
+ ndberror_status_enum status;
+
+ /**
+ * Error type
+ */
+ ndberror_classification_enum 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_struct;
+
+
+typedef ndberror_status_enum ndberror_status;
+typedef ndberror_classification_enum ndberror_classification;
+
+const char *ndberror_status_message(ndberror_status);
+const char *ndberror_classification_message(ndberror_classification);
+void ndberror_update(ndberror_struct *);
+int ndb_error_string(int err_no, char *str, unsigned int size);
+
+#endif /* doxygen skip internal*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/storage/ndb/include/newtonapi/dba.h b/storage/ndb/include/newtonapi/dba.h
new file mode 100644
index 00000000000..4cfc0ec8eb9
--- /dev/null
+++ b/storage/ndb/include/newtonapi/dba.h
@@ -0,0 +1,730 @@
+/* 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 <ndb_global.h>
+#include <defs/pcn_types.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/storage/ndb/include/newtonapi/defs/pcn_types.h b/storage/ndb/include/newtonapi/defs/pcn_types.h
new file mode 100644
index 00000000000..eae6c67899d
--- /dev/null
+++ b/storage/ndb/include/newtonapi/defs/pcn_types.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 PCN_TYPES_H
+#define PCN_TYPES_H
+
+#include <ndb_global.h>
+
+typedef size_t Size_t;
+
+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/storage/ndb/include/portlib/NdbCondition.h b/storage/ndb/include/portlib/NdbCondition.h
new file mode 100644
index 00000000000..3d959a0db41
--- /dev/null
+++ b/storage/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/storage/ndb/include/portlib/NdbConfig.h b/storage/ndb/include/portlib/NdbConfig.h
new file mode 100644
index 00000000000..1bca825ab8d
--- /dev/null
+++ b/storage/ndb/include/portlib/NdbConfig.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_CONFIG_H
+#define NDB_CONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const char* NdbConfig_get_path(int *len);
+void NdbConfig_SetPath(const char *path);
+char* NdbConfig_NdbCfgName(int with_ndb_home);
+char* NdbConfig_ErrorFileName(int node_id);
+char* NdbConfig_ClusterLogFileName(int node_id);
+char* NdbConfig_SignalLogFileName(int node_id);
+char* NdbConfig_TraceFileName(int node_id, int file_no);
+char* NdbConfig_NextTraceFileName(int node_id);
+char* NdbConfig_PidFileName(int node_id);
+char* NdbConfig_StdoutFileName(int node_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/storage/ndb/include/portlib/NdbDaemon.h b/storage/ndb/include/portlib/NdbDaemon.h
new file mode 100644
index 00000000000..74ea3f06419
--- /dev/null
+++ b/storage/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/storage/ndb/include/portlib/NdbEnv.h b/storage/ndb/include/portlib/NdbEnv.h
new file mode 100644
index 00000000000..1611bf3152e
--- /dev/null
+++ b/storage/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/storage/ndb/include/portlib/NdbHost.h b/storage/ndb/include/portlib/NdbHost.h
new file mode 100644
index 00000000000..90e7b781137
--- /dev/null
+++ b/storage/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/storage/ndb/include/portlib/NdbMain.h b/storage/ndb/include/portlib/NdbMain.h
new file mode 100644
index 00000000000..7cc7a877750
--- /dev/null
+++ b/storage/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/storage/ndb/include/portlib/NdbMem.h b/storage/ndb/include/portlib/NdbMem.h
new file mode 100644
index 00000000000..0f2de80200e
--- /dev/null
+++ b/storage/ndb/include/portlib/NdbMem.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 NDB_MEM_H
+#define NDB_MEM_H
+
+#include <ndb_global.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/storage/ndb/include/portlib/NdbMutex.h b/storage/ndb/include/portlib/NdbMutex.h
new file mode 100644
index 00000000000..b0b985ecef5
--- /dev/null
+++ b/storage/ndb/include/portlib/NdbMutex.h
@@ -0,0 +1,113 @@
+/* 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
+
+#include <ndb_global.h>
+
+#ifdef NDB_WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined NDB_OSE || defined NDB_SOFTOSE
+#include <ose.h>
+typedef SEMAPHORE NdbMutex;
+#elif defined NDB_WIN32
+typedef CRITICAL_SECTION NdbMutex;
+#else
+#include <pthread.h>
+typedef pthread_mutex_t NdbMutex;
+#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/storage/ndb/include/portlib/NdbSleep.h b/storage/ndb/include/portlib/NdbSleep.h
new file mode 100644
index 00000000000..3b26710154f
--- /dev/null
+++ b/storage/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/storage/ndb/include/portlib/NdbTCP.h b/storage/ndb/include/portlib/NdbTCP.h
new file mode 100644
index 00000000000..8138a2ef354
--- /dev/null
+++ b/storage/ndb/include/portlib/NdbTCP.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 NDB_TCP_H
+#define NDB_TCP_H
+
+#include <ndb_global.h>
+#include <ndb_net.h>
+
+#if defined NDB_OSE || defined NDB_SOFTOSE
+/**
+ * Include files needed
+ */
+#include "inet.h"
+
+#include <netdb.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())
+
+#elif defined NDB_WIN32
+
+/**
+ * Include files needed
+ */
+#include <winsock2.h>
+#include <ws2tcpip.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)
+
+#else
+
+/**
+ * Include files needed
+ */
+#include <netdb.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
+
+#define NDB_SOCKLEN_T SOCKET_SIZE_TYPE
+
+#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/storage/ndb/include/portlib/NdbThread.h b/storage/ndb/include/portlib/NdbThread.h
new file mode 100644
index 00000000000..e86deee4354
--- /dev/null
+++ b/storage/ndb/include/portlib/NdbThread.h
@@ -0,0 +1,102 @@
+/* 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 <ndb_global.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(void *status);
+
+/**
+ * Set thread concurrency level
+ *
+ * *
+ */
+int NdbThread_SetConcurrencyLevel(int level);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
+
+
+
+
+
+
+
diff --git a/storage/ndb/include/portlib/NdbTick.h b/storage/ndb/include/portlib/NdbTick.h
new file mode 100644
index 00000000000..9bd8eca22bd
--- /dev/null
+++ b/storage/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/storage/ndb/include/portlib/PortDefs.h b/storage/ndb/include/portlib/PortDefs.h
new file mode 100644
index 00000000000..a115c60cfe1
--- /dev/null
+++ b/storage/ndb/include/portlib/PortDefs.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 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_ALPHA
+#ifdef NDB_GCC /* only for NDB_ALPHA */
+extern int gnuShouldNotUseRPCC();
+#define RPCC() gnuShouldNotUseRPCC();
+#else
+#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/storage/ndb/include/portlib/prefetch.h b/storage/ndb/include/portlib/prefetch.h
new file mode 100644
index 00000000000..729c80bd93e
--- /dev/null
+++ b/storage/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/storage/ndb/include/transporter/TransporterCallback.hpp b/storage/ndb/include/transporter/TransporterCallback.hpp
new file mode 100644
index 00000000000..9f910f31728
--- /dev/null
+++ b/storage/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/storage/ndb/include/transporter/TransporterDefinitions.hpp b/storage/ndb/include/transporter/TransporterDefinitions.hpp
new file mode 100644
index 00000000000..18d1ec76a3c
--- /dev/null
+++ b/storage/ndb/include/transporter/TransporterDefinitions.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 TransporterDefinitions_H
+#define TransporterDefinitions_H
+
+#include <ndb_global.h>
+#include <kernel_types.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);
+
+/**
+ * TransporterConfiguration
+ *
+ * used for setting up a transporter. the union member specific is for
+ * information specific to a transporter type.
+ */
+struct TransporterConfiguration {
+ Uint32 port;
+ const char *remoteHostName;
+ const char *localHostName;
+ NodeId remoteNodeId;
+ NodeId localNodeId;
+ NodeId serverNodeId;
+ bool checksum;
+ bool signalId;
+ bool isMgmConnection; // is a mgm connection, requires transforming
+
+ union { // Transporter specific configuration information
+
+ struct {
+ Uint32 sendBufferSize; // Size of SendBuffer of priority B
+ Uint32 maxReceiveSize; // Maximum no of bytes to receive
+ } tcp;
+
+ struct {
+ Uint32 shmKey;
+ Uint32 shmSize;
+ int signum;
+ } shm;
+
+ struct {
+ Uint32 prioASignalSize;
+ Uint32 prioBSignalSize;
+ } ose;
+
+ struct {
+ Uint32 sendLimit; // Packet size
+ Uint32 bufferSize; // Buffer size
+
+ Uint32 nLocalAdapters; // 1 or 2, the number of adapters on local host
+
+ Uint32 remoteSciNodeId0; // SCInodeId for adapter 1
+ Uint32 remoteSciNodeId1; // SCInodeId for adapter 2
+ } sci;
+ };
+};
+
+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 = 28 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/storage/ndb/include/transporter/TransporterRegistry.hpp b/storage/ndb/include/transporter/TransporterRegistry.hpp
new file mode 100644
index 00000000000..363cdabe10a
--- /dev/null
+++ b/storage/ndb/include/transporter/TransporterRegistry.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 */
+
+//****************************************************************************
+//
+// 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 <SocketServer.hpp>
+#include <SocketClient.hpp>
+
+#include <NdbTCP.h>
+
+#include <mgmapi/mgmapi.h>
+
+// 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
+};
+
+static const char *performStateString[] =
+ { "is connected",
+ "is trying to connect",
+ "does nothing",
+ "is trying to disconnect" };
+
+class Transporter;
+class TCP_Transporter;
+class SCI_Transporter;
+class SHM_Transporter;
+class OSE_Transporter;
+
+class TransporterRegistry;
+class SocketAuthenticator;
+
+class TransporterService : public SocketServer::Service {
+ SocketAuthenticator * m_auth;
+ TransporterRegistry * m_transporter_registry;
+public:
+ TransporterService(SocketAuthenticator *auth= 0)
+ {
+ m_auth= auth;
+ m_transporter_registry= 0;
+ }
+ void setTransporterRegistry(TransporterRegistry *t)
+ {
+ m_transporter_registry= t;
+ }
+ SocketServer::Session * newSession(NDB_SOCKET_TYPE socket);
+};
+
+/**
+ * @class TransporterRegistry
+ * @brief ...
+ */
+class TransporterRegistry {
+ friend class OSE_Receiver;
+ friend class SHM_Transporter;
+ friend class Transporter;
+ friend class TransporterService;
+public:
+ /**
+ * Constructor
+ */
+ TransporterRegistry(void * callback = 0 ,
+ unsigned maxTransporters = MAX_NTRANSPORTERS,
+ unsigned sizeOfLongSignalMemory = 100);
+
+ /**
+ * this handle will be used in the client connect thread
+ * to fetch information on dynamic ports. The old handle
+ * (if set) is destroyed, and this is destroyed by the destructor
+ */
+ void set_mgm_handle(NdbMgmHandle h);
+ NdbMgmHandle get_mgm_handle(void) { return m_mgm_handle; };
+
+ bool init(NodeId localNodeId);
+
+ /**
+ * after a connect from client, perform connection using correct transporter
+ */
+ bool connect_server(NDB_SOCKET_TYPE sockfd);
+
+ bool connect_client(NdbMgmHandle *h);
+
+ /**
+ * Given a SocketClient, creates a NdbMgmHandle, turns it into a transporter
+ * and returns the socket.
+ */
+ NDB_SOCKET_TYPE connect_ndb_mgmd(SocketClient *sc);
+
+ /**
+ * Given a connected NdbMgmHandle, turns it into a transporter
+ * and returns the socket.
+ */
+ NDB_SOCKET_TYPE connect_ndb_mgmd(NdbMgmHandle *h);
+
+ /**
+ * 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();
+
+ bool start_service(SocketServer& server);
+ bool start_clients();
+ bool stop_clients();
+ void start_clients_thread();
+ void update_connections();
+
+ /**
+ * Start/Stop receiving
+ */
+ void startReceiving();
+ void stopReceiving();
+
+ /**
+ * Start/Stop sending
+ */
+ void startSending();
+ void stopSending();
+
+ // A transporter is always in a PerformState.
+ // PerformIO is used initially and as long as any of the events
+ // PerformConnect, ...
+ enum PerformState {
+ CONNECTED = 0,
+ CONNECTING = 1,
+ DISCONNECTED = 2,
+ DISCONNECTING = 3
+ };
+ const char *getPerformStateString(NodeId nodeId) const
+ { return performStateString[(unsigned)performStates[nodeId]]; };
+
+ /**
+ * Get and set methods for PerformState
+ */
+ void do_connect(NodeId node_id);
+ void do_disconnect(NodeId node_id);
+ bool is_connected(NodeId node_id) { return performStates[node_id] == CONNECTED; };
+ void report_connect(NodeId node_id);
+ void report_disconnect(NodeId node_id, int errnum);
+
+ /**
+ * 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 createTCPTransporter(struct TransporterConfiguration * config);
+ bool createSCITransporter(struct TransporterConfiguration * config);
+ bool createSHMTransporter(struct TransporterConfiguration * config);
+ bool createOSETransporter(struct 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();
+
+ /**
+ * 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
+
+ class Transporter_interface {
+ public:
+ NodeId m_remote_nodeId;
+ int m_s_service_port; // signed port number
+ const char *m_interface;
+ };
+ Vector<Transporter_interface> m_transporter_interface;
+ void add_transporter_interface(NodeId remoteNodeId, const char *interf,
+ int s_port); // signed port. <0 is dynamic
+ Transporter* get_transporter(NodeId nodeId);
+ NodeId get_localNodeId() { return localNodeId; };
+
+protected:
+
+private:
+ void * callbackObj;
+
+ NdbMgmHandle m_mgm_handle;
+
+ struct NdbThread *m_start_clients_thread;
+ bool m_run_start_clients_thread;
+
+ int sendCounter;
+ NodeId localNodeId;
+ bool nodeIdSpecified;
+ unsigned maxTransporters;
+ int nTransporters;
+ int nTCPTransporters;
+ int nSCITransporters;
+ int nSHMTransporters;
+ int nOSETransporters;
+
+ /**
+ * 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);
+
+ int m_shm_own_pid;
+};
+
+#endif // Define of TransporterRegistry_H
diff --git a/storage/ndb/include/util/Base64.hpp b/storage/ndb/include/util/Base64.hpp
new file mode 100644
index 00000000000..f4b11ad9214
--- /dev/null
+++ b/storage/ndb/include/util/Base64.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 __BASE64_HPP_INCLUDED__
+#define __BASE64_HPP_INCLUDED__
+
+#include <UtilBuffer.hpp>
+#include <BaseString.hpp>
+
+int base64_encode(const UtilBuffer &src, BaseString &dst);
+int base64_encode(const void * s, size_t src_len, BaseString &dst);
+int base64_decode(const BaseString &src, UtilBuffer &dst);
+int base64_decode(const char * s, size_t len, UtilBuffer &dst);
+
+#endif /* !__BASE64_HPP_INCLUDED__ */
diff --git a/storage/ndb/include/util/BaseString.hpp b/storage/ndb/include/util/BaseString.hpp
new file mode 100644
index 00000000000..02a6a3b3e66
--- /dev/null
+++ b/storage/ndb/include/util/BaseString.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 __UTIL_BASESTRING_HPP_INCLUDED__
+#define __UTIL_BASESTRING_HPP_INCLUDED__
+
+#include <ndb_global.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 */
+ BaseString& ndb_toupper();
+
+ /** @brief Convert to lowercase */
+ BaseString& 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);
+
+ /**
+ * snprintf on some platforms need special treatment
+ */
+ static int snprintf(char *str, size_t size, const char *format, ...);
+ static int vsnprintf(char *str, size_t size, const char *format, va_list ap);
+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 BaseString&
+BaseString::ndb_toupper() {
+ for(unsigned i = 0; i < length(); i++)
+ m_chr[i] = toupper(m_chr[i]);
+ return *this;
+}
+
+inline BaseString&
+BaseString::ndb_tolower() {
+ for(unsigned i = 0; i < length(); i++)
+ m_chr[i] = tolower(m_chr[i]);
+ return *this;
+}
+
+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/storage/ndb/include/util/Bitmask.hpp b/storage/ndb/include/util/Bitmask.hpp
new file mode 100644
index 00000000000..ade57a5ee57
--- /dev/null
+++ b/storage/ndb/include/util/Bitmask.hpp
@@ -0,0 +1,854 @@
+/* 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_global.h>
+
+/**
+ * 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[]);
+
+ /**
+ * bitXORC - Bitwise (x ^ ~y) into first operand.
+ */
+ static void bitXORC(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);
+
+
+ /**
+ * getField - Get bitfield at given position and length
+ */
+ static void getField(unsigned size, const Uint32 data[],
+ unsigned pos, unsigned len, Uint32 dst[]);
+
+ /**
+ * setField - Set bitfield at given position and length
+ */
+ static void setField(unsigned size, Uint32 data[],
+ unsigned pos, unsigned len, const Uint32 src[]);
+
+ /**
+ * getText - Return as hex-digits (only for debug routines).
+ */
+ static char* getText(unsigned size, const Uint32 data[], char* buf);
+private:
+ static void getFieldImpl(const Uint32 data[], unsigned, unsigned, Uint32 []);
+ static void setFieldImpl(Uint32 data[], unsigned, unsigned, const Uint32 []);
+};
+
+inline bool
+BitmaskImpl::get(unsigned size, const Uint32 data[], unsigned n)
+{
+ assert(n < (size << 5));
+ 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)
+{
+ assert(n < (size << 5));
+ 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)
+{
+ assert(n < (size << 5));
+ 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 void
+BitmaskImpl::bitXORC(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 char *
+BitmaskImpl::getText(unsigned size, const Uint32 data[], char* buf)
+{
+ char * org = buf;
+ const char* const hex = "0123456789abcdef";
+ for (int i = (size-1); i >= 0; i--) {
+ Uint32 x = data[i];
+ for (unsigned j = 0; j < 8; j++) {
+ buf[7-j] = hex[x & 0xf];
+ x >>= 4;
+ }
+ buf += 8;
+ }
+ *buf = 0;
+ return org;
+}
+
+/**
+ * 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>
+struct BitmaskPOD {
+public:
+ /**
+ * POD data representation
+ */
+ struct Data {
+ Uint32 data[size];
+#if 0
+ Data & operator=(const BitmaskPOD<size> & src) {
+ src.copyto(size, data);
+ return *this;
+ }
+#endif
+ };
+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 typename BitmaskPOD<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[]);
+ static void assign(Uint32 dst[], const BitmaskPOD<size> & src);
+ void assign(const BitmaskPOD<size> & src);
+
+ /**
+ * copy this to <em>dst</em>
+ */
+ void copyto(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 BitmaskPOD<size>& mask2) const;
+
+ /**
+ * bitOR - Bitwise (x | y) into first operand.
+ */
+ static void bitOR(Uint32 data[], const Uint32 data2[]);
+ BitmaskPOD<size>& bitOR(const BitmaskPOD<size>& mask2);
+
+ /**
+ * bitAND - Bitwise (x & y) into first operand.
+ */
+ static void bitAND(Uint32 data[], const Uint32 data2[]);
+ BitmaskPOD<size>& bitAND(const BitmaskPOD<size>& mask2);
+
+ /**
+ * bitANDC - Bitwise (x & ~y) into first operand.
+ */
+ static void bitANDC(Uint32 data[], const Uint32 data2[]);
+ BitmaskPOD<size>& bitANDC(const BitmaskPOD<size>& mask2);
+
+ /**
+ * bitXOR - Bitwise (x ^ y) into first operand.
+ */
+ static void bitXOR(Uint32 data[], const Uint32 data2[]);
+ BitmaskPOD<size>& bitXOR(const BitmaskPOD<size>& mask2);
+
+ /**
+ * bitXORC - Bitwise (x ^ ~y) into first operand.
+ */
+ static void bitXORC(Uint32 data[], const Uint32 data2[]);
+ BitmaskPOD<size>& bitXORC(const BitmaskPOD<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(BitmaskPOD<size> that);
+
+ /**
+ * overlaps - Check if any bit set in this BitmaskPOD (data) is also set in that (data2)
+ */
+ static bool overlaps(Uint32 data[], const Uint32 data2[]);
+ bool overlaps(BitmaskPOD<size> that);
+
+ /**
+ * getText - Return as hex-digits (only for debug routines).
+ */
+ static char* getText(const Uint32 data[], char* buf);
+ char* getText(char* buf) const;
+};
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::assign(Uint32 dst[], const Uint32 src[])
+{
+ BitmaskImpl::assign(size, dst, src);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::assign(Uint32 dst[], const BitmaskPOD<size> & src)
+{
+ BitmaskImpl::assign(size, dst, src.rep.data);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::assign(const typename BitmaskPOD<size>::Data & src)
+{
+ BitmaskPOD<size>::assign(rep.data, src.data);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::assign(const BitmaskPOD<size> & src)
+{
+ BitmaskPOD<size>::assign(rep.data, src.rep.data);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::copyto(unsigned sz, Uint32 dst[]) const
+{
+ BitmaskImpl::assign(sz, dst, rep.data);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::assign(unsigned sz, const Uint32 src[])
+{
+ BitmaskImpl::assign(sz, rep.data, src);
+}
+
+template <unsigned size>
+inline bool
+BitmaskPOD<size>::get(const Uint32 data[], unsigned n)
+{
+ return BitmaskImpl::get(size, data, n);
+}
+
+template <unsigned size>
+inline bool
+BitmaskPOD<size>::get(unsigned n) const
+{
+ return BitmaskPOD<size>::get(rep.data, n);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::set(Uint32 data[], unsigned n, bool value)
+{
+ BitmaskImpl::set(size, data, n, value);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::set(unsigned n, bool value)
+{
+ BitmaskPOD<size>::set(rep.data, n, value);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::set(Uint32 data[], unsigned n)
+{
+ BitmaskImpl::set(size, data, n);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::set(unsigned n)
+{
+ BitmaskPOD<size>::set(rep.data, n);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::set(Uint32 data[])
+{
+ BitmaskImpl::set(size, data);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::set()
+{
+ BitmaskPOD<size>::set(rep.data);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::clear(Uint32 data[], unsigned n)
+{
+ BitmaskImpl::clear(size, data, n);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::clear(unsigned n)
+{
+ BitmaskPOD<size>::clear(rep.data, n);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::clear(Uint32 data[])
+{
+ BitmaskImpl::clear(size, data);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::clear()
+{
+ BitmaskPOD<size>::clear(rep.data);
+}
+
+template <unsigned size>
+inline bool
+BitmaskPOD<size>::isclear(const Uint32 data[])
+{
+ return BitmaskImpl::isclear(size, data);
+}
+
+template <unsigned size>
+inline bool
+BitmaskPOD<size>::isclear() const
+{
+ return BitmaskPOD<size>::isclear(rep.data);
+}
+
+template <unsigned size>
+unsigned
+BitmaskPOD<size>::count(const Uint32 data[])
+{
+ return BitmaskImpl::count(size, data);
+}
+
+template <unsigned size>
+inline unsigned
+BitmaskPOD<size>::count() const
+{
+ return BitmaskPOD<size>::count(rep.data);
+}
+
+template <unsigned size>
+unsigned
+BitmaskPOD<size>::find(const Uint32 data[], unsigned n)
+{
+ return BitmaskImpl::find(size, data, n);
+}
+
+template <unsigned size>
+inline unsigned
+BitmaskPOD<size>::find(unsigned n) const
+{
+ return BitmaskPOD<size>::find(rep.data, n);
+}
+
+template <unsigned size>
+inline bool
+BitmaskPOD<size>::equal(const Uint32 data[], const Uint32 data2[])
+{
+ return BitmaskImpl::equal(size, data, data2);
+}
+
+template <unsigned size>
+inline bool
+BitmaskPOD<size>::equal(const BitmaskPOD<size>& mask2) const
+{
+ return BitmaskPOD<size>::equal(rep.data, mask2.rep.data);
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::bitOR(Uint32 data[], const Uint32 data2[])
+{
+ BitmaskImpl::bitOR(size,data, data2);
+}
+
+template <unsigned size>
+inline BitmaskPOD<size>&
+BitmaskPOD<size>::bitOR(const BitmaskPOD<size>& mask2)
+{
+ BitmaskPOD<size>::bitOR(rep.data, mask2.rep.data);
+ return *this;
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::bitAND(Uint32 data[], const Uint32 data2[])
+{
+ BitmaskImpl::bitAND(size,data, data2);
+}
+
+template <unsigned size>
+inline BitmaskPOD<size>&
+BitmaskPOD<size>::bitAND(const BitmaskPOD<size>& mask2)
+{
+ BitmaskPOD<size>::bitAND(rep.data, mask2.rep.data);
+ return *this;
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::bitANDC(Uint32 data[], const Uint32 data2[])
+{
+ BitmaskImpl::bitANDC(size,data, data2);
+}
+
+template <unsigned size>
+inline BitmaskPOD<size>&
+BitmaskPOD<size>::bitANDC(const BitmaskPOD<size>& mask2)
+{
+ BitmaskPOD<size>::bitANDC(rep.data, mask2.rep.data);
+ return *this;
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::bitXOR(Uint32 data[], const Uint32 data2[])
+{
+ BitmaskImpl::bitXOR(size,data, data2);
+}
+
+template <unsigned size>
+inline BitmaskPOD<size>&
+BitmaskPOD<size>::bitXOR(const BitmaskPOD<size>& mask2)
+{
+ BitmaskPOD<size>::bitXOR(rep.data, mask2.rep.data);
+ return *this;
+}
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::bitXORC(Uint32 data[], const Uint32 data2[])
+{
+ BitmaskImpl::bitXORC(size,data, data2);
+}
+
+template <unsigned size>
+inline BitmaskPOD<size>&
+BitmaskPOD<size>::bitXORC(const BitmaskPOD<size>& mask2)
+{
+ BitmaskPOD<size>::bitXORC(rep.data, mask2.rep.data);
+ return *this;
+}
+
+template <unsigned size>
+char *
+BitmaskPOD<size>::getText(const Uint32 data[], char* buf)
+{
+ return BitmaskImpl::getText(size, data, buf);
+}
+
+template <unsigned size>
+inline char *
+BitmaskPOD<size>::getText(char* buf) const
+{
+ return BitmaskPOD<size>::getText(rep.data, buf);
+}
+
+template <unsigned size>
+inline bool
+BitmaskPOD<size>::contains(Uint32 data[], const Uint32 data2[])
+{
+ return BitmaskImpl::contains(size, data, data2);
+}
+
+template <unsigned size>
+inline bool
+BitmaskPOD<size>::contains(BitmaskPOD<size> that)
+{
+ return BitmaskPOD<size>::contains(this->rep.data, that.rep.data);
+}
+
+template <unsigned size>
+inline bool
+BitmaskPOD<size>::overlaps(Uint32 data[], const Uint32 data2[])
+{
+ return BitmaskImpl::overlaps(size, data, data2);
+}
+
+template <unsigned size>
+inline bool
+BitmaskPOD<size>::overlaps(BitmaskPOD<size> that)
+{
+ return BitmaskPOD<size>::overlaps(this->rep.data, that.rep.data);
+}
+
+template <unsigned size>
+class Bitmask : public BitmaskPOD<size> {
+public:
+ Bitmask() { this->clear();}
+};
+
+inline void
+BitmaskImpl::getField(unsigned size, const Uint32 src[],
+ unsigned pos, unsigned len, Uint32 dst[])
+{
+ assert(pos + len < (size << 5));
+
+ src += (pos >> 5);
+ Uint32 offset = pos & 31;
+ * dst = (* src >> offset) & (len >= 32 ? ~0 : (1 << len) - 1);
+
+ if(offset + len <= 32)
+ {
+ return;
+ }
+ Uint32 used = (32 - offset);
+ assert(len > used);
+ getFieldImpl(src+1, used & 31, len-used, dst+(used >> 5));
+}
+
+inline void
+BitmaskImpl::setField(unsigned size, Uint32 dst[],
+ unsigned pos, unsigned len, const Uint32 src[])
+{
+ assert(pos + len < (size << 5));
+
+ dst += (pos >> 5);
+ Uint32 offset = pos & 31;
+ Uint32 mask = (len >= 32 ? ~0 : (1 << len) - 1) << offset;
+
+ * dst = (* dst & ~mask) | ((*src << offset) & mask);
+
+ if(offset + len <= 32)
+ {
+ return;
+ }
+ Uint32 used = (32 - offset);
+ assert(len > used);
+ setFieldImpl(dst+1, used & 31, len-used, src+(used >> 5));
+}
+
+
+#endif
diff --git a/storage/ndb/include/util/ConfigValues.hpp b/storage/ndb/include/util/ConfigValues.hpp
new file mode 100644
index 00000000000..457488e3c42
--- /dev/null
+++ b/storage/ndb/include/util/ConfigValues.hpp
@@ -0,0 +1,254 @@
+#ifndef __CONFIG_VALUES_HPP
+#define __CONFIG_VALUES_HPP
+
+#include <ndb_types.h>
+#include <UtilBuffer.hpp>
+
+class ConfigValues {
+ friend class ConfigValuesFactory;
+ ConfigValues(Uint32 sz, Uint32 data);
+
+public:
+ ~ConfigValues();
+
+ enum ValueType {
+ InvalidType = 0,
+ IntType = 1,
+ StringType = 2,
+ SectionType = 3,
+ Int64Type = 4
+ };
+
+ struct Entry {
+ Uint32 m_key;
+ ValueType m_type;
+ union {
+ Uint32 m_int;
+ Uint64 m_int64;
+ const char * m_string;
+ };
+ };
+
+ class ConstIterator {
+ friend class ConfigValuesFactory;
+ const ConfigValues & m_cfg;
+ public:
+ Uint32 m_currentSection;
+ ConstIterator(const ConfigValues&c) : m_cfg(c) { m_currentSection = 0;}
+
+ bool openSection(Uint32 key, Uint32 no);
+ bool closeSection();
+
+ bool get(Uint32 key, Entry *) const;
+
+ bool get(Uint32 key, Uint32 * value) const;
+ bool get(Uint32 key, Uint64 * value) const;
+ bool get(Uint32 key, const char ** value) const;
+ bool getTypeOf(Uint32 key, ValueType * type) const;
+
+ Uint32 get(Uint32 key, Uint32 notFound) const;
+ Uint64 get64(Uint32 key, Uint64 notFound) const;
+ const char * get(Uint32 key, const char * notFound) const;
+ ValueType getTypeOf(Uint32 key) const;
+ };
+
+ class Iterator : public ConstIterator {
+ ConfigValues & m_cfg;
+ public:
+ Iterator(ConfigValues&c) : ConstIterator(c), m_cfg(c) {}
+ Iterator(ConfigValues&c, const ConstIterator& i):ConstIterator(c),m_cfg(c){
+ m_currentSection = i.m_currentSection;
+ }
+
+ bool set(Uint32 key, Uint32 value);
+ bool set(Uint32 key, Uint64 value);
+ bool set(Uint32 key, const char * value);
+ };
+
+ Uint32 getPackedSize() const; // get size in bytes needed to pack
+ Uint32 pack(UtilBuffer&) const;
+ Uint32 pack(void * dst, Uint32 len) const;// pack into dst(of len %d);
+
+private:
+ friend class Iterator;
+ friend class ConstIterator;
+
+ bool getByPos(Uint32 pos, Entry *) const;
+ Uint64 * get64(Uint32 index) const;
+ char ** getString(Uint32 index) const;
+
+ Uint32 m_size;
+ Uint32 m_dataSize;
+ Uint32 m_stringCount;
+ Uint32 m_int64Count;
+
+ Uint32 m_values[1];
+ void * m_data[1];
+};
+
+class ConfigValuesFactory {
+ Uint32 m_currentSection;
+public:
+ Uint32 m_sectionCounter;
+ Uint32 m_freeKeys;
+ Uint32 m_freeData;
+
+public:
+ ConfigValuesFactory(Uint32 keys = 50, Uint32 data = 10); // Initial
+ ConfigValuesFactory(ConfigValues * m_cfg); //
+
+ ConfigValues * m_cfg;
+ ConfigValues * getConfigValues();
+
+ bool openSection(Uint32 key, Uint32 no);
+ bool put(const ConfigValues::Entry & );
+ bool put(Uint32 key, Uint32 value);
+ bool put64(Uint32 key, Uint64 value);
+ bool put(Uint32 key, const char * value);
+ bool closeSection();
+
+ void expand(Uint32 freeKeys, Uint32 freeData);
+ void shrink();
+
+ bool unpack(const UtilBuffer&);
+ bool unpack(const void * src, Uint32 len);
+
+ static ConfigValues * extractCurrentSection(const ConfigValues::ConstIterator &);
+
+private:
+ static ConfigValues * create(Uint32 keys, Uint32 data);
+ void put(const ConfigValues & src);
+};
+
+inline
+bool
+ConfigValues::ConstIterator::get(Uint32 key, Uint32 * value) const {
+ Entry tmp;
+ if(get(key, &tmp) && tmp.m_type == IntType){
+ * value = tmp.m_int;
+ return true;
+ }
+ return false;
+}
+
+inline
+bool
+ConfigValues::ConstIterator::get(Uint32 key, Uint64 * value) const {
+ Entry tmp;
+ if(get(key, &tmp) && tmp.m_type == Int64Type){
+ * value = tmp.m_int64;
+ return true;
+ }
+ return false;
+}
+
+inline
+bool
+ConfigValues::ConstIterator::get(Uint32 key, const char ** value) const {
+ Entry tmp;
+ if(get(key, &tmp) && tmp.m_type == StringType){
+ * value = tmp.m_string;
+ return true;
+ }
+ return false;
+}
+
+inline
+bool
+ConfigValues::ConstIterator::getTypeOf(Uint32 key, ValueType * type) const{
+ Entry tmp;
+ if(get(key, &tmp)){
+ * type = tmp.m_type;
+ return true;
+ }
+ return false;
+}
+
+inline
+Uint32
+ConfigValues::ConstIterator::get(Uint32 key, Uint32 notFound) const {
+ Entry tmp;
+ if(get(key, &tmp) && tmp.m_type == IntType){
+ return tmp.m_int;
+ }
+ return notFound;
+}
+
+inline
+Uint64
+ConfigValues::ConstIterator::get64(Uint32 key, Uint64 notFound) const {
+ Entry tmp;
+ if(get(key, &tmp) && tmp.m_type == Int64Type){
+ return tmp.m_int64;
+ }
+ return notFound;
+}
+
+inline
+const char *
+ConfigValues::ConstIterator::get(Uint32 key, const char * notFound) const {
+ Entry tmp;
+ if(get(key, &tmp) && tmp.m_type == StringType){
+ return tmp.m_string;
+ }
+ return notFound;
+}
+
+inline
+ConfigValues::ValueType
+ConfigValues::ConstIterator::getTypeOf(Uint32 key) const{
+ Entry tmp;
+ if(get(key, &tmp)){
+ return tmp.m_type;
+ }
+ return ConfigValues::InvalidType;
+}
+
+inline
+bool
+ConfigValuesFactory::put(Uint32 key, Uint32 val){
+ ConfigValues::Entry tmp;
+ tmp.m_key = key;
+ tmp.m_type = ConfigValues::IntType;
+ tmp.m_int = val;
+ return put(tmp);
+}
+
+inline
+bool
+ConfigValuesFactory::put64(Uint32 key, Uint64 val){
+ ConfigValues::Entry tmp;
+ tmp.m_key = key;
+ tmp.m_type = ConfigValues::Int64Type;
+ tmp.m_int64 = val;
+ return put(tmp);
+}
+
+inline
+bool
+ConfigValuesFactory::put(Uint32 key, const char * val){
+ ConfigValues::Entry tmp;
+ tmp.m_key = key;
+ tmp.m_type = ConfigValues::StringType;
+ tmp.m_string = val;
+ return put(tmp);
+}
+
+inline
+Uint32
+ConfigValues::pack(UtilBuffer& buf) const {
+ Uint32 len = getPackedSize();
+ void * tmp = buf.append(len);
+ if(tmp == 0){
+ return 0;
+ }
+ return pack(tmp, len);
+}
+
+inline
+bool
+ConfigValuesFactory::unpack(const UtilBuffer& buf){
+ return unpack(buf.get_data(), buf.length());
+}
+
+#endif
diff --git a/storage/ndb/include/util/File.hpp b/storage/ndb/include/util/File.hpp
new file mode 100644
index 00000000000..3ed0ad7a6f9
--- /dev/null
+++ b/storage/ndb/include/util/File.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 */
+
+#ifndef FILE_H
+#define FILE_H
+
+#include <ndb_global.h>
+
+/**
+ * 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_class
+{
+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_class();
+
+ /**
+ * 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_class(const char* aFileName, const char* mode = "r");
+
+ /**
+ * Destructor.
+ */
+ ~File_class();
+
+ /**
+ * 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_class (const File_class& aCopy);
+ File_class operator = (const File_class&);
+ bool operator == (const File_class&);
+};
+#endif
+
diff --git a/storage/ndb/include/util/InputStream.hpp b/storage/ndb/include/util/InputStream.hpp
new file mode 100644
index 00000000000..b2a56b1e433
--- /dev/null
+++ b/storage/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 <ndb_global.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/storage/ndb/include/util/NdbAutoPtr.hpp b/storage/ndb/include/util/NdbAutoPtr.hpp
new file mode 100644
index 00000000000..ff747e3de68
--- /dev/null
+++ b/storage/ndb/include/util/NdbAutoPtr.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 __NDB_AUTO_PTR_HPP
+#define __NDB_AUTO_PTR_HPP
+
+#include <ndb_global.h>
+#include <my_sys.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;}
+};
+
+template<typename T>
+class My_auto_ptr {
+ T * m_obj;
+public:
+ My_auto_ptr(T * obj = 0){ m_obj = obj;}
+ void reset(T * obj = 0) { if (m_obj) my_free(m_obj,MYF(0)); m_obj = obj; }
+ ~My_auto_ptr() { if (m_obj) my_free(m_obj,MYF(0));}
+};
+
+#endif
diff --git a/storage/ndb/include/util/NdbOut.hpp b/storage/ndb/include/util/NdbOut.hpp
new file mode 100644
index 00000000000..d85d5cc6305
--- /dev/null
+++ b/storage/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/storage/ndb/include/util/NdbSqlUtil.hpp b/storage/ndb/include/util/NdbSqlUtil.hpp
new file mode 100644
index 00000000000..3e98dcd1805
--- /dev/null
+++ b/storage/ndb/include/util/NdbSqlUtil.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 NDB_SQL_UTIL_HPP
+#define NDB_SQL_UTIL_HPP
+
+#include <ndb_global.h>
+#include <kernel/ndb_limits.h>
+
+struct charset_info_st;
+typedef struct charset_info_st CHARSET_INFO;
+
+class NdbSqlUtil {
+public:
+ /**
+ * Compare attribute values. Returns -1, 0, +1 for less, equal,
+ * greater, respectively. Parameters are pointers to values and their
+ * lengths in bytes. The lengths can differ.
+ *
+ * First value is a full value but second value can be partial. If
+ * the partial value is not enough to determine the result, CmpUnknown
+ * will be returned. A shorter second value is not necessarily
+ * partial. Partial values are allowed only for types where prefix
+ * comparison is possible (basically, binary strings).
+ *
+ * First parameter is a pointer to type specific extra info. Char
+ * types receive CHARSET_INFO in it.
+ *
+ * If a value cannot be parsed, it compares like NULL i.e. less than
+ * any valid value.
+ */
+ typedef int Cmp(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full);
+
+ /**
+ * Prototype for "like" comparison. Defined for string types. Second
+ * argument must have same type-specific format. Returns 0 on match,
+ * +1 on no match, and -1 on bad data.
+ *
+ * Uses default special chars ( \ % _ ).
+ *
+ * TODO convert special chars to the cs so that ucs2 etc works
+ * TODO allow user-defined escape ( \ )
+ */
+ typedef int Like(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2);
+
+ enum CmpResult {
+ CmpLess = -1,
+ CmpEqual = 0,
+ CmpGreater = 1,
+ CmpUnknown = 2 // insufficient partial data
+ };
+
+ struct Type {
+ enum Enum {
+ Undefined = NDB_TYPE_UNDEFINED,
+ Tinyint = NDB_TYPE_TINYINT,
+ Tinyunsigned = NDB_TYPE_TINYUNSIGNED,
+ Smallint = NDB_TYPE_SMALLINT,
+ Smallunsigned = NDB_TYPE_SMALLUNSIGNED,
+ Mediumint = NDB_TYPE_MEDIUMINT,
+ Mediumunsigned = NDB_TYPE_MEDIUMUNSIGNED,
+ Int = NDB_TYPE_INT,
+ Unsigned = NDB_TYPE_UNSIGNED,
+ Bigint = NDB_TYPE_BIGINT,
+ Bigunsigned = NDB_TYPE_BIGUNSIGNED,
+ Float = NDB_TYPE_FLOAT,
+ Double = NDB_TYPE_DOUBLE,
+ Olddecimal = NDB_TYPE_OLDDECIMAL,
+ Char = NDB_TYPE_CHAR,
+ Varchar = NDB_TYPE_VARCHAR,
+ Binary = NDB_TYPE_BINARY,
+ Varbinary = NDB_TYPE_VARBINARY,
+ Datetime = NDB_TYPE_DATETIME,
+ Date = NDB_TYPE_DATE,
+ Blob = NDB_TYPE_BLOB,
+ Text = NDB_TYPE_TEXT,
+ Bit = NDB_TYPE_BIT,
+ Longvarchar = NDB_TYPE_LONGVARCHAR,
+ Longvarbinary = NDB_TYPE_LONGVARBINARY,
+ Time = NDB_TYPE_TIME,
+ Year = NDB_TYPE_YEAR,
+ Timestamp = NDB_TYPE_TIMESTAMP,
+ Olddecimalunsigned = NDB_TYPE_OLDDECIMALUNSIGNED,
+ Decimal = NDB_TYPE_DECIMAL,
+ Decimalunsigned = NDB_TYPE_DECIMALUNSIGNED
+ };
+ Enum m_typeId; // redundant
+ Cmp* m_cmp; // comparison method
+ Like* m_like; // "like" comparison method
+ };
+
+ /**
+ * Get type by id. Can return the Undefined type.
+ */
+ static const Type& getType(Uint32 typeId);
+
+ /**
+ * Get the normalized type used in hashing and key comparisons.
+ * Maps all string types to Binary. This includes Var* strings
+ * because strxfrm result is padded to fixed (maximum) length.
+ */
+ static const Type& getTypeBinary(Uint32 typeId);
+
+ /**
+ * Check character set.
+ */
+ static bool usable_in_pk(Uint32 typeId, const void* info);
+ static bool usable_in_hash_index(Uint32 typeId, const void* info);
+ static bool usable_in_ordered_index(Uint32 typeId, const void* info);
+
+ /**
+ * Get number of length bytes and length from variable length string.
+ * Returns false on error (invalid data). For other types returns
+ * zero length bytes and the fixed attribute length.
+ */
+ static bool get_var_length(Uint32 typeId, const void* p, unsigned attrlen, Uint32& lb, Uint32& len);
+
+ /**
+ * Temporary workaround for bug#7284.
+ */
+ static int strnxfrm_bug7284(CHARSET_INFO* cs, unsigned char* dst, unsigned dstLen, const unsigned char*src, unsigned srcLen);
+
+ /**
+ * Compare decimal numbers.
+ */
+ static int cmp_olddecimal(const uchar* s1, const uchar* s2, unsigned n);
+
+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 cmpOlddecimal;
+ static Cmp cmpChar;
+ static Cmp cmpVarchar;
+ static Cmp cmpBinary;
+ static Cmp cmpVarbinary;
+ static Cmp cmpDatetime;
+ static Cmp cmpDate;
+ static Cmp cmpBlob;
+ static Cmp cmpText;
+ static Cmp cmpBit;
+ static Cmp cmpLongvarchar;
+ static Cmp cmpLongvarbinary;
+ static Cmp cmpTime;
+ static Cmp cmpYear;
+ static Cmp cmpTimestamp;
+ static Cmp cmpOlddecimalunsigned;
+ static Cmp cmpDecimal;
+ static Cmp cmpDecimalunsigned;
+ //
+ static Like likeChar;
+ static Like likeBinary;
+ static Like likeVarchar;
+ static Like likeVarbinary;
+ static Like likeLongvarchar;
+ static Like likeLongvarbinary;
+};
+
+#endif
diff --git a/storage/ndb/include/util/OutputStream.hpp b/storage/ndb/include/util/OutputStream.hpp
new file mode 100644
index 00000000000..c7e009d4537
--- /dev/null
+++ b/storage/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 <ndb_global.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/storage/ndb/include/util/Parser.hpp b/storage/ndb/include/util/Parser.hpp
new file mode 100644
index 00000000000..c117498e1ba
--- /dev/null
+++ b/storage/ndb/include/util/Parser.hpp
@@ -0,0 +1,291 @@
+/* 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> struct 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 {
+public:
+ class Dummy {};
+ typedef ParserRow<Dummy> DummyRow;
+ typedef Parser<Dummy>::Context Context;
+
+
+ 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(){
+ delete impl;
+}
+
+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/storage/ndb/include/util/Properties.hpp b/storage/ndb/include/util/Properties.hpp
new file mode 100644
index 00000000000..e6668744211
--- /dev/null
+++ b/storage/ndb/include/util/Properties.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 PROPERTIES_HPP
+#define PROPERTIES_HPP
+
+#include <ndb_global.h>
+#include <BaseString.hpp>
+#include <UtilBuffer.hpp>
+
+enum PropertiesType {
+ PropertiesType_Uint32 = 0,
+ PropertiesType_char = 1,
+ PropertiesType_Properties = 2,
+ PropertiesType_Uint64 = 3
+};
+
+/**
+ * @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, Uint64 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(bool case_insensitive= false);
+ 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 put64(const char * name, Uint64 value, bool replace = false);
+ bool put(const char * name, const char * value, bool replace = false);
+ bool put(const char * name, const Properties * value, bool replace = false);
+
+ /**
+ * 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 put64(const char *, Uint32 no, Uint64, bool replace = false);
+ bool put(const char *, Uint32 no, const char *, bool replace = false);
+ bool put(const char *, Uint32 no, const Properties *, bool replace = false);
+
+
+ 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, Uint64 * value) const;
+ bool get(const char * name, const char ** value) const;
+ bool get(const char * name, BaseString & value) const;
+ bool get(const char * name, const Properties ** value) const;
+
+ 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, Uint64 * value) const;
+ bool get(const char * name, Uint32 no, const char ** value) const;
+ bool get(const char * name, Uint32 no, const Properties ** value) const;
+
+ 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();
+ void *tmp_buf = buf.append(size);
+ if(tmp_buf == 0)
+ return false;
+ bool ret = pack((Uint32 *)tmp_buf);
+ if(ret == false)
+ return false;
+ return true;
+}
+
+
+
+#endif
diff --git a/storage/ndb/include/util/SimpleProperties.hpp b/storage/ndb/include/util/SimpleProperties.hpp
new file mode 100644
index 00000000000..356f3406f38
--- /dev/null
+++ b/storage/ndb/include/util/SimpleProperties.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 SIMPLE_PROPERTIES_HPP
+#define SIMPLE_PROPERTIES_HPP
+
+#include <ndb_global.h>
+#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;
+ 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(struct 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;
+ struct SectionSegment * m_head;
+ struct 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(struct SegmentedSectionPtr & dst);
+
+private:
+ Int32 m_pos;
+ Uint32 m_sz;
+ class SectionSegmentPool & m_pool;
+ struct SectionSegment * m_head;
+ Uint32 m_prevPtrI; // Prev to m_currentSegment
+ struct SectionSegment * m_currentSegment;
+};
+
+#endif
diff --git a/storage/ndb/include/util/SocketAuthenticator.hpp b/storage/ndb/include/util/SocketAuthenticator.hpp
new file mode 100644
index 00000000000..1b82567feaa
--- /dev/null
+++ b/storage/ndb/include/util/SocketAuthenticator.hpp
@@ -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 SOCKET_AUTHENTICATOR_HPP
+#define SOCKET_AUTHENTICATOR_HPP
+
+class SocketAuthenticator
+{
+public:
+ virtual ~SocketAuthenticator() {};
+ virtual bool client_authenticate(int sockfd) = 0;
+ virtual bool server_authenticate(int sockfd) = 0;
+};
+
+class SocketAuthSimple : public SocketAuthenticator
+{
+ const char *m_passwd;
+ const char *m_username;
+public:
+ SocketAuthSimple(const char *username, const char *passwd);
+ virtual ~SocketAuthSimple();
+ virtual bool client_authenticate(int sockfd);
+ virtual bool server_authenticate(int sockfd);
+};
+
+#endif // SOCKET_AUTHENTICATOR_HPP
diff --git a/storage/ndb/include/util/SocketClient.hpp b/storage/ndb/include/util/SocketClient.hpp
new file mode 100644
index 00000000000..bf1ad7d45d6
--- /dev/null
+++ b/storage/ndb/include/util/SocketClient.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 SOCKET_CLIENT_HPP
+#define SOCKET_CLIENT_HPP
+
+#include <NdbTCP.h>
+class SocketAuthenticator;
+
+class SocketClient
+{
+ NDB_SOCKET_TYPE m_sockfd;
+ struct sockaddr_in m_servaddr;
+ unsigned short m_port;
+ char *m_server_name;
+ SocketAuthenticator *m_auth;
+public:
+ SocketClient(const char *server_name, unsigned short port, SocketAuthenticator *sa = 0);
+ ~SocketClient();
+ bool init();
+ void set_port(unsigned short port) {
+ m_port = port;
+ m_servaddr.sin_port = htons(m_port);
+ };
+ unsigned short get_port() { return m_port; };
+ char *get_server_name() { return m_server_name; };
+ NDB_SOCKET_TYPE connect();
+ bool close();
+};
+
+#endif // SOCKET_ClIENT_HPP
diff --git a/storage/ndb/include/util/SocketServer.hpp b/storage/ndb/include/util/SocketServer.hpp
new file mode 100644
index 00000000000..2e1afb74945
--- /dev/null
+++ b/storage/ndb/include/util/SocketServer.hpp
@@ -0,0 +1,133 @@
+/* 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(){ m_stop = true; }
+ 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
+ */
+ static bool tryBind(unsigned short port, const char * intface = 0);
+
+ /**
+ * 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);
+
+ void foreachSession(void (*f)(Session*, void*), void *data);
+
+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/storage/ndb/include/util/UtilBuffer.hpp b/storage/ndb/include/util/UtilBuffer.hpp
new file mode 100644
index 00000000000..f43fc960a16
--- /dev/null
+++ b/storage/ndb/include/util/UtilBuffer.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 __BUFFER_HPP_INCLUDED__
+#define __BUFFER_HPP_INCLUDED__
+
+#include <ndb_global.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;
+ };
+
+ void * append(size_t l){
+ if(grow(len+l) != 0)
+ return 0;
+
+ void * ret = (char*)data+len;
+ len += l;
+ return ret;
+ }
+
+ int assign(const void * d, size_t l) {
+ if (data) free(data);
+ data = NULL;
+ 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/storage/ndb/include/util/Vector.hpp b/storage/ndb/include/util/Vector.hpp
new file mode 100644
index 00000000000..480dddf8243
--- /dev/null
+++ b/storage/ndb/include/util/Vector.hpp
@@ -0,0 +1,296 @@
+/* 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 <ndb_global.h>
+#include <NdbMutex.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;
+ // safety for placement new usage
+ m_items = 0;
+ m_size = 0;
+ m_arraySize = 0;
+}
+
+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;
+ // safety for placement new usage
+ m_items = 0;
+ m_size = 0;
+ m_arraySize = 0;
+}
+
+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/storage/ndb/include/util/basestring_vsnprintf.h b/storage/ndb/include/util/basestring_vsnprintf.h
new file mode 100644
index 00000000000..7c804f22841
--- /dev/null
+++ b/storage/ndb/include/util/basestring_vsnprintf.h
@@ -0,0 +1,29 @@
+/* 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 BASESTRING_VSNPRINTF_H
+#define BASESTRING_VSNPRINTF_H
+#include <stdarg.h>
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+int basestring_snprintf(char*, size_t, const char*, ...);
+int basestring_vsnprintf(char*,size_t, const char*,va_list);
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/storage/ndb/include/util/md5_hash.hpp b/storage/ndb/include/util/md5_hash.hpp
new file mode 100644
index 00000000000..b79dce3b5a9
--- /dev/null
+++ b/storage/ndb/include/util/md5_hash.hpp
@@ -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 MD5_HASH_H
+#define MD5_HASH_H
+
+#include <ndb_types.h>
+
+// External declaration of hash function
+void md5_hash(Uint32 result[4], const Uint64* keybuf, Uint32 no_of_32_words);
+
+inline
+Uint32
+md5_hash(const Uint64* keybuf, Uint32 no_of_32_words)
+{
+ Uint32 result[4];
+ md5_hash(result, keybuf, no_of_32_words);
+ return result[0];
+}
+
+#endif
diff --git a/storage/ndb/include/util/ndb_opts.h b/storage/ndb/include/util/ndb_opts.h
new file mode 100644
index 00000000000..72abd6d5d7a
--- /dev/null
+++ b/storage/ndb/include/util/ndb_opts.h
@@ -0,0 +1,167 @@
+/* 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_OPTS_H
+#define _NDB_OPTS_H
+
+#include <ndb_global.h>
+#include <my_sys.h>
+#include <my_getopt.h>
+#include <mysql_version.h>
+#include <ndb_version.h>
+#include <ndb_opt_defaults.h>
+
+#define NDB_STD_OPTS_VARS \
+my_bool opt_ndb_optimized_node_selection
+
+int opt_ndb_nodeid;
+my_bool opt_ndb_shm;
+const char *opt_ndb_connectstring= 0;
+const char *opt_connect_str= 0;
+const char *opt_ndb_mgmd= 0;
+char opt_ndb_constrbuf[1024];
+unsigned opt_ndb_constrbuf_len= 0;
+
+#ifndef DBUG_OFF
+const char *opt_debug= 0;
+#endif
+
+#define OPT_NDB_CONNECTSTRING 'c'
+
+#define NDB_STD_OPTS_COMMON \
+ { "usage", '?', "Display this help and exit.", \
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
+ { "help", '?', "Display this help and exit.", \
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
+ { "version", 'V', "Output version information and exit.", 0, 0, 0, \
+ GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
+ { "ndb-connectstring", OPT_NDB_CONNECTSTRING, \
+ "Set connect string for connecting to ndb_mgmd. " \
+ "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \
+ "Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", \
+ (gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring, \
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
+ { "ndb-mgmd-host", OPT_NDB_MGMD, \
+ "Set host and port for connecting to ndb_mgmd. " \
+ "Syntax: <hostname>[:<port>].", \
+ (gptr*) &opt_ndb_mgmd, (gptr*) &opt_ndb_mgmd, 0, \
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
+ { "ndb-nodeid", OPT_NDB_NODEID, \
+ "Set node id for this node.", \
+ (gptr*) &opt_ndb_nodeid, (gptr*) &opt_ndb_nodeid, 0, \
+ GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
+ { "ndb-shm", OPT_NDB_SHM,\
+ "Allow optimizing using shared memory connections when available",\
+ (gptr*) &opt_ndb_shm, (gptr*) &opt_ndb_shm, 0,\
+ GET_BOOL, NO_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0 },\
+ {"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION,\
+ "Select nodes for transactions in a more optimal way",\
+ (gptr*) &opt_ndb_optimized_node_selection,\
+ (gptr*) &opt_ndb_optimized_node_selection, 0,\
+ GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},\
+ { "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\
+ (gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring, \
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }
+
+#ifndef DBUG_OFF
+#define NDB_STD_OPTS(prog_name) \
+ { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \
+ (gptr*) &opt_debug, (gptr*) &opt_debug, \
+ 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \
+ NDB_STD_OPTS_COMMON
+#else
+#define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON
+#endif
+
+static void ndb_std_print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",
+ MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+
+static void usage();
+
+enum ndb_std_options {
+ OPT_NDB_SHM= 256,
+ OPT_NDB_SHM_SIGNUM,
+ OPT_NDB_OPTIMIZED_NODE_SELECTION,
+ OPT_NDB_MGMD,
+ OPT_NDB_NODEID,
+ NDB_STD_OPTIONS_LAST /* should always be last in this enum */
+};
+
+static my_bool
+ndb_std_get_one_option(int optid,
+ const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+#ifndef DBUG_OFF
+ case '#':
+ if (opt_debug)
+ {
+ DBUG_PUSH(opt_debug);
+ }
+ else
+ {
+ DBUG_PUSH("d:t");
+ }
+ break;
+#endif
+ case 'V':
+ ndb_std_print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
+ case OPT_NDB_SHM:
+ if (opt_ndb_shm)
+ {
+#ifndef NDB_SHM_TRANSPORTER
+ printf("Warning: binary not compiled with shared memory support,\n"
+ "Tcp connections will now be used instead\n");
+ opt_ndb_shm= 0;
+#endif
+ }
+ break;
+ case OPT_NDB_MGMD:
+ case OPT_NDB_NODEID:
+ {
+ int len= my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len,
+ sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len,
+ "%s%s%s",opt_ndb_constrbuf_len > 0 ? ",":"",
+ optid == OPT_NDB_NODEID ? "nodeid=" : "",
+ argument);
+ opt_ndb_constrbuf_len+= len;
+ }
+ /* fall through to add the connectstring to the end
+ * and set opt_ndbcluster_connectstring
+ */
+ case OPT_NDB_CONNECTSTRING:
+ if (opt_ndb_connectstring && opt_ndb_connectstring[0])
+ my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len,
+ sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len,
+ "%s%s", opt_ndb_constrbuf_len > 0 ? ",":"",
+ opt_ndb_connectstring);
+ else
+ opt_ndb_constrbuf[opt_ndb_constrbuf_len]= 0;
+ opt_connect_str= opt_ndb_constrbuf;
+ break;
+ }
+ return 0;
+}
+
+#endif /*_NDB_OPTS_H */
diff --git a/storage/ndb/include/util/random.h b/storage/ndb/include/util/random.h
new file mode 100644
index 00000000000..1b83e5fec93
--- /dev/null
+++ b/storage/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/storage/ndb/include/util/socket_io.h b/storage/ndb/include/util/socket_io.h
new file mode 100644
index 00000000000..a0e6c4e369d
--- /dev/null
+++ b/storage/ndb/include/util/socket_io.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 _SOCKET_IO_H
+#define _SOCKET_IO_H
+
+#include <ndb_global.h>
+
+#include <NdbTCP.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/storage/ndb/include/util/uucode.h b/storage/ndb/include/util/uucode.h
new file mode 100644
index 00000000000..f5569d033a5
--- /dev/null
+++ b/storage/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 <ndb_global.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/storage/ndb/include/util/version.h b/storage/ndb/include/util/version.h
new file mode 100644
index 00000000000..5459e44b818
--- /dev/null
+++ b/storage/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);
+
+ const char* getVersionString(Uint32 version, const 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