Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1895 05/09/15 11:33:50 tomas@stripped[tomas] +103 -0
ndb-wl2325.patch
storage/ndb/test/tools/Makefile.am
1.14 05/09/15 10:42:06 tomas@stripped[tomas] +2 -1
Import patch ndb-wl2325.patch
storage/ndb/test/src/UtilTransactions.cpp
1.22 05/09/15 10:42:06 tomas@stripped[tomas] +13 -8
Import patch ndb-wl2325.patch
storage/ndb/test/src/NDBT_Test.cpp
1.27 05/09/15 10:42:06 tomas@stripped[tomas] +175 -61
Import patch ndb-wl2325.patch
storage/ndb/test/src/NDBT_Tables.cpp
1.16 05/09/15 10:42:06 tomas@stripped[tomas] +1 -1
Import patch ndb-wl2325.patch
storage/ndb/test/src/NDBT_ResultRow.cpp
1.15 05/09/15 10:42:06 tomas@stripped[tomas] +2 -1
Import patch ndb-wl2325.patch
storage/ndb/test/src/HugoTransactions.cpp
1.27 05/09/15 10:42:06 tomas@stripped[tomas] +22 -300
Import patch ndb-wl2325.patch
storage/ndb/test/src/HugoOperations.cpp
1.26 05/09/15 10:42:06 tomas@stripped[tomas] +2 -2
Import patch ndb-wl2325.patch
storage/ndb/test/run-test/daily-devel-tests.txt
1.25 05/09/15 10:42:06 tomas@stripped[tomas] +14 -0
Import patch ndb-wl2325.patch
storage/ndb/test/run-test/Makefile.am
1.24 05/09/15 10:42:06 tomas@stripped[tomas] +4 -1
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/test_event_multi_table.cpp
1.3 05/09/15 10:42:05 tomas@stripped[tomas] +236 -164
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/test_event.cpp
1.10 05/09/15 10:42:05 tomas@stripped[tomas] +1127 -126
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bench/ndb_schema.hpp
1.3 05/09/15 10:42:05 tomas@stripped[tomas] +1 -1
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bench/asyncGenerator.cpp
1.3 05/09/15 10:42:05 tomas@stripped[tomas] +4 -5
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/testBank.cpp
1.8 05/09/15 10:42:05 tomas@stripped[tomas] +12 -6
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/bankValidateAllGLs.cpp
1.10 05/09/15 10:42:05 tomas@stripped[tomas] +4 -2
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/bankTransactionMaker.cpp
1.10 05/09/15 10:42:05 tomas@stripped[tomas] +3 -1
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/bankTimer.cpp
1.10 05/09/15 10:42:05 tomas@stripped[tomas] +3 -1
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/bankSumAccounts.cpp
1.10 05/09/15 10:42:05 tomas@stripped[tomas] +4 -2
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/bankMakeGL.cpp
1.10 05/09/15 10:42:05 tomas@stripped[tomas] +4 -2
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/bankCreator.cpp
1.10 05/09/15 10:42:05 tomas@stripped[tomas] +3 -1
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/Bank.hpp
1.10 05/09/15 10:42:05 tomas@stripped[tomas] +1 -1
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/Bank.cpp
1.13 05/09/15 10:42:05 tomas@stripped[tomas] +2 -2
Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/Makefile.am
1.25 05/09/15 10:42:05 tomas@stripped[tomas] +0 -2
Import patch ndb-wl2325.patch
storage/ndb/test/include/NDBT_Test.hpp
1.15 05/09/15 10:42:05 tomas@stripped[tomas] +13 -0
Import patch ndb-wl2325.patch
storage/ndb/test/include/NDBT_Table.hpp
1.11 05/09/15 10:42:05 tomas@stripped[tomas] +6 -1
Import patch ndb-wl2325.patch
storage/ndb/test/include/HugoTransactions.hpp
1.10 05/09/15 10:42:05 tomas@stripped[tomas] +4 -3
Import patch ndb-wl2325.patch
storage/ndb/test/include/HugoOperations.hpp
1.17 05/09/15 10:42:05 tomas@stripped[tomas] +1 -1
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/ndberror.c
1.41 05/09/15 10:42:04 tomas@stripped[tomas] +367 -348
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp
1.4 05/09/15 10:42:04 tomas@stripped[tomas] +1 -0
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
1.32 05/09/15 10:42:04 tomas@stripped[tomas] +24 -22
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/TransporterFacade.hpp
1.27 05/09/15 10:42:04 tomas@stripped[tomas] +6 -6
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/TransporterFacade.cpp
1.44 05/09/15 10:42:04 tomas@stripped[tomas] +43 -0
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/ObjectMap.hpp
1.9 05/09/15 10:42:04 tomas@stripped[tomas] +4 -9
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/Ndbinit.cpp
1.34 05/09/15 10:42:04 tomas@stripped[tomas] +21 -12
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/Ndbif.cpp
1.32 05/09/15 10:42:04 tomas@stripped[tomas] +75 -4
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/Ndberr.cpp
1.13 05/09/15 10:42:04 tomas@stripped[tomas] +7 -0
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbWaiter.hpp
1.4 05/09/15 10:42:04 tomas@stripped[tomas] +2 -2
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbImpl.hpp
1.13 05/09/15 10:42:04 tomas@stripped[tomas] +10 -4
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp
1.7 05/09/15 10:42:04 tomas@stripped[tomas] +247 -131
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
1.20 05/09/15 10:42:04 tomas@stripped[tomas] +898 -885
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbEventOperation.cpp
1.6 05/09/15 10:42:04 tomas@stripped[tomas] +74 -19
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
1.36 05/09/15 10:42:04 tomas@stripped[tomas] +24 -18
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
1.92 05/09/15 11:10:11 tomas@stripped[tomas] +233 -187
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbDictionary.cpp
1.40 05/09/15 11:10:11 tomas@stripped[tomas] +11 -0
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/Ndb.cpp
1.58 05/09/15 10:42:04 tomas@stripped[tomas] +73 -39
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/ClusterMgr.hpp
1.8 05/09/15 10:42:04 tomas@stripped[tomas] +6 -0
Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/ClusterMgr.cpp
1.24 05/09/15 10:42:04 tomas@stripped[tomas] +2 -26
Import patch ndb-wl2325.patch
storage/ndb/src/mgmsrv/Services.hpp
1.15 05/09/15 10:42:04 tomas@stripped[tomas] +0 -2
Import patch ndb-wl2325.patch
storage/ndb/src/mgmsrv/Services.cpp
1.52 05/09/15 10:42:04 tomas@stripped[tomas] +0 -30
Import patch ndb-wl2325.patch
storage/ndb/src/mgmsrv/MgmtSrvr.hpp
1.36 05/09/15 10:42:04 tomas@stripped[tomas] +1 -6
Import patch ndb-wl2325.patch
storage/ndb/src/mgmsrv/MgmtSrvr.cpp
1.83 05/09/15 10:42:04 tomas@stripped[tomas] +11 -23
Import patch ndb-wl2325.patch
storage/ndb/src/mgmclient/CommandInterpreter.cpp
1.56 05/09/15 10:42:04 tomas@stripped[tomas] +0 -295
Import patch ndb-wl2325.patch
storage/ndb/src/mgmapi/ndb_logevent.cpp
1.7 05/09/15 10:42:04 tomas@stripped[tomas] +8 -0
Import patch ndb-wl2325.patch
storage/ndb/src/mgmapi/mgmapi.cpp
1.55 05/09/15 10:42:04 tomas@stripped[tomas] +1 -1
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/vm/SimulatedBlock.hpp
1.15 05/09/15 10:42:04 tomas@stripped[tomas] +3 -1
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/vm/SimulatedBlock.cpp
1.21 05/09/15 10:42:04 tomas@stripped[tomas] +12 -0
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/vm/Configuration.cpp
1.41 05/09/15 10:42:04 tomas@stripped[tomas] +0 -4
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/trix/Trix.hpp
1.5 05/09/15 10:42:04 tomas@stripped[tomas] +0 -2
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/trix/Trix.cpp
1.9 05/09/15 10:42:04 tomas@stripped[tomas] +71 -63
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/suma/SumaInit.cpp
1.8 05/09/15 10:42:04 tomas@stripped[tomas] +101 -103
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/suma/Suma.hpp
1.5 05/09/15 10:42:04 tomas@stripped[tomas] +275 -266
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/suma/Suma.cpp
1.22 05/09/15 10:42:04 tomas@stripped[tomas] +2791 -2337
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
1.19 05/09/15 10:42:04 tomas@stripped[tomas] +10 -7
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
1.21 05/09/15 10:42:04 tomas@stripped[tomas] +5 -1
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrSysTable.cpp
1.4 05/09/15 10:42:04 tomas@stripped[tomas] +13 -5
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
1.21 05/09/15 10:42:04 tomas@stripped[tomas] +21 -4
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp
1.8 05/09/15 10:42:04 tomas@stripped[tomas] +1 -0
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp
1.5 05/09/15 10:42:04 tomas@stripped[tomas] +1 -0
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp
1.12 05/09/15 10:42:04 tomas@stripped[tomas] +26 -14
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
1.15 05/09/15 10:42:04 tomas@stripped[tomas] +1 -0
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbtup/DbtupBuffer.cpp
1.9 05/09/15 10:42:04 tomas@stripped[tomas] +1 -1
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
1.27 05/09/15 10:42:04 tomas@stripped[tomas] +3 -1
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
1.88 05/09/15 10:42:04 tomas@stripped[tomas] +17 -3
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
1.78 05/09/15 11:10:11 tomas@stripped[tomas] +4 -1
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
1.36 05/09/15 10:42:04 tomas@stripped[tomas] +0 -1
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
1.19 05/09/15 10:42:04 tomas@stripped[tomas] +9 -9
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
1.54 05/09/15 10:42:04 tomas@stripped[tomas] +229 -235
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
1.22 05/09/15 10:42:03 tomas@stripped[tomas] +6 -8
Import patch ndb-wl2325.patch
storage/ndb/src/kernel/SimBlockList.cpp
1.10 05/09/15 10:42:03 tomas@stripped[tomas] +2 -3
Import patch ndb-wl2325.patch
storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp
1.31 05/09/15 10:42:03 tomas@stripped[tomas] +12 -3
Import patch ndb-wl2325.patch
storage/ndb/src/common/debugger/signaldata/SumaImpl.cpp
1.4 05/09/15 10:42:03 tomas@stripped[tomas] +20 -32
Import patch ndb-wl2325.patch
storage/ndb/src/common/debugger/signaldata/SignalNames.cpp
1.8 05/09/15 10:42:03 tomas@stripped[tomas] +7 -23
Import patch ndb-wl2325.patch
storage/ndb/src/common/debugger/Makefile.am
1.7 05/09/15 10:42:03 tomas@stripped[tomas] +1 -1
Import patch ndb-wl2325.patch
storage/ndb/src/common/debugger/EventLogger.cpp
1.24 05/09/15 10:42:02 tomas@stripped[tomas] +39 -2
Import patch ndb-wl2325.patch
storage/ndb/ndbapi-examples/Makefile
1.9 05/09/15 10:42:02 tomas@stripped[tomas] +8 -8
Import patch ndb-wl2325.patch
storage/ndb/include/ndbapi/ndberror.h
1.10 05/09/15 10:42:02 tomas@stripped[tomas] +5 -0
Import patch ndb-wl2325.patch
storage/ndb/include/ndbapi/ndb_cluster_connection.hpp
1.12 05/09/15 10:42:02 tomas@stripped[tomas] +1 -0
Import patch ndb-wl2325.patch
storage/ndb/include/ndbapi/NdbEventOperation.hpp
1.14 05/09/15 10:42:02 tomas@stripped[tomas] +37 -34
Import patch ndb-wl2325.patch
storage/ndb/include/ndbapi/NdbError.hpp
1.9 05/09/15 10:42:02 tomas@stripped[tomas] +8 -0
Import patch ndb-wl2325.patch
storage/ndb/include/ndbapi/NdbDictionary.hpp
1.56 05/09/15 11:10:11 tomas@stripped[tomas] +36 -5
Import patch ndb-wl2325.patch
storage/ndb/include/ndbapi/Ndb.hpp
1.45 05/09/15 10:42:02 tomas@stripped[tomas] +21 -8
Import patch ndb-wl2325.patch
storage/ndb/include/mgmapi/ndb_logevent.h
1.5 05/09/15 10:42:02 tomas@stripped[tomas] +15 -1
Import patch ndb-wl2325.patch
storage/ndb/include/mgmapi/mgmapi_config_parameters.h
1.21 05/09/15 10:42:02 tomas@stripped[tomas] +0 -5
Import patch ndb-wl2325.patch
storage/ndb/include/mgmapi/mgmapi.h
1.47 05/09/15 10:42:02 tomas@stripped[tomas] +0 -1
Import patch ndb-wl2325.patch
storage/ndb/include/kernel/signaldata/SumaImpl.hpp
1.5 05/09/15 10:42:02 tomas@stripped[tomas] +164 -260
Import patch ndb-wl2325.patch
storage/ndb/include/kernel/signaldata/EventReport.hpp
1.5 05/09/15 10:42:02 tomas@stripped[tomas] +16 -2
Import patch ndb-wl2325.patch
storage/ndb/include/kernel/signaldata/DropTab.hpp
1.4 05/09/15 10:42:02 tomas@stripped[tomas] +1 -0
Import patch ndb-wl2325.patch
storage/ndb/include/kernel/signaldata/CreateTab.hpp
1.3 05/09/15 10:42:02 tomas@stripped[tomas] +1 -0
Import patch ndb-wl2325.patch
storage/ndb/include/kernel/signaldata/CreateEvnt.hpp
1.9 05/09/15 10:42:02 tomas@stripped[tomas] +53 -16
Import patch ndb-wl2325.patch
storage/ndb/include/kernel/signaldata/AlterTab.hpp
1.3 05/09/15 10:42:02 tomas@stripped[tomas] +1 -0
Import patch ndb-wl2325.patch
storage/ndb/include/kernel/NodeInfo.hpp
1.5 05/09/15 10:42:02 tomas@stripped[tomas] +0 -4
Import patch ndb-wl2325.patch
storage/ndb/include/kernel/GlobalSignalNumbers.h
1.11 05/09/15 10:42:02 tomas@stripped[tomas] +73 -79
Import patch ndb-wl2325.patch
storage/ndb/include/debugger/EventLogger.hpp
1.11 05/09/15 10:42:02 tomas@stripped[tomas] +0 -1
Import patch ndb-wl2325.patch
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: tomas
# Host: poseidon.ndb.mysql.com
# Root: /home/tomas/mysql-5.1
--- 1.20/storage/ndb/include/mgmapi/mgmapi_config_parameters.h 2005-08-05 23:50:40 +02:00
+++ 1.21/storage/ndb/include/mgmapi/mgmapi_config_parameters.h 2005-09-15 10:42:02 +02:00
@@ -4,7 +4,6 @@
#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
@@ -139,8 +138,6 @@
#define CFG_OSE_PRIO_B_SIZE 603
#define CFG_OSE_RECEIVE_ARRAY_SIZE 604
-#define CFG_REP_HEARTBEAT_INTERVAL 700
-
/**
* API Config variables
*
@@ -162,8 +159,6 @@
#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
--- 1.2/storage/ndb/test/ndbapi/bench/asyncGenerator.cpp 2005-04-08 02:44:25 +02:00
+++ 1.3/storage/ndb/test/ndbapi/bench/asyncGenerator.cpp 2005-09-15 10:42:05 +02:00
@@ -325,11 +325,10 @@
td->transactionData.do_rollback =
getNextRandom(&td->generator.rollbackSequenceT4);
-#if 0
- memset(td->transactionData.session_details,
- myRandom48(26)+'A', SESSION_DETAILS_LENGTH);
-#endif
- td->transactionData.session_details[SESSION_DETAILS_LENGTH] = 0;
+ memset(td->transactionData.session_details+2,
+ myRandom48(26)+'A', SESSION_DETAILS_LENGTH-3);
+ td->transactionData.session_details[SESSION_DETAILS_LENGTH-1] = 0;
+ int2store(td->transactionData.session_details,SESSION_DETAILS_LENGTH-2);
/*-----------------*/
/* Run transaction */
--- 1.2/storage/ndb/test/ndbapi/bench/ndb_schema.hpp 2005-04-08 02:44:25 +02:00
+++ 1.3/storage/ndb/test/ndbapi/bench/ndb_schema.hpp 2005-09-15 10:42:05 +02:00
@@ -36,7 +36,7 @@
#define SERVER_INSERTS "NO_OF_INSERT"
#define SERVER_DELETES "NO_OF_DELETE"
-#define GROUP_TABLE "GROUP"
+#define GROUP_TABLE "GROUP_T"
#define GROUP_ID "GROUP_ID"
#define GROUP_NAME "GROUP_NAME"
#define GROUP_ALLOW_READ "ALLOW_READ"
--- 1.24/storage/ndb/test/run-test/daily-devel-tests.txt 2005-05-02 13:19:47 +02:00
+++ 1.25/storage/ndb/test/run-test/daily-devel-tests.txt 2005-09-15 10:42:06 +02:00
@@ -208,3 +208,17 @@
cmd: test_event
args: -n EventOperationApplier
+#
+max-time: 2500
+cmd: test_event
+args: -n EventOperationApplier_NR
+
+#
+max-time: 2500
+cmd: test_event
+args: -n Multi
+
+max-time: 600
+cmd: testBasic
+args: -n PkRead T1
+
--- 1.8/storage/ndb/ndbapi-examples/Makefile 2005-04-08 02:43:54 +02:00
+++ 1.9/storage/ndb/ndbapi-examples/Makefile 2005-09-15 10:42:02 +02:00
@@ -1,11 +1,11 @@
-BIN_DIRS := ndbapi_simple_example \
- ndbapi_async_example \
- ndbapi_async_example1 \
- ndbapi_retries_example \
- ndbapi_simple_index_example \
- ndbapi_event_example \
- ndbapi_scan_example \
- mgmapi_logevent_example
+BIN_DIRS := ndbapi_simple \
+ ndbapi_async \
+ ndbapi_async1 \
+ ndbapi_retries \
+ ndbapi_simple_index \
+ ndbapi_event \
+ ndbapi_scan \
+ mgmapi_logevent
bins: $(patsubst %, _bins_%, $(BIN_DIRS))
--- 1.10/storage/ndb/include/debugger/EventLogger.hpp 2005-04-08 02:43:49 +02:00
+++ 1.11/storage/ndb/include/debugger/EventLogger.hpp 2005-09-15 10:42:02 +02:00
@@ -19,7 +19,6 @@
#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>
--- 1.10/storage/ndb/include/kernel/GlobalSignalNumbers.h 2005-08-25 18:49:45 +02:00
+++ 1.11/storage/ndb/include/kernel/GlobalSignalNumbers.h 2005-09-15 10:42:02 +02:00
@@ -169,6 +169,7 @@
#define GSN_ADD_FRAGREF 110
#define GSN_ADD_FRAGREQ 111
+#define GSN_API_START_REP 120
#define GSN_API_FAILCONF 113
#define GSN_API_FAILREQ 114
#define GSN_CNTR_START_REQ 115
@@ -176,7 +177,7 @@
#define GSN_CNTR_START_REF 117
#define GSN_CNTR_START_CONF 118
#define GSN_CNTR_START_REP 119
-/* 120 unused */
+/* 120 not unused */
/* 121 unused */
/* 122 unused */
/* 123 unused */
@@ -592,6 +593,7 @@
#define GSN_BLOCK_COMMIT_ORD 485
#define GSN_UNBLOCK_COMMIT_ORD 486
+#define GSN_NODE_START_REP 502
#define GSN_NODE_STATE_REP 487
#define GSN_CHANGE_NODE_STATE_REQ 488
#define GSN_CHANGE_NODE_STATE_CONF 489
@@ -612,7 +614,7 @@
#define GSN_WAIT_GCP_REF 500
#define GSN_WAIT_GCP_CONF 501
-/* 502 not used */
+/* 502 used */
/**
* Trigger and index signals
@@ -774,66 +776,59 @@
#define GSN_ALTER_INDX_REF 604
#define GSN_ALTER_INDX_CONF 605
-/**
- * Grep signals
- */
#define GSN_ALTER_TABLE_REP 606
#define GSN_API_BROADCAST_REP 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
+#define GSN_608
+#define GSN_609
+#define GSN_610
+#define GSN_611
+
+#define GSN_612
+#define GSN_613
+#define GSN_614
+#define GSN_615
+#define GSN_616
+#define GSN_617
+
+#define GSN_618
+#define GSN_619
+#define GSN_620
+#define GSN_621
+#define GSN_622
+#define GSN_623
+
+#define GSN_627
+#define GSN_628
+#define GSN_629
+#define GSN_630
+#define GSN_631
+#define GSN_632
+#define GSN_633
+#define GSN_634
+#define GSN_635
+#define GSN_636
+#define GSN_637
+#define GSN_638
+#define GSN_639
+#define GSN_640
+#define GSN_641
+#define GSN_642
+#define GSN_643
+#define GSN_644
+#define GSN_645
+#define GSN_646
+#define GSN_647
+#define GSN_648
+#define GSN_649
+
+#define GSN_650
+#define GSN_651
+#define GSN_652
+#define GSN_653
+#define GSN_654
+#define GSN_655
-/* Start Global Replication */
-#define GSN_GREP_REQ 656
+#define GSN_656
/**
* Management server
@@ -864,13 +859,12 @@
#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
+#define GSN_664
+#define GSN_665
+#define GSN_666
+#define GSN_667
+#define GSN_668
+#define GSN_669
/*
* TUX
@@ -911,27 +905,27 @@
/**
* SUMA restart protocol
*/
-#define GSN_SUMA_START_ME 691
+#define GSN_SUMA_START_ME_REQ 691
+#define GSN_SUMA_START_ME_REF 694
+#define GSN_SUMA_START_ME_CONF 695
#define GSN_SUMA_HANDOVER_REQ 692
+#define GSN_SUMA_HANDOVER_REF 696
#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
+/* used 694 */
+/* used 695 */
+/* used 696 */
+
+#define GSN_706
+#define GSN_707
+#define GSN_708
+#define GSN_709
/*
* EVENT Signals
*/
-#define GSN_SUB_GCP_COMPLETE_ACC 699
+#define GSN_SUB_GCP_COMPLETE_ACK 699
#define GSN_CREATE_EVNT_REQ 700
#define GSN_CREATE_EVNT_CONF 701
--- 1.4/storage/ndb/include/kernel/NodeInfo.hpp 2005-07-22 14:50:18 +02:00
+++ 1.5/storage/ndb/include/kernel/NodeInfo.hpp 2005-09-15 10:42:02 +02:00
@@ -31,7 +31,6 @@
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;
@@ -75,9 +74,6 @@
break;
case NodeInfo::MGM:
ndbout << "MGM";
- break;
- case NodeInfo::REP:
- ndbout << "REP";
break;
case NodeInfo::INVALID:
ndbout << "INVALID";
--- 1.2/storage/ndb/include/kernel/signaldata/AlterTab.hpp 2005-04-08 02:43:49 +02:00
+++ 1.3/storage/ndb/include/kernel/signaldata/AlterTab.hpp 2005-09-15 10:42:02 +02:00
@@ -103,6 +103,7 @@
friend class Dbtc;
friend class Dblqh;
friend class Dbtup;
+ friend class Suma;
/**
* For printing
--- 1.8/storage/ndb/include/kernel/signaldata/CreateEvnt.hpp 2005-04-08 02:43:50 +02:00
+++ 1.9/storage/ndb/include/kernel/signaldata/CreateEvnt.hpp 2005-09-15 10:42:02 +02:00
@@ -97,6 +97,13 @@
enum ErrorCode {
NoError = 0,
Undefined = 1,
+ NF_FakeErrorREF = 11,
+ Busy = 701
+ };
+#if 0
+ enum ErrorCode {
+ NoError = 0,
+ Undefined = 1,
UndefinedTCError = 2,
NF_FakeErrorREF = 11,
Busy = 701,
@@ -115,7 +122,7 @@
InvalidAttributeOrder = 4255,
Temporary = 0x1 << 16
};
-
+#endif
STATIC_CONST( SignalLength = 5 );
union { // user block reference
@@ -132,7 +139,7 @@
};
Uint32 m_errorLine;
Uint32 m_errorNode;
-
+#if 0
bool isTemporary() const
{ return (errorCode & Temporary) > 0; }
@@ -141,7 +148,7 @@
ErrorCode setTemporary(ErrorCode ec)
{ return (ErrorCode) (errorCode = ((Uint32) ec | (Uint32)Temporary)); }
-
+#endif
Uint32 getUserRef() const {
return m_userRef;
}
@@ -154,11 +161,11 @@
void setUserData(Uint32 val) {
m_userData = val;
}
- DropEvntRef::ErrorCode getErrorCode() const {
- return (DropEvntRef::ErrorCode)m_errorCode;
+ Uint32 getErrorCode() const {
+ return m_errorCode;
}
- void setErrorCode(DropEvntRef::ErrorCode val) {
- m_errorCode = (Uint32)val;
+ void setErrorCode(Uint32 val) {
+ m_errorCode = val;
}
Uint32 getErrorLine() const {
return m_errorLine;
@@ -193,8 +200,8 @@
// RT_TC = 5 << 8
};
STATIC_CONST( SignalLengthGet = 3 );
- STATIC_CONST( SignalLengthCreate = 5+MAXNROFATTRIBUTESINWORDS );
- STATIC_CONST( SignalLength = 7+MAXNROFATTRIBUTESINWORDS );
+ STATIC_CONST( SignalLengthCreate = 6+MAXNROFATTRIBUTESINWORDS );
+ STATIC_CONST( SignalLength = 8+MAXNROFATTRIBUTESINWORDS );
// SECTION( ATTRIBUTE_LIST_SECTION = 0 );
SECTION( EVENT_NAME_SECTION = 0 );
@@ -208,6 +215,7 @@
};
Uint32 m_requestInfo;
Uint32 m_tableId; // table to event
+ Uint32 m_tableVersion; // table version
AttributeMask::Data m_attrListBitmask;
Uint32 m_eventType; // from DictTabInfo::TableType
Uint32 m_eventId; // event table id set by DICT/SUMA
@@ -245,6 +253,12 @@
void setTableId(Uint32 val) {
m_tableId = val;
}
+ Uint32 getTableVersion() const {
+ return m_tableVersion;
+ }
+ void setTableVersion(Uint32 val) {
+ m_tableVersion = val;
+ }
AttributeMask getAttrListBitmask() const {
AttributeMask tmp;
tmp.assign(m_attrListBitmask);
@@ -281,7 +295,7 @@
public:
// STATIC_CONST( InternalLength = 3 );
- STATIC_CONST( SignalLength = 7+MAXNROFATTRIBUTESINWORDS );
+ STATIC_CONST( SignalLength = 8+MAXNROFATTRIBUTESINWORDS );
union {
Uint32 m_userRef; // user block reference
@@ -293,6 +307,7 @@
};
Uint32 m_requestInfo;
Uint32 m_tableId;
+ Uint32 m_tableVersion; // table version
AttributeMask m_attrListBitmask;
Uint32 m_eventType;
Uint32 m_eventId;
@@ -322,6 +337,12 @@
void setTableId(Uint32 val) {
m_tableId = val;
}
+ Uint32 getTableVersion() const {
+ return m_tableVersion;
+ }
+ void setTableVersion(Uint32 val) {
+ m_tableVersion = val;
+ }
AttributeMask getAttrListBitmask() const {
return m_attrListBitmask;
}
@@ -355,7 +376,14 @@
friend class SafeCounter;
friend bool printCREATE_EVNT_REF(FILE*, const Uint32*, Uint32, Uint16);
- STATIC_CONST( SignalLength = 10 );
+ STATIC_CONST( SignalLength = 11 );
+ enum ErrorCode {
+ NoError = 0,
+ Undefined = 1,
+ NF_FakeErrorREF = 11,
+ Busy = 701
+ };
+#if 0
enum ErrorCode {
NoError = 0,
Undefined = 1,
@@ -383,6 +411,7 @@
void setTemporary();
ErrorCode setTemporary(ErrorCode ec);
static ErrorCode makeTemporary(ErrorCode ec);
+#endif
union {
Uint32 m_userRef; // user block reference
@@ -395,6 +424,7 @@
Uint32 m_requestInfo;
Uint32 m_tableId;
+ Uint32 m_tableVersion; // table version
Uint32 m_eventType;
Uint32 m_eventId;
Uint32 m_eventKey;
@@ -434,6 +464,12 @@
void setTableId(Uint32 val) {
m_tableId = val;
}
+ Uint32 getTableVersion() const {
+ return m_tableVersion;
+ }
+ void setTableVersion(Uint32 val) {
+ m_tableVersion = val;
+ }
Uint32 getEventType() const {
return m_eventType;
@@ -454,11 +490,11 @@
m_eventKey = val;
}
- CreateEvntRef::ErrorCode getErrorCode() const {
- return (CreateEvntRef::ErrorCode)errorCode;
+ Uint32 getErrorCode() const {
+ return errorCode;
}
- void setErrorCode(CreateEvntRef::ErrorCode val) {
- errorCode = (Uint32)val;
+ void setErrorCode(Uint32 val) {
+ errorCode = val;
}
Uint32 getErrorLine() const {
return m_errorLine;
@@ -473,6 +509,7 @@
m_errorNode = val;
}
};
+#if 0
inline bool CreateEvntRef::isTemporary() const
{ return (errorCode & CreateEvntRef::Temporary) > 0; }
inline void CreateEvntRef::setTemporary()
@@ -483,5 +520,5 @@
inline CreateEvntRef::ErrorCode CreateEvntRef::makeTemporary(ErrorCode ec)
{ return (CreateEvntRef::ErrorCode)
( (Uint32) ec | (Uint32)CreateEvntRef::Temporary ); }
-
+#endif
#endif
--- 1.2/storage/ndb/include/kernel/signaldata/CreateTab.hpp 2005-04-08 02:43:50 +02:00
+++ 1.3/storage/ndb/include/kernel/signaldata/CreateTab.hpp 2005-09-15 10:42:02 +02:00
@@ -91,6 +91,7 @@
* Sender(s) / Reciver(s)
*/
friend class Dbdict;
+ friend class Suma;
/**
* For printing
--- 1.3/storage/ndb/include/kernel/signaldata/DropTab.hpp 2005-04-08 02:43:50 +02:00
+++ 1.4/storage/ndb/include/kernel/signaldata/DropTab.hpp 2005-09-15 10:42:02 +02:00
@@ -61,6 +61,7 @@
friend class Dbtup;
friend class Dbtux;
friend class Dbdih;
+ friend class Suma;
/**
* Receiver(s)
--- 1.4/storage/ndb/include/kernel/signaldata/EventReport.hpp 2005-04-08 02:43:50 +02:00
+++ 1.5/storage/ndb/include/kernel/signaldata/EventReport.hpp 2005-09-15 10:42:02 +02:00
@@ -68,6 +68,8 @@
4) Add SentHeartbeat in EventLogger::getText()
*/
+ void setNodeId(Uint32 nodeId);
+ Uint32 getNodeId() const;
void setEventType(Ndb_logevent_type type);
Ndb_logevent_type getEventType() const;
UintR eventType; // DATA 0
@@ -75,14 +77,26 @@
inline
void
+EventReport::setNodeId(Uint32 nodeId){
+ eventType = (nodeId << 16) | (eventType & 0xFFFF);
+}
+
+inline
+Uint32
+EventReport::getNodeId() const {
+ return eventType >> 16;
+}
+
+inline
+void
EventReport::setEventType(Ndb_logevent_type type){
- eventType = (UintR) type;
+ eventType = (eventType & 0xFFFF0000) | (((UintR) type) & 0xFFFF);
}
inline
Ndb_logevent_type
EventReport::getEventType() const {
- return (Ndb_logevent_type)eventType;
+ return (Ndb_logevent_type)(eventType & 0xFFFF);
}
#endif
--- 1.4/storage/ndb/include/kernel/signaldata/SumaImpl.hpp 2005-04-08 02:43:51 +02:00
+++ 1.5/storage/ndb/include/kernel/signaldata/SumaImpl.hpp 2005-09-15 10:42:02 +02:00
@@ -21,16 +21,15 @@
#include <NodeBitmask.hpp>
-class SubCreateReq {
+struct SubCreateReq {
/**
* Sender(s)/Reciver(s)
*/
- friend class Grep;
- friend class SumaParticipant;
+ friend struct Grep;
+ friend struct SumaParticipant;
friend bool printSUB_CREATE_REQ(FILE *, const Uint32 *, Uint32, Uint16);
-public:
- STATIC_CONST( SignalLength = 5 );
+ STATIC_CONST( SignalLength = 6 );
enum SubscriptionType {
SingleTableScan = 1, //
@@ -43,75 +42,57 @@
RestartFlag = 0x2 << 16
};
- Uint32 subscriberRef;
- Uint32 subscriberData;
+ Uint32 senderRef;
+ Uint32 senderData;
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 );
-
+ Uint32 tableId;
};
-class SubCreateRef {
+struct SubCreateRef {
/**
* Sender(s)/Reciver(s)
*/
- friend class Grep;
- friend class SumaParticipant;
+ friend struct Grep;
+ friend struct 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;
+ STATIC_CONST( SignalLength = 3 );
- SECTION( ATTRIBUTE_LIST = 0); // Used when doing SingelTableScan
- union {
- Uint32 tableId; // Used when doing SingelTableScan
- };
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 errorCode;
};
-class SubCreateConf {
+struct SubCreateConf {
/**
* Sender(s)/Reciver(s)
*/
- friend class Grep;
- friend class SumaParticipant;
+ friend struct Grep;
+ friend struct SumaParticipant;
friend bool printSUB_CREATE_CONF(FILE *, const Uint32 *, Uint32, Uint16);
-public:
- STATIC_CONST( SignalLength = 3 );
+ STATIC_CONST( SignalLength = 2 );
- Uint32 subscriberData;
- Uint32 subscriptionId;
- Uint32 subscriptionKey;
+ Uint32 senderRef;
+ Uint32 senderData;
};
-class SubscriptionData {
-public:
+struct SubscriptionData {
enum Part {
MetaData = 1,
TableData = 2
};
};
-class SubStartReq {
+struct SubStartReq {
/**
* Sender(s)/Reciver(s)
*/
- friend class Suma;
+ friend struct Suma;
friend bool printSUB_START_REQ(FILE *, const Uint32 *, Uint32, Uint16);
-public:
STATIC_CONST( SignalLength = 6 );
STATIC_CONST( SignalLength2 = SignalLength+1 );
@@ -124,23 +105,18 @@
Uint32 subscriberRef;
};
-class SubStartRef {
+struct SubStartRef {
/**
* Sender(s)/Reciver(s)
*/
- friend class Suma;
+ friend struct Suma;
friend bool printSUB_START_REF(FILE *, const Uint32 *, Uint32, Uint16);
-public:
enum ErrorCode {
- Undefined = 0,
+ Undefined = 1,
NF_FakeErrorREF = 11,
- Busy = 701,
- Temporary = 0x1 << 16
+ Busy = 701
};
- bool isTemporary() const;
- void setTemporary();
- ErrorCode setTemporary(ErrorCode ec);
STATIC_CONST( SignalLength = 7 );
STATIC_CONST( SignalLength2 = SignalLength+1 );
@@ -151,29 +127,19 @@
Uint32 subscriptionKey;
Uint32 part; // SubscriptionData::Part
Uint32 subscriberData;
- union { // do not change the order here!
- Uint32 err;
- Uint32 errorCode;
- };
+ // do not change the order here!
+ 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 {
+struct SubStartConf {
/**
* Sender(s)/Reciver(s)
*/
- friend class Grep;
+ friend struct Grep;
friend bool printSUB_START_CONF(FILE *, const Uint32 *, Uint32, Uint16);
-public:
STATIC_CONST( SignalLength = 7 );
STATIC_CONST( SignalLength2 = SignalLength+1 );
@@ -188,14 +154,13 @@
Uint32 subscriberRef;
};
-class SubStopReq {
+struct SubStopReq {
/**
* Sender(s)/Reciver(s)
*/
- friend class Suma;
+ friend struct Suma;
friend bool printSUB_STOP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
-public:
STATIC_CONST( SignalLength = 7 );
Uint32 senderRef;
Uint32 senderData;
@@ -206,23 +171,18 @@
Uint32 subscriberRef;
};
-class SubStopRef {
+struct SubStopRef {
/**
* Sender(s)/Reciver(s)
*/
- friend class Suma;
+ friend struct Suma;
friend bool printSUB_STOP_REF(FILE *, const Uint32 *, Uint32, Uint16);
-public:
enum ErrorCode {
- Undefined = 0,
+ Undefined = 1,
NF_FakeErrorREF = 11,
- Busy = 701,
- Temporary = 0x1 << 16
+ Busy = 701
};
- bool isTemporary() const;
- void setTemporary();
- ErrorCode setTemporary(ErrorCode ec);
STATIC_CONST( SignalLength = 8 );
@@ -233,27 +193,16 @@
Uint32 part; // SubscriptionData::Part
Uint32 subscriberData;
Uint32 subscriberRef;
- union {
- Uint32 err;
- Uint32 errorCode;
- };
+ 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 {
+struct SubStopConf {
/**
* Sender(s)/Reciver(s)
*/
- friend class Grep;
+ friend struct Grep;
friend bool printSUB_STOP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
-public:
STATIC_CONST( SignalLength = 7 );
Uint32 senderRef;
@@ -265,215 +214,181 @@
Uint32 subscriberRef;
};
-class SubSyncReq {
+struct SubSyncReq {
/**
* Sender(s)/Reciver(s)
*/
- friend class Suma;
- friend class Grep;
+ friend struct Suma;
+ friend struct Grep;
friend bool printSUB_SYNC_REQ(FILE *, const Uint32 *, Uint32, Uint16);
-public:
- STATIC_CONST( SignalLength = 4 );
+ STATIC_CONST( SignalLength = 5 );
-public:
+ Uint32 senderRef;
+ Uint32 senderData;
Uint32 subscriptionId;
Uint32 subscriptionKey;
- Uint32 subscriberData;
Uint32 part; // SubscriptionData::Part
+
+ SECTION( ATTRIBUTE_LIST = 0); // Used when doing SingelTableScan
+ SECTION( TABLE_LIST = 1 );
};
-class SubSyncRef {
+struct SubSyncRef {
/**
* Sender(s)/Reciver(s)
*/
- friend class Suma;
- friend class Grep;
+ friend struct Suma;
+ friend struct Grep;
friend bool printSUB_SYNC_REF(FILE *, const Uint32 *, Uint32, Uint16);
-public:
enum ErrorCode {
- Undefined = 0,
- Temporary = 0x1 << 16
+ Undefined = 1
};
- STATIC_CONST( SignalLength = 5 );
+ STATIC_CONST( SignalLength = 3 );
- Uint32 subscriptionId;
- Uint32 subscriptionKey;
- Uint32 part; // SubscriptionData::Part
- Uint32 subscriberData;
- union {
- Uint32 errorCode;
- Uint32 err;
- };
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 errorCode;
};
-class SubSyncConf {
+struct SubSyncConf {
/**
* Sender(s)/Reciver(s)
*/
- friend class Suma;
- friend class Grep;
+ friend struct Suma;
+ friend struct Grep;
friend bool printSUB_SYNC_CONF(FILE *, const Uint32 *, Uint32, Uint16);
-public:
- STATIC_CONST( SignalLength = 4 );
+ STATIC_CONST( SignalLength = 2 );
- Uint32 subscriptionId;
- Uint32 subscriptionKey;
- Uint32 part; // SubscriptionData::Part
- Uint32 subscriberData;
+ Uint32 senderRef;
+ Uint32 senderData;
};
-class SubMetaData {
+struct SubMetaData {
/**
* Sender(s)/Reciver(s)
*/
- friend class SumaParticipant;
- friend class Grep;
+ friend struct SumaParticipant;
+ friend struct 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;
- };
+ Uint32 senderData;
+ Uint32 tableId;
};
-class SubTableData {
+struct SubTableData {
/**
* Sender(s)/Reciver(s)
*/
- friend class SumaParticipant;
- friend class Grep;
+ friend struct SumaParticipant;
+ friend struct Grep;
friend bool printSUB_TABLE_DATA(FILE *, const Uint32 *, Uint32, Uint16);
-public:
- STATIC_CONST( SignalLength = 7 );
+ STATIC_CONST( SignalLength = 5 );
enum LogType {
SCAN = 1,
LOG = 2,
- REMOVE_FLAGS = 0xff,
- GCINOTCONSISTENT = 0x1 << 16
+ REMOVE_FLAGS = 0xff
};
- 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 senderData;
Uint32 gci;
Uint32 tableId;
- Uint32 operation;
- Uint32 noOfAttributes;
- Uint32 dataSize;
+ Uint8 operation;
+ Uint8 req_nodeid;
+ Uint8 not_used2;
+ Uint8 not_used3;
Uint32 logType;
};
-class SubSyncContinueReq {
+struct SubSyncContinueReq {
/**
* Sender(s)/Reciver(s)
*/
- friend class SumaParticipant;
- friend class Grep;
- friend class Trix;
+ friend struct SumaParticipant;
+ friend struct Grep;
+ friend struct 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 subscriberData;
Uint32 noOfRowsSent;
};
-class SubSyncContinueRef {
+struct SubSyncContinueRef {
/**
* Sender(s)/Reciver(s)
*/
- friend class SumaParticipant;
- friend class Grep;
- friend class Trix;
+ friend struct SumaParticipant;
+ friend struct Grep;
+ friend struct Trix;
friend bool printSUB_SYNC_CONTINUE_REF(FILE *, const Uint32 *, Uint32, Uint16);
-public:
STATIC_CONST( SignalLength = 2 );
Uint32 subscriptionId;
Uint32 subscriptionKey;
};
-class SubSyncContinueConf {
+struct SubSyncContinueConf {
/**
* Sender(s)/Reciver(s)
*/
- friend class SumaParticipant;
- friend class Grep;
- friend class Trix;
+ friend struct SumaParticipant;
+ friend struct Grep;
+ friend struct Trix;
friend bool printSUB_SYNC_CONTINUE_CONF(FILE *, const Uint32 *, Uint32, Uint16);
-public:
STATIC_CONST( SignalLength = 2 );
Uint32 subscriptionId;
Uint32 subscriptionKey;
};
-class SubGcpCompleteRep {
+struct SubGcpCompleteRep {
/**
* Sender(s)/Reciver(s)
*/
- friend class Dbdih;
- friend class SumaParticipant;
- friend class Grep;
- friend class Trix;
+ friend struct Dbdih;
+ friend struct SumaParticipant;
+ friend struct Grep;
+ friend struct 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;
- };
+ Uint32 gcp_complete_rep_count;
};
-class SubGcpCompleteAcc {
+struct SubGcpCompleteAck {
/**
* Sender(s)/Reciver(s)
*/
-public:
STATIC_CONST( SignalLength = SubGcpCompleteRep::SignalLength );
SubGcpCompleteRep rep;
};
-class SubRemoveReq {
+struct SubRemoveReq {
/**
* Sender(s)/Reciver(s)
*/
- friend class Grep;
- friend class SumaParticipant;
+ friend struct Grep;
+ friend struct SumaParticipant;
friend bool printSUB_REMOVE_REQ(FILE *, const Uint32 *, Uint32, Uint16);
-public:
STATIC_CONST( SignalLength = 4 );
Uint32 senderRef;
@@ -482,138 +397,127 @@
Uint32 subscriptionKey;
};
-class SubRemoveRef {
+struct SubRemoveRef {
/**
* Sender(s)/Reciver(s)
*/
- friend class Grep;
- friend class SumaParticipant;
+ friend struct Grep;
+ friend struct SumaParticipant;
friend bool printSUB_REMOVE_REF(FILE *, const Uint32 *, Uint32, Uint16);
-public:
STATIC_CONST( SignalLength = 5 );
enum ErrorCode {
- Undefined = 0,
+ Undefined = 1,
NF_FakeErrorREF = 11,
- Busy = 701,
- Temporary = 0x1 << 16
+ Busy = 701
};
- 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;
- };
+ Uint32 errorCode;
+ Uint32 senderData;
};
-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 {
+struct SubRemoveConf {
/**
* Sender(s)/Reciver(s)
*/
- friend class Grep;
- friend class SumaParticipant;
+ friend struct Grep;
+ friend struct 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;
- };
-
+ Uint32 errorCode;
+ Uint32 senderData;
};
-class CreateSubscriptionIdReq {
- friend class Grep;
- friend class SumaParticipant;
+struct CreateSubscriptionIdReq {
+ friend struct Grep;
+ friend struct SumaParticipant;
friend bool printCREATE_SUBSCRIPTION_ID_REQ(FILE *, const Uint32 *,
Uint32, Uint16);
-public:
- STATIC_CONST( SignalLength = 3 );
+ STATIC_CONST( SignalLength = 2 );
- Uint32 subscriptionId;
- Uint32 subscriptionKey;
- union { // Haven't decide what to call it
- Uint32 senderData;
- Uint32 subscriberData;
- };
+ Uint32 senderRef;
+ Uint32 senderData;
};
-class CreateSubscriptionIdConf {
- friend class Grep;
- friend class SumaParticipant;
+struct CreateSubscriptionIdConf {
+ friend struct Grep;
+ friend struct SumaParticipant;
friend bool printCREATE_SUBSCRIPTION_ID_CONF(FILE *, const Uint32 *,
Uint32, Uint16);
-public:
- STATIC_CONST( SignalLength = 3 );
+ STATIC_CONST( SignalLength = 4 );
+ Uint32 senderRef;
+ Uint32 senderData;
Uint32 subscriptionId;
Uint32 subscriptionKey;
- union { // Haven't decide what to call it
- Uint32 senderData;
- Uint32 subscriberData;
- };
};
-class CreateSubscriptionIdRef {
- friend class Grep;
- friend class SumaParticipant;
+struct CreateSubscriptionIdRef {
+ friend struct Grep;
+ friend struct SumaParticipant;
friend bool printCREATE_SUBSCRIPTION_ID_REF(FILE *, const Uint32 *,
Uint32, Uint16);
-public:
- STATIC_CONST( SignalLength = 4 );
+ STATIC_CONST( SignalLength = 3 );
- Uint32 subscriptionId;
- Uint32 subscriptionKey;
- union { // Haven't decide what to call it
- Uint32 senderData;
- Uint32 subscriberData;
- };
- Uint32 err;
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 errorCode;
};
-class SumaStartMe {
-public:
+struct SumaStartMeReq {
STATIC_CONST( SignalLength = 1 );
Uint32 unused;
};
-class SumaHandoverReq {
-public:
+struct SumaStartMeRef {
STATIC_CONST( SignalLength = 1 );
- Uint32 gci;
+ Uint32 errorCode;
+ enum {
+ Busy = 0x1
+ };
};
-class SumaHandoverConf {
-public:
+struct SumaStartMeConf {
STATIC_CONST( SignalLength = 1 );
+ Uint32 unused;
+};
+
+struct SumaHandoverReq {
+ STATIC_CONST( SignalLength = 3 );
Uint32 gci;
+ Uint32 nodeId;
+ Uint32 theBucketMask[1];
};
+
+struct SumaHandoverConf {
+ STATIC_CONST( SignalLength = 3 );
+ Uint32 gci;
+ Uint32 nodeId;
+ Uint32 theBucketMask[1];
+};
+
+struct SumaContinueB
+{
+ enum
+ {
+ RESEND_BUCKET = 1
+ ,RELEASE_GCI = 2
+ ,OUT_OF_BUFFER_RELEASE = 3
+ };
+};
+
#endif
--- 1.46/storage/ndb/include/mgmapi/mgmapi.h 2005-08-08 22:21:37 +02:00
+++ 1.47/storage/ndb/include/mgmapi/mgmapi.h 2005-09-15 10:42:02 +02:00
@@ -171,7 +171,6 @@
= 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
--- 1.44/storage/ndb/include/ndbapi/Ndb.hpp 2005-07-26 13:11:34 +02:00
+++ 1.45/storage/ndb/include/ndbapi/Ndb.hpp 2005-09-15 10:42:02 +02:00
@@ -1051,6 +1051,7 @@
friend class NdbReceiver;
friend class NdbOperation;
friend class NdbEventOperationImpl;
+ friend class NdbEventBuffer;
friend class NdbTransaction;
friend class Table;
friend class NdbApiSignal;
@@ -1060,6 +1061,7 @@
friend class NdbDictionaryImpl;
friend class NdbDictInterface;
friend class NdbBlob;
+ friend class NdbImpl;
#endif
public:
@@ -1206,13 +1208,10 @@
*
* @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);
+ NdbEventOperation* createEventOperation(const char* eventName);
/**
* Drop a subscription to an event
*
@@ -1230,9 +1229,24 @@
* @param aMillisecondNumber
* maximum time to wait
*
- * @return the number of events that has occured, -1 on failure
+ * @return > 0 if events available, 0 if no events available, < 0 on failure
*/
- int pollEvents(int aMillisecondNumber);
+ int pollEvents(int aMillisecondNumber, Uint64 *latestGCI= 0);
+
+ /**
+ * Returns an event operation that has data after a pollEvents
+ *
+ * @return an event operations that has data, NULL if no events left with data.
+ */
+ NdbEventOperation *nextEvent();
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ NdbEventOperation *getEventOperation(NdbEventOperation* eventOp= 0);
+ Uint64 getLatestGCI();
+ void forceGCP();
+ void setReportThreshEventGCISlip(unsigned thresh);
+ void setReportThreshEventFreeMem(unsigned thresh);
+#endif
/** @} *********************************************************************/
@@ -1496,7 +1510,6 @@
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);
@@ -1635,7 +1648,7 @@
class NdbImpl * theImpl;
class NdbDictionaryImpl* theDictionary;
- class NdbGlobalEventBufferHandle* theGlobalEventBufferHandle;
+ class NdbEventBuffer* theEventBuffer;
NdbTransaction* theConIdleList; // First connection in idle list.
--- 1.55/storage/ndb/include/ndbapi/NdbDictionary.hpp 2005-09-15 02:31:40 +02:00
+++ 1.56/storage/ndb/include/ndbapi/NdbDictionary.hpp 2005-09-15 11:10:11 +02:00
@@ -737,6 +737,8 @@
/** @} *******************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ const char *getMysqlName() const;
+
void setStoredTable(bool x) { setLogging(x); }
bool getStoredTable() const { return getLogging(); }
@@ -949,12 +951,37 @@
/** 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)
+ TE_INSERT =1<<0, ///< Insert event on table
+ TE_DELETE =1<<1, ///< Delete event on table
+ TE_UPDATE =1<<2, ///< Update event on table
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ TE_SCAN =1<<3, ///< Scan event on table
+ TE_FIRST_NON_DATA_EVENT =1<<4,
+#endif
+ TE_DROP =1<<4, ///< Drop of table
+ TE_ALTER =1<<5, ///< Alter of table
+ TE_CREATE =1<<6, ///< Create of table
+ TE_GCP_COMPLETE=1<<7, ///< GCP is complete
+ TE_CLUSTER_FAILURE=1<<8, ///< Cluster is unavailable
+ TE_STOP =1<<9, ///< Stop of event operation
+ TE_ALL=0xFFFF ///< Any/all event on table (not relevant when
+ ///< events are received)
+ };
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ enum _TableEvent {
+ _TE_INSERT=0,
+ _TE_DELETE=1,
+ _TE_UPDATE=2,
+ _TE_SCAN=3,
+ _TE_FIRST_NON_DATA_EVENT=4,
+ _TE_DROP=4,
+ _TE_ALTER=5,
+ _TE_CREATE=6,
+ _TE_GCP_COMPLETE=7,
+ _TE_CLUSTER_FAILURE=8,
+ _TE_STOP=9
};
+#endif
/**
* Specifies the durability of an event
* (future version may supply other types)
@@ -1321,6 +1348,10 @@
*/
void invalidateIndex(const char * indexName,
const char * tableName);
+ /**
+ * Force gcp and wait for gcp complete
+ */
+ int forceGCPWait();
#endif
/** @} *******************************************************************/
--- 1.8/storage/ndb/include/ndbapi/NdbError.hpp 2005-04-08 02:43:53 +02:00
+++ 1.9/storage/ndb/include/ndbapi/NdbError.hpp 2005-09-15 10:42:02 +02:00
@@ -192,6 +192,11 @@
int code;
/**
+ * Mysql error code
+ */
+ int mysql_code;
+
+ /**
* Error message
*/
const char * message;
@@ -209,6 +214,7 @@
status = UnknownResult;
classification = NoError;
code = 0;
+ mysql_code = 0;
message = 0;
details = 0;
}
@@ -216,6 +222,7 @@
status = (NdbError::Status) ndberror.status;
classification = (NdbError::Classification) ndberror.classification;
code = ndberror.code;
+ mysql_code = ndberror.mysql_code;
message = ndberror.message;
details = ndberror.details;
}
@@ -224,6 +231,7 @@
ndberror.status = (ndberror_status_enum) status;
ndberror.classification = (ndberror_classification_enum) classification;
ndberror.code = code;
+ ndberror.mysql_code = mysql_code;
ndberror.message = message;
ndberror.details = details;
return ndberror;
--- 1.13/storage/ndb/include/ndbapi/NdbEventOperation.hpp 2005-04-08 02:43:53 +02:00
+++ 1.14/storage/ndb/include/ndbapi/NdbEventOperation.hpp 2005-09-15 10:42:02 +02:00
@@ -33,7 +33,7 @@
* - 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
+ * for an event to occur. Use Ndb::nextEvent() to iterate
* through the events that have occured.
* - The instance is removed by Ndb::dropEventOperation()
*
@@ -56,9 +56,9 @@
* - 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().
+ * after Ndb::nextEvent().
* - "False" exits from Ndb::pollEvents() may occur and thus
- * the subsequent next() will return zero,
+ * the subsequent Ndb::nextEvent() will return NULL,
* 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
@@ -86,6 +86,7 @@
enum State {
EO_CREATED, ///< Created but execute() not called
EO_EXECUTING, ///< execute() called
+ EO_DROPPED, ///< Waiting to be deleted, Object unusable.
EO_ERROR ///< An error has occurred. Object unusable.
};
/**
@@ -95,18 +96,14 @@
/**
* 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
+ * changed attribute values may be retrieved after Ndb::nextEvent()
+ * has returned not NULL. 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
@@ -129,8 +126,8 @@
* 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
+ * Ndb::nextEvent() has returned not NULL.
+ * 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.
*
@@ -149,43 +146,30 @@
*/
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);
+ int isOverrun() const;
/**
* In the current implementation a nodefailiure may cause loss of events,
* in which case isConsistent() will return false
*/
- bool isConsistent();
+ bool isConsistent() const;
/**
* Query for occured event type.
*
- * @note Only valid after next() has been called and returned value >= 0
+ * @note Only valid after Ndb::nextEvent() has been called and
+ * returned a not NULL value
*
* @return type of event
*/
- NdbDictionary::Event::TableEvent getEventType();
+ NdbDictionary::Event::TableEvent getEventType() const;
/**
* Retrieve the GCI of the latest retrieved event
*
* @return GCI number
*/
- Uint32 getGCI();
+ Uint64 getGCI() const;
/**
* Retrieve the complete GCI in the cluster (not necessarily
@@ -193,7 +177,7 @@
*
* @return GCI number
*/
- Uint32 getLatestGCI();
+ Uint64 getLatestGCI() const;
/**
* Get the latest error
@@ -203,6 +187,26 @@
const struct NdbError & getNdbError() const;
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /** these are subject to change at any time */
+ const NdbDictionary::Table *getTable() const;
+ const NdbDictionary::Event *getEvent() const;
+ const NdbRecAttr *getFirstPkAttr() const;
+ const NdbRecAttr *getFirstPkPreAttr() const;
+ const NdbRecAttr *getFirstDataAttr() const;
+ const NdbRecAttr *getFirstDataPreAttr() const;
+
+ bool validateTable(NdbDictionary::Table &table) const;
+
+ void setCustomData(void * data);
+ void * getCustomData() const;
+
+ void clearError();
+ int hasError() const;
+
+ int getReqNodeId() const;
+#endif
+
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/*
*
*/
@@ -212,11 +216,10 @@
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbEventOperationImpl;
- friend class Ndb;
+ friend class NdbEventBuffer;
#endif
- NdbEventOperation(Ndb *theNdb, const char* eventName,int bufferLength);
+ NdbEventOperation(Ndb *theNdb, const char* eventName);
~NdbEventOperation();
- static int wait(void *p, int aMillisecondNumber);
class NdbEventOperationImpl &m_impl;
NdbEventOperation(NdbEventOperationImpl& impl);
};
--- 1.23/storage/ndb/src/common/debugger/EventLogger.cpp 2005-09-06 09:11:52 +02:00
+++ 1.24/storage/ndb/src/common/debugger/EventLogger.cpp 2005-09-15 10:42:02 +02:00
@@ -16,12 +16,11 @@
#include <ndb_global.h>
-#include "EventLogger.hpp"
+#include <EventLogger.hpp>
#include <NdbConfig.h>
#include <kernel/BlockNumbers.h>
#include <signaldata/ArbitSignalData.hpp>
-#include <GrepEvent.hpp>
#include <NodeState.hpp>
#include <version.h>
@@ -571,6 +570,43 @@
void getTextInfoEvent(QQQQ) {
BaseString::snprintf(m_text, m_text_len, (char *)&theData[1]);
}
+const char bytes_unit[]= "B";
+const char kbytes_unit[]= "KB";
+const char mbytes_unit[]= "MB";
+static void convert_unit(unsigned &data, const char *&unit)
+{
+ if (data < 16*1024)
+ {
+ unit= bytes_unit;
+ return;
+ }
+ if (data < 16*1024*1024)
+ {
+ data= (data+1023)/1024;
+ unit= kbytes_unit;
+ return;
+ }
+ data= (data+1024*1024-1)/(1024*1024);
+ unit= mbytes_unit;
+}
+
+void getTextEventBufferStatus(QQQQ) {
+ unsigned used= theData[1], alloc= theData[2], max_= theData[3];
+ const char *used_unit, *alloc_unit, *max_unit;
+ convert_unit(used, used_unit);
+ convert_unit(alloc, alloc_unit);
+ convert_unit(max_, max_unit);
+ BaseString::snprintf(m_text, m_text_len,
+ "Event buffer status: used=%d%s(%d%) alloc=%d%s(%d%) "
+ "max=%d%s apply_gci=%lld latest_gci=%lld",
+ used, used_unit,
+ theData[2] ? (theData[1]*100)/theData[2] : 0,
+ alloc, alloc_unit,
+ theData[3] ? (theData[2]*100)/theData[3] : 0,
+ max_, max_unit,
+ theData[4]+(((Uint64)theData[5])<<32),
+ theData[6]+(((Uint64)theData[7])<<32));
+}
void getTextWarningEvent(QQQQ) {
BaseString::snprintf(m_text, m_text_len, (char *)&theData[1]);
}
@@ -715,6 +751,7 @@
ROW(SentHeartbeat, LogLevel::llInfo, 12, Logger::LL_INFO ),
ROW(CreateLogBytes, LogLevel::llInfo, 11, Logger::LL_INFO ),
ROW(InfoEvent, LogLevel::llInfo, 2, Logger::LL_INFO ),
+ ROW(EventBufferStatus, LogLevel::llInfo, 7, Logger::LL_INFO ),
// Backup
ROW(BackupStarted, LogLevel::llBackup, 7, Logger::LL_INFO ),
--- 1.7/storage/ndb/src/common/debugger/signaldata/SignalNames.cpp 2005-04-08 02:43:56
+02:00
+++ 1.8/storage/ndb/src/common/debugger/signaldata/SignalNames.cpp 2005-09-15 10:42:03
+02:00
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "GlobalSignalNumbers.h"
+#include <GlobalSignalNumbers.h>
const GsnName SignalNames [] = {
{ GSN_API_REGCONF, "API_REGCONF" }
@@ -506,10 +506,13 @@
,{ GSN_CREATE_EVNT_CONF, "CREATE_EVNT_CONF" }
,{ GSN_CREATE_EVNT_REF, "CREATE_EVNT_REF" }
- ,{ GSN_SUMA_START_ME, "SUMA_START_ME" }
+ ,{ GSN_SUMA_START_ME_REQ, "SUMA_START_ME_REQ" }
+ ,{ GSN_SUMA_START_ME_REF, "SUMA_START_ME_REF" }
+ ,{ GSN_SUMA_START_ME_CONF, "SUMA_START_ME_CONF" }
,{ GSN_SUMA_HANDOVER_REQ, "SUMA_HANDOVER_REQ"}
+ ,{ GSN_SUMA_HANDOVER_REF, "SUMA_HANDOVER_REF"}
,{ GSN_SUMA_HANDOVER_CONF, "SUMA_HANDOVER_CONF"}
-
+
,{ GSN_DROP_EVNT_REQ, "DROP_EVNT_REQ" }
,{ GSN_DROP_EVNT_CONF, "DROP_EVNT_CONF" }
,{ GSN_DROP_EVNT_REF, "DROP_EVNT_REF" }
@@ -555,25 +558,6 @@
,{ GSN_UTIL_RELEASE_CONF, "UTIL_RELEASE_CONF" }
,{ GSN_UTIL_RELEASE_REF, "UTIL_RELASE_REF" }
- ,{ GSN_GREP_CREATE_REQ, "GREP_CREATE_REQ" },
- { GSN_GREP_CREATE_REF, "GREP_CREATE_REF" },
- { GSN_GREP_CREATE_CONF, "GREP_CREATE_CONF" },
- { GSN_GREP_START_REQ, "GREP_START_REQ" },
- { GSN_GREP_START_REF, "GREP_START_REF" },
- { GSN_GREP_START_CONF, "GREP_START_CONF" },
- { GSN_GREP_SYNC_REQ, "GREP_SYNC_REQ" },
- { GSN_GREP_SYNC_REF, "GREP_SYNC_REF" },
- { GSN_GREP_SYNC_CONF, "GREP_SYNC_CONF" },
- //{ GSN_REP_CONNECT_REQ, "REP_CONNECT_REQ" }, Not used
- //{ GSN_REP_CONNECT_REF, "REP_CONNECT_REF" }, Not used
- //{ GSN_REP_CONNECT_CONF, "REP_CONNECT_CONF" }, Not used
- { GSN_REP_WAITGCP_REQ, "REP_WAIT_GCP_REQ" },
- { GSN_REP_WAITGCP_REF, "REP_WAIT_GCP_REF" },
- { GSN_REP_WAITGCP_CONF, "REP_WAIT_GCP_CONF" },
- { GSN_GREP_WAITGCP_REQ, "GREP_WAIT_GCP_REQ" },
- { GSN_GREP_WAITGCP_REF, "GREP_WAIT_GCP_REF" },
- { GSN_GREP_WAITGCP_CONF, "GREP_WAIT_GCP_CONF" }
-
/* Suma Block Services **/
,{ GSN_SUB_CREATE_REQ, "SUB_CREATE_REQ" }
,{ GSN_SUB_CREATE_REF, "SUB_CREATE_REF" }
@@ -596,7 +580,7 @@
,{ GSN_SUB_SYNC_CONTINUE_REF, "SUB_SYNC_CONTINUE_REF" }
,{ GSN_SUB_SYNC_CONTINUE_CONF, "SUB_SYNC_CONTINUE_CONF" }
,{ GSN_SUB_GCP_COMPLETE_REP, "SUB_GCP_COMPLETE_REP" }
- ,{ GSN_SUB_GCP_COMPLETE_ACC, "SUB_GCP_COMPLETE_ACC" }
+ ,{ GSN_SUB_GCP_COMPLETE_ACK, "SUB_GCP_COMPLETE_ACK" }
,{ GSN_CREATE_SUBID_REQ, "CREATE_SUBID_REQ" }
,{ GSN_CREATE_SUBID_REF, "CREATE_SUBID_REF" }
--- 1.3/storage/ndb/src/common/debugger/signaldata/SumaImpl.cpp 2005-04-08 02:43:56 +02:00
+++ 1.4/storage/ndb/src/common/debugger/signaldata/SumaImpl.cpp 2005-09-15 10:42:03 +02:00
@@ -20,8 +20,8 @@
printSUB_CREATE_REQ(FILE * output, const Uint32 * theData,
Uint32 len, Uint16 receiverBlockNo) {
const SubCreateReq * const sig = (SubCreateReq *)theData;
- fprintf(output, " subscriberRef: %x\n", sig->subscriberRef);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
+ fprintf(output, " senderRef: %x\n", sig->senderRef);
+ fprintf(output, " senderData: %x\n", sig->senderData);
fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
fprintf(output, " subscriptionType: %x\n", sig->subscriptionType);
@@ -33,9 +33,7 @@
printSUB_CREATE_CONF(FILE * output, const Uint32 * theData,
Uint32 len, Uint16 receiverBlockNo) {
const SubCreateConf * const sig = (SubCreateConf *)theData;
- fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
- fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
+ fprintf(output, " senderData: %x\n", sig->senderData);
return false;
}
@@ -43,9 +41,7 @@
printSUB_CREATE_REF(FILE * output, const Uint32 * theData,
Uint32 len, Uint16 receiverBlockNo) {
const SubCreateRef * const sig = (SubCreateRef *)theData;
- fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
- fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
+ fprintf(output, " senderData: %x\n", sig->senderData);
return false;
}
@@ -66,7 +62,7 @@
const SubRemoveConf * const sig = (SubRemoveConf *)theData;
fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
+ fprintf(output, " senderData: %x\n", sig->senderData);
return false;
}
@@ -77,8 +73,8 @@
const SubRemoveRef * const sig = (SubRemoveRef *)theData;
fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
- fprintf(output, " err: %x\n", sig->err);
+ fprintf(output, " senderData: %x\n", sig->senderData);
+ fprintf(output, " errorCode: %x\n", sig->errorCode);
return false;
}
@@ -88,7 +84,7 @@
const SubStartReq * const sig = (SubStartReq *)theData;
fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
+ fprintf(output, " senderData: %x\n", sig->senderData);
return false;
}
@@ -99,8 +95,8 @@
fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
fprintf(output, " startPart: %x\n", sig->part);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
- fprintf(output, " err: %x\n", sig->err);
+ fprintf(output, " senderData: %x\n", sig->senderData);
+ fprintf(output, " errorCode: %x\n", sig->errorCode);
return false;
}
@@ -111,7 +107,7 @@
fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
fprintf(output, " startPart: %x\n", sig->part);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
+ fprintf(output, " senderData: %x\n", sig->senderData);
return false;
}
@@ -121,7 +117,7 @@
const SubStopReq * const sig = (SubStopReq *)theData;
fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
+ fprintf(output, " senderData: %x\n", sig->senderData);
return false;
}
@@ -131,8 +127,8 @@
const SubStopRef * const sig = (SubStopRef *)theData;
fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
- fprintf(output, " err: %x\n", sig->err);
+ fprintf(output, " senderData: %x\n", sig->senderData);
+ fprintf(output, " errorCode: %x\n", sig->errorCode);
return false;
}
@@ -142,7 +138,7 @@
const SubStopConf * const sig = (SubStopConf *)theData;
fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
+ fprintf(output, " senderData: %x\n", sig->senderData);
return false;
}
@@ -160,11 +156,8 @@
printSUB_SYNC_REF(FILE * output, const Uint32 * theData,
Uint32 len, Uint16 receiverBlockNo) {
const SubSyncRef * const sig = (SubSyncRef *)theData;
- fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
- fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
- fprintf(output, " syncPart: %x\n", sig->part);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
- fprintf(output, " err: %x\n", sig->err);
+ fprintf(output, " senderData: %x\n", sig->senderData);
+ fprintf(output, " errorCode: %x\n", sig->errorCode);
return false;
}
@@ -172,10 +165,7 @@
printSUB_SYNC_CONF(FILE * output, const Uint32 * theData,
Uint32 len, Uint16 receiverBlockNo) {
const SubSyncConf * const sig = (SubSyncConf *)theData;
- fprintf(output, " subscriptionId: %x\n", sig->subscriptionId);
- fprintf(output, " subscriptionKey: %x\n", sig->subscriptionKey);
- fprintf(output, " syncPart: %x\n", sig->part);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
+ fprintf(output, " senderData: %x\n", sig->senderData);
return false;
}
@@ -185,7 +175,7 @@
const SubMetaData * const sig = (SubMetaData *)theData;
fprintf(output, " gci: %x\n", sig->gci);
fprintf(output, " senderData: %x\n", sig->senderData);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
+ fprintf(output, " senderData: %x\n", sig->senderData);
fprintf(output, " tableId: %x\n", sig->tableId);
return false;
}
@@ -195,12 +185,10 @@
Uint32 len, Uint16 receiverBlockNo) {
const SubTableData * const sig = (SubTableData *)theData;
fprintf(output, " senderData: %x\n", sig->senderData);
- fprintf(output, " subscriberData: %x\n", sig->subscriberData);
+ fprintf(output, " senderData: %x\n", sig->senderData);
fprintf(output, " gci: %x\n", sig->gci);
fprintf(output, " tableId: %x\n", sig->tableId);
fprintf(output, " operation: %x\n", sig->operation);
- fprintf(output, " noOfAttributes: %x\n", sig->noOfAttributes);
- fprintf(output, " dataSize: %x\n", sig->dataSize);
return false;
}
--- 1.30/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp 2005-07-19 20:40:16 +02:00
+++ 1.31/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp 2005-09-15 10:42:03 +02:00
@@ -62,7 +62,10 @@
if (ndb_mgm_set_connectstring(m_handle, _connect_string))
{
- setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
+ BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
+ tmp.append(" : ");
+ tmp.append(ndb_mgm_get_latest_error_desc(m_handle));
+ setError(CR_ERROR, tmp.c_str());
DBUG_VOID_RETURN;
}
resetError();
@@ -147,7 +150,10 @@
ndb_mgm_configuration * conf = ndb_mgm_get_configuration(m_handle,m_version);
if(conf == 0)
{
- setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
+ BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
+ tmp.append(" : ");
+ tmp.append(ndb_mgm_get_latest_error_desc(m_handle));
+ setError(CR_ERROR, tmp.c_str());
return 0;
}
return conf;
@@ -349,7 +355,10 @@
no_retries--;
NdbSleep_SecSleep(retry_delay_in_seconds);
}
- setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
+ BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
+ tmp.append(" : ");
+ tmp.append(ndb_mgm_get_latest_error_desc(m_handle));
+ setError(CR_ERROR, tmp.c_str());
} else
setError(CR_ERROR, "management server handle not initialized");
return 0;
--- 1.21/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp 2005-08-25 18:49:46 +02:00
+++ 1.22/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp 2005-09-15 10:42:03 +02:00
@@ -117,7 +117,6 @@
break;
case NodeInfo::API:
case NodeInfo::MGM:
- case NodeInfo::REP:
break;
default:
ndbrequire(false);
@@ -189,6 +188,12 @@
//-----------------------------------------------------------------------
EventReport * const eventReport = (EventReport *)&signal->theData[0];
Ndb_logevent_type eventType = eventReport->getEventType();
+ Uint32 nodeId= eventReport->getNodeId();
+ if (nodeId == 0)
+ {
+ nodeId= refToNode(signal->getSendersBlockRef());
+ eventReport->setNodeId(nodeId);
+ }
jamEntry();
@@ -322,10 +327,6 @@
signal->theData[1] = 0; // no id
signal->theData[2] = NodeInfo::API;
execOPEN_COMREQ(signal);
- signal->theData[0] = 0; // no answer
- signal->theData[1] = 0; // no id
- signal->theData[2] = NodeInfo::REP;
- execOPEN_COMREQ(signal);
globalData.theStartLevel = NodeState::SL_STARTED;
sendSTTORRY(signal);
} else {
@@ -1023,9 +1024,6 @@
break;
case NodeInfo::MGM:
nodeTypeStr = "MGM";
- break;
- case NodeInfo::REP:
- nodeTypeStr = "REP";
break;
case NodeInfo::INVALID:
nodeTypeStr = 0;
--- 1.53/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2005-09-06 06:51:57 +02:00
+++ 1.54/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2005-09-15 10:42:04 +02:00
@@ -60,8 +60,6 @@
#include <signaldata/UtilExecute.hpp>
#include <signaldata/UtilRelease.hpp>
#include <signaldata/SumaImpl.hpp>
-#include <GrepError.hpp>
-//#include <signaldata/DropEvnt.hpp>
#include <signaldata/LqhFrag.hpp>
@@ -1290,9 +1288,6 @@
addRecSignal(GSN_SUB_STOP_CONF, &Dbdict::execSUB_STOP_CONF);
addRecSignal(GSN_SUB_STOP_REF, &Dbdict::execSUB_STOP_REF);
- addRecSignal(GSN_SUB_SYNC_CONF, &Dbdict::execSUB_SYNC_CONF);
- addRecSignal(GSN_SUB_SYNC_REF, &Dbdict::execSUB_SYNC_REF);
-
addRecSignal(GSN_DROP_EVNT_REQ, &Dbdict::execDROP_EVNT_REQ);
addRecSignal(GSN_SUB_REMOVE_REQ, &Dbdict::execSUB_REMOVE_REQ);
@@ -2690,13 +2685,27 @@
c_tableRecordPool.getPtr(tabPtr, createTabPtr.p->m_tablePtrI);
tabPtr.p->tabState = TableRecord::DEFINED;
- c_opCreateTable.release(createTabPtr);
+ releaseCreateTableOp(signal,createTabPtr);
c_restartRecord.activeTable++;
checkSchemaStatus(signal);
}
void
+Dbdict::releaseCreateTableOp(Signal* signal, CreateTableRecordPtr createTabPtr)
+{
+ if (createTabPtr.p->m_tabInfoPtrI != RNIL)
+ {
+ jam();
+ SegmentedSectionPtr tabInfoPtr;
+ getSection(tabInfoPtr, createTabPtr.p->m_tabInfoPtrI);
+ signal->setSection(tabInfoPtr, 0);
+ releaseSections(signal);
+ }
+ c_opCreateTable.release(createTabPtr);
+}
+
+void
Dbdict::restartDropTab(Signal* signal, Uint32 tableId){
const Uint32 key = ++c_opRecordSequence;
@@ -3777,7 +3786,7 @@
TableRecordPtr tabPtr;
c_tableRecordPool.getPtr(tabPtr, alterTabPtr.p->m_tablePtrI);
releaseTableObject(tabPtr.i, false);
- c_opCreateTable.release(alterTabPtr);
+ releaseCreateTableOp(signal,alterTabPtr);
c_blockState = BS_IDLE;
}
else {
@@ -3891,6 +3900,7 @@
writeTableFile(signal, tableId, tabInfoPtr, &callback);
+ alterTabPtr.p->m_tabInfoPtrI = RNIL;
signal->setSection(tabInfoPtr, 0);
releaseSections(signal);
}
@@ -3915,6 +3925,17 @@
conf->tableVersion = tabPtr.p->tableVersion;
conf->gci = tabPtr.p->gciTableCreated;
conf->requestType = AlterTabReq::AlterTableCommit;
+ {
+ AlterTabConf tmp= *conf;
+ if (coordinatorRef == reference())
+ conf->senderRef = alterTabPtr.p->m_senderRef;
+ else
+ conf->senderRef = 0;
+ EXECUTE_DIRECT(SUMA, GSN_ALTER_TAB_CONF, signal,
+ AlterTabConf::SignalLength);
+ jamEntry();
+ *conf= tmp;
+ }
sendSignal(coordinatorRef, GSN_ALTER_TAB_CONF, signal,
AlterTabConf::SignalLength, JBB);
@@ -3943,7 +3964,7 @@
// Release resources
c_tableRecordPool.getPtr(tabPtr, alterTabPtr.p->m_tablePtrI);
releaseTableObject(tabPtr.i, false);
- c_opCreateTable.release(alterTabPtr);
+ releaseCreateTableOp(signal,alterTabPtr);
c_blockState = BS_IDLE;
}
}
@@ -4133,7 +4154,7 @@
//@todo check api failed
sendSignal(createTabPtr.p->m_senderRef, GSN_CREATE_TABLE_REF, signal,
CreateTableRef::SignalLength, JBB);
- c_opCreateTable.release(createTabPtr);
+ releaseCreateTableOp(signal,createTabPtr);
c_blockState = BS_IDLE;
return;
}
@@ -4192,7 +4213,7 @@
//@todo check api failed
sendSignal(createTabPtr.p->m_senderRef, GSN_CREATE_TABLE_CONF, signal,
CreateTableConf::SignalLength, JBB);
- c_opCreateTable.release(createTabPtr);
+ releaseCreateTableOp(signal,createTabPtr);
c_blockState = BS_IDLE;
return;
}
@@ -4323,10 +4344,11 @@
SegmentedSectionPtr tabInfoPtr;
getSection(tabInfoPtr, createTabPtr.p->m_tabInfoPtrI);
writeTableFile(signal, createTabPtr.p->m_tablePtrI, tabInfoPtr, &callback);
-
+#if 0
createTabPtr.p->m_tabInfoPtrI = RNIL;
signal->setSection(tabInfoPtr, 0);
releaseSections(signal);
+#endif
}
void
@@ -4814,12 +4836,28 @@
CreateTabConf * const conf = (CreateTabConf*)signal->getDataPtr();
conf->senderRef = reference();
conf->senderData = createTabPtr.p->key;
+ {
+ CreateTabConf tmp= *conf;
+ conf->senderData = createTabPtr.p->m_tablePtrI;
+#if 0
+ signal->header.m_noOfSections = 1;
+ SegmentedSectionPtr tabInfoPtr;
+ getSection(tabInfoPtr, createTabPtr.p->m_tabInfoPtrI);
+ signal->setSection(tabInfoPtr, 0);
+#endif
+ sendSignal(SUMA_REF, GSN_CREATE_TAB_CONF, signal,
+ CreateTabConf::SignalLength, JBB);
+ *conf= tmp;
+#if 0
+ signal->header.m_noOfSections = 0;
+#endif
+ }
sendSignal(createTabPtr.p->m_coordinatorRef, GSN_CREATE_TAB_CONF,
signal, CreateTabConf::SignalLength, JBB);
if(createTabPtr.p->m_coordinatorRef != reference()){
jam();
- c_opCreateTable.release(createTabPtr);
+ releaseCreateTableOp(signal,createTabPtr);
}
}
@@ -4887,7 +4925,7 @@
if(createTabPtr.p->m_coordinatorRef != reference()){
jam();
- c_opCreateTable.release(createTabPtr);
+ releaseCreateTableOp(signal,createTabPtr);
}
c_opDropTable.release(dropTabPtr);
@@ -5056,7 +5094,8 @@
if (parseP->requestType != DictTabInfo::AlterTableFromAPI) {
jam();
#ifdef VM_TRACE
- ndbout_c("Dbdict: name=%s,id=%u", tablePtr.p->tableName, tablePtr.i);
+ ndbout_c("Dbdict: name=%s, id=%u, version=%u",
+ tablePtr.p->tableName, tablePtr.i, tablePtr.p->tableVersion);
TableRecordPtr tmp;
ndbrequire(!c_tableRecordHash.find(tmp, * tablePtr.p));
#endif
@@ -5705,7 +5744,6 @@
conf->senderData = dropTabPtr.p->m_request.senderData;
conf->tableId = dropTabPtr.p->m_request.tableId;
conf->tableVersion = dropTabPtr.p->m_request.tableVersion;
-
Uint32 ref = dropTabPtr.p->m_request.senderRef;
sendSignal(ref, GSN_DROP_TABLE_CONF, signal,
DropTableConf::SignalLength, JBB);
@@ -5966,7 +6004,17 @@
conf->senderRef = reference();
conf->senderData = dropTabPtrI;
conf->tableId = dropTabPtr.p->m_request.tableId;
-
+ {
+ DropTabConf tmp= *conf;
+ if (dropTabPtr.p->m_coordinatorRef == reference())
+ conf->senderRef = dropTabPtr.p->m_request.senderRef;
+ else
+ conf->senderRef = 0;
+ EXECUTE_DIRECT(SUMA, GSN_DROP_TAB_CONF, signal,
+ DropTabConf::SignalLength);
+ jamEntry();
+ *conf= tmp;
+ }
dropTabPtr.p->m_participantData.m_gsn = GSN_DROP_TAB_CONF;
sendSignal(dropTabPtr.p->m_coordinatorRef, GSN_DROP_TAB_CONF, signal,
DropTabConf::SignalLength, JBB);
@@ -6113,7 +6161,7 @@
* The format of GetTabInfo Req/Ref is the same
*/
BlockReference retRef = req->senderRef;
- ref->err = errorCode;
+ ref->err = errorCode;
sendSignal(retRef, GSN_GET_TABLEID_REF, signal,
GetTableIdRef::SignalLength, JBB);
}//sendGET_TABINFOREF()
@@ -7538,6 +7586,8 @@
const Uint32 Dbdict::sysTab_NDBEVENTS_0_szs[EVENT_SYSTEM_TABLE_LENGTH] = {
sizeof(((sysTab_NDBEVENTS_0*)0)->NAME),
sizeof(((sysTab_NDBEVENTS_0*)0)->EVENT_TYPE),
+ sizeof(((sysTab_NDBEVENTS_0*)0)->TABLEID),
+ sizeof(((sysTab_NDBEVENTS_0*)0)->TABLEVERSION),
sizeof(((sysTab_NDBEVENTS_0*)0)->TABLE_NAME),
sizeof(((sysTab_NDBEVENTS_0*)0)->ATTRIBUTE_MASK),
sizeof(((sysTab_NDBEVENTS_0*)0)->SUBID),
@@ -7755,7 +7805,7 @@
CreateEvntRef * ret = (CreateEvntRef *)signal->getDataPtrSend();
ret->senderRef = reference();
- ret->setErrorCode(CreateEvntRef::SeizeError);
+ ret->setErrorCode(747);
ret->setErrorLine(__LINE__);
ret->setErrorNode(reference());
sendSignal(signal->senderBlockRef(), GSN_CREATE_EVNT_REF, signal,
@@ -7796,7 +7846,7 @@
jam();
releaseSections(signal);
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 1;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
@@ -7810,8 +7860,10 @@
*****************************************************************/
void
-Dbdict::createEvent_RT_USER_CREATE(Signal* signal, OpCreateEventPtr evntRecPtr){
+Dbdict::createEvent_RT_USER_CREATE(Signal* signal, OpCreateEventPtr evntRecPtr)
+{
jam();
+ DBUG_ENTER("Dbdict::createEvent_RT_USER_CREATE");
evntRecPtr.p->m_request.setUserRef(signal->senderBlockRef());
#ifdef EVENT_DEBUG
@@ -7839,12 +7891,12 @@
jam();
releaseSections(signal);
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 1;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
createEvent_sendReply(signal, evntRecPtr);
- return;
+ DBUG_VOID_RETURN;
}
r0.getString(evntRecPtr.p->m_eventRec.NAME);
{
@@ -7865,24 +7917,19 @@
jam();
releaseSections(signal);
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 1;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
createEvent_sendReply(signal, evntRecPtr);
- return;
+ DBUG_VOID_RETURN;
}
r0.getString(evntRecPtr.p->m_eventRec.TABLE_NAME);
{
int len = strlen(evntRecPtr.p->m_eventRec.TABLE_NAME);
memset(evntRecPtr.p->m_eventRec.TABLE_NAME+len, 0, MAX_TAB_NAME_SIZE-len);
}
-
-#ifdef EVENT_DEBUG
- ndbout_c("event name: %s",evntRecPtr.p->m_eventRec.NAME);
- ndbout_c("table name: %s",evntRecPtr.p->m_eventRec.TABLE_NAME);
-#endif
-
+
releaseSections(signal);
// Send request to SUMA
@@ -7891,6 +7938,7 @@
(CreateSubscriptionIdReq *)signal->getDataPtrSend();
// make sure we save the original sender for later
+ sumaIdReq->senderRef = reference();
sumaIdReq->senderData = evntRecPtr.i;
#ifdef EVENT_DEBUG
ndbout << "sumaIdReq->senderData = " << sumaIdReq->senderData
<< endl;
@@ -7899,12 +7947,13 @@
CreateSubscriptionIdReq::SignalLength, JBB);
// we should now return in either execCREATE_SUBID_CONF
// or execCREATE_SUBID_REF
+ DBUG_VOID_RETURN;
}
void Dbdict::execCREATE_SUBID_REF(Signal* signal)
{
- jamEntry();
- EVENT_TRACE;
+ jamEntry();
+ DBUG_ENTER("Dbdict::execCREATE_SUBID_REF");
CreateSubscriptionIdRef * const ref =
(CreateSubscriptionIdRef *)signal->getDataPtr();
OpCreateEventPtr evntRecPtr;
@@ -7912,17 +7961,26 @@
evntRecPtr.i = ref->senderData;
ndbrequire((evntRecPtr.p = c_opCreateEvent.getPtr(evntRecPtr.i)) != NULL);
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
- evntRecPtr.p->m_errorLine = __LINE__;
+ if (ref->errorCode)
+ {
+ evntRecPtr.p->m_errorCode = ref->errorCode;
+ evntRecPtr.p->m_errorLine = __LINE__;
+ }
+ else
+ {
+ evntRecPtr.p->m_errorCode = 1;
+ evntRecPtr.p->m_errorLine = __LINE__;
+ }
evntRecPtr.p->m_errorNode = reference();
createEvent_sendReply(signal, evntRecPtr);
+ DBUG_VOID_RETURN;
}
void Dbdict::execCREATE_SUBID_CONF(Signal* signal)
{
jamEntry();
- EVENT_TRACE;
+ DBUG_ENTER("Dbdict::execCREATE_SUBID_CONF");
CreateSubscriptionIdConf const * sumaIdConf =
(CreateSubscriptionIdConf *)signal->getDataPtr();
@@ -7941,6 +7999,7 @@
prepareTransactionEventSysTable(&c, signal, evntRecId,
UtilPrepareReq::Insert);
+ DBUG_VOID_RETURN;
}
void
@@ -7958,46 +8017,47 @@
*/
void interpretUtilPrepareErrorCode(UtilPrepareRef::ErrorCode errorCode,
- bool& temporary, Uint32& line)
+ Uint32& error, Uint32& line)
{
+ DBUG_ENTER("interpretUtilPrepareErrorCode");
switch (errorCode) {
case UtilPrepareRef::NO_ERROR:
jam();
+ error = 1;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
case UtilPrepareRef::PREPARE_SEIZE_ERROR:
jam();
- temporary = true;
+ error = 748;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
case UtilPrepareRef::PREPARE_PAGES_SEIZE_ERROR:
jam();
+ error = 1;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
case UtilPrepareRef::PREPARED_OPERATION_SEIZE_ERROR:
jam();
+ error = 1;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
case UtilPrepareRef::DICT_TAB_INFO_ERROR:
jam();
+ error = 1;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
case UtilPrepareRef::MISSING_PROPERTIES_SECTION:
jam();
+ error = 1;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
default:
jam();
+ error = 1;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
}
+ DBUG_VOID_RETURN;
}
void
@@ -8020,25 +8080,28 @@
switch (evntRecPtr.p->m_requestType) {
case CreateEvntReq::RT_USER_GET:
-#ifdef EVENT_DEBUG
- printf("get type = %d\n", CreateEvntReq::RT_USER_GET);
-#endif
jam();
executeTransEventSysTable(&c, signal,
evntRecPtr.i, evntRecPtr.p->m_eventRec,
prepareId, UtilPrepareReq::Read);
break;
case CreateEvntReq::RT_USER_CREATE:
-#ifdef EVENT_DEBUG
- printf("create type = %d\n", CreateEvntReq::RT_USER_CREATE);
-#endif
{
evntRecPtr.p->m_eventRec.EVENT_TYPE = evntRecPtr.p->m_request.getEventType();
+ evntRecPtr.p->m_eventRec.TABLEID = evntRecPtr.p->m_request.getTableId();
+ evntRecPtr.p->m_eventRec.TABLEVERSION=evntRecPtr.p->m_request.getTableVersion();
AttributeMask m = evntRecPtr.p->m_request.getAttrListBitmask();
memcpy(evntRecPtr.p->m_eventRec.ATTRIBUTE_MASK, &m,
sizeof(evntRecPtr.p->m_eventRec.ATTRIBUTE_MASK));
evntRecPtr.p->m_eventRec.SUBID = evntRecPtr.p->m_request.getEventId();
evntRecPtr.p->m_eventRec.SUBKEY = evntRecPtr.p->m_request.getEventKey();
+ DBUG_PRINT("info",
+ ("CREATE: event name: %s table name: %s table id: %u table version: %u",
+ evntRecPtr.p->m_eventRec.NAME,
+ evntRecPtr.p->m_eventRec.TABLE_NAME,
+ evntRecPtr.p->m_eventRec.TABLEID,
+ evntRecPtr.p->m_eventRec.TABLEVERSION));
+
}
jam();
executeTransEventSysTable(&c, signal,
@@ -8063,17 +8126,9 @@
evntRecPtr.i = ref->getSenderData();
ndbrequire((evntRecPtr.p = c_opCreateEvent.getPtr(evntRecPtr.i)) != NULL);
- bool temporary = false;
- interpretUtilPrepareErrorCode(errorCode,
- temporary, evntRecPtr.p->m_errorLine);
- if (temporary) {
- evntRecPtr.p->m_errorCode =
- CreateEvntRef::makeTemporary(CreateEvntRef::Undefined);
- }
-
- if (evntRecPtr.p->m_errorCode == 0) {
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
- }
+ Uint32 err;
+ interpretUtilPrepareErrorCode(errorCode, evntRecPtr.p->m_errorCode,
+ evntRecPtr.p->m_errorLine);
evntRecPtr.p->m_errorNode = reference();
createEvent_sendReply(signal, evntRecPtr);
@@ -8244,20 +8299,22 @@
switch (evntRec->m_requestType) {
case CreateEvntReq::RT_USER_GET: {
-#ifdef EVENT_DEBUG
- printf("get type = %d\n", CreateEvntReq::RT_USER_GET);
-#endif
parseReadEventSys(signal, evntRecPtr.p->m_eventRec);
evntRec->m_request.setEventType(evntRecPtr.p->m_eventRec.EVENT_TYPE);
-
evntRec->m_request.setAttrListBitmask(*(AttributeMask*)evntRecPtr.p->m_eventRec.ATTRIBUTE_MASK);
+ evntRec->m_request.setTableId(evntRecPtr.p->m_eventRec.TABLEID);
+ evntRec->m_request.setTableVersion(evntRecPtr.p->m_eventRec.TABLEVERSION);
+ evntRec->m_request.setAttrListBitmask(*(AttributeMask*)
+ evntRecPtr.p->m_eventRec.ATTRIBUTE_MASK);
evntRec->m_request.setEventId(evntRecPtr.p->m_eventRec.SUBID);
evntRec->m_request.setEventKey(evntRecPtr.p->m_eventRec.SUBKEY);
-#ifdef EVENT_DEBUG
- printf("EventName: %s\n", evntRec->m_eventRec.NAME);
- printf("TableName: %s\n", evntRec->m_eventRec.TABLE_NAME);
-#endif
+ DBUG_PRINT("info",
+ ("GET: event name: %s table name: %s table id: %u table version: %u",
+ evntRecPtr.p->m_eventRec.NAME,
+ evntRecPtr.p->m_eventRec.TABLE_NAME,
+ evntRecPtr.p->m_eventRec.TABLEID,
+ evntRecPtr.p->m_eventRec.TABLEVERSION));
// find table id for event table
TableRecord keyRecord;
@@ -8268,7 +8325,7 @@
if (tablePtr.i == RNIL) {
jam();
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 723;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
@@ -8277,6 +8334,7 @@
}
evntRec->m_request.setTableId(tablePtr.p->tableId);
+ evntRec->m_request.setTableVersion(tablePtr.p->tableVersion);
createEventComplete_RT_USER_GET(signal, evntRecPtr);
return;
@@ -8307,21 +8365,21 @@
switch (ref->getTCErrorCode()) {
case ZNOT_FOUND:
jam();
- evntRecPtr.p->m_errorCode = CreateEvntRef::EventNotFound;
+ evntRecPtr.p->m_errorCode = 4710;
break;
case ZALREADYEXIST:
jam();
- evntRecPtr.p->m_errorCode = CreateEvntRef::EventNameExists;
+ evntRecPtr.p->m_errorCode = 746;
break;
default:
jam();
- evntRecPtr.p->m_errorCode = CreateEvntRef::UndefinedTCError;
+ evntRecPtr.p->m_errorCode = ref->getTCErrorCode();
break;
}
break;
default:
jam();
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = ref->getErrorCode();
break;
}
@@ -8357,7 +8415,7 @@
jam();
releaseSections(signal);
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 1;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
@@ -8493,8 +8551,8 @@
SubCreateReq * sumaReq = (SubCreateReq *)signal->getDataPtrSend();
- sumaReq->subscriberRef = reference(); // reference to DICT
- sumaReq->subscriberData = evntRecPtr.i;
+ sumaReq->senderRef = reference(); // reference to DICT
+ sumaReq->senderData = evntRecPtr.i;
sumaReq->subscriptionId = evntRecPtr.p->m_request.getEventId();
sumaReq->subscriptionKey = evntRecPtr.p->m_request.getEventKey();
sumaReq->subscriptionType = SubCreateReq::TableEvent;
@@ -8505,106 +8563,56 @@
#endif
sendSignal(SUMA_REF, GSN_SUB_CREATE_REQ, signal,
- SubCreateReq::SignalLength+1 /*to get table Id*/, JBB);
+ SubCreateReq::SignalLength, JBB);
}
void Dbdict::execSUB_CREATE_REF(Signal* signal)
{
jamEntry();
- EVENT_TRACE;
+ DBUG_ENTER("Dbdict::execSUB_CREATE_REF");
+
SubCreateRef * const ref = (SubCreateRef *)signal->getDataPtr();
OpCreateEventPtr evntRecPtr;
- evntRecPtr.i = ref->subscriberData;
+ evntRecPtr.i = ref->senderData;
ndbrequire((evntRecPtr.p = c_opCreateEvent.getPtr(evntRecPtr.i)) != NULL);
-#ifdef EVENT_PH2_DEBUG
- ndbout_c("DBDICT(Participant) got SUB_CREATE_REF evntRecPtr.i = (%d)", evntRecPtr.i);
-#endif
-
- if (ref->err == GrepError::SUBSCRIPTION_ID_NOT_UNIQUE) {
+ if (ref->errorCode == 1415) {
jam();
-#ifdef EVENT_PH2_DEBUG
- ndbout_c("SUBSCRIPTION_ID_NOT_UNIQUE");
-#endif
createEvent_sendReply(signal, evntRecPtr);
- return;
+ DBUG_VOID_RETURN;
}
-#ifdef EVENT_PH2_DEBUG
- ndbout_c("Other error");
-#endif
-
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
- evntRecPtr.p->m_errorLine = __LINE__;
+ if (ref->errorCode)
+ {
+ evntRecPtr.p->m_errorCode = ref->errorCode;
+ evntRecPtr.p->m_errorLine = __LINE__;
+ }
+ else
+ {
+ evntRecPtr.p->m_errorCode = 1;
+ evntRecPtr.p->m_errorLine = __LINE__;
+ }
evntRecPtr.p->m_errorNode = reference();
createEvent_sendReply(signal, evntRecPtr);
+ DBUG_VOID_RETURN;
}
void Dbdict::execSUB_CREATE_CONF(Signal* signal)
{
jamEntry();
+ DBUG_ENTER("Dbdict::execSUB_CREATE_CONF");
EVENT_TRACE;
SubCreateConf * const sumaConf = (SubCreateConf *)signal->getDataPtr();
-
- const Uint32 subscriptionId = sumaConf->subscriptionId;
- const Uint32 subscriptionKey = sumaConf->subscriptionKey;
- const Uint32 evntRecId = sumaConf->subscriberData;
-
- OpCreateEvent *evntRec;
- ndbrequire((evntRec = c_opCreateEvent.getPtr(evntRecId)) != NULL);
-
-#ifdef EVENT_PH2_DEBUG
- ndbout_c("DBDICT(Participant) got SUB_CREATE_CONF evntRecPtr.i = (%d)", evntRecId);
-#endif
-
- SubSyncReq *sumaSync = (SubSyncReq *)signal->getDataPtrSend();
-
- sumaSync->subscriptionId = subscriptionId;
- sumaSync->subscriptionKey = subscriptionKey;
- sumaSync->part = (Uint32) SubscriptionData::MetaData;
- sumaSync->subscriberData = evntRecId;
-
- sendSignal(SUMA_REF, GSN_SUB_SYNC_REQ, signal,
- SubSyncReq::SignalLength, JBB);
-}
-
-void Dbdict::execSUB_SYNC_REF(Signal* signal)
-{
- jamEntry();
- EVENT_TRACE;
- SubSyncRef * const ref = (SubSyncRef *)signal->getDataPtr();
OpCreateEventPtr evntRecPtr;
-
- evntRecPtr.i = ref->subscriberData;
+ evntRecPtr.i = sumaConf->senderData;
ndbrequire((evntRecPtr.p = c_opCreateEvent.getPtr(evntRecPtr.i)) != NULL);
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
- evntRecPtr.p->m_errorLine = __LINE__;
- evntRecPtr.p->m_errorNode = reference();
-
createEvent_sendReply(signal, evntRecPtr);
-}
-
-void Dbdict::execSUB_SYNC_CONF(Signal* signal)
-{
- jamEntry();
- EVENT_TRACE;
-
- SubSyncConf * const sumaSyncConf = (SubSyncConf *)signal->getDataPtr();
-
- // Uint32 subscriptionId = sumaSyncConf->subscriptionId;
- // Uint32 subscriptionKey = sumaSyncConf->subscriptionKey;
- OpCreateEventPtr evntRecPtr;
- evntRecPtr.i = sumaSyncConf->subscriberData;
- ndbrequire((evntRecPtr.p = c_opCreateEvent.getPtr(evntRecPtr.i)) != NULL);
-
- ndbrequire(sumaSyncConf->part == (Uint32)SubscriptionData::MetaData);
-
- createEvent_sendReply(signal, evntRecPtr);
+ DBUG_VOID_RETURN;
}
/****************************************************
@@ -8631,7 +8639,7 @@
if (evntRecPtr.p->m_reqTracker.hasRef()) {
ptr = NULL; // we don't want to return anything if there's an error
if (!evntRecPtr.p->hasError()) {
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 1;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
jam();
@@ -8655,6 +8663,7 @@
ret->setUserData(evntRecPtr.p->m_request.getUserData());
ret->senderRef = reference();
ret->setTableId(evntRecPtr.p->m_request.getTableId());
+ ret->setTableVersion(evntRecPtr.p->m_request.getTableVersion());
ret->setEventType(evntRecPtr.p->m_request.getEventType());
ret->setRequestType(evntRecPtr.p->m_request.getRequestType());
@@ -8680,6 +8689,7 @@
evntConf->setUserData(evntRecPtr.p->m_request.getUserData());
evntConf->senderRef = reference();
evntConf->setTableId(evntRecPtr.p->m_request.getTableId());
+ evntConf->setTableVersion(evntRecPtr.p->m_request.getTableVersion());
evntConf->setAttrListBitmask(evntRecPtr.p->m_request.getAttrListBitmask());
evntConf->setEventType(evntRecPtr.p->m_request.getEventType());
evntConf->setRequestType(evntRecPtr.p->m_request.getRequestType());
@@ -8728,7 +8738,7 @@
// ret->setErrorLine(__LINE__);
// ret->setErrorNode(reference());
ref->senderRef = reference();
- ref->setTemporary(SubStartRef::Busy);
+ ref->errorCode = SubStartRef::Busy;
sendSignal(origSenderRef, GSN_SUB_START_REF, signal,
SubStartRef::SignalLength2, JBB);
@@ -8789,6 +8799,7 @@
const SubStartRef* ref = (SubStartRef*) signal->getDataPtr();
Uint32 senderRef = ref->senderRef;
+ Uint32 err = ref->errorCode;
OpSubEventPtr subbPtr;
c_opSubEvent.getPtr(subbPtr, ref->senderData);
@@ -8803,27 +8814,13 @@
ndbout_c("DBDICT(Participant) got GSN_SUB_START_REF = (%d)", subbPtr.i);
#endif
- if (ref->isTemporary()){
- jam();
- SubStartReq* req = (SubStartReq*)signal->getDataPtrSend();
- { // fix
- Uint32 subscriberRef = ref->subscriberRef;
- req->subscriberRef = subscriberRef;
- }
- req->senderRef = reference();
- req->senderData = subbPtr.i;
- sendSignal(SUMA_REF, GSN_SUB_START_REQ,
- signal, SubStartReq::SignalLength2, JBB);
- } else {
- jam();
-
- SubStartRef* ref = (SubStartRef*) signal->getDataPtrSend();
- ref->senderRef = reference();
- ref->senderData = subbPtr.p->m_senderData;
- sendSignal(subbPtr.p->m_senderRef, GSN_SUB_START_REF,
- signal, SubStartRef::SignalLength2, JBB);
- c_opSubEvent.release(subbPtr);
- }
+ jam();
+ SubStartRef* ref = (SubStartRef*) signal->getDataPtrSend();
+ ref->senderRef = reference();
+ ref->senderData = subbPtr.p->m_senderData;
+ sendSignal(subbPtr.p->m_senderRef, GSN_SUB_START_REF,
+ signal, SubStartRef::SignalLength2, JBB);
+ c_opSubEvent.release(subbPtr);
return;
}
/*
@@ -8833,11 +8830,15 @@
#ifdef EVENT_PH3_DEBUG
ndbout_c("DBDICT(Coordinator) got GSN_SUB_START_REF = (%d)", subbPtr.i);
#endif
- if (ref->errorCode == SubStartRef::NF_FakeErrorREF){
+ if (err == SubStartRef::NF_FakeErrorREF){
jam();
subbPtr.p->m_reqTracker.ignoreRef(c_counterMgr, refToNode(senderRef));
} else {
jam();
+ if (subbPtr.p->m_errorCode == 0)
+ {
+ subbPtr.p->m_errorCode= err ? err : 1;
+ }
subbPtr.p->m_reqTracker.reportRef(c_counterMgr, refToNode(senderRef));
}
completeSubStartReq(signal,subbPtr.i,0);
@@ -8940,7 +8941,7 @@
// ret->setErrorLine(__LINE__);
// ret->setErrorNode(reference());
ref->senderRef = reference();
- ref->setTemporary(SubStopRef::Busy);
+ ref->errorCode = SubStopRef::Busy;
sendSignal(origSenderRef, GSN_SUB_STOP_REF, signal,
SubStopRef::SignalLength, JBB);
@@ -8997,6 +8998,7 @@
jamEntry();
const SubStopRef* ref = (SubStopRef*) signal->getDataPtr();
Uint32 senderRef = ref->senderRef;
+ Uint32 err = ref->errorCode;
OpSubEventPtr subbPtr;
c_opSubEvent.getPtr(subbPtr, ref->senderData);
@@ -9006,33 +9008,27 @@
* Participant
*/
jam();
- if (ref->isTemporary()){
- jam();
- SubStopReq* req = (SubStopReq*)signal->getDataPtrSend();
- req->senderRef = reference();
- req->senderData = subbPtr.i;
- sendSignal(SUMA_REF, GSN_SUB_STOP_REQ,
- signal, SubStopReq::SignalLength, JBB);
- } else {
- jam();
- SubStopRef* ref = (SubStopRef*) signal->getDataPtrSend();
- ref->senderRef = reference();
- ref->senderData = subbPtr.p->m_senderData;
- sendSignal(subbPtr.p->m_senderRef, GSN_SUB_STOP_REF,
- signal, SubStopRef::SignalLength, JBB);
- c_opSubEvent.release(subbPtr);
- }
+ SubStopRef* ref = (SubStopRef*) signal->getDataPtrSend();
+ ref->senderRef = reference();
+ ref->senderData = subbPtr.p->m_senderData;
+ sendSignal(subbPtr.p->m_senderRef, GSN_SUB_STOP_REF,
+ signal, SubStopRef::SignalLength, JBB);
+ c_opSubEvent.release(subbPtr);
return;
}
/*
* Coordinator
*/
ndbrequire(refToBlock(senderRef) == DBDICT);
- if (ref->errorCode == SubStopRef::NF_FakeErrorREF){
+ if (err == SubStopRef::NF_FakeErrorREF){
jam();
subbPtr.p->m_reqTracker.ignoreRef(c_counterMgr, refToNode(senderRef));
} else {
jam();
+ if (subbPtr.p->m_errorCode == 0)
+ {
+ subbPtr.p->m_errorCode= err ? err : 1;
+ }
subbPtr.p->m_reqTracker.reportRef(c_counterMgr, refToNode(senderRef));
}
completeSubStopReq(signal,subbPtr.i,0);
@@ -9092,17 +9088,9 @@
#endif
SubStopRef* ref = (SubStopRef*)signal->getDataPtrSend();
- ref->senderRef = reference();
- ref->senderData = subbPtr.p->m_senderData;
- /*
- ref->subscriptionId = subbPtr.p->m_senderData;
- ref->subscriptionKey = subbPtr.p->m_senderData;
- ref->part = subbPtr.p->m_part; // SubscriptionData::Part
- ref->subscriberData = subbPtr.p->m_subscriberData;
- ref->subscriberRef = subbPtr.p->m_subscriberRef;
- */
- ref->errorCode = subbPtr.p->m_errorCode;
-
+ ref->senderRef = reference();
+ ref->senderData = subbPtr.p->m_senderData;
+ ref->errorCode = subbPtr.p->m_errorCode;
sendSignal(subbPtr.p->m_senderRef, GSN_SUB_STOP_REF,
signal, SubStopRef::SignalLength, JBB);
@@ -9132,7 +9120,7 @@
Dbdict::execDROP_EVNT_REQ(Signal* signal)
{
jamEntry();
- EVENT_TRACE;
+ DBUG_ENTER("Dbdict::execDROP_EVNT_REQ");
DropEvntReq *req = (DropEvntReq*)signal->getDataPtr();
const Uint32 senderRef = signal->senderBlockRef();
@@ -9145,12 +9133,12 @@
releaseSections(signal);
DropEvntRef * ret = (DropEvntRef *)signal->getDataPtrSend();
- ret->setErrorCode(DropEvntRef::SeizeError);
+ ret->setErrorCode(747);
ret->setErrorLine(__LINE__);
ret->setErrorNode(reference());
sendSignal(senderRef, GSN_DROP_EVNT_REF, signal,
DropEvntRef::SignalLength, JBB);
- return;
+ DBUG_VOID_RETURN;
}
#ifdef EVENT_DEBUG
@@ -9175,12 +9163,12 @@
jam();
releaseSections(signal);
- evntRecPtr.p->m_errorCode = DropEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 1;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
dropEvent_sendReply(signal, evntRecPtr);
- return;
+ DBUG_VOID_RETURN;
}
r0.getString(evntRecPtr.p->m_eventRec.NAME);
{
@@ -9201,6 +9189,7 @@
prepareTransactionEventSysTable(&c, signal, evntRecPtr.i,
UtilPrepareReq::Read);
+ DBUG_VOID_RETURN;
}
void
@@ -9274,6 +9263,7 @@
Dbdict::execSUB_REMOVE_REQ(Signal* signal)
{
jamEntry();
+ DBUG_ENTER("Dbdict::execSUB_REMOVE_REQ");
Uint32 origSenderRef = signal->senderBlockRef();
@@ -9282,11 +9272,11 @@
SubRemoveRef * ref = (SubRemoveRef *)signal->getDataPtrSend();
jam();
ref->senderRef = reference();
- ref->setTemporary(SubRemoveRef::Busy);
+ ref->errorCode = SubRemoveRef::Busy;
sendSignal(origSenderRef, GSN_SUB_REMOVE_REF, signal,
SubRemoveRef::SignalLength, JBB);
- return;
+ DBUG_VOID_RETURN;
}
{
@@ -9301,6 +9291,7 @@
req->senderData = subbPtr.i;
sendSignal(SUMA_REF, GSN_SUB_REMOVE_REQ, signal, SubRemoveReq::SignalLength, JBB);
+ DBUG_VOID_RETURN;
}
/*
@@ -9311,8 +9302,11 @@
Dbdict::execSUB_REMOVE_REF(Signal* signal)
{
jamEntry();
+ DBUG_ENTER("Dbdict::execSUB_REMOVE_REF");
+
const SubRemoveRef* ref = (SubRemoveRef*) signal->getDataPtr();
Uint32 senderRef = ref->senderRef;
+ Uint32 err= ref->errorCode;
if (refToBlock(senderRef) == SUMA) {
/*
@@ -9321,8 +9315,8 @@
jam();
OpSubEventPtr subbPtr;
c_opSubEvent.getPtr(subbPtr, ref->senderData);
- if (ref->errorCode == (Uint32) GrepError::SUBSCRIPTION_ID_NOT_FOUND) {
- // conf this since this may occur if a nodefailiure has occured
+ if (err == 1407) {
+ // conf this since this may occur if a nodefailure has occured
// earlier so that the systable was not cleared
SubRemoveConf* conf = (SubRemoveConf*) signal->getDataPtrSend();
conf->senderRef = reference();
@@ -9337,7 +9331,7 @@
signal, SubRemoveRef::SignalLength, JBB);
}
c_opSubEvent.release(subbPtr);
- return;
+ DBUG_VOID_RETURN;
}
/*
* Coordinator
@@ -9345,14 +9339,21 @@
ndbrequire(refToBlock(senderRef) == DBDICT);
OpDropEventPtr eventRecPtr;
c_opDropEvent.getPtr(eventRecPtr, ref->senderData);
- if (ref->errorCode == SubRemoveRef::NF_FakeErrorREF){
+ if (err == SubRemoveRef::NF_FakeErrorREF){
jam();
eventRecPtr.p->m_reqTracker.ignoreRef(c_counterMgr, refToNode(senderRef));
} else {
jam();
+ if (eventRecPtr.p->m_errorCode == 0)
+ {
+ eventRecPtr.p->m_errorCode= err ? err : 1;
+ eventRecPtr.p->m_errorLine= __LINE__;
+ eventRecPtr.p->m_errorNode= reference();
+ }
eventRecPtr.p->m_reqTracker.reportRef(c_counterMgr, refToNode(senderRef));
}
completeSubRemoveReq(signal,eventRecPtr.i,0);
+ DBUG_VOID_RETURN;
}
void
@@ -9400,9 +9401,12 @@
if (evntRecPtr.p->m_reqTracker.hasRef()) {
jam();
- evntRecPtr.p->m_errorNode = reference();
- evntRecPtr.p->m_errorLine = __LINE__;
- evntRecPtr.p->m_errorCode = DropEvntRef::Undefined;
+ if ( evntRecPtr.p->m_errorCode == 0 )
+ {
+ evntRecPtr.p->m_errorNode = reference();
+ evntRecPtr.p->m_errorLine = __LINE__;
+ evntRecPtr.p->m_errorCode = 1;
+ }
dropEvent_sendReply(signal, evntRecPtr);
return;
}
@@ -9478,18 +9482,8 @@
evntRecPtr.i = ref->getSenderData();
ndbrequire((evntRecPtr.p = c_opDropEvent.getPtr(evntRecPtr.i)) != NULL);
- bool temporary = false;
interpretUtilPrepareErrorCode((UtilPrepareRef::ErrorCode)ref->getErrorCode(),
- temporary, evntRecPtr.p->m_errorLine);
- if (temporary) {
- evntRecPtr.p->m_errorCode = (DropEvntRef::ErrorCode)
- ((Uint32) DropEvntRef::Undefined | (Uint32) DropEvntRef::Temporary);
- }
-
- if (evntRecPtr.p->m_errorCode == 0) {
- evntRecPtr.p->m_errorCode = DropEvntRef::Undefined;
- evntRecPtr.p->m_errorLine = __LINE__;
- }
+ evntRecPtr.p->m_errorCode, evntRecPtr.p->m_errorLine);
evntRecPtr.p->m_errorNode = reference();
dropEvent_sendReply(signal, evntRecPtr);
@@ -9516,17 +9510,17 @@
switch (ref->getTCErrorCode()) {
case ZNOT_FOUND:
jam();
- evntRecPtr.p->m_errorCode = DropEvntRef::EventNotFound;
+ evntRecPtr.p->m_errorCode = 4710;
break;
default:
jam();
- evntRecPtr.p->m_errorCode = DropEvntRef::UndefinedTCError;
+ evntRecPtr.p->m_errorCode = ref->getTCErrorCode();
break;
}
break;
default:
jam();
- evntRecPtr.p->m_errorCode = DropEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = ref->getErrorCode();
break;
}
dropEvent_sendReply(signal, evntRecPtr);
--- 1.18/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2005-09-06 06:51:57 +02:00
+++ 1.19/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2005-09-15 10:42:04 +02:00
@@ -107,11 +107,13 @@
*/
#define EVENT_SYSTEM_TABLE_NAME "sys/def/NDB$EVENTS_0"
-#define EVENT_SYSTEM_TABLE_LENGTH 6
+#define EVENT_SYSTEM_TABLE_LENGTH 8
struct sysTab_NDBEVENTS_0 {
char NAME[MAX_TAB_NAME_SIZE];
Uint32 EVENT_TYPE;
+ Uint32 TABLEID;
+ Uint32 TABLEVERSION;
char TABLE_NAME[MAX_TAB_NAME_SIZE];
Uint32 ATTRIBUTE_MASK[MAXNROFATTRIBUTESINWORDS];
Uint32 SUBID;
@@ -546,9 +548,6 @@
void execSUB_CREATE_CONF(Signal* signal);
void execSUB_CREATE_REF (Signal* signal);
- void execSUB_SYNC_CONF(Signal* signal);
- void execSUB_SYNC_REF (Signal* signal);
-
void execSUB_REMOVE_REQ(Signal* signal);
void execSUB_REMOVE_CONF(Signal* signal);
void execSUB_REMOVE_REF(Signal* signal);
@@ -1388,7 +1387,7 @@
CreateEvntReq::RequestType m_requestType;
Uint32 m_requestFlag;
// error info
- CreateEvntRef::ErrorCode m_errorCode;
+ Uint32 m_errorCode;
Uint32 m_errorLine;
Uint32 m_errorNode;
// ctor
@@ -1432,24 +1431,24 @@
sysTab_NDBEVENTS_0 m_eventRec;
RequestTracker m_reqTracker;
// error info
- DropEvntRef::ErrorCode m_errorCode;
+ Uint32 m_errorCode;
Uint32 m_errorLine;
Uint32 m_errorNode;
// ctor
OpDropEvent() {
memset(&m_request, 0, sizeof(m_request));
- m_errorCode = DropEvntRef::NoError;
+ m_errorCode = 0;
m_errorLine = 0;
m_errorNode = 0;
}
void init(const DropEvntReq* req) {
m_request = *req;
- m_errorCode = DropEvntRef::NoError;
+ m_errorCode = 0;
m_errorLine = 0;
m_errorNode = 0;
}
bool hasError() {
- return m_errorCode != DropEvntRef::NoError;
+ return m_errorCode != 0;
}
void setError(const DropEvntRef* ref) {
if (ref != 0 && ! hasError()) {
@@ -1782,6 +1781,7 @@
/* ------------------------------------------------------------ */
// Add Table Handling
/* ------------------------------------------------------------ */
+ void releaseCreateTableOp(Signal* signal, CreateTableRecordPtr createTabPtr);
/* ------------------------------------------------------------ */
// Add Fragment Handling
--- 1.35/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2005-09-06 12:50:24 +02:00
+++ 1.36/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2005-09-15 10:42:04 +02:00
@@ -7903,7 +7903,6 @@
SubGcpCompleteRep * const rep = (SubGcpCompleteRep*)signal->getDataPtr();
rep->gci = coldgcp;
- rep->senderData = 0;
sendSignal(SUMA_REF, GSN_SUB_GCP_COMPLETE_REP, signal,
SubGcpCompleteRep::SignalLength, JBB);
}
--- 1.77/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2005-09-15 02:31:40 +02:00
+++ 1.78/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2005-09-15 11:10:11 +02:00
@@ -3272,6 +3272,7 @@
locTcConnectptr.p->tcTimer = cLqhTimeOutCount;
locTcConnectptr.p->tableref = RNIL;
locTcConnectptr.p->savePointId = 0;
+ locTcConnectptr.p->gci = 0;
cfirstfreeTcConrec = nextTc;
tcConnectptr = locTcConnectptr;
locTcConnectptr.p->connectState = TcConnectionrec::CONNECTED;
@@ -5422,6 +5423,7 @@
TcConnectionrec * const regTcPtr = tcConnectptr.p;
TcConnectionrec::LogWriteState logWriteState = regTcPtr->logWriteState;
TcConnectionrec::TransactionState transState = regTcPtr->transactionState;
+ ndbrequire(regTcPtr->gci == gci || regTcPtr->gci == 0);
regTcPtr->gci = gci;
if (transState == TcConnectionrec::PREPARED) {
if (logWriteState == TcConnectionrec::WRITTEN) {
@@ -5491,6 +5493,7 @@
Uint32 newestGci = cnewestGci;
TcConnectionrec::LogWriteState logWriteState = regTcPtr->logWriteState;
TcConnectionrec::TransactionState transState = regTcPtr->transactionState;
+ ndbrequire(regTcPtr->gci == gci || regTcPtr->gci == 0);
regTcPtr->gci = gci;
if (gci > newestGci) {
jam();
@@ -8890,7 +8893,7 @@
const Uint32 nodeId = refToNode(ref);
const bool connectedToNode = getNodeInfo(nodeId).m_connected;
const Uint32 type = getNodeInfo(nodeId).m_type;
- const bool is_api = (type >= NodeInfo::API && type <= NodeInfo::REP);
+ const bool is_api = (type >= NodeInfo::API && type <= NodeInfo::MGM);
const bool old_dest = (getNodeInfo(nodeId).m_version < MAKE_VERSION(3,5,0));
const bool longable = true; // TODO is_api && !old_dest;
--- 1.87/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2005-09-06 12:50:24 +02:00
+++ 1.88/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2005-09-15 10:42:04 +02:00
@@ -3908,7 +3908,7 @@
const UintR TopWords = (UintR)regApiPtr->tckeyrec;
localHostptr.i = refToNode(regApiPtr->ndbapiBlockref);
const Uint32 type = getNodeInfo(localHostptr.i).m_type;
- const bool is_api = (type >= NodeInfo::API && type <= NodeInfo::REP);
+ const bool is_api = (type >= NodeInfo::API && type <= NodeInfo::MGM);
const BlockNumber TblockNum = refToBlock(regApiPtr->ndbapiBlockref);
const Uint32 Tmarker = (regApiPtr->commitAckMarker == RNIL) ? 0 : 1;
ptrAss(localHostptr, hostRecord);
@@ -4590,7 +4590,8 @@
commitConf->transId1 = regApiPtr->transid[0];
commitConf->transId2 = regApiPtr->transid[1];
commitConf->gci = regApiPtr->globalcheckpointid;
- sendSignal(regApiPtr->ndbapiBlockref, GSN_TC_COMMITCONF, signal,
+
+ sendSignal(regApiPtr->ndbapiBlockref, GSN_TC_COMMITCONF, signal,
TcCommitConf::SignalLength, JBB);
} else if (regApiPtr->returnsignal == RS_NO_RETURN) {
jam();
@@ -5127,6 +5128,19 @@
return;
}
+ /* Only ref in certain situations */
+ {
+ const Uint32 opType = regTcPtr->operation;
+ if ( (opType == ZDELETE && errCode != ZNOT_FOUND)
+ || (opType == ZINSERT && errCode != ZALREADYEXIST)
+ || (opType == ZUPDATE && errCode != ZNOT_FOUND)
+ || (opType == ZWRITE && errCode != 839 && errCode != 840))
+ {
+ TCKEY_abort(signal, 49);
+ return;
+ }
+ }
+
/* *************** */
/* TCKEYREF < */
/* *************** */
@@ -11336,7 +11350,7 @@
const UintR TopWords = (UintR)regApiPtr->tcindxrec;
localHostptr.i = refToNode(regApiPtr->ndbapiBlockref);
const Uint32 type = getNodeInfo(localHostptr.i).m_type;
- const bool is_api = (type >= NodeInfo::API && type <= NodeInfo::REP);
+ const bool is_api = (type >= NodeInfo::API && type <= NodeInfo::MGM);
const BlockNumber TblockNum = refToBlock(regApiPtr->ndbapiBlockref);
const Uint32 Tmarker = (regApiPtr->commitAckMarker == RNIL ? 0 : 1);
ptrAss(localHostptr, hostRecord);
--- 1.26/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2005-09-02 08:42:59 +02:00
+++ 1.27/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2005-09-15 10:42:04 +02:00
@@ -345,6 +345,7 @@
#endif
class Dbtup: public SimulatedBlock {
+ friend class Suma;
public:
typedef bool (Dbtup::* ReadFunction)(Uint32*,
@@ -420,7 +421,8 @@
SAME_PAGE = 64,
DEFINING = 65,
TUPLE_BLOCKED = 66,
- ERROR_WAIT_STORED_PROCREQ = 67
+ ERROR_WAIT_STORED_PROCREQ = 67,
+ DROPPING = 68
};
// Records
--- 1.8/storage/ndb/src/kernel/blocks/dbtup/DbtupBuffer.cpp 2005-06-07 12:21:22 +02:00
+++ 1.9/storage/ndb/src/kernel/blocks/dbtup/DbtupBuffer.cpp 2005-09-15 10:42:04 +02:00
@@ -146,7 +146,7 @@
bool connectedToNode = getNodeInfo(nodeId).m_connected;
const Uint32 type = getNodeInfo(nodeId).m_type;
- bool is_api = (type >= NodeInfo::API && type <= NodeInfo::REP);
+ bool is_api = (type >= NodeInfo::API && type <= NodeInfo::MGM);
bool old_dest = (getNodeInfo(nodeId).m_version < MAKE_VERSION(3,5,0));
const Uint32 TpacketTA = hostBuffer[nodeId].noOfPacketsTA;
const Uint32 TpacketLen = hostBuffer[nodeId].packetLenTA;
--- 1.14/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp 2005-09-02 08:42:59 +02:00
+++ 1.15/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp 2005-09-15 10:42:04 +02:00
@@ -590,6 +590,7 @@
tabPtr.p->m_dropTable.tabUserRef = req->senderRef;
tabPtr.p->m_dropTable.tabUserPtr = req->senderData;
+ tabPtr.p->tableStatus = DROPPING;
signal->theData[0] = ZREL_FRAG;
signal->theData[1] = tabPtr.i;
--- 1.11/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp 2005-07-22 13:53:57 +02:00
+++ 1.12/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp 2005-09-15 10:42:04 +02:00
@@ -123,14 +123,21 @@
BlockReference senderRef = signal->getSendersBlockRef();
const CreateTrigReq reqCopy = *(const CreateTrigReq*)signal->getDataPtr();
const CreateTrigReq* const req = &reqCopy;
+ CreateTrigRef::ErrorCode error= CreateTrigRef::NoError;
// Find table
TablerecPtr tabPtr;
tabPtr.i = req->getTableId();
ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
+ if (tabPtr.p->tableStatus != DEFINED )
+ {
+ ljam();
+ error= CreateTrigRef::InvalidTable;
+ }
// Create trigger and associate it with the table
- if (createTrigger(tabPtr.p, req)) {
+ else if (createTrigger(tabPtr.p, req))
+ {
ljam();
// Send conf
CreateTrigConf* const conf = (CreateTrigConf*)signal->getDataPtrSend();
@@ -143,21 +150,26 @@
conf->setTriggerInfo(req->getTriggerInfo());
sendSignal(senderRef, GSN_CREATE_TRIG_CONF,
signal, CreateTrigConf::SignalLength, JBB);
- } else {
+ return;
+ }
+ else
+ {
ljam();
- // Send ref
- CreateTrigRef* const ref = (CreateTrigRef*)signal->getDataPtrSend();
- ref->setUserRef(reference());
- ref->setConnectionPtr(req->getConnectionPtr());
- ref->setRequestType(req->getRequestType());
- ref->setTableId(req->getTableId());
- ref->setIndexId(req->getIndexId());
- ref->setTriggerId(req->getTriggerId());
- ref->setTriggerInfo(req->getTriggerInfo());
- ref->setErrorCode(CreateTrigRef::TooManyTriggers);
- sendSignal(senderRef, GSN_CREATE_TRIG_REF,
- signal, CreateTrigRef::SignalLength, JBB);
+ error= CreateTrigRef::TooManyTriggers;
}
+ ndbassert(error != CreateTrigRef::NoError);
+ // Send ref
+ CreateTrigRef* const ref = (CreateTrigRef*)signal->getDataPtrSend();
+ ref->setUserRef(reference());
+ ref->setConnectionPtr(req->getConnectionPtr());
+ ref->setRequestType(req->getRequestType());
+ ref->setTableId(req->getTableId());
+ ref->setIndexId(req->getIndexId());
+ ref->setTriggerId(req->getTriggerId());
+ ref->setTriggerInfo(req->getTriggerInfo());
+ ref->setErrorCode(error);
+ sendSignal(senderRef, GSN_CREATE_TRIG_REF,
+ signal, CreateTrigRef::SignalLength, JBB);
}//Dbtup::execCREATE_TRIG_REQ()
void
--- 1.4/storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp 2005-09-02 08:42:59 +02:00
+++ 1.5/storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp 2005-09-15 10:42:04 +02:00
@@ -159,6 +159,7 @@
BLOCK_DEFINES(Ndbcntr);
// Transit signals
+ void execAPI_START_REP(Signal*);
void execCONTINUEB(Signal* signal);
void execREAD_NODESCONF(Signal* signal);
void execREAD_NODESREF(Signal* signal);
--- 1.7/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp 2005-09-02 08:42:59 +02:00
+++ 1.8/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp 2005-09-15 10:42:04 +02:00
@@ -55,6 +55,7 @@
addRecSignal(GSN_CNTR_START_CONF, &Ndbcntr::execCNTR_START_CONF);
addRecSignal(GSN_CNTR_WAITREP, &Ndbcntr::execCNTR_WAITREP);
addRecSignal(GSN_CNTR_START_REP, &Ndbcntr::execCNTR_START_REP);
+ addRecSignal(GSN_API_START_REP, &Ndbcntr::execAPI_START_REP, true);
addRecSignal(GSN_NODE_FAILREP, &Ndbcntr::execNODE_FAILREP);
addRecSignal(GSN_SYSTEM_ERROR , &Ndbcntr::execSYSTEM_ERROR);
--- 1.20/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp 2005-09-06 10:30:20 +02:00
+++ 1.21/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp 2005-09-15 10:42:04 +02:00
@@ -136,6 +136,16 @@
}//switch
}//Ndbcntr::execCONTINUEB()
+void
+Ndbcntr::execAPI_START_REP(Signal* signal)
+{
+ if(refToBlock(signal->getSendersBlockRef()) == QMGR)
+ {
+ for(Uint32 i = 0; i<ALL_BLOCKS_SZ; i++){
+ sendSignal(ALL_BLOCKS[i].Ref, GSN_API_START_REP, signal, 1, JBB);
+ }
+ }
+}
/*******************************/
/* SYSTEM_ERROR */
/*******************************/
@@ -202,10 +212,6 @@
jamEntry();
cstartPhase = signal->theData[1];
- NodeState newState(NodeState::SL_STARTING, cstartPhase,
- (NodeState::StartType)ctypeOfStart);
- updateNodeState(signal, newState);
-
cndbBlocksCount = 0;
cinternalStartphase = cstartPhase - 1;
@@ -566,6 +572,13 @@
Uint32 nodeId = signal->theData[0];
c_startedNodes.set(nodeId);
c_start.m_starting.clear(nodeId);
+
+ /**
+ * Inform all interested blocks that node has started
+ */
+ for(Uint32 i = 0; i<ALL_BLOCKS_SZ; i++){
+ sendSignal(ALL_BLOCKS[i].Ref, GSN_NODE_START_REP, signal, 1, JBB);
+ }
if(!c_start.m_starting.isclear()){
jam();
@@ -2532,6 +2545,10 @@
currentBlockIndex = 0;
+ NodeState newState(NodeState::SL_STARTING, currentStartPhase,
+ (NodeState::StartType)cntr.ctypeOfStart);
+ cntr.updateNodeState(signal, newState);
+
if(start != 0){
/**
* At least one wanted this start phase, report it
--- 1.3/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrSysTable.cpp 2005-04-08 02:44:05
+02:00
+++ 1.4/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrSysTable.cpp 2005-09-15 10:42:04
+02:00
@@ -53,22 +53,30 @@
DictTabInfo::ExtUnsigned, 1,
false, false
},
- { 2, "TABLE_NAME",
+ { 2, "TABLEID",
+ DictTabInfo::ExtUnsigned, 1,
+ false, false
+ },
+ { 3, "TABLEVERSION",
+ DictTabInfo::ExtUnsigned, 1,
+ false, false
+ },
+ { 4, "TABLE_NAME",
DictTabInfo::ExtBinary, MAX_TAB_NAME_SIZE,
false, false
},
- { 3, "ATTRIBUTE_MASK",
+ { 5, "ATTRIBUTE_MASK",
DictTabInfo::ExtUnsigned, MAXNROFATTRIBUTESINWORDS,
false, false
},
- { 4, "SUBID",
+ { 6, "SUBID",
DictTabInfo::ExtUnsigned, 1,
false, false
},
- { 5, "SUBKEY",
+ { 7, "SUBKEY",
DictTabInfo::ExtUnsigned, 1,
false, false
- }
+ },
};
const Ndbcntr::SysTable
--- 1.20/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp 2005-07-22 15:27:09 +02:00
+++ 1.21/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp 2005-09-15 10:42:04 +02:00
@@ -367,7 +367,11 @@
break;
return;
}
- const int mode = S_IRUSR | S_IWUSR | S_IRGRP;
+ // allow for user to choose any permissionsa with umask
+ const int mode =
+ S_IRUSR | S_IWUSR |
+ S_IRGRP | S_IWGRP |
+ S_IROTH | S_IWOTH;
if (-1 == (theFd = ::open(theFileName.c_str(), new_flags, mode))) {
PRINT_ERRORANDFLAGS(new_flags);
--- 1.18/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp 2005-08-25 18:49:48 +02:00
+++ 1.19/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp 2005-09-15 10:42:04 +02:00
@@ -1931,9 +1931,6 @@
case NodeInfo::MGM:
compatability_check = ndbCompatible_ndb_mgmt(NDB_VERSION, version);
break;
- case NodeInfo::REP:
- // compatability_check = ndbCompatible_ndb_api(NDB_VERSION, version);
- // break;
case NodeInfo::DB:
case NodeInfo::INVALID:
default:
@@ -1964,7 +1961,7 @@
apiRegConf->qmgrRef = reference();
apiRegConf->apiHeartbeatFrequency = (chbApiDelay / 10);
apiRegConf->version = NDB_VERSION;
- apiRegConf->nodeState = getNodeState();
+ NodeState state= apiRegConf->nodeState = getNodeState();
{
NodeRecPtr nodePtr;
nodePtr.i = getOwnNodeId();
@@ -1982,9 +1979,12 @@
sendSignal(ref, GSN_API_REGCONF, signal, ApiRegConf::SignalLength, JBB);
- if ((getNodeState().startLevel == NodeState::SL_STARTED ||
- getNodeState().getSingleUserMode())
- && apiNodePtr.p->phase == ZAPI_INACTIVE) {
+ if (apiNodePtr.p->phase == ZAPI_INACTIVE &&
+ (state.startLevel == NodeState::SL_STARTED ||
+ state.getSingleUserMode() ||
+ (state.startLevel == NodeState::SL_STARTING &&
+ state.starting.startPhase >= 100)))
+ {
jam();
/**----------------------------------------------------------------------
* THE API NODE IS REGISTERING. WE WILL ACCEPT IT BY CHANGING STATE AND
@@ -1994,6 +1994,9 @@
apiNodePtr.p->blockRef = ref;
signal->theData[0] = apiNodePtr.i;
sendSignal(CMVMI_REF, GSN_ENABLE_COMORD, signal, 1, JBA);
+
+ signal->theData[0] = apiNodePtr.i;
+ EXECUTE_DIRECT(NDBCNTR, GSN_API_START_REP, signal, 1);
}
return;
}//Qmgr::execAPI_REGREQ()
--- 1.21/storage/ndb/src/kernel/blocks/suma/Suma.cpp 2005-08-25 18:49:48 +02:00
+++ 1.22/storage/ndb/src/kernel/blocks/suma/Suma.cpp 2005-09-15 10:42:04 +02:00
@@ -39,9 +39,14 @@
#include <signaldata/TrigAttrInfo.hpp>
#include <signaldata/CheckNodeGroups.hpp>
#include <signaldata/GCPSave.hpp>
-#include <GrepError.hpp>
+#include <signaldata/CreateTab.hpp>
+#include <signaldata/DropTab.hpp>
+#include <signaldata/AlterTab.hpp>
+
+#include <ndbapi/NdbDictionary.hpp>
#include <DebuggerNames.hpp>
+#include <../dbtup/Dbtup.hpp>
//#define HANDOVER_DEBUG
//#define NODEFAIL_DEBUG
@@ -72,6 +77,7 @@
Uint32 g_subPtrI = RNIL;
static const Uint32 SUMA_SEQUENCE = 0xBABEBABE;
+static const Uint32 MAX_CONCURRENT_GCP = 2;
/**************************************************************
*
@@ -80,11 +86,12 @@
*/
#define PRINT_ONLY 0
-static Uint32 g_TypeOfStart = NodeState::ST_ILLEGAL_TYPE;
void
-Suma::getNodeGroupMembers(Signal* signal) {
+Suma::getNodeGroupMembers(Signal* signal)
+{
jam();
+ DBUG_ENTER("Suma::getNodeGroupMembers");
/**
* Ask DIH for nodeGroupMembers
*/
@@ -99,25 +106,45 @@
jamEntry();
c_nodeGroup = sd->output;
- c_noNodesInGroup = 0;
- for (int i = 0; i < MAX_NDB_NODES; i++) {
- if (sd->mask.get(i)) {
- if (i == getOwnNodeId()) c_idInNodeGroup = c_noNodesInGroup;
- c_nodesInGroup[c_noNodesInGroup] = i;
- c_noNodesInGroup++;
+ c_nodes_in_nodegroup_mask.assign(sd->mask);
+ c_noNodesInGroup = c_nodes_in_nodegroup_mask.count();
+ Uint32 i, pos= 0;
+
+ for (i = 0; i < MAX_NDB_NODES; i++) {
+ if (sd->mask.get(i))
+ {
+ c_nodesInGroup[pos++] = i;
}
}
+
+ const Uint32 replicas= c_noNodesInGroup;
- // ndbout_c("c_noNodesInGroup=%d", c_noNodesInGroup);
+ Uint32 buckets= 1;
+ for(i = 1; i <= replicas; i++)
+ buckets *= i;
+
+ for(i = 0; i<buckets; i++)
+ {
+ Bucket* ptr= c_buckets+i;
+ for(Uint32 j= 0; j< replicas; j++)
+ {
+ ptr->m_nodes[j] = c_nodesInGroup[(i + j) % replicas];
+ }
+ }
+
+ c_no_of_buckets= buckets;
ndbrequire(c_noNodesInGroup > 0); // at least 1 node in the nodegroup
-#ifdef NODEFAIL_DEBUG
+#ifndef DBUG_OFF
for (Uint32 i = 0; i < c_noNodesInGroup; i++) {
- ndbout_c ("Suma: NodeGroup %u, me %u, me in group %u, member[%u] %u",
- c_nodeGroup, getOwnNodeId(), c_idInNodeGroup,
- i, c_nodesInGroup[i]);
+ DBUG_PRINT("exit",("Suma: NodeGroup %u, me %u, "
+ "member[%u] %u",
+ c_nodeGroup, getOwnNodeId(),
+ i, c_nodesInGroup[i]));
}
#endif
+
+ DBUG_VOID_RETURN;
}
void
@@ -128,85 +155,134 @@
const Uint32 startphase = signal->theData[1];
const Uint32 typeOfStart = signal->theData[7];
- DBUG_PRINT("info",("startphase = %u, typeOfStart = %u", startphase, typeOfStart));
+ DBUG_PRINT("info",("startphase = %u, typeOfStart = %u",
+ startphase, typeOfStart));
- if(startphase == 1){
- jam();
- c_restartLock = true;
- }
-
- if(startphase == 3){
+ if(startphase == 3)
+ {
jam();
- g_TypeOfStart = typeOfStart;
+ ndbrequire((m_tup = (Dbtup*)globalData.getBlock(DBTUP)) != 0);
signal->theData[0] = reference();
sendSignal(NDBCNTR_REF, GSN_READ_NODESREQ, signal, 1, JBB);
-
-#if 0
-
- /**
- * Debug
- */
-
-
- SubscriptionPtr subPtr;
- Ptr<SyncRecord> syncPtr;
- ndbrequire(c_subscriptions.seize(subPtr));
- ndbrequire(c_syncPool.seize(syncPtr));
-
-
- ndbout_c("Suma: subPtr.i = %d syncPtr.i = %d", subPtr.i, syncPtr.i);
-
- subPtr.p->m_syncPtrI = syncPtr.i;
- subPtr.p->m_subscriptionType = SubCreateReq::DatabaseSnapshot;
- syncPtr.p->m_subscriptionPtrI = subPtr.i;
- syncPtr.p->ptrI = syncPtr.i;
- g_subPtrI = subPtr.i;
- // sendSTTORRY(signal);
-#endif
DBUG_VOID_RETURN;
}
- if(startphase == 5) {
+ if(startphase == 5)
+ {
getNodeGroupMembers(signal);
- if (g_TypeOfStart == NodeState::ST_NODE_RESTART) {
+ if (typeOfStart == NodeState::ST_NODE_RESTART ||
+ typeOfStart == NodeState::ST_INITIAL_NODE_RESTART)
+ {
jam();
- for (Uint32 i = 0; i < c_noNodesInGroup; i++) {
- Uint32 ref = calcSumaBlockRef(c_nodesInGroup[i]);
- if (ref != reference())
- sendSignal(ref, GSN_SUMA_START_ME, signal,
- 1 /*SumaStartMe::SignalLength*/, JBB);
- }
+
+ send_start_me_req(signal);
+ return;
}
}
- if(startphase == 7) {
- c_restartLock = false; // may be set false earlier with HANDOVER_REQ
-
- if (g_TypeOfStart != NodeState::ST_NODE_RESTART) {
- for( int i = 0; i < NO_OF_BUCKETS; i++) {
- if (getResponsibleSumaNodeId(i) == refToNode(reference())) {
+ if(startphase == 7)
+ {
+ if (typeOfStart != NodeState::ST_NODE_RESTART &&
+ typeOfStart != NodeState::ST_INITIAL_NODE_RESTART)
+ {
+ for( Uint32 i = 0; i < c_no_of_buckets; i++)
+ {
+ if (get_responsible_node(i) == getOwnNodeId())
+ {
// I'm running this bucket
DBUG_PRINT("info",("bucket %u set to true", i));
- c_buckets[i].active = true;
+ m_active_buckets.set(i);
+ ndbout_c("m_active_buckets.set(%d)", i);
}
}
}
-
- if(g_TypeOfStart == NodeState::ST_INITIAL_START &&
- c_masterNodeId == getOwnNodeId()) {
+
+ if(!m_active_buckets.isclear())
+ m_gcp_complete_rep_count = 1; // I contribute 1 gcp complete rep
+ else
+ m_gcp_complete_rep_count = 0; // I contribute 1 gcp complete rep
+
+ if(typeOfStart == NodeState::ST_INITIAL_START &&
+ c_masterNodeId == getOwnNodeId())
+ {
jam();
createSequence(signal);
DBUG_VOID_RETURN;
}//if
}//if
+ if(startphase == 100)
+ {
+ /**
+ * Allow API's to connect
+ */
+ sendSTTORRY(signal);
+ return;
+ }
+ if(startphase == 101)
+ {
+ if (typeOfStart == NodeState::ST_NODE_RESTART ||
+ typeOfStart == NodeState::ST_INITIAL_NODE_RESTART)
+ {
+ /**
+ * Handover code here
+ */
+ c_startup.m_wait_handover= true;
+ check_start_handover(signal);
+ return;
+ }
+ }
sendSTTORRY(signal);
DBUG_VOID_RETURN;
}
void
+Suma::send_start_me_req(Signal* signal)
+{
+ Uint32 nodeId= c_startup.m_restart_server_node_id;
+ do {
+ nodeId = c_alive_nodes.find(nodeId + 1);
+
+ if(nodeId == getOwnNodeId())
+ continue;
+ if(nodeId == NdbNodeBitmask::NotFound)
+ {
+ nodeId = 0;
+ continue;
+ }
+ break;
+ } while(true);
+
+
+ infoEvent("Suma: asking node %d to recreate subscriptions on me", nodeId);
+ c_startup.m_restart_server_node_id= nodeId;
+ sendSignal(calcSumaBlockRef(nodeId),
+ GSN_SUMA_START_ME_REQ, signal, 1, JBB);
+}
+
+void
+Suma::execSUMA_START_ME_REF(Signal* signal)
+{
+ const SumaStartMeRef* ref= (SumaStartMeRef*)signal->getDataPtr();
+ ndbrequire(ref->errorCode == SumaStartMeRef::Busy);
+
+ infoEvent("Suma: node %d refused %d",
+ c_startup.m_restart_server_node_id, ref->errorCode);
+ send_start_me_req(signal);
+}
+
+void
+Suma::execSUMA_START_ME_CONF(Signal* signal)
+{
+ infoEvent("Suma: node %d has completed restoring me",
+ c_startup.m_restart_server_node_id);
+ sendSTTORRY(signal);
+ c_startup.m_restart_server_node_id= 0;
+}
+
+void
Suma::createSequence(Signal* signal)
{
jam();
@@ -241,35 +317,71 @@
jamEntry();
ReadNodesConf * const conf = (ReadNodesConf *)signal->getDataPtr();
- c_aliveNodes.clear();
- c_preparingNodes.clear();
+ if(getNodeState().getNodeRestartInProgress())
+ {
+ c_alive_nodes.assign(NdbNodeBitmask::Size, conf->startedNodes);
+ c_alive_nodes.set(getOwnNodeId());
+ }
+ else
+ {
+ c_alive_nodes.assign(NdbNodeBitmask::Size, conf->startingNodes);
+ NdbNodeBitmask tmp;
+ tmp.assign(NdbNodeBitmask::Size, conf->startedNodes);
+ ndbrequire(tmp.isclear()); // No nodes can be started during SR
+ }
+
+ c_masterNodeId = conf->masterNodeId;
+
+ sendSTTORRY(signal);
+}
- Uint32 count = 0;
- for(Uint32 i = 0; i < MAX_NDB_NODES; i++){
- if(NodeBitmask::get(conf->allNodes, i)){
- jam();
-
- count++;
+void
+Suma::execAPI_START_REP(Signal* signal)
+{
+ Uint32 nodeId = signal->theData[0];
+ c_connected_nodes.set(nodeId);
+
+ check_start_handover(signal);
+}
- NodePtr node;
- ndbrequire(c_nodes.seize(node));
-
- node.p->nodeId = i;
- if(NodeBitmask::get(conf->inactiveNodes, i)){
- jam();
- node.p->alive = 0;
- } else {
- jam();
- node.p->alive = 1;
- c_aliveNodes.set(i);
- }
- } else
- jam();
+void
+Suma::check_start_handover(Signal* signal)
+{
+ if(c_startup.m_wait_handover)
+ {
+ NodeBitmask tmp;
+ tmp.assign(c_connected_nodes);
+ tmp.bitAND(c_subscriber_nodes);
+ if(!c_subscriber_nodes.equal(tmp))
+ {
+ return;
+ }
+
+ c_startup.m_wait_handover= false;
+ send_handover_req(signal);
}
- c_masterNodeId = conf->masterNodeId;
- ndbrequire(count == conf->noOfNodes);
+}
- sendSTTORRY(signal);
+void
+Suma::send_handover_req(Signal* signal)
+{
+ c_startup.m_handover_nodes.assign(c_alive_nodes);
+ c_startup.m_handover_nodes.bitAND(c_nodes_in_nodegroup_mask);
+ c_startup.m_handover_nodes.clear(getOwnNodeId());
+ Uint32 gci= m_last_complete_gci + 3;
+
+ SumaHandoverReq* req= (SumaHandoverReq*)signal->getDataPtrSend();
+ char buf[255];
+ c_startup.m_handover_nodes.getText(buf);
+ infoEvent("Suma: initiate handover with nodes %s GCI: %d",
+ buf, gci);
+
+ req->gci = gci;
+ req->nodeId = getOwnNodeId();
+
+ NodeReceiverGroup rg(SUMA, c_startup.m_handover_nodes);
+ sendSignal(rg, GSN_SUMA_HANDOVER_REQ, signal,
+ SumaHandoverReq::SignalLength, JBB);
}
#if 0
@@ -313,8 +425,10 @@
signal->theData[4] = 3;
signal->theData[5] = 5;
signal->theData[6] = 7;
- signal->theData[7] = 255; // No more start phases from missra
- sendSignal(NDBCNTR_REF, GSN_STTORRY, signal, 8, JBB);
+ signal->theData[7] = 100;
+ signal->theData[8] = 101;
+ signal->theData[9] = 255; // No more start phases from missra
+ sendSignal(NDBCNTR_REF, GSN_STTORRY, signal, 10, JBB);
}
void
@@ -326,12 +440,22 @@
void
Suma::execCONTINUEB(Signal* signal){
jamEntry();
-}
-
-void
-SumaParticipant::execCONTINUEB(Signal* signal)
-{
- jamEntry();
+ Uint32 type= signal->theData[0];
+ switch(type){
+ case SumaContinueB::RELEASE_GCI:
+ release_gci(signal, signal->theData[1], signal->theData[2]);
+ return;
+ case SumaContinueB::RESEND_BUCKET:
+ resend_bucket(signal,
+ signal->theData[1],
+ signal->theData[2],
+ signal->theData[3],
+ signal->theData[4]);
+ return;
+ case SumaContinueB::OUT_OF_BUFFER_RELEASE:
+ out_of_buffer_release(signal, signal->theData[1]);
+ return;
+ }
}
/*****************************************************************************
@@ -348,32 +472,60 @@
//BlockReference retRef = signal->theData[1];
c_failedApiNodes.set(failedApiNode);
+ c_connected_nodes.clear(failedApiNode);
bool found = removeSubscribersOnNode(signal, failedApiNode);
if(!found){
jam();
c_failedApiNodes.clear(failedApiNode);
}
+
+ SubGcpCompleteAck * const ack = (SubGcpCompleteAck*)signal->getDataPtr();
+ Ptr<Gcp_record> gcp;
+ for(c_gcp_list.first(gcp); !gcp.isNull(); c_gcp_list.next(gcp))
+ {
+ ack->rep.gci = gcp.p->m_gci;
+ if(gcp.p->m_subscribers.get(failedApiNode))
+ {
+ ack->rep.senderRef = numberToRef(0, failedApiNode);
+ sendSignal(SUMA_REF, GSN_SUB_GCP_COMPLETE_ACK, signal,
+ SubGcpCompleteAck::SignalLength, JBB);
+ }
+ }
+
+ c_subscriber_nodes.clear(failedApiNode);
+
+ check_start_handover(signal);
+
DBUG_VOID_RETURN;
}//execAPI_FAILREQ()
bool
-SumaParticipant::removeSubscribersOnNode(Signal *signal, Uint32 nodeId)
+Suma::removeSubscribersOnNode(Signal *signal, Uint32 nodeId)
{
- DBUG_ENTER("SumaParticipant::removeSubscribersOnNode");
+ DBUG_ENTER("Suma::removeSubscribersOnNode");
bool found = false;
- SubscriberPtr i_subbPtr;
- c_dataSubscribers.first(i_subbPtr);
- while(!i_subbPtr.isNull()){
- SubscriberPtr subbPtr = i_subbPtr;
- c_dataSubscribers.next(i_subbPtr);
- jam();
- if (refToNode(subbPtr.p->m_subscriberRef) == nodeId) {
+ KeyTable<Table>::Iterator it;
+ for(c_tables.first(it);!it.isNull();c_tables.next(it))
+ {
+ LocalDLList<Subscriber> subbs(c_subscriberPool,it.curr.p->c_subscribers);
+ SubscriberPtr i_subbPtr;
+ for(subbs.first(i_subbPtr);!i_subbPtr.isNull();)
+ {
+ SubscriberPtr subbPtr = i_subbPtr;
+ subbs.next(i_subbPtr);
jam();
- c_dataSubscribers.remove(subbPtr);
- c_removeDataSubscribers.add(subbPtr);
- found = true;
+ if (refToNode(subbPtr.p->m_senderRef) == nodeId) {
+ jam();
+ subbs.remove(subbPtr);
+ c_removeDataSubscribers.add(subbPtr);
+ found = true;
+ }
+ }
+ if (subbs.isEmpty())
+ {
+ // ToDo handle this
}
}
if(found){
@@ -384,10 +536,10 @@
}
void
-SumaParticipant::sendSubStopReq(Signal *signal, bool unlock){
- DBUG_ENTER("SumaParticipant::sendSubStopReq");
+Suma::sendSubStopReq(Signal *signal, bool unlock){
static bool remove_lock = false;
jam();
+ DBUG_ENTER("Suma::sendSubStopReq");
SubscriberPtr subbPtr;
c_removeDataSubscribers.first(subbPtr);
@@ -416,75 +568,54 @@
SubStopReq * const req = (SubStopReq*)signal->getDataPtrSend();
req->senderRef = reference();
req->senderData = subbPtr.i;
- req->subscriberRef = subbPtr.p->m_subscriberRef;
- req->subscriberData = subbPtr.p->m_subscriberData;
+ req->subscriberRef = subbPtr.p->m_senderRef;
+ req->subscriberData = subbPtr.p->m_senderData;
req->subscriptionId = subPtr.p->m_subscriptionId;
req->subscriptionKey = subPtr.p->m_subscriptionKey;
req->part = SubscriptionData::TableData;
- sendSignal(SUMA_REF, GSN_SUB_STOP_REQ, signal, SubStopReq::SignalLength, JBB);
+ sendSignal(SUMA_REF,GSN_SUB_STOP_REQ,signal,SubStopReq::SignalLength,JBB);
DBUG_VOID_RETURN;
}
void
-SumaParticipant::execSUB_STOP_CONF(Signal* signal){
+Suma::execSUB_STOP_CONF(Signal* signal){
jamEntry();
- DBUG_ENTER("SumaParticipant::execSUB_STOP_CONF");
-
- SubStopConf * const conf = (SubStopConf*)signal->getDataPtr();
-
- // Uint32 subscriberData = conf->subscriberData;
- // Uint32 subscriberRef = conf->subscriberRef;
-
- Subscription key;
- key.m_subscriptionId = conf->subscriptionId;
- key.m_subscriptionKey = conf->subscriptionKey;
-
- SubscriptionPtr subPtr;
- if(c_subscriptions.find(subPtr, key)) {
- jam();
- if (subPtr.p->m_markRemove) {
- jam();
- ndbrequire(false);
- ndbrequire(subPtr.p->m_nSubscribers > 0);
- subPtr.p->m_nSubscribers--;
- if (subPtr.p->m_nSubscribers == 0){
- jam();
- completeSubRemoveReq(signal, subPtr);
- }
- }
- }
-
+ DBUG_ENTER("Suma::execSUB_STOP_CONF");
+ ndbassert(signal->getNoOfSections() == 0);
sendSubStopReq(signal,true);
DBUG_VOID_RETURN;
}
void
-SumaParticipant::execSUB_STOP_REF(Signal* signal){
+Suma::execSUB_STOP_REF(Signal* signal){
jamEntry();
- DBUG_ENTER("SumaParticipant::execSUB_STOP_REF");
+ DBUG_ENTER("Suma::execSUB_STOP_REF");
+ ndbassert(signal->getNoOfSections() == 0);
SubStopRef * const ref = (SubStopRef*)signal->getDataPtr();
- Uint32 subscriptionId = ref->subscriptionId;
+ Uint32 senderData = ref->senderData;
+ Uint32 subscriptionId = ref->subscriptionId;
Uint32 subscriptionKey = ref->subscriptionKey;
- Uint32 part = ref->part;
- Uint32 subscriberData = ref->subscriberData;
- Uint32 subscriberRef = ref->subscriberRef;
- // Uint32 err = ref->err;
+ Uint32 part = ref->part;
+ Uint32 subscriberData = ref->subscriberData;
+ Uint32 subscriberRef = ref->subscriberRef;
- if(!ref->isTemporary()){
+ if(ref->errorCode != 1411){
ndbrequire(false);
}
SubStopReq * const req = (SubStopReq*)signal->getDataPtrSend();
- req->subscriberRef = subscriberRef;
- req->subscriberData = subscriberData;
- req->subscriptionId = subscriptionId;
+ req->senderRef = reference();
+ req->senderData = senderData;
+ req->subscriberRef = subscriberRef;
+ req->subscriberData = subscriberData;
+ req->subscriptionId = subscriptionId;
req->subscriptionKey = subscriptionKey;
req->part = part;
- sendSignal(SUMA_REF, GSN_SUB_STOP_REQ, signal, SubStopReq::SignalLength, JBB);
+ sendSignal(SUMA_REF,GSN_SUB_STOP_REQ,signal,SubStopReq::SignalLength,JBB);
DBUG_VOID_RETURN;
}
@@ -493,71 +624,55 @@
Suma::execNODE_FAILREP(Signal* signal){
jamEntry();
DBUG_ENTER("Suma::execNODE_FAILREP");
+ ndbassert(signal->getNoOfSections() == 0);
- NodeFailRep * const rep = (NodeFailRep*)signal->getDataPtr();
+ const NodeFailRep * rep = (NodeFailRep*)signal->getDataPtr();
+ NdbNodeBitmask failed; failed.assign(NdbNodeBitmask::Size, rep->theNodes);
- bool changed = false;
+ if(failed.get(Restart.nodeId))
+ {
+ Restart.nodeId = 0;
+ }
- NodePtr nodePtr;
-#ifdef NODEFAIL_DEBUG
- ndbout_c("Suma: nodefailrep");
-#endif
- c_nodeFailGCI = getFirstGCI(signal);
+ signal->theData[0] = SumaContinueB::RESEND_BUCKET;
- for(c_nodes.first(nodePtr); nodePtr.i != RNIL; c_nodes.next(nodePtr)){
- if(NodeBitmask::get(rep->theNodes, nodePtr.p->nodeId)){
- if(nodePtr.p->alive){
- ndbassert(c_aliveNodes.get(nodePtr.p->nodeId));
- changed = true;
- jam();
- } else {
- ndbassert(!c_aliveNodes.get(nodePtr.p->nodeId));
- jam();
- }
-
- if (c_preparingNodes.get(nodePtr.p->nodeId)) {
- jam();
- // we are currently preparing this node that died
- // it's ok just to clear and go back to waiting for it to start up
- Restart.resetNode(calcSumaBlockRef(nodePtr.p->nodeId));
- c_preparingNodes.clear(nodePtr.p->nodeId);
- } else if (c_handoverToDo) {
- jam();
- // TODO what if I'm a SUMA that is currently restarting and the SUMA
- // responsible for restarting me is the one that died?
+ NdbNodeBitmask tmp;
+ tmp.assign(c_alive_nodes);
+ tmp.bitANDC(failed);
- // a node has failed whilst handover is going on
- // let's check if we're in the process of handover with that node
- c_handoverToDo = false;
- for( int i = 0; i < NO_OF_BUCKETS; i++) {
- if (c_buckets[i].handover) {
- // I'm doing handover, but is it with the dead node?
- if (getResponsibleSumaNodeId(i) == nodePtr.p->nodeId) {
- // so it was the dead node, has handover started?
- if (c_buckets[i].handover_started) {
- jam();
- // we're not ok and will have lost data!
- // set not active to indicate this -
- // this will generate takeover behaviour
- c_buckets[i].active = false;
- c_buckets[i].handover_started = false;
- } // else we're ok to revert back to state before
- c_buckets[i].handover = false;
- } else {
- jam();
- // ok, we're doing handover with a different node
- c_handoverToDo = true;
- }
- }
+ NdbNodeBitmask takeover_nodes;
+
+ if(c_nodes_in_nodegroup_mask.overlaps(failed))
+ {
+ for( Uint32 i = 0; i < c_no_of_buckets; i++)
+ {
+ if(m_active_buckets.get(i))
+ continue;
+ else if(m_switchover_buckets.get(i))
+ {
+ Uint32 state= c_buckets[i].m_state;
+ if((state & Bucket::BUCKET_HANDOVER) &&
+ failed.get(get_responsible_node(i)))
+ {
+ m_active_buckets.set(i);
+ m_switchover_buckets.clear(i);
+ ndbout_c("aborting handover");
+ }
+ else if(state & Bucket::BUCKET_STARTING)
+ {
+ progError(__LINE__, ERR_SYSTEM_ERROR,
+ "Nodefailure during SUMA takeover");
}
}
-
- c_failoverBuffer.nodeFailRep();
-
- nodePtr.p->alive = 0;
- c_aliveNodes.clear(nodePtr.p->nodeId); // this has to be done after the loop
above
+ else if(get_responsible_node(i, tmp) == getOwnNodeId())
+ {
+ start_resend(signal, i);
+ }
}
}
+
+ c_alive_nodes.assign(tmp);
+
DBUG_VOID_RETURN;
}
@@ -566,49 +681,11 @@
jamEntry();
//const Uint32 senderRef = signal->theData[0];
- const Uint32 inclNode = signal->theData[1];
-
- NodePtr node;
- for(c_nodes.first(node); node.i != RNIL; c_nodes.next(node)){
- jam();
- const Uint32 nodeId = node.p->nodeId;
- if(inclNode == nodeId){
- jam();
-
- ndbrequire(node.p->alive == 0);
- ndbrequire(!c_aliveNodes.get(nodeId));
-
- for (Uint32 j = 0; j < c_noNodesInGroup; j++) {
- jam();
- if (c_nodesInGroup[j] == nodeId) {
- // the starting node is part of my node group
- jam();
- c_preparingNodes.set(nodeId); // set as being prepared
- for (Uint32 i = 0; i < c_noNodesInGroup; i++) {
- jam();
- if (i == c_idInNodeGroup) {
- jam();
- // I'm responsible for restarting this SUMA
- // ALL dict's should have meta data info so it is ok to start
- Restart.startNode(signal, calcSumaBlockRef(nodeId));
- break;
- }//if
- if (c_aliveNodes.get(c_nodesInGroup[i])) {
- jam();
- break; // another Suma takes care of this
- }//if
- }//for
- break;
- }//if
- }//for
-
- node.p->alive = 1;
- c_aliveNodes.set(nodeId);
-
- break;
- }//if
- }//for
+ const Uint32 nodeId = signal->theData[1];
+ ndbrequire(!c_alive_nodes.get(nodeId));
+ c_alive_nodes.set(nodeId);
+
#if 0 // if we include this DIH's got to be prepared, later if needed...
signal->theData[0] = reference();
@@ -629,10 +706,10 @@
*/
static unsigned
-count_subscribers(const DLList<SumaParticipant::Subscriber> &subs)
+count_subscribers(const DLList<Suma::Subscriber> &subs)
{
unsigned n= 0;
- SumaParticipant::SubscriberPtr i_subbPtr;
+ Suma::SubscriberPtr i_subbPtr;
subs.first(i_subbPtr);
while(!i_subbPtr.isNull()){
n++;
@@ -646,13 +723,14 @@
jamEntry();
Uint32 tCase = signal->theData[0];
+#if 0
if(tCase >= 8000 && tCase <= 8003){
SubscriptionPtr subPtr;
c_subscriptions.getPtr(subPtr, g_subPtrI);
Ptr<SyncRecord> syncPtr;
c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI);
-
+
if(tCase == 8000){
syncPtr.p->startMeta(signal);
}
@@ -674,15 +752,15 @@
attrs.append(att, 3);
}
}
-
+#endif
if(tCase == 8004){
infoEvent("Suma: c_subscriberPool size: %d free: %d",
c_subscriberPool.getSize(),
c_subscriberPool.getNoOfFree());
infoEvent("Suma: c_tablePool size: %d free: %d",
- c_tablePool_.getSize(),
- c_tablePool_.getNoOfFree());
+ c_tablePool.getSize(),
+ c_tablePool.getNoOfFree());
infoEvent("Suma: c_subscriptionPool size: %d free: %d",
c_subscriptionPool.getSize(),
@@ -698,119 +776,34 @@
infoEvent("Suma: c_metaSubscribers count: %d",
count_subscribers(c_metaSubscribers));
+#if 0
infoEvent("Suma: c_dataSubscribers count: %d",
count_subscribers(c_dataSubscribers));
infoEvent("Suma: c_prepDataSubscribers count: %d",
count_subscribers(c_prepDataSubscribers));
+#endif
infoEvent("Suma: c_removeDataSubscribers count: %d",
count_subscribers(c_removeDataSubscribers));
}
-}
-
-/********************************************************************
- *
- * Convert a table name (db+schema+tablename) to tableId
- *
- */
-
-#if 0
-void
-SumaParticipant::convertNameToId(SubscriptionPtr subPtr, Signal * signal)
-{
- jam();
- if(subPtr.p->m_currentTable < subPtr.p->m_maxTables) {
- jam();
-
- GetTableIdReq * req = (GetTableIdReq *)signal->getDataPtrSend();
- char * tableName = subPtr.p->m_tableNames[subPtr.p->m_currentTable];
- const Uint32 strLen = strlen(tableName) + 1; // NULL Terminated
- req->senderRef = reference();
- req->senderData = subPtr.i;
- req->len = strLen;
-
- LinearSectionPtr ptr[1];
- ptr[0].p = (Uint32*)tableName;
- ptr[0].sz = strLen;
-
- sendSignal(DBDICT_REF,
- GSN_GET_TABLEID_REQ,
- signal,
- GetTableIdReq::SignalLength,
- JBB,
- ptr,
- 1);
- } else {
- jam();
- sendSubCreateConf(signal, subPtr.p->m_subscriberRef, subPtr);
- }
-}
-#endif
-
-
-void
-SumaParticipant::addTableId(Uint32 tableId,
- SubscriptionPtr subPtr, SyncRecord *psyncRec)
-{
-#ifdef NODEFAIL_DEBUG
- ndbout_c("SumaParticipant::addTableId(%u,%u,%u), current_table=%u",
- tableId, subPtr.i, psyncRec, subPtr.p->m_currentTable);
-#endif
- subPtr.p->m_tables[tableId] = 1;
- subPtr.p->m_currentTable++;
- if(psyncRec != NULL)
- psyncRec->m_tableList.append(&tableId, 1);
-}
-#if 0
-void
-SumaParticipant::execGET_TABLEID_CONF(Signal * signal)
-{
- jamEntry();
-
- GetTableIdConf* conf = (GetTableIdConf *)signal->getDataPtr();
- Uint32 tableId = conf->tableId;
- //Uint32 schemaVersion = conf->schemaVersion;
- Uint32 senderData = conf->senderData;
-
- SubscriptionPtr subPtr;
- Ptr<SyncRecord> syncPtr;
-
- c_subscriptions.getPtr(subPtr, senderData);
- c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI);
-
- /*
- * add to m_tableList
- */
- addTableId(tableId, subPtr, syncPtr.p);
-
- convertNameToId(subPtr, signal);
-}
-
-void
-SumaParticipant::execGET_TABLEID_REF(Signal * signal)
-{
- jamEntry();
- GetTableIdRef const * ref = (GetTableIdRef *)signal->getDataPtr();
- Uint32 senderData = ref->senderData;
- // Uint32 err = ref->err;
-
- SubscriptionPtr subPtr;
- c_subscriptions.getPtr(subPtr, senderData);
- Uint32 subData = subPtr.p->m_subscriberData;
- SubCreateRef * reff = (SubCreateRef*)ref;
- /**
- * @todo: map ref->err to GrepError.
- */
- reff->err = GrepError::SELECTED_TABLE_NOT_FOUND;
- reff->subscriberData = subData;
- sendSignal(subPtr.p->m_subscriberRef,
- GSN_SUB_CREATE_REF,
- signal,
- SubCreateRef::SignalLength,
- JBB);
+ if(tCase == 8005)
+ {
+ for(Uint32 i = 0; i<c_no_of_buckets; i++)
+ {
+ Bucket* ptr= c_buckets + i;
+ infoEvent("Bucket %d %d%d-%x switch gci: %d max_acked_gci: %d max_gci: %d tail: %d
head: %d",
+ i,
+ m_active_buckets.get(i),
+ m_switchover_buckets.get(i),
+ ptr->m_state,
+ ptr->m_switchover_gci,
+ ptr->m_max_acked_gci,
+ ptr->m_buffer_head.m_max_gci,
+ ptr->m_buffer_tail,
+ ptr->m_buffer_head.m_page_id);
+ }
+ }
}
-#endif
-
/*************************************************************
*
@@ -822,7 +815,8 @@
Suma::execCREATE_SUBID_REQ(Signal* signal)
{
jamEntry();
-
+ DBUG_ENTER("Suma::execCREATE_SUBID_REQ");
+ ndbassert(signal->getNoOfSections() == 0);
CRASH_INSERTION(13001);
CreateSubscriptionIdReq const * req =
@@ -830,29 +824,32 @@
SubscriberPtr subbPtr;
if(!c_subscriberPool.seize(subbPtr)){
jam();
- sendSubIdRef(signal, GrepError::SUBSCRIPTION_ID_NOMEM);
- return;
+ sendSubIdRef(signal, req->senderRef, req->senderData, 1412);
+ DBUG_VOID_RETURN;
}
+ DBUG_PRINT("info",("c_subscriberPool size: %d free: %d",
+ c_subscriberPool.getSize(),
+ c_subscriberPool.getNoOfFree()));
- subbPtr.p->m_subscriberRef = signal->getSendersBlockRef();
- subbPtr.p->m_senderData = req->senderData;
- subbPtr.p->m_subscriberData = subbPtr.i;
+ subbPtr.p->m_senderRef = req->senderRef;
+ subbPtr.p->m_senderData = req->senderData;
UtilSequenceReq * utilReq = (UtilSequenceReq*)signal->getDataPtrSend();
-
- utilReq->senderData = subbPtr.p->m_subscriberData;
+ utilReq->senderData = subbPtr.i;
utilReq->sequenceId = SUMA_SEQUENCE;
utilReq->requestType = UtilSequenceReq::NextVal;
sendSignal(DBUTIL_REF, GSN_UTIL_SEQUENCE_REQ,
signal, UtilSequenceReq::SignalLength, JBB);
+
+ DBUG_VOID_RETURN;
}
void
Suma::execUTIL_SEQUENCE_CONF(Signal* signal)
{
jamEntry();
-
DBUG_ENTER("Suma::execUTIL_SEQUENCE_CONF");
+ ndbassert(signal->getNoOfSections() == 0);
CRASH_INSERTION(13002);
UtilSequenceConf * conf = (UtilSequenceConf*)signal->getDataPtr();
@@ -864,22 +861,22 @@
Uint64 subId;
memcpy(&subId,conf->sequenceValue,8);
- Uint32 subData = conf->senderData;
-
SubscriberPtr subbPtr;
- c_subscriberPool.getPtr(subbPtr,subData);
-
+ c_subscriberPool.getPtr(subbPtr,conf->senderData);
CreateSubscriptionIdConf * subconf = (CreateSubscriptionIdConf*)conf;
+ subconf->senderRef = reference();
+ subconf->senderData = subbPtr.p->m_senderData;
subconf->subscriptionId = (Uint32)subId;
subconf->subscriptionKey =(getOwnNodeId() << 16) | (Uint32)(subId &
0xFFFF);
- subconf->subscriberData = subbPtr.p->m_senderData;
- sendSignal(subbPtr.p->m_subscriberRef, GSN_CREATE_SUBID_CONF, signal,
+ sendSignal(subbPtr.p->m_senderRef, GSN_CREATE_SUBID_CONF, signal,
CreateSubscriptionIdConf::SignalLength, JBB);
c_subscriberPool.release(subbPtr);
-
+ DBUG_PRINT("info",("c_subscriberPool size: %d free: %d",
+ c_subscriberPool.getSize(),
+ c_subscriberPool.getNoOfFree()));
DBUG_VOID_RETURN;
}
@@ -888,7 +885,9 @@
{
jamEntry();
DBUG_ENTER("Suma::execUTIL_SEQUENCE_REF");
+ ndbassert(signal->getNoOfSections() == 0);
UtilSequenceRef * ref = (UtilSequenceRef*)signal->getDataPtr();
+ Uint32 err= ref->errorCode;
if(ref->requestType == UtilSequenceReq::Create) {
jam();
@@ -900,27 +899,35 @@
SubscriberPtr subbPtr;
c_subscriberPool.getPtr(subbPtr,subData);
- sendSubIdRef(signal, GrepError::SEQUENCE_ERROR);
+ sendSubIdRef(signal, subbPtr.p->m_senderRef, subbPtr.p->m_senderData, err);
c_subscriberPool.release(subbPtr);
+ DBUG_PRINT("info",("c_subscriberPool size: %d free: %d",
+ c_subscriberPool.getSize(),
+ c_subscriberPool.getNoOfFree()));
DBUG_VOID_RETURN;
}//execUTIL_SEQUENCE_REF()
void
-SumaParticipant::sendSubIdRef(Signal* signal, Uint32 errCode){
+Suma::sendSubIdRef(Signal* signal,
+ Uint32 senderRef, Uint32 senderData, Uint32 errCode)
+{
jam();
+ DBUG_ENTER("Suma::sendSubIdRef");
CreateSubscriptionIdRef * ref =
(CreateSubscriptionIdRef *)signal->getDataPtrSend();
- ref->err = errCode;
- sendSignal(signal->getSendersBlockRef(),
+ ref->senderRef = reference();
+ ref->senderData = senderData;
+ ref->errorCode = errCode;
+ sendSignal(senderRef,
GSN_CREATE_SUBID_REF,
signal,
CreateSubscriptionIdRef::SignalLength,
JBB);
- releaseSections(signal);
- return;
+ releaseSections(signal);
+ DBUG_VOID_RETURN;
}
/**********************************************************
@@ -929,227 +936,113 @@
* Creation of subscriptions
*/
+void
+Suma::addTableId(Uint32 tableId,
+ SubscriptionPtr subPtr, SyncRecord *psyncRec)
+{
+ DBUG_ENTER("Suma::addTableId");
+ DBUG_PRINT("enter",("tableId: %u subPtr.i: %u", tableId, subPtr.i));
+ subPtr.p->m_tableId= tableId;
+ if(psyncRec != NULL)
+ psyncRec->m_tableList.append(&tableId, 1);
+ DBUG_VOID_RETURN;
+}
+
void
-SumaParticipant::execSUB_CREATE_REQ(Signal* signal) {
-#ifdef NODEFAIL_DEBUG
- ndbout_c("SumaParticipant::execSUB_CREATE_REQ");
-#endif
+Suma::execSUB_CREATE_REQ(Signal* signal)
+{
jamEntry();
-
+ DBUG_ENTER("Suma::execSUB_CREATE_REQ");
+ ndbassert(signal->getNoOfSections() == 0);
CRASH_INSERTION(13003);
const SubCreateReq req = *(SubCreateReq*)signal->getDataPtr();
+ const Uint32 subRef = req.senderRef;
+ const Uint32 subData = req.senderData;
const Uint32 subId = req.subscriptionId;
const Uint32 subKey = req.subscriptionKey;
- const Uint32 subRef = req.subscriberRef;
- const Uint32 subData = req.subscriberData;
const Uint32 type = req.subscriptionType & SubCreateReq::RemoveFlags;
const Uint32 flags = req.subscriptionType & SubCreateReq::GetFlags;
const bool addTableFlag = (flags & SubCreateReq::AddTableFlag) != 0;
const bool restartFlag = (flags & SubCreateReq::RestartFlag) != 0;
-
- const Uint32 sender = signal->getSendersBlockRef();
+ const Uint32 tableId = req.tableId;
Subscription key;
key.m_subscriptionId = subId;
key.m_subscriptionKey = subKey;
+ DBUG_PRINT("enter",("key.m_subscriptionId: %u, key.m_subscriptionKey: %u",
+ key.m_subscriptionId, key.m_subscriptionKey));
+
SubscriptionPtr subPtr;
- Ptr<SyncRecord> syncPtr;
-
+
if (addTableFlag) {
ndbrequire(restartFlag); //TODO remove this
if(!c_subscriptions.find(subPtr, key)) {
jam();
- sendSubCreateRef(signal, req, GrepError::SUBSCRIPTION_NOT_FOUND);
- return;
+ sendSubCreateRef(signal, 1407);
+ DBUG_VOID_RETURN;
}
jam();
- c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI);
+ if (restartFlag)
+ {
+ ndbrequire(type != SubCreateReq::SingleTableScan);
+ ndbrequire(req.tableId != subPtr.p->m_tableId);
+ ndbrequire(type != SubCreateReq::TableEvent);
+ addTableId(req.tableId, subPtr, 0);
+ }
} else {
// Check that id/key is unique
if(c_subscriptions.find(subPtr, key)) {
jam();
- sendSubCreateRef(signal, req, GrepError::SUBSCRIPTION_ID_NOT_UNIQUE);
- return;
+ sendSubCreateRef(signal, 1415);
+ DBUG_VOID_RETURN;
}
if(!c_subscriptions.seize(subPtr)) {
jam();
- sendSubCreateRef(signal, req, GrepError::NOSPACE_IN_POOL);
- return;
- }
- if(!c_syncPool.seize(syncPtr)) {
- jam();
- sendSubCreateRef(signal, req, GrepError::NOSPACE_IN_POOL);
- return;
+ sendSubCreateRef(signal, 1412);
+ DBUG_VOID_RETURN;
}
+ DBUG_PRINT("info",("c_subscriptionPool size: %d free: %d",
+ c_subscriptionPool.getSize(),
+ c_subscriptionPool.getNoOfFree()));
jam();
- subPtr.p->m_subscriberRef = subRef;
- subPtr.p->m_subscriberData = subData;
+ subPtr.p->m_senderRef = subRef;
+ subPtr.p->m_senderData = subData;
subPtr.p->m_subscriptionId = subId;
subPtr.p->m_subscriptionKey = subKey;
subPtr.p->m_subscriptionType = type;
-
- /**
- * ok to memset? Support on all compilers
- * @todo find out if memset is supported by all compilers
- */
- memset(subPtr.p->m_tables,0,MAX_TABLES);
- subPtr.p->m_maxTables = 0;
- subPtr.p->m_currentTable = 0;
- subPtr.p->m_syncPtrI = syncPtr.i;
- subPtr.p->m_markRemove = false;
- subPtr.p->m_nSubscribers = 0;
+ subPtr.p->m_tableId = tableId;
+ subPtr.p->m_table_ptrI = RNIL;
+ subPtr.p->m_state = Subscription::DEFINED;
+ subPtr.p->n_subscribers = 0;
- c_subscriptions.add(subPtr);
-
- syncPtr.p->m_subscriptionPtrI = subPtr.i;
- syncPtr.p->m_doSendSyncData = true;
- syncPtr.p->ptrI = syncPtr.i;
- syncPtr.p->m_locked = false;
- syncPtr.p->m_error = false;
- }
-
- if (restartFlag ||
- type == SubCreateReq::TableEvent) {
+ DBUG_PRINT("info",("Added: key.m_subscriptionId: %u, key.m_subscriptionKey: %u",
+ key.m_subscriptionId, key.m_subscriptionKey));
- syncPtr.p->m_doSendSyncData = false;
-
- ndbrequire(type != SubCreateReq::SingleTableScan);
- jam();
-
- if (subPtr.p->m_tables[req.tableId] != 0) {
- ndbrequire(false); //TODO remove
- jam();
- sendSubCreateRef(signal, req, GrepError::SELECTED_TABLE_ALREADY_ADDED);
- return;
- }
- if (addTableFlag) {
- ndbrequire(type != SubCreateReq::TableEvent);
- jam();
- }
- subPtr.p->m_maxTables++;
- addTableId(req.tableId, subPtr, syncPtr.p);
- } else {
- switch(type){
- case SubCreateReq::SingleTableScan:
- {
- jam();
- syncPtr.p->m_tableList.append(&req.tableId, 1);
- if(signal->getNoOfSections() > 0){
- SegmentedSectionPtr ptr;
- signal->getSection(ptr, SubCreateReq::ATTRIBUTE_LIST);
- LocalDataBuffer<15> attrBuf(c_dataBufferPool,syncPtr.p->m_attributeList);
- append(attrBuf, ptr, getSectionSegmentPool());
- }
- }
- break;
-#if 0
- case SubCreateReq::SelectiveTableSnapshot:
- /**
- * Tables specified by the user that does not exist
- * in the database are just ignored. No error message
- * is given, nor does the db nodes crash
- * @todo: Memory is not release here (used tableBuf)
- */
- {
- if(signal->getNoOfSections() == 0 ){
- jam();
- sendSubCreateRef(signal, req, GrepError::WRONG_NO_OF_SECTIONS);
- return;
- }
-
- jam();
- SegmentedSectionPtr ptr;
- signal->getSection(ptr,0);// SubCreateReq::TABLE_LIST);
- SimplePropertiesSectionReader r0(ptr, getSectionSegmentPool());
- Uint32 i=0;
- char table[MAX_TAB_NAME_SIZE];
- r0.reset();
- r0.first();
- while(true){
- if ((r0.getValueType() != SimpleProperties::StringValue) ||
- (r0.getValueLen() <= 0)) {
- releaseSections(signal);
- ndbrequire(false);
- }
- r0.getString(table);
- strcpy(subPtr.p->m_tableNames[i],table);
- i++;
- if(!r0.next())
- break;
- }
- releaseSections(signal);
- subPtr.p->m_maxTables = i;
- subPtr.p->m_currentTable = 0;
- releaseSections(signal);
- convertNameToId(subPtr, signal);
- return;
- }
- break;
-#endif
- case SubCreateReq::DatabaseSnapshot:
- {
- jam();
- }
- break;
- default:
- ndbrequire(false);
- }
+ c_subscriptions.add(subPtr);
}
- sendSubCreateConf(signal, sender, subPtr);
-
- return;
+ SubCreateConf * const conf = (SubCreateConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->senderData = subPtr.p->m_senderData;
+ sendSignal(subRef, GSN_SUB_CREATE_CONF, signal, SubCreateConf::SignalLength, JBB);
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::sendSubCreateConf(Signal* signal, Uint32 sender,
- SubscriptionPtr subPtr)
+Suma::sendSubCreateRef(Signal* signal, Uint32 errCode)
{
- SubCreateConf * const conf = (SubCreateConf*)signal->getDataPtrSend();
- conf->subscriptionId = subPtr.p->m_subscriptionId;
- conf->subscriptionKey = subPtr.p->m_subscriptionKey;
- conf->subscriberData = subPtr.p->m_subscriberData;
- sendSignal(sender, GSN_SUB_CREATE_CONF, signal,
- SubCreateConf::SignalLength, JBB);
-}
-
-void
-SumaParticipant::sendSubCreateRef(Signal* signal, const SubCreateReq& req, Uint32
errCode){
jam();
SubCreateRef * ref = (SubCreateRef *)signal->getDataPtrSend();
- ref->subscriberRef = reference();
- ref->subscriberData = req.subscriberData;
- ref->err = errCode;
- releaseSections(signal);
+ ref->errorCode = errCode;
sendSignal(signal->getSendersBlockRef(), GSN_SUB_CREATE_REF, signal,
SubCreateRef::SignalLength, JBB);
return;
}
-
-
-
-
-
-
-
-
-
-
-
-Uint32
-SumaParticipant::getFirstGCI(Signal* signal) {
- if (c_lastCompleteGCI == RNIL) {
- ndbout_c("WARNING: c_lastCompleteGCI == RNIL");
- return 0;
- }
- return c_lastCompleteGCI+3;
-}
-
/**********************************************************
*
* Setting upp trigger for subscription
@@ -1157,13 +1050,12 @@
*/
void
-SumaParticipant::execSUB_SYNC_REQ(Signal* signal) {
+Suma::execSUB_SYNC_REQ(Signal* signal)
+{
jamEntry();
-
+ DBUG_ENTER("Suma::execSUB_SYNC_REQ");
+ ndbassert(signal->getNoOfSections() <= 1);
CRASH_INSERTION(13004);
-#ifdef EVENT_PH3_DEBUG
- ndbout_c("SumaParticipant::execSUB_SYNC_REQ");
-#endif
SubSyncReq * const req = (SubSyncReq*)signal->getDataPtr();
@@ -1171,28 +1063,61 @@
Subscription key;
key.m_subscriptionId = req->subscriptionId;
key.m_subscriptionKey = req->subscriptionKey;
-
- if(!c_subscriptions.find(subPtr, key)){
- jam();
- sendSubSyncRef(signal, GrepError::SUBSCRIPTION_ID_NOT_FOUND);
- return;
- }
- /**
- * @todo Tomas, do you really need to do this?
- */
- if(subPtr.p->m_subscriptionType == SubCreateReq::TableEvent) {
+ DBUG_PRINT("enter",("key.m_subscriptionId: %u, key.m_subscriptionKey: %u",
+ key.m_subscriptionId, key.m_subscriptionKey));
+
+ if(!c_subscriptions.find(subPtr, key))
+ {
jam();
- subPtr.p->m_subscriberData = req->subscriberData;
+ DBUG_PRINT("info",("Not found"));
+ sendSubSyncRef(signal, 1407);
+ DBUG_VOID_RETURN;
}
bool ok = false;
SubscriptionData::Part part = (SubscriptionData::Part)req->part;
Ptr<SyncRecord> syncPtr;
- c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI);
+ if(!c_syncPool.seize(syncPtr))
+ {
+ jam();
+ sendSubSyncRef(signal, 1416);
+ DBUG_VOID_RETURN;
+ }
+ DBUG_PRINT("info",("c_syncPool size: %d free: %d",
+ c_syncPool.getSize(),
+ c_syncPool.getNoOfFree()));
+ new (syncPtr.p) Ptr<SyncRecord>;
+ syncPtr.p->m_senderRef = req->senderRef;
+ syncPtr.p->m_senderData = req->senderData;
+ syncPtr.p->m_subscriptionPtrI = subPtr.i;
+ syncPtr.p->ptrI = syncPtr.i;
+ syncPtr.p->m_error = 0;
+
+ {
+ jam();
+ syncPtr.p->m_tableList.append(&subPtr.p->m_tableId, 1);
+ if(signal->getNoOfSections() > 0){
+ SegmentedSectionPtr ptr;
+ signal->getSection(ptr, SubSyncReq::ATTRIBUTE_LIST);
+ LocalDataBuffer<15> attrBuf(c_dataBufferPool,syncPtr.p->m_attributeList);
+ append(attrBuf, ptr, getSectionSegmentPool());
+ releaseSections(signal);
+ }
+ }
+
+ TablePtr tabPtr;
+ initTable(signal,subPtr.p->m_tableId,tabPtr,syncPtr);
+ tabPtr.p->n_subscribers++;
+ DBUG_PRINT("info",("Suma::Table[%u]::n_subscribers: %u",
+ tabPtr.p->m_tableId, tabPtr.p->n_subscribers));
+ DBUG_VOID_RETURN;
+
switch(part){
case SubscriptionData::MetaData:
+ ndbrequire(false);
+#if 0
ok = true;
jam();
if (subPtr.p->m_subscriptionType == SubCreateReq::DatabaseSnapshot) {
@@ -1218,6 +1143,7 @@
}
syncPtr.p->startMeta(signal);
+#endif
break;
case SubscriptionData::TableData: {
ok = true;
@@ -1227,21 +1153,20 @@
}
}
ndbrequire(ok);
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::sendSubSyncRef(Signal* signal, Uint32 errCode){
+Suma::sendSubSyncRef(Signal* signal, Uint32 errCode){
jam();
- SubSyncRef * ref =
- (SubSyncRef *)signal->getDataPtrSend();
- ref->err = errCode;
+ SubSyncRef * ref= (SubSyncRef *)signal->getDataPtrSend();
+ ref->errorCode = errCode;
+ releaseSections(signal);
sendSignal(signal->getSendersBlockRef(),
GSN_SUB_SYNC_REF,
signal,
SubSyncRef::SignalLength,
JBB);
-
- releaseSections(signal);
return;
}
@@ -1249,26 +1174,287 @@
* Dict interface
*/
+#if 0
void
-SumaParticipant::execLIST_TABLES_CONF(Signal* signal){
+Suma::execLIST_TABLES_CONF(Signal* signal){
jamEntry();
CRASH_INSERTION(13005);
ListTablesConf* const conf = (ListTablesConf*)signal->getDataPtr();
SyncRecord* tmp = c_syncPool.getPtr(conf->senderData);
tmp->runLIST_TABLES_CONF(signal);
}
+#endif
+
+
+/*************************************************************************
+ *
+ *
+ */
+#if 0
+void
+Suma::Table::runLIST_TABLES_CONF(Signal* signal){
+ jam();
+
+ ListTablesConf * const conf = (ListTablesConf*)signal->getDataPtr();
+ const Uint32 len = signal->length() - ListTablesConf::HeaderLength;
+
+ SubscriptionPtr subPtr;
+ suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
+
+ for (unsigned i = 0; i < len; i++) {
+ subPtr.p->m_maxTables++;
+ suma.addTableId(ListTablesConf::getTableId(conf->tableData[i]), subPtr, this);
+ }
+
+ // for (unsigned i = 0; i < len; i++)
+ // conf->tableData[i] = ListTablesConf::getTableId(conf->tableData[i]);
+ // m_tableList.append(&conf->tableData[0], len);
+
+#if 0
+ TableList::DataBufferIterator it;
+ int i = 0;
+ for(m_tableList.first(it);!it.isNull();m_tableList.next(it)) {
+ ndbout_c("%u listtableconf tableid %d", i++, *it.data);
+ }
+#endif
+
+ if(len == ListTablesConf::DataLength){
+ jam();
+ // we expect more LIST_TABLE_CONF
+ return;
+ }
+
+#if 0
+ subPtr.p->m_currentTable = 0;
+ subPtr.p->m_maxTables = 0;
+
+ TableList::DataBufferIterator it;
+ for(m_tableList.first(it); !it.isNull(); m_tableList.next(it)) {
+ subPtr.p->m_maxTables++;
+ suma.addTableId(*it.data, subPtr, NULL);
+#ifdef NODEFAIL_DEBUG
+ ndbout_c(" listtableconf tableid %d",*it.data);
+#endif
+ }
+#endif
+
+ startMeta(signal);
+}
+#endif
+
+
+int
+Suma::initTable(Signal *signal, Uint32 tableId, TablePtr &tabPtr,
+ SubscriberPtr subbPtr)
+{
+ DBUG_ENTER("Suma::initTable SubscriberPtr");
+ DBUG_PRINT("enter",("tableId: %d", tableId));
+
+ int r= initTable(signal,tableId,tabPtr);
+
+ {
+ LocalDLList<Subscriber> subscribers(c_subscriberPool,
+ tabPtr.p->c_subscribers);
+ subscribers.add(subbPtr);
+ }
+
+ DBUG_PRINT("info",("added subscriber: %i", subbPtr.i));
+
+ if (r)
+ {
+ // we have to wait getting tab info
+ DBUG_RETURN(1);
+ }
+
+ if (tabPtr.p->setupTrigger(signal, *this))
+ {
+ // we have to wait for triggers to be setup
+ DBUG_RETURN(1);
+ }
+
+ completeOneSubscriber(signal, tabPtr, subbPtr);
+ completeInitTable(signal, tabPtr);
+ DBUG_RETURN(0);
+}
+
+int
+Suma::initTable(Signal *signal, Uint32 tableId, TablePtr &tabPtr,
+ Ptr<SyncRecord> syncPtr)
+{
+ jam();
+ DBUG_ENTER("Suma::initTable Ptr<SyncRecord>");
+ DBUG_PRINT("enter",("tableId: %d", tableId));
+
+ int r= initTable(signal,tableId,tabPtr);
+
+ {
+ LocalDLList<SyncRecord> syncRecords(c_syncPool,tabPtr.p->c_syncRecords);
+ syncRecords.add(syncPtr);
+ }
+
+ if (r)
+ {
+ // we have to wait getting tab info
+ DBUG_RETURN(1);
+ }
+ completeInitTable(signal, tabPtr);
+ DBUG_RETURN(0);
+}
+
+int
+Suma::initTable(Signal *signal, Uint32 tableId, TablePtr &tabPtr)
+{
+ jam();
+ DBUG_ENTER("Suma::initTable");
+
+ if (!c_tables.find(tabPtr, tableId) ||
+ tabPtr.p->m_state == Table::DROPPED ||
+ tabPtr.p->m_state == Table::ALTERED)
+ {
+ // table not being prepared
+ // seize a new table, initialize and add to c_tables
+ ndbrequire(c_tablePool.seize(tabPtr));
+ DBUG_PRINT("info",("c_tablePool size: %d free: %d",
+ c_tablePool.getSize(),
+ c_tablePool.getNoOfFree()));
+ new (tabPtr.p) Table;
+
+ tabPtr.p->m_tableId= tableId;
+ tabPtr.p->m_ptrI= tabPtr.i;
+ tabPtr.p->n_subscribers = 0;
+ DBUG_PRINT("info",("Suma::Table[%u,i=%u]::n_subscribers: %u",
+ tabPtr.p->m_tableId, tabPtr.i, tabPtr.p->n_subscribers));
+
+ tabPtr.p->m_error = 0;
+ tabPtr.p->m_schemaVersion = RNIL;
+ tabPtr.p->m_state = Table::DEFINING;
+ tabPtr.p->m_hasTriggerDefined[0] = 0;
+ tabPtr.p->m_hasTriggerDefined[1] = 0;
+ tabPtr.p->m_hasTriggerDefined[2] = 0;
+ tabPtr.p->m_triggerIds[0] = ILLEGAL_TRIGGER_ID;
+ tabPtr.p->m_triggerIds[1] = ILLEGAL_TRIGGER_ID;
+ tabPtr.p->m_triggerIds[2] = ILLEGAL_TRIGGER_ID;
+
+ c_tables.add(tabPtr);
+
+ GetTabInfoReq * req = (GetTabInfoReq *)signal->getDataPtrSend();
+ req->senderRef = reference();
+ req->senderData = tabPtr.i;
+ req->requestType =
+ GetTabInfoReq::RequestById | GetTabInfoReq::LongSignalConf;
+ req->tableId = tableId;
+
+ DBUG_PRINT("info",("GET_TABINFOREQ id %d", req->tableId));
+ sendSignal(DBDICT_REF, GSN_GET_TABINFOREQ, signal,
+ GetTabInfoReq::SignalLength, JBB);
+ DBUG_RETURN(1);
+ }
+ if (tabPtr.p->m_state == Table::DEFINING)
+ {
+ DBUG_RETURN(1);
+ }
+ // ToDo should be a ref signal instead
+ ndbrequire(tabPtr.p->m_state == Table::DEFINED);
+ DBUG_RETURN(0);
+}
+
+void
+Suma::completeOneSubscriber(Signal *signal, TablePtr tabPtr, SubscriberPtr subbPtr)
+{
+ jam();
+ DBUG_ENTER("Suma::completeOneSubscriber");
+
+ if (tabPtr.p->m_error)
+ {
+ sendSubStartRef(signal,subbPtr,tabPtr.p->m_error,
+ SubscriptionData::TableData);
+ tabPtr.p->n_subscribers--;
+ }
+ else
+ {
+ SubscriptionPtr subPtr;
+ c_subscriptions.getPtr(subPtr, subbPtr.p->m_subPtrI);
+ subPtr.p->m_table_ptrI= tabPtr.i;
+ sendSubStartComplete(signal,subbPtr, m_last_complete_gci + 3,
+ SubscriptionData::TableData);
+ }
+ DBUG_VOID_RETURN;
+}
+
+void
+Suma::completeAllSubscribers(Signal *signal, TablePtr tabPtr)
+{
+ jam();
+ DBUG_ENTER("Suma::completeAllSubscribers");
+ // handle all subscribers
+ {
+ LocalDLList<Subscriber> subscribers(c_subscriberPool,
+ tabPtr.p->c_subscribers);
+ SubscriberPtr subbPtr;
+ for(subscribers.first(subbPtr);
+ !subbPtr.isNull();
+ subscribers.next(subbPtr))
+ {
+ completeOneSubscriber(signal, tabPtr, subbPtr);
+ }
+ }
+ DBUG_VOID_RETURN;
+}
+
+void
+Suma::completeInitTable(Signal *signal, TablePtr tabPtr)
+{
+ jam();
+ DBUG_ENTER("Suma::completeInitTable");
+
+ // handle all syncRecords
+ while (!tabPtr.p->c_syncRecords.isEmpty())
+ {
+ Ptr<SyncRecord> syncPtr;
+ {
+ LocalDLList<SyncRecord> syncRecords(c_syncPool,
+ tabPtr.p->c_syncRecords);
+ syncRecords.first(syncPtr);
+ syncRecords.remove(syncPtr);
+ }
+ syncPtr.p->ptrI = syncPtr.i;
+ if (tabPtr.p->m_error == 0)
+ {
+ jam();
+ syncPtr.p->startScan(signal);
+ }
+ else
+ {
+ jam();
+ syncPtr.p->completeScan(signal, tabPtr.p->m_error);
+ tabPtr.p->n_subscribers--;
+ }
+ }
+
+ if (tabPtr.p->m_error)
+ {
+ DBUG_PRINT("info",("Suma::Table[%u]::n_subscribers: %u",
+ tabPtr.p->m_tableId, tabPtr.p->n_subscribers));
+ tabPtr.p->checkRelease(*this);
+ }
+ else
+ {
+ tabPtr.p->m_state = Table::DEFINED;
+ }
+
+ DBUG_VOID_RETURN;
+}
void
-SumaParticipant::execGET_TABINFOREF(Signal* signal){
+Suma::execGET_TABINFOREF(Signal* signal){
jamEntry();
- GetTabInfoRef* const ref = (GetTabInfoRef*)signal->getDataPtr();
- SyncRecord* tmp = c_syncPool.getPtr(ref->senderData);
- tmp->runGET_TABINFOREF(signal);
+ /* ToDo handle this */
+ ndbrequire(false);
}
void
-SumaParticipant::execGET_TABINFO_CONF(Signal* signal){
+Suma::execGET_TABINFO_CONF(Signal* signal){
jamEntry();
CRASH_INSERTION(13006);
@@ -1278,23 +1464,30 @@
}
GetTabInfoConf* conf = (GetTabInfoConf*)signal->getDataPtr();
-
Uint32 tableId = conf->tableId;
- Uint32 senderData = conf->senderData;
-
- SyncRecord* tmp = c_syncPool.getPtr(senderData);
- ndbrequire(parseTable(signal, conf, tableId, tmp));
- tmp->runGET_TABINFO_CONF(signal);
+ TablePtr tabPtr;
+ c_tablePool.getPtr(tabPtr, conf->senderData);
+ SegmentedSectionPtr ptr;
+ signal->getSection(ptr, GetTabInfoConf::DICT_TAB_INFO);
+ ndbrequire(tabPtr.p->parseTable(ptr, *this));
+ releaseSections(signal);
+ /**
+ * We need to gather fragment info
+ */
+ jam();
+ signal->theData[0] = RNIL;
+ signal->theData[1] = tableId;
+ signal->theData[2] = tabPtr.i;
+ sendSignal(DBDIH_REF, GSN_DI_FCOUNTREQ, signal, 3, JBB);
}
bool
-SumaParticipant::parseTable(Signal* signal, GetTabInfoConf* conf, Uint32 tableId,
- SyncRecord* syncPtr_p){
-
- SegmentedSectionPtr ptr;
- signal->getSection(ptr, GetTabInfoConf::DICT_TAB_INFO);
+Suma::Table::parseTable(SegmentedSectionPtr ptr,
+ Suma &suma)
+{
+ DBUG_ENTER("Suma::Table::parseTable");
- SimplePropertiesSectionReader it(ptr, getSectionSegmentPool());
+ SimplePropertiesSectionReader it(ptr, suma.getSectionSegmentPool());
SimpleProperties::UnpackStatus s;
DictTabInfo::Table tableDesc; tableDesc.init();
@@ -1302,25 +1495,27 @@
DictTabInfo::TableMapping,
DictTabInfo::TableMappingSize,
true, true);
-
- ndbrequire(s == SimpleProperties::Break);
- TablePtr tabPtr;
- c_tables.find(tabPtr, tableId);
-
- if(!tabPtr.isNull() &&
- tabPtr.p->m_schemaVersion != tableDesc.TableVersion){
+ jam();
+ suma.suma_ndbrequire(s == SimpleProperties::Break);
+
+#if 0
+ToDo handle this
+ if(m_schemaVersion != tableDesc.TableVersion){
jam();
- tabPtr.p->release(* this);
+ release(* this);
// oops wrong schema version in stored tabledesc
// we need to find all subscriptions with old table desc
// and all subscribers to this
// hopefully none
c_tables.release(tabPtr);
+ DBUG_PRINT("info",("c_tablePool size: %d free: %d",
+ suma.c_tablePool.getSize(),
+ suma.c_tablePool.getNoOfFree()));
tabPtr.setNull();
- DLHashTable<SumaParticipant::Subscription>::Iterator i_subPtr;
+ DLHashTable<Suma::Subscription>::Iterator i_subPtr;
c_subscriptions.first(i_subPtr);
SubscriptionPtr subPtr;
for(;!i_subPtr.isNull();c_subscriptions.next(i_subPtr)){
@@ -1331,9 +1526,9 @@
jam();
continue;
}
- if (subPtr.p->m_tables[tableId]) {
+ if (subPtr.p->m_tables.get(tableId)) {
jam();
- subPtr.p->m_tables[tableId] = 0; // remove this old table reference
+ subPtr.p->m_tables.clear(tableId); // remove this old table reference
TableList::DataBufferIterator it;
for(tmp->m_tableList.first(it);!it.isNull();tmp->m_tableList.next(it)) {
jam();
@@ -1353,31 +1548,11 @@
}
}
}
-
- if (tabPtr.isNull()) {
- jam();
- /**
- * Uninitialized table record
- */
- ndbrequire(c_tables.seize(tabPtr));
- new (tabPtr.p) Table;
- tabPtr.p->m_schemaVersion = RNIL;
- tabPtr.p->m_tableId = tableId;
- tabPtr.p->m_hasTriggerDefined[0] = 0;
- tabPtr.p->m_hasTriggerDefined[1] = 0;
- tabPtr.p->m_hasTriggerDefined[2] = 0;
- tabPtr.p->m_triggerIds[0] = ILLEGAL_TRIGGER_ID;
- tabPtr.p->m_triggerIds[1] = ILLEGAL_TRIGGER_ID;
- tabPtr.p->m_triggerIds[2] = ILLEGAL_TRIGGER_ID;
-#if 0
- ndbout_c("Get tab info conf %d", tableId);
#endif
- c_tables.add(tabPtr);
- }
- if(tabPtr.p->m_attributes.getSize() != 0){
+ if(m_attributes.getSize() != 0){
jam();
- return true;
+ DBUG_RETURN(true);
}
/**
@@ -1385,22 +1560,24 @@
*/
Uint32 noAttribs = tableDesc.NoOfAttributes;
Uint32 notFixed = (tableDesc.NoOfNullable+tableDesc.NoOfVariable);
- tabPtr.p->m_schemaVersion = tableDesc.TableVersion;
+ m_schemaVersion = tableDesc.TableVersion;
// The attribute buffer
- LocalDataBuffer<15> attrBuf(c_dataBufferPool, tabPtr.p->m_attributes);
+ LocalDataBuffer<15> attrBuf(suma.c_dataBufferPool, m_attributes);
// Temporary buffer
- DataBuffer<15> theRest(c_dataBufferPool);
+ DataBuffer<15> theRest(suma.c_dataBufferPool);
if(!attrBuf.seize(noAttribs)){
- ndbrequire(false);
- return false;
+ jam();
+ suma.suma_ndbrequire(false);
+ DBUG_RETURN(false);
}
if(!theRest.seize(notFixed)){
- ndbrequire(false);
- return false;
+ jam();
+ suma.suma_ndbrequire(false);
+ DBUG_RETURN(false);
}
DataBuffer<15>::DataBufferIterator attrIt; // Fixed not nullable
@@ -1414,7 +1591,8 @@
DictTabInfo::AttributeMapping,
DictTabInfo::AttributeMappingSize,
true, true);
- ndbrequire(s == SimpleProperties::Break);
+ jam();
+ suma.suma_ndbrequire(s == SimpleProperties::Break);
if (!attrDesc.AttributeNullableFlag
/* && !attrDesc.AttributeVariableFlag */) {
@@ -1442,302 +1620,15 @@
theRest.release();
- return true;
-}
-
-void
-SumaParticipant::execDI_FCOUNTCONF(Signal* signal){
- jamEntry();
-
- CRASH_INSERTION(13007);
-
- const Uint32 senderData = signal->theData[3];
- SyncRecord* tmp = c_syncPool.getPtr(senderData);
- tmp->runDI_FCOUNTCONF(signal);
+ DBUG_RETURN(true);
}
void
-SumaParticipant::execDIGETPRIMCONF(Signal* signal){
- jamEntry();
-
- CRASH_INSERTION(13008);
-
- const Uint32 senderData = signal->theData[1];
- SyncRecord* tmp = c_syncPool.getPtr(senderData);
- tmp->runDIGETPRIMCONF(signal);
-}
-
-void
-SumaParticipant::execCREATE_TRIG_CONF(Signal* signal){
- jamEntry();
- DBUG_ENTER("SumaParticipant::execCREATE_TRIG_CONF");
- CRASH_INSERTION(13009);
-
- CreateTrigConf * const conf = (CreateTrigConf*)signal->getDataPtr();
-
- const Uint32 senderData = conf->getConnectionPtr();
- SyncRecord* tmp = c_syncPool.getPtr(senderData);
- tmp->runCREATE_TRIG_CONF(signal);
-
- /**
- * dodido
- * @todo: I (Johan) dont know what to do here. Jonas, what do you mean?
- */
- DBUG_VOID_RETURN;
-}
-
-void
-SumaParticipant::execCREATE_TRIG_REF(Signal* signal){
- jamEntry();
- ndbrequire(false);
-}
-
-void
-SumaParticipant::execDROP_TRIG_CONF(Signal* signal){
- jamEntry();
- DBUG_ENTER("SumaParticipant::execDROP_TRIG_CONF");
- CRASH_INSERTION(13010);
-
- DropTrigConf * const conf = (DropTrigConf*)signal->getDataPtr();
-
- const Uint32 senderData = conf->getConnectionPtr();
- SyncRecord* tmp = c_syncPool.getPtr(senderData);
- tmp->runDROP_TRIG_CONF(signal);
- DBUG_VOID_RETURN;
-}
-
-void
-SumaParticipant::execDROP_TRIG_REF(Signal* signal){
- jamEntry();
- DBUG_ENTER("SumaParticipant::execDROP_TRIG_CONF");
- DropTrigRef * const ref = (DropTrigRef*)signal->getDataPtr();
-
- const Uint32 senderData = ref->getConnectionPtr();
- SyncRecord* tmp = c_syncPool.getPtr(senderData);
- tmp->runDROP_TRIG_CONF(signal);
- DBUG_VOID_RETURN;
-}
-
-/*************************************************************************
- *
- *
- */
-
-void
-SumaParticipant::SyncRecord::runLIST_TABLES_CONF(Signal* signal){
- jam();
-
- ListTablesConf * const conf = (ListTablesConf*)signal->getDataPtr();
- const Uint32 len = signal->length() - ListTablesConf::HeaderLength;
-
- SubscriptionPtr subPtr;
- suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
-
- for (unsigned i = 0; i < len; i++) {
- subPtr.p->m_maxTables++;
- suma.addTableId(ListTablesConf::getTableId(conf->tableData[i]), subPtr, this);
- }
-
- // for (unsigned i = 0; i < len; i++)
- // conf->tableData[i] = ListTablesConf::getTableId(conf->tableData[i]);
- // m_tableList.append(&conf->tableData[0], len);
-
-#if 0
- TableList::DataBufferIterator it;
- int i = 0;
- for(m_tableList.first(it);!it.isNull();m_tableList.next(it)) {
- ndbout_c("%u listtableconf tableid %d", i++, *it.data);
- }
-#endif
-
- if(len == ListTablesConf::DataLength){
- jam();
- // we expect more LIST_TABLE_CONF
- return;
- }
-
-#if 0
- subPtr.p->m_currentTable = 0;
- subPtr.p->m_maxTables = 0;
-
- TableList::DataBufferIterator it;
- for(m_tableList.first(it); !it.isNull(); m_tableList.next(it)) {
- subPtr.p->m_maxTables++;
- suma.addTableId(*it.data, subPtr, NULL);
-#ifdef NODEFAIL_DEBUG
- ndbout_c(" listtableconf tableid %d",*it.data);
-#endif
- }
-#endif
-
- startMeta(signal);
-}
-
-void
-SumaParticipant::SyncRecord::startMeta(Signal* signal){
- jam();
- m_currentTable = 0;
- nextMeta(signal);
-}
-
-/**
- * m_tableList only contains UserTables
- */
-void
-SumaParticipant::SyncRecord::nextMeta(Signal* signal){
- jam();
-
- TableList::DataBufferIterator it;
- if(!m_tableList.position(it, m_currentTable)){
- completeMeta(signal);
- return;
- }
-
- GetTabInfoReq * req = (GetTabInfoReq *)signal->getDataPtrSend();
- req->senderRef = suma.reference();
- req->senderData = ptrI;
- req->requestType =
- GetTabInfoReq::RequestById | GetTabInfoReq::LongSignalConf;
- req->tableId = * it.data;
-
-#if 0
- ndbout_c("GET_TABINFOREQ id %d", req->tableId);
-#endif
- suma.sendSignal(DBDICT_REF, GSN_GET_TABINFOREQ, signal,
- GetTabInfoReq::SignalLength, JBB);
-}
-
-void
-SumaParticipant::SyncRecord::runGET_TABINFOREF(Signal* signal)
+Suma::execDI_FCOUNTCONF(Signal* signal)
{
- jam();
-
- SubscriptionPtr subPtr;
- suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
- ndbrequire(subPtr.p->m_syncPtrI == ptrI);
-
- Uint32 type = subPtr.p->m_subscriptionType;
-
- bool do_continue = false;
- switch (type) {
- case SubCreateReq::TableEvent:
- jam();
- break;
- case SubCreateReq::DatabaseSnapshot:
- jam();
- do_continue = true;
- break;
- case SubCreateReq::SelectiveTableSnapshot:
- jam();
- do_continue = true;
- break;
- case SubCreateReq::SingleTableScan:
- jam();
- break;
- default:
- ndbrequire(false);
- break;
- }
-
- if (! do_continue) {
- m_error = true;
- completeMeta(signal);
- return;
- }
-
- m_currentTable++;
- nextMeta(signal);
- return;
-
- // now we need to clean-up
-}
-
-
-void
-SumaParticipant::SyncRecord::runGET_TABINFO_CONF(Signal* signal){
- jam();
-
- GetTabInfoConf * const conf = (GetTabInfoConf*)signal->getDataPtr();
- // const Uint32 gci = conf->gci;
- const Uint32 tableId = conf->tableId;
- TableList::DataBufferIterator it;
-
- ndbrequire(m_tableList.position(it, m_currentTable));
- ndbrequire(* it.data == tableId);
-
- SubscriptionPtr subPtr;
- suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
- ndbrequire(subPtr.p->m_syncPtrI == ptrI);
-
- SegmentedSectionPtr ptr;
- signal->getSection(ptr, GetTabInfoConf::DICT_TAB_INFO);
-
- SubMetaData * data = (SubMetaData*)signal->getDataPtrSend();
- /**
- * sending lastCompleteGCI. Used by Lars in interval calculations
- * incremenet by one, since last_CompleteGCI is the not the current gci.
- */
- data->gci = suma.c_lastCompleteGCI + 1;
- data->tableId = tableId;
- data->senderData = subPtr.p->m_subscriberData;
-#if PRINT_ONLY
- ndbout_c("GSN_SUB_META_DATA Table %d", tableId);
-#else
-
- bool okToSend = m_doSendSyncData;
-
- /*
- * If it is a selectivetablesnapshot and the table is not part of the
- * subscription, then do not send anything, just continue.
- * If it is a tablevent, don't send regardless since the APIs are not
- * interested in meta data.
- */
- if(subPtr.p->m_subscriptionType == SubCreateReq::SelectiveTableSnapshot)
- if(!subPtr.p->m_tables[tableId])
- okToSend = false;
-
- if(okToSend) {
- if(refToNode(subPtr.p->m_subscriberRef) == 0){
- jam();
- suma.EXECUTE_DIRECT(refToBlock(subPtr.p->m_subscriberRef),
- GSN_SUB_META_DATA,
- signal,
- SubMetaData::SignalLength);
- jamEntry();
- suma.releaseSections(signal);
- } else {
- jam();
- suma.sendSignal(subPtr.p->m_subscriberRef,
- GSN_SUB_META_DATA,
- signal,
- SubMetaData::SignalLength, JBB);
- }
- }
-#endif
-
- TablePtr tabPtr;
- ndbrequire(suma.c_tables.find(tabPtr, tableId));
-
- LocalDataBuffer<15> fragBuf(suma.c_dataBufferPool, tabPtr.p->m_fragments);
- if(fragBuf.getSize() == 0){
- /**
- * We need to gather fragment info
- */
- jam();
- signal->theData[0] = RNIL;
- signal->theData[1] = tableId;
- signal->theData[2] = ptrI;
- suma.sendSignal(DBDIH_REF, GSN_DI_FCOUNTREQ, signal, 3, JBB);
- return;
- }
-
- m_currentTable++;
- nextMeta(signal);
-}
-
-void
-SumaParticipant::SyncRecord::runDI_FCOUNTCONF(Signal* signal){
- jam();
+ jamEntry();
+ DBUG_ENTER("Suma::execDI_FCOUNTCONF");
+ ndbassert(signal->getNoOfSections() == 0);
const Uint32 userPtr = signal->theData[0];
const Uint32 fragCount = signal->theData[1];
@@ -1746,25 +1637,31 @@
ndbrequire(userPtr == RNIL && signal->length() == 5);
TablePtr tabPtr;
- ndbrequire(suma.c_tables.find(tabPtr, tableId));
-
- LocalDataBuffer<15> fragBuf(suma.c_dataBufferPool, tabPtr.p->m_fragments);
+ tabPtr.i= signal->theData[3];
+ ndbrequire(tabPtr.p= c_tablePool.getPtr(tabPtr.i));
+ ndbrequire(tabPtr.p->m_tableId == tableId);
+
+ LocalDataBuffer<15> fragBuf(c_dataBufferPool, tabPtr.p->m_fragments);
ndbrequire(fragBuf.getSize() == 0);
- m_currentFragment = fragCount;
+ tabPtr.p->m_fragCount = fragCount;
+
signal->theData[0] = RNIL;
- signal->theData[1] = ptrI;
+ signal->theData[1] = tabPtr.i;
signal->theData[2] = tableId;
signal->theData[3] = 0; // Frag no
- suma.sendSignal(DBDIH_REF, GSN_DIGETPRIMREQ, signal, 4, JBB);
+ sendSignal(DBDIH_REF, GSN_DIGETPRIMREQ, signal, 4, JBB);
+
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::SyncRecord::runDIGETPRIMCONF(Signal* signal){
- jam();
+Suma::execDIGETPRIMCONF(Signal* signal){
+ jamEntry();
+ DBUG_ENTER("Suma::execDIGETPRIMCONF");
+ ndbassert(signal->getNoOfSections() == 0);
const Uint32 userPtr = signal->theData[0];
- //const Uint32 senderData = signal->theData[1];
const Uint32 nodeCount = signal->theData[6];
const Uint32 tableId = signal->theData[7];
const Uint32 fragNo = signal->theData[8];
@@ -1773,40 +1670,55 @@
ndbrequire(nodeCount > 0 && nodeCount <= MAX_REPLICAS);
TablePtr tabPtr;
- ndbrequire(suma.c_tables.find(tabPtr, tableId));
- LocalDataBuffer<15> fragBuf(suma.c_dataBufferPool, tabPtr.p->m_fragments);
+ tabPtr.i= signal->theData[1];
+ ndbrequire(tabPtr.p= c_tablePool.getPtr(tabPtr.i));
+ ndbrequire(tabPtr.p->m_tableId == tableId);
- /**
- * Add primary node for fragment to list
- */
- FragmentDescriptor fd;
- fd.m_fragDesc.m_nodeId = signal->theData[2];
- fd.m_fragDesc.m_fragmentNo = fragNo;
- signal->theData[2] = fd.m_dummy;
- fragBuf.append(&signal->theData[2], 1);
+ {
+ LocalDataBuffer<15> fragBuf(c_dataBufferPool,tabPtr.p->m_fragments);
+
+ /**
+ * Add primary node for fragment to list
+ */
+ FragmentDescriptor fd;
+ fd.m_fragDesc.m_nodeId = signal->theData[2];
+ fd.m_fragDesc.m_fragmentNo = fragNo;
+ signal->theData[2] = fd.m_dummy;
+ fragBuf.append(&signal->theData[2], 1);
+ }
const Uint32 nextFrag = fragNo + 1;
- if(nextFrag == m_currentFragment){
+ if(nextFrag == tabPtr.p->m_fragCount)
+ {
/**
* Complete frag info for table
+ * table is not up to date
*/
- m_currentTable++;
- nextMeta(signal);
- return;
+
+ if (tabPtr.p->c_subscribers.isEmpty())
+ {
+ completeInitTable(signal,tabPtr);
+ DBUG_VOID_RETURN;
+ }
+ tabPtr.p->setupTrigger(signal, *this);
+ DBUG_VOID_RETURN;
}
signal->theData[0] = RNIL;
- signal->theData[1] = ptrI;
+ signal->theData[1] = tabPtr.i;
signal->theData[2] = tableId;
signal->theData[3] = nextFrag; // Frag no
- suma.sendSignal(DBDIH_REF, GSN_DIGETPRIMREQ, signal, 4, JBB);
+ sendSignal(DBDIH_REF, GSN_DIGETPRIMREQ, signal, 4, JBB);
+
+ DBUG_VOID_RETURN;
}
+#if 0
void
-SumaParticipant::SyncRecord::completeMeta(Signal* signal){
+Suma::SyncRecord::completeTableInit(Signal* signal)
+{
jam();
SubscriptionPtr subPtr;
suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
- ndbrequire(subPtr.p->m_syncPtrI == ptrI);
#if PRINT_ONLY
ndbout_c("GSN_SUB_SYNC_CONF (meta)");
@@ -1816,24 +1728,21 @@
if (m_error) {
SubSyncRef * const ref = (SubSyncRef*)signal->getDataPtrSend();
- ref->subscriptionId = subPtr.p->m_subscriptionId;
- ref->subscriptionKey = subPtr.p->m_subscriptionKey;
- ref->part = SubscriptionData::MetaData;
- ref->subscriberData = subPtr.p->m_subscriberData;
+ ref->senderRef = suma.reference();
+ ref->senderData = subPtr.p->m_senderData;
ref->errorCode = SubSyncRef::Undefined;
- suma.sendSignal(subPtr.p->m_subscriberRef, GSN_SUB_SYNC_REF, signal,
+ suma.sendSignal(subPtr.p->m_senderRef, GSN_SUB_SYNC_REF, signal,
SubSyncRef::SignalLength, JBB);
} else {
SubSyncConf * const conf = (SubSyncConf*)signal->getDataPtrSend();
- conf->subscriptionId = subPtr.p->m_subscriptionId;
- conf->subscriptionKey = subPtr.p->m_subscriptionKey;
- conf->part = SubscriptionData::MetaData;
- conf->subscriberData = subPtr.p->m_subscriberData;
- suma.sendSignal(subPtr.p->m_subscriberRef, GSN_SUB_SYNC_CONF, signal,
+ conf->senderRef = suma.reference();
+ conf->senderData = subPtr.p->m_senderData;
+ suma.sendSignal(subPtr.p->m_senderRef, GSN_SUB_SYNC_CONF, signal,
SubSyncConf::SignalLength, JBB);
}
#endif
}
+#endif
/**********************************************************
*
@@ -1842,21 +1751,24 @@
*/
void
-SumaParticipant::SyncRecord::startScan(Signal* signal){
+Suma::SyncRecord::startScan(Signal* signal)
+{
jam();
+ DBUG_ENTER("Suma::SyncRecord::startScan");
/**
* Get fraginfo
*/
m_currentTable = 0;
m_currentFragment = 0;
-
nextScan(signal);
+ DBUG_VOID_RETURN;
}
bool
-SumaParticipant::SyncRecord::getNextFragment(TablePtr * tab,
- FragmentDescriptor * fd){
+Suma::SyncRecord::getNextFragment(TablePtr * tab,
+ FragmentDescriptor * fd)
+{
jam();
SubscriptionPtr subPtr;
suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
@@ -1864,20 +1776,15 @@
DataBuffer<15>::DataBufferIterator fragIt;
m_tableList.position(tabIt, m_currentTable);
- for(; !tabIt.curr.isNull(); m_tableList.next(tabIt), m_currentTable++){
+ for(; !tabIt.curr.isNull(); m_tableList.next(tabIt), m_currentTable++)
+ {
TablePtr tabPtr;
ndbrequire(suma.c_tables.find(tabPtr, * tabIt.data));
- if(subPtr.p->m_subscriptionType == SubCreateReq::SelectiveTableSnapshot)
- {
- if(!subPtr.p->m_tables[tabPtr.p->m_tableId]) {
- *tab = tabPtr;
- return true;
- }
- }
LocalDataBuffer<15> fragBuf(suma.c_dataBufferPool, tabPtr.p->m_fragments);
fragBuf.position(fragIt, m_currentFragment);
- for(; !fragIt.curr.isNull(); fragBuf.next(fragIt), m_currentFragment++){
+ for(; !fragIt.curr.isNull(); fragBuf.next(fragIt), m_currentFragment++)
+ {
FragmentDescriptor tmp;
tmp.m_dummy = * fragIt.data;
if(tmp.m_fragDesc.m_nodeId == suma.getOwnNodeId()){
@@ -1887,36 +1794,30 @@
}
}
m_currentFragment = 0;
+
+ tabPtr.p->n_subscribers--;
+ DBUG_PRINT("info",("Suma::Table[%u]::n_subscribers: %u",
+ tabPtr.p->m_tableId, tabPtr.p->n_subscribers));
+ tabPtr.p->checkRelease(suma);
}
return false;
}
void
-SumaParticipant::SyncRecord::nextScan(Signal* signal){
+Suma::SyncRecord::nextScan(Signal* signal)
+{
jam();
+ DBUG_ENTER("Suma::SyncRecord::nextScan");
TablePtr tabPtr;
FragmentDescriptor fd;
SubscriptionPtr subPtr;
if(!getNextFragment(&tabPtr, &fd)){
jam();
completeScan(signal);
- return;
+ DBUG_VOID_RETURN;
}
suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
- ndbrequire(subPtr.p->m_syncPtrI == ptrI);
- if(subPtr.p->m_subscriptionType == SubCreateReq::SelectiveTableSnapshot) {
- jam();
- if(!subPtr.p->m_tables[tabPtr.p->m_tableId]) {
- /*
- * table is not part of the subscription. Check next table
- */
- m_currentTable++;
- nextScan(signal);
- return;
- }
- }
-
DataBuffer<15>::Head head = m_attributeList;
if(head.getSize() == 0){
head = tabPtr.p->m_attributes;
@@ -1927,7 +1828,7 @@
const Uint32 parallelism = 16;
const Uint32 attrLen = 5 + attrBuf.getSize();
- req->senderData = m_subscriptionPtrI;
+ req->senderData = ptrI;
req->resultRef = suma.reference();
req->tableId = tabPtr.p->m_tableId;
req->requestInfo = 0;
@@ -1941,7 +1842,7 @@
req->transId1 = 0;
req->transId2 = (SUMA << 20) + (suma.getOwnNodeId() << 8);
req->clientOpPtr = (ptrI << 16);
- req->batch_size_rows= 16;
+ req->batch_size_rows= parallelism;
req->batch_size_bytes= 0;
suma.sendSignal(DBLQH_REF, GSN_SCAN_FRAGREQ, signal,
ScanFragReq::SignalLength, JBB);
@@ -1963,7 +1864,7 @@
AttributeHeader::init(&signal->theData[dataPos++], * it.data, 0);
if(dataPos == 25){
suma.sendSignal(DBLQH_REF, GSN_ATTRINFO, signal, 25, JBB);
- dataPos = 3;
+ dataPos = 3;
}
}
if(dataPos != 3){
@@ -1972,11 +1873,13 @@
m_currentTableId = tabPtr.p->m_tableId;
m_currentNoOfAttributes = attrBuf.getSize();
+
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::execSCAN_FRAGREF(Signal* signal){
+Suma::execSCAN_FRAGREF(Signal* signal){
jamEntry();
// ScanFragRef * const ref = (ScanFragRef*)signal->getDataPtr();
@@ -1984,9 +1887,10 @@
}
void
-SumaParticipant::execSCAN_FRAGCONF(Signal* signal){
+Suma::execSCAN_FRAGCONF(Signal* signal){
jamEntry();
-
+ DBUG_ENTER("Suma::execSCAN_FRAGCONF");
+ ndbassert(signal->getNoOfSections() == 0);
CRASH_INSERTION(13011);
ScanFragConf * const conf = (ScanFragConf*)signal->getDataPtr();
@@ -1995,8 +1899,8 @@
const Uint32 senderData = conf->senderData;
const Uint32 completedOps = conf->completedOps;
- SubscriptionPtr subPtr;
- c_subscriptions.getPtr(subPtr, senderData);
+ Ptr<SyncRecord> syncPtr;
+ c_syncPool.getPtr(syncPtr, senderData);
if(completed != 2){
jam();
@@ -2009,25 +1913,25 @@
execSUB_SYNC_CONTINUE_CONF(signal);
#else
SubSyncContinueReq * const req = (SubSyncContinueReq*)signal->getDataPtrSend();
- req->subscriberData = subPtr.p->m_subscriberData;
+ req->subscriberData = syncPtr.p->m_senderData;
req->noOfRowsSent = completedOps;
- sendSignal(subPtr.p->m_subscriberRef, GSN_SUB_SYNC_CONTINUE_REQ, signal,
+ sendSignal(syncPtr.p->m_senderRef, GSN_SUB_SYNC_CONTINUE_REQ, signal,
SubSyncContinueReq::SignalLength, JBB);
#endif
- return;
+ DBUG_VOID_RETURN;
}
ndbrequire(completedOps == 0);
- SyncRecord* tmp = c_syncPool.getPtr(subPtr.p->m_syncPtrI);
-
- tmp->m_currentFragment++;
- tmp->nextScan(signal);
+ syncPtr.p->m_currentFragment++;
+ syncPtr.p->nextScan(signal);
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::execSUB_SYNC_CONTINUE_CONF(Signal* signal){
+Suma::execSUB_SYNC_CONTINUE_CONF(Signal* signal){
jamEntry();
+ ndbassert(signal->getNoOfSections() == 0);
CRASH_INSERTION(13012);
@@ -2053,29 +1957,43 @@
}
void
-SumaParticipant::SyncRecord::completeScan(Signal* signal){
+Suma::SyncRecord::completeScan(Signal* signal, int error)
+{
jam();
+ DBUG_ENTER("Suma::SyncRecord::completeScan");
// m_tableList.release();
- SubscriptionPtr subPtr;
- suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
- ndbrequire(subPtr.p->m_syncPtrI == ptrI);
-
#if PRINT_ONLY
ndbout_c("GSN_SUB_SYNC_CONF (data)");
#else
- SubSyncConf * const conf = (SubSyncConf*)signal->getDataPtrSend();
- conf->subscriptionId = subPtr.p->m_subscriptionId;
- conf->subscriptionKey = subPtr.p->m_subscriptionKey;
- conf->part = SubscriptionData::TableData;
- conf->subscriberData = subPtr.p->m_subscriberData;
- suma.sendSignal(subPtr.p->m_subscriberRef, GSN_SUB_SYNC_CONF, signal,
- SubSyncConf::SignalLength, JBB);
+ if (error == 0)
+ {
+ SubSyncConf * const conf = (SubSyncConf*)signal->getDataPtrSend();
+ conf->senderRef = suma.reference();
+ conf->senderData = m_senderData;
+ suma.sendSignal(m_senderRef, GSN_SUB_SYNC_CONF, signal,
+ SubSyncConf::SignalLength, JBB);
+ }
+ else
+ {
+ SubSyncRef * const ref = (SubSyncRef*)signal->getDataPtrSend();
+ ref->senderRef = suma.reference();
+ ref->senderData = m_senderData;
+ suma.sendSignal(m_senderRef, GSN_SUB_SYNC_REF, signal,
+ SubSyncRef::SignalLength, JBB);
+ }
#endif
+
+ release();
+ suma.c_syncPool.release(ptrI);
+ DBUG_PRINT("info",("c_syncPool size: %d free: %d",
+ suma.c_syncPool.getSize(),
+ suma.c_syncPool.getNoOfFree()));
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::execSCAN_HBREP(Signal* signal){
+Suma::execSCAN_HBREP(Signal* signal){
jamEntry();
#if 0
ndbout << "execSCAN_HBREP" << endl << hex;
@@ -2097,502 +2015,714 @@
*/
void
-SumaParticipant::execSUB_START_REQ(Signal* signal){
+Suma::execSUB_START_REQ(Signal* signal){
jamEntry();
- DBUG_ENTER("SumaParticipant::execSUB_START_REQ");
-
- CRASH_INSERTION(13013);
-
- if (c_restartLock) {
- jam();
- // ndbout_c("c_restartLock");
- if (RtoI(signal->getSendersBlockRef(), false) == RNIL) {
- jam();
- sendSubStartRef(signal, /** Error Code */ 0, true);
- DBUG_VOID_RETURN;
- }
- // only allow other Suma's in the nodegroup to come through for restart purposes
- }
-
- Subscription key;
-
+ ndbassert(signal->getNoOfSections() == 0);
+ DBUG_ENTER("Suma::execSUB_START_REQ");
SubStartReq * const req = (SubStartReq*)signal->getDataPtr();
+ CRASH_INSERTION(13013);
Uint32 senderRef = req->senderRef;
Uint32 senderData = req->senderData;
Uint32 subscriberData = req->subscriberData;
Uint32 subscriberRef = req->subscriberRef;
SubscriptionData::Part part = (SubscriptionData::Part)req->part;
+
+ Subscription key;
key.m_subscriptionId = req->subscriptionId;
key.m_subscriptionKey = req->subscriptionKey;
-
+
+ if (c_startup.m_restart_server_node_id &&
+ refToNode(senderRef) != c_startup.m_restart_server_node_id)
+ {
+ /**
+ * only allow "restart_server" Suma's to come through
+ * for restart purposes
+ */
+ jam();
+ sendSubStartRef(signal, 1405);
+ DBUG_VOID_RETURN;
+ }
+
SubscriptionPtr subPtr;
if(!c_subscriptions.find(subPtr, key)){
jam();
- sendSubStartRef(signal, /** Error Code */ 0);
+ sendSubStartRef(signal, 1407);
DBUG_VOID_RETURN;
}
- Ptr<SyncRecord> syncPtr;
- c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI);
- if (syncPtr.p->m_locked) {
+ if (subPtr.p->m_state != Subscription::DEFINED) {
jam();
-#if 0
- ndbout_c("Locked");
-#endif
- sendSubStartRef(signal, /** Error Code */ 0, true);
+ DBUG_PRINT("info",("Locked"));
+ sendSubStartRef(signal, 1411);
DBUG_VOID_RETURN;
}
- syncPtr.p->m_locked = true;
SubscriberPtr subbPtr;
if(!c_subscriberPool.seize(subbPtr)){
jam();
- syncPtr.p->m_locked = false;
- sendSubStartRef(signal, /** Error Code */ 0);
+ sendSubStartRef(signal, 1412);
DBUG_VOID_RETURN;
}
+ DBUG_PRINT("info",("c_subscriberPool size: %d free: %d",
+ c_subscriberPool.getSize(),
+ c_subscriberPool.getNoOfFree()));
+
+ c_subscriber_nodes.set(refToNode(subscriberRef));
+
+ // setup subscription record
+ subPtr.p->m_state = Subscription::LOCKED;
+ // store these here for later use
+ subPtr.p->m_senderRef = senderRef;
+ subPtr.p->m_senderData = senderData;
- Uint32 type = subPtr.p->m_subscriptionType;
-
- subbPtr.p->m_senderRef = senderRef;
- subbPtr.p->m_senderData = senderData;
-
- switch (type) {
- case SubCreateReq::TableEvent:
- jam();
- // we want the data to return to the API not DICT
- subbPtr.p->m_subscriberRef = subscriberRef;
- // ndbout_c("start ref = %u", signal->getSendersBlockRef());
- // ndbout_c("ref = %u", subbPtr.p->m_subscriberRef);
- // we use the subscription id for now, should really be API choice
- subbPtr.p->m_subscriberData = subscriberData;
+ // setup subscriber record
+ subbPtr.p->m_senderRef = subscriberRef;
+ subbPtr.p->m_senderData = subscriberData;
+ subbPtr.p->m_subPtrI= subPtr.i;
+
+ DBUG_PRINT("info",("subscriber: %u[%u,%u] subscription: %u[%u,%u] "
+ "tableId: %u id: %u key: %u",
+ subbPtr.i, subbPtr.p->m_senderRef, subbPtr.p->m_senderData,
+ subPtr.i, subPtr.p->m_senderRef, subPtr.p->m_senderData,
+ subPtr.p->m_tableId,
+ subPtr.p->m_subscriptionId,subPtr.p->m_subscriptionKey));
-#if 0
- if (RtoI(signal->getSendersBlockRef(), false) == RNIL) {
- jam();
- for (Uint32 i = 0; i < c_noNodesInGroup; i++) {
- Uint32 ref = calcSumaBlockRef(c_nodesInGroup[i]);
- if (ref != reference()) {
- jam();
- sendSubStartReq(subPtr, subbPtr, signal, ref);
- } else
- jam();
- }
- }
-#endif
- break;
- case SubCreateReq::DatabaseSnapshot:
- case SubCreateReq::SelectiveTableSnapshot:
- jam();
- ndbrequire(false);
- //subbPtr.p->m_subscriberRef = GREP_REF;
- subbPtr.p->m_subscriberData = subPtr.p->m_subscriberData;
- break;
- case SubCreateReq::SingleTableScan:
- jam();
- subbPtr.p->m_subscriberRef = subPtr.p->m_subscriberRef;
- subbPtr.p->m_subscriberData = subPtr.p->m_subscriberData;
- }
-
- subbPtr.p->m_subPtrI = subPtr.i;
- subbPtr.p->m_firstGCI = RNIL;
- if (type == SubCreateReq::TableEvent)
- subbPtr.p->m_lastGCI = 0;
- else
- subbPtr.p->m_lastGCI = RNIL; // disable usage of m_lastGCI
- bool ok = false;
-
+ TablePtr tabPtr;
switch(part){
case SubscriptionData::MetaData:
- ok = true;
jam();
c_metaSubscribers.add(subbPtr);
sendSubStartComplete(signal, subbPtr, 0, part);
- break;
+ DBUG_VOID_RETURN;
case SubscriptionData::TableData:
- ok = true;
jam();
- c_prepDataSubscribers.add(subbPtr);
- syncPtr.p->startTrigger(signal);
- break;
+ initTable(signal,subPtr.p->m_tableId,tabPtr,subbPtr);
+ tabPtr.p->n_subscribers++;
+ DBUG_PRINT("info",("Suma::Table[%u]::n_subscribers: %u",
+ tabPtr.p->m_tableId, tabPtr.p->n_subscribers));
+ DBUG_VOID_RETURN;
}
- ndbrequire(ok);
- DBUG_VOID_RETURN;
+ ndbrequire(false);
}
void
-SumaParticipant::sendSubStartComplete(Signal* signal,
- SubscriberPtr subbPtr,
- Uint32 firstGCI,
- SubscriptionData::Part part){
+Suma::sendSubStartComplete(Signal* signal,
+ SubscriberPtr subbPtr,
+ Uint32 firstGCI,
+ SubscriptionData::Part part)
+{
jam();
+ DBUG_ENTER("Suma::sendSubStartComplete");
SubscriptionPtr subPtr;
c_subscriptions.getPtr(subPtr, subbPtr.p->m_subPtrI);
+ ndbrequire( subPtr.p->m_state == Subscription::LOCKED )
+ subPtr.p->m_state = Subscription::DEFINED;
+ subPtr.p->n_subscribers++;
+
+ DBUG_PRINT("info",("subscriber: %u[%u,%u] subscription: %u[%u,%u] "
+ "tableId: %u[i=%u] id: %u key: %u",
+ subbPtr.i, subbPtr.p->m_senderRef, subbPtr.p->m_senderData,
+ subPtr.i, subPtr.p->m_senderRef, subPtr.p->m_senderData,
+ subPtr.p->m_tableId, subPtr.p->m_table_ptrI,
+ subPtr.p->m_subscriptionId,subPtr.p->m_subscriptionKey));
- Ptr<SyncRecord> syncPtr;
- c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI);
- syncPtr.p->m_locked = false;
-
- SubStartConf * const conf = (SubStartConf*)signal->getDataPtrSend();
+ SubStartConf * const conf = (SubStartConf*)signal->getDataPtrSend();
conf->senderRef = reference();
- conf->senderData = subbPtr.p->m_senderData;
+ conf->senderData = subPtr.p->m_senderData;
conf->subscriptionId = subPtr.p->m_subscriptionId;
conf->subscriptionKey = subPtr.p->m_subscriptionKey;
- conf->firstGCI = firstGCI;
- conf->part = (Uint32) part;
-
- conf->subscriberData = subPtr.p->m_subscriberData;
- sendSignal(subPtr.p->m_subscriberRef, GSN_SUB_START_CONF, signal,
+ conf->firstGCI = firstGCI;
+ conf->part = (Uint32) part;
+
+ DBUG_PRINT("info",("subscriber: %u id: %u key: %u", subbPtr.i,
+ subPtr.p->m_subscriptionId,subPtr.p->m_subscriptionKey));
+ sendSignal(subPtr.p->m_senderRef, GSN_SUB_START_CONF, signal,
SubStartConf::SignalLength, JBB);
+ DBUG_VOID_RETURN;
}
-#if 0
void
-SumaParticipant::sendSubStartRef(SubscriptionPtr subPtr,
- Signal* signal, Uint32 errCode,
- bool temporary){
+Suma::sendSubStartRef(Signal* signal, Uint32 errCode)
+{
jam();
SubStartRef * ref = (SubStartRef *)signal->getDataPtrSend();
- xxx ref->senderRef = reference();
- xxx ref->senderData = subPtr.p->m_senderData;
- ref->subscriptionId = subPtr.p->m_subscriptionId;
- ref->subscriptionKey = subPtr.p->m_subscriptionKey;
- ref->part = (Uint32) subPtr.p->m_subscriptionType;
- ref->subscriberData = subPtr.p->m_subscriberData;
- ref->err = errCode;
- if (temporary) {
- jam();
- ref->setTemporary();
- }
+ ref->senderRef = reference();
+ ref->errorCode = errCode;
releaseSections(signal);
- sendSignal(subPtr.p->m_subscriberRef, GSN_SUB_START_REF, signal,
+ sendSignal(signal->getSendersBlockRef(), GSN_SUB_START_REF, signal,
SubStartRef::SignalLength, JBB);
}
-#endif
void
-SumaParticipant::sendSubStartRef(Signal* signal, Uint32 errCode,
- bool temporary){
+Suma::sendSubStartRef(Signal* signal,
+ SubscriberPtr subbPtr, Uint32 error,
+ SubscriptionData::Part part)
+{
jam();
- SubStartRef * ref = (SubStartRef *)signal->getDataPtrSend();
- ref->senderRef = reference();
- ref->err = errCode;
- if (temporary) {
- jam();
- ref->setTemporary();
- }
- releaseSections(signal);
- sendSignal(signal->getSendersBlockRef(), GSN_SUB_START_REF, signal,
+
+ SubscriptionPtr subPtr;
+ c_subscriptions.getPtr(subPtr, subbPtr.p->m_subPtrI);
+
+ ndbrequire( subPtr.p->m_state == Subscription::LOCKED );
+ subPtr.p->m_state = Subscription::DEFINED;
+
+ SubStartRef * ref= (SubStartRef *)signal->getDataPtrSend();
+ ref->senderRef = reference();
+ ref->senderData = subPtr.p->m_senderData;
+ ref->subscriptionId = subPtr.p->m_subscriptionId;
+ ref->subscriptionKey = subPtr.p->m_subscriptionKey;
+ ref->part = (Uint32) part;
+ ref->errorCode = error;
+
+ sendSignal(subPtr.p->m_senderRef, GSN_SUB_START_REF, signal,
SubStartRef::SignalLength, JBB);
}
/**********************************************************
+ * Suma participant interface
*
- * Trigger admin interface
+ * Stopping and removing of subscriber
*
*/
void
-SumaParticipant::SyncRecord::startTrigger(Signal* signal){
- jam();
- m_currentTable = 0;
- m_latestTriggerId = RNIL;
- nextTrigger(signal);
+Suma::execSUB_STOP_REQ(Signal* signal){
+ jamEntry();
+ ndbassert(signal->getNoOfSections() == 0);
+ DBUG_ENTER("Suma::execSUB_STOP_REQ");
+
+ CRASH_INSERTION(13019);
+
+ SubStopReq * const req = (SubStopReq*)signal->getDataPtr();
+ Uint32 senderRef = req->senderRef;
+ Uint32 senderData = req->senderData;
+ Uint32 subscriberRef = req->subscriberRef;
+ Uint32 subscriberData = req->subscriberData;
+ SubscriptionPtr subPtr;
+ Subscription key;
+ key.m_subscriptionId = req->subscriptionId;
+ key.m_subscriptionKey = req->subscriptionKey;
+ Uint32 part = req->part;
+
+ if (key.m_subscriptionKey == 0 &&
+ key.m_subscriptionId == 0 &&
+ subscriberData == 0)
+ {
+ SubStopConf* conf = (SubStopConf*)signal->getDataPtrSend();
+
+ conf->senderRef = reference();
+ conf->senderData = senderData;
+ conf->subscriptionId = key.m_subscriptionId;
+ conf->subscriptionKey = key.m_subscriptionKey;
+ conf->subscriberData = subscriberData;
+
+ sendSignal(senderRef, GSN_SUB_STOP_CONF, signal,
+ SubStopConf::SignalLength, JBB);
+
+ removeSubscribersOnNode(signal, refToNode(senderRef));
+ DBUG_VOID_RETURN;
+ }
+
+ if(!c_subscriptions.find(subPtr, key)){
+ jam();
+ DBUG_PRINT("error", ("not found"));
+ sendSubStopRef(signal, 1407);
+ DBUG_VOID_RETURN;
+ }
+
+ if (subPtr.p->m_state == Subscription::LOCKED) {
+ jam();
+ DBUG_PRINT("error", ("locked"));
+ sendSubStopRef(signal, 1411);
+ DBUG_VOID_RETURN;
+ }
+
+ ndbrequire(part == SubscriptionData::TableData);
+
+ TablePtr tabPtr;
+ tabPtr.i = subPtr.p->m_table_ptrI;
+ if (!(tabPtr.p = c_tables.getPtr(tabPtr.i)) ||
+ tabPtr.p->m_tableId != subPtr.p->m_tableId)
+ {
+ jam();
+ DBUG_PRINT("error", ("no such table id %u[i=%u]",
+ subPtr.p->m_tableId, subPtr.p->m_table_ptrI));
+ sendSubStopRef(signal, 1417);
+ DBUG_VOID_RETURN;
+ }
+
+ DBUG_PRINT("info",("subscription: %u tableId: %u[i=%u] id: %u key: %u",
+ subPtr.i, subPtr.p->m_tableId, tabPtr.i,
+ subPtr.p->m_subscriptionId,subPtr.p->m_subscriptionKey));
+
+ SubscriberPtr subbPtr;
+ if (senderRef == reference()){
+ jam();
+ c_subscriberPool.getPtr(subbPtr, senderData);
+ ndbrequire(subbPtr.p->m_subPtrI == subPtr.i &&
+ subbPtr.p->m_senderRef == subscriberRef &&
+ subbPtr.p->m_senderData == subscriberData);
+ c_removeDataSubscribers.remove(subbPtr);
+ }
+ else
+ {
+ jam();
+ LocalDLList<Subscriber>
+ subscribers(c_subscriberPool,tabPtr.p->c_subscribers);
+
+ DBUG_PRINT("info",("search: subscription: %u, ref: %u, data: %d",
+ subPtr.i, subscriberRef, subscriberData));
+ for (subscribers.first(subbPtr);!subbPtr.isNull();subscribers.next(subbPtr))
+ {
+ jam();
+ DBUG_PRINT("info",
+ ("search: subscription: %u, ref: %u, data: %u, subscriber %u",
+ subbPtr.p->m_subPtrI, subbPtr.p->m_senderRef,
+ subbPtr.p->m_senderData, subbPtr.i));
+ if (subbPtr.p->m_subPtrI == subPtr.i &&
+ subbPtr.p->m_senderRef == subscriberRef &&
+ subbPtr.p->m_senderData == subscriberData)
+ {
+ jam();
+ DBUG_PRINT("info",("found"));
+ break;
+ }
+ }
+ /**
+ * If we didn't find anyone, send ref
+ */
+ if (subbPtr.isNull()) {
+ jam();
+ DBUG_PRINT("error", ("subscriber not found"));
+ sendSubStopRef(signal, 1407);
+ DBUG_VOID_RETURN;
+ }
+ subscribers.remove(subbPtr);
+ }
+
+ subPtr.p->m_senderRef = senderRef; // store ref to requestor
+ subPtr.p->m_senderData = senderData; // store ref to requestor
+
+ tabPtr.p->m_drop_subbPtr= subbPtr;
+
+ if (subPtr.p->m_state == Subscription::DEFINED)
+ {
+ jam();
+ subPtr.p->m_state = Subscription::LOCKED;
+ }
+
+ if (tabPtr.p->m_state == Table::DROPPED)
+ // not ALTERED here since trigger must be removed
+ {
+ jam();
+ tabPtr.p->n_subscribers--;
+ DBUG_PRINT("info",("Suma::Table[%u]::n_subscribers: %u",
+ tabPtr.p->m_tableId, tabPtr.p->n_subscribers));
+ tabPtr.p->checkRelease(*this);
+ sendSubStopComplete(signal, tabPtr.p->m_drop_subbPtr);
+ }
+ else
+ {
+ jam();
+ tabPtr.p->dropTrigger(signal,*this);
+ }
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::SyncRecord::nextTrigger(Signal* signal){
+Suma::sendSubStopComplete(Signal* signal, SubscriberPtr subbPtr)
+{
jam();
+ DBUG_ENTER("Suma::sendSubStopComplete");
+ CRASH_INSERTION(13020);
- TableList::DataBufferIterator it;
-
- if(!m_tableList.position(it, m_currentTable)){
- completeTrigger(signal);
- return;
- }
+ DBUG_PRINT("info",("removed subscriber: %i", subbPtr.i));
SubscriptionPtr subPtr;
- suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
- ndbrequire(subPtr.p->m_syncPtrI == ptrI);
- const Uint32 RT_BREAK = 48;
- Uint32 latestTriggerId = 0;
- for(Uint32 i = 0; i<RT_BREAK && !it.isNull(); i++, m_tableList.next(it)){
- TablePtr tabPtr;
-#if 0
- ndbout_c("nextTrigger tableid %u", *it.data);
-#endif
- ndbrequire(suma.c_tables.find(tabPtr, *it.data));
+ c_subscriptions.getPtr(subPtr, subbPtr.p->m_subPtrI);
- AttributeMask attrMask;
- createAttributeMask(attrMask, tabPtr.p);
+ Uint32 senderRef= subPtr.p->m_senderRef;
+ Uint32 senderData= subPtr.p->m_senderData;
- for(Uint32 j = 0; j<3; j++){
- i++;
- latestTriggerId = (tabPtr.p->m_schemaVersion << 18) |
- (j << 16) | tabPtr.p->m_tableId;
- if(tabPtr.p->m_hasTriggerDefined[j] == 0) {
- ndbrequire(tabPtr.p->m_triggerIds[j] == ILLEGAL_TRIGGER_ID);
-#if 0
- ndbout_c("DEFINING trigger on table %u[%u]", tabPtr.p->m_tableId, j);
+ subPtr.p->n_subscribers--;
+ ndbassert( subPtr.p->m_state == Subscription::LOCKED ||
+ subPtr.p->m_state == Subscription::DROPPED );
+ if ( subPtr.p->m_state == Subscription::LOCKED )
+ {
+ jam();
+ subPtr.p->m_state = Subscription::DEFINED;
+ if (subPtr.p->n_subscribers == 0)
+ {
+ jam();
+#if 1
+ subPtr.p->m_table_ptrI = RNIL;
+#else
+ TablePtr tabPtr;
+ tabPtr.i = subPtr.p->m_table_ptrI;
+ if ((tabPtr.p= c_tablePool.getPtr(tabPtr.i)) &&
+ (tabPtr.p->m_state == Table::DROPPED ||
+ tabPtr.p->m_state == Table::ALTERED) &&
+ false)
+ {
+ // last subscriber, and table is dropped
+ // safe to drop subscription
+ c_subscriptions.release(subPtr);
+ DBUG_PRINT("info",("c_subscriptionPool size: %d free: %d",
+ c_subscriptionPool.getSize(),
+ c_subscriptionPool.getNoOfFree()));
+ }
+ else
+ {
+ subPtr.p->m_table_ptrI = RNIL;
+ }
+ ndbassert(tabPtr.p != 0);
#endif
- CreateTrigReq * const req = (CreateTrigReq*)signal->getDataPtrSend();
- req->setUserRef(SUMA_REF);
- req->setConnectionPtr(ptrI);
- req->setTriggerType(TriggerType::SUBSCRIPTION_BEFORE);
- req->setTriggerActionTime(TriggerActionTime::TA_DETACHED);
- req->setMonitorReplicas(true);
- req->setMonitorAllAttributes(false);
- req->setReceiverRef(SUMA_REF);
- req->setTriggerId(latestTriggerId);
- req->setTriggerEvent((TriggerEvent::Value)j);
- req->setTableId(tabPtr.p->m_tableId);
- req->setAttributeMask(attrMask);
- suma.sendSignal(DBTUP_REF, GSN_CREATE_TRIG_REQ,
- signal, CreateTrigReq::SignalLength, JBB);
+ }
+ }
+ else if ( subPtr.p->n_subscribers == 0 )
+ {
+ // subscription is marked to be removed
+ // and there are no subscribers left
+ jam();
+ ndbassert(subPtr.p->m_state == Subscription::DROPPED);
+ completeSubRemove(subPtr);
+ }
- } else {
- /**
- * Faking that a trigger has been created in order to
- * simulate the proper behaviour.
- * Perhaps this should be a dummy signal instead of
- * (ab)using CREATE_TRIG_CONF.
- */
- CreateTrigConf * conf = (CreateTrigConf*)signal->getDataPtrSend();
- conf->setConnectionPtr(ptrI);
- conf->setTableId(tabPtr.p->m_tableId);
- conf->setTriggerId(latestTriggerId);
- suma.sendSignal(SUMA_REF,GSN_CREATE_TRIG_CONF,
- signal, CreateTrigConf::SignalLength, JBB);
-
- }
+ // let subscriber know that subscrber is stopped
+ {
+ SubTableData * data = (SubTableData*)signal->getDataPtrSend();
+ data->gci = m_last_complete_gci + 1; // XXX ???
+ data->tableId = 0;
+ data->operation = NdbDictionary::Event::_TE_STOP;
+ data->senderData = subbPtr.p->m_senderData;
+ sendSignal(subbPtr.p->m_senderRef, GSN_SUB_TABLE_DATA, signal,
+ SubTableData::SignalLength, JBB);
+ }
+
+ SubStopConf * const conf = (SubStopConf*)signal->getDataPtrSend();
+
+ conf->senderRef= reference();
+ conf->senderData= senderData;
+
+ sendSignal(senderRef, GSN_SUB_STOP_CONF, signal,
+ SubStopConf::SignalLength, JBB);
+
+ c_subscriberPool.release(subbPtr);
+ DBUG_PRINT("info",("c_subscriberPool size: %d free: %d",
+ c_subscriberPool.getSize(),
+ c_subscriberPool.getNoOfFree()));
+ DBUG_VOID_RETURN;
+}
+
+void
+Suma::sendSubStopRef(Signal* signal, Uint32 errCode)
+{
+ jam();
+ DBUG_ENTER("Suma::sendSubStopRef");
+ SubStopRef * ref = (SubStopRef *)signal->getDataPtrSend();
+ ref->senderRef = reference();
+ ref->errorCode = errCode;
+ sendSignal(signal->getSendersBlockRef(),
+ GSN_SUB_STOP_REF,
+ signal,
+ SubStopRef::SignalLength,
+ JBB);
+ DBUG_VOID_RETURN;
+}
+
+/**********************************************************
+ *
+ * Trigger admin interface
+ *
+ */
+int
+Suma::Table::setupTrigger(Signal* signal,
+ Suma &suma)
+{
+ jam();
+ DBUG_ENTER("Suma::Table::setupTrigger");
+
+ int ret= 0;
+
+ AttributeMask attrMask;
+ createAttributeMask(attrMask, suma);
+
+ for(Uint32 j = 0; j<3; j++)
+ {
+ Uint32 triggerId = (m_schemaVersion << 18) | (j << 16) | m_ptrI;
+ if(m_hasTriggerDefined[j] == 0)
+ {
+ suma.suma_ndbrequire(m_triggerIds[j] == ILLEGAL_TRIGGER_ID);
+ DBUG_PRINT("info",("DEFINING trigger on table %u[%u]", m_tableId, j));
+ CreateTrigReq * const req = (CreateTrigReq*)signal->getDataPtrSend();
+ req->setUserRef(SUMA_REF);
+ req->setConnectionPtr(m_ptrI);
+ req->setTriggerType(TriggerType::SUBSCRIPTION_BEFORE);
+ req->setTriggerActionTime(TriggerActionTime::TA_DETACHED);
+ req->setMonitorReplicas(true);
+ req->setMonitorAllAttributes(false);
+ req->setReceiverRef(SUMA_REF);
+ req->setTriggerId(triggerId);
+ req->setTriggerEvent((TriggerEvent::Value)j);
+ req->setTableId(m_tableId);
+ req->setAttributeMask(attrMask);
+ suma.sendSignal(DBTUP_REF, GSN_CREATE_TRIG_REQ,
+ signal, CreateTrigReq::SignalLength, JBB);
+ ret= 1;
+ }
+ else
+ {
+ m_hasTriggerDefined[j]++;
+ DBUG_PRINT("info",("REFCOUNT trigger on table %u[%u] %u",
+ m_tableId, j, m_hasTriggerDefined[j]));
}
- m_currentTable++;
}
- m_latestTriggerId = latestTriggerId;
+ DBUG_RETURN(ret);
}
void
-SumaParticipant::SyncRecord::createAttributeMask(AttributeMask& mask,
- Table * table){
+Suma::Table::createAttributeMask(AttributeMask& mask,
+ Suma &suma)
+{
jam();
mask.clear();
DataBuffer<15>::DataBufferIterator it;
- LocalDataBuffer<15> attrBuf(suma.c_dataBufferPool, table->m_attributes);
+ LocalDataBuffer<15> attrBuf(suma.c_dataBufferPool, m_attributes);
for(attrBuf.first(it); !it.curr.isNull(); attrBuf.next(it)){
mask.set(* it.data);
}
}
void
-SumaParticipant::SyncRecord::runCREATE_TRIG_CONF(Signal* signal){
- jam();
-
+Suma::execCREATE_TRIG_CONF(Signal* signal){
+ jamEntry();
+ DBUG_ENTER("Suma::execCREATE_TRIG_CONF");
+ ndbassert(signal->getNoOfSections() == 0);
CreateTrigConf * const conf = (CreateTrigConf*)signal->getDataPtr();
const Uint32 triggerId = conf->getTriggerId();
Uint32 type = (triggerId >> 16) & 0x3;
Uint32 tableId = conf->getTableId();
-
+
+
+ DBUG_PRINT("enter", ("type: %u tableId: %u[i=%u==%u]",
+ type, tableId,conf->getConnectionPtr(),triggerId & 0xFFFF));
+
TablePtr tabPtr;
- ndbrequire(suma.c_tables.find(tabPtr, tableId));
+ c_tables.getPtr(tabPtr, conf->getConnectionPtr());
+ ndbrequire(tabPtr.p->m_tableId == tableId);
+ ndbrequire(tabPtr.p->m_state == Table::DEFINING);
ndbrequire(type < 3);
tabPtr.p->m_triggerIds[type] = triggerId;
- tabPtr.p->m_hasTriggerDefined[type]++;
+ ndbrequire(tabPtr.p->m_hasTriggerDefined[type] == 0);
+ tabPtr.p->m_hasTriggerDefined[type] = 1;
- if(triggerId == m_latestTriggerId){
- jam();
- nextTrigger(signal);
+ if (type == 2)
+ {
+ completeAllSubscribers(signal, tabPtr);
+ completeInitTable(signal,tabPtr);
+ DBUG_VOID_RETURN;
}
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::SyncRecord::completeTrigger(Signal* signal){
- jam();
- SubscriptionPtr subPtr;
- CRASH_INSERTION(13013);
-#ifdef EVENT_PH3_DEBUG
- ndbout_c("SumaParticipant: trigger completed");
-#endif
- Uint32 gci;
- suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
- ndbrequire(subPtr.p->m_syncPtrI == ptrI);
+Suma::execCREATE_TRIG_REF(Signal* signal){
+ jamEntry();
+ DBUG_ENTER("Suma::execCREATE_TRIG_REF");
+ ndbassert(signal->getNoOfSections() == 0);
+ CreateTrigRef * const ref = (CreateTrigRef*)signal->getDataPtr();
+ const Uint32 triggerId = ref->getTriggerId();
+ Uint32 type = (triggerId >> 16) & 0x3;
+ Uint32 tableId = ref->getTableId();
+
+ DBUG_PRINT("enter", ("type: %u tableId: %u[i=%u==%u]",
+ type, tableId,ref->getConnectionPtr(),triggerId & 0xFFFF));
+
+ TablePtr tabPtr;
+ c_tables.getPtr(tabPtr, ref->getConnectionPtr());
+ ndbrequire(tabPtr.p->m_tableId == tableId);
+ ndbrequire(tabPtr.p->m_state == Table::DEFINING);
- SubscriberPtr subbPtr;
- {
- bool found = false;
+ tabPtr.p->m_error= ref->getErrorCode();
- for(suma.c_prepDataSubscribers.first(subbPtr);
- !subbPtr.isNull(); suma.c_prepDataSubscribers.next(subbPtr)) {
- jam();
- if(subbPtr.p->m_subPtrI == subPtr.i) {
- jam();
- found = true;
- break;
- }
- }
- ndbrequire(found);
- gci = suma.getFirstGCI(signal);
- subbPtr.p->m_firstGCI = gci;
- suma.c_prepDataSubscribers.remove(subbPtr);
- suma.c_dataSubscribers.add(subbPtr);
+ ndbrequire(type < 3);
+
+ if (type == 2)
+ {
+ completeAllSubscribers(signal, tabPtr);
+ completeInitTable(signal,tabPtr);
+ DBUG_VOID_RETURN;
}
- suma.sendSubStartComplete(signal, subbPtr, gci, SubscriptionData::TableData);
-}
-void
-SumaParticipant::SyncRecord::startDropTrigger(Signal* signal){
- jam();
- m_currentTable = 0;
- m_latestTriggerId = RNIL;
- nextDropTrigger(signal);
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::SyncRecord::nextDropTrigger(Signal* signal){
+Suma::Table::dropTrigger(Signal* signal,Suma& suma)
+{
jam();
-
- TableList::DataBufferIterator it;
+ DBUG_ENTER("Suma::dropTrigger");
- if(!m_tableList.position(it, m_currentTable)){
- completeDropTrigger(signal);
- return;
- }
-
- SubscriptionPtr subPtr;
- suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
- ndbrequire(subPtr.p->m_syncPtrI == ptrI);
-
- const Uint32 RT_BREAK = 48;
- Uint32 latestTriggerId = 0;
- for(Uint32 i = 0; i<RT_BREAK && !it.isNull(); i++, m_tableList.next(it)){
+ for(Uint32 j = 0; j<3; j++){
jam();
- TablePtr tabPtr;
-#if 0
- ndbout_c("nextDropTrigger tableid %u", *it.data);
-#endif
- ndbrequire(suma.c_tables.find(tabPtr, * it.data));
-
- for(Uint32 j = 0; j<3; j++){
+ suma.suma_ndbrequire(m_triggerIds[j] != ILLEGAL_TRIGGER_ID);
+ if(m_hasTriggerDefined[j] == 1) {
jam();
- ndbrequire(tabPtr.p->m_triggerIds[j] != ILLEGAL_TRIGGER_ID);
- i++;
- latestTriggerId = tabPtr.p->m_triggerIds[j];
- if(tabPtr.p->m_hasTriggerDefined[j] == 1) {
- jam();
-
- DropTrigReq * const req = (DropTrigReq*)signal->getDataPtrSend();
- req->setConnectionPtr(ptrI);
- req->setUserRef(SUMA_REF); // Sending to myself
- req->setRequestType(DropTrigReq::RT_USER);
- req->setTriggerType(TriggerType::SUBSCRIPTION_BEFORE);
- req->setTriggerActionTime(TriggerActionTime::TA_DETACHED);
- req->setIndexId(RNIL);
-
- req->setTableId(tabPtr.p->m_tableId);
- req->setTriggerId(latestTriggerId);
- req->setTriggerEvent((TriggerEvent::Value)j);
-#if 0
- ndbout_c("DROPPING trigger %u = %u %u %u on table %u[%u]",
- latestTriggerId,TriggerType::SUBSCRIPTION_BEFORE,
- TriggerActionTime::TA_DETACHED, j, tabPtr.p->m_tableId, j);
-#endif
- suma.sendSignal(DBTUP_REF, GSN_DROP_TRIG_REQ,
- signal, DropTrigReq::SignalLength, JBB);
- } else {
- jam();
- ndbrequire(tabPtr.p->m_hasTriggerDefined[j] > 1);
- /**
- * Faking that a trigger has been dropped in order to
- * simulate the proper behaviour.
- * Perhaps this should be a dummy signal instead of
- * (ab)using DROP_TRIG_CONF.
- */
- DropTrigConf * conf = (DropTrigConf*)signal->getDataPtrSend();
- conf->setConnectionPtr(ptrI);
- conf->setTableId(tabPtr.p->m_tableId);
- conf->setTriggerId(latestTriggerId);
- suma.sendSignal(SUMA_REF,GSN_DROP_TRIG_CONF,
- signal, DropTrigConf::SignalLength, JBB);
- }
+ DropTrigReq * const req = (DropTrigReq*)signal->getDataPtrSend();
+ req->setConnectionPtr(m_ptrI);
+ req->setUserRef(SUMA_REF); // Sending to myself
+ req->setRequestType(DropTrigReq::RT_USER);
+ req->setTriggerType(TriggerType::SUBSCRIPTION_BEFORE);
+ req->setTriggerActionTime(TriggerActionTime::TA_DETACHED);
+ req->setIndexId(RNIL);
+
+ req->setTableId(m_tableId);
+ req->setTriggerId(m_triggerIds[j]);
+ req->setTriggerEvent((TriggerEvent::Value)j);
+
+ DBUG_PRINT("info",("DROPPING trigger %u = %u %u %u on table %u[%u]",
+ m_triggerIds[j],
+ TriggerType::SUBSCRIPTION_BEFORE,
+ TriggerActionTime::TA_DETACHED,
+ j,
+ m_tableId, j));
+ suma.sendSignal(DBTUP_REF, GSN_DROP_TRIG_REQ,
+ signal, DropTrigReq::SignalLength, JBB);
+ } else {
+ jam();
+ suma.suma_ndbrequire(m_hasTriggerDefined[j] > 1);
+ runDropTrigger(signal,m_triggerIds[j],suma);
}
- m_currentTable++;
}
- m_latestTriggerId = latestTriggerId;
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::SyncRecord::runDROP_TRIG_REF(Signal* signal){
- jam();
+Suma::execDROP_TRIG_REF(Signal* signal){
+ jamEntry();
+ DBUG_ENTER("Suma::execDROP_TRIG_REF");
+ ndbassert(signal->getNoOfSections() == 0);
DropTrigRef * const ref = (DropTrigRef*)signal->getDataPtr();
- if (ref->getErrorCode() != DropTrigRef::TriggerNotFound){
+ if (ref->getErrorCode() != DropTrigRef::TriggerNotFound)
+ {
ndbrequire(false);
}
- const Uint32 triggerId = ref->getTriggerId();
- Uint32 tableId = ref->getTableId();
- runDropTrig(signal, triggerId, tableId);
+ TablePtr tabPtr;
+ c_tables.getPtr(tabPtr, ref->getConnectionPtr());
+ ndbrequire(ref->getTableId() == tabPtr.p->m_tableId);
+
+ tabPtr.p->runDropTrigger(signal, ref->getTriggerId(), *this);
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::SyncRecord::runDROP_TRIG_CONF(Signal* signal){
- jam();
-
+Suma::execDROP_TRIG_CONF(Signal* signal){
+ jamEntry();
+ DBUG_ENTER("Suma::execDROP_TRIG_CONF");
+ ndbassert(signal->getNoOfSections() == 0);
+
DropTrigConf * const conf = (DropTrigConf*)signal->getDataPtr();
- const Uint32 triggerId = conf->getTriggerId();
- Uint32 tableId = conf->getTableId();
- runDropTrig(signal, triggerId, tableId);
+ TablePtr tabPtr;
+ c_tables.getPtr(tabPtr, conf->getConnectionPtr());
+ ndbrequire(conf->getTableId() == tabPtr.p->m_tableId);
+
+ tabPtr.p->runDropTrigger(signal, conf->getTriggerId(),*this);
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::SyncRecord::runDropTrig(Signal* signal,
- Uint32 triggerId,
- Uint32 tableId){
+Suma::Table::runDropTrigger(Signal* signal,
+ Uint32 triggerId,
+ Suma &suma)
+{
+ jam();
Uint32 type = (triggerId >> 16) & 0x3;
-
- TablePtr tabPtr;
- ndbrequire(suma.c_tables.find(tabPtr, tableId));
- ndbrequire(type < 3);
- ndbrequire(tabPtr.p->m_triggerIds[type] == triggerId);
- tabPtr.p->m_hasTriggerDefined[type]--;
- if (tabPtr.p->m_hasTriggerDefined[type] == 0) {
+ suma.suma_ndbrequire(type < 3);
+ suma.suma_ndbrequire(m_triggerIds[type] == triggerId);
+ m_hasTriggerDefined[type]--;
+ if (m_hasTriggerDefined[type] == 0)
+ {
jam();
- tabPtr.p->m_triggerIds[type] = ILLEGAL_TRIGGER_ID;
+ m_triggerIds[type] = ILLEGAL_TRIGGER_ID;
}
- if(triggerId == m_latestTriggerId){
+ if( m_hasTriggerDefined[0] != m_hasTriggerDefined[1] ||
+ m_hasTriggerDefined[0] != m_hasTriggerDefined[2])
+ {
+ // more to come
jam();
- nextDropTrigger(signal);
+ return;
}
-}
-void
-SumaParticipant::SyncRecord::completeDropTrigger(Signal* signal){
- jam();
- SubscriptionPtr subPtr;
- CRASH_INSERTION(13014);
#if 0
ndbout_c("trigger completed");
#endif
- suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
- ndbrequire(subPtr.p->m_syncPtrI == ptrI);
- bool found = false;
- SubscriberPtr subbPtr;
- for(suma.c_prepDataSubscribers.first(subbPtr);
- !subbPtr.isNull(); suma.c_prepDataSubscribers.next(subbPtr)) {
+ n_subscribers--;
+ DBUG_PRINT("info",("Suma::Table[%u]::n_subscribers: %u",
+ m_tableId, n_subscribers));
+ checkRelease(suma);
+
+ suma.sendSubStopComplete(signal, m_drop_subbPtr);
+}
+
+void Suma::suma_ndbrequire(bool v) { ndbrequire(v); }
+
+void
+Suma::Table::checkRelease(Suma &suma)
+{
+ jam();
+ DBUG_ENTER("Suma::Table::checkRelease");
+ if (n_subscribers == 0)
+ {
jam();
- if(subbPtr.p->m_subPtrI == subPtr.i) {
- jam();
- found = true;
- break;
+ suma.suma_ndbrequire(m_hasTriggerDefined[0] == 0);
+ suma.suma_ndbrequire(m_hasTriggerDefined[1] == 0);
+ suma.suma_ndbrequire(m_hasTriggerDefined[2] == 0);
+ if (!c_subscribers.isEmpty())
+ {
+ LocalDLList<Subscriber>
+ subscribers(suma.c_subscriberPool,c_subscribers);
+ SubscriberPtr subbPtr;
+ for (subscribers.first(subbPtr);!subbPtr.isNull();
+ subscribers.next(subbPtr))
+ {
+ jam();
+ DBUG_PRINT("info",("subscriber: %u", subbPtr.i));
+ }
+ suma.suma_ndbrequire(false);
+ }
+ if (!c_syncRecords.isEmpty())
+ {
+ LocalDLList<SyncRecord>
+ syncRecords(suma.c_syncPool,c_syncRecords);
+ Ptr<SyncRecord> syncPtr;
+ for (syncRecords.first(syncPtr);!syncPtr.isNull();
+ syncRecords.next(syncPtr))
+ {
+ jam();
+ DBUG_PRINT("info",("syncRecord: %u", syncPtr.i));
+ }
+ suma.suma_ndbrequire(false);
}
+ release(suma);
+ suma.c_tables.remove(m_ptrI);
+ suma.c_tablePool.release(m_ptrI);
+ DBUG_PRINT("info",("c_tablePool size: %d free: %d",
+ suma.c_tablePool.getSize(),
+ suma.c_tablePool.getNoOfFree()));
}
- ndbrequire(found);
- suma.sendSubStopComplete(signal, subbPtr);
+ else
+ {
+ DBUG_PRINT("info",("n_subscribers: %d", n_subscribers));
+ }
+ DBUG_VOID_RETURN;
}
/**********************************************************
@@ -2613,8 +2743,10 @@
static Uint32 b_trigBufferSize = 0;
void
-SumaParticipant::execTRANSID_AI(Signal* signal){
+Suma::execTRANSID_AI(Signal* signal)
+{
jamEntry();
+ DBUG_ENTER("Suma::execTRANSID_AI");
CRASH_INSERTION(13015);
TransIdAI * const data = (TransIdAI*)signal->getDataPtr();
@@ -2667,11 +2799,11 @@
* Initialize signal
*/
SubTableData * sdata = (SubTableData*)signal->getDataPtrSend();
- Uint32 ref = subPtr.p->m_subscriberRef;
+ Uint32 ref = subPtr.p->m_senderRef;
sdata->tableId = syncPtr.p->m_currentTableId;
- sdata->senderData = subPtr.p->m_subscriberData;
- sdata->operation = 3; // Scan
- sdata->gci = 1; // Undefined
+ sdata->senderData = subPtr.p->m_senderData;
+ sdata->operation = NdbDictionary::Event::_TE_SCAN; // Scan
+ sdata->gci = 0; // Undefined
#if PRINT_ONLY
ndbout_c("GSN_SUB_TABLE_DATA (scan) #attr: %d len: %d", attribs, sum);
#else
@@ -2686,6 +2818,8 @@
* Reset f_bufferLock
*/
f_bufferLock = 0;
+
+ DBUG_VOID_RETURN;
}
/**********************************************************
@@ -2695,9 +2829,11 @@
*/
void
-SumaParticipant::execTRIG_ATTRINFO(Signal* signal){
+Suma::execTRIG_ATTRINFO(Signal* signal)
+{
jamEntry();
-
+ DBUG_ENTER("Suma::execTRIG_ATTRINFO");
+
CRASH_INSERTION(13016);
TrigAttrInfo* const trg = (TrigAttrInfo*)signal->getDataPtr();
const Uint32 trigId = trg->getTriggerId();
@@ -2711,6 +2847,7 @@
memcpy(b_buffer + b_trigBufferSize, trg->getData(), 4 * dataLen);
b_trigBufferSize += dataLen;
+
// printf("before values %u %u %u\n",trigId, dataLen, b_trigBufferSize);
} else {
jam();
@@ -2727,6 +2864,9 @@
memcpy(f_buffer + f_trigBufferSize, trg->getData(), 4 * dataLen);
f_trigBufferSize += dataLen;
}
+
+
+ DBUG_VOID_RETURN;
}
#ifdef NODEFAIL_DEBUG2
@@ -2734,662 +2874,527 @@
#endif
Uint32
-Suma::getStoreBucket(Uint32 v)
-{
- // id will contain id to responsible suma or
- // RNIL if we don't have nodegroup info yet
-
- const Uint32 N = NO_OF_BUCKETS;
- const Uint32 D = v % N; // Distibution key
- return D;
-}
-
-Uint32
-Suma::getResponsibleSumaNodeId(Uint32 D)
+Suma::get_responsible_node(Uint32 bucket) const
{
// id will contain id to responsible suma or
// RNIL if we don't have nodegroup info yet
- Uint32 id;
-
- if (c_restartLock) {
- jam();
- // ndbout_c("c_restartLock");
- id = RNIL;
- } else {
- jam();
- id = RNIL;
- const Uint32 n = c_noNodesInGroup; // Number nodes in node group
- const Uint32 C1 = D / n;
- const Uint32 C2 = D - C1*n; // = D % n;
- const Uint32 C = C2 + C1 % n;
- for (Uint32 i = 0; i < n; i++) {
- jam();
- id = c_nodesInGroup[(C + i) % n];
- if (c_aliveNodes.get(id) &&
- !c_preparingNodes.get(id)) {
- jam();
- break;
- }//if
+ jam();
+ Uint32 node;
+ const Bucket* ptr= c_buckets + bucket;
+ for(Uint32 i = 0; i<MAX_REPLICAS; i++)
+ {
+ node= ptr->m_nodes[i];
+ if(c_alive_nodes.get(node))
+ {
+ break;
}
+ }
+
+
#ifdef NODEFAIL_DEBUG2
- theCounts[id]++;
+ if(node != 0)
+ {
+ theCounts[node]++;
ndbout_c("Suma:responsible n=%u, D=%u, id = %u, count=%u",
- n,D, id, theCounts[id]);
-#endif
+ n,D, id, theCounts[node]);
}
- return id;
+#endif
+ return node;
}
-Uint32
-SumaParticipant::decideWhoToSend(Uint32 nBucket, Uint32 gci){
- bool replicaFlag = true;
- Uint32 nId = RNIL;
-
- // bucket active/not active set by GCP_COMPLETE
- if (c_buckets[nBucket].active) {
- if (c_buckets[nBucket].handover && c_buckets[nBucket].handoverGCI <= gci)
{
- jam();
- replicaFlag = true; // let the other node send this
- nId = RNIL;
- // mark this as started, if we get a node failiure now we have some lost stuff
- c_buckets[nBucket].handover_started = true;
- } else {
- jam();
- replicaFlag = false;
- nId = refToNode(reference());
- }
- } else {
- nId = getResponsibleSumaNodeId(nBucket);
- replicaFlag = !(nId == refToNode(reference()));
-
- if (!replicaFlag) {
- if (!c_buckets[nBucket].handover) {
- jam();
- // appearently a node has failed and we are taking over sending
- // from that bucket. Now we need to go back to latest completed
- // GCI. Handling will depend on Subscriber and Subscription
-
- // TODO, for now we make an easy takeover
- if (gci < c_nodeFailGCI)
- c_lastInconsistentGCI = gci;
-
- // we now have responsability for this bucket and we're actively
- // sending from that
- c_buckets[nBucket].active = true;
-#ifdef HANDOVER_DEBUG
- ndbout_c("Takeover Bucket %u", nBucket);
-#endif
- } else if (c_buckets[nBucket].handoverGCI > gci) {
- jam();
- replicaFlag = true; // handover going on, but don't start sending yet
- nId = RNIL;
- } else {
- jam();
-#ifdef HANDOVER_DEBUG
- ndbout_c("Possible error: Will send from GCI = %u", gci);
-#endif
- }
+Uint32
+Suma::get_responsible_node(Uint32 bucket, const NdbNodeBitmask& mask) const
+{
+ jam();
+ Uint32 node;
+ const Bucket* ptr= c_buckets + bucket;
+ for(Uint32 i = 0; i<MAX_REPLICAS; i++)
+ {
+ node= ptr->m_nodes[i];
+ if(mask.get(node))
+ {
+ return node;
}
}
-#ifdef NODEFAIL_DEBUG2
- ndbout_c("Suma:bucket %u, responsible id = %u, replicaFlag = %u",
- nBucket, nId, (Uint32)replicaFlag);
-#endif
- return replicaFlag;
+ return 0;
}
-void
-SumaParticipant::execFIRE_TRIG_ORD(Signal* signal){
- jamEntry();
- DBUG_ENTER("SumaParticipant::execFIRE_TRIG_ORD");
- CRASH_INSERTION(13016);
- FireTrigOrd* const trg = (FireTrigOrd*)signal->getDataPtr();
- const Uint32 trigId = trg->getTriggerId();
- const Uint32 hashValue = trg->getHashValue();
- const Uint32 gci = trg->getGCI();
- const Uint32 event = trg->getTriggerEvent();
- const Uint32 triggerId = trg->getTriggerId();
- Uint32 tableId = triggerId & 0xFFFF;
-
- ndbrequire(f_bufferLock == trigId);
-
-#ifdef EVENT_DEBUG2
- ndbout_c("SumaParticipant::execFIRE_TRIG_ORD");
-#endif
-
- Uint32 sz = trg->getNoOfPrimaryKeyWords()+trg->getNoOfAfterValueWords();
- ndbrequire(sz == f_trigBufferSize);
+bool
+Suma::check_switchover(Uint32 bucket, Uint32 gci)
+{
+ const Uint32 send_mask = (Bucket::BUCKET_STARTING | Bucket::BUCKET_TAKEOVER);
+ bool send = c_buckets[bucket].m_state & send_mask;
+ ndbassert(m_switchover_buckets.get(bucket));
+ if(unlikely(gci >= c_buckets[bucket].m_switchover_gci))
+ {
+ return send;
+ }
+ return !send;
+}
- /**
- * Reformat as "all headers" + "all data"
- */
- Uint32 dataLen = 0;
- Uint32 noOfAttrs = 0;
- Uint32 * src = f_buffer;
+static
+Uint32
+reformat(Signal* signal, LinearSectionPtr ptr[3],
+ Uint32 * src_1, Uint32 sz_1,
+ Uint32 * src_2, Uint32 sz_2)
+{
+ Uint32 noOfAttrs = 0, dataLen = 0;
Uint32 * headers = signal->theData + 25;
Uint32 * dst = signal->theData + 25 + MAX_ATTRIBUTES_IN_TABLE;
-
- LinearSectionPtr ptr[3];
- int nptr;
-
+
ptr[0].p = headers;
ptr[1].p = dst;
-
- while(sz > 0){
+
+ while(sz_1 > 0){
jam();
- Uint32 tmp = * src ++;
+ Uint32 tmp = * src_1 ++;
* headers ++ = tmp;
Uint32 len = AttributeHeader::getDataSize(tmp);
- memcpy(dst, src, 4 * len);
+ memcpy(dst, src_1, 4 * len);
dst += len;
- src += len;
-
+ src_1 += len;
+
noOfAttrs++;
dataLen += len;
- sz -= (1 + len);
+ sz_1 -= (1 + len);
}
- ndbrequire(sz == 0);
-
+ assert(sz_1 == 0);
+
ptr[0].sz = noOfAttrs;
ptr[1].sz = dataLen;
+
+ ptr[2].p = src_2;
+ ptr[2].sz = sz_2;
+
+ return sz_2 > 0 ? 3 : 2;
+}
- if (b_trigBufferSize > 0) {
- jam();
- ptr[2].p = b_buffer;
- ptr[2].sz = b_trigBufferSize;
- nptr = 3;
- } else {
- jam();
- nptr = 2;
- }
-
- // right now only for tableEvent
- bool replicaFlag = decideWhoToSend(getStoreBucket(hashValue), gci);
+void
+Suma::execFIRE_TRIG_ORD(Signal* signal)
+{
+ jamEntry();
+ DBUG_ENTER("Suma::execFIRE_TRIG_ORD");
+ ndbassert(signal->getNoOfSections() == 0);
+
+ CRASH_INSERTION(13016);
+ FireTrigOrd* const trg = (FireTrigOrd*)signal->getDataPtr();
+ const Uint32 trigId = trg->getTriggerId();
+ const Uint32 hashValue = trg->getHashValue();
+ const Uint32 gci = trg->getGCI();
+ const Uint32 event = trg->getTriggerEvent();
+ TablePtr tabPtr;
+ tabPtr.i = trigId & 0xFFFF;
+ DBUG_PRINT("enter",("tabPtr.i=%u", tabPtr.i));
+ ndbrequire(f_bufferLock == trigId);
/**
- * Signal to subscriber(s)
+ * Reset f_bufferLock
*/
- SubTableData * data = (SubTableData*)signal->getDataPtrSend();//trg;
- data->gci = gci;
- data->tableId = tableId;
- data->operation = event;
- data->noOfAttributes = noOfAttrs;
- data->dataSize = dataLen;
-
- SubscriberPtr subbPtr;
- for(c_dataSubscribers.first(subbPtr); !subbPtr.isNull();
- c_dataSubscribers.next(subbPtr)){
- if (subbPtr.p->m_firstGCI > gci) {
-#ifdef EVENT_DEBUG
- ndbout_c("m_firstGCI = %u, gci = %u", subbPtr.p->m_firstGCI, gci);
-#endif
- jam();
- // we're either restarting or it's a newly created subscriber
- // and waiting for the right gci
- continue;
- }
-
- jam();
+ f_bufferLock = 0;
+ b_bufferLock = 0;
- const Uint32 ref = subbPtr.p->m_subscriberRef;
- // ndbout_c("ref = %u", ref);
- const Uint32 subdata = subbPtr.p->m_subscriberData;
- data->senderData = subdata;
- /*
- * get subscription ptr for this subscriber
+ Uint32 bucket= hashValue % c_no_of_buckets;
+ m_max_seen_gci = (gci > m_max_seen_gci ? gci : m_max_seen_gci);
+ if(m_active_buckets.get(bucket) ||
+ (m_switchover_buckets.get(bucket) && (check_switchover(bucket, gci))))
+ {
+ m_max_sent_gci = (gci > m_max_sent_gci ? gci : m_max_sent_gci);
+ Uint32 sz = trg->getNoOfPrimaryKeyWords()+trg->getNoOfAfterValueWords();
+ ndbrequire(sz == f_trigBufferSize);
+
+ LinearSectionPtr ptr[3];
+ const Uint32 nptr= reformat(signal, ptr,
+ f_buffer, sz, b_buffer, b_trigBufferSize);
+
+ /**
+ * Signal to subscriber(s)
*/
- SubscriptionPtr subPtr;
- c_subscriptions.getPtr(subPtr, subbPtr.p->m_subPtrI);
-
- if(!subPtr.p->m_tables[tableId]) {
- jam();
- continue;
- //continue in for-loop if the table is not part of
- //the subscription. Otherwise, send data to subscriber.
- }
-
- if (subPtr.p->m_subscriptionType == SubCreateReq::TableEvent) {
- if (replicaFlag) {
- jam();
- c_failoverBuffer.subTableData(gci,NULL,0);
- continue;
- }
- jam();
- Uint32 tmp = data->logType;
- if (c_lastInconsistentGCI == data->gci) {
- data->setGCINotConsistent();
- }
-
-#ifdef HANDOVER_DEBUG
- {
- static int aLongGCIName = 0;
- if (data->gci != aLongGCIName) {
- aLongGCIName = data->gci;
- ndbout_c("sent from GCI = %u", aLongGCIName);
- }
- }
-#endif
- DBUG_PRINT("info",("GSN_SUB_TABLE_DATA to node %d", refToNode(ref)));
- sendSignal(ref, GSN_SUB_TABLE_DATA, signal,
- SubTableData::SignalLength, JBB, ptr, nptr);
- data->logType = tmp;
- } else {
- ndbassert(refToNode(ref) == 0 || refToNode(ref) == getOwnNodeId());
- jam();
-#if PRINT_ONLY
- ndbout_c("GSN_SUB_TABLE_DATA to %s: op: %d #attr: %d len: %d",
- getBlockName(refToBlock(ref)),
- noOfAttrs, dataLen);
+ ndbrequire(tabPtr.p = c_tablePool.getPtr(tabPtr.i));
-#else
-#ifdef HANDOVER_DEBUG
+ SubTableData * data = (SubTableData*)signal->getDataPtrSend();//trg;
+ data->gci = gci;
+ data->tableId = tabPtr.p->m_tableId;
+ data->operation = event;
+ data->logType = 0;
+
+ {
+ LocalDLList<Subscriber> list(c_subscriberPool,tabPtr.p->c_subscribers);
+ SubscriberPtr subbPtr;
+ for(list.first(subbPtr); !subbPtr.isNull(); list.next(subbPtr))
{
- static int aLongGCIName2 = 0;
- if (data->gci != aLongGCIName2) {
- aLongGCIName2 = data->gci;
- ndbout_c("(EXECUTE_DIRECT) sent from GCI = %u to %u", aLongGCIName2, ref);
- }
+ DBUG_PRINT("info",("GSN_SUB_TABLE_DATA to node %d",
+ refToNode(subbPtr.p->m_senderRef)));
+ data->senderData = subbPtr.p->m_senderData;
+ sendSignal(subbPtr.p->m_senderRef, GSN_SUB_TABLE_DATA, signal,
+ SubTableData::SignalLength, JBB, ptr, nptr);
}
-#endif
- EXECUTE_DIRECT(refToBlock(ref), GSN_SUB_TABLE_DATA, signal,
- SubTableData::SignalLength);
- jamEntry();
-#endif
+ }
+ }
+ else
+ {
+ Uint32* dst;
+ Uint32 sz = f_trigBufferSize + b_trigBufferSize + 2;
+ if((dst = get_buffer_ptr(signal, bucket, gci, sz)))
+ {
+ * dst++ = tabPtr.i;
+ * dst++ = (event << 16) | f_trigBufferSize;
+ memcpy(dst, f_buffer, f_trigBufferSize << 2);
+ dst += f_trigBufferSize;
+ memcpy(dst, b_buffer, b_trigBufferSize << 2);
}
}
- /**
- * Reset f_bufferLock
- */
- f_bufferLock = 0;
- b_bufferLock = 0;
-
DBUG_VOID_RETURN;
}
void
-SumaParticipant::execSUB_GCP_COMPLETE_REP(Signal* signal){
+Suma::execSUB_GCP_COMPLETE_REP(Signal* signal)
+{
jamEntry();
+ ndbassert(signal->getNoOfSections() == 0);
SubGcpCompleteRep * rep = (SubGcpCompleteRep*)signal->getDataPtrSend();
-
- Uint32 gci = rep->gci;
- c_lastCompleteGCI = gci;
+ Uint32 gci = m_last_complete_gci = rep->gci;
+ m_max_seen_gci = (gci > m_max_seen_gci ? gci : m_max_seen_gci);
/**
- * Signal to subscriber(s)
+ *
*/
+ if(!m_switchover_buckets.isclear())
+ {
+ NdbNodeBitmask takeover_nodes;
+ NdbNodeBitmask handover_nodes;
+ Uint32 i = m_switchover_buckets.find(0);
+ for(; i != Bucket_mask::NotFound; i = m_switchover_buckets.find(i + 1))
+ {
+ if(c_buckets[i].m_switchover_gci == gci)
+ {
+ Uint32 state = c_buckets[i].m_state;
+ m_switchover_buckets.clear(i);
+ printf("switchover complete bucket %d state: %x", i, state);
+ if(state & Bucket::BUCKET_STARTING)
+ {
+ /**
+ * NR case
+ */
+ m_active_buckets.set(i);
+ c_buckets[i].m_state &= ~(Uint32)Bucket::BUCKET_STARTING;
+ ndbout_c("starting");
+ m_gcp_complete_rep_count = 1;
+ }
+ else if(state & Bucket::BUCKET_TAKEOVER)
+ {
+ /**
+ * NF case
+ */
+ Bucket* bucket= c_buckets + i;
+ Page_pos pos= bucket->m_buffer_head;
+ ndbrequire(pos.m_max_gci < gci);
+
+ Buffer_page* page= (Buffer_page*)(m_tup->page+pos.m_page_id);
+ ndbout_c("takeover %d", pos.m_page_id);
+ page->m_max_gci = pos.m_max_gci;
+ page->m_words_used = pos.m_page_pos;
+ page->m_next_page = RNIL;
+ memset(&bucket->m_buffer_head, 0, sizeof(bucket->m_buffer_head));
+ bucket->m_buffer_head.m_page_id = RNIL;
+ bucket->m_buffer_head.m_page_pos = Buffer_page::DATA_WORDS + 1;
+
+ m_active_buckets.set(i);
+ c_buckets[i].m_state &= ~(Uint32)Bucket::BUCKET_TAKEOVER;
+ takeover_nodes.set(c_buckets[i].m_switchover_node);
+ }
+ else
+ {
+ /**
+ * NR, living node
+ */
+ ndbrequire(state & Bucket::BUCKET_HANDOVER);
+ c_buckets[i].m_state &= ~(Uint32)Bucket::BUCKET_HANDOVER;
+ handover_nodes.set(c_buckets[i].m_switchover_node);
+ ndbout_c("handover");
+ }
+ }
+ }
+ ndbassert(handover_nodes.count() == 0 ||
+ m_gcp_complete_rep_count > handover_nodes.count());
+ m_gcp_complete_rep_count -= handover_nodes.count();
+ m_gcp_complete_rep_count += takeover_nodes.count();
+
+ if(getNodeState().startLevel == NodeState::SL_STARTING &&
+ m_switchover_buckets.isclear() &&
+ c_startup.m_handover_nodes.isclear())
+ {
+ sendSTTORRY(signal);
+ }
+ }
- SubscriberPtr subbPtr;
- SubscriptionPtr subPtr;
- c_dataSubscribers.first(subbPtr);
- for(; !subbPtr.isNull(); c_dataSubscribers.next(subbPtr)){
+ if(ERROR_INSERTED(13010))
+ {
+ CLEAR_ERROR_INSERT_VALUE;
+ ndbout_c("Don't send GCP_COMPLETE_REP(%d)", gci);
+ return;
+ }
- if (subbPtr.p->m_firstGCI > gci) {
- jam();
- // we don't send SUB_GCP_COMPLETE_REP for incomplete GCI's
+ /**
+ * Signal to subscribers
+ */
+ rep->gci = gci;
+ rep->senderRef = reference();
+ rep->gcp_complete_rep_count = m_gcp_complete_rep_count;
+
+ if(m_gcp_complete_rep_count && !c_subscriber_nodes.isclear())
+ {
+ NodeReceiverGroup rg(API_CLUSTERMGR, c_subscriber_nodes);
+ sendSignal(rg, GSN_SUB_GCP_COMPLETE_REP, signal,
+ SubGcpCompleteRep::SignalLength, JBB);
+
+ Ptr<Gcp_record> gcp;
+ if(c_gcp_list.seize(gcp))
+ {
+ gcp.p->m_gci = gci;
+ gcp.p->m_subscribers = c_subscriber_nodes;
+ }
+ }
+
+ /**
+ * Add GCP COMPLETE REP to buffer
+ */
+ for(Uint32 i = 0; i<c_no_of_buckets; i++)
+ {
+ if(m_active_buckets.get(i))
continue;
+
+ if(c_buckets[i].m_buffer_tail != RNIL)
+ {
+ Uint32* dst;
+ get_buffer_ptr(signal, i, gci, 0);
}
-
- const Uint32 ref = subbPtr.p->m_subscriberRef;
- rep->senderRef = ref;
- rep->senderData = subbPtr.p->m_subscriberData;
-
- c_subscriptions.getPtr(subPtr, subbPtr.p->m_subPtrI);
-#if PRINT_ONLY
- ndbout_c("GSN_SUB_GCP_COMPLETE_REP to %s:",
- getBlockName(refToBlock(ref)));
-#else
-
- CRASH_INSERTION(13018);
-
- if (subPtr.p->m_subscriptionType == SubCreateReq::TableEvent)
- {
- jam();
- sendSignal(ref, GSN_SUB_GCP_COMPLETE_REP, signal,
- SubGcpCompleteRep::SignalLength, JBB);
- }
- else
- {
- jam();
- ndbassert(refToNode(ref) == 0 || refToNode(ref) == getOwnNodeId());
- EXECUTE_DIRECT(refToBlock(ref), GSN_SUB_GCP_COMPLETE_REP, signal,
- SubGcpCompleteRep::SignalLength);
- jamEntry();
- }
-#endif
}
- if (c_handoverToDo) {
- jam();
- c_handoverToDo = false;
- for( int i = 0; i < NO_OF_BUCKETS; i++) {
- if (c_buckets[i].handover) {
- if (c_buckets[i].handoverGCI > gci) {
- jam();
- c_handoverToDo = true; // still waiting for the right GCI
- break; /* since all handover should happen at the same time
- * we can break here
- */
- } else {
- c_buckets[i].handover = false;
-#ifdef HANDOVER_DEBUG
- ndbout_c("Handover Bucket %u", i);
-#endif
- if (getResponsibleSumaNodeId(i) == refToNode(reference())) {
- // my bucket to be handed over to me
- ndbrequire(!c_buckets[i].active);
- jam();
- c_buckets[i].active = true;
- } else {
- // someone else's bucket to handover to
- ndbrequire(c_buckets[i].active);
- jam();
- c_buckets[i].active = false;
- }
- }
- }
- }
+ if(gci == m_out_of_buffer_gci)
+ {
+ infoEvent("Reenable event buffer");
+ m_out_of_buffer_gci = 0;
}
}
-/***********************************************************
- *
- * Embryo to syncronize the Suma's so as to know if a subscriber
- * has received a GCP_COMPLETE from all suma's or not
- *
- */
-
void
-SumaParticipant::runSUB_GCP_COMPLETE_ACC(Signal* signal){
- jam();
-
- SubGcpCompleteAcc * const acc = (SubGcpCompleteAcc*)signal->getDataPtr();
+Suma::execCREATE_TAB_CONF(Signal *signal)
+{
+ jamEntry();
+ DBUG_ENTER("Suma::execCREATE_TAB_CONF");
- Uint32 gci = acc->rep.gci;
+#if 0
+ CreateTabConf * const conf = (CreateTabConf*)signal->getDataPtr();
+ Uint32 tableId = conf->senderData;
-#ifdef EVENT_DEBUG
- ndbout_c("SumaParticipant::runSUB_GCP_COMPLETE_ACC gci = %u", gci);
+ TablePtr tabPtr;
+ initTable(signal,tableId,tabPtr);
#endif
-
- c_failoverBuffer.subGcpCompleteRep(gci);
+ DBUG_VOID_RETURN;
}
void
-Suma::execSUB_GCP_COMPLETE_ACC(Signal* signal){
+Suma::execDROP_TAB_CONF(Signal *signal)
+{
jamEntry();
+ DBUG_ENTER("Suma::execDROP_TAB_CONF");
+ ndbassert(signal->getNoOfSections() == 0);
- if (RtoI(signal->getSendersBlockRef(), false) != RNIL) {
- jam();
- // Ack from other SUMA
- runSUB_GCP_COMPLETE_ACC(signal);
- return;
+ DropTabConf * const conf = (DropTabConf*)signal->getDataPtr();
+ Uint32 senderRef= conf->senderRef;
+ Uint32 tableId= conf->tableId;
+
+ TablePtr tabPtr;
+ if (!c_tables.find(tabPtr, tableId) ||
+ tabPtr.p->m_state == Table::DROPPED ||
+ tabPtr.p->m_state == Table::ALTERED)
+ {
+ DBUG_VOID_RETURN;
}
- jam();
- // Ack from User and not an acc from other SUMA, redistribute in nodegroup
+ DBUG_PRINT("info",("drop table id: %d[i=%u]", tableId, tabPtr.i));
- SubGcpCompleteAcc * const acc = (SubGcpCompleteAcc*)signal->getDataPtr();
- Uint32 gci = acc->rep.gci;
- Uint32 senderRef = acc->rep.senderRef;
- Uint32 subscriberData = acc->rep.subscriberData;
-
-#ifdef EVENT_DEBUG
- ndbout_c("Suma::execSUB_GCP_COMPLETE_ACC gci = %u", gci);
-#endif
- bool moreToCome = false;
+ tabPtr.p->m_state = Table::DROPPED;
+ tabPtr.p->m_hasTriggerDefined[0] = 0;
+ tabPtr.p->m_hasTriggerDefined[1] = 0;
+ tabPtr.p->m_hasTriggerDefined[2] = 0;
+ tabPtr.p->m_triggerIds[0] = ILLEGAL_TRIGGER_ID;
+ tabPtr.p->m_triggerIds[1] = ILLEGAL_TRIGGER_ID;
+ tabPtr.p->m_triggerIds[2] = ILLEGAL_TRIGGER_ID;
- SubscriberPtr subbPtr;
- for(c_dataSubscribers.first(subbPtr);
- !subbPtr.isNull(); c_dataSubscribers.next(subbPtr)){
-#ifdef EVENT_DEBUG
- ndbout_c("Suma::execSUB_GCP_COMPLETE_ACC %u == %u && %u == %u",
- subbPtr.p->m_subscriberRef,
- senderRef,
- subbPtr.p->m_subscriberData,
- subscriberData);
-#endif
- if (subbPtr.p->m_subscriberRef == senderRef &&
- subbPtr.p->m_subscriberData == subscriberData) {
- jam();
-#ifdef EVENT_DEBUG
- ndbout_c("Suma::execSUB_GCP_COMPLETE_ACC gci = FOUND SUBSCRIBER");
-#endif
- subbPtr.p->m_lastGCI = gci;
- } else if (subbPtr.p->m_lastGCI < gci) {
- jam();
- if (subbPtr.p->m_firstGCI <= gci)
- moreToCome = true;
- } else
- jam();
+ if (senderRef == 0)
+ {
+ DBUG_VOID_RETURN;
}
+ // dict coordinator sends info to API
- if (!moreToCome) {
- // tell the other SUMA's that I'm done with this GCI
- jam();
- for (Uint32 i = 0; i < c_noNodesInGroup; i++) {
- Uint32 id = c_nodesInGroup[i];
- Uint32 ref = calcSumaBlockRef(id);
- if ((ref != reference()) && c_aliveNodes.get(id)) {
- jam();
- sendSignal(ref, GSN_SUB_GCP_COMPLETE_ACC, signal,
- SubGcpCompleteAcc::SignalLength, JBB);
- } else
+ SubTableData * data = (SubTableData*)signal->getDataPtrSend();
+ data->gci = m_last_complete_gci+1;
+ data->tableId = tableId;
+ data->operation = NdbDictionary::Event::_TE_DROP;
+ data->req_nodeid = refToNode(senderRef);
+
+ {
+ LocalDLList<Subscriber> subbs(c_subscriberPool,tabPtr.p->c_subscribers);
+ SubscriberPtr subbPtr;
+ for(subbs.first(subbPtr);!subbPtr.isNull();subbs.next(subbPtr))
+ {
+ jam();
+ /*
+ * get subscription ptr for this subscriber
+ */
+ SubscriptionPtr subPtr;
+ c_subscriptions.getPtr(subPtr, subbPtr.p->m_subPtrI);
+ if(subPtr.p->m_subscriptionType != SubCreateReq::TableEvent) {
jam();
+ continue;
+ //continue in for-loop if the table is not part of
+ //the subscription. Otherwise, send data to subscriber.
+ }
+ data->senderData= subbPtr.p->m_senderData;
+ sendSignal(subbPtr.p->m_senderRef, GSN_SUB_TABLE_DATA, signal,
+ SubTableData::SignalLength, JBB);
+ DBUG_PRINT("info",("sent to subscriber %d", subbPtr.i));
}
}
+ DBUG_VOID_RETURN;
}
-static Uint32 tmpFailoverBuffer[512];
-//SumaParticipant::FailoverBuffer::FailoverBuffer(DataBuffer<15>::DataBufferPool
& p)
-// : m_dataList(p),
-SumaParticipant::FailoverBuffer::FailoverBuffer()
- :
- c_gcis(tmpFailoverBuffer), c_sz(512), c_first(0), c_next(0), c_full(false)
+void
+Suma::execALTER_TAB_CONF(Signal *signal)
{
-}
+ jamEntry();
+ DBUG_ENTER("Suma::execALTER_TAB_CONF");
+ ndbassert(signal->getNoOfSections() == 0);
-bool SumaParticipant::FailoverBuffer::subTableData(Uint32 gci, Uint32 *src, int sz)
-{
- bool ok = true;
+ AlterTabConf * const conf = (AlterTabConf*)signal->getDataPtr();
+ Uint32 senderRef= conf->senderRef;
+ Uint32 tableId= conf->tableId;
- if (c_full) {
- ok = false;
-#ifdef EVENT_DEBUG
- ndbout_c("Suma::FailoverBuffer::SubTableData buffer full gci=%u");
-#endif
- } else {
- c_gcis[c_next] = gci;
- c_next++;
- if (c_next == c_sz) c_next = 0;
- if (c_next == c_first)
- c_full = true;
- // ndbout_c("%u %u %u",c_first,c_next,c_sz);
- }
- return ok;
-}
-bool SumaParticipant::FailoverBuffer::subGcpCompleteRep(Uint32 gci)
-{
- bool ok = true;
-
- // ndbout_c("Empty");
- while (true) {
- if (c_first == c_next && !c_full)
- break;
- if (c_gcis[c_first] > gci)
- break;
- c_full = false;
- c_first++;
- if (c_first == c_sz) c_first = 0;
- // ndbout_c("%u %u %u : ",c_first,c_next,c_sz);
+ TablePtr tabPtr;
+ if (!c_tables.find(tabPtr, tableId) ||
+ tabPtr.p->m_state == Table::DROPPED ||
+ tabPtr.p->m_state == Table::ALTERED)
+ {
+ DBUG_VOID_RETURN;
}
- return ok;
-}
-bool SumaParticipant::FailoverBuffer::nodeFailRep()
-{
- bool ok = true;
- while (true) {
- if (c_first == c_next && !c_full)
- break;
+ DBUG_PRINT("info",("alter table id: %d[i=%u]", tableId, tabPtr.i));
-#ifdef EVENT_DEBUG
- ndbout_c("Suma::FailoverBuffer::NodeFailRep resending gci=%u", c_gcis[c_first]);
-#endif
- c_full = false;
- c_first++;
- if (c_first == c_sz) c_first = 0;
- }
- return ok;
-}
+ tabPtr.p->m_state = Table::ALTERED;
+ // triggers must be removed, waiting for sub stop req for that
-/**********************************************************
- * Suma participant interface
- *
- * Stopping and removing of subscriber
- *
- */
-
-void
-SumaParticipant::execSUB_STOP_REQ(Signal* signal){
- jamEntry();
- DBUG_ENTER("SumaParticipant::execSUB_STOP_REQ");
-
- CRASH_INSERTION(13019);
-
- SubStopReq * const req = (SubStopReq*)signal->getDataPtr();
- Uint32 senderRef = signal->getSendersBlockRef();
- Uint32 senderData = req->senderData;
- Uint32 subscriberRef = req->subscriberRef;
- Uint32 subscriberData = req->subscriberData;
- SubscriptionPtr subPtr;
- Subscription key;
- key.m_subscriptionId = req->subscriptionId;
- key.m_subscriptionKey = req->subscriptionKey;
- Uint32 part = req->part;
-
- if (key.m_subscriptionKey == 0 &&
- key.m_subscriptionId == 0 &&
- subscriberData == 0) {
- SubStopConf* conf = (SubStopConf*)signal->getDataPtrSend();
-
- conf->senderRef = reference();
- conf->senderData = senderData;
- conf->subscriptionId = key.m_subscriptionId;
- conf->subscriptionKey = key.m_subscriptionKey;
- conf->subscriberData = subscriberData;
-
- sendSignal(senderRef, GSN_SUB_STOP_CONF, signal,
- SubStopConf::SignalLength, JBB);
-
- removeSubscribersOnNode(signal, refToNode(subscriberRef));
+ if (senderRef == 0)
+ {
DBUG_VOID_RETURN;
}
-
- if(!c_subscriptions.find(subPtr, key)){
- jam();
- sendSubStopRef(signal, GrepError::SUBSCRIPTION_ID_NOT_FOUND);
- return;
- }
+ // dict coordinator sends info to API
- ndbrequire(part == SubscriptionData::TableData);
-
- SubscriberPtr subbPtr;
- if (senderRef == reference()){
- jam();
- c_subscriberPool.getPtr(subbPtr, senderData);
- ndbrequire(subbPtr.p->m_subPtrI == subPtr.i &&
- subbPtr.p->m_subscriberRef == subscriberRef &&
- subbPtr.p->m_subscriberData == subscriberData);
- c_removeDataSubscribers.remove(subbPtr);
- } else {
- bool found = false;
- jam();
- c_dataSubscribers.first(subbPtr);
- for (;!subbPtr.isNull(); c_dataSubscribers.next(subbPtr)){
+ SubTableData * data = (SubTableData*)signal->getDataPtrSend();
+ data->gci = m_last_complete_gci+1;
+ data->tableId = tableId;
+ data->operation = NdbDictionary::Event::_TE_ALTER;
+ data->req_nodeid = refToNode(senderRef);
+
+ {
+ LocalDLList<Subscriber> subbs(c_subscriberPool,tabPtr.p->c_subscribers);
+ SubscriberPtr subbPtr;
+ for(subbs.first(subbPtr);!subbPtr.isNull();subbs.next(subbPtr))
+ {
jam();
- if (subbPtr.p->m_subPtrI == subPtr.i &&
- refToNode(subbPtr.p->m_subscriberRef) == refToNode(subscriberRef) &&
- subbPtr.p->m_subscriberData == subscriberData){
- // ndbout_c("STOP_REQ: before c_dataSubscribers.release");
+ /*
+ * get subscription ptr for this subscriber
+ */
+ SubscriptionPtr subPtr;
+ c_subscriptions.getPtr(subPtr, subbPtr.p->m_subPtrI);
+ if(subPtr.p->m_subscriptionType != SubCreateReq::TableEvent) {
jam();
- c_dataSubscribers.remove(subbPtr);
- found = true;
- break;
+ continue;
+ //continue in for-loop if the table is not part of
+ //the subscription. Otherwise, send data to subscriber.
}
- }
- /**
- * If we didn't find anyone, send ref
- */
- if (!found) {
- jam();
- sendSubStopRef(signal, GrepError::SUBSCRIBER_NOT_FOUND);
- DBUG_VOID_RETURN;
- }
- }
- subbPtr.p->m_senderRef = senderRef; // store ref to requestor
- subbPtr.p->m_senderData = senderData; // store ref to requestor
- c_prepDataSubscribers.add(subbPtr);
-
- Ptr<SyncRecord> syncPtr;
- c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI);
- if (syncPtr.p->m_locked) {
- jam();
- sendSubStopRef(signal, /** Error Code */ 0, true);
- DBUG_VOID_RETURN;
+ data->senderData= subbPtr.p->m_senderData;
+ sendSignal(subbPtr.p->m_senderRef, GSN_SUB_TABLE_DATA, signal,
+ SubTableData::SignalLength, JBB);
+ DBUG_PRINT("info",("sent to subscriber %d", subbPtr.i));
+ }
}
- syncPtr.p->m_locked = true;
-
- syncPtr.p->startDropTrigger(signal);
DBUG_VOID_RETURN;
}
void
-SumaParticipant::sendSubStopComplete(Signal* signal, SubscriberPtr subbPtr){
- jam();
+Suma::execSUB_GCP_COMPLETE_ACK(Signal* signal)
+{
+ jamEntry();
+ ndbassert(signal->getNoOfSections() == 0);
- CRASH_INSERTION(13020);
+ SubGcpCompleteAck * const ack = (SubGcpCompleteAck*)signal->getDataPtr();
+ Uint32 gci = ack->rep.gci;
+ Uint32 senderRef = ack->rep.senderRef;
+ m_max_seen_gci = (gci > m_max_seen_gci ? gci : m_max_seen_gci);
- SubscriptionPtr subPtr;
- c_subscriptions.getPtr(subPtr, subbPtr.p->m_subPtrI);
-
- Ptr<SyncRecord> syncPtr;
- c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI);
- syncPtr.p->m_locked = false;
+ if (refToBlock(senderRef) == SUMA) {
+ jam();
+ // Ack from other SUMA
+ Uint32 nodeId= refToNode(senderRef);
+ for(Uint32 i = 0; i<c_no_of_buckets; i++)
+ {
+ if(m_active_buckets.get(i) ||
+ (m_switchover_buckets.get(i) && (check_switchover(i, gci))) ||
+ (!m_switchover_buckets.get(i) && get_responsible_node(i) == nodeId))
+ {
+ release_gci(signal, i, gci);
+ }
+ }
+ return;
+ }
- SubStopConf * const conf = (SubStopConf*)signal->getDataPtrSend();
+ // Ack from User and not an ack from other SUMA, redistribute in nodegroup
+
+ Uint32 nodeId = refToNode(senderRef);
- conf->senderRef = reference();
- conf->senderData = subbPtr.p->m_senderData;
- conf->subscriptionId = subPtr.p->m_subscriptionId;
- conf->subscriptionKey = subPtr.p->m_subscriptionKey;
- conf->subscriberData = subbPtr.p->m_subscriberData;
- Uint32 senderRef = subbPtr.p->m_senderRef;
-
- c_prepDataSubscribers.release(subbPtr);
- sendSignal(senderRef, GSN_SUB_STOP_CONF, signal,
- SubStopConf::SignalLength, JBB);
-}
-
-void
-SumaParticipant::sendSubStopRef(Signal* signal, Uint32 errCode,
- bool temporary){
jam();
- SubStopRef * ref = (SubStopRef *)signal->getDataPtrSend();
- ref->senderRef = reference();
- ref->errorCode = errCode;
- if (temporary) {
- ref->setTemporary();
+ Ptr<Gcp_record> gcp;
+ for(c_gcp_list.first(gcp); !gcp.isNull(); c_gcp_list.next(gcp))
+ {
+ if(gcp.p->m_gci == gci)
+ {
+ gcp.p->m_subscribers.clear(nodeId);
+ if(!gcp.p->m_subscribers.isclear())
+ {
+ jam();
+ return;
+ }
+ break;
+ }
}
- sendSignal(signal->getSendersBlockRef(),
- GSN_SUB_STOP_REF,
- signal,
- SubStopRef::SignalLength,
- JBB);
- return;
+
+ if(gcp.isNull())
+ {
+ ndbout_c("ACK wo/ gcp record (gci: %d)", gci);
+ }
+ else
+ {
+ c_gcp_list.release(gcp);
+ }
+
+ CRASH_INSERTION(13011);
+ if(ERROR_INSERTED(13012))
+ {
+ CLEAR_ERROR_INSERT_VALUE;
+ ndbout_c("Don't redistribute SUB_GCP_COMPLETE_ACK");
+ return;
+ }
+
+ ack->rep.senderRef = reference();
+ NodeReceiverGroup rg(SUMA, c_nodes_in_nodegroup_mask);
+ sendSignal(rg, GSN_SUB_GCP_COMPLETE_ACK, signal,
+ SubGcpCompleteAck::SignalLength, JBB);
}
/**************************************************************
@@ -3399,10 +3404,11 @@
*/
void
-SumaParticipant::execSUB_REMOVE_REQ(Signal* signal) {
+Suma::execSUB_REMOVE_REQ(Signal* signal)
+{
jamEntry();
-
- Uint32 senderRef = signal->getSendersBlockRef();
+ DBUG_ENTER("Suma::execSUB_REMOVE_REQ");
+ ndbassert(signal->getNoOfSections() == 0);
CRASH_INSERTION(13021);
@@ -3411,93 +3417,68 @@
Subscription key;
key.m_subscriptionId = req.subscriptionId;
key.m_subscriptionKey = req.subscriptionKey;
-
- if(!c_subscriptions.find(subPtr, key)) {
+
+ DBUG_PRINT("enter",("key.m_subscriptionId: %u, key.m_subscriptionKey: %u",
+ key.m_subscriptionId, key.m_subscriptionKey));
+
+ if(!c_subscriptions.find(subPtr, key))
+ {
jam();
- sendSubRemoveRef(signal, req, (Uint32) GrepError::SUBSCRIPTION_ID_NOT_FOUND);
- return;
+ DBUG_PRINT("info",("Not found"));
+ sendSubRemoveRef(signal, req, 1407);
+ DBUG_VOID_RETURN;
}
-
- int count = 0;
+ if (subPtr.p->m_state == Subscription::LOCKED)
{
+ /**
+ * we are currently setting up triggers etc. for this event
+ */
jam();
- SubscriberPtr i_subbPtr;
- for(c_prepDataSubscribers.first(i_subbPtr);
- !i_subbPtr.isNull(); c_prepDataSubscribers.next(i_subbPtr)){
- jam();
- if( i_subbPtr.p->m_subPtrI == subPtr.i ) {
- jam();
- sendSubRemoveRef(signal, req, /* ErrorCode */ 0, true);
- return;
- // c_prepDataSubscribers.release(subbPtr);
- }
- }
- c_dataSubscribers.first(i_subbPtr);
- while(!i_subbPtr.isNull()){
- jam();
- SubscriberPtr subbPtr = i_subbPtr;
- c_dataSubscribers.next(i_subbPtr);
- if( subbPtr.p->m_subPtrI == subPtr.i ) {
- jam();
- sendSubRemoveRef(signal, req, /* ErrorCode */ 0, true);
- return;
- /* Unfinished/untested code. If remove should be possible
- * even if subscribers are left these have to be stopped
- * first. See m_markRemove, m_nSubscribers. We need also to
- * block remove for this subscription so that multiple
- * removes is not possible...
- */
- c_dataSubscribers.remove(subbPtr);
- c_removeDataSubscribers.add(subbPtr);
- count++;
- }
- }
- c_metaSubscribers.first(i_subbPtr);
- while(!i_subbPtr.isNull()){
- jam();
- SubscriberPtr subbPtr = i_subbPtr;
- c_metaSubscribers.next(i_subbPtr);
- if( subbPtr.p->m_subPtrI == subPtr.i ){
- jam();
- c_metaSubscribers.release(subbPtr);
- }
- }
+ sendSubRemoveRef(signal, req, 1413);
+ DBUG_VOID_RETURN;
}
+
+ DBUG_PRINT("info",("n_subscribers: %u", subPtr.p->n_subscribers));
- subPtr.p->m_senderRef = senderRef;
- subPtr.p->m_senderData = req.senderData;
-
- if (count > 0){
+ if (subPtr.p->n_subscribers == 0)
+ {
+ // no subscribers on the subscription
+ // remove it
jam();
- ndbrequire(false); // code not finalized
- subPtr.p->m_markRemove = true;
- subPtr.p->m_nSubscribers = count;
- sendSubStopReq(signal);
- } else {
- completeSubRemoveReq(signal, subPtr);
+ completeSubRemove(subPtr);
}
+ else
+ {
+ // subscribers left on the subscription
+ // mark it to be removed once all subscribers
+ // are removed
+ jam();
+ subPtr.p->m_state = Subscription::DROPPED;
+ }
+
+ SubRemoveConf * const conf = (SubRemoveConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->senderData = req.senderData;
+ conf->subscriptionId = req.subscriptionId;
+ conf->subscriptionKey = req.subscriptionKey;
+
+ sendSignal(req.senderRef, GSN_SUB_REMOVE_CONF, signal,
+ SubRemoveConf::SignalLength, JBB);
+
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::completeSubRemoveReq(Signal* signal, SubscriptionPtr subPtr) {
+Suma::completeSubRemove(SubscriptionPtr subPtr)
+{
+ DBUG_ENTER("Suma::completeSubRemove");
Uint32 subscriptionId = subPtr.p->m_subscriptionId;
Uint32 subscriptionKey = subPtr.p->m_subscriptionKey;
- Uint32 senderRef = subPtr.p->m_senderRef;
- Uint32 senderData = subPtr.p->m_senderData;
- {
- Ptr<SyncRecord> syncPtr;
- c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI);
-
- syncPtr.p->release();
- c_syncPool.release(syncPtr);
- }
-
- // if (subPtr.p->m_subscriptionType != SubCreateReq::TableEvent) {
- // jam();
- // senderRef = subPtr.p->m_subscriberRef;
- // }
c_subscriptions.release(subPtr);
+ DBUG_PRINT("info",("c_subscriptionPool size: %d free: %d",
+ c_subscriptionPool.getSize(),
+ c_subscriptionPool.getNoOfFree()));
/**
* I was the last subscription to be remove so clear c_tables
@@ -3512,48 +3493,60 @@
#if 0
ndbout_c("SUB_REMOVE_REQ:Clearing c_tables");
#endif
+ int count= 0;
KeyTable<Table>::Iterator it;
- for(c_tables.first(it); !it.isNull(); ){
+ for(c_tables.first(it); !it.isNull(); )
+ {
+ // ndbrequire(false);
+ DBUG_PRINT("error",("trailing table id: %d[i=%d] n_subscribers: %d m_state: %d",
+ it.curr.p->m_tableId,
+ it.curr.p->m_ptrI,
+ it.curr.p->n_subscribers,
+ it.curr.p->m_state));
+
+ LocalDLList<Subscriber> subbs(c_subscriberPool,it.curr.p->c_subscribers);
+ SubscriberPtr subbPtr;
+ for(subbs.first(subbPtr);!subbPtr.isNull();subbs.next(subbPtr))
+ {
+ DBUG_PRINT("error",("subscriber %d, m_subPtrI: %d", subbPtr.i,
subbPtr.p->m_subPtrI));
+ }
+
it.curr.p->release(* this);
-
TablePtr tabPtr = it.curr;
-
c_tables.next(it);
- c_tables.release(tabPtr);
+ c_tables.remove(tabPtr);
+ c_tablePool.release(tabPtr);
+ DBUG_PRINT("info",("c_tablePool size: %d free: %d",
+ c_tablePool.getSize(),
+ c_tablePool.getNoOfFree()));
+ count++;
}
+ DBUG_ASSERT(count == 0);
}
-
- SubRemoveConf * const conf = (SubRemoveConf*)signal->getDataPtrSend();
- conf->senderRef = reference();
- conf->senderData = senderData;
- conf->subscriptionId = subscriptionId;
- conf->subscriptionKey = subscriptionKey;
-
- sendSignal(senderRef, GSN_SUB_REMOVE_CONF, signal,
- SubRemoveConf::SignalLength, JBB);
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::sendSubRemoveRef(Signal* signal, const SubRemoveReq& req,
- Uint32 errCode, bool temporary){
+Suma::sendSubRemoveRef(Signal* signal, const SubRemoveReq& req,
+ Uint32 errCode)
+{
jam();
+ DBUG_ENTER("Suma::sendSubRemoveRef");
SubRemoveRef * ref = (SubRemoveRef *)signal->getDataPtrSend();
ref->senderRef = reference();
+ ref->senderData = req.senderData;
ref->subscriptionId = req.subscriptionId;
ref->subscriptionKey = req.subscriptionKey;
- ref->senderData = req.senderData;
- ref->err = errCode;
- if (temporary)
- ref->setTemporary();
+ ref->errorCode = errCode;
releaseSections(signal);
sendSignal(signal->getSendersBlockRef(), GSN_SUB_REMOVE_REF,
signal, SubRemoveRef::SignalLength, JBB);
- return;
+ DBUG_VOID_RETURN;
}
void
-SumaParticipant::Table::release(SumaParticipant & suma){
+Suma::Table::release(Suma & suma){
jam();
LocalDataBuffer<15> attrBuf(suma.c_dataBufferPool, m_attributes);
@@ -3561,10 +3554,16 @@
LocalDataBuffer<15> fragBuf(suma.c_dataBufferPool, m_fragments);
fragBuf.release();
+
+ m_state = UNDEFINED;
+#ifndef DBUG_OFF
+ if (n_subscribers != 0)
+ abort();
+#endif
}
void
-SumaParticipant::SyncRecord::release(){
+Suma::SyncRecord::release(){
jam();
m_tableList.release();
@@ -3583,59 +3582,124 @@
*
*/
-Suma::Restart::Restart(Suma& s) : suma(s) {
- for (int i = 0; i < MAX_REPLICAS; i++) {
- c_okToStart[i] = false;
- c_waitingToStart[i] = false;
- }
+void
+Suma::execSUMA_START_ME_REQ(Signal* signal) {
+ jamEntry();
+ DBUG_ENTER("Suma::execSUMA_START_ME");
+ ndbassert(signal->getNoOfSections() == 0);
+ Restart.runSUMA_START_ME_REQ(signal, signal->getSendersBlockRef());
+ DBUG_VOID_RETURN;
+}
+
+void
+Suma::execSUB_CREATE_REF(Signal* signal) {
+ jamEntry();
+ DBUG_ENTER("Suma::execSUB_CREATE_REF");
+ ndbassert(signal->getNoOfSections() == 0);
+ ndbrequire(false);
+ DBUG_VOID_RETURN;
+}
+
+void
+Suma::execSUB_CREATE_CONF(Signal* signal)
+{
+ jamEntry();
+ DBUG_ENTER("Suma::execSUB_CREATE_CONF");
+ ndbassert(signal->getNoOfSections() == 0);
+ Restart.runSUB_CREATE_CONF(signal);
+ DBUG_VOID_RETURN;
+}
+
+void
+Suma::execSUB_START_CONF(Signal* signal)
+{
+ jamEntry();
+ DBUG_ENTER("Suma::execSUB_START_CONF");
+ ndbassert(signal->getNoOfSections() == 0);
+ Restart.runSUB_START_CONF(signal);
+ DBUG_VOID_RETURN;
}
void
-Suma::Restart::resetNode(Uint32 sumaRef)
+Suma::execSUB_START_REF(Signal* signal) {
+ jamEntry();
+ DBUG_ENTER("Suma::execSUB_START_REF");
+ ndbassert(signal->getNoOfSections() == 0);
+ ndbrequire(false);
+ DBUG_VOID_RETURN;
+}
+
+Suma::Restart::Restart(Suma& s) : suma(s)
+{
+ nodeId = 0;
+}
+
+void
+Suma::Restart::runSUMA_START_ME_REQ(Signal* signal, Uint32 sumaRef)
{
jam();
- int I = suma.RtoI(sumaRef);
- c_okToStart[I] = false;
- c_waitingToStart[I] = false;
+ DBUG_ENTER("Suma::Restart::runSUMA_START_ME");
+
+ if(nodeId != 0)
+ {
+ SumaStartMeRef* ref= (SumaStartMeRef*)signal->getDataPtrSend();
+ ref->errorCode = SumaStartMeRef::Busy;
+ suma.sendSignal(sumaRef, GSN_SUMA_START_ME_REF, signal,
+ SumaStartMeRef::SignalLength, JBB);
+ return;
+ }
+
+ nodeId = refToNode(sumaRef);
+ startNode(signal, sumaRef);
+
+ DBUG_VOID_RETURN;
}
void
Suma::Restart::startNode(Signal* signal, Uint32 sumaRef)
{
jam();
- resetNode(sumaRef);
-
+ DBUG_ENTER("Suma::Restart::startNode");
+
// right now we can only handle restarting one node
// at a time in a node group
-
+
createSubscription(signal, sumaRef);
+ DBUG_VOID_RETURN;
}
void
-Suma::Restart::createSubscription(Signal* signal, Uint32 sumaRef) {
+Suma::Restart::createSubscription(Signal* signal, Uint32 sumaRef)
+{
jam();
- suma.c_subscriptions.first(c_subPtr);
+ DBUG_ENTER("Suma::Restart::createSubscription");
+ suma.c_subscriptions.first(c_subIt);
nextSubscription(signal, sumaRef);
+ DBUG_VOID_RETURN;
}
void
-Suma::Restart::nextSubscription(Signal* signal, Uint32 sumaRef) {
+Suma::Restart::nextSubscription(Signal* signal, Uint32 sumaRef)
+{
jam();
- if (c_subPtr.isNull()) {
+ DBUG_ENTER("Suma::Restart::nextSubscription");
+
+ if (c_subIt.isNull())
+ {
jam();
completeSubscription(signal, sumaRef);
- return;
+ DBUG_VOID_RETURN;
}
SubscriptionPtr subPtr;
- subPtr.i = c_subPtr.curr.i;
+ subPtr.i = c_subIt.curr.i;
subPtr.p = suma.c_subscriptions.getPtr(subPtr.i);
- suma.c_subscriptions.next(c_subPtr);
+ suma.c_subscriptions.next(c_subIt);
SubCreateReq * req = (SubCreateReq *)signal->getDataPtrSend();
- req->subscriberRef = suma.reference();
- req->subscriberData = subPtr.i;
+ req->senderRef = suma.reference();
+ req->senderData = subPtr.i;
req->subscriptionId = subPtr.p->m_subscriptionId;
req->subscriptionKey = subPtr.p->m_subscriptionKey;
req->subscriptionType = subPtr.p->m_subscriptionType |
@@ -3643,414 +3707,804 @@
switch (subPtr.p->m_subscriptionType) {
case SubCreateReq::TableEvent:
- case SubCreateReq::SelectiveTableSnapshot:
- case SubCreateReq::DatabaseSnapshot: {
jam();
-
- Ptr<SyncRecord> syncPtr;
- suma.c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI);
- syncPtr.p->m_tableList.first(syncPtr.p->m_tableList_it);
-
- ndbrequire(!syncPtr.p->m_tableList_it.isNull());
-
- req->tableId = *syncPtr.p->m_tableList_it.data;
-
-#if 0
- for (int i = 0; i < MAX_TABLES; i++)
- if (subPtr.p->m_tables[i]) {
- req->tableId = i;
- break;
- }
-#endif
-
+ req->tableId = subPtr.p->m_tableId;
suma.sendSignal(sumaRef, GSN_SUB_CREATE_REQ, signal,
- SubCreateReq::SignalLength+1 /*to get table Id*/, JBB);
- return;
- }
- case SubCreateReq::SingleTableScan :
- // TODO
+ SubCreateReq::SignalLength, JBB);
+ DBUG_VOID_RETURN;
+ case SubCreateReq::SingleTableScan:
jam();
- return;
+ nextSubscription(signal, sumaRef);
+ DBUG_VOID_RETURN;
+ case SubCreateReq::SelectiveTableSnapshot:
+ case SubCreateReq::DatabaseSnapshot:
+ ndbrequire(false);
}
ndbrequire(false);
}
-void
-Suma::execSUB_CREATE_CONF(Signal* signal) {
- jamEntry();
-#ifdef NODEFAIL_DEBUG
- ndbout_c("Suma::execSUB_CREATE_CONF");
-#endif
+void
+Suma::Restart::runSUB_CREATE_CONF(Signal* signal)
+{
+ jam();
+ DBUG_ENTER("Suma::Restart::runSUB_CREATE_CONF");
const Uint32 senderRef = signal->senderBlockRef();
+ Uint32 sumaRef = signal->getSendersBlockRef();
SubCreateConf * const conf = (SubCreateConf *)signal->getDataPtr();
- Subscription key;
- const Uint32 subscriberData = conf->subscriberData;
- key.m_subscriptionId = conf->subscriptionId;
- key.m_subscriptionKey = conf->subscriptionKey;
-
SubscriptionPtr subPtr;
- ndbrequire(c_subscriptions.find(subPtr, key));
+ suma.c_subscriptions.getPtr(subPtr,conf->senderData);
switch(subPtr.p->m_subscriptionType) {
case SubCreateReq::TableEvent:
- case SubCreateReq::SelectiveTableSnapshot:
- case SubCreateReq::DatabaseSnapshot:
+ if (1)
{
- Ptr<SyncRecord> syncPtr;
- c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI);
-
- syncPtr.p->m_tableList.next(syncPtr.p->m_tableList_it);
- if (syncPtr.p->m_tableList_it.isNull()) {
- jam();
- SubSyncReq *req = (SubSyncReq *)signal->getDataPtrSend();
-
- req->subscriptionId = key.m_subscriptionId;
- req->subscriptionKey = key.m_subscriptionKey;
- req->subscriberData = subscriberData;
- req->part = (Uint32) SubscriptionData::MetaData;
-
- sendSignal(senderRef, GSN_SUB_SYNC_REQ, signal,
- SubSyncReq::SignalLength, JBB);
- } else {
- jam();
- SubCreateReq * req = (SubCreateReq *)signal->getDataPtrSend();
+ jam();
+ nextSubscription(signal, sumaRef);
+ } else {
+ jam();
+ SubCreateReq * req = (SubCreateReq *)signal->getDataPtrSend();
- req->subscriberRef = reference();
- req->subscriberData = subPtr.i;
- req->subscriptionId = subPtr.p->m_subscriptionId;
- req->subscriptionKey = subPtr.p->m_subscriptionKey;
- req->subscriptionType = subPtr.p->m_subscriptionType |
- SubCreateReq::RestartFlag |
- SubCreateReq::AddTableFlag;
+ req->senderRef = suma.reference();
+ req->senderData = subPtr.i;
+ req->subscriptionId = subPtr.p->m_subscriptionId;
+ req->subscriptionKey = subPtr.p->m_subscriptionKey;
+ req->subscriptionType = subPtr.p->m_subscriptionType |
+ SubCreateReq::RestartFlag |
+ SubCreateReq::AddTableFlag;
- req->tableId = *syncPtr.p->m_tableList_it.data;
+ req->tableId = 0;
- sendSignal(senderRef, GSN_SUB_CREATE_REQ, signal,
- SubCreateReq::SignalLength+1 /*to get table Id*/, JBB);
- }
+ suma.sendSignal(senderRef, GSN_SUB_CREATE_REQ, signal,
+ SubCreateReq::SignalLength, JBB);
}
- return;
+ DBUG_VOID_RETURN;
case SubCreateReq::SingleTableScan:
+ case SubCreateReq::SelectiveTableSnapshot:
+ case SubCreateReq::DatabaseSnapshot:
ndbrequire(false);
}
ndbrequire(false);
}
void
-Suma::execSUB_CREATE_REF(Signal* signal) {
- jamEntry();
-#ifdef NODEFAIL_DEBUG
- ndbout_c("Suma::execSUB_CREATE_REF");
-#endif
- //ndbrequire(false);
+Suma::Restart::completeSubscription(Signal* signal, Uint32 sumaRef)
+{
+ jam();
+ DBUG_ENTER("Suma::Restart::completeSubscription");
+ startSubscriber(signal, sumaRef);
+ DBUG_VOID_RETURN;
}
void
-Suma::execSUB_SYNC_CONF(Signal* signal) {
- jamEntry();
-#ifdef NODEFAIL_DEBUG
- ndbout_c("Suma::execSUB_SYNC_CONF");
-#endif
- Uint32 sumaRef = signal->getSendersBlockRef();
+Suma::Restart::startSubscriber(Signal* signal, Uint32 sumaRef)
+{
+ jam();
+ DBUG_ENTER("Suma::Restart::startSubscriber");
+ suma.c_tables.first(c_tabIt);
+ if (c_tabIt.isNull())
+ {
+ completeSubscriber(signal, sumaRef);
+ DBUG_VOID_RETURN;
+ }
+ SubscriberPtr subbPtr;
+ {
+ LocalDLList<Subscriber>
+ subbs(suma.c_subscriberPool,c_tabIt.curr.p->c_subscribers);
+ subbs.first(subbPtr);
+ }
+ nextSubscriber(signal, sumaRef, subbPtr);
+ DBUG_VOID_RETURN;
+}
- SubSyncConf *conf = (SubSyncConf *)signal->getDataPtr();
- Subscription key;
+void
+Suma::Restart::nextSubscriber(Signal* signal, Uint32 sumaRef,
+ SubscriberPtr subbPtr)
+{
+ jam();
+ DBUG_ENTER("Suma::Restart::nextSubscriber");
+ while (subbPtr.isNull())
+ {
+ jam();
+ DBUG_PRINT("info",("prev tableId %u",c_tabIt.curr.p->m_tableId));
+ suma.c_tables.next(c_tabIt);
+ if (c_tabIt.isNull())
+ {
+ completeSubscriber(signal, sumaRef);
+ DBUG_VOID_RETURN;
+ }
+ DBUG_PRINT("info",("next tableId %u",c_tabIt.curr.p->m_tableId));
- key.m_subscriptionId = conf->subscriptionId;
- key.m_subscriptionKey = conf->subscriptionKey;
- // SubscriptionData::Part part = (SubscriptionData::Part)conf->part;
- // const Uint32 subscriberData = conf->subscriberData;
+ LocalDLList<Subscriber>
+ subbs(suma.c_subscriberPool,c_tabIt.curr.p->c_subscribers);
+ subbs.first(subbPtr);
+ }
- SubscriptionPtr subPtr;
- c_subscriptions.find(subPtr, key);
+ /*
+ * get subscription ptr for this subscriber
+ */
- switch(subPtr.p->m_subscriptionType) {
+ SubscriptionPtr subPtr;
+ suma.c_subscriptions.getPtr(subPtr, subbPtr.p->m_subPtrI);
+ switch (subPtr.p->m_subscriptionType) {
case SubCreateReq::TableEvent:
+ jam();
+ sendSubStartReq(subPtr, subbPtr, signal, sumaRef);
+ DBUG_VOID_RETURN;
case SubCreateReq::SelectiveTableSnapshot:
case SubCreateReq::DatabaseSnapshot:
- jam();
- Restart.nextSubscription(signal, sumaRef);
- return;
case SubCreateReq::SingleTableScan:
ndbrequire(false);
- return;
}
ndbrequire(false);
}
-void
-Suma::execSUB_SYNC_REF(Signal* signal) {
- jamEntry();
-#ifdef NODEFAIL_DEBUG
- ndbout_c("Suma::execSUB_SYNC_REF");
-#endif
- //ndbrequire(false);
-}
-
void
-Suma::execSUMA_START_ME(Signal* signal) {
- jamEntry();
-#ifdef NODEFAIL_DEBUG
- ndbout_c("Suma::execSUMA_START_ME");
-#endif
+Suma::Restart::sendSubStartReq(SubscriptionPtr subPtr, SubscriberPtr subbPtr,
+ Signal* signal, Uint32 sumaRef)
+{
+ jam();
+ DBUG_ENTER("Suma::Restart::sendSubStartReq");
+ SubStartReq * req = (SubStartReq *)signal->getDataPtrSend();
- Restart.runSUMA_START_ME(signal, signal->getSendersBlockRef());
-}
+ req->senderRef = suma.reference();
+ req->senderData = subbPtr.i;
+ req->subscriptionId = subPtr.p->m_subscriptionId;
+ req->subscriptionKey = subPtr.p->m_subscriptionKey;
+ req->part = SubscriptionData::TableData;
+ req->subscriberData = subbPtr.p->m_senderData;
+ req->subscriberRef = subbPtr.p->m_senderRef;
-void
-Suma::Restart::runSUMA_START_ME(Signal* signal, Uint32 sumaRef) {
- int I = suma.RtoI(sumaRef);
+ // restarting suma will not respond to this until startphase 5
+ // since it is not until then data copying has been completed
+ DBUG_PRINT("info",("Restarting subscriber: %u on key: [%u,%u]",
+ subbPtr.i,
+ subPtr.p->m_subscriptionId,
+ subPtr.p->m_subscriptionKey,
+ subPtr.p->m_tableId));
- // restarting Suma is ready for SUB_START_REQ
- if (c_waitingToStart[I]) {
- // we've waited with startSubscriber since restarting suma was not ready
- c_waitingToStart[I] = false;
- startSubscriber(signal, sumaRef);
- } else {
- // do startSubscriber as soon as its time
- c_okToStart[I] = true;
- }
+ suma.sendSignal(sumaRef, GSN_SUB_START_REQ,
+ signal, SubStartReq::SignalLength2, JBB);
+ DBUG_VOID_RETURN;
}
void
-Suma::Restart::completeSubscription(Signal* signal, Uint32 sumaRef) {
+Suma::Restart::runSUB_START_CONF(Signal* signal)
+{
jam();
- int I = suma.RtoI(sumaRef);
+ DBUG_ENTER("Suma::Restart::runSUB_START_CONF");
- if (c_okToStart[I]) {// otherwise will start when START_ME comes
- c_okToStart[I] = false;
- startSubscriber(signal, sumaRef);
- } else {
- c_waitingToStart[I] = true;
+ SubStartConf * const conf = (SubStartConf*)signal->getDataPtr();
+
+ Subscription key;
+ SubscriptionPtr subPtr;
+ key.m_subscriptionId = conf->subscriptionId;
+ key.m_subscriptionKey = conf->subscriptionKey;
+ ndbrequire(suma.c_subscriptions.find(subPtr, key));
+
+ TablePtr tabPtr;
+ ndbrequire(suma.c_tables.find(tabPtr, subPtr.p->m_tableId));
+
+ SubscriberPtr subbPtr;
+ {
+ LocalDLList<Subscriber>
+ subbs(suma.c_subscriberPool,tabPtr.p->c_subscribers);
+ subbs.getPtr(subbPtr, conf->senderData);
+ DBUG_PRINT("info",("Restarted subscriber: %u on key: [%u,%u] table: %u",
+ subbPtr.i,key.m_subscriptionId,key.m_subscriptionKey,
+ subPtr.p->m_tableId));
+ subbs.next(subbPtr);
}
+
+ Uint32 sumaRef = signal->getSendersBlockRef();
+ nextSubscriber(signal, sumaRef, subbPtr);
+
+ DBUG_VOID_RETURN;
}
void
-Suma::Restart::startSubscriber(Signal* signal, Uint32 sumaRef) {
- jam();
- suma.c_dataSubscribers.first(c_subbPtr);
- nextSubscriber(signal, sumaRef);
+Suma::Restart::completeSubscriber(Signal* signal, Uint32 sumaRef)
+{
+ DBUG_ENTER("Suma::Restart::completeSubscriber");
+ completeRestartingNode(signal, sumaRef);
+ DBUG_VOID_RETURN;
}
void
-Suma::Restart::sendSubStartReq(SubscriptionPtr subPtr, SubscriberPtr subbPtr,
- Signal* signal, Uint32 sumaRef)
+Suma::Restart::completeRestartingNode(Signal* signal, Uint32 sumaRef)
{
jam();
- SubStartReq * req = (SubStartReq *)signal->getDataPtrSend();
-
- req->senderRef = suma.reference();
- req->senderData = subbPtr.p->m_senderData;
- req->subscriptionId = subPtr.p->m_subscriptionId;
- req->subscriptionKey = subPtr.p->m_subscriptionKey;
- req->part = SubscriptionData::TableData;
- req->subscriberData = subbPtr.p->m_subscriberData;
- req->subscriberRef = subbPtr.p->m_subscriberRef;
-
- // restarting suma will not respond to this until startphase 5
- // since it is not until then data copying has been completed
-#ifdef NODEFAIL_DEBUG
- ndbout_c("Suma::Restart::sendSubStartReq sending GSN_SUB_START_REQ id=%u key=%u",
- req->subscriptionId, req->subscriptionKey);
-#endif
- suma.sendSignal(sumaRef, GSN_SUB_START_REQ,
- signal, SubStartReq::SignalLength2, JBB);
+ DBUG_ENTER("Suma::Restart::completeRestartingNode");
+ //SumaStartMeConf *conf= (SumaStartMeConf*)signal->getDataPtrSend();
+ suma.sendSignal(sumaRef, GSN_SUMA_START_ME_CONF, signal,
+ SumaStartMeConf::SignalLength, JBB);
+ nodeId = 0;
+ DBUG_VOID_RETURN;
}
-void
-Suma::execSUB_START_CONF(Signal* signal) {
+// only run on restarting suma
+
+void
+Suma::execSUMA_HANDOVER_REQ(Signal* signal)
+{
jamEntry();
-#ifdef NODEFAIL_DEBUG
- ndbout_c("Suma::execSUB_START_CONF");
-#endif
- Uint32 sumaRef = signal->getSendersBlockRef();
- Restart.nextSubscriber(signal, sumaRef);
+ DBUG_ENTER("Suma::execSUMA_HANDOVER_REQ");
+ // Uint32 sumaRef = signal->getSendersBlockRef();
+ SumaHandoverReq const * req = (SumaHandoverReq *)signal->getDataPtr();
+
+ Uint32 gci = req->gci;
+ Uint32 nodeId = req->nodeId;
+ Uint32 new_gci = m_last_complete_gci + MAX_CONCURRENT_GCP + 1;
+
+ Uint32 start_gci = (gci > new_gci ? gci : new_gci);
+ // mark all active buckets really belonging to restarting SUMA
+
+ Bucket_mask tmp;
+ for( Uint32 i = 0; i < c_no_of_buckets; i++)
+ {
+ if(get_responsible_node(i) == nodeId)
+ {
+ if (m_active_buckets.get(i))
+ {
+ // I'm running this bucket but it should really be the restarted node
+ tmp.set(i);
+ m_active_buckets.clear(i);
+ m_switchover_buckets.set(i);
+ c_buckets[i].m_switchover_gci = start_gci;
+ c_buckets[i].m_state |= Bucket::BUCKET_HANDOVER;
+ c_buckets[i].m_switchover_node = nodeId;
+ ndbout_c("prepare to handover bucket: %d", i);
+ }
+ else if(m_switchover_buckets.get(i))
+ {
+ ndbout_c("dont handover bucket: %d %d", i, nodeId);
+ }
+ }
+ }
+
+ SumaHandoverConf* conf= (SumaHandoverConf*)signal->getDataPtrSend();
+ tmp.copyto(BUCKET_MASK_SIZE, conf->theBucketMask);
+ conf->gci = start_gci;
+ conf->nodeId = getOwnNodeId();
+ sendSignal(calcSumaBlockRef(nodeId), GSN_SUMA_HANDOVER_CONF, signal,
+ SumaHandoverConf::SignalLength, JBB);
+
+ DBUG_VOID_RETURN;
}
-void
-Suma::execSUB_START_REF(Signal* signal) {
+// only run on all but restarting suma
+void
+Suma::execSUMA_HANDOVER_REF(Signal* signal)
+{
+ ndbrequire(false);
+}
+
+void
+Suma::execSUMA_HANDOVER_CONF(Signal* signal) {
jamEntry();
-#ifdef NODEFAIL_DEBUG
- ndbout_c("Suma::execSUB_START_REF");
+ DBUG_ENTER("Suma::execSUMA_HANDOVER_CONF");
+
+ SumaHandoverConf const * conf = (SumaHandoverConf *)signal->getDataPtr();
+
+ Uint32 gci = conf->gci;
+ Uint32 nodeId = conf->nodeId;
+ Bucket_mask tmp;
+ tmp.assign(BUCKET_MASK_SIZE, conf->theBucketMask);
+#ifdef HANDOVER_DEBUG
+ ndbout_c("Suma::execSUMA_HANDOVER_CONF, gci = %u", gci);
#endif
- //ndbrequire(false);
-}
-void
-Suma::Restart::nextSubscriber(Signal* signal, Uint32 sumaRef) {
- jam();
- if (c_subbPtr.isNull()) {
- jam();
- completeSubscriber(signal, sumaRef);
- return;
+ for( Uint32 i = 0; i < c_no_of_buckets; i++)
+ {
+ if (tmp.get(i))
+ {
+ ndbrequire(get_responsible_node(i) == getOwnNodeId());
+ // We should run this bucket, but _nodeId_ is
+ c_buckets[i].m_switchover_gci = gci;
+ c_buckets[i].m_state |= Bucket::BUCKET_STARTING;
+ }
}
- SubscriberPtr subbPtr = c_subbPtr;
- suma.c_dataSubscribers.next(c_subbPtr);
+ char buf[255];
+ tmp.getText(buf);
+ infoEvent("Suma: handover from node %d gci: %d buckets: %s (%d)",
+ nodeId, gci, buf, c_no_of_buckets);
+ m_switchover_buckets.bitOR(tmp);
+ c_startup.m_handover_nodes.clear(nodeId);
+ DBUG_VOID_RETURN;
+}
- /*
- * get subscription ptr for this subscriber
- */
+static
+NdbOut&
+operator<<(NdbOut & out, const Suma::Page_pos & pos)
+{
+ out << "[ Page_pos:"
+ << " m_page_id: " << pos.m_page_id
+ << " m_page_pos: " << pos.m_page_pos
+ << " m_max_gci: " << pos.m_max_gci
+ << " ]";
+ return out;
+}
- SubscriptionPtr subPtr;
- suma.c_subscriptions.getPtr(subPtr, subbPtr.p->m_subPtrI);
- switch (subPtr.p->m_subscriptionType) {
- case SubCreateReq::TableEvent:
- case SubCreateReq::SelectiveTableSnapshot:
- case SubCreateReq::DatabaseSnapshot:
+Uint32*
+Suma::get_buffer_ptr(Signal* signal, Uint32 buck, Uint32 gci, Uint32 sz)
+{
+ sz += 1; // len
+ Bucket* bucket= c_buckets+buck;
+ Page_pos pos= bucket->m_buffer_head;
+
+ Buffer_page* page= (Buffer_page*)(m_tup->page+pos.m_page_id);
+ Uint32* ptr= page->m_data + pos.m_page_pos;
+
+ const bool same_gci = (gci == pos.m_last_gci) && (!ERROR_INSERTED(13022));
+
+ pos.m_page_pos += sz;
+ pos.m_last_gci = gci;
+ Uint32 max = pos.m_max_gci > gci ? pos.m_max_gci : gci;
+
+ if(likely(same_gci && pos.m_page_pos <= Buffer_page::DATA_WORDS))
+ {
+ pos.m_max_gci = max;
+ bucket->m_buffer_head = pos;
+ * ptr++ = (0x8000 << 16) | sz; // Same gci
+ return ptr;
+ }
+ else if(pos.m_page_pos + 1 <= Buffer_page::DATA_WORDS)
+ {
+loop:
+ pos.m_max_gci = max;
+ pos.m_page_pos += 1;
+ bucket->m_buffer_head = pos;
+ * ptr++ = (sz + 1);
+ * ptr++ = gci;
+ return ptr;
+ }
+ else
+ {
+ /**
+ * new page
+ * 1) save header on last page
+ * 2) seize new page
+ */
+ Uint32 next;
+ if(unlikely((next= seize_page()) == RNIL))
{
- jam();
- sendSubStartReq(subPtr, subbPtr, signal, sumaRef);
-#if 0
- SubStartReq * req = (SubStartReq *)signal->getDataPtrSend();
-
- req->senderRef = reference();
- req->senderData = subbPtr.p->m_senderData;
- req->subscriptionId = subPtr.p->m_subscriptionId;
- req->subscriptionKey = subPtr.p->m_subscriptionKey;
- req->part = SubscriptionData::TableData;
- req->subscriberData = subbPtr.p->m_subscriberData;
- req->subscriberRef = subbPtr.p->m_subscriberRef;
-
- // restarting suma will not respond to this until startphase 5
- // since it is not until then data copying has been completed
-#ifdef NODEFAIL_DEBUG
- ndbout_c("Suma::nextSubscriber sending GSN_SUB_START_REQ id=%u key=%u",
- req->subscriptionId, req->subscriptionKey);
-#endif
- suma.sendSignal(sumaRef, GSN_SUB_START_REQ,
- signal, SubStartReq::SignalLength2, JBB);
-#endif
+ /**
+ * Out of buffer
+ */
+ out_of_buffer(signal);
+ return 0;
}
- return;
- case SubCreateReq::SingleTableScan:
- ndbrequire(false);
- return;
+
+ if(likely(pos.m_page_id != RNIL))
+ {
+ page->m_max_gci = pos.m_max_gci;
+ page->m_words_used = pos.m_page_pos - sz;
+ page->m_next_page= next;
+ }
+ else
+ {
+ bucket->m_buffer_tail = next;
+ }
+
+ memset(&pos, 0, sizeof(pos));
+ pos.m_page_id = next;
+ pos.m_page_pos = sz;
+ pos.m_last_gci = gci;
+
+ page= (Buffer_page*)(m_tup->page+pos.m_page_id);
+ page->m_next_page= RNIL;
+ ptr= page->m_data;
+ goto loop; //
}
- ndbrequire(false);
}
-void
-Suma::Restart::completeSubscriber(Signal* signal, Uint32 sumaRef) {
- completeRestartingNode(signal, sumaRef);
+void
+Suma::out_of_buffer(Signal* signal)
+{
+ if(m_out_of_buffer_gci)
+ {
+ return;
+ }
+
+ m_out_of_buffer_gci = m_last_complete_gci - 1;
+ infoEvent("Out of event buffer: nodefailure will cause event failures");
+
+ signal->theData[0] = SumaContinueB::OUT_OF_BUFFER_RELEASE;
+ signal->theData[1] = 0;
+ sendSignal(SUMA_REF, GSN_CONTINUEB, signal, 2, JBB);
}
void
-Suma::Restart::completeRestartingNode(Signal* signal, Uint32 sumaRef) {
- jam();
- SumaHandoverReq * req = (SumaHandoverReq *)signal->getDataPtrSend();
+Suma::out_of_buffer_release(Signal* signal, Uint32 buck)
+{
+ Bucket* bucket= c_buckets+buck;
+ Uint32 tail= bucket->m_buffer_tail;
+
+ if(tail != RNIL)
+ {
+ Buffer_page* page= (Buffer_page*)(m_tup->page+tail);
+ bucket->m_buffer_tail = page->m_next_page;
+ free_page(tail, page);
+ signal->theData[0] = SumaContinueB::OUT_OF_BUFFER_RELEASE;
+ signal->theData[1] = buck;
+ sendSignal(SUMA_REF, GSN_CONTINUEB, signal, 2, JBB);
+ return;
+ }
- req->gci = suma.getFirstGCI(signal);
+ /**
+ * Clear head
+ */
+ bucket->m_buffer_head.m_page_id = RNIL;
+ bucket->m_buffer_head.m_page_pos = Buffer_page::DATA_WORDS + 1;
+
+ buck++;
| Thread |
|---|
| • bk commit into 5.1 tree (tomas:1.1895) | tomas | 15 Sep |