#At file:///export/home2/tmp/maitrayi/mysql-src2/mysql-5.1-telco-7.0-mai/ based on revid:msabaratnam@stripped
3253 Maitrayi Sabaratnam 2010-10-01 [merge]
Merge with 7.0 - revno 3811
removed:
cluster_change_hist.txt
added:
storage/ndb/src/ndbapi/ndb_internal.cpp
modified:
configure.in
mysql-test/suite/ndb_team/t/ndb_restart.test
sql/ha_ndbcluster_binlog.cc
storage/ndb/include/mgmapi/mgmapi.h
storage/ndb/include/ndb_version.h.in
storage/ndb/include/ndbapi/Ndb.hpp
storage/ndb/include/ndbapi/NdbIndexOperation.hpp
storage/ndb/include/ndbapi/NdbOperation.hpp
storage/ndb/include/ndbapi/NdbTransaction.hpp
storage/ndb/ndb_configure.m4
storage/ndb/src/common/portlib/NdbDir.cpp
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp
storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
storage/ndb/src/kernel/blocks/dbtux/DbtuxBuild.cpp
storage/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp
storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp
storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
storage/ndb/src/kernel/blocks/ndbfs/PosixAsyncFile.cpp
storage/ndb/src/kernel/blocks/suma/Suma.cpp
storage/ndb/src/kernel/blocks/suma/Suma.hpp
storage/ndb/src/mgmapi/mgmapi.cpp
storage/ndb/src/mgmclient/CommandInterpreter.cpp
storage/ndb/src/mgmsrv/ConfigManager.cpp
storage/ndb/src/mgmsrv/MgmtSrvr.cpp
storage/ndb/src/mgmsrv/MgmtSrvr.hpp
storage/ndb/src/mgmsrv/Services.cpp
storage/ndb/src/mgmsrv/main.cpp
storage/ndb/src/ndbapi/API.hpp
storage/ndb/src/ndbapi/CMakeLists.txt
storage/ndb/src/ndbapi/ClusterMgr.cpp
storage/ndb/src/ndbapi/ClusterMgr.hpp
storage/ndb/src/ndbapi/Makefile.am
storage/ndb/src/ndbapi/Ndb.cpp
storage/ndb/src/ndbapi/NdbApiSignal.cpp
storage/ndb/src/ndbapi/NdbApiSignal.hpp
storage/ndb/src/ndbapi/NdbBlob.cpp
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp
storage/ndb/src/ndbapi/NdbImpl.hpp
storage/ndb/src/ndbapi/NdbIndexOperation.cpp
storage/ndb/src/ndbapi/NdbInfoScanOperation.cpp
storage/ndb/src/ndbapi/NdbInterpretedCode.cpp
storage/ndb/src/ndbapi/NdbOperation.cpp
storage/ndb/src/ndbapi/NdbOperationDefine.cpp
storage/ndb/src/ndbapi/NdbOperationExec.cpp
storage/ndb/src/ndbapi/NdbOperationInt.cpp
storage/ndb/src/ndbapi/NdbOperationSearch.cpp
storage/ndb/src/ndbapi/NdbReceiver.cpp
storage/ndb/src/ndbapi/NdbScanFilter.cpp
storage/ndb/src/ndbapi/NdbScanOperation.cpp
storage/ndb/src/ndbapi/NdbTransaction.cpp
storage/ndb/src/ndbapi/NdbTransactionScan.cpp
storage/ndb/src/ndbapi/NdbWaiter.hpp
storage/ndb/src/ndbapi/Ndberr.cpp
storage/ndb/src/ndbapi/Ndbif.cpp
storage/ndb/src/ndbapi/Ndbinit.cpp
storage/ndb/src/ndbapi/Ndblist.cpp
storage/ndb/src/ndbapi/SignalSender.cpp
storage/ndb/src/ndbapi/SignalSender.hpp
storage/ndb/src/ndbapi/TransporterFacade.cpp
storage/ndb/src/ndbapi/TransporterFacade.hpp
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp
storage/ndb/src/ndbapi/ndb_internal.hpp
storage/ndb/test/include/NdbRestarter.hpp
storage/ndb/test/ndbapi/testIndex.cpp
storage/ndb/test/ndbapi/testNdbinfo.cpp
storage/ndb/test/ndbapi/testNodeRestart.cpp
storage/ndb/test/run-test/daily-basic-tests.txt
storage/ndb/test/src/NDBT_Test.cpp
storage/ndb/test/src/NdbRestarter.cpp
=== removed file 'cluster_change_hist.txt'
--- a/cluster_change_hist.txt 2009-12-14 10:18:40 +0000
+++ b/cluster_change_hist.txt 1970-01-01 00:00:00 +0000
@@ -1,276 +0,0 @@
-==================================================
-mysql-5.1.X-ndb-6.2.Y
-==================================================
-
-mysql-5.1.19-ndb-6.2.4 (released 2007-07-04)
-
- Bug #29525 batching incorrect
- Bug #28720 Disk data meta information is not visible in mysqld but exists in ndbd
- Bug #28642 Tablespace returning incorrect usage status
- Bug #29501 DN crashes in LGMAN during NR while DD schema operations are being handled
- Bug #29354 Incorrect handling of replica REDO during SR (5.0)
- Bug #29364 SQL queries hang while data node in start phase 5
- Bug #27404 util thd mysql_parse sig11 when mysqld default multibyte charset
-
-mysql-5.1.19-ndb-6.2.3 (released 2007-07-02)
-(additional bugs fixed compared to mysql-5.1.19)
-
- Bug #29331 Incorrect node killed on GCP Stop (COPY_GCI)
- Bug #29057 Incorrect handling of file 0 during redo execution(Error while reading REDO log)
- Bug #29067 Incorrect order during redo invalidation(Error while reading REDO log)
- Bug #29118 Incorrect handling of loglap in redo invalidation (Error while reading REDO log)
- Bug #29229 memory corruption in dbtup
- Bug #29185 Large IN list crashes mysqld with cluster and condition pushdown
- Bug #29176 drop table can crash pgman
- Bug #28989 hpux11 ps_row warnings
- Bug #25305 rpl_ndb_UUID.test fails on pb-valgrind
- Bug #29167 Insufficient nodes for SR
- Bug #27640 backup id not displayed in the output of "ndb_mgm start backup wait completed"
- Bug #28949 n_mix valgrind failing in pushbuild
- Bug #29099 slow backup for disk data
- Bug #26342 auto_increment_increment AND auto_increment_offset REALLY REALLY anger NDB cluster
- Bug #29103 ndb_restore segfaults on NULL var[char|binary]
- Bug #29074 preserve file timestamps in ndb_error_reporter
- Bug #29073 Store history for ndb_mgm
- Bug #29063 mgmapi: connect timeout set incorrectly
- Bug #29044 blob code sets error code on transaction object
- Bug #28724 for blobs, op flag to not set error on trans
- Bug #28751 Lots of memory locked in memory causes high kswapd
- Bug #28899 not possible to set separate watchdog timeout at startup
- Bug# 28726 LCP files not removed after initial system restart
- Bug #20612 failed ndbrequire in PGMAN
- Bug #28443 transporter gets stuck when >1024 signals received at once
- Bug #28770 file already opened error when corrupt schema file
- Bug #28749 MaxNoOfOpenFiles offset by 1
- Bug #26783 replication status unknown after cluster or mysqld failure
- Bug #28717 Race between NODE_FAILREP and COPY_GCIREQ
- Bug #28719 multi pk update ignore corrupts data
- Bug #28653 Fast GCP + high load + high RedoBuffer causes ndbrequire
- Bug #28525 Node failures in PGMAN at ndbrequire (line 430)
-
-
-==================================================
-mysql-5.1.15-ndb-6.1.X
-==================================================
-
-mysql-5.1.15-ndb-6.1.16 (2007-06-28)
-
- Bug #29331 Incorrect node killed on GCP Stop (COPY_GCI)
- Bug #29057 Incorrect handling of file 0 during redo execution(Error while reading REDO log)
- Bug #29067 Incorrect order during redo invalidation(Error while reading REDO log)
- Bug #29118 Incorrect handling of loglap in redo invalidation (Error while reading REDO log)
- Bug #29176 drop table can crash pgman
-
-mysql-5.1.15-ndb-6.1.15 (2007-06-20)
-
- Bug #29229 memory corruption in dbtup
-
-mysql-5.1.15-ndb-6.1.14 (2007-06-19)
-
- Bug #29176 missing stack pruning in drop_page
- Bug #29167 Insufficient nodes for SR
-
-mysql-5.1.15-ndb-6.1.13 (2007-06-15)
-
- Bug #29099 slow backup for disk data
-
-mysql-5.1.15-ndb-6.1.12 (2007-06-13)
-
- Bug #29044 memory buddy allocator "unoptimal" memory handling
- extend backup dump to give more info
-
-mysql-5.1.15-ndb-6.1.11 (2007-06-06)
-
- Bug #28751 Lots of memory locked in memory causes high kswapd
- Bug #28899 not possible to set separate watchdog timeout at startup
- Bug #28726 LCP files not removed after initial system restart
- Bug #20612 failed ndbrequire in PGMAN
- make size of redo log files (fragment log files) configurable (error 1220)
-
-mysql-5.1.15-ndb-6.1.10 (2007-05-30)
-
- Bug #28783 heartbeat failures under high load
- Bug #28770 file already opened error when corrupt schema file
- Bug #28717 Race between NODE_FAILREP and COPY_GCIREQ
- Bug #28525 Node failures in PGMAN at ndbrequire (line 430)
- Bug #28653 Fast GCP + high load + high RedoBuffer causes ndbrequire
- Bug #28749 MaxNoOfOpenFiles offset by 1
- Added addditional 'times' printout in ndbd WatchDog thread
- Some filename changes to avoid 'tar' issues with 99 char limit
- Removed some extra printouts in ndbd out file
-
-mysql-5.1.15-ndb-6.1.9 (2007-05-24)
-
- Bug #28593 cluster backup scans in acc index order, bad for disk data
- Bug #28443 transporter gets stuck when >1024 signals received at once
-
-mysql-5.1.15-ndb-6.1.8 (2007-05-18)
-
- Bug #28491 Expand check gets disabled in some cases (initial node restart)
- Bug #28348 Dropped tables not removed from LCP
- Bug #20535 NDB API implicit insert of NULL does not overwrite old value
- Bug #27437 NDB Data node crashes during mysqldump inserts
- Bug #27942 node failure during massive insert
-
-mysql-5.1.15-ndb-6.1.7 (2007-05-05)
-
- Bug #26121 mysqldump includes LOCK TABLES general_log WRITE
- Bug #28161 Detached triggers + DD and only MM update could cause node failure
- Bug #25530 --with-readline fails with commercial source packages
- Bug #25741 AllocNodeIdRef::NodeFailureHandlingNotCompleted
- Bug #27205 Occational 899 if delete+insert during LCP
- Bug #24667 After ALTER TABLE operation ndb_dd table becomes regular ndb
- Bug #28093 ndb: retry sleep in get table stats 30s instead of 30ms
- Bug #28073 Infinite loop in lock queue.
- Bug #27495 Missing implementation of NdbTransaction::executeAsynch().
- Bug #28023 NR can fail to update GCI
- Bug #27756 Memleak with insert+delete
- Bug #27757 Tup scan cant see own records
- Bug #27748 Inconsistent replication(backup) with some multi-update combinations
- Bug #27651 Very high load can cause event api to get out of sync, "out of order buckets"
- Bug #27728 Partially connected API's can cause problem for SUMA
- Bug #27663 Missmatched free/delete in listObjects
- Bug #27560 Memory usage of mysqld grows while doing nothing
- Bug #27581 Drop/truncate table can result in node/cluster-crash
-
- (no bug number) fix bug in my.cnf config handling, put64 for 64-bit variables
-
- Other changes:
- - Force varpart, such that tables can handle online add column when feature arrives
-
- Test tools update for measuring replication latency:
-
- - new ndb tool 'rep_latency' to measure replication latency
- - simple extend of 'listen_event' to do apply on remote cluster
-
-mysql-5.1.15-ndb-6.1.6 (2007-03-30)
-
- Bug #27529 Slave crashes on lots of updates
- Bug #27512 Inconsistent tuples when using variable size and >16Gb datamemory
- Bug #27378 update becomes delete on slave
- Bug #27466 nf during nr can leave cluster in inconsistent state
- Bug #27444 DataMemory missing from report in cluster logs
- Bug #27044 replicated with unique field ndb table allows duplicate key inserts
- Bug #26286 row-based logging scales worse than statement-based logging
- Bug #19896 Last_Errno: 4294967295, Error in Write_rows event: (error number 4 billion ?)
- Bug #27320 ndb handler does not reset extra flags on reset()
- Bug #27283 Race condition in GCP Master take-over
- Bug #26825 MySQL Server Crashes in high load
- Bug #27286 Rare racecondition in nodeid allocation on master failure
- Bug #27291 Setting LockPagesInMainMemory to zero doesn't work
- Bug #20185 Node failure might cause other node failure
- Bug #27203 ScanDelete+Scan+Insert could cause node crash
- Bug #27169 xtra word sent in SUMA::resend_bucket causing crash of mysqld(event listener)
- Bug #27005 Node failure + API failure can crash SUMA resend
- Bug #27087 Unoptimal handling of failed API in SUMA
- Bug #27102 Node can crash during flush of undo during restart with filesystem error
- Bug #27003 Failure during noderestart could crash/hang alive node (and hence cluster)
- (not reported) correct event buffer status reporting
-
-mysql-5.1.15-ndb-6.1.5 (2007-03-15)
-
- Bug #26997 - mysqld segfault when in single user mode
- Bug #26825 - MySQL Server Crashes in high load
- Bug #25743 - If undo_buffer_size (for LG) greater than the inital shared memory (default 20M), ndbd nodes are crashed
- Bug #26899 - ndb_restore cannot restore selected tables and databases
- Bug #26900 - ndb_restore printout option does not give structured data
- Bug #26720 - Infinite loop on unknown signal in logging function
-
- * ndb_apply_status schema change
- * ndb_restore options for printing to file
-
- Note: since ndb_apply_status schema change this version is not backwards compatible
-
-mysql-5.1.15-ndb-6.1.4 (limited test release)
-
- Bug #26741 - ndb_restore with only print_data seg faults
- Bug #26739 - ndb_restore segfault on some 64-bit architectures
- Bug #26663 - cluster have issues with api nodeids > 63
-
-mysql-5.1.15-ndb-6.1.3 (25 Feb 2007)
-
- Bug #26515 - Incorrect pointer after FSCLOSECONF in REDO invalidation
- Bug #26514 - Invalid memory access could occur during DD usage
- Bug #26490 - duplicate cluster error code
- Bug #26487 - Bug in extent/page allocation when *using* >1gb datafiles
- Bug #25801 - Internal error if starting partially with missing REDO
- Bug #26481 - Node failure during initial node restart, can lead to subsequent node failures
- Bug #26457 - Incorrect handling of LCP take-over during multi-master-node-failure
- Bug #26454 - LockPagesInMemory=1 is called after distributed communcation has started
- Bug #25239 - Out of memory problem can cause crash in SUMA
- Bug #21033 - Error 0 in readAutoIncrementValue()
- Bug #26293 - cluster mgmt node sometimes doesn't receive events from all nodes on restart
-
- * listEvents ndbapi extension
- * Modified ndb_show_tables to also handle Table Events
- * mysqld option --ndb-wait-connected
- * Possibility to disable arbitration by setting arbitrationrank=0 on all nodes
- * All dump 2352
- * Different READ/SCAN (EX-SH)
- * New dump commands for tracking hanging locks
- * Change level on StartREDOLog to make it default come up in cluster log
- * Make ndbd_redo_log_reader be build default
-
----------------------------------------------------
-
-mysql-5.1.16-ndb-6.2.0 (2007-03-09)
-
- * WAN settings for TCP transporters
- * moved initialization of ndbd fs block first to ensure that it gets enough space for allocation of file system thread stacks
- * added listEvents
- * modified ndb_show_tables to also handle Table Events
- * added mysqld option --ndb-wait-connected
- * Add possibility to disable arbitration by setting arbitrationrank=0 on all nodes
- * Add all dump 2352
- * Add different READ/SCAN (EX-SH)
- * ndb - add new dump commands for tracking hanging locks
- * Change level on StartREDOLog to make it default come up in cluster log
- * Make ndbd_redo_log_reader be build default
- * Integrate mem-manager with TUP removing need for DataMemory2
- * New interface(ndbapi) for iterating over ndb-object connected to a Ndb_cluster_connection
- * New interface(ndbapi) for starting transaction with hints
- * Different handling of AbortOption in ndbapi
-
----------------------------------------------------
-
-mysql-5.1.15-ndb-6.1.2 (7 Feb 2007)
-
- Bug #26267 - using node ids > 48 causes invalid memory access
-
----------------------------------------------------
-
-mysql-5.1.15-ndb-6.1.1 (31 Jan 2007)
-
- Bug #25997 - Valgrind reports leak in event code in mysqld during hadeling of NF and CF
- Bug #25794 - Delete+Read (in same op) crashes datanodes if >5 cols or disk/varchar
- Bug #25286 - NDB data node crashed in DBLQH, Line 2483
-
- (* added extra version info to API to enable support for non-supported online software upgrade)
- * 255 node support
-
- Notes:
-
- - This release is not online upgradable with ndb-6.1.0.
- - All executables needs to be replaced
- - All ndbapi/mgmapi application should be recompiled
-
----------------------------------------------------
-
-mysql-5.1.14-ndb-6.1.0 (20 Dec 2006)
-
- Bug #25059 - Unique index lookup execute(Commit) on non existing tuple can lead to 4012
- Bug #25090 - Incorrect handling of execute(Commit, AO_IgnoreError), can lead to DBCT crash
- Bug #19956 - Problems with VARCHAR primary key and BLOB fields
- Bug #24949 - Pulling cable from _last_ db-node can cause 6min timeout in api
- Bug #25001 - MEDIUMTEXT column not stored on disk
- Bug #24664 - Rare problem in LCP, can lead to unability to restart
- Bug #24917 - Makeing node restart with "newly" dropped disk table can cause failure during restart
- Bug #24914 - Start Transaction with hint guessed incorrectly
- Bug #21948 - Repeated create/drop/truncate(DD) together with restarts can cause SR failure
- Bug #17605 - DD Extents are not available until after LCP
- Bug #22773 - NDB_LE_Connected sent when it should be NDB_LE_Disconnected
- Bug #24166 - SR-crash if DD and hidden key
-
- * add support for periodic mem-reporting, config.ini parameter "MemReportFrequency" which is specified in seconds
-
-
=== modified file 'configure.in'
--- a/configure.in 2010-08-30 08:53:28 +0000
+++ b/configure.in 2010-09-29 11:53:30 +0000
@@ -12,7 +12,7 @@ dnl
dnl When changing the major version number please also check the switch
dnl statement in mysqlbinlog::check_master_version(). You may also need
dnl to update version.c in ndb.
-AC_INIT([MySQL Server], [5.1.47-ndb-7.0.19], [], [mysql])
+AC_INIT([MySQL Server], [5.1.47-ndb-7.0.20], [], [mysql])
AC_CONFIG_SRCDIR([sql/mysqld.cc])
AC_CANONICAL_SYSTEM
=== modified file 'mysql-test/suite/ndb_team/t/ndb_restart.test'
--- a/mysql-test/suite/ndb_team/t/ndb_restart.test 2010-06-11 07:27:59 +0000
+++ b/mysql-test/suite/ndb_team/t/ndb_restart.test 2010-09-29 10:27:39 +0000
@@ -15,7 +15,7 @@ insert into t1 values (1, 2);
#
# Restart node 1
#
---exec $ndb_mgm_cmd -e "1 RESTART"
+--exec $ndb_mgm_cmd -e "1 RESTART -n"
--exec $ndb_waiter_cmd --nowait-nodes=2 --not-started > /dev/null
--exec $ndb_mgm_cmd -e "1 START"
--exec $ndb_waiter_cmd > /dev/null
@@ -27,7 +27,7 @@ insert into t1 values (2, 3);
#
# Restart node 1 --initial
#
---exec $ndb_mgm_cmd -e "1 RESTART -I"
+--exec $ndb_mgm_cmd -e "1 RESTART -n -I"
--exec $ndb_waiter_cmd --nowait-nodes=2 --not-started > /dev/null
--exec $ndb_mgm_cmd -e "1 START"
--exec $ndb_waiter_cmd > /dev/null
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2010-09-15 18:38:13 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2010-09-29 11:01:55 +0000
@@ -6541,7 +6541,24 @@ restart_cluster_failure:
DBUG_PRINT("info", ("COMMIT gci: %lu", (ulong) gci));
if (opt_ndb_log_binlog_index)
{
- ndb_add_ndb_binlog_index(thd, rows);
+ if (ndb_add_ndb_binlog_index(thd, rows))
+ {
+ /*
+ Writing to ndb_binlog_index failed, check if we are
+ being killed and retry
+ */
+ if (thd->killed)
+ {
+ (void) pthread_mutex_lock(&LOCK_thread_count);
+ volatile THD::killed_state killed= thd->killed;
+ /* We are cleaning up, allow for flushing last epoch */
+ thd->killed= THD::NOT_KILLED;
+ ndb_add_ndb_binlog_index(thd, rows);
+ /* Restore kill flag */
+ thd->killed= killed;
+ (void) pthread_mutex_unlock(&LOCK_thread_count);
+ }
+ }
}
ndb_latest_applied_binlog_epoch= gci;
break;
=== modified file 'storage/ndb/include/mgmapi/mgmapi.h'
--- a/storage/ndb/include/mgmapi/mgmapi.h 2010-09-22 14:19:12 +0000
+++ b/storage/ndb/include/mgmapi/mgmapi.h 2010-09-29 08:45:11 +0000
@@ -771,6 +771,29 @@ extern "C" {
int ndb_mgm_stop3(NdbMgmHandle handle, int no_of_nodes,
const int * node_list, int abort, int *disconnect);
+ /**
+ * Stops cluster nodes
+ *
+ * @param handle Management handle.
+ * @param no_of_nodes Number of database nodes to stop<br>
+ * -1: All database and management nodes<br>
+ * 0: All database nodes in cluster<br>
+ * n: Stop the <var>n</var> node(s) specified in
+ * the array node_list
+ * @param node_list List of node IDs of database nodes to be stopped
+ * @param abort Don't perform graceful stop,
+ * but rather stop immediately
+ * @param force Force stop of nodes even if it means the
+ * whole cluster will be shutdown
+ * @param disconnect Returns true if you need to disconnect to apply
+ * the stop command (e.g. stopping the mgm server
+ * that handle is connected to)
+ *
+ * @return Number of nodes stopped (-1 on error).
+ */
+ int ndb_mgm_stop4(NdbMgmHandle handle, int no_of_nodes,
+ const int * node_list, int abort, int force,
+ int *disconnect);
/**
* Restart database nodes
@@ -837,6 +860,33 @@ extern "C" {
int nostart, int abort, int *disconnect);
/**
+ * Restart nodes
+ *
+ * @param handle Management handle.
+ * @param no_of_nodes Number of database nodes to be restarted:<br>
+ * 0: Restart all database nodes in the cluster<br>
+ * n: Restart the <var>n</var> node(s) specified
+ * in the array node_list
+ * @param node_list List of node IDs of database nodes to be restarted
+ * @param initial Remove filesystem from restarting node(s)
+ * @param nostart Don't actually start node(s) but leave them
+ * waiting for start command
+ * @param abort Don't perform graceful restart,
+ * but rather restart immediately
+ * @param force Force restart of nodes even if it means the
+ * whole cluster will be restarted
+ * @param disconnect Returns true if mgmapi client must disconnect from
+ * server to apply the requested operation. (e.g.
+ * restart the management server)
+ *
+ *
+ * @return Number of nodes stopped (-1 on error).
+ */
+ int ndb_mgm_restart4(NdbMgmHandle handle, int no_of_nodes,
+ const int * node_list, int initial,
+ int nostart, int abort, int force, int *disconnect);
+
+ /**
* Start database nodes
*
* @param handle Management handle.
=== modified file 'storage/ndb/include/ndb_version.h.in'
--- a/storage/ndb/include/ndb_version.h.in 2010-08-26 12:33:33 +0000
+++ b/storage/ndb/include/ndb_version.h.in 2010-09-29 08:45:11 +0000
@@ -119,8 +119,6 @@ Uint32 ndbGetOwnVersion();
#define NDBD_MT_LQH_VERSION MAKE_VERSION(6,4,0)
#define NDBD_SCHEMA_TRANS_VERSION NDB_MAKE_VERSION(6,4,0)
-#define MGMD_MGMAPI_PROTOCOL_CHANGE NDB_MAKE_VERSION(6,4,0)
-
static
inline
=== modified file 'storage/ndb/include/ndbapi/Ndb.hpp'
--- a/storage/ndb/include/ndbapi/Ndb.hpp 2010-02-11 10:59:05 +0000
+++ b/storage/ndb/include/ndbapi/Ndb.hpp 2010-09-29 13:25:19 +0000
@@ -1837,7 +1837,8 @@ private:
// Handle a received signal. Used by both
// synchronous and asynchronous interface
- void handleReceivedSignal(NdbApiSignal* anApiSignal, struct LinearSectionPtr ptr[3]);
+ void handleReceivedSignal(const NdbApiSignal* anApiSignal,
+ const struct LinearSectionPtr ptr[3]);
int sendRecSignal(Uint16 aNodeId,
Uint32 aWaitState,
@@ -1999,8 +2000,8 @@ private:
int creleaseSignals;
#endif
- static void executeMessage(void*, NdbApiSignal *,
- struct LinearSectionPtr ptr[3]);
+ static void executeMessage(void*, const NdbApiSignal *,
+ const struct LinearSectionPtr ptr[3]);
static void statusMessage(void*, Uint32, bool, bool);
#ifdef VM_TRACE
#include <my_attribute.h>
=== modified file 'storage/ndb/include/ndbapi/NdbIndexOperation.hpp'
--- a/storage/ndb/include/ndbapi/NdbIndexOperation.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/include/ndbapi/NdbIndexOperation.hpp 2010-09-29 13:25:19 +0000
@@ -177,7 +177,7 @@ private:
NdbIndexOperation(Ndb* aNdb);
~NdbIndexOperation();
- int receiveTCINDXREF(NdbApiSignal* aSignal);
+ int receiveTCINDXREF(const NdbApiSignal* aSignal);
// Overloaded methods from NdbCursorOperation
int indxInit(const class NdbIndexImpl* anIndex,
=== modified file 'storage/ndb/include/ndbapi/NdbOperation.hpp'
--- a/storage/ndb/include/ndbapi/NdbOperation.hpp 2010-06-08 14:37:15 +0000
+++ b/storage/ndb/include/ndbapi/NdbOperation.hpp 2010-09-29 13:25:19 +0000
@@ -1272,11 +1272,11 @@ protected:
int insertATTRINFOData_NdbRecord(const char *value,
Uint32 size);
- int receiveTCKEYREF(NdbApiSignal*);
+ int receiveTCKEYREF(const NdbApiSignal*);
int checkMagicNumber(bool b = true); // Verify correct object
- int checkState_TransId(NdbApiSignal* aSignal);
+ int checkState_TransId(const NdbApiSignal* aSignal);
/******************************************************************************
* These are support methods only used locally in this class.
=== modified file 'storage/ndb/include/ndbapi/NdbTransaction.hpp'
--- a/storage/ndb/include/ndbapi/NdbTransaction.hpp 2010-01-28 15:16:46 +0000
+++ b/storage/ndb/include/ndbapi/NdbTransaction.hpp 2010-09-29 13:25:19 +0000
@@ -942,23 +942,23 @@ private:
Uint32 get_send_size(); // Get size to send
void set_send_size(Uint32); // Set size to send;
- int receiveDIHNDBTAMPER(NdbApiSignal* anApiSignal);
- int receiveTCSEIZECONF(NdbApiSignal* anApiSignal);
- int receiveTCSEIZEREF(NdbApiSignal* anApiSignal);
- int receiveTCRELEASECONF(NdbApiSignal* anApiSignal);
- int receiveTCRELEASEREF(NdbApiSignal* anApiSignal);
+ int receiveDIHNDBTAMPER(const NdbApiSignal* anApiSignal);
+ int receiveTCSEIZECONF(const NdbApiSignal* anApiSignal);
+ int receiveTCSEIZEREF(const NdbApiSignal* anApiSignal);
+ int receiveTCRELEASECONF(const NdbApiSignal* anApiSignal);
+ int receiveTCRELEASEREF(const NdbApiSignal* anApiSignal);
int receiveTC_COMMITCONF(const class TcCommitConf *, Uint32 len);
int receiveTCKEYCONF(const class TcKeyConf *, Uint32 aDataLength);
int receiveTCKEY_FAILCONF(const class TcKeyFailConf *);
- int receiveTCKEY_FAILREF(NdbApiSignal* anApiSignal);
- int receiveTC_COMMITREF(NdbApiSignal* anApiSignal);
- int receiveTCROLLBACKCONF(NdbApiSignal* anApiSignal); // Rec TCPREPARECONF ?
- int receiveTCROLLBACKREF(NdbApiSignal* anApiSignal); // Rec TCPREPAREREF ?
- int receiveTCROLLBACKREP(NdbApiSignal* anApiSignal);
+ int receiveTCKEY_FAILREF(const NdbApiSignal* anApiSignal);
+ int receiveTC_COMMITREF(const NdbApiSignal* anApiSignal);
+ int receiveTCROLLBACKCONF(const NdbApiSignal* anApiSignal);
+ int receiveTCROLLBACKREF(const NdbApiSignal* anApiSignal);
+ int receiveTCROLLBACKREP(const NdbApiSignal* anApiSignal);
int receiveTCINDXCONF(const class TcIndxConf *, Uint32 aDataLength);
- int receiveTCINDXREF(NdbApiSignal*);
- int receiveSCAN_TABREF(NdbApiSignal*);
- int receiveSCAN_TABCONF(NdbApiSignal*, const Uint32*, Uint32 len);
+ int receiveTCINDXREF(const NdbApiSignal*);
+ int receiveSCAN_TABREF(const NdbApiSignal*);
+ int receiveSCAN_TABCONF(const NdbApiSignal*, const Uint32*, Uint32 len);
int doSend(); // Send all operations
int sendROLLBACK(); // Send of an ROLLBACK
=== modified file 'storage/ndb/ndb_configure.m4'
--- a/storage/ndb/ndb_configure.m4 2010-08-30 09:51:49 +0000
+++ b/storage/ndb/ndb_configure.m4 2010-09-29 11:51:14 +0000
@@ -2,7 +2,7 @@
# Should be updated when creating a new NDB version
NDB_VERSION_MAJOR=7
NDB_VERSION_MINOR=0
-NDB_VERSION_BUILD=19
+NDB_VERSION_BUILD=20
NDB_VERSION_STATUS=""
dnl for build ndb docs
=== modified file 'storage/ndb/src/common/portlib/NdbDir.cpp'
--- a/storage/ndb/src/common/portlib/NdbDir.cpp 2010-09-23 09:10:53 +0000
+++ b/storage/ndb/src/common/portlib/NdbDir.cpp 2010-09-29 07:54:14 +0000
@@ -209,7 +209,7 @@ NdbDir::create(const char *dir, mode_t m
return true;
fprintf(stderr,
- "Failed to create directory '%s', error: %d",
+ "Failed to create directory '%s', error: %d\n",
dir, GetLastError());
return false;
}
@@ -220,7 +220,7 @@ NdbDir::create(const char *dir, mode_t m
return true;
fprintf(stderr,
- "Failed to create directory '%s', error: %d",
+ "Failed to create directory '%s', error: %d\n",
dir, errno);
return false;
}
=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2010-09-23 07:31:28 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2010-09-27 08:52:07 +0000
@@ -17897,8 +17897,18 @@ void Dblqh::readFileInInvalidate(Signal*
logPartPtr.p->logPartNo, logFilePtr.p->fileNo, stepNext);
}
+ if (stepNext == 0)
+ {
+ jam();
+ // Contact NDBFS. Real time break.
+ readSinglePage(signal, logPartPtr.p->invalidatePageNo);
+ lfoPtr.p->lfoState = LogFileOperationRecord::READ_SR_INVALIDATE_PAGES;
+ return;
+ }
+
if (stepNext == 1)
{
+ jam();
logPartPtr.p->invalidatePageNo++;
if (logPartPtr.p->invalidatePageNo == (clogFileSize * ZPAGES_IN_MBYTE))
{
=== modified file 'storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2010-09-30 13:15:22 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2010-10-01 08:53:44 +0000
@@ -1741,7 +1741,7 @@ public:
* index node. TUX reads and writes the node directly via pointer.
*/
int tuxAllocNode(EmulatedJamBuffer*, Uint32 fragPtrI, Uint32& pageId, Uint32& pageOffset, Uint32*& node);
- void tuxFreeNode(Signal* signal, Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32* node);
+ void tuxFreeNode(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32* node);
void tuxGetNode(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32*& node);
/*
=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp 2010-09-03 05:35:51 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp 2010-09-24 18:19:07 +0000
@@ -75,10 +75,8 @@ Dbtup::tuxAllocNode(EmulatedJamBuffer *
return 0;
}
-#if 0
void
-Dbtup::tuxFreeNode(Signal* signal,
- Uint32 fragPtrI,
+Dbtup::tuxFreeNode(Uint32 fragPtrI,
Uint32 pageId,
Uint32 pageOffset,
Uint32* node)
@@ -90,15 +88,19 @@ Dbtup::tuxFreeNode(Signal* signal,
TablerecPtr tablePtr;
tablePtr.i= fragPtr.p->fragTableId;
ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec);
+
+ Local_key key;
+ key.m_page_no = pageId;
+ key.m_page_idx = pageOffset;
PagePtr pagePtr;
- pagePtr.i= pageId;
- ptrCheckGuard(pagePtr, cnoOfPage, cpage);
+ Tuple_header* ptr = (Tuple_header*)get_ptr(&pagePtr, &key, tablePtr.p);
+
Uint32 attrDescIndex= tablePtr.p->tabDescriptor + (0 << ZAD_LOG_SIZE);
Uint32 attrDataOffset= AttributeOffset::getOffset(tableDescriptor[attrDescIndex + 1].tabDescr);
- ndbrequire(node == &pagePtr.p->pageWord[pageOffset] + attrDataOffset);
- freeTh(fragPtr.p, tablePtr.p, signal, pagePtr.p, pageOffset);
+ ndbrequire(node == (Uint32*)ptr + attrDataOffset);
+
+ free_fix_rec(fragPtr.p, tablePtr.p, &key, (Fix_page*)pagePtr.p);
}
-#endif
void
Dbtup::tuxGetNode(Uint32 fragPtrI,
=== modified file 'storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp 2010-08-20 11:10:25 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp 2010-09-24 18:19:07 +0000
@@ -492,7 +492,7 @@ private:
Uint16 m_numAttrs;
bool m_storeNullKey;
TreeHead m_tree;
- TupLoc m_freeLoc; // list of free index nodes
+ TupLoc m_freeLoc; // one free node for next op
DLList<ScanOp> m_scanList; // current scans on this fragment
Uint32 m_tupIndexFragPtrI;
Uint32 m_tupTableFragPtrI;
@@ -604,9 +604,11 @@ private:
* DbtuxNode.cpp
*/
int allocNode(TuxCtx&, NodeHandle& node);
+ void freeNode(NodeHandle& node);
void selectNode(NodeHandle& node, TupLoc loc);
void insertNode(NodeHandle& node);
void deleteNode(NodeHandle& node);
+ void freePreallocatedNode(Frag& frag);
void setNodePref(struct TuxCtx &, NodeHandle& node);
// node operations
void nodePushUp(TuxCtx&, NodeHandle& node, unsigned pos, const TreeEnt& ent, Uint32 scanList);
=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxBuild.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxBuild.cpp 2010-01-12 08:25:40 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxBuild.cpp 2010-09-24 18:19:07 +0000
@@ -141,8 +141,6 @@ Dbtux::mt_buildIndexFragment(mt_BuildInd
{
break;
}
- // link to freelist
- node.setLink(0, frag.m_freeLoc);
frag.m_freeLoc = node.m_loc;
ndbrequire(frag.m_freeLoc != NullTupLoc);
}
=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp 2009-12-14 10:58:03 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp 2010-09-24 11:06:19 +0000
@@ -146,8 +146,6 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
jam();
break;
}
- // link to freelist
- node.setLink(0, frag.m_freeLoc);
frag.m_freeLoc = node.m_loc;
ndbrequire(frag.m_freeLoc != NullTupLoc);
}
=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp 2009-12-14 22:14:34 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp 2010-09-24 18:19:07 +0000
@@ -54,6 +54,24 @@ Dbtux::allocNode(TuxCtx& ctx, NodeHandle
}
/*
+ * Free index node in TUP
+ */
+void
+Dbtux::freeNode(NodeHandle& node)
+{
+ Frag& frag = node.m_frag;
+ Uint32 pageId = node.m_loc.getPageId();
+ Uint32 pageOffset = node.m_loc.getPageOffset();
+ Uint32* node32 = reinterpret_cast<Uint32*>(node.m_node);
+ c_tup->tuxFreeNode(frag.m_tupIndexFragPtrI,
+ pageId, pageOffset, node32);
+ jamEntry();
+ // invalidate the handle
+ node.m_loc = NullTupLoc;
+ node.m_node = 0;
+}
+
+/*
* Set handle to point to existing node.
*/
void
@@ -77,9 +95,9 @@ void
Dbtux::insertNode(NodeHandle& node)
{
Frag& frag = node.m_frag;
- // unlink from freelist
+ // use up pre-allocated node
selectNode(node, frag.m_freeLoc);
- frag.m_freeLoc = node.getLink(0);
+ frag.m_freeLoc = NullTupLoc;
new (node.m_node) TreeNode();
#ifdef VM_TRACE
TreeHead& tree = frag.m_tree;
@@ -90,19 +108,44 @@ Dbtux::insertNode(NodeHandle& node)
}
/*
- * Delete existing node. Simply put it on the freelist.
+ * Delete existing node. Make it the pre-allocated free node if there
+ * is none. Otherwise return it to fragment's free list.
*/
void
Dbtux::deleteNode(NodeHandle& node)
{
Frag& frag = node.m_frag;
ndbrequire(node.getOccup() == 0);
- // link to freelist
- node.setLink(0, frag.m_freeLoc);
- frag.m_freeLoc = node.m_loc;
- // invalidate the handle
- node.m_loc = NullTupLoc;
- node.m_node = 0;
+ if (frag.m_freeLoc == NullTupLoc)
+ {
+ jam();
+ frag.m_freeLoc = node.m_loc;
+ // invalidate the handle
+ node.m_loc = NullTupLoc;
+ node.m_node = 0;
+ }
+ else
+ {
+ jam();
+ freeNode(node);
+ }
+}
+
+/*
+ * Free the pre-allocated node, called when tree is empty. This avoids
+ * leaving any used pages in DataMemory.
+ */
+void
+Dbtux::freePreallocatedNode(Frag& frag)
+{
+ if (frag.m_freeLoc != NullTupLoc)
+ {
+ jam();
+ NodeHandle node(frag);
+ selectNode(node, frag.m_freeLoc);
+ freeNode(node);
+ frag.m_freeLoc = NullTupLoc;
+ }
}
/*
=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp 2009-12-14 22:14:34 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp 2010-09-24 18:19:07 +0000
@@ -328,6 +328,8 @@ Dbtux::treeRemoveNode(Frag& frag, NodeHa
}
// tree is now empty
tree.m_root = NullTupLoc;
+ // free even the pre-allocated node
+ freePreallocatedNode(frag);
}
/*
=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp 2010-09-23 09:36:19 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp 2010-09-29 07:54:14 +0000
@@ -137,7 +137,8 @@ bool
do_mkdir(const char * path)
{
return NdbDir::create(path,
- NdbDir::u_rwx() | NdbDir::g_r() | NdbDir::g_x());
+ NdbDir::u_rwx() | NdbDir::g_r() | NdbDir::g_x(),
+ true /* ignore_existing */);
}
static
=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/PosixAsyncFile.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/PosixAsyncFile.cpp 2010-08-17 09:54:53 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/PosixAsyncFile.cpp 2010-09-24 15:10:46 +0000
@@ -42,6 +42,8 @@
#include <sys/uio.h>
#include <dirent.h>
+#include <sys/stat.h>
+
PosixAsyncFile::PosixAsyncFile(SimulatedBlock& fs) :
AsyncFile(fs),
theFd(-1),
=== modified file 'storage/ndb/src/kernel/blocks/suma/Suma.cpp'
--- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp 2010-09-06 08:20:33 +0000
+++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp 2010-09-29 07:39:42 +0000
@@ -1251,10 +1251,10 @@ Suma::execNODE_FAILREP(Signal* signal){
progError(__LINE__, NDBD_EXIT_SYSTEM_ERROR,
"Nodefailure during SUMA takeover");
}
- else if (state & Bucket::BUCKET_SHUTDOWN)
+ else if (state & Bucket::BUCKET_SHUTDOWN_TO)
{
jam();
- c_buckets[i].m_state &= ~Uint32(Bucket::BUCKET_SHUTDOWN);
+ c_buckets[i].m_state &= ~Uint32(Bucket::BUCKET_SHUTDOWN_TO);
m_switchover_buckets.clear(i);
ndbrequire(get_responsible_node(i, tmp) == getOwnNodeId());
start_resend(signal, i);
@@ -3964,7 +3964,11 @@ Suma::get_responsible_node(Uint32 bucket
bool
Suma::check_switchover(Uint32 bucket, Uint64 gci)
{
- const Uint32 send_mask = (Bucket::BUCKET_STARTING | Bucket::BUCKET_TAKEOVER);
+ const Uint32 send_mask =
+ Bucket::BUCKET_STARTING |
+ Bucket::BUCKET_TAKEOVER |
+ Bucket::BUCKET_SHUTDOWN_TO;
+
bool send = c_buckets[bucket].m_state & send_mask;
ndbassert(m_switchover_buckets.get(bucket));
if(unlikely(gci > c_buckets[bucket].m_switchover_gci))
@@ -4453,27 +4457,27 @@ found:
}
else if (state & Bucket::BUCKET_SHUTDOWN)
{
+ jam();
Uint32 nodeId = c_buckets[i].m_switchover_node;
- if (nodeId == getOwnNodeId())
- {
- jam();
- m_active_buckets.clear(i);
- m_gcp_complete_rep_count--;
- ndbout_c("shutdown handover");
- }
- else
- {
- jam();
- NdbNodeBitmask nodegroup = c_nodes_in_nodegroup_mask;
- nodegroup.clear(nodeId);
- ndbrequire(get_responsible_node(i) == nodeId &&
- get_responsible_node(i, nodegroup) == getOwnNodeId());
- m_active_buckets.set(i);
- m_gcp_complete_rep_count++;
- ndbout_c("shutdown takover");
- }
+ ndbrequire(nodeId == getOwnNodeId());
+ m_active_buckets.clear(i);
+ m_gcp_complete_rep_count--;
+ ndbout_c("shutdown handover");
c_buckets[i].m_state &= ~(Uint32)Bucket::BUCKET_SHUTDOWN;
}
+ else if (state & Bucket::BUCKET_SHUTDOWN_TO)
+ {
+ jam();
+ Uint32 nodeId = c_buckets[i].m_switchover_node;
+ NdbNodeBitmask nodegroup = c_nodes_in_nodegroup_mask;
+ nodegroup.clear(nodeId);
+ ndbrequire(get_responsible_node(i) == nodeId &&
+ get_responsible_node(i, nodegroup) == getOwnNodeId());
+ m_active_buckets.set(i);
+ m_gcp_complete_rep_count++;
+ ndbout_c("shutdown takover");
+ c_buckets[i].m_state &= ~(Uint32)Bucket::BUCKET_SHUTDOWN_TO;
+ }
}
}
@@ -5482,7 +5486,7 @@ Suma::execSUMA_HANDOVER_REQ(Signal* sign
tmp.set(i);
m_switchover_buckets.set(i);
c_buckets[i].m_switchover_gci = (Uint64(start_gci) << 32) - 1;
- c_buckets[i].m_state |= Bucket::BUCKET_SHUTDOWN;
+ c_buckets[i].m_state |= Bucket::BUCKET_SHUTDOWN_TO;
c_buckets[i].m_switchover_node = nodeId;
ndbout_c("prepare to takeover bucket: %d", i);
}
=== modified file 'storage/ndb/src/kernel/blocks/suma/Suma.hpp'
--- a/storage/ndb/src/kernel/blocks/suma/Suma.hpp 2010-08-26 12:33:33 +0000
+++ b/storage/ndb/src/kernel/blocks/suma/Suma.hpp 2010-09-29 07:39:42 +0000
@@ -589,6 +589,7 @@ private:
,BUCKET_DROPPED_OTHER = 0x80 // New nodegroup (not me)
,BUCKET_DROPPED_MASK = (BUCKET_DROPPED_SELF | BUCKET_DROPPED_OTHER)
,BUCKET_SHUTDOWN = 0x100 // Graceful shutdown
+ ,BUCKET_SHUTDOWN_TO = 0x200 // Graceful shutdown
};
Uint16 m_state;
Uint16 m_switchover_node;
=== modified file 'storage/ndb/src/mgmapi/mgmapi.cpp'
--- a/storage/ndb/src/mgmapi/mgmapi.cpp 2010-09-22 10:07:28 +0000
+++ b/storage/ndb/src/mgmapi/mgmapi.cpp 2010-09-29 08:45:11 +0000
@@ -107,11 +107,78 @@ struct ndb_mgm_handle {
int mgmd_version_major;
int mgmd_version_minor;
int mgmd_version_build;
+
+ int mgmd_version(void) const {
+ // Must be connected
+ assert(connected);
+ // Check that version has been read
+ assert(mgmd_version_major >= 0 &&
+ mgmd_version_minor >= 0 &&
+ mgmd_version_build >= 0);
+ return NDB_MAKE_VERSION(mgmd_version_major,
+ mgmd_version_minor,
+ mgmd_version_build);
+ }
+
char * m_bindaddress;
int m_bindaddress_port;
bool ignore_sigpipe;
};
+
+/*
+ Check if version "curr" is greater than or equal to
+ a list of given versions
+
+ NOTE! The list of versions to check against must be listed
+ with the highest version first and terminated with version 0
+*/
+static inline
+bool check_version_ge(Uint32 curr, ...)
+{
+ Uint32 version, last = ~0;
+
+ va_list versions;
+ va_start(versions, curr);
+ while ((version= va_arg(versions, Uint32)))
+ {
+ if (curr >= version)
+ {
+ va_end(versions);
+ return true;
+ }
+ assert(version < last); // check that version list is descending
+ last = version;
+ }
+
+ va_end(versions);
+ return false;
+}
+
+static inline void
+test_check_version_ge(void)
+{
+ assert(check_version_ge(NDB_MAKE_VERSION(7,0,19),
+ NDB_MAKE_VERSION(7,0,20),
+ 0) == false);
+ assert(check_version_ge(NDB_MAKE_VERSION(7,0,19),
+ NDB_MAKE_VERSION(7,1,6),
+ NDB_MAKE_VERSION(7,0,20),
+ 0) == false);
+ assert(check_version_ge(NDB_MAKE_VERSION(7,0,19),
+ NDB_MAKE_VERSION(7,1,6),
+ NDB_MAKE_VERSION(7,0,18),
+ 0));
+ assert(check_version_ge(NDB_MAKE_VERSION(7,1,8),
+ NDB_MAKE_VERSION(7,1,6),
+ NDB_MAKE_VERSION(7,0,18),
+ 0));
+ assert(check_version_ge(NDB_MAKE_VERSION(5,5,6),
+ NDB_MAKE_VERSION(7,1,6),
+ NDB_MAKE_VERSION(7,0,18),
+ 0) == false);
+}
+
#define SET_ERROR(h, e, s) setError((h), (e), __LINE__, (s))
static
@@ -535,6 +602,26 @@ int ndb_mgm_number_of_mgmd_in_connect_st
return count;
}
+
+static inline
+bool get_mgmd_version(NdbMgmHandle handle)
+{
+ assert(handle->connected);
+
+ if (handle->mgmd_version_major >= 0)
+ return true; // Already fetched version of mgmd
+
+ char buf[2]; // Not used -> keep short
+ if (!ndb_mgm_get_version(handle,
+ &(handle->mgmd_version_major),
+ &(handle->mgmd_version_minor),
+ &(handle->mgmd_version_build),
+ sizeof(buf), buf))
+ return false;
+ return true;
+}
+
+
/**
* Connect to a management server
*/
@@ -683,6 +770,11 @@ ndb_mgm_connect(NdbMgmHandle handle, int
handle->socket = sockfd;
handle->connected = 1;
+ // Version of the connected ndb_mgmd is not yet known
+ handle->mgmd_version_major= -1;
+ handle->mgmd_version_minor= -1;
+ handle->mgmd_version_build= -1;
+
DBUG_RETURN(0);
}
@@ -1135,7 +1227,6 @@ extern "C"
int
ndb_mgm_stop(NdbMgmHandle handle, int no_of_nodes, const int * node_list)
{
- SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_stop");
return ndb_mgm_stop2(handle, no_of_nodes, node_list, 0);
}
@@ -1148,36 +1239,23 @@ ndb_mgm_stop2(NdbMgmHandle handle, int n
return ndb_mgm_stop3(handle, no_of_nodes, node_list, abort, &disconnect);
}
-
extern "C"
int
-ndb_mgm_obtain_mgmd_version(NdbMgmHandle handle)
+ndb_mgm_stop3(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
+ int abort, int *disconnect)
{
- if (handle->mgmd_version_build == -1)
- {
- char verStr[64]; /* Long enough? */
-
- if (!ndb_mgm_get_version(handle,
- &(handle->mgmd_version_major),
- &(handle->mgmd_version_minor),
- &(handle->mgmd_version_build),
- sizeof(verStr),
- verStr))
- {
- return -1;
- }
- }
- return 0;
+ return ndb_mgm_stop4(handle, no_of_nodes, node_list, abort,
+ false, disconnect);
}
extern "C"
int
-ndb_mgm_stop3(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
- int abort, int *disconnect)
+ndb_mgm_stop4(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
+ int abort, int force, int *disconnect)
{
- DBUG_ENTER("ndb_mgm_stop3");
+ DBUG_ENTER("ndb_mgm_stop4");
CHECK_HANDLE(handle, -1);
- SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_stop3");
+ SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_stop4");
const ParserRow<ParserDummy> stop_reply_v1[] = {
MGM_CMD("stop reply", NULL, ""),
MGM_ARG("stopped", Int, Optional, "No of stopped nodes"),
@@ -1194,10 +1272,8 @@ ndb_mgm_stop3(NdbMgmHandle handle, int n
CHECK_CONNECTED(handle, -1);
- if(ndb_mgm_obtain_mgmd_version(handle) == -1)
- {
+ if (!get_mgmd_version(handle))
DBUG_RETURN(-1);
- }
int use_v2= ((handle->mgmd_version_major==5)
&& (
@@ -1223,6 +1299,7 @@ ndb_mgm_stop3(NdbMgmHandle handle, int n
args.put("abort", abort);
if(use_v2)
args.put("stop", (no_of_nodes==-1)?"mgm,db":"db");
+ // force has no effect, continue anyway for consistency
const Properties *reply;
if(use_v2)
reply = ndb_mgm_call(handle, stop_reply_v2, "stop all", &args);
@@ -1263,6 +1340,14 @@ ndb_mgm_stop3(NdbMgmHandle handle, int n
args.put("node", node_list_str.c_str());
args.put("abort", abort);
+ if (check_version_ge(handle->mgmd_version(),
+ NDB_MAKE_VERSION(7,1,8),
+ NDB_MAKE_VERSION(7,0,19),
+ 0))
+ args.put("force", force);
+ else
+ SET_ERROR(handle, NDB_MGM_STOP_FAILED,
+ "The connected mgm server does not support 'stop --force'");
const Properties *reply;
if(use_v2)
@@ -1296,7 +1381,6 @@ extern "C"
int
ndb_mgm_restart(NdbMgmHandle handle, int no_of_nodes, const int *node_list)
{
- SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_restart");
return ndb_mgm_restart2(handle, no_of_nodes, node_list, 0, 0, 0);
}
@@ -1316,9 +1400,19 @@ int
ndb_mgm_restart3(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
int initial, int nostart, int abort, int *disconnect)
{
- DBUG_ENTER("ndb_mgm_restart3");
+ return ndb_mgm_restart4(handle, no_of_nodes, node_list, initial,
+ nostart, abort, false, disconnect);
+}
+
+extern "C"
+int
+ndb_mgm_restart4(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
+ int initial, int nostart, int abort, int force,
+ int *disconnect)
+{
+ DBUG_ENTER("ndb_mgm_restart");
CHECK_HANDLE(handle, -1);
- SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_restart3");
+ SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_restart4");
Uint32 restarted = 0;
const ParserRow<ParserDummy> restart_reply_v1[] = {
MGM_CMD("restart reply", NULL, ""),
@@ -1336,19 +1430,9 @@ ndb_mgm_restart3(NdbMgmHandle handle, in
CHECK_CONNECTED(handle, -1);
- if(handle->mgmd_version_build==-1)
- {
- char verstr[50];
- if(!ndb_mgm_get_version(handle,
- &(handle->mgmd_version_major),
- &(handle->mgmd_version_minor),
- &(handle->mgmd_version_build),
- sizeof(verstr),
- verstr))
- {
- DBUG_RETURN(-1);
- }
- }
+ if (!get_mgmd_version(handle))
+ DBUG_RETURN(-1);
+
int use_v2= ((handle->mgmd_version_major==5)
&& (
(handle->mgmd_version_minor==0 && handle->mgmd_version_build>=21)
@@ -1369,6 +1453,7 @@ ndb_mgm_restart3(NdbMgmHandle handle, in
args.put("abort", abort);
args.put("initialstart", initial);
args.put("nostart", nostart);
+ // force has no effect, continue anyway for consistency
const Properties *reply;
const int timeout = handle->timeout;
handle->timeout= 5*60*1000; // 5 minutes
@@ -1405,6 +1490,15 @@ ndb_mgm_restart3(NdbMgmHandle handle, in
args.put("initialstart", initial);
args.put("nostart", nostart);
+ if (check_version_ge(handle->mgmd_version(),
+ NDB_MAKE_VERSION(7,1,8),
+ NDB_MAKE_VERSION(7,0,19),
+ 0))
+ args.put("force", force);
+ else
+ SET_ERROR(handle, NDB_MGM_RESTART_FAILED,
+ "The connected mgm server does not support 'restart --force'");
+
const Properties *reply;
const int timeout = handle->timeout;
handle->timeout= 5*60*1000; // 5 minutes
@@ -2229,19 +2323,6 @@ ndb_mgm_start_backup3(NdbMgmHandle handl
unsigned int backuppoint)
{
DBUG_ENTER("ndb_mgm_start_backup");
- /* Before we start the backup, first get the version of the
- * management node we are connected to
- */
- if (ndb_mgm_obtain_mgmd_version(handle) == -1)
- {
- DBUG_RETURN(-1);
- }
-
- Uint32 mgmdVersion = NDB_MAKE_VERSION(handle->mgmd_version_major,
- handle->mgmd_version_minor,
- handle->mgmd_version_build);
-
- bool sendBackupPoint = (mgmdVersion >= MGMD_MGMAPI_PROTOCOL_CHANGE);
CHECK_HANDLE(handle, -1);
SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_start_backup");
@@ -2253,6 +2334,11 @@ ndb_mgm_start_backup3(NdbMgmHandle handl
};
CHECK_CONNECTED(handle, -1);
+ if (!get_mgmd_version(handle))
+ DBUG_RETURN(-1);
+
+ bool sendBackupPoint = (handle->mgmd_version() >= NDB_MAKE_VERSION(6,4,0));
+
Properties args;
args.put("completed", wait_completed);
if(input_backupId > 0)
@@ -2344,24 +2430,17 @@ ndb_mgm_get_configuration2(NdbMgmHandle
enum ndb_mgm_node_type nodetype)
{
DBUG_ENTER("ndb_mgm_get_configuration2");
- /* Before we get the config, first get the version of the
- * managment node we are connected to
- */
- if (ndb_mgm_obtain_mgmd_version(handle) == -1)
- {
- DBUG_RETURN(NULL);
- }
-
- Uint32 mgmdVersion = NDB_MAKE_VERSION(handle->mgmd_version_major,
- handle->mgmd_version_minor,
- handle->mgmd_version_build);
-
- bool getConfigUsingNodetype = (mgmdVersion >= MGMD_MGMAPI_PROTOCOL_CHANGE);
CHECK_HANDLE(handle, 0);
SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_get_configuration");
CHECK_CONNECTED(handle, 0);
+ if (!get_mgmd_version(handle))
+ DBUG_RETURN(NULL);
+
+ bool getConfigUsingNodetype =
+ (handle->mgmd_version() >= NDB_MAKE_VERSION(6,4,0));
+
Properties args;
args.put("version", version);
if (getConfigUsingNodetype)
@@ -3041,24 +3120,28 @@ int ndb_mgm_get_version(NdbMgmHandle han
Uint32 id;
if(!prop->get("id",&id)){
- fprintf(handle->errstream, "Unable to get value\n");
+ SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY,
+ "Unable to get version id");
DBUG_RETURN(0);
}
*build= getBuild(id);
if(!prop->get("major",(Uint32*)major)){
- fprintf(handle->errstream, "Unable to get value\n");
+ SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY,
+ "Unable to get version major");
DBUG_RETURN(0);
}
if(!prop->get("minor",(Uint32*)minor)){
- fprintf(handle->errstream, "Unable to get value\n");
+ SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY,
+ "Unable to get version minor");
DBUG_RETURN(0);
}
BaseString result;
if(!prop->get("string", result)){
- fprintf(handle->errstream, "Unable to get value\n");
+ SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY,
+ "Unable to get version string");
DBUG_RETURN(0);
}
=== modified file 'storage/ndb/src/mgmclient/CommandInterpreter.cpp'
--- a/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2010-08-17 11:56:12 +0000
+++ b/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2010-09-29 08:45:11 +0000
@@ -25,16 +25,10 @@
#include <util/Vector.hpp>
#include <kernel/BlockNumbers.h>
-class MgmtSrvr;
-
/**
* @class CommandInterpreter
* @brief Reads command line in management client
*
- * This class has one public method which reads a command line
- * from a stream. It then interpret that commmand line and calls a suitable
- * method in the MgmtSrvr class which executes the command.
- *
* For command syntax, see the HELP command.
*/
class CommandInterpreter {
@@ -228,8 +222,8 @@ static const char* helpText =
"CLUSTERLOG TOGGLE [<severity>] ... Toggle severity filter on/off\n"
"CLUSTERLOG INFO Print cluster log information\n"
"<id> START Start data node (started with -n)\n"
-"<id> RESTART [-n] [-i] [-a] Restart data or management server node\n"
-"<id> STOP [-a] Stop data or management server node\n"
+"<id> RESTART [-n] [-i] [-a] [-f] Restart data or management server node\n"
+"<id> STOP [-a] [-f] Stop data or management server node\n"
"ENTER SINGLE USER MODE <id> Enter single user mode\n"
"EXIT SINGLE USER MODE Exit single user mode\n"
"<id> STATUS Print status\n"
@@ -397,7 +391,7 @@ static const char* helpTextRestart =
" NDB Cluster -- Management Client -- Help for RESTART command\n"
"---------------------------------------------------------------------------\n"
"RESTART Restart data or management server node\n\n"
-"<id> RESTART [-n] [-i] [-a]\n"
+"<id> RESTART [-n] [-i] [-a] [-f]\n"
" Restart the data or management node <id>(or All data nodes).\n\n"
" -n (--nostart) restarts the node but does not\n"
" make it join the cluster. Use '<id> START' to\n"
@@ -407,8 +401,10 @@ static const char* helpTextRestart =
" and the node will copy data from another node\n"
" in the same node group during start up.\n\n"
" Consult the documentation before using -i.\n\n"
-" INCORRECT USE OF -i WILL CAUSE DATA LOSS!\n"
-" -a Aborts the node, not syncing GCP.\n"
+" INCORRECT USE OF -i WILL CAUSE DATA LOSS!\n\n"
+" -a Aborts the node, not syncing GCP.\n\n"
+" -f Force restart even if that would mean the\n"
+" whole cluster would need to be restarted\n"
;
static const char* helpTextStop =
@@ -416,11 +412,14 @@ static const char* helpTextStop =
" NDB Cluster -- Management Client -- Help for STOP command\n"
"---------------------------------------------------------------------------\n"
"STOP Stop data or management server node\n\n"
-"<id> STOP [-a] Stop the data or management server node <id>.\n\n"
+"<id> STOP [-a] [-f]\n"
+" Stop the data or management server node <id>.\n\n"
" ALL STOP will just stop all data nodes.\n\n"
" If you desire to also shut down management servers,\n"
-" use SHUTDOWN instead.\n"
-" -a Aborts the node, not syncing GCP.\n"
+" use SHUTDOWN instead.\n\n"
+" -a Aborts the node, not syncing GCP.\n\n"
+" -f Force stop even if that would mean the\n"
+" whole cluster would need to be stopped\n"
;
static const char* helpTextEnterSingleUserMode =
@@ -2044,6 +2043,7 @@ CommandInterpreter::executeStop(Vector<B
int need_disconnect;
int abort= 0;
int retval = 0;
+ int force = 0;
for (; command_pos < command_list.size(); command_pos++)
{
@@ -2053,13 +2053,18 @@ CommandInterpreter::executeStop(Vector<B
abort= 1;
continue;
}
- ndbout_c("Invalid option: %s. Expecting -A after STOP",
+ if (strcasecmp(item, "-F") == 0)
+ {
+ force = 1;
+ continue;
+ }
+ ndbout_c("Invalid option: %s. Expecting -A or -F after STOP",
item);
return -1;
}
- int result= ndb_mgm_stop3(m_mgmsrv, no_of_nodes, node_ids, abort,
- &need_disconnect);
+ int result= ndb_mgm_stop4(m_mgmsrv, no_of_nodes, node_ids, abort,
+ force, &need_disconnect);
if (result < 0)
{
ndbout_c("Shutdown failed.");
@@ -2207,6 +2212,7 @@ CommandInterpreter::executeRestart(Vecto
int initialstart= 0;
int abort= 0;
int need_disconnect= 0;
+ int force = 0;
for (; command_pos < command_list.size(); command_pos++)
{
@@ -2226,7 +2232,12 @@ CommandInterpreter::executeRestart(Vecto
abort= 1;
continue;
}
- ndbout_c("Invalid option: %s. Expecting -A,-N or -I after RESTART",
+ if (strcasecmp(item, "-F") == 0)
+ {
+ force = 1;
+ continue;
+ }
+ ndbout_c("Invalid option: %s. Expecting -A,-N,-I or -F after RESTART",
item);
return -1;
}
@@ -2275,8 +2286,9 @@ CommandInterpreter::executeRestart(Vecto
}
}
- result= ndb_mgm_restart3(m_mgmsrv, no_of_nodes, node_ids,
- initialstart, nostart, abort, &need_disconnect);
+ result= ndb_mgm_restart4(m_mgmsrv, no_of_nodes, node_ids,
+ initialstart, nostart, abort, force,
+ &need_disconnect);
if (result <= 0) {
ndbout_c("Restart failed.");
=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.cpp 2010-09-21 12:02:05 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.cpp 2010-09-30 09:32:28 +0000
@@ -20,6 +20,7 @@
#include <NdbConfig.h>
#include <NdbSleep.h>
+#include <kernel/GlobalSignalNumbers.h>
#include <SignalSender.hpp>
#include <NdbApiSignal.hpp>
#include <signaldata/NFCompleteRep.hpp>
@@ -27,6 +28,8 @@
#include <signaldata/ApiRegSignalData.hpp>
#include <ndb_version.h>
+#include <EventLogger.hpp>
+extern EventLogger * g_eventLogger;
extern "C" const char* opt_ndb_connectstring;
extern "C" int opt_ndb_nodeid;
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2010-09-23 07:31:51 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2010-09-29 13:25:19 +0000
@@ -2457,7 +2457,7 @@ const char* MgmtSrvr::getErrorText(int e
void
-MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal)
+MgmtSrvr::handleReceivedSignal(const NdbApiSignal* signal)
{
int gsn = signal->readSignalNumber();
@@ -2493,8 +2493,8 @@ MgmtSrvr::handleReceivedSignal(NdbApiSig
void
MgmtSrvr::signalReceivedNotification(void* mgmtSrvr,
- NdbApiSignal* signal,
- LinearSectionPtr ptr[3])
+ const NdbApiSignal* signal,
+ const LinearSectionPtr ptr[3])
{
((MgmtSrvr*)mgmtSrvr)->handleReceivedSignal(signal);
}
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.hpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2010-06-11 13:46:40 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2010-09-29 13:25:19 +0000
@@ -469,7 +469,7 @@ private:
NodeBitmask m_reserved_nodes;
struct in_addr m_connect_address[MAX_NODES];
- void handleReceivedSignal(NdbApiSignal* signal);
+ void handleReceivedSignal(const NdbApiSignal* signal);
void handleStatus(NodeId nodeId, bool alive, bool nfComplete);
/**
@@ -480,8 +480,8 @@ private:
@param ptr: The long part(s) of the signal
*/
static void signalReceivedNotification(void* mgmtSrvr,
- NdbApiSignal* signal,
- struct LinearSectionPtr ptr[3]);
+ const NdbApiSignal* signal,
+ const struct LinearSectionPtr ptr[3]);
/**
Callback function installed into TransporterFacade, will be called
=== modified file 'storage/ndb/src/mgmsrv/Services.cpp'
--- a/storage/ndb/src/mgmsrv/Services.cpp 2010-08-28 09:37:09 +0000
+++ b/storage/ndb/src/mgmsrv/Services.cpp 2010-09-29 08:45:11 +0000
@@ -33,6 +33,8 @@
#include "Services.hpp"
#include "../mgmapi/ndb_logevent.hpp"
+#include "ndb_mgmd_error.h"
+
#include <base64.h>
#include <ndberror.h>
@@ -158,6 +160,7 @@ ParserRow<MgmApiSession> commands[] = {
MGM_ARG("initialstart", Int, Optional, "Initial start"),
MGM_ARG("nostart", Int, Optional, "No start"),
MGM_ARG("abort", Int, Optional, "Abort"),
+ MGM_ARG("force", Int, Optional, "Force"),
MGM_CMD("restart all", &MgmApiSession::restartAll, ""),
MGM_ARG("initialstart", Int, Optional, "Initial start"),
@@ -203,6 +206,7 @@ ParserRow<MgmApiSession> commands[] = {
MGM_CMD("stop v2", &MgmApiSession::stop_v2, ""),
MGM_ARG("node", String, Mandatory, "Node"),
MGM_ARG("abort", Int, Mandatory, "Node"),
+ MGM_ARG("force", Int, Optional, "Force"),
MGM_CMD("stop all", &MgmApiSession::stopAll, ""),
MGM_ARG("abort", Int, Mandatory, "Node"),
@@ -924,7 +928,7 @@ MgmApiSession::restart(Properties const
Uint32
nostart = 0,
initialstart = 0,
- abort = 0;
+ abort = 0, force = 0;
char *nodes_str;
Vector<NodeId> nodes;
@@ -932,6 +936,7 @@ MgmApiSession::restart(Properties const
args.get("nostart", &nostart);
args.get("abort", &abort);
args.get("node", (const char **)&nodes_str);
+ args.get("force", &force);
char *p, *last;
for((p = strtok_r(nodes_str, " ", &last));
@@ -947,7 +952,15 @@ MgmApiSession::restart(Properties const
initialstart != 0,
abort != 0,
&m_stopSelf);
-
+
+ if (force &&
+ (result == NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH ||
+ result == UNSUPPORTED_NODE_SHUTDOWN))
+ {
+ // Force restart by restarting all nodes
+ result = m_mgmsrv.restartDB(nostart, initialstart, false, &restarted);
+ }
+
m_output->println("restart reply");
if(result != 0){
m_output->println("result: %d-%s", result, get_error_text(result));
@@ -1102,7 +1115,7 @@ MgmApiSession::stop_v2(Parser<MgmApiSess
void
MgmApiSession::stop(Properties const &args, int version) {
- Uint32 abort;
+ Uint32 abort, force = 0;
char *nodes_str;
Vector<NodeId> nodes;
@@ -1115,6 +1128,7 @@ MgmApiSession::stop(Properties const &ar
return;
}
args.get("abort", &abort);
+ args.get("force", &force);
char *p, *last;
for((p = strtok_r(nodes_str, " ", &last));
@@ -1126,8 +1140,18 @@ MgmApiSession::stop(Properties const &ar
int stopped= 0;
int result= 0;
if (nodes.size())
+ {
result= m_mgmsrv.stopNodes(nodes, &stopped, abort != 0, &m_stopSelf);
+ if (force &&
+ (result == NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH ||
+ result == UNSUPPORTED_NODE_SHUTDOWN))
+ {
+ // Force stop and shutdown all remaining nodes
+ result = m_mgmsrv.shutdownDB(&stopped, false);
+ }
+ }
+
m_output->println("stop reply");
if(result != 0)
m_output->println("result: %s", get_error_text(result));
=== modified file 'storage/ndb/src/mgmsrv/main.cpp'
--- a/storage/ndb/src/mgmsrv/main.cpp 2010-09-23 07:31:51 +0000
+++ b/storage/ndb/src/mgmsrv/main.cpp 2010-09-30 09:32:28 +0000
@@ -34,6 +34,10 @@
#include <NdbAutoPtr.hpp>
#include <ndb_mgmclient.hpp>
+#include <EventLogger.hpp>
+extern EventLogger * g_eventLogger;
+
+
const char *load_default_groups[]= { "mysql_cluster","ndb_mgmd",0 };
// copied from mysql.cc to get readline
=== modified file 'storage/ndb/src/ndbapi/API.hpp'
--- a/storage/ndb/src/ndbapi/API.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/ndbapi/API.hpp 2010-09-30 09:32:28 +0000
@@ -19,11 +19,35 @@
#ifndef API_H
#define API_H
+#include <ndb_global.h>
#include <BlockNumbers.h>
#include <GlobalSignalNumbers.h>
#include <RefConvert.hpp>
-#include "NdbImpl.hpp"
+#include <NdbOut.hpp>
+
+#include "NdbApiSignal.hpp"
#include "NdbDictionaryImpl.hpp"
#include "NdbRecord.hpp"
+#include "NdbUtil.hpp"
+
+#include <Ndb.hpp>
+#include <NdbTransaction.hpp>
+#include <NdbOperation.hpp>
+#include <NdbIndexOperation.hpp>
+#include <NdbScanOperation.hpp>
+#include <NdbIndexScanOperation.hpp>
+#include <NdbRecAttr.hpp>
+#include <NdbReceiver.hpp>
+#include <NdbBlob.hpp>
+#include <NdbBlobImpl.hpp>
+#include <NdbInterpretedCode.hpp>
+
+#include <NdbEventOperation.hpp>
+#include "NdbEventOperationImpl.hpp"
+
+#include <NdbReceiver.hpp>
+#include "NdbImpl.hpp"
+
+#include "TransporterFacade.hpp"
#endif
=== modified file 'storage/ndb/src/ndbapi/CMakeLists.txt'
--- a/storage/ndb/src/ndbapi/CMakeLists.txt 2009-11-08 12:52:27 +0000
+++ b/storage/ndb/src/ndbapi/CMakeLists.txt 2010-09-30 09:32:28 +0000
@@ -56,5 +56,6 @@ ADD_LIBRARY(ndbapi STATIC
SignalSender.cpp
ObjectMap.cpp
NdbInfo.cpp
- NdbInfoScanOperation.cpp)
+ NdbInfoScanOperation.cpp
+ ndb_internal.cpp)
=== modified file 'storage/ndb/src/ndbapi/ClusterMgr.cpp'
--- a/storage/ndb/src/ndbapi/ClusterMgr.cpp 2010-08-03 07:25:36 +0000
+++ b/storage/ndb/src/ndbapi/ClusterMgr.cpp 2010-09-30 09:32:28 +0000
@@ -21,10 +21,11 @@
#include <util/version.h>
#include "TransporterFacade.hpp"
+#include <kernel/GlobalSignalNumbers.h>
+
#include "ClusterMgr.hpp"
#include <IPCConfig.hpp>
#include "NdbApiSignal.hpp"
-#include "API.hpp"
#include <NdbSleep.h>
#include <NdbOut.hpp>
#include <NdbTick.h>
=== modified file 'storage/ndb/src/ndbapi/ClusterMgr.hpp'
--- a/storage/ndb/src/ndbapi/ClusterMgr.hpp 2010-01-28 15:16:46 +0000
+++ b/storage/ndb/src/ndbapi/ClusterMgr.hpp 2010-09-30 09:32:28 +0000
@@ -19,7 +19,6 @@
#ifndef ClusterMgr_H
#define ClusterMgr_H
-#include "API.hpp"
#include <ndb_limits.h>
#include <NdbThread.h>
#include <NdbMutex.h>
=== modified file 'storage/ndb/src/ndbapi/Makefile.am'
--- a/storage/ndb/src/ndbapi/Makefile.am 2009-11-08 12:52:27 +0000
+++ b/storage/ndb/src/ndbapi/Makefile.am 2010-09-30 09:32:28 +0000
@@ -60,7 +60,8 @@ libndbapi_la_SOURCES = \
ObjectMap.cpp \
NdbInterpretedCode.cpp \
NdbInfo.cpp \
- NdbInfoScanOperation.cpp
+ NdbInfoScanOperation.cpp \
+ ndb_internal.cpp
INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/src/mgmapi
=== modified file 'storage/ndb/src/ndbapi/Ndb.cpp'
--- a/storage/ndb/src/ndbapi/Ndb.cpp 2010-08-26 12:33:33 +0000
+++ b/storage/ndb/src/ndbapi/Ndb.cpp 2010-09-30 09:32:28 +0000
@@ -25,19 +25,11 @@ Name: Ndb.cpp
#include <ndb_global.h>
-
-#include "NdbApiSignal.hpp"
-#include "NdbImpl.hpp"
-#include <NdbOperation.hpp>
-#include <NdbTransaction.hpp>
-#include <NdbEventOperation.hpp>
-#include <NdbEventOperationImpl.hpp>
-#include <NdbRecAttr.hpp>
+#include "API.hpp"
#include <md5_hash.hpp>
#include <NdbSleep.h>
#include <NdbOut.hpp>
#include <ndb_limits.h>
-#include "API.hpp"
#include <NdbEnv.h>
#include <BaseString.hpp>
#include <NdbSqlUtil.hpp>
=== modified file 'storage/ndb/src/ndbapi/NdbApiSignal.cpp'
--- a/storage/ndb/src/ndbapi/NdbApiSignal.cpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/ndbapi/NdbApiSignal.cpp 2010-09-29 13:25:19 +0000
@@ -283,6 +283,8 @@ NdbApiSignal::copyFrom(const NdbApiSigna
theSendersBlockRef = src->theSendersBlockRef;
theLength = src->theLength;
theTrace = src->theTrace;
+ m_noOfSections = src->m_noOfSections;
+ m_fragmentInfo = src->m_fragmentInfo;
Uint32 * dstData = getDataPtrSend();
const Uint32 * srcData = src->getDataPtr();
=== modified file 'storage/ndb/src/ndbapi/NdbApiSignal.hpp'
--- a/storage/ndb/src/ndbapi/NdbApiSignal.hpp 2010-08-17 09:54:53 +0000
+++ b/storage/ndb/src/ndbapi/NdbApiSignal.hpp 2010-09-30 09:32:28 +0000
@@ -33,27 +33,10 @@
#define NdbApiSignal_H
#include <kernel_types.h>
-#include "TransporterFacade.hpp"
+#include <RefConvert.hpp>
#include <TransporterDefinitions.hpp>
-#include "Ndb.hpp"
-#include <signaldata/GetTabInfo.hpp>
-#include <signaldata/DictTabInfo.hpp>
-#include <signaldata/CreateTable.hpp>
-#include <signaldata/CreateIndx.hpp>
-#include <signaldata/CreateEvnt.hpp>
-#include <signaldata/SumaImpl.hpp>
-#include <signaldata/DropTable.hpp>
-#include <signaldata/AlterTable.hpp>
-#include <signaldata/DropIndx.hpp>
-#include <signaldata/ListTables.hpp>
-#include <signaldata/DropFilegroup.hpp>
-#include <signaldata/CreateFilegroup.hpp>
-#include <signaldata/WaitGCP.hpp>
-#include <signaldata/SchemaTrans.hpp>
-#include <signaldata/CreateHashMap.hpp>
-#include <signaldata/ApiRegSignalData.hpp>
-#include <signaldata/ArbitSignalData.hpp>
+class Ndb;
/**
* A NdbApiSignal : public SignalHeader
@@ -80,7 +63,7 @@ public:
Uint32 readData(Uint32 aDataNo) const; // Read word in signal
int setSignal(int NdbSignalType); // Set signal header
- int readSignalNumber(); // Read signal number
+ int readSignalNumber() const; // Read signal number
Uint32 getLength() const;
void setLength(Uint32 aLength);
void next(NdbApiSignal* anApiSignal);
@@ -184,7 +167,7 @@ Remark: Read signal number
*****************************************************************************/
inline
int
-NdbApiSignal::readSignalNumber()
+NdbApiSignal::readSignalNumber() const
{
return (int)theVerId_signalNumber;
}
=== modified file 'storage/ndb/src/ndbapi/NdbBlob.cpp'
--- a/storage/ndb/src/ndbapi/NdbBlob.cpp 2010-02-26 12:44:34 +0000
+++ b/storage/ndb/src/ndbapi/NdbBlob.cpp 2010-09-30 09:32:28 +0000
@@ -16,20 +16,9 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <Ndb.hpp>
-#include <NdbDictionaryImpl.hpp>
-#include <NdbTransaction.hpp>
-#include <NdbOperation.hpp>
-#include <NdbIndexOperation.hpp>
-#include <NdbRecAttr.hpp>
-#include <NdbBlob.hpp>
-#include "NdbBlobImpl.hpp"
-#include <NdbScanOperation.hpp>
+#include "API.hpp"
#include <signaldata/TcKeyReq.hpp>
-#include <NdbEventOperationImpl.hpp>
#include <NdbEnv.h>
-#include "NdbRecord.hpp"
-#include "NdbUtil.hpp"
#include <ndb_version.h>
/*
=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2010-09-30 13:15:22 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2010-10-01 08:53:44 +0000
@@ -16,19 +16,11 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "NdbDictionaryImpl.hpp"
#include "API.hpp"
#include <NdbOut.hpp>
-#include "NdbApiSignal.hpp"
-#include "TransporterFacade.hpp"
#include <SimpleProperties.hpp>
#include <Bitmask.hpp>
#include <AttributeList.hpp>
-#include <NdbEventOperation.hpp>
-#include "NdbEventOperationImpl.hpp"
-#include <NdbBlob.hpp>
-#include "NdbBlobImpl.hpp"
-#include <NdbInterpretedCode.hpp>
#include <AttributeHeader.hpp>
#include <my_sys.h>
#include <NdbEnv.h>
@@ -36,6 +28,23 @@
#include <util/version.h>
#include <NdbSleep.h>
+#include <signaldata/GetTabInfo.hpp>
+#include <signaldata/DictTabInfo.hpp>
+#include <signaldata/CreateTable.hpp>
+#include <signaldata/CreateIndx.hpp>
+#include <signaldata/CreateEvnt.hpp>
+#include <signaldata/SumaImpl.hpp>
+#include <signaldata/DropTable.hpp>
+#include <signaldata/AlterTable.hpp>
+#include <signaldata/DropIndx.hpp>
+#include <signaldata/ListTables.hpp>
+#include <signaldata/DropFilegroup.hpp>
+#include <signaldata/CreateFilegroup.hpp>
+#include <signaldata/WaitGCP.hpp>
+#include <signaldata/SchemaTrans.hpp>
+#include <signaldata/CreateHashMap.hpp>
+#include <signaldata/ApiRegSignalData.hpp>
+
#define DEBUG_PRINT 0
#define INCOMPATIBLE_VERSION -2
@@ -2070,8 +2079,8 @@ NdbDictInterface::~NdbDictInterface()
void
NdbDictInterface::execSignal(void* dictImpl,
- class NdbApiSignal* signal,
- struct LinearSectionPtr ptr[3])
+ const class NdbApiSignal* signal,
+ const struct LinearSectionPtr ptr[3])
{
NdbDictInterface * tmp = (NdbDictInterface*)dictImpl;
@@ -2462,8 +2471,8 @@ NdbDictInterface::getTable(class NdbApiS
}
void
-NdbDictInterface::execGET_TABINFO_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execGET_TABINFO_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const GetTabInfoConf* conf = CAST_CONSTPTR(GetTabInfoConf, signal->getDataPtr());
const Uint32 i = GetTabInfoConf::DICT_TAB_INFO;
@@ -2493,8 +2502,8 @@ end:
}
void
-NdbDictInterface::execGET_TABINFO_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execGET_TABINFO_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const GetTabInfoRef* ref = CAST_CONSTPTR(GetTabInfoRef,
signal->getDataPtr());
@@ -3661,8 +3670,8 @@ NdbDictInterface::sendCreateTable(const
}
void
-NdbDictInterface::execCREATE_TABLE_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execCREATE_TABLE_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const CreateTableConf* const conf=
CAST_CONSTPTR(CreateTableConf, signal->getDataPtr());
@@ -3674,8 +3683,8 @@ NdbDictInterface::execCREATE_TABLE_CONF(
}
void
-NdbDictInterface::execCREATE_TABLE_REF(NdbApiSignal * sig,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execCREATE_TABLE_REF(const NdbApiSignal * sig,
+ const LinearSectionPtr ptr[3])
{
const CreateTableRef* ref = CAST_CONSTPTR(CreateTableRef, sig->getDataPtr());
m_error.code= ref->errorCode;
@@ -3684,15 +3693,15 @@ NdbDictInterface::execCREATE_TABLE_REF(N
}
void
-NdbDictInterface::execALTER_TABLE_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execALTER_TABLE_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
m_waiter.signal(NO_WAIT);
}
void
-NdbDictInterface::execALTER_TABLE_REF(NdbApiSignal * sig,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execALTER_TABLE_REF(const NdbApiSignal * sig,
+ const LinearSectionPtr ptr[3])
{
const AlterTableRef * ref = CAST_CONSTPTR(AlterTableRef, sig->getDataPtr());
m_error.code= ref->errorCode;
@@ -3887,8 +3896,8 @@ NdbDictInterface::dropTable(const NdbTab
}
void
-NdbDictInterface::execDROP_TABLE_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execDROP_TABLE_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
DBUG_ENTER("NdbDictInterface::execDROP_TABLE_CONF");
//DropTableConf* const conf = CAST_CONSTPTR(DropTableConf, signal->getDataPtr());
@@ -3898,8 +3907,8 @@ NdbDictInterface::execDROP_TABLE_CONF(Nd
}
void
-NdbDictInterface::execDROP_TABLE_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execDROP_TABLE_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
DBUG_ENTER("NdbDictInterface::execDROP_TABLE_REF");
const DropTableRef* ref = CAST_CONSTPTR(DropTableRef, signal->getDataPtr());
@@ -4148,15 +4157,15 @@ NdbDictInterface::createIndex(Ndb & ndb,
}
void
-NdbDictInterface::execCREATE_INDX_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execCREATE_INDX_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
m_waiter.signal(NO_WAIT);
}
void
-NdbDictInterface::execCREATE_INDX_REF(NdbApiSignal * sig,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execCREATE_INDX_REF(const NdbApiSignal * sig,
+ const LinearSectionPtr ptr[3])
{
const CreateIndxRef* ref = CAST_CONSTPTR(CreateIndxRef, sig->getDataPtr());
m_error.code = ref->errorCode;
@@ -4284,15 +4293,15 @@ NdbDictInterface::dropIndex(const NdbInd
}
void
-NdbDictInterface::execDROP_INDX_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execDROP_INDX_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
m_waiter.signal(NO_WAIT);
}
void
-NdbDictInterface::execDROP_INDX_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execDROP_INDX_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const DropIndxRef* ref = CAST_CONSTPTR(DropIndxRef, signal->getDataPtr());
m_error.code = ref->errorCode;
@@ -4777,8 +4786,8 @@ NdbDictionaryImpl::getBlobEvent(const Nd
}
void
-NdbDictInterface::execCREATE_EVNT_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execCREATE_EVNT_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
DBUG_ENTER("NdbDictInterface::execCREATE_EVNT_CONF");
@@ -4810,8 +4819,8 @@ NdbDictInterface::execCREATE_EVNT_CONF(N
}
void
-NdbDictInterface::execCREATE_EVNT_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execCREATE_EVNT_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
DBUG_ENTER("NdbDictInterface::execCREATE_EVNT_REF");
@@ -4827,8 +4836,8 @@ NdbDictInterface::execCREATE_EVNT_REF(Nd
}
void
-NdbDictInterface::execSUB_STOP_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execSUB_STOP_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
DBUG_ENTER("NdbDictInterface::execSUB_STOP_CONF");
const SubStopConf * const subStopConf=
@@ -4859,8 +4868,8 @@ NdbDictInterface::execSUB_STOP_CONF(NdbA
}
void
-NdbDictInterface::execSUB_STOP_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execSUB_STOP_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
DBUG_ENTER("NdbDictInterface::execSUB_STOP_REF");
const SubStopRef * const subStopRef=
@@ -4883,8 +4892,8 @@ NdbDictInterface::execSUB_STOP_REF(NdbAp
}
void
-NdbDictInterface::execSUB_START_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execSUB_START_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
DBUG_ENTER("NdbDictInterface::execSUB_START_CONF");
const SubStartConf * const subStartConf=
@@ -4932,8 +4941,8 @@ NdbDictInterface::execSUB_START_CONF(Ndb
}
void
-NdbDictInterface::execSUB_START_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execSUB_START_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
DBUG_ENTER("NdbDictInterface::execSUB_START_REF");
const SubStartRef * const subStartRef=
@@ -5073,8 +5082,8 @@ NdbDictInterface::dropEvent(const NdbEve
}
void
-NdbDictInterface::execDROP_EVNT_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execDROP_EVNT_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
DBUG_ENTER("NdbDictInterface::execDROP_EVNT_CONF");
m_waiter.signal(NO_WAIT);
@@ -5082,8 +5091,8 @@ NdbDictInterface::execDROP_EVNT_CONF(Ndb
}
void
-NdbDictInterface::execDROP_EVNT_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execDROP_EVNT_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
DBUG_ENTER("NdbDictInterface::execDROP_EVNT_REF");
const DropEvntRef* const ref=
@@ -5098,7 +5107,6 @@ NdbDictInterface::execDROP_EVNT_REF(NdbA
DBUG_VOID_RETURN;
}
-#include <NdbScanOperation.hpp>
static int scanEventTable(Ndb* pNdb,
const NdbDictionary::Table* pTab,
NdbDictionary::Dictionary::List &list)
@@ -5670,8 +5678,8 @@ NdbDictInterface::listObjects(NdbApiSign
}
void
-NdbDictInterface::execLIST_TABLES_CONF(NdbApiSignal* signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execLIST_TABLES_CONF(const NdbApiSignal* signal,
+ const LinearSectionPtr ptr[3])
{
Uint16 nodeId = refToNode(signal->theSendersBlockRef);
NodeInfo info = m_transporter->theClusterMgr->getNodeInfo(nodeId).m_info;
@@ -5748,8 +5756,8 @@ NdbDictInterface::execLIST_TABLES_CONF(N
void
-NdbDictInterface::execOLD_LIST_TABLES_CONF(NdbApiSignal* signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execOLD_LIST_TABLES_CONF(const NdbApiSignal* signal,
+ const LinearSectionPtr ptr[3])
{
const unsigned off = OldListTablesConf::HeaderLength;
const unsigned len = (signal->getLength() - off);
@@ -5838,15 +5846,15 @@ NdbDictInterface::forceGCPWait(int type)
}
void
-NdbDictInterface::execWAIT_GCP_CONF(NdbApiSignal* signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execWAIT_GCP_CONF(const NdbApiSignal* signal,
+ const LinearSectionPtr ptr[3])
{
m_waiter.signal(NO_WAIT);
}
void
-NdbDictInterface::execWAIT_GCP_REF(NdbApiSignal* signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execWAIT_GCP_REF(const NdbApiSignal* signal,
+ const LinearSectionPtr ptr[3])
{
m_waiter.signal(NO_WAIT);
}
@@ -7235,8 +7243,8 @@ NdbDictInterface::create_file(const NdbF
}
void
-NdbDictInterface::execCREATE_FILE_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execCREATE_FILE_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const CreateFileConf* conf=
CAST_CONSTPTR(CreateFileConf, signal->getDataPtr());
@@ -7250,8 +7258,8 @@ NdbDictInterface::execCREATE_FILE_CONF(N
}
void
-NdbDictInterface::execCREATE_FILE_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execCREATE_FILE_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const CreateFileRef* ref =
CAST_CONSTPTR(CreateFileRef, signal->getDataPtr());
@@ -7288,15 +7296,15 @@ NdbDictInterface::drop_file(const NdbFil
}
void
-NdbDictInterface::execDROP_FILE_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execDROP_FILE_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
m_waiter.signal(NO_WAIT);
}
void
-NdbDictInterface::execDROP_FILE_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execDROP_FILE_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const DropFileRef* ref =
CAST_CONSTPTR(DropFileRef, signal->getDataPtr());
@@ -7404,8 +7412,8 @@ NdbDictInterface::create_filegroup(const
}
void
-NdbDictInterface::execCREATE_FILEGROUP_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execCREATE_FILEGROUP_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const CreateFilegroupConf* conf=
CAST_CONSTPTR(CreateFilegroupConf, signal->getDataPtr());
@@ -7418,8 +7426,8 @@ NdbDictInterface::execCREATE_FILEGROUP_C
}
void
-NdbDictInterface::execCREATE_FILEGROUP_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execCREATE_FILEGROUP_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const CreateFilegroupRef* ref =
CAST_CONSTPTR(CreateFilegroupRef, signal->getDataPtr());
@@ -7456,15 +7464,15 @@ NdbDictInterface::drop_filegroup(const N
}
void
-NdbDictInterface::execDROP_FILEGROUP_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execDROP_FILEGROUP_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
m_waiter.signal(NO_WAIT);
}
void
-NdbDictInterface::execDROP_FILEGROUP_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execDROP_FILEGROUP_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const DropFilegroupRef* ref =
CAST_CONSTPTR(DropFilegroupRef, signal->getDataPtr());
@@ -7915,7 +7923,8 @@ NdbDictInterface::create_hashmap(const N
Uint32 flags)
{
DictHashMapInfo::HashMap hm; hm.init();
- BaseString::snprintf(hm.HashMapName, sizeof(hm.HashMapName), src.getName());
+ BaseString::snprintf(hm.HashMapName, sizeof(hm.HashMapName),
+ "%s", src.getName());
hm.HashMapBuckets = src.getMapLen();
for (Uint32 i = 0; i<hm.HashMapBuckets; i++)
{
@@ -7986,8 +7995,8 @@ NdbDictInterface::create_hashmap(const N
}
void
-NdbDictInterface::execCREATE_HASH_MAP_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execCREATE_HASH_MAP_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const CreateHashMapRef* ref =
CAST_CONSTPTR(CreateHashMapRef, signal->getDataPtr());
@@ -7998,8 +8007,8 @@ NdbDictInterface::execCREATE_HASH_MAP_RE
void
-NdbDictInterface::execCREATE_HASH_MAP_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execCREATE_HASH_MAP_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const CreateHashMapConf* conf=
CAST_CONSTPTR(CreateHashMapConf, signal->getDataPtr());
@@ -8210,8 +8219,8 @@ NdbDictInterface::endSchemaTrans(Uint32
}
void
-NdbDictInterface::execSCHEMA_TRANS_BEGIN_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execSCHEMA_TRANS_BEGIN_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const SchemaTransBeginConf* conf=
CAST_CONSTPTR(SchemaTransBeginConf, signal->getDataPtr());
@@ -8221,8 +8230,8 @@ NdbDictInterface::execSCHEMA_TRANS_BEGIN
}
void
-NdbDictInterface::execSCHEMA_TRANS_BEGIN_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execSCHEMA_TRANS_BEGIN_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const SchemaTransBeginRef* ref =
CAST_CONSTPTR(SchemaTransBeginRef, signal->getDataPtr());
@@ -8232,8 +8241,8 @@ NdbDictInterface::execSCHEMA_TRANS_BEGIN
}
void
-NdbDictInterface::execSCHEMA_TRANS_END_CONF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execSCHEMA_TRANS_END_CONF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const SchemaTransEndConf* conf=
CAST_CONSTPTR(SchemaTransEndConf, signal->getDataPtr());
@@ -8242,8 +8251,8 @@ NdbDictInterface::execSCHEMA_TRANS_END_C
}
void
-NdbDictInterface::execSCHEMA_TRANS_END_REF(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execSCHEMA_TRANS_END_REF(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const SchemaTransEndRef* ref =
CAST_CONSTPTR(SchemaTransEndRef, signal->getDataPtr());
@@ -8254,8 +8263,8 @@ NdbDictInterface::execSCHEMA_TRANS_END_R
}
void
-NdbDictInterface::execSCHEMA_TRANS_END_REP(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbDictInterface::execSCHEMA_TRANS_END_REP(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
const SchemaTransEndRep* rep =
CAST_CONSTPTR(SchemaTransEndRep, signal->getDataPtr());
=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2010-09-30 13:15:22 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2010-10-01 08:53:44 +0000
@@ -715,61 +715,71 @@ private:
friend class Ndb;
friend class NdbDictionaryImpl;
static void execSignal(void* dictImpl,
- class NdbApiSignal* signal,
- struct LinearSectionPtr ptr[3]);
+ const class NdbApiSignal* signal,
+ const struct LinearSectionPtr ptr[3]);
static void execNodeStatus(void* dictImpl, Uint32,
bool alive, bool nfCompleted);
- void execGET_TABINFO_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execGET_TABINFO_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execCREATE_TABLE_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execCREATE_TABLE_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execALTER_TABLE_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execALTER_TABLE_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
-
- void execCREATE_INDX_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execCREATE_INDX_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execDROP_INDX_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execDROP_INDX_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
-
- void execCREATE_EVNT_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execCREATE_EVNT_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execSUB_START_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execSUB_START_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execSUB_STOP_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execSUB_STOP_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execDROP_EVNT_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execDROP_EVNT_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
-
- void execDROP_TABLE_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execDROP_TABLE_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execOLD_LIST_TABLES_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execLIST_TABLES_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
-
- void execCREATE_FILE_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execCREATE_FILE_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
-
- void execCREATE_FILEGROUP_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execCREATE_FILEGROUP_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
-
- void execDROP_FILE_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execDROP_FILE_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
-
- void execDROP_FILEGROUP_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execDROP_FILEGROUP_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
-
- void execSCHEMA_TRANS_BEGIN_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execSCHEMA_TRANS_BEGIN_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execSCHEMA_TRANS_END_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execSCHEMA_TRANS_END_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execSCHEMA_TRANS_END_REP(NdbApiSignal *, LinearSectionPtr ptr[3]);
-
- void execWAIT_GCP_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execWAIT_GCP_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
-
- void execCREATE_HASH_MAP_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execCREATE_HASH_MAP_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
+ void execGET_TABINFO_REF(const NdbApiSignal *, const LinearSectionPtr p[3]);
+ void execGET_TABINFO_CONF(const NdbApiSignal *, const LinearSectionPtr p[3]);
+ void execCREATE_TABLE_REF(const NdbApiSignal *, const LinearSectionPtr p[3]);
+ void execCREATE_TABLE_CONF(const NdbApiSignal *, const LinearSectionPtr [3]);
+ void execALTER_TABLE_REF(const NdbApiSignal *, const LinearSectionPtr pr[3]);
+ void execALTER_TABLE_CONF(const NdbApiSignal *, const LinearSectionPtr p[3]);
+
+ void execCREATE_INDX_REF(const NdbApiSignal *, const LinearSectionPtr pr[3]);
+ void execCREATE_INDX_CONF(const NdbApiSignal *, const LinearSectionPtr p[3]);
+ void execDROP_INDX_REF(const NdbApiSignal *, const LinearSectionPtr ptr[3]);
+ void execDROP_INDX_CONF(const NdbApiSignal *, const LinearSectionPtr ptr[3]);
+
+ void execCREATE_EVNT_REF(const NdbApiSignal *, const LinearSectionPtr pr[3]);
+ void execCREATE_EVNT_CONF(const NdbApiSignal *, const LinearSectionPtr p[3]);
+ void execSUB_START_CONF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+ void execSUB_START_REF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+ void execSUB_STOP_CONF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+ void execSUB_STOP_REF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+ void execDROP_EVNT_REF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+ void execDROP_EVNT_CONF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+
+ void execDROP_TABLE_REF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+ void execDROP_TABLE_CONF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+ void execOLD_LIST_TABLES_CONF(const NdbApiSignal*,
+ const LinearSectionPtr ptr[3]);
+ void execLIST_TABLES_CONF(const NdbApiSignal*, const LinearSectionPtr pt[3]);
+
+ void execCREATE_FILE_REF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+ void execCREATE_FILE_CONF(const NdbApiSignal*, const LinearSectionPtr pr[3]);
+
+ void execCREATE_FILEGROUP_REF(const NdbApiSignal*,
+ const LinearSectionPtr ptr[3]);
+ void execCREATE_FILEGROUP_CONF(const NdbApiSignal*,
+ const LinearSectionPtr ptr[3]);
+
+ void execDROP_FILE_REF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+ void execDROP_FILE_CONF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+
+ void execDROP_FILEGROUP_REF(const NdbApiSignal*, const LinearSectionPtr [3]);
+ void execDROP_FILEGROUP_CONF(const NdbApiSignal*,
+ const LinearSectionPtr ptr[3]);
+
+ void execSCHEMA_TRANS_BEGIN_CONF(const NdbApiSignal*,
+ const LinearSectionPtr ptr[3]);
+ void execSCHEMA_TRANS_BEGIN_REF(const NdbApiSignal*,
+ const LinearSectionPtr ptr[3]);
+ void execSCHEMA_TRANS_END_CONF(const NdbApiSignal*,
+ const LinearSectionPtr ptr[3]);
+ void execSCHEMA_TRANS_END_REF(const NdbApiSignal*,
+ const LinearSectionPtr ptr[3]);
+ void execSCHEMA_TRANS_END_REP(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+
+ void execWAIT_GCP_CONF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+ void execWAIT_GCP_REF(const NdbApiSignal*, const LinearSectionPtr ptr[3]);
+
+ void execCREATE_HASH_MAP_REF(const NdbApiSignal*,
+ const LinearSectionPtr ptr[3]);
+ void execCREATE_HASH_MAP_CONF(const NdbApiSignal*,
+ const LinearSectionPtr ptr[3]);
Uint32 m_fragmentId;
UtilBuffer m_buffer;
=== modified file 'storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp 2010-08-20 11:26:54 +0000
+++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp 2010-09-30 09:32:28 +0000
@@ -20,11 +20,9 @@
#include <ndb_global.h>
#include <kernel_types.h>
-#include "NdbDictionaryImpl.hpp"
#include "API.hpp"
#include <NdbOut.hpp>
-#include "NdbApiSignal.hpp"
-#include "TransporterFacade.hpp"
+
#include <signaldata/CreateEvnt.hpp>
#include <signaldata/SumaImpl.hpp>
#include <SimpleProperties.hpp>
@@ -34,15 +32,7 @@
#include <NdbError.hpp>
#include <BaseString.hpp>
#include <UtilBuffer.hpp>
-#include <NdbDictionary.hpp>
-#include <Ndb.hpp>
-#include "NdbImpl.hpp"
-#include "DictCache.hpp"
#include <portlib/NdbMem.h>
-#include <NdbRecAttr.hpp>
-#include <NdbBlob.hpp>
-#include <NdbEventOperation.hpp>
-#include "NdbEventOperationImpl.hpp"
#include <signaldata/AlterTable.hpp>
#include "ndb_internal.hpp"
@@ -769,8 +759,8 @@ NdbEventOperationImpl::getLatestGCI()
}
bool
-NdbEventOperationImpl::execSUB_TABLE_DATA(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
+NdbEventOperationImpl::execSUB_TABLE_DATA(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3])
{
DBUG_ENTER("NdbEventOperationImpl::execSUB_TABLE_DATA");
const SubTableData * const sdata=
=== modified file 'storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp 2010-03-12 11:56:09 +0000
+++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp 2010-09-29 13:25:19 +0000
@@ -383,8 +383,8 @@ public:
Uint64 getGCI();
Uint32 getAnyValue() const;
Uint64 getLatestGCI();
- bool execSUB_TABLE_DATA(NdbApiSignal * signal,
- LinearSectionPtr ptr[3]);
+ bool execSUB_TABLE_DATA(const NdbApiSignal * signal,
+ const LinearSectionPtr ptr[3]);
NdbDictionary::Event::TableEvent getEventType();
=== modified file 'storage/ndb/src/ndbapi/NdbImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbImpl.hpp 2010-01-28 15:16:46 +0000
+++ b/storage/ndb/src/ndbapi/NdbImpl.hpp 2010-09-30 10:36:47 +0000
@@ -20,12 +20,8 @@
#define NDB_IMPL_HPP
#include <ndb_global.h>
-#include <Ndb.hpp>
+#include "API.hpp"
#include <NdbOut.hpp>
-#include <NdbError.hpp>
-#include <NdbCondition.h>
-#include <NdbReceiver.hpp>
-#include <NdbOperation.hpp>
#include <kernel/ndb_limits.h>
#include <NdbTick.h>
@@ -117,6 +113,13 @@ public:
ndb->theImpl->forceShortRequests = val;
}
+ Uint32 get_waitfor_timeout() const {
+ return m_ndb_cluster_connection.m_config.m_waitfor_timeout;
+ }
+ const NdbApiConfig& get_ndbapi_config_parameters() const {
+ return m_ndb_cluster_connection.m_config;
+ }
+
BaseString m_systemPrefix; // Buffer for preformatted for <sys>/<def>/
=== modified file 'storage/ndb/src/ndbapi/NdbIndexOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbIndexOperation.cpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/ndbapi/NdbIndexOperation.cpp 2010-09-29 13:25:19 +0000
@@ -16,11 +16,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ndb_global.h>
-#include <NdbIndexOperation.hpp>
-#include <Ndb.hpp>
-#include <NdbTransaction.hpp>
-#include "NdbApiSignal.hpp"
+#include "API.hpp"
#include <AttributeHeader.hpp>
#include <signaldata/TcIndx.hpp>
#include <signaldata/TcKeyReq.hpp>
@@ -188,7 +184,7 @@ Parameters: aSignal: the signal obje
Remark: Handles the reception of the TCKEYREF signal.
***************************************************************************/
int
-NdbIndexOperation::receiveTCINDXREF( NdbApiSignal* aSignal)
+NdbIndexOperation::receiveTCINDXREF(const NdbApiSignal* aSignal)
{
return receiveTCKEYREF(aSignal);
}//NdbIndexOperation::receiveTCINDXREF()
=== modified file 'storage/ndb/src/ndbapi/NdbInfoScanOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbInfoScanOperation.cpp 2010-08-17 09:54:53 +0000
+++ b/storage/ndb/src/ndbapi/NdbInfoScanOperation.cpp 2010-09-30 09:32:28 +0000
@@ -18,7 +18,7 @@
#include "NdbInfo.hpp"
#include "SignalSender.hpp"
-
+#include <kernel/GlobalSignalNumbers.h>
#include <AttributeHeader.hpp>
#include <signaldata/DbinfoScan.hpp>
#include <signaldata/TransIdAI.hpp>
=== modified file 'storage/ndb/src/ndbapi/NdbInterpretedCode.cpp'
--- a/storage/ndb/src/ndbapi/NdbInterpretedCode.cpp 2010-06-10 07:21:34 +0000
+++ b/storage/ndb/src/ndbapi/NdbInterpretedCode.cpp 2010-09-29 13:27:36 +0000
@@ -706,7 +706,7 @@ NdbInterpretedCode::interpret_exit_nok(U
int
NdbInterpretedCode::interpret_exit_nok()
{
- return add1((899 << 16) | Interpreter::EXIT_REFUSE);
+ return add1((626 << 16) | Interpreter::EXIT_REFUSE);
}
int
=== modified file 'storage/ndb/src/ndbapi/NdbOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperation.cpp 2010-01-28 15:16:46 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperation.cpp 2010-09-30 09:32:28 +0000
@@ -16,19 +16,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ndb_global.h>
-#include <NdbTransaction.hpp>
-#include <NdbOperation.hpp>
-#include "NdbApiSignal.hpp"
-#include "NdbRecAttr.hpp"
-#include "NdbUtil.hpp"
-#include "NdbBlob.hpp"
-#include "ndbapi_limits.h"
-#include <signaldata/TcKeyReq.hpp>
-#include "NdbDictionaryImpl.hpp"
-
#include "API.hpp"
-#include <NdbOut.hpp>
+#include <signaldata/TcKeyReq.hpp>
/******************************************************************************
=== modified file 'storage/ndb/src/ndbapi/NdbOperationDefine.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp 2010-06-08 14:37:15 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp 2010-09-29 13:25:19 +0000
@@ -16,16 +16,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ndb_global.h>
-#include <NdbOperation.hpp>
-#include "NdbApiSignal.hpp"
-#include <NdbTransaction.hpp>
-#include <Ndb.hpp>
-#include <NdbRecAttr.hpp>
-#include "NdbUtil.hpp"
+#include "API.hpp"
#include "NdbOut.hpp"
-#include "NdbImpl.hpp"
-#include <NdbIndexScanOperation.hpp>
#include <NdbBlob.hpp>
#include <Interpreter.hpp>
=== modified file 'storage/ndb/src/ndbapi/NdbOperationExec.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationExec.cpp 2010-06-08 14:37:15 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationExec.cpp 2010-09-30 09:32:28 +0000
@@ -17,14 +17,7 @@
*/
#include <ndb_global.h>
-#include <NdbOperation.hpp>
-#include <NdbTransaction.hpp>
-#include <NdbBlob.hpp>
-#include "NdbApiSignal.hpp"
-#include <Ndb.hpp>
-#include <NdbRecAttr.hpp>
-#include "NdbUtil.hpp"
-#include "NdbInterpretedCode.hpp"
+#include "API.hpp"
#include "Interpreter.hpp"
#include <AttributeHeader.hpp>
@@ -1696,7 +1689,7 @@ NdbOperation::insertATTRINFOData_NdbReco
}
int
-NdbOperation::checkState_TransId(NdbApiSignal* aSignal)
+NdbOperation::checkState_TransId(const NdbApiSignal* aSignal)
{
Uint64 tRecTransId, tCurrTransId;
Uint32 tTmp1, tTmp2;
@@ -1731,7 +1724,7 @@ Parameters: aSignal: the signal obje
Remark: Handles the reception of the TCKEYREF signal.
***************************************************************************/
int
-NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal)
+NdbOperation::receiveTCKEYREF(const NdbApiSignal* aSignal)
{
if (checkState_TransId(aSignal) == -1) {
return -1;
=== modified file 'storage/ndb/src/ndbapi/NdbOperationInt.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationInt.cpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationInt.cpp 2010-09-29 13:25:19 +0000
@@ -16,15 +16,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ndb_global.h>
-#include <NdbOperation.hpp>
-#include "NdbApiSignal.hpp"
-#include <NdbTransaction.hpp>
-#include <Ndb.hpp>
-#include <NdbRecAttr.hpp>
-#include "NdbUtil.hpp"
+#include "API.hpp"
#include "Interpreter.hpp"
-#include <NdbIndexScanOperation.hpp>
#include <signaldata/AttrInfo.hpp>
#ifdef VM_TRACE
=== modified file 'storage/ndb/src/ndbapi/NdbOperationSearch.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationSearch.cpp 2009-11-27 14:47:24 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationSearch.cpp 2010-09-30 09:32:28 +0000
@@ -31,18 +31,10 @@ Adjust: 971022 UABMNST First version
*****************************************************************************/
#include "API.hpp"
-#include <NdbOperation.hpp>
-#include "NdbApiSignal.hpp"
-#include <NdbTransaction.hpp>
-#include <Ndb.hpp>
-#include "NdbImpl.hpp"
-#include <NdbOut.hpp>
-#include "NdbBlob.hpp"
#include <AttributeHeader.hpp>
#include <signaldata/TcKeyReq.hpp>
#include <signaldata/KeyInfo.hpp>
-#include "NdbDictionaryImpl.hpp"
#include <md5_hash.hpp>
/******************************************************************************
=== modified file 'storage/ndb/src/ndbapi/NdbReceiver.cpp'
--- a/storage/ndb/src/ndbapi/NdbReceiver.cpp 2010-03-10 07:43:06 +0000
+++ b/storage/ndb/src/ndbapi/NdbReceiver.cpp 2010-09-30 10:36:47 +0000
@@ -16,15 +16,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ndb_global.h>
-#include "NdbImpl.hpp"
-#include <NdbReceiver.hpp>
-#include "NdbDictionaryImpl.hpp"
-#include <NdbRecAttr.hpp>
+#include "API.hpp"
#include <AttributeHeader.hpp>
-#include <NdbTransaction.hpp>
-#include <TransporterFacade.hpp>
-#include <NdbBlob.hpp>
#include <signaldata/TcKeyConf.hpp>
#include <signaldata/DictTabInfo.hpp>
@@ -147,10 +140,10 @@ NdbReceiver::calculate_batch_size(Uint32
Uint32& first_batch_size,
const NdbRecord *record)
{
- TransporterFacade *tp= m_ndb->theImpl->m_transporter_facade;
- Uint32 max_scan_batch_size= tp->get_scan_batch_size();
- Uint32 max_batch_byte_size= tp->get_batch_byte_size();
- Uint32 max_batch_size= tp->get_batch_size();
+ const NdbApiConfig & cfg = m_ndb->theImpl->get_ndbapi_config_parameters();
+ Uint32 max_scan_batch_size= cfg.m_scan_batch_size;
+ Uint32 max_batch_byte_size= cfg.m_batch_byte_size;
+ Uint32 max_batch_size= cfg.m_batch_size;
Uint32 tot_size= (key_size ? (key_size + 32) : 0); //key + signal overhead
if (record)
=== modified file 'storage/ndb/src/ndbapi/NdbScanFilter.cpp'
--- a/storage/ndb/src/ndbapi/NdbScanFilter.cpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/ndbapi/NdbScanFilter.cpp 2010-09-30 09:32:28 +0000
@@ -16,18 +16,12 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "API.hpp"
#include <NdbScanFilter.hpp>
-#include <Ndb.hpp>
-#include <NdbOperation.hpp>
-#include <NdbScanOperation.hpp>
-#include "NdbDictionaryImpl.hpp"
#include <Vector.hpp>
#include <NdbOut.hpp>
#include <Interpreter.hpp>
#include <signaldata/AttrInfo.hpp>
-#include "NdbApiSignal.hpp"
-#include "NdbUtil.hpp"
-#include <NdbInterpretedCode.hpp>
#ifdef VM_TRACE
#include <NdbEnv.h>
=== modified file 'storage/ndb/src/ndbapi/NdbScanOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2010-08-20 11:10:25 +0000
+++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2010-09-30 10:36:47 +0000
@@ -16,21 +16,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ndb_global.h>
-#include <Ndb.hpp>
-#include <NdbScanOperation.hpp>
-#include <NdbIndexScanOperation.hpp>
-#include <NdbTransaction.hpp>
-#include "NdbApiSignal.hpp"
-#include <NdbOut.hpp>
-#include "NdbDictionaryImpl.hpp"
-#include <NdbBlob.hpp>
-#include <NdbInterpretedCode.hpp>
+#include "API.hpp"
-#include <NdbRecAttr.hpp>
-#include <NdbReceiver.hpp>
-
-#include <stdlib.h>
#include <NdbSqlUtil.hpp>
#include <AttributeHeader.hpp>
@@ -1842,6 +1829,7 @@ NdbScanOperation::nextResultNdbRecord(co
/* Now we have to wait for more rows (or end-of-file on all receivers). */
Uint32 nodeId = theNdbCon->theDBnode;
+ Uint32 timeout= theNdb->theImpl->get_waitfor_timeout();
TransporterFacade* tp = theNdb->theImpl->m_transporter_facade;
int retVal= 2;
Uint32 idx, last;
@@ -1864,7 +1852,6 @@ NdbScanOperation::nextResultNdbRecord(co
{
idx= m_current_api_receiver;
last= m_api_receivers_count;
- Uint32 timeout= tp->m_waitfor_timeout;
do {
if (theError.code){
@@ -3722,6 +3709,7 @@ NdbIndexScanOperation::ordered_insert_re
int
NdbIndexScanOperation::ordered_send_scan_wait_for_all(bool forceSend)
{
+ Uint32 timeout= theNdb->theImpl->get_waitfor_timeout();
TransporterFacade* tp= theNdb->theImpl->m_transporter_facade;
PollGuard poll_guard(tp, &theNdb->theImpl->theWaiter,
@@ -3731,7 +3719,6 @@ NdbIndexScanOperation::ordered_send_scan
Uint32 seq= theNdbCon->theNodeSequence;
Uint32 nodeId= theNdbCon->theDBnode;
- Uint32 timeout= tp->m_waitfor_timeout;
if (seq == tp->getNodeSequence(nodeId) &&
!send_next_scan_ordered(m_current_api_receiver))
{
@@ -3821,6 +3808,7 @@ int
NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend,
PollGuard *poll_guard)
{
+ Uint32 timeout= theNdb->theImpl->get_waitfor_timeout();
Uint32 seq = theNdbCon->theNodeSequence;
Uint32 nodeId = theNdbCon->theDBnode;
@@ -3830,7 +3818,6 @@ NdbScanOperation::close_impl(Transporter
return -1;
}
- Uint32 timeout = tp->m_waitfor_timeout;
/**
* Wait for outstanding
*/
=== modified file 'storage/ndb/src/ndbapi/NdbTransaction.cpp'
--- a/storage/ndb/src/ndbapi/NdbTransaction.cpp 2010-08-09 10:20:17 +0000
+++ b/storage/ndb/src/ndbapi/NdbTransaction.cpp 2010-09-30 10:36:47 +0000
@@ -18,17 +18,7 @@
#include <ndb_global.h>
#include <NdbOut.hpp>
-#include <NdbTransaction.hpp>
-#include <NdbOperation.hpp>
-#include <NdbScanOperation.hpp>
-#include <NdbIndexScanOperation.hpp>
-#include <NdbIndexOperation.hpp>
-#include <NdbDictionaryImpl.hpp>
-#include "NdbApiSignal.hpp"
-#include "TransporterFacade.hpp"
#include "API.hpp"
-#include "NdbBlob.hpp"
-#include "NdbUtil.hpp"
#include <AttributeHeader.hpp>
#include <signaldata/TcKeyConf.hpp>
@@ -535,7 +525,7 @@ NdbTransaction::executeNoBlobs(NdbTransa
//------------------------------------------------------------------------
Ndb* tNdb = theNdb;
- Uint32 timeout = theNdb->theImpl->m_transporter_facade->m_waitfor_timeout;
+ Uint32 timeout = theNdb->theImpl->get_waitfor_timeout();
m_waitForReply = false;
executeAsynchPrepare(aTypeOfExec, NULL, NULL, abortOption);
if (m_waitForReply){
@@ -1644,7 +1634,7 @@ Parameters: aSignal: The signal objec
Remark: Sets theRestartGCI in the NDB object.
*******************************************************************************/
int
-NdbTransaction::receiveDIHNDBTAMPER(NdbApiSignal* aSignal)
+NdbTransaction::receiveDIHNDBTAMPER(const NdbApiSignal* aSignal)
{
if (theStatus != Connecting) {
return -1;
@@ -1664,7 +1654,7 @@ Parameters: aSignal: The signal objec
Remark: Sets TC Connect pointer at reception of TCSEIZECONF.
*******************************************************************************/
int
-NdbTransaction::receiveTCSEIZECONF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCSEIZECONF(const NdbApiSignal* aSignal)
{
if (theStatus != Connecting)
{
@@ -1686,7 +1676,7 @@ Parameters: aSignal: The signal objec
Remark: Sets TC Connect pointer.
*******************************************************************************/
int
-NdbTransaction::receiveTCSEIZEREF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCSEIZEREF(const NdbApiSignal* aSignal)
{
DBUG_ENTER("NdbTransaction::receiveTCSEIZEREF");
if (theStatus != Connecting)
@@ -1712,7 +1702,7 @@ Parameters: aSignal: The signal objec
Remark: DisConnect TC Connect pointer to NDBAPI.
*******************************************************************************/
int
-NdbTransaction::receiveTCRELEASECONF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCRELEASECONF(const NdbApiSignal* aSignal)
{
if (theStatus != DisConnecting)
{
@@ -1733,7 +1723,7 @@ Parameters: aSignal: The signal objec
Remark: DisConnect TC Connect pointer to NDBAPI Failure.
*******************************************************************************/
int
-NdbTransaction::receiveTCRELEASEREF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCRELEASEREF(const NdbApiSignal* aSignal)
{
if (theStatus != DisConnecting) {
return -1;
@@ -1788,7 +1778,7 @@ Parameters: aSignal: The signal objec
Remark:
******************************************************************************/
int
-NdbTransaction::receiveTC_COMMITREF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTC_COMMITREF(const NdbApiSignal* aSignal)
{
const TcCommitRef * ref = CAST_CONSTPTR(TcCommitRef, aSignal->getDataPtr());
if(checkState_TransId(&ref->transId1)){
@@ -1815,7 +1805,7 @@ Parameters: aSignal: The signal objec
Remark:
******************************************************************************/
int
-NdbTransaction::receiveTCROLLBACKCONF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCROLLBACKCONF(const NdbApiSignal* aSignal)
{
if(checkState_TransId(aSignal->getDataPtr() + 1)){
theCommitStatus = Aborted;
@@ -1839,7 +1829,7 @@ Parameters: aSignal: The signal objec
Remark:
*******************************************************************************/
int
-NdbTransaction::receiveTCROLLBACKREF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCROLLBACKREF(const NdbApiSignal* aSignal)
{
if(checkState_TransId(aSignal->getDataPtr() + 1)){
setOperationErrorCodeAbort(aSignal->readData(4));
@@ -1866,7 +1856,7 @@ Parameters: aSignal: the signal obje
Remark: Handles the reception of the ROLLBACKREP signal.
*****************************************************************************/
int
-NdbTransaction::receiveTCROLLBACKREP( NdbApiSignal* aSignal)
+NdbTransaction::receiveTCROLLBACKREP( const NdbApiSignal* aSignal)
{
DBUG_ENTER("NdbTransaction::receiveTCROLLBACKREP");
@@ -2062,7 +2052,7 @@ Parameters: aSignal: the signal obje
Remark: Handles the reception of the TCKEY_FAILREF signal.
**************************************************************************/
int
-NdbTransaction::receiveTCKEY_FAILREF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCKEY_FAILREF(const NdbApiSignal* aSignal)
{
/*
Check that we are expecting signals from this transaction and
=== modified file 'storage/ndb/src/ndbapi/NdbTransactionScan.cpp'
--- a/storage/ndb/src/ndbapi/NdbTransactionScan.cpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/ndbapi/NdbTransactionScan.cpp 2010-09-30 09:32:28 +0000
@@ -19,15 +19,7 @@
#include <ndb_global.h>
-#include <Ndb.hpp>
-#include <NdbTransaction.hpp>
-#include <NdbOperation.hpp>
-#include <NdbScanOperation.hpp>
-#include "NdbApiSignal.hpp"
-#include "TransporterFacade.hpp"
-#include "NdbUtil.hpp"
#include "API.hpp"
-#include "NdbImpl.hpp"
#include <signaldata/ScanTab.hpp>
@@ -42,7 +34,7 @@
*
****************************************************************************/
int
-NdbTransaction::receiveSCAN_TABREF(NdbApiSignal* aSignal){
+NdbTransaction::receiveSCAN_TABREF(const NdbApiSignal* aSignal){
const ScanTabRef * ref = CAST_CONSTPTR(ScanTabRef, aSignal->getDataPtr());
if(checkState_TransId(&ref->transId1)){
@@ -83,7 +75,7 @@ NdbTransaction::receiveSCAN_TABREF(NdbAp
*
*****************************************************************************/
int
-NdbTransaction::receiveSCAN_TABCONF(NdbApiSignal* aSignal,
+NdbTransaction::receiveSCAN_TABCONF(const NdbApiSignal* aSignal,
const Uint32 * ops, Uint32 len)
{
const ScanTabConf * conf = CAST_CONSTPTR(ScanTabConf, aSignal->getDataPtr());
=== modified file 'storage/ndb/src/ndbapi/NdbWaiter.hpp'
--- a/storage/ndb/src/ndbapi/NdbWaiter.hpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/ndbapi/NdbWaiter.hpp 2010-09-30 09:32:28 +0000
@@ -20,14 +20,9 @@
#define NDB_WAITER_HPP
#include <ndb_global.h>
-#include <NdbOut.hpp>
-#include <NdbError.hpp>
-#include <NdbCondition.h>
-#include <NdbReceiver.hpp>
-#include <NdbOperation.hpp>
-#include <kernel/ndb_limits.h>
-
#include <NdbTick.h>
+#include <NdbCondition.h>
+#include <NdbOut.hpp>
enum WaitSignalType {
NO_WAIT = 0,
=== modified file 'storage/ndb/src/ndbapi/Ndberr.cpp'
--- a/storage/ndb/src/ndbapi/Ndberr.cpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/ndbapi/Ndberr.cpp 2010-09-30 09:32:28 +0000
@@ -16,14 +16,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-#include <NdbError.hpp>
-#include "NdbImpl.hpp"
-#include "NdbDictionaryImpl.hpp"
-#include <NdbOperation.hpp>
-#include <NdbTransaction.hpp>
-#include <NdbBlob.hpp>
-#include "NdbEventOperationImpl.hpp"
+#include "API.hpp"
static void
update(const NdbError & _err){
=== modified file 'storage/ndb/src/ndbapi/Ndbif.cpp'
--- a/storage/ndb/src/ndbapi/Ndbif.cpp 2010-08-26 12:33:33 +0000
+++ b/storage/ndb/src/ndbapi/Ndbif.cpp 2010-09-30 11:52:49 +0000
@@ -19,16 +19,7 @@
#include <ndb_global.h>
-#include "NdbApiSignal.hpp"
-#include "NdbImpl.hpp"
-#include <NdbTransaction.hpp>
-#include <NdbOperation.hpp>
-#include <NdbIndexOperation.hpp>
-#include <NdbScanOperation.hpp>
-#include <NdbRecAttr.hpp>
-#include <NdbReceiver.hpp>
#include "API.hpp"
-#include "NdbEventOperationImpl.hpp"
#include <signaldata/TcCommit.hpp>
#include <signaldata/TcKeyFailConf.hpp>
@@ -150,7 +141,7 @@ error_handler:
ndbout << "error_handler" << endl;
releaseTransactionArrays();
delete theDictionary;
- theImpl->m_transporter_facade->close(theNdbBlockNumber, 0);
+ theImpl->m_transporter_facade->close(theNdbBlockNumber);
DBUG_RETURN(-1);
}
@@ -172,8 +163,8 @@ Ndb::releaseTransactionArrays()
void
Ndb::executeMessage(void* NdbObject,
- NdbApiSignal * aSignal,
- LinearSectionPtr ptr[3])
+ const NdbApiSignal * aSignal,
+ const LinearSectionPtr ptr[3])
{
Ndb* tNdb = (Ndb*)NdbObject;
tNdb->handleReceivedSignal(aSignal, ptr);
@@ -199,9 +190,8 @@ void Ndb::connected(Uint32 ref)
}
theImpl->theNoOfDBnodes = n;
- theFirstTransId = ((Uint64)tBlockNo << 52)+
+ theFirstTransId += ((Uint64)tBlockNo << 52)+
((Uint64)tmpTheNode << 40);
- theFirstTransId += theFacade->m_max_trans_id;
// assert(0);
DBUG_PRINT("info",("connected with ref=%x, id=%d, no_db_nodes=%d, first_trans_id: 0x%lx",
theMyRef,
@@ -343,7 +333,8 @@ Parameters: aSignal: The signal obje
Remark: Send all operations belonging to this connection.
*****************************************************************************/
void
-Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
+Ndb::handleReceivedSignal(const NdbApiSignal* aSignal,
+ const LinearSectionPtr ptr[3])
{
NdbOperation* tOp;
NdbIndexOperation* tIndexOp;
@@ -763,9 +754,15 @@ Ndb::handleReceivedSignal(NdbApiSignal*
!op->execSUB_TABLE_DATA(aSignal, ptr))
return;
- for (int i= aSignal->m_noOfSections;i < 3; i++) {
- ptr[i].p = NULL;
- ptr[i].sz = 0;
+ LinearSectionPtr copy[3];
+ for (int i = 0; i<aSignal->m_noOfSections; i++)
+ {
+ copy[i] = ptr[i];
+ }
+ for (int i = aSignal->m_noOfSections; i < 3; i++)
+ {
+ copy[i].p = NULL;
+ copy[i].sz = 0;
}
DBUG_PRINT("info",("oid=senderData: %d, gci{hi/lo}: %d/%d, operation: %d, "
"tableId: %d",
@@ -773,7 +770,7 @@ Ndb::handleReceivedSignal(NdbApiSignal*
SubTableData::getOperation(sdata->requestInfo),
sdata->tableId));
- theEventBuffer->insertDataL(op, sdata, tLen, ptr);
+ theEventBuffer->insertDataL(op, sdata, tLen, copy);
return;
}
case GSN_DIHNDBTAMPER:
@@ -1087,7 +1084,7 @@ Ndb::pollCompleted(NdbTransaction** aCop
void
Ndb::check_send_timeout()
{
- Uint32 timeout = theImpl->m_transporter_facade->m_waitfor_timeout;
+ Uint32 timeout = theImpl->get_ndbapi_config_parameters().m_waitfor_timeout;
NDB_TICKS current_time = NdbTick_CurrentMillisecond();
assert(current_time >= the_last_check_time);
if (current_time - the_last_check_time > 1000) {
=== modified file 'storage/ndb/src/ndbapi/Ndbinit.cpp'
--- a/storage/ndb/src/ndbapi/Ndbinit.cpp 2010-01-28 15:16:46 +0000
+++ b/storage/ndb/src/ndbapi/Ndbinit.cpp 2010-09-30 11:52:49 +0000
@@ -19,23 +19,15 @@
#include <ndb_global.h>
+#include "API.hpp"
#include "NdbApiSignal.hpp"
#include "NdbImpl.hpp"
-#include <NdbOperation.hpp>
-#include <NdbTransaction.hpp>
-#include <NdbRecAttr.hpp>
-#include <IPCConfig.hpp>
-#include "TransporterFacade.hpp"
#include <ConfigRetriever.hpp>
#include <ndb_limits.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
#include "ObjectMap.hpp"
-#include <NdbIndexScanOperation.hpp>
-#include <NdbIndexOperation.hpp>
#include "NdbUtil.hpp"
-#include <NdbBlob.hpp>
-#include "NdbEventOperationImpl.hpp"
#include <EventLogger.hpp>
extern EventLogger * g_eventLogger;
@@ -153,7 +145,7 @@ Ndb::~Ndb()
/* Disconnect from transporter to stop signals from coming in */
if (theImpl->m_transporter_facade != NULL && theNdbBlockNumber > 0){
- theImpl->m_transporter_facade->close(theNdbBlockNumber, theFirstTransId);
+ theImpl->m_transporter_facade->close(theNdbBlockNumber);
}
delete theEventBuffer;
=== modified file 'storage/ndb/src/ndbapi/Ndblist.cpp'
--- a/storage/ndb/src/ndbapi/Ndblist.cpp 2010-01-28 15:16:46 +0000
+++ b/storage/ndb/src/ndbapi/Ndblist.cpp 2010-09-30 09:32:28 +0000
@@ -16,16 +16,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <NdbOut.hpp>
-#include <Ndb.hpp>
-#include <NdbOperation.hpp>
-#include <NdbIndexOperation.hpp>
-#include <NdbIndexScanOperation.hpp>
-#include "NdbApiSignal.hpp"
-#include <NdbRecAttr.hpp>
-#include "NdbUtil.hpp"
#include "API.hpp"
-#include "NdbBlob.hpp"
void
Ndb::checkFailedNode()
=== modified file 'storage/ndb/src/ndbapi/SignalSender.cpp'
--- a/storage/ndb/src/ndbapi/SignalSender.cpp 2010-02-19 11:11:09 +0000
+++ b/storage/ndb/src/ndbapi/SignalSender.cpp 2010-09-30 11:52:49 +0000
@@ -17,6 +17,7 @@
*/
#include "SignalSender.hpp"
+#include <kernel/GlobalSignalNumbers.h>
#include <NdbSleep.h>
#include <SignalLoggerManager.hpp>
#include <signaldata/NFCompleteRep.hpp>
@@ -99,7 +100,7 @@ SignalSender::~SignalSender(){
int i;
if (m_lock)
unlock();
- theFacade->close(m_blockNo,0);
+ theFacade->close(m_blockNo);
// free these _after_ closing theFacade to ensure that
// we delete all signals
for (i= m_jobBuffer.size()-1; i>= 0; i--)
@@ -253,37 +254,12 @@ SignalSender::waitFor(Uint32 timeOutMill
return waitFor(timeOutMillis, w);
}
-class WaitForNode {
-public:
- WaitForNode() {}
- Uint32 m_nodeId;
- SimpleSignal * check(Vector<SimpleSignal*> & m_jobBuffer){
- Uint32 len = m_jobBuffer.size();
- for(Uint32 i = 0; i<len; i++){
- if(refToNode(m_jobBuffer[i]->header.theSendersBlockRef) == m_nodeId){
- SimpleSignal * s = m_jobBuffer[i];
- m_jobBuffer.erase(i);
- return s;
- }
- }
- return 0;
- }
-};
-
-SimpleSignal *
-SignalSender::waitFor(Uint16 nodeId, Uint32 timeOutMillis){
-
- WaitForNode w;
- w.m_nodeId = nodeId;
- return waitFor(timeOutMillis, w);
-}
-
#include <NdbApiSignal.hpp>
void
SignalSender::execSignal(void* signalSender,
- NdbApiSignal* signal,
- struct LinearSectionPtr ptr[3]){
+ const NdbApiSignal* signal,
+ const struct LinearSectionPtr ptr[3]){
SimpleSignal * s = new SimpleSignal(true);
s->header = * signal;
memcpy(&s->theData[0], signal->getDataPtr(), 4 * s->header.theLength);
@@ -411,7 +387,6 @@ SignalSender::find_alive_node(const Node
#if __SUNPRO_CC != 0x560
-template SimpleSignal* SignalSender::waitFor<WaitForNode>(unsigned, WaitForNode&);
template SimpleSignal* SignalSender::waitFor<WaitForAny>(unsigned, WaitForAny&);
template NodeId SignalSender::find_node<FindConfirmedNode>(const NodeBitmask&,
FindConfirmedNode&);
=== modified file 'storage/ndb/src/ndbapi/SignalSender.hpp'
--- a/storage/ndb/src/ndbapi/SignalSender.hpp 2010-03-16 08:54:58 +0000
+++ b/storage/ndb/src/ndbapi/SignalSender.hpp 2010-09-29 13:25:19 +0000
@@ -110,8 +110,6 @@ public:
Uint16 recBlock, Uint16 gsn, Uint32 len);
SimpleSignal * waitFor(Uint32 timeOutMillis = 0);
- SimpleSignal * waitFor(Uint16 nodeId, Uint32 timeOutMillis = 0);
- SimpleSignal * waitFor(Uint16 nodeId, Uint16 gsn, Uint32 timeOutMillis = 0);
Uint32 get_an_alive_node() const { return theFacade->get_an_alive_node(); }
Uint32 getAliveNode() const { return get_an_alive_node(); }
@@ -122,8 +120,8 @@ private:
TransporterFacade * theFacade;
static void execSignal(void* signalSender,
- NdbApiSignal* signal,
- struct LinearSectionPtr ptr[3]);
+ const NdbApiSignal* signal,
+ const struct LinearSectionPtr ptr[3]);
static void execNodeStatus(void* signalSender, Uint32 nodeId,
bool alive, bool nfCompleted);
=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.cpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.cpp 2010-08-20 08:35:41 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp 2010-09-30 11:52:49 +0000
@@ -25,11 +25,12 @@
#include <TransporterCallback.hpp>
#include <TransporterRegistry.hpp>
#include "NdbApiSignal.hpp"
+#include "NdbWaiter.hpp"
#include <NdbOut.hpp>
#include <NdbEnv.h>
#include <NdbSleep.h>
-#include "API.hpp"
+#include <kernel/GlobalSignalNumbers.h>
#include <mgmapi_config_parameters.h>
#include <mgmapi_configuration.hpp>
#include <NdbConfig.h>
@@ -724,13 +725,9 @@ TransporterFacade::TransporterFacade(Glo
theArbitMgr(NULL),
checkCounter(4),
currentSendLimit(1),
- m_scan_batch_size(MAX_SCAN_BATCH_SIZE),
- m_batch_byte_size(SCAN_BATCH_SIZE),
- m_batch_size(DEF_BATCH_SIZE),
theStopReceive(0),
theSendThread(NULL),
theReceiveThread(NULL),
- m_max_trans_id(0),
m_fragmented_signal_id(0),
m_globalDictCache(cache)
{
@@ -848,20 +845,6 @@ TransporterFacade::configure(NodeId node
theArbitMgr= NULL;
}
- // Configure scan settings
- Uint32 scan_batch_size= 0;
- if (!iter.get(CFG_MAX_SCAN_BATCH_SIZE, &scan_batch_size)) {
- m_scan_batch_size= scan_batch_size;
- }
- Uint32 batch_byte_size= 0;
- if (!iter.get(CFG_BATCH_BYTE_SIZE, &batch_byte_size)) {
- m_batch_byte_size= batch_byte_size;
- }
- Uint32 batch_size= 0;
- if (!iter.get(CFG_BATCH_SIZE, &batch_size)) {
- m_batch_size= batch_size;
- }
-
Uint32 auto_reconnect=1;
iter.get(CFG_AUTO_RECONNECT, &auto_reconnect);
@@ -879,19 +862,6 @@ TransporterFacade::configure(NodeId node
theClusterMgr->m_auto_reconnect = auto_reconnect;
}
- // Configure timeouts
- Uint32 timeout = 120000;
- for (iter.first(); iter.valid(); iter.next())
- {
- Uint32 tmp1 = 0, tmp2 = 0;
- iter.get(CFG_DB_TRANSACTION_CHECK_INTERVAL, &tmp1);
- iter.get(CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT, &tmp2);
- tmp1 += tmp2;
- if (tmp1 > timeout)
- timeout = tmp1;
- }
- m_waitfor_timeout = timeout;
-
#ifdef API_TRACE
signalLogger.logOn(true, 0, SignalLoggerManager::LogInOut);
#endif
@@ -1005,11 +975,9 @@ TransporterFacade::ReportNodeAlive(NodeI
}
int
-TransporterFacade::close(BlockNumber blockNumber, Uint64 trans_id)
+TransporterFacade::close(BlockNumber blockNumber)
{
NdbMutex_Lock(theMutexPtr);
- Uint32 low_bits = (Uint32)trans_id;
- m_max_trans_id = m_max_trans_id > low_bits ? m_max_trans_id : low_bits;
close_local(blockNumber);
NdbMutex_Unlock(theMutexPtr);
return 0;
=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.hpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.hpp 2010-08-26 12:33:33 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.hpp 2010-09-30 11:52:49 +0000
@@ -36,13 +36,12 @@ class Ndb;
class NdbApiSignal;
class NdbWaiter;
-typedef void (* ExecuteFunction)(void *, NdbApiSignal *, LinearSectionPtr ptr[3]);
+typedef void (* ExecuteFunction)(void *, const NdbApiSignal *, const LinearSectionPtr ptr[3]);
typedef void (* NodeStatusFunction)(void *, Uint32, bool nodeAlive, bool nfComplete);
extern "C" {
void* runSendRequest_C(void*);
void* runReceiveResponse_C(void*);
- void atexit_stop_instance();
}
class TransporterFacade : public TransporterCallback
@@ -74,7 +73,7 @@ public:
int blockNo = -1);
// Close this block number
- int close(BlockNumber blockNumber, Uint64 trans_id);
+ int close(BlockNumber blockNumber);
Uint32 get_active_ndb_objects() const;
// Only sends to nodes which are alive
@@ -131,12 +130,6 @@ public:
// Close this block number
int close_local(BlockNumber blockNumber);
- // Scan batch configuration parameters
- Uint32 get_scan_batch_size();
- Uint32 get_batch_byte_size();
- Uint32 get_batch_size();
- Uint32 m_waitfor_timeout; // in milli seconds...
-
TransporterRegistry* get_registry() { return theTransporterRegistry;};
/*
@@ -244,11 +237,6 @@ private:
void calculateSendLimit();
- // Scan batch configuration parameters
- Uint32 m_scan_batch_size;
- Uint32 m_batch_byte_size;
- Uint32 m_batch_size;
-
// Declarations for the receive and send thread
int theStopReceive;
@@ -259,7 +247,6 @@ private:
friend void* runSendRequest_C(void*);
friend void* runReceiveResponse_C(void*);
- friend void atexit_stop_instance();
bool do_connect_mgm(NodeId, const ndb_mgm_configuration*);
@@ -316,7 +303,6 @@ private:
} m_threads;
Uint32 m_fixed2dynamic[NO_API_FIXED_BLOCKS];
- Uint32 m_max_trans_id;
Uint32 m_fragmented_signal_id;
public:
@@ -360,6 +346,7 @@ TransporterFacade::unlock_mutex()
}
#include "ClusterMgr.hpp"
+#include "ndb_cluster_connection_impl.hpp"
inline
unsigned Ndb_cluster_connection_impl::get_connect_count() const
@@ -455,24 +442,6 @@ TransporterFacade::getMinDbNodeVersion()
return 0;
}
-inline
-Uint32
-TransporterFacade::get_scan_batch_size() {
- return m_scan_batch_size;
-}
-
-inline
-Uint32
-TransporterFacade::get_batch_byte_size() {
- return m_batch_byte_size;
-}
-
-inline
-Uint32
-TransporterFacade::get_batch_size() {
- return m_batch_size;
-}
-
/**
* LinearSectionIterator
*
=== modified file 'storage/ndb/src/ndbapi/ndb_cluster_connection.cpp'
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp 2010-05-04 14:34:54 +0000
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp 2010-09-30 11:52:49 +0000
@@ -23,7 +23,7 @@
#include "ndb_cluster_connection_impl.hpp"
#include <mgmapi_configuration.hpp>
#include <mgmapi_config_parameters.h>
-#include <TransporterFacade.hpp>
+#include "TransporterFacade.hpp"
#include <NdbOut.hpp>
#include <NdbSleep.h>
#include <NdbThread.h>
@@ -33,6 +33,8 @@
#include <mgmapi_debug.h>
#include <mgmapi_internal.h>
#include <md5_hash.hpp>
+#include "NdbImpl.hpp"
+#include "NdbDictionaryImpl.hpp"
#include <NdbMutex.h>
#ifdef VM_TRACE
@@ -302,7 +304,8 @@ Ndb_cluster_connection_impl(const char *
m_latest_trans_gci(0),
m_first_ndb_object(0),
m_latest_error_msg(),
- m_latest_error(0)
+ m_latest_error(0),
+ m_max_trans_id(0)
{
DBUG_ENTER("Ndb_cluster_connection");
DBUG_PRINT("enter",("Ndb_cluster_connection this=0x%lx", (long) this));
@@ -453,6 +456,7 @@ Ndb_cluster_connection_impl::link_ndb_ob
p->theImpl->m_next_ndb_object = m_first_ndb_object;
m_first_ndb_object = p;
+ p->theFirstTransId += m_max_trans_id;
unlock_ndb_objects();
}
@@ -481,6 +485,12 @@ Ndb_cluster_connection_impl::unlink_ndb_
p->theImpl->m_prev_ndb_object = 0;
p->theImpl->m_next_ndb_object = 0;
+ Uint32 transId = (Uint32)p->theFirstTransId;
+ if (transId > m_max_trans_id)
+ {
+ m_max_trans_id = transId;
+ }
+
unlock_ndb_objects();
}
@@ -590,6 +600,46 @@ Ndb_cluster_connection_impl::init_nodes_
DBUG_RETURN(0);
}
+int
+Ndb_cluster_connection_impl::configure(Uint32 nodeId,
+ const ndb_mgm_configuration &config)
+{
+ DBUG_ENTER("Ndb_cluster_connection_impl::configure");
+ {
+ ndb_mgm_configuration_iterator iter(config, CFG_SECTION_NODE);
+ if(iter.find(CFG_NODE_ID, nodeId))
+ DBUG_RETURN(-1);
+
+ // Configure scan settings
+ Uint32 scan_batch_size= 0;
+ if (!iter.get(CFG_MAX_SCAN_BATCH_SIZE, &scan_batch_size)) {
+ m_config.m_scan_batch_size= scan_batch_size;
+ }
+ Uint32 batch_byte_size= 0;
+ if (!iter.get(CFG_BATCH_BYTE_SIZE, &batch_byte_size)) {
+ m_config.m_batch_byte_size= batch_byte_size;
+ }
+ Uint32 batch_size= 0;
+ if (!iter.get(CFG_BATCH_SIZE, &batch_size)) {
+ m_config.m_batch_size= batch_size;
+ }
+
+ // Configure timeouts
+ Uint32 timeout = 120000;
+ for (iter.first(); iter.valid(); iter.next())
+ {
+ Uint32 tmp1 = 0, tmp2 = 0;
+ iter.get(CFG_DB_TRANSACTION_CHECK_INTERVAL, &tmp1);
+ iter.get(CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT, &tmp2);
+ tmp1 += tmp2;
+ if (tmp1 > timeout)
+ timeout = tmp1;
+ }
+ m_config.m_waitfor_timeout = timeout;
+ }
+ DBUG_RETURN(init_nodes_vector(nodeId, config));
+}
+
void
Ndb_cluster_connection_impl::do_test()
{
@@ -684,16 +734,16 @@ int Ndb_cluster_connection_impl::connect
if(props == 0)
break;
- if (m_transporter_facade->start_instance(nodeId, props) < 0)
+ if (configure(nodeId, *props))
{
ndb_mgm_destroy_configuration(props);
+ DBUG_PRINT("exit", ("malloc failure, ret: -1"));
DBUG_RETURN(-1);
}
- if (init_nodes_vector(nodeId, *props))
+ if (m_transporter_facade->start_instance(nodeId, props) < 0)
{
ndb_mgm_destroy_configuration(props);
- DBUG_PRINT("exit", ("malloc failure, ret: -1"));
DBUG_RETURN(-1);
}
=== modified file 'storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp'
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp 2010-05-04 14:34:54 +0000
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp 2010-09-30 11:52:49 +0000
@@ -37,6 +37,21 @@ extern "C" {
void* run_ndb_cluster_connection_connect_thread(void*);
}
+struct NdbApiConfig
+{
+ NdbApiConfig() :
+ m_scan_batch_size(MAX_SCAN_BATCH_SIZE),
+ m_batch_byte_size(SCAN_BATCH_SIZE),
+ m_batch_size(DEF_BATCH_SIZE),
+ m_waitfor_timeout(120000)
+ {}
+
+ Uint32 m_scan_batch_size;
+ Uint32 m_batch_byte_size;
+ Uint32 m_batch_size;
+ Uint32 m_waitfor_timeout; // in milli seconds...
+};
+
class Ndb_cluster_connection_impl : public Ndb_cluster_connection
{
Ndb_cluster_connection_impl(const char *connectstring,
@@ -75,6 +90,7 @@ private:
Vector<Node> m_all_nodes;
int init_nodes_vector(Uint32 nodeid, const ndb_mgm_configuration &config);
+ int configure(Uint32 nodeid, const ndb_mgm_configuration &config);
void connect_thread();
void set_name(const char *name);
@@ -101,6 +117,12 @@ private:
BaseString m_latest_error_msg;
unsigned m_latest_error;
+
+ // Scan batch configuration parameters
+ NdbApiConfig m_config;
+
+ // keep initial transId's increasing...
+ Uint32 m_max_trans_id;
};
#endif
=== added file 'storage/ndb/src/ndbapi/ndb_internal.cpp'
--- a/storage/ndb/src/ndbapi/ndb_internal.cpp 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/ndbapi/ndb_internal.cpp 2010-09-30 09:32:28 +0000
@@ -0,0 +1,34 @@
+/*
+ Copyright (C) 2007 MySQL AB
+ All rights reserved. Use is subject to license terms.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "API.hpp"
+#include "ndb_internal.hpp"
+
+int
+Ndb_internal::send_event_report(bool has_lock,
+ Ndb *ndb, Uint32 *data, Uint32 length)
+{
+ return ndb->theImpl->send_event_report(has_lock, data, length);
+}
+
+void
+Ndb_internal::setForceShortRequests(Ndb* ndb, bool val)
+{
+ ndb->theImpl->forceShortRequests = val;
+}
+
=== modified file 'storage/ndb/src/ndbapi/ndb_internal.hpp'
--- a/storage/ndb/src/ndbapi/ndb_internal.hpp 2009-06-22 08:23:35 +0000
+++ b/storage/ndb/src/ndbapi/ndb_internal.hpp 2010-09-30 12:52:55 +0000
@@ -16,15 +16,20 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "NdbImpl.hpp"
+#ifndef NDB_INTERNAL_HPP
+#define NDB_INTERNAL_HPP
+/**
+ * This class exposes non-public funcionality to various test/utility programs
+ */
class Ndb_internal
{
-private:
- friend class NdbEventBuffer;
- friend class BackupRestore;
+public:
Ndb_internal() {}
virtual ~Ndb_internal() {}
- static int send_event_report(bool has_lock, Ndb *ndb, Uint32 *data, Uint32 length)
- { return ndb->theImpl->send_event_report(has_lock, data, length); }
+
+ static int send_event_report(bool has_lock, Ndb *ndb, Uint32*data,Uint32 len);
+ static void setForceShortRequests(Ndb*, bool val);
};
+
+#endif
=== modified file 'storage/ndb/test/include/NdbRestarter.hpp'
--- a/storage/ndb/test/include/NdbRestarter.hpp 2010-09-20 13:09:18 +0000
+++ b/storage/ndb/test/include/NdbRestarter.hpp 2010-09-29 08:45:11 +0000
@@ -33,29 +33,34 @@ public:
enum RestartFlags {
NRRF_INITIAL = 0x1,
NRRF_NOSTART = 0x2,
- NRRF_ABORT = 0x4
+ NRRF_ABORT = 0x4,
+ NRRF_FORCE = 0x8
};
int restartOneDbNode(int _nodeId,
bool initial = false,
bool nostart = false,
- bool abort = false);
+ bool abort = false,
+ bool force = false);
int restartOneDbNode2(int _nodeId, Uint32 flags){
return restartOneDbNode(_nodeId,
flags & NRRF_INITIAL,
flags & NRRF_NOSTART,
- flags & NRRF_ABORT);
+ flags & NRRF_ABORT,
+ flags & NRRF_FORCE);
}
int restartAll(bool initial = false,
bool nostart = false,
- bool abort = false);
+ bool abort = false,
+ bool force = false);
int restartAll2(Uint32 flags){
return restartAll(flags & NRRF_INITIAL,
flags & NRRF_NOSTART,
- flags & NRRF_ABORT);
+ flags & NRRF_ABORT,
+ flags & NRRF_FORCE);
}
int restartNodes(int * nodes, int num_nodes, Uint32 flags);
=== modified file 'storage/ndb/test/ndbapi/testIndex.cpp'
--- a/storage/ndb/test/ndbapi/testIndex.cpp 2010-03-19 14:15:57 +0000
+++ b/storage/ndb/test/ndbapi/testIndex.cpp 2010-09-24 18:19:07 +0000
@@ -24,6 +24,9 @@
#include <NdbRestarts.hpp>
#include <Vector.hpp>
#include <signaldata/DumpStateOrd.hpp>
+#include <NodeBitmask.hpp>
+#include <NdbSqlUtil.hpp>
+#include <BlockNumbers.h>
#define CHECK(b) if (!(b)) { \
g_err << "ERR: "<< step->getName() \
@@ -2473,6 +2476,250 @@ runClearError(NDBT_Context* ctx, NDBT_St
return NDBT_OK;
}
+// bug#56829
+
+#undef CHECK2 // previous no good
+#define CHECK2(b, e) \
+ if (!(b)) { \
+ g_err << "ERR: " << #b << " failed at line " << __LINE__ \
+ << ": " << e << endl; \
+ result = NDBT_FAILED; \
+ break; \
+ }
+
+static int
+get_data_memory_pages(NdbMgmHandle h, NdbNodeBitmask dbmask, int* pages_out)
+{
+ int result = NDBT_OK;
+ int pages = 0;
+
+ while (1)
+ {
+ // sends dump 1000 and retrieves all replies
+ ndb_mgm_events* e = 0;
+ CHECK2((e = ndb_mgm_dump_events(h, NDB_LE_MemoryUsage, 0, 0)) != 0, ndb_mgm_get_latest_error_msg(h));
+
+ // sum up pages (also verify sanity)
+ for (int i = 0; i < e->no_of_events; i++)
+ {
+ ndb_logevent* le = &e->events[i];
+ CHECK2(le->type == NDB_LE_MemoryUsage, "bad event type " << le->type);
+ const ndb_logevent_MemoryUsage* lem = &le->MemoryUsage;
+ if (lem->block != DBTUP)
+ continue;
+ int nodeId = le->source_nodeid;
+ CHECK2(dbmask.get(nodeId), "duplicate event from node " << nodeId);
+ dbmask.clear(nodeId);
+ pages += lem->pages_used;
+ g_info << "i:" << i << " node:" << le->source_nodeid << " pages:" << lem->pages_used << endl;
+ }
+ free(e);
+ CHECK2(result == NDBT_OK, "failed");
+
+ char buf[NdbNodeBitmask::TextLength + 1];
+ CHECK2(dbmask.isclear(), "no response from nodes " << dbmask.getText(buf));
+ break;
+ }
+
+ *pages_out = pages;
+ return result;
+}
+
+int
+runBug56829(NDBT_Context* ctx, NDBT_Step* step)
+{
+ Ndb* pNdb = GETNDB(step);
+ NdbDictionary::Dictionary* pDic = pNdb->getDictionary();
+ const int loops = ctx->getNumLoops();
+ int result = NDBT_OK;
+ const NdbDictionary::Table tab(*ctx->getTab());
+ const int rows = ctx->getNumRecords();
+ const char* mgm = 0;//XXX ctx->getRemoteMgm();
+
+ char tabname[100];
+ strcpy(tabname, tab.getName());
+ char indname[100];
+ strcpy(indname, tabname);
+ strcat(indname, "X1");
+
+ (void)pDic->dropTable(tabname);
+
+ NdbMgmHandle h = 0;
+ NdbNodeBitmask dbmask;
+ // entry n marks if row with PK n exists
+ char* rowmask = new char [rows];
+ memset(rowmask, 0, rows);
+ int loop = 0;
+ while (loop < loops)
+ {
+ CHECK2(rows > 0, "rows must be != 0");
+ g_info << "loop " << loop << "<" << loops << endl;
+
+ // at first loop connect to mgm
+ if (loop == 0)
+ {
+ CHECK2((h = ndb_mgm_create_handle()) != 0, "mgm: failed to create handle");
+ CHECK2(ndb_mgm_set_connectstring(h, mgm) == 0, ndb_mgm_get_latest_error_msg(h));
+ CHECK2(ndb_mgm_connect(h, 0, 0, 0) == 0, ndb_mgm_get_latest_error_msg(h));
+ g_info << "mgm: connected to " << (mgm ? mgm : "default") << endl;
+
+ // make bitmask of DB nodes
+ dbmask.clear();
+ ndb_mgm_cluster_state* cs = 0;
+ CHECK2((cs = ndb_mgm_get_status(h)) != 0, ndb_mgm_get_latest_error_msg(h));
+ for (int j = 0; j < cs->no_of_nodes; j++)
+ {
+ ndb_mgm_node_state* ns = &cs->node_states[j];
+ if (ns->node_type == NDB_MGM_NODE_TYPE_NDB)
+ {
+ CHECK2(ns->node_status == NDB_MGM_NODE_STATUS_STARTED, "node " << ns->node_id << " not started status " << ns->node_status);
+ CHECK2(!dbmask.get(ns->node_id), "duplicate node id " << ns->node_id);
+ dbmask.set(ns->node_id);
+ g_info << "added DB node " << ns->node_id << endl;
+ }
+ }
+ free(cs);
+ CHECK2(result == NDBT_OK, "some DB nodes are not started");
+ CHECK2(!dbmask.isclear(), "found no DB nodes");
+ }
+
+ // data memory pages after following events
+ // 0-initial 1,2-create table,index 3-load 4-delete 5,6-drop index,table
+ int pages[7];
+
+ // initial
+ CHECK2(get_data_memory_pages(h, dbmask, &pages[0]) == NDBT_OK, "failed");
+ g_info << "initial pages " << pages[0] << endl;
+
+ // create table
+ g_info << "create table " << tabname << endl;
+ const NdbDictionary::Table* pTab = 0;
+ CHECK2(pDic->createTable(tab) == 0, pDic->getNdbError());
+ CHECK2((pTab = pDic->getTable(tabname)) != 0, pDic->getNdbError());
+ CHECK2(get_data_memory_pages(h, dbmask, &pages[1]) == NDBT_OK, "failed");
+ g_info << "create table pages " << pages[1] << endl;
+
+ // choice of index attributes is not relevant to this bug
+ // choose one non-PK updateable column
+ NdbDictionary::Index ind;
+ ind.setName(indname);
+ ind.setTable(tabname);
+ ind.setType(NdbDictionary::Index::OrderedIndex);
+ ind.setLogging(false);
+ {
+ HugoCalculator calc(*pTab);
+ for (int j = 0; j < pTab->getNoOfColumns(); j++)
+ {
+ const NdbDictionary::Column* col = pTab->getColumn(j);
+ if (col->getPrimaryKey() || calc.isUpdateCol(j))
+ continue;
+ CHARSET_INFO* cs = col->getCharset();
+ if (NdbSqlUtil::check_column_for_ordered_index(col->getType(), col->getCharset()) == 0)
+ {
+ ind.addColumn(*col);
+ break;
+ }
+ }
+ }
+ CHECK2(ind.getNoOfColumns() == 1, "cannot use table " << tabname);
+
+ // create index
+ g_info << "create index " << indname << " on " << ind.getColumn(0)->getName() << endl;
+ const NdbDictionary::Index* pInd = 0;
+ CHECK2(pDic->createIndex(ind, *pTab) == 0, pDic->getNdbError());
+ CHECK2((pInd = pDic->getIndex(indname, tabname)) != 0, pDic->getNdbError());
+ CHECK2(get_data_memory_pages(h, dbmask, &pages[2]) == NDBT_OK, "failed");
+ g_info << "create index pages " << pages[2] << endl;
+
+ HugoTransactions trans(*pTab);
+
+ // load all records
+ g_info << "load records" << endl;
+ CHECK2(trans.loadTable(pNdb, rows) == 0, trans.getNdbError());
+ memset(rowmask, 1, rows);
+ CHECK2(get_data_memory_pages(h, dbmask, &pages[3]) == NDBT_OK, "failed");
+ g_info << "load records pages " << pages[3] << endl;
+
+ // test index with random ops
+ g_info << "test index ops" << endl;
+ {
+ HugoOperations ops(*pTab);
+ for (int i = 0; i < rows; i++)
+ {
+ CHECK2(ops.startTransaction(pNdb) == 0, ops.getNdbError());
+ for (int j = 0; j < 32; j++)
+ {
+ int n = rand() % rows;
+ if (!rowmask[n])
+ {
+ CHECK2(ops.pkInsertRecord(pNdb, n) == 0, ops.getNdbError());
+ rowmask[n] = 1;
+ }
+ else if (rand() % 2 == 0)
+ {
+ CHECK2(ops.pkDeleteRecord(pNdb, n) == 0, ops.getNdbError());
+ rowmask[n] = 0;
+ }
+ else
+ {
+ CHECK2(ops.pkUpdateRecord(pNdb, n) == 0, ops.getNdbError());
+ }
+ }
+ CHECK2(result == NDBT_OK, "index ops batch failed");
+ CHECK2(ops.execute_Commit(pNdb) == 0, ops.getNdbError());
+ ops.closeTransaction(pNdb);
+ }
+ CHECK2(result == NDBT_OK, "index ops failed");
+ }
+
+ // delete all records
+ g_info << "delete records" << endl;
+ CHECK2(trans.clearTable(pNdb) == 0, trans.getNdbError());
+ memset(rowmask, 0, rows);
+ CHECK2(get_data_memory_pages(h, dbmask, &pages[4]) == NDBT_OK, "failed");
+ g_info << "delete records pages " << pages[4] << endl;
+
+ // drop index
+ g_info << "drop index" << endl;
+ CHECK2(pDic->dropIndex(indname, tabname) == 0, pDic->getNdbError());
+ CHECK2(get_data_memory_pages(h, dbmask, &pages[5]) == NDBT_OK, "failed");
+ g_info << "drop index pages " << pages[5] << endl;
+
+ // drop table
+ g_info << "drop table" << endl;
+ CHECK2(pDic->dropTable(tabname) == 0, pDic->getNdbError());
+ CHECK2(get_data_memory_pages(h, dbmask, &pages[6]) == NDBT_OK, "failed");
+ g_info << "drop table pages " << pages[6] << endl;
+
+ // verify
+ CHECK2(pages[1] == pages[0], "pages after create table " << pages[1]
+ << " not == initial pages " << pages[0]);
+ CHECK2(pages[2] == pages[0], "pages after create index " << pages[2]
+ << " not == initial pages " << pages[0]);
+ CHECK2(pages[3] > pages[0], "pages after load " << pages[3]
+ << " not > initial pages " << pages[0]);
+ CHECK2(pages[4] == pages[0], "pages after delete " << pages[4]
+ << " not == initial pages " << pages[0]);
+ CHECK2(pages[5] == pages[0], "pages after drop index " << pages[5]
+ << " not == initial pages " << pages[0]);
+ CHECK2(pages[6] == pages[0], "pages after drop table " << pages[6]
+ << " not == initial pages " << pages[0]);
+
+ loop++;
+
+ // at last loop disconnect from mgm
+ if (loop == loops)
+ {
+ CHECK2(ndb_mgm_disconnect(h) == 0, ndb_mgm_get_latest_error_msg(h));
+ ndb_mgm_destroy_handle(&h);
+ g_info << "mgm: disconnected" << endl;
+ }
+ }
+ delete [] rowmask;
+
+ return result;
+}
+
NDBT_TESTSUITE(testIndex);
TESTCASE("CreateAll",
@@ -2874,6 +3121,11 @@ TESTCASE("FireTrigOverload", ""){
FINALIZER(runClearError);
FINALIZER(createRandomIndex_Drop);
}
+TESTCASE("Bug56829",
+ "Return empty ordered index nodes to index fragment "
+ "so that empty fragment pages can be freed"){
+ STEP(runBug56829);
+}
NDBT_TESTSUITE_END(testIndex);
=== modified file 'storage/ndb/test/ndbapi/testNdbinfo.cpp'
--- a/storage/ndb/test/ndbapi/testNdbinfo.cpp 2010-01-26 14:02:23 +0000
+++ b/storage/ndb/test/ndbapi/testNdbinfo.cpp 2010-09-29 10:40:31 +0000
@@ -534,6 +534,15 @@ int runRestarter(NDBT_Context* ctx, NDBT
NDBT_TESTSUITE(testNdbinfo);
+#ifndef NDB_WIN
+/**
+ * TODO NdbRestarter does not work on windoze
+ */
+TESTCASE("NodeRestart", "Scan NdbInfo tables while restarting nodes"){
+ STEP(runRestarter);
+ STEPS(runTestTableUntilStopped, 1);
+}
+#endif
TESTCASE("Ndbinfo",
"Test ndbapi interface to NDB$INFO"){
INITIALIZER(runTestNdbInfo);
@@ -566,15 +575,6 @@ TESTCASE("TestTable",
"of rows which will depend on how many TUP blocks are configured"){
STEP(runTestTable);
}
-#ifndef NDB_WIN
-/**
- * TODO NdbRestarter does not work on windoze
- */
-TESTCASE("NodeRestart", "Scan NdbInfo tables while restarting nodes"){
- STEP(runRestarter);
- STEPS(runTestTableUntilStopped, 1);
-}
-#endif
NDBT_TESTSUITE_END(testNdbinfo);
=== modified file 'storage/ndb/test/ndbapi/testNodeRestart.cpp'
--- a/storage/ndb/test/ndbapi/testNodeRestart.cpp 2010-08-17 10:11:01 +0000
+++ b/storage/ndb/test/ndbapi/testNodeRestart.cpp 2010-09-29 08:45:11 +0000
@@ -3976,6 +3976,95 @@ runBug56044(NDBT_Context* ctx, NDBT_Step
return NDBT_OK;
}
+int
+runForceStopAndRestart(NDBT_Context* ctx, NDBT_Step* step)
+{
+ NdbRestarter res;
+ if (res.getNumDbNodes() < 2)
+ return NDBT_OK;
+
+ Vector<int> group1;
+ Vector<int> group2;
+ Bitmask<256/32> nodeGroupMap;
+ for (int j = 0; j<res.getNumDbNodes(); j++)
+ {
+ int node = res.getDbNodeId(j);
+ int ng = res.getNodeGroup(node);
+ if (nodeGroupMap.get(ng))
+ {
+ group2.push_back(node);
+ }
+ else
+ {
+ group1.push_back(node);
+ nodeGroupMap.set(ng);
+ }
+ }
+
+ // Stop half of the cluster
+ res.restartNodes(group1.getBase(), (int)group1.size(),
+ NdbRestarter::NRRF_NOSTART);
+ res.waitNodesNoStart(group1.getBase(), (int)group1.size());
+
+ // Try to stop first node in second half without force, should return error
+ if (res.restartOneDbNode(group2[0],
+ false, /* initial */
+ true, /* nostart */
+ false, /* abort */
+ false /* force */) != -1)
+ {
+ g_err << "Restart suceeded without force" << endl;
+ return NDBT_FAILED;
+ }
+
+ // Now stop with force
+ if (res.restartOneDbNode(group2[0],
+ false, /* initial */
+ true, /* nostart */
+ false, /* abort */
+ true /* force */) != 0)
+ {
+ g_err << "Could not restart with force" << endl;
+ return NDBT_FAILED;
+ }
+
+ // All nodes should now be in nostart, the above stop force
+ // cvaused the remainig nodes to be stopped(and restarted nostart)
+ res.waitClusterNoStart();
+
+ // Start second half back up again
+ res.startNodes(group2.getBase(), (int)group2.size());
+ res.waitNodesStarted(group2.getBase(), (int)group2.size());
+
+ // Try to stop remaining half without force, should return error
+ if (res.restartNodes(group2.getBase(), (int)group2.size(),
+ NdbRestarter::NRRF_NOSTART) != -1)
+ {
+ g_err << "Restart suceeded without force" << endl;
+ return NDBT_FAILED;
+ }
+
+ // Now stop with force
+ if (res.restartNodes(group2.getBase(), (int)group2.size(),
+ NdbRestarter::NRRF_NOSTART |
+ NdbRestarter::NRRF_FORCE) != 0)
+ {
+ g_err << "Could not restart with force" << endl;
+ return NDBT_FAILED;
+ }
+ if (res.waitNodesNoStart(group2.getBase(), (int)group2.size()))
+ {
+ g_err << "Failed to waitNodesNoStart" << endl;
+ return NDBT_FAILED;
+ }
+
+ // Start all nodes again
+ res.startAll();
+ res.waitClusterStarted();
+
+ return NDBT_OK;
+}
+
NDBT_TESTSUITE(testNodeRestart);
TESTCASE("NoLoad",
"Test that one node at a time can be stopped and then restarted "\
@@ -4494,6 +4583,10 @@ TESTCASE("Bug56044", "")
{
INITIALIZER(runBug56044);
}
+TESTCASE("ForceStopAndRestart", "Test restart and stop -with force flag")
+{
+ STEP(runForceStopAndRestart);
+}
NDBT_TESTSUITE_END(testNodeRestart);
int main(int argc, const char** argv){
=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt 2010-09-23 06:22:44 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt 2010-09-29 08:54:47 +0000
@@ -1593,3 +1593,12 @@ max-time: 500
cmd: testDict
args: -n Bug53944 T1
+max-time: 300
+cmd: testIndex
+args: -n Bug56829 T1
+
+max-time: 500
+cmd testNodeRestart
+args: -n ForceStopAndRestart T1
+
+
=== modified file 'storage/ndb/test/src/NDBT_Test.cpp'
--- a/storage/ndb/test/src/NDBT_Test.cpp 2010-08-16 17:02:58 +0000
+++ b/storage/ndb/test/src/NDBT_Test.cpp 2010-09-30 09:32:28 +0000
@@ -260,7 +260,7 @@ NDBT_Step::NDBT_Step(NDBT_TestCase* ptes
{
}
-#include <../../src/ndbapi/NdbImpl.hpp>
+#include "../../src/ndbapi/ndb_internal.hpp"
int
NDBT_Step::setUp(Ndb_cluster_connection& con){
@@ -275,8 +275,8 @@ NDBT_Step::setUp(Ndb_cluster_connection&
m_ndb = new Ndb(&con, "TEST_DB" );
m_ndb->init(1024);
- NdbImpl::setForceShortRequests(m_ndb,
- m_ctx->suite->getForceShort());
+ Ndb_internal::setForceShortRequests(m_ndb,
+ m_ctx->suite->getForceShort());
int result = m_ndb->waitUntilReady(300); // 5 minutes
if (result != 0){
@@ -931,7 +931,7 @@ NDBT_TestSuite::executeOneCtx(Ndb_cluste
Ndb ndb(&con, "TEST_DB");
ndb.init(1024);
- NdbImpl::setForceShortRequests(&ndb, m_forceShort);
+ Ndb_internal::setForceShortRequests(&ndb, m_forceShort);
int result = ndb.waitUntilReady(300); // 5 minutes
if (result != 0){
=== modified file 'storage/ndb/test/src/NdbRestarter.cpp'
--- a/storage/ndb/test/src/NdbRestarter.cpp 2010-09-20 13:09:18 +0000
+++ b/storage/ndb/test/src/NdbRestarter.cpp 2010-09-29 08:45:11 +0000
@@ -73,11 +73,14 @@ int
NdbRestarter::restartOneDbNode(int _nodeId,
bool inital,
bool nostart,
- bool abort){
+ bool abort,
+ bool force)
+{
return restartNodes(&_nodeId, 1,
(inital ? NRRF_INITIAL : 0) |
(nostart ? NRRF_NOSTART : 0) |
- (abort ? NRRF_ABORT : 0));
+ (abort ? NRRF_ABORT : 0) |
+ (force ? NRRF_FORCE : 0));
}
int
@@ -88,14 +91,16 @@ NdbRestarter::restartNodes(int * nodes,
return -1;
int ret = 0;
-
- if ((ret = ndb_mgm_restart2(handle, cnt, nodes,
+ int unused;
+ if ((ret = ndb_mgm_restart4(handle, cnt, nodes,
(flags & NRRF_INITIAL),
(flags & NRRF_NOSTART),
- (flags & NRRF_ABORT))) <= 0)
+ (flags & NRRF_ABORT),
+ (flags & NRRF_FORCE),
+ &unused)) <= 0)
{
/**
- * ndb_mgm_restart2 returned error, one reason could
+ * ndb_mgm_restart4 returned error, one reason could
* be that the node have not stopped fast enough!
* Check status of the node to see if it's on the
* way down. If that's the case ignore the error
@@ -104,7 +109,7 @@ NdbRestarter::restartNodes(int * nodes,
if (getStatus() != 0)
return -1;
- g_info << "ndb_mgm_restart2 returned with error, checking node state"
+ g_info << "ndb_mgm_restart4 returned with error, checking node state"
<< endl;
for (int j = 0; j<cnt; j++)
@@ -623,12 +628,15 @@ int NdbRestarter::getNumDbNodes(){
int NdbRestarter::restartAll(bool initial,
bool nostart,
- bool abort){
-
+ bool abort,
+ bool force)
+{
if (!isConnected())
return -1;
- if (ndb_mgm_restart2(handle, 0, NULL, initial, 1, abort) == -1) {
+ int unused;
+ if (ndb_mgm_restart4(handle, 0, NULL, initial, 1, abort,
+ force, &unused) == -1) {
MGMERR(handle);
g_err << "Could not restart(stop) all nodes " << endl;
// return -1; Continue anyway - Magnus
Attachment: [text/bzr-bundle] bzr/msabaratnam@mysql.com-20101001085344-q1hrlum61xf2evjf.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0-mai branch (msabaratnam:3253) | Maitrayi Sabaratnam | 1 Oct |