diff options
author | tomas@whalegate.ndb.mysql.com <> | 2007-11-16 11:24:44 +0100 |
---|---|---|
committer | tomas@whalegate.ndb.mysql.com <> | 2007-11-16 11:24:44 +0100 |
commit | a018fb92ef7403a17c6dc3fac15343a4cd3cb3bf (patch) | |
tree | 5849727fd740662c147b9b6a1f163edbc05bf872 /storage/ndb | |
parent | 9eb3a99e67ef2c97d66530b0a83e1e5246af1dca (diff) | |
parent | 5af22b0d515988db8a380a3b17b825316f04c9d0 (diff) | |
download | mariadb-git-a018fb92ef7403a17c6dc3fac15343a4cd3cb3bf.tar.gz |
Merge whalegate.ndb.mysql.com:/home/tomas/cge-5.1
into whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb-merge
Diffstat (limited to 'storage/ndb')
-rw-r--r-- | storage/ndb/src/common/transporter/Transporter.cpp | 4 | ||||
-rw-r--r-- | storage/ndb/src/common/transporter/TransporterRegistry.cpp | 3 | ||||
-rw-r--r-- | storage/ndb/src/kernel/blocks/suma/Suma.cpp | 48 | ||||
-rw-r--r-- | storage/ndb/test/tools/Makefile.am | 3 | ||||
-rw-r--r-- | storage/ndb/test/tools/connect.cpp | 152 |
5 files changed, 206 insertions, 4 deletions
diff --git a/storage/ndb/src/common/transporter/Transporter.cpp b/storage/ndb/src/common/transporter/Transporter.cpp index cec018575e0..269a5fba4e9 100644 --- a/storage/ndb/src/common/transporter/Transporter.cpp +++ b/storage/ndb/src/common/transporter/Transporter.cpp @@ -70,7 +70,7 @@ Transporter::Transporter(TransporterRegistry &t_reg, signalIdUsed = _signalId; m_connected = false; - m_timeOutMillis = 1000; + m_timeOutMillis = 30000; m_connect_address.s_addr= 0; if(s_port<0) @@ -101,7 +101,7 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) { if(m_connected) { - DBUG_RETURN(true); // TODO assert(0); + DBUG_RETURN(false); // TODO assert(0); } { diff --git a/storage/ndb/src/common/transporter/TransporterRegistry.cpp b/storage/ndb/src/common/transporter/TransporterRegistry.cpp index 5f5f3c17b2d..848738b2983 100644 --- a/storage/ndb/src/common/transporter/TransporterRegistry.cpp +++ b/storage/ndb/src/common/transporter/TransporterRegistry.cpp @@ -758,7 +758,8 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis) TCP_Transporter * t = theTCPTransporters[i]; // If the transporter is connected - if (t->isConnected()) { + NodeId nodeId = t->getRemoteNodeId(); + if (is_connected(nodeId) && t->isConnected()) { const NDB_SOCKET_TYPE socket = t->getSocket(); // Find the highest socket value. It will be used by select diff --git a/storage/ndb/src/kernel/blocks/suma/Suma.cpp b/storage/ndb/src/kernel/blocks/suma/Suma.cpp index 7845b83693c..a4e886b14b6 100644 --- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp +++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp @@ -974,6 +974,54 @@ Suma::execDUMP_STATE_ORD(Signal* signal){ } return; } + + if (tCase == 8011) + { + jam(); + Uint32 bucket = signal->theData[1]; + KeyTable<Table>::Iterator it; + if (signal->getLength() == 1) + { + jam(); + bucket = 0; + infoEvent("-- Starting dump of subscribers --"); + } + + c_tables.next(bucket, it); + const Uint32 RT_BREAK = 16; + for(Uint32 i = 0; i<RT_BREAK || it.bucket == bucket; i++) + { + jam(); + if(it.curr.i == RNIL) + { + jam(); + infoEvent("-- Ending dump of subscribers --"); + return; + } + + infoEvent("Table: %u ver: %u #n: %u (ref,data,subscritopn)", + it.curr.p->m_tableId, + it.curr.p->m_schemaVersion, + it.curr.p->n_subscribers); + + Ptr<Subscriber> ptr; + LocalDLList<Subscriber> list(c_subscriberPool, it.curr.p->c_subscribers); + for (list.first(ptr); !ptr.isNull(); list.next(ptr), i++) + { + jam(); + infoEvent(" [ %x %u %u ]", + ptr.p->m_senderRef, + ptr.p->m_senderData, + ptr.p->m_subPtrI); + } + c_tables.next(it); + } + + signal->theData[0] = tCase; + signal->theData[1] = it.bucket; + sendSignalWithDelay(reference(), GSN_DUMP_STATE_ORD, signal, 100, 2); + return; + } } /************************************************************* diff --git a/storage/ndb/test/tools/Makefile.am b/storage/ndb/test/tools/Makefile.am index 1683d4d84ae..da715caa1cb 100644 --- a/storage/ndb/test/tools/Makefile.am +++ b/storage/ndb/test/tools/Makefile.am @@ -13,7 +13,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -ndbtest_PROGRAMS = hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc listen_event eventlog rep_latency +ndbtest_PROGRAMS = hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc listen_event eventlog rep_latency ndb_connect # transproxy @@ -35,6 +35,7 @@ ndb_cpcc_SOURCES = cpcc.cpp listen_event_SOURCES = listen.cpp eventlog_SOURCES = log_listner.cpp rep_latency_SOURCES = rep_latency.cpp +ndb_connect_SOURCES = connect.cpp include $(top_srcdir)/storage/ndb/config/common.mk.am include $(top_srcdir)/storage/ndb/config/type_ndbapitest.mk.am diff --git a/storage/ndb/test/tools/connect.cpp b/storage/ndb/test/tools/connect.cpp new file mode 100644 index 00000000000..2d3ac34d3e8 --- /dev/null +++ b/storage/ndb/test/tools/connect.cpp @@ -0,0 +1,152 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <ndb_global.h> +#include <ndb_opts.h> +#include <NDBT.hpp> +#include <NdbApi.hpp> +#include <NdbSleep.h> + +NDB_STD_OPTS_VARS; + +static int _loop = 25; +static int _sleep = 25; +static int _drop = 1; + +typedef uchar* gptr; + +static struct my_option my_long_options[] = +{ + NDB_STD_OPTS("ndb_desc"), + { "loop", 'l', "loops", + (gptr*) &_loop, (gptr*) &_loop, 0, + GET_INT, REQUIRED_ARG, _loop, 0, 0, 0, 0, 0 }, + { "sleep", 's', "Sleep (ms) between connection attempt", + (gptr*) &_sleep, (gptr*) &_sleep, 0, + GET_INT, REQUIRED_ARG, _sleep, 0, 0, 0, 0, 0 }, + { "drop", 'd', + "Drop event operations before disconnect (0 = no, 1 = yes, else rand", + (gptr*) &_drop, (gptr*) &_drop, 0, + GET_INT, REQUIRED_ARG, _drop, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} +}; + +static void usage() +{ + char desc[] = "This program connects to ndbd, and then disconnects\n"; + ndb_std_print_version(); + my_print_help(my_long_options); + my_print_variables(my_long_options); +} + +int main(int argc, char** argv){ + NDB_INIT(argv[0]); + + const char *load_default_groups[]= { "mysql_cluster",0 }; + load_defaults("my",load_default_groups,&argc,&argv); + int ho_error; +#ifndef DBUG_OFF + opt_debug= "d:t:O,/tmp/ndb_desc.trace"; +#endif + if ((ho_error=handle_options(&argc, &argv, my_long_options, + ndb_std_get_one_option))) + return NDBT_ProgramExit(NDBT_WRONGARGS); + + for (int i = 0; i<_loop; i++) + { + Ndb_cluster_connection con(opt_connect_str); + if(con.connect(12, 5, 1) != 0) + { + ndbout << "Unable to connect to management server." << endl; + return NDBT_ProgramExit(NDBT_FAILED); + } + if (con.wait_until_ready(30,30) != 0) + { + ndbout << "Cluster nodes not ready in 30 seconds." << endl; + return NDBT_ProgramExit(NDBT_FAILED); + } + + Ndb MyNdb(&con, "TEST_DB"); + if(MyNdb.init() != 0){ + ERR(MyNdb.getNdbError()); + return NDBT_ProgramExit(NDBT_FAILED); + } + + Vector<NdbEventOperation*> ops; + const NdbDictionary::Dictionary * dict= MyNdb.getDictionary(); + for (int j = 0; j < argc; j++) + { + const NdbDictionary::Table * pTab = dict->getTable(argv[j]); + if (pTab == 0) + { + ndbout_c("Failed to retreive table: \"%s\"", argv[j]); + } + + BaseString tmp; + tmp.appfmt("EV-%s", argv[j]); + NdbEventOperation* pOp = MyNdb.createEventOperation(tmp.c_str()); + if ( pOp == NULL ) + { + ndbout << "Event operation creation failed: " << + MyNdb.getNdbError() << endl; + return NDBT_ProgramExit(NDBT_FAILED); + } + + for (int a = 0; a < pTab->getNoOfColumns(); a++) + { + pOp->getValue(pTab->getColumn(a)->getName()); + pOp->getPreValue(pTab->getColumn(a)->getName()); + } + + if (pOp->execute()) + { + ndbout << "operation execution failed: " << pOp->getNdbError() + << endl; + return NDBT_ProgramExit(NDBT_FAILED); + } + ops.push_back(pOp); + } + + if (_sleep) + { + NdbSleep_MilliSleep(10 + rand() % _sleep); + } + + for (Uint32 i = 0; i<ops.size(); i++) + { + switch(_drop){ + case 0: + break; + do_drop: + case 1: + if (MyNdb.dropEventOperation(ops[i])) + { + ndbout << "drop event operation failed " + << MyNdb.getNdbError() << endl; + return NDBT_ProgramExit(NDBT_FAILED); + } + break; + default: + if ((rand() % 100) > 50) + goto do_drop; + } + } + } + + return NDBT_ProgramExit(NDBT_OK); +} + +template class Vector<NdbEventOperation*>; |