summaryrefslogtreecommitdiff
path: root/ndb/src
diff options
context:
space:
mode:
authorunknown <serg@sergbook.mysql.com>2004-12-31 18:01:00 +0100
committerunknown <serg@sergbook.mysql.com>2004-12-31 18:01:00 +0100
commit9c92a25524183a88c46474bab10313eb8b9edbab (patch)
tree73d60625dbb0c5e0d654eb089086cb4785040288 /ndb/src
parent6b393398744ec96a8f912b88d3a880114038aa12 (diff)
parent31c4511d1794079f3951d741901cbd4440da4e5c (diff)
downloadmariadb-git-9c92a25524183a88c46474bab10313eb8b9edbab.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into sergbook.mysql.com:/usr/home/serg/Abk/mysql-5.0 mysql-test/r/user_limits.result: Auto merged mysql-test/t/user_limits.test: Auto merged
Diffstat (limited to 'ndb/src')
-rw-r--r--ndb/src/common/logger/LogHandler.cpp62
-rw-r--r--ndb/src/common/logger/Logger.cpp4
-rw-r--r--ndb/src/common/mgmcommon/IPCConfig.cpp2
-rw-r--r--ndb/src/common/transporter/Makefile.am2
-rw-r--r--ndb/src/common/transporter/SCI_Transporter.cpp3
-rw-r--r--ndb/src/common/transporter/SHM_Transporter.cpp6
-rw-r--r--ndb/src/common/transporter/TCP_Transporter.cpp3
-rw-r--r--ndb/src/common/transporter/Transporter.cpp71
-rw-r--r--ndb/src/common/transporter/Transporter.hpp4
-rw-r--r--ndb/src/common/transporter/TransporterRegistry.cpp137
-rw-r--r--ndb/src/kernel/main.cpp2
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp37
-rw-r--r--ndb/src/mgmsrv/main.cpp10
-rw-r--r--ndb/src/ndbapi/Ndb.cpp2
-rw-r--r--ndb/src/ndbapi/NdbBlob.cpp63
-rw-r--r--ndb/src/ndbapi/NdbBlobImpl.hpp39
-rw-r--r--ndb/src/ndbapi/NdbConnection.cpp7
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp7
-rw-r--r--ndb/src/ndbapi/NdbOperationDefine.cpp4
-rw-r--r--ndb/src/ndbapi/NdbOperationInt.cpp18
-rw-r--r--ndb/src/ndbapi/Ndbinit.cpp21
-rw-r--r--ndb/src/ndbapi/ndb_cluster_connection.cpp22
22 files changed, 359 insertions, 167 deletions
diff --git a/ndb/src/common/logger/LogHandler.cpp b/ndb/src/common/logger/LogHandler.cpp
index a76cb622878..e038b05401e 100644
--- a/ndb/src/common/logger/LogHandler.cpp
+++ b/ndb/src/common/logger/LogHandler.cpp
@@ -24,7 +24,13 @@
LogHandler::LogHandler() :
m_pDateTimeFormat("%d-%.2d-%.2d %.2d:%.2d:%.2d"),
m_errorCode(0)
-{
+{
+ m_max_repeat_frequency= 3; // repeat messages maximum every 3 seconds
+ m_count_repeated_messages= 0;
+ m_last_category[0]= 0;
+ m_last_message[0]= 0;
+ m_last_log_time= 0;
+ m_now= 0;
}
LogHandler::~LogHandler()
@@ -34,11 +40,53 @@ LogHandler::~LogHandler()
void
LogHandler::append(const char* pCategory, Logger::LoggerLevel level,
const char* pMsg)
-{
+{
+ time_t now;
+ now= ::time((time_t*)NULL);
+
+ if (level != m_last_level ||
+ strcmp(pCategory, m_last_category) ||
+ strcmp(pMsg, m_last_message))
+ {
+ if (m_count_repeated_messages > 0) // print that message
+ append_impl(m_last_category, m_last_level, m_last_message);
+
+ m_last_level= level;
+ strncpy(m_last_category, pCategory, sizeof(m_last_category));
+ strncpy(m_last_message, pMsg, sizeof(m_last_message));
+ }
+ else // repeated message
+ {
+ if (now < m_last_log_time+m_max_repeat_frequency)
+ {
+ m_count_repeated_messages++;
+ m_now= now;
+ return;
+ }
+ }
+
+ m_now= now;
+
+ append_impl(pCategory, level, pMsg);
+ m_last_log_time= now;
+}
+
+void
+LogHandler::append_impl(const char* pCategory, Logger::LoggerLevel level,
+ const char* pMsg)
+{
writeHeader(pCategory, level);
- writeMessage(pMsg);
+ if (m_count_repeated_messages == 0)
+ writeMessage(pMsg);
+ else
+ {
+ BaseString str(pMsg);
+ str.appfmt(" - Repeated %d times", m_count_repeated_messages);
+ writeMessage(str.c_str());
+ m_count_repeated_messages= 0;
+ }
writeFooter();
-}
+}
const char*
LogHandler::getDefaultHeader(char* pStr, const char* pCategory,
@@ -76,12 +124,10 @@ char*
LogHandler::getTimeAsString(char* pStr) const
{
struct tm* tm_now;
- time_t now;
- now = ::time((time_t*)NULL);
#ifdef NDB_WIN32
- tm_now = localtime(&now);
+ tm_now = localtime(&m_now);
#else
- tm_now = ::localtime(&now); //uses the "current" timezone
+ tm_now = ::localtime(&m_now); //uses the "current" timezone
#endif
BaseString::snprintf(pStr, MAX_DATE_TIME_HEADER_LENGTH,
diff --git a/ndb/src/common/logger/Logger.cpp b/ndb/src/common/logger/Logger.cpp
index 4fa7b462563..7f18f5bd3ec 100644
--- a/ndb/src/common/logger/Logger.cpp
+++ b/ndb/src/common/logger/Logger.cpp
@@ -355,11 +355,11 @@ Logger::log(LoggerLevel logLevel, const char* pMsg, va_list ap) const
LogHandler* pHandler = NULL;
while ( (pHandler = m_pHandlerList->next()) != NULL)
{
- char buf[1024];
+ char buf[MAX_LOG_MESSAGE_SIZE];
BaseString::vsnprintf(buf, sizeof(buf), pMsg, ap);
pHandler->append(m_pCategory, logLevel, buf);
}
- }
+ }
}
//
diff --git a/ndb/src/common/mgmcommon/IPCConfig.cpp b/ndb/src/common/mgmcommon/IPCConfig.cpp
index 780504d2c62..1da03e3eaf2 100644
--- a/ndb/src/common/mgmcommon/IPCConfig.cpp
+++ b/ndb/src/common/mgmcommon/IPCConfig.cpp
@@ -383,6 +383,8 @@ IPCConfig::configureTransporters(Uint32 nodeId,
if(iter.get(CFG_SHM_BUFFER_MEM, &conf.shmSize)) break;
conf.port= server_port;
+ conf.localHostName = localHostName;
+ conf.remoteHostName = remoteHostName;
if(!tr.createTransporter(&conf)){
DBUG_PRINT("error", ("Failed to create SHM Transporter from %d to %d",
diff --git a/ndb/src/common/transporter/Makefile.am b/ndb/src/common/transporter/Makefile.am
index d76b1b6048b..b902012e56d 100644
--- a/ndb/src/common/transporter/Makefile.am
+++ b/ndb/src/common/transporter/Makefile.am
@@ -13,7 +13,7 @@ EXTRA_libtransporter_la_SOURCES = SHM_Transporter.cpp SHM_Transporter.unix.cpp S
libtransporter_la_LIBADD = @ndb_transporter_opt_objs@
libtransporter_la_DEPENDENCIES = @ndb_transporter_opt_objs@
-INCLUDES_LOC = -I$(top_srcdir)/ndb/include/kernel -I$(top_srcdir)/ndb/include/transporter @NDB_SCI_INCLUDES@
+INCLUDES_LOC = -I$(top_srcdir)/ndb/include/mgmapi -I$(top_srcdir)/ndb/include/debugger -I$(top_srcdir)/ndb/include/kernel -I$(top_srcdir)/ndb/include/transporter @NDB_SCI_INCLUDES@
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_util.mk.am
diff --git a/ndb/src/common/transporter/SCI_Transporter.cpp b/ndb/src/common/transporter/SCI_Transporter.cpp
index 73fbb064599..e7807c972b1 100644
--- a/ndb/src/common/transporter/SCI_Transporter.cpp
+++ b/ndb/src/common/transporter/SCI_Transporter.cpp
@@ -44,7 +44,8 @@ SCI_Transporter::SCI_Transporter(TransporterRegistry &t_reg,
bool chksm,
bool signalId,
Uint32 reportFreq) :
- Transporter(t_reg, lHostName, rHostName, r_port, _localNodeId,
+ Transporter(t_reg, tt_SCI_TRANSPORTER,
+ lHostName, rHostName, r_port, _localNodeId,
_remoteNodeId, 0, false, chksm, signalId)
{
DBUG_ENTER("SCI_Transporter::SCI_Transporter");
diff --git a/ndb/src/common/transporter/SHM_Transporter.cpp b/ndb/src/common/transporter/SHM_Transporter.cpp
index e4051519b86..ffb51bf1326 100644
--- a/ndb/src/common/transporter/SHM_Transporter.cpp
+++ b/ndb/src/common/transporter/SHM_Transporter.cpp
@@ -38,7 +38,8 @@ SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
bool signalId,
key_t _shmKey,
Uint32 _shmSize) :
- Transporter(t_reg, lHostName, rHostName, r_port, lNodeId, rNodeId,
+ Transporter(t_reg, tt_SHM_TRANSPORTER,
+ lHostName, rHostName, r_port, lNodeId, rNodeId,
0, false, checksum, signalId),
shmKey(_shmKey),
shmSize(_shmSize)
@@ -256,6 +257,9 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
SocketOutputStream s_output(sockfd);
char buf[256];
+#if 1
+#endif
+
// Wait for server to create and attach
if (s_input.gets(buf, 256) == 0) {
NDB_CLOSE_SOCKET(sockfd);
diff --git a/ndb/src/common/transporter/TCP_Transporter.cpp b/ndb/src/common/transporter/TCP_Transporter.cpp
index 524ecd653e0..a629b620157 100644
--- a/ndb/src/common/transporter/TCP_Transporter.cpp
+++ b/ndb/src/common/transporter/TCP_Transporter.cpp
@@ -72,7 +72,8 @@ TCP_Transporter::TCP_Transporter(TransporterRegistry &t_reg,
NodeId rNodeId,
bool chksm, bool signalId,
Uint32 _reportFreq) :
- Transporter(t_reg, lHostName, rHostName, r_port, lNodeId, rNodeId,
+ Transporter(t_reg, tt_TCP_TRANSPORTER,
+ lHostName, rHostName, r_port, lNodeId, rNodeId,
0, false, chksm, signalId),
m_sendBuffer(sendBufSize)
{
diff --git a/ndb/src/common/transporter/Transporter.cpp b/ndb/src/common/transporter/Transporter.cpp
index ee25d97feef..b84f8f6fb5e 100644
--- a/ndb/src/common/transporter/Transporter.cpp
+++ b/ndb/src/common/transporter/Transporter.cpp
@@ -24,7 +24,11 @@
#include <InputStream.hpp>
#include <OutputStream.hpp>
+#include <EventLogger.hpp>
+extern EventLogger g_eventLogger;
+
Transporter::Transporter(TransporterRegistry &t_reg,
+ TransporterType _type,
const char *lHostName,
const char *rHostName,
int r_port,
@@ -35,8 +39,10 @@ Transporter::Transporter(TransporterRegistry &t_reg,
: m_r_port(r_port), remoteNodeId(rNodeId), localNodeId(lNodeId),
isServer(lNodeId < rNodeId),
m_packer(_signalId, _checksum),
+ m_type(_type),
m_transporter_registry(t_reg)
{
+ DBUG_ENTER("Transporter::Transporter");
if (rHostName && strlen(rHostName) > 0){
strncpy(remoteHostName, rHostName, sizeof(remoteHostName));
Ndb_getInAddr(&remoteHostAddress, rHostName);
@@ -55,6 +61,11 @@ Transporter::Transporter(TransporterRegistry &t_reg,
if (strlen(lHostName) > 0)
Ndb_getInAddr(&localHostAddress, lHostName);
+ DBUG_PRINT("info",("rId=%d lId=%d isServer=%d rHost=%s lHost=%s r_port=%d",
+ remoteNodeId, localNodeId, isServer,
+ remoteHostName, localHostName,
+ r_port));
+
byteOrder = _byteorder;
compressionUsed = _compression;
checksumUsed = _checksum;
@@ -67,7 +78,9 @@ Transporter::Transporter(TransporterRegistry &t_reg,
m_socket_client= 0;
else
m_socket_client= new SocketClient(remoteHostName, r_port,
- new SocketAuthSimple("ndbd", "ndbd passwd"));
+ new SocketAuthSimple("ndbd",
+ "ndbd passwd"));
+ DBUG_VOID_RETURN;
}
Transporter::~Transporter(){
@@ -77,8 +90,13 @@ Transporter::~Transporter(){
bool
Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
+ // all initial negotiation is done in TransporterRegistry::connect_server
+ DBUG_ENTER("Transporter::connect_server");
+
if(m_connected)
- return true; // TODO assert(0);
+ {
+ DBUG_RETURN(true); // TODO assert(0);
+ }
bool res = connect_server_impl(sockfd);
if(res){
@@ -86,7 +104,7 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
m_errorCount = 0;
}
- return res;
+ DBUG_RETURN(res);
}
bool
@@ -98,27 +116,60 @@ Transporter::connect_client() {
if (sockfd == NDB_INVALID_SOCKET)
return false;
- // send info about own id
+ DBUG_ENTER("Transporter::connect_client");
+
+ // send info about own id
+ // send info about own transporter type
SocketOutputStream s_output(sockfd);
- s_output.println("%d", localNodeId);
+ s_output.println("%d %d", localNodeId, m_type);
// get remote id
- int nodeId;
+ int nodeId, remote_transporter_type= -1;
SocketInputStream s_input(sockfd);
char buf[256];
if (s_input.gets(buf, 256) == 0) {
NDB_CLOSE_SOCKET(sockfd);
- return false;
+ DBUG_RETURN(false);
}
- if (sscanf(buf, "%d", &nodeId) != 1) {
+
+ int r= sscanf(buf, "%d %d", &nodeId, &remote_transporter_type);
+ switch (r) {
+ case 2:
+ break;
+ case 1:
+ // we're running version prior to 4.1.9
+ // ok, but with no checks on transporter configuration compatability
+ break;
+ default:
NDB_CLOSE_SOCKET(sockfd);
- return false;
+ DBUG_RETURN(false);
}
+
+ DBUG_PRINT("info", ("nodeId=%d remote_transporter_type=%d",
+ nodeId, remote_transporter_type));
+
+ if (remote_transporter_type != -1)
+ {
+ if (remote_transporter_type != m_type)
+ {
+ DBUG_PRINT("error", ("Transporter types mismatch this=%d remote=%d",
+ m_type, remote_transporter_type));
+ NDB_CLOSE_SOCKET(sockfd);
+ g_eventLogger.error("Incompatible configuration: transporter type "
+ "mismatch with node %d", nodeId);
+ DBUG_RETURN(false);
+ }
+ }
+ else if (m_type == tt_SHM_TRANSPORTER)
+ {
+ g_eventLogger.warning("Unable to verify transporter compatability with node %d", nodeId);
+ }
+
bool res = connect_client_impl(sockfd);
if(res){
m_connected = true;
m_errorCount = 0;
}
- return res;
+ DBUG_RETURN(res);
}
void
diff --git a/ndb/src/common/transporter/Transporter.hpp b/ndb/src/common/transporter/Transporter.hpp
index 9a39f8788bc..baff6d53dd8 100644
--- a/ndb/src/common/transporter/Transporter.hpp
+++ b/ndb/src/common/transporter/Transporter.hpp
@@ -71,6 +71,7 @@ public:
protected:
Transporter(TransporterRegistry &,
+ TransporterType,
const char *lHostName,
const char *rHostName,
int r_port,
@@ -127,6 +128,7 @@ protected:
protected:
bool m_connected; // Are we connected
+ TransporterType m_type;
TransporterRegistry &m_transporter_registry;
void *get_callback_obj() { return m_transporter_registry.callbackObj; };
@@ -149,7 +151,7 @@ Transporter::getRemoteNodeId() const {
inline
NodeId
Transporter::getLocalNodeId() const {
- return remoteNodeId;
+ return localNodeId;
}
inline
diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp
index be51e9223ba..2eb81b2b35d 100644
--- a/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -47,6 +47,9 @@
#include <InputStream.hpp>
#include <OutputStream.hpp>
+#include <EventLogger.hpp>
+extern EventLogger g_eventLogger;
+
int g_shm_pid = 0;
SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd)
@@ -57,49 +60,10 @@ SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd)
DBUG_RETURN(0);
}
+ if (!m_transporter_registry->connect_server(sockfd))
{
- // read node id from client
- int nodeId;
- SocketInputStream s_input(sockfd);
- char buf[256];
- if (s_input.gets(buf, 256) == 0) {
- NDB_CLOSE_SOCKET(sockfd);
- DBUG_PRINT("error", ("Could not get node id from client"));
- DBUG_RETURN(0);
- }
- if (sscanf(buf, "%d", &nodeId) != 1) {
- NDB_CLOSE_SOCKET(sockfd);
- DBUG_PRINT("error", ("Error in node id from client"));
- DBUG_RETURN(0);
- }
-
- //check that nodeid is valid and that there is an allocated transporter
- if ( nodeId < 0 || nodeId >= (int)m_transporter_registry->maxTransporters) {
- NDB_CLOSE_SOCKET(sockfd);
- DBUG_PRINT("error", ("Node id out of range from client"));
- DBUG_RETURN(0);
- }
- if (m_transporter_registry->theTransporters[nodeId] == 0) {
- NDB_CLOSE_SOCKET(sockfd);
- DBUG_PRINT("error", ("No transporter for this node id from client"));
- DBUG_RETURN(0);
- }
-
- //check that the transporter should be connected
- if (m_transporter_registry->performStates[nodeId] != TransporterRegistry::CONNECTING) {
- NDB_CLOSE_SOCKET(sockfd);
- DBUG_PRINT("error", ("Transporter in wrong state for this node id from client"));
- DBUG_RETURN(0);
- }
-
- Transporter *t= m_transporter_registry->theTransporters[nodeId];
-
- // send info about own id (just as response to acknowledge connection)
- SocketOutputStream s_output(sockfd);
- s_output.println("%d", t->getLocalNodeId());
-
- // setup transporter (transporter responsible for closing sockfd)
- t->connect_server(sockfd);
+ NDB_CLOSE_SOCKET(sockfd);
+ DBUG_RETURN(0);
}
DBUG_RETURN(0);
@@ -196,6 +160,91 @@ TransporterRegistry::init(NodeId nodeId) {
}
bool
+TransporterRegistry::connect_server(NDB_SOCKET_TYPE sockfd)
+{
+ DBUG_ENTER("TransporterRegistry::connect_server");
+
+ // read node id from client
+ // read transporter type
+ int nodeId, remote_transporter_type= -1;
+ SocketInputStream s_input(sockfd);
+ char buf[256];
+ if (s_input.gets(buf, 256) == 0) {
+ DBUG_PRINT("error", ("Could not get node id from client"));
+ DBUG_RETURN(false);
+ }
+ int r= sscanf(buf, "%d %d", &nodeId, &remote_transporter_type);
+ switch (r) {
+ case 2:
+ break;
+ case 1:
+ // we're running version prior to 4.1.9
+ // ok, but with no checks on transporter configuration compatability
+ break;
+ default:
+ DBUG_PRINT("error", ("Error in node id from client"));
+ DBUG_RETURN(false);
+ }
+
+ DBUG_PRINT("info", ("nodeId=%d remote_transporter_type=%d",
+ nodeId,remote_transporter_type));
+
+ //check that nodeid is valid and that there is an allocated transporter
+ if ( nodeId < 0 || nodeId >= (int)maxTransporters) {
+ DBUG_PRINT("error", ("Node id out of range from client"));
+ DBUG_RETURN(false);
+ }
+ if (theTransporters[nodeId] == 0) {
+ DBUG_PRINT("error", ("No transporter for this node id from client"));
+ DBUG_RETURN(false);
+ }
+
+ //check that the transporter should be connected
+ if (performStates[nodeId] != TransporterRegistry::CONNECTING) {
+ DBUG_PRINT("error", ("Transporter in wrong state for this node id from client"));
+ DBUG_RETURN(false);
+ }
+
+ Transporter *t= theTransporters[nodeId];
+
+ // send info about own id (just as response to acknowledge connection)
+ // send info on own transporter type
+ SocketOutputStream s_output(sockfd);
+ s_output.println("%d %d", t->getLocalNodeId(), t->m_type);
+
+ if (remote_transporter_type != -1)
+ {
+ if (remote_transporter_type != t->m_type)
+ {
+ DBUG_PRINT("error", ("Transporter types mismatch this=%d remote=%d",
+ t->m_type, remote_transporter_type));
+ g_eventLogger.error("Incompatible configuration: Transporter type "
+ "mismatch with node %d", nodeId);
+
+ // wait for socket close for 1 second to let message arrive at client
+ {
+ fd_set a_set;
+ FD_ZERO(&a_set);
+ FD_SET(sockfd, &a_set);
+ struct timeval timeout;
+ timeout.tv_sec = 1; timeout.tv_usec = 0;
+ select(sockfd+1, &a_set, 0, 0, &timeout);
+ }
+ DBUG_RETURN(false);
+ }
+ }
+ else if (t->m_type == tt_SHM_TRANSPORTER)
+ {
+ g_eventLogger.warning("Unable to verify transporter compatability with node %d", nodeId);
+ }
+
+ // setup transporter (transporter responsible for closing sockfd)
+ t->connect_server(sockfd);
+
+ DBUG_RETURN(true);
+}
+
+bool
TransporterRegistry::createTransporter(TCP_TransporterConfiguration *config) {
#ifdef NDB_TCP_TRANSPORTER
@@ -358,8 +407,8 @@ TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) {
return false;
SHM_Transporter * t = new SHM_Transporter(*this,
- "localhost",
- "localhost",
+ config->localHostName,
+ config->remoteHostName,
config->port,
localNodeId,
config->remoteNodeId,
diff --git a/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp
index 44fe1725c9e..448bdd9a1fa 100644
--- a/ndb/src/kernel/main.cpp
+++ b/ndb/src/kernel/main.cpp
@@ -58,7 +58,7 @@ int main(int argc, char** argv)
// Print to stdout/console
g_eventLogger.createConsoleHandler();
g_eventLogger.setCategory("NDB");
- g_eventLogger.enable(Logger::LL_INFO, Logger::LL_ALERT); // Log INFO to ALERT
+ g_eventLogger.enable(Logger::LL_ON, Logger::LL_ERROR);
globalEmulatorData.create();
diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index 3fcde997cb0..f698099141a 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -133,8 +133,7 @@ MgmtSrvr::signalRecvThreadRun()
}
}
-
-EventLogger g_EventLogger;
+extern EventLogger g_eventLogger;
static NdbOut&
operator<<(NdbOut& out, const LogLevel & ll)
@@ -200,7 +199,7 @@ MgmtSrvr::logLevelThreadRun()
void
MgmtSrvr::startEventLog()
{
- g_EventLogger.setCategory("MgmSrvr");
+ g_eventLogger.setCategory("MgmSrvr");
ndb_mgm_configuration_iterator * iter = ndb_mgm_create_configuration_iterator
((ndb_mgm_configuration*)_config->m_configValues, CFG_SECTION_NODE);
@@ -226,7 +225,7 @@ MgmtSrvr::startEventLog()
logdest.assfmt("FILE:filename=%s,maxsize=1000000,maxfiles=6",
clusterLog);
}
- if(!g_EventLogger.addHandler(logdest)) {
+ if(!g_eventLogger.addHandler(logdest)) {
ndbout << "Warning: could not add log destination \""
<< logdest.c_str() << "\"" << endl;
}
@@ -250,21 +249,21 @@ MgmtSrvr::setEventLogFilter(int severity, int enable)
{
Logger::LoggerLevel level = (Logger::LoggerLevel)severity;
if (enable > 0) {
- g_EventLogger.enable(level);
+ g_eventLogger.enable(level);
} else if (enable == 0) {
- g_EventLogger.disable(level);
- } else if (g_EventLogger.isEnable(level)) {
- g_EventLogger.disable(level);
+ g_eventLogger.disable(level);
+ } else if (g_eventLogger.isEnable(level)) {
+ g_eventLogger.disable(level);
} else {
- g_EventLogger.enable(level);
+ g_eventLogger.enable(level);
}
- return g_EventLogger.isEnable(level);
+ return g_eventLogger.isEnable(level);
}
bool
MgmtSrvr::isEventLogFilterEnabled(int severity)
{
- return g_EventLogger.isEnable((Logger::LoggerLevel)severity);
+ return g_eventLogger.isEnable((Logger::LoggerLevel)severity);
}
static ErrorItem errorTable[] =
@@ -1990,7 +1989,7 @@ MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal)
}
default:
- g_EventLogger.error("Unknown signal received. SignalNumber: "
+ g_eventLogger.error("Unknown signal received. SignalNumber: "
"%i from (%d, %x)",
gsn,
refToNode(signal->theSendersBlockRef),
@@ -2066,7 +2065,7 @@ MgmtSrvr::handleStopReply(NodeId nodeId, Uint32 errCode)
error:
if(errCode != 0){
- g_EventLogger.error("Unexpected signal received. SignalNumber: %i from %d",
+ g_eventLogger.error("Unexpected signal received. SignalNumber: %i from %d",
GSN_STOP_REF, nodeId);
}
}
@@ -2286,7 +2285,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
m_reserved_nodes.set(id_found);
char tmp_str[128];
m_reserved_nodes.getText(tmp_str);
- g_EventLogger.info("Mgmt server state: nodeid %d reserved for ip %s, m_reserved_nodes %s.",
+ g_eventLogger.info("Mgmt server state: nodeid %d reserved for ip %s, m_reserved_nodes %s.",
id_found, get_connect_address(id_found), tmp_str);
DBUG_RETURN(true);
}
@@ -2346,7 +2345,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
*nodeId);
}
- g_EventLogger.warning("Allocate nodeid (%d) failed. Connection from ip %s. "
+ g_eventLogger.warning("Allocate nodeid (%d) failed. Connection from ip %s. "
"Returned error string \"%s\"",
*nodeId,
client_addr != 0 ? inet_ntoa(((struct sockaddr_in *)(client_addr))->sin_addr) : "<none>",
@@ -2369,10 +2368,10 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
}
}
if (tmp_connected.length() > 0)
- g_EventLogger.info("Mgmt server state: node id's %s connected but not reserved",
+ g_eventLogger.info("Mgmt server state: node id's %s connected but not reserved",
tmp_connected.c_str());
if (tmp_not_connected.length() > 0)
- g_EventLogger.info("Mgmt server state: node id's %s not connected but reserved",
+ g_eventLogger.info("Mgmt server state: node id's %s not connected but reserved",
tmp_not_connected.c_str());
}
DBUG_RETURN(false);
@@ -2404,7 +2403,7 @@ MgmtSrvr::eventReport(NodeId nodeId, const Uint32 * theData)
EventReport::EventType type = eventReport->getEventType();
// Log event
- g_EventLogger.log(type, theData, nodeId,
+ g_eventLogger.log(type, theData, nodeId,
&m_event_listner[0].m_logLevel);
m_event_listner.log(type, theData, nodeId);
}
@@ -2647,7 +2646,7 @@ MgmtSrvr::Allocated_resources::~Allocated_resources()
char tmp_str[128];
m_mgmsrv.m_reserved_nodes.getText(tmp_str);
- g_EventLogger.info("Mgmt server state: nodeid %d freed, m_reserved_nodes %s.",
+ g_eventLogger.info("Mgmt server state: nodeid %d freed, m_reserved_nodes %s.",
get_nodeid(), tmp_str);
}
}
diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp
index aa2cefae38c..4a8b79d3ddc 100644
--- a/ndb/src/mgmsrv/main.cpp
+++ b/ndb/src/mgmsrv/main.cpp
@@ -86,7 +86,7 @@ static MgmGlobals glob;
* Global variables
*/
bool g_StopServer;
-extern EventLogger g_EventLogger;
+extern EventLogger g_eventLogger;
extern int global_mgmt_server_check;
@@ -284,12 +284,12 @@ int main(int argc, char** argv)
BaseString::snprintf(msg, sizeof(msg),
"NDB Cluster Management Server. %s", NDB_VERSION_STRING);
ndbout_c(msg);
- g_EventLogger.info(msg);
+ g_eventLogger.info(msg);
BaseString::snprintf(msg, 256, "Id: %d, Command port: %d",
glob.localNodeId, glob.port);
ndbout_c(msg);
- g_EventLogger.info(msg);
+ g_eventLogger.info(msg);
g_StopServer = false;
glob.socketServer->startServer();
@@ -305,10 +305,10 @@ int main(int argc, char** argv)
NdbSleep_MilliSleep(500);
}
- g_EventLogger.info("Shutting down server...");
+ g_eventLogger.info("Shutting down server...");
glob.socketServer->stopServer();
glob.socketServer->stopSessions();
- g_EventLogger.info("Shutdown complete");
+ g_eventLogger.info("Shutdown complete");
return 0;
error_end:
return 1;
diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp
index e9a125922c6..b5493622b70 100644
--- a/ndb/src/ndbapi/Ndb.cpp
+++ b/ndb/src/ndbapi/Ndb.cpp
@@ -282,7 +282,7 @@ Ndb::waitUntilReady(int timeout)
}
if (theImpl->m_ndb_cluster_connection.wait_until_ready
- (timeout-secondsCounter,30))
+ (timeout-secondsCounter,30) < 0)
{
theError.code = 4009;
DBUG_RETURN(-1);
diff --git a/ndb/src/ndbapi/NdbBlob.cpp b/ndb/src/ndbapi/NdbBlob.cpp
index 0a1433c71f3..c72568f7201 100644
--- a/ndb/src/ndbapi/NdbBlob.cpp
+++ b/ndb/src/ndbapi/NdbBlob.cpp
@@ -21,6 +21,7 @@
#include <NdbIndexOperation.hpp>
#include <NdbRecAttr.hpp>
#include <NdbBlob.hpp>
+#include "NdbBlobImpl.hpp"
#include <NdbScanOperation.hpp>
#ifdef NDB_BLOB_DEBUG
@@ -85,14 +86,14 @@ void
NdbBlob::getBlobTableName(char* btname, const NdbTableImpl* t, const NdbColumnImpl* c)
{
assert(t != 0 && c != 0 && c->getBlobType());
- memset(btname, 0, BlobTableNameSize);
+ memset(btname, 0, NdbBlobImpl::BlobTableNameSize);
sprintf(btname, "NDB$BLOB_%d_%d", (int)t->m_tableId, (int)c->m_attrId);
}
void
NdbBlob::getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnImpl* c)
{
- char btname[BlobTableNameSize];
+ char btname[NdbBlobImpl::BlobTableNameSize];
getBlobTableName(btname, t, c);
bt.setName(btname);
bt.setLogging(t->getLogging());
@@ -450,15 +451,15 @@ NdbBlob::getValue(void* data, Uint32 bytes)
{
DBG("getValue data=" << hex << data << " bytes=" << dec << bytes);
if (theGetFlag || theState != Prepared) {
- setErrorCode(ErrState);
+ setErrorCode(NdbBlobImpl::ErrState);
return -1;
}
if (! isReadOp() && ! isScanOp()) {
- setErrorCode(ErrUsage);
+ setErrorCode(NdbBlobImpl::ErrUsage);
return -1;
}
if (data == NULL && bytes != 0) {
- setErrorCode(ErrUsage);
+ setErrorCode(NdbBlobImpl::ErrUsage);
return -1;
}
theGetFlag = true;
@@ -472,15 +473,15 @@ NdbBlob::setValue(const void* data, Uint32 bytes)
{
DBG("setValue data=" << hex << data << " bytes=" << dec << bytes);
if (theSetFlag || theState != Prepared) {
- setErrorCode(ErrState);
+ setErrorCode(NdbBlobImpl::ErrState);
return -1;
}
if (! isInsertOp() && ! isUpdateOp() && ! isWriteOp()) {
- setErrorCode(ErrUsage);
+ setErrorCode(NdbBlobImpl::ErrUsage);
return -1;
}
if (data == NULL && bytes != 0) {
- setErrorCode(ErrUsage);
+ setErrorCode(NdbBlobImpl::ErrUsage);
return -1;
}
theSetFlag = true;
@@ -512,7 +513,7 @@ NdbBlob::setActiveHook(ActiveHook activeHook, void* arg)
{
DBG("setActiveHook hook=" << hex << (void*)activeHook << " arg=" << hex << arg);
if (theState != Prepared) {
- setErrorCode(ErrState);
+ setErrorCode(NdbBlobImpl::ErrState);
return -1;
}
theActiveHook = activeHook;
@@ -531,7 +532,7 @@ NdbBlob::getNull(bool& isNull)
return 0;
}
if (theNullFlag == -1) {
- setErrorCode(ErrState);
+ setErrorCode(NdbBlobImpl::ErrState);
return -1;
}
isNull = theNullFlag;
@@ -546,7 +547,7 @@ NdbBlob::setNull()
if (theState == Prepared) {
return setValue(0, 0);
}
- setErrorCode(ErrState);
+ setErrorCode(NdbBlobImpl::ErrState);
return -1;
}
if (theNullFlag)
@@ -568,7 +569,7 @@ NdbBlob::getLength(Uint64& len)
return 0;
}
if (theNullFlag == -1) {
- setErrorCode(ErrState);
+ setErrorCode(NdbBlobImpl::ErrState);
return -1;
}
len = theLength;
@@ -580,7 +581,7 @@ NdbBlob::truncate(Uint64 length)
{
DBG("truncate [in] length=" << length);
if (theNullFlag == -1) {
- setErrorCode(ErrState);
+ setErrorCode(NdbBlobImpl::ErrState);
return -1;
}
if (theLength > length) {
@@ -608,7 +609,7 @@ NdbBlob::getPos(Uint64& pos)
{
DBG("getPos");
if (theNullFlag == -1) {
- setErrorCode(ErrState);
+ setErrorCode(NdbBlobImpl::ErrState);
return -1;
}
pos = thePos;
@@ -620,11 +621,11 @@ NdbBlob::setPos(Uint64 pos)
{
DBG("setPos pos=" << pos);
if (theNullFlag == -1) {
- setErrorCode(ErrState);
+ setErrorCode(NdbBlobImpl::ErrState);
return -1;
}
if (pos > theLength) {
- setErrorCode(ErrSeek);
+ setErrorCode(NdbBlobImpl::ErrSeek);
return -1;
}
thePos = pos;
@@ -637,7 +638,7 @@ int
NdbBlob::readData(void* data, Uint32& bytes)
{
if (theState != Active) {
- setErrorCode(ErrState);
+ setErrorCode(NdbBlobImpl::ErrState);
return -1;
}
char* buf = static_cast<char*>(data);
@@ -666,7 +667,7 @@ NdbBlob::readDataPrivate(char* buf, Uint32& bytes)
}
}
if (len > 0 && thePartSize == 0) {
- setErrorCode(ErrSeek);
+ setErrorCode(NdbBlobImpl::ErrSeek);
return -1;
}
if (len > 0) {
@@ -731,7 +732,7 @@ int
NdbBlob::writeData(const void* data, Uint32 bytes)
{
if (theState != Active) {
- setErrorCode(ErrState);
+ setErrorCode(NdbBlobImpl::ErrState);
return -1;
}
const char* buf = static_cast<const char*>(data);
@@ -764,7 +765,7 @@ NdbBlob::writeDataPrivate(const char* buf, Uint32 bytes)
}
}
if (len > 0 && thePartSize == 0) {
- setErrorCode(ErrSeek);
+ setErrorCode(NdbBlobImpl::ErrSeek);
return -1;
}
if (len > 0) {
@@ -1081,7 +1082,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
theFillChar = 0x20;
break;
default:
- setErrorCode(ErrUsage);
+ setErrorCode(NdbBlobImpl::ErrUsage);
return -1;
}
// sizes
@@ -1099,7 +1100,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
(bc = bt->getColumn("DATA")) == NULL ||
bc->getType() != partType ||
bc->getLength() != (int)thePartSize) {
- setErrorCode(ErrTable);
+ setErrorCode(NdbBlobImpl::ErrTable);
return -1;
}
theBlobTable = &NdbTableImpl::getImpl(*bt);
@@ -1120,7 +1121,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
Uint32* data = (Uint32*)theKeyBuf.data;
unsigned size = theTable->m_keyLenInWords;
if (theNdbOp->getKeyFromTCREQ(data, size) == -1) {
- setErrorCode(ErrUsage);
+ setErrorCode(NdbBlobImpl::ErrUsage);
return -1;
}
}
@@ -1129,7 +1130,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
Uint32* data = (Uint32*)theAccessKeyBuf.data;
unsigned size = theAccessTable->m_keyLenInWords;
if (theNdbOp->getKeyFromTCREQ(data, size) == -1) {
- setErrorCode(ErrUsage);
+ setErrorCode(NdbBlobImpl::ErrUsage);
return -1;
}
}
@@ -1158,7 +1159,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
supportedOp = true;
}
if (! supportedOp) {
- setErrorCode(ErrUsage);
+ setErrorCode(NdbBlobImpl::ErrUsage);
return -1;
}
setState(Prepared);
@@ -1204,7 +1205,7 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch)
tOp->updateTuple() == -1 ||
setTableKeyValue(tOp) == -1 ||
setHeadInlineValue(tOp) == -1) {
- setErrorCode(ErrAbort);
+ setErrorCode(NdbBlobImpl::ErrAbort);
return -1;
}
DBG("add op to update head+inline");
@@ -1434,7 +1435,7 @@ NdbBlob::postExecute(ExecType anExecType)
tOp->updateTuple() == -1 ||
setTableKeyValue(tOp) == -1 ||
setHeadInlineValue(tOp) == -1) {
- setErrorCode(ErrAbort);
+ setErrorCode(NdbBlobImpl::ErrAbort);
return -1;
}
tOp->m_abortOption = AbortOnError;
@@ -1464,7 +1465,7 @@ NdbBlob::preCommit()
tOp->updateTuple() == -1 ||
setTableKeyValue(tOp) == -1 ||
setHeadInlineValue(tOp) == -1) {
- setErrorCode(ErrAbort);
+ setErrorCode(NdbBlobImpl::ErrAbort);
return -1;
}
tOp->m_abortOption = AbortOnError;
@@ -1489,7 +1490,7 @@ NdbBlob::atNextResult()
{ Uint32* data = (Uint32*)theKeyBuf.data;
unsigned size = theTable->m_keyLenInWords;
if (((NdbScanOperation*)theNdbOp)->getKeyFromKEYINFO20(data, size) == -1) {
- setErrorCode(ErrUsage);
+ setErrorCode(NdbBlobImpl::ErrUsage);
return -1;
}
}
@@ -1545,7 +1546,7 @@ NdbBlob::setErrorCode(NdbOperation* anOp, bool invalidFlag)
else if ((code = theNdb->theError.code) != 0)
;
else
- code = ErrUnknown;
+ code = NdbBlobImpl::ErrUnknown;
setErrorCode(code, invalidFlag);
}
@@ -1558,7 +1559,7 @@ NdbBlob::setErrorCode(NdbConnection* aCon, bool invalidFlag)
else if ((code = theNdb->theError.code) != 0)
;
else
- code = ErrUnknown;
+ code = NdbBlobImpl::ErrUnknown;
setErrorCode(code, invalidFlag);
}
diff --git a/ndb/src/ndbapi/NdbBlobImpl.hpp b/ndb/src/ndbapi/NdbBlobImpl.hpp
new file mode 100644
index 00000000000..0030e910c52
--- /dev/null
+++ b/ndb/src/ndbapi/NdbBlobImpl.hpp
@@ -0,0 +1,39 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef NdbBlobImpl_H
+#define NdbBlobImpl_H
+
+class NdbBlobImpl {
+public:
+ STATIC_CONST( BlobTableNameSize = 40 );
+ // "Invalid blob attributes or invalid blob parts table"
+ STATIC_CONST( ErrTable = 4263 );
+ // "Invalid usage of blob attribute"
+ STATIC_CONST( ErrUsage = 4264 );
+ // "Method is not valid in current blob state"
+ STATIC_CONST( ErrState = 4265 );
+ // "Invalid blob seek position"
+ STATIC_CONST( ErrSeek = 4266 );
+ // "Corrupted blob value"
+ STATIC_CONST( ErrCorrupt = 4267 );
+ // "Error in blob head update forced rollback of transaction"
+ STATIC_CONST( ErrAbort = 4268 );
+ // "Unknown blob error"
+ STATIC_CONST( ErrUnknown = 4269 );
+};
+
+#endif
diff --git a/ndb/src/ndbapi/NdbConnection.cpp b/ndb/src/ndbapi/NdbConnection.cpp
index 29959a4ed7e..aa4f68a85b4 100644
--- a/ndb/src/ndbapi/NdbConnection.cpp
+++ b/ndb/src/ndbapi/NdbConnection.cpp
@@ -361,11 +361,10 @@ NdbConnection::execute(ExecType aTypeOfExec,
if (executeNoBlobs(tExecType, abortOption, forceSend) == -1)
ret = -1;
-#ifndef VM_TRACE
- // can happen in complex abort cases
- theFirstOpInList = theLastOpInList = NULL;
-#else
+#ifdef ndb_api_crash_on_complex_blob_abort
assert(theFirstOpInList == NULL && theLastOpInList == NULL);
+#else
+ theFirstOpInList = theLastOpInList = NULL;
#endif
{
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index d39b921072b..b3b8e48edd1 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -34,7 +34,8 @@
#include <AttributeList.hpp>
#include <NdbEventOperation.hpp>
#include "NdbEventOperationImpl.hpp"
-#include "NdbBlob.hpp"
+#include <NdbBlob.hpp>
+#include "NdbBlobImpl.hpp"
#include <AttributeHeader.hpp>
#include <my_sys.h>
@@ -1381,7 +1382,7 @@ NdbDictionaryImpl::addBlobTables(NdbTableImpl &t)
if (! c.getBlobType() || c.getPartSize() == 0)
continue;
n--;
- char btname[NdbBlob::BlobTableNameSize];
+ char btname[NdbBlobImpl::BlobTableNameSize];
NdbBlob::getBlobTableName(btname, &t, &c);
// Save BLOB table handle
NdbTableImpl * cachedBlobTable = getTable(btname);
@@ -1789,7 +1790,7 @@ NdbDictionaryImpl::dropBlobTables(NdbTableImpl & t)
NdbColumnImpl & c = *t.m_columns[i];
if (! c.getBlobType() || c.getPartSize() == 0)
continue;
- char btname[NdbBlob::BlobTableNameSize];
+ char btname[NdbBlobImpl::BlobTableNameSize];
NdbBlob::getBlobTableName(btname, &t, &c);
if (dropTable(btname) != 0) {
if (m_error.code != 709){
diff --git a/ndb/src/ndbapi/NdbOperationDefine.cpp b/ndb/src/ndbapi/NdbOperationDefine.cpp
index d9aa860f71f..bc960a72d2e 100644
--- a/ndb/src/ndbapi/NdbOperationDefine.cpp
+++ b/ndb/src/ndbapi/NdbOperationDefine.cpp
@@ -523,7 +523,9 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo,
CHARSET_INFO* cs = tAttrInfo->m_cs;
// invalid data can crash kernel
if (cs != NULL &&
- (*cs->cset->well_formed_len)(cs,
+ // fast fix bug#7340
+ tAttrInfo->m_type != NdbDictionary::Column::Text &&
+ (*cs->cset->well_formed_len)(cs,
aValue,
aValue + sizeInBytes,
sizeInBytes) != sizeInBytes) {
diff --git a/ndb/src/ndbapi/NdbOperationInt.cpp b/ndb/src/ndbapi/NdbOperationInt.cpp
index ee7b8132cd1..ace90e35ca4 100644
--- a/ndb/src/ndbapi/NdbOperationInt.cpp
+++ b/ndb/src/ndbapi/NdbOperationInt.cpp
@@ -15,21 +15,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/************************************************************************************************
-Name: NdbOperationInt.C
-Include:
-Link:
-Author: UABRONM Mikael Ronström UAB/M/MT
-Date: 991029
-Version: 0.1
-Description: Interpreted operations in NDB API
-Documentation:
-Adjust: 991029 UABRONM First version.
-************************************************************************************************/
-#include "NdbOperation.hpp"
+#include <ndb_global.h>
+#include <NdbOperation.hpp>
#include "NdbApiSignal.hpp"
-#include "NdbConnection.hpp"
-#include "Ndb.hpp"
+#include <NdbConnection.hpp>
+#include <Ndb.hpp>
#include "NdbRecAttr.hpp"
#include "NdbUtil.hpp"
#include "Interpreter.hpp"
diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp
index e1af7bd4cc5..a11dd842495 100644
--- a/ndb/src/ndbapi/Ndbinit.cpp
+++ b/ndb/src/ndbapi/Ndbinit.cpp
@@ -204,14 +204,6 @@ Ndb::~Ndb()
TransporterFacade::instance()->close(theNdbBlockNumber, theFirstTransId);
}
- if (global_ndb_cluster_connection != 0) {
- theNoOfNdbObjects--;
- if(theNoOfNdbObjects == 0){
- delete global_ndb_cluster_connection;
- global_ndb_cluster_connection= 0;
- }
- }//if
-
// if (theSchemaConToNdbList != NULL)
// closeSchemaTransaction(theSchemaConToNdbList);
while ( theConIdleList != NULL )
@@ -249,6 +241,19 @@ Ndb::~Ndb()
delete theImpl;
+ /**
+ * This needs to be put after delete theImpl
+ * as TransporterFacade::instance is delete by global_ndb_cluster_connection
+ * and used by theImpl
+ */
+ if (global_ndb_cluster_connection != 0) {
+ theNoOfNdbObjects--;
+ if(theNoOfNdbObjects == 0){
+ delete global_ndb_cluster_connection;
+ global_ndb_cluster_connection= 0;
+ }
+ }//if
+
/**
* This sleep is to make sure that the transporter
* send thread will come in and send any
diff --git a/ndb/src/ndbapi/ndb_cluster_connection.cpp b/ndb/src/ndbapi/ndb_cluster_connection.cpp
index 98a52786aab..5df707e211d 100644
--- a/ndb/src/ndbapi/ndb_cluster_connection.cpp
+++ b/ndb/src/ndbapi/ndb_cluster_connection.cpp
@@ -31,6 +31,9 @@
#include <Vector.hpp>
#include <md5_hash.hpp>
+#include <EventLogger.hpp>
+EventLogger g_eventLogger;
+
static int g_run_connect_thread= 0;
#include <NdbMutex.h>
@@ -174,7 +177,7 @@ Ndb_cluster_connection_impl::get_next_node(Ndb_cluster_connection_node_iter &ite
return node.id;
}
-Uint32
+unsigned
Ndb_cluster_connection::no_db_nodes()
{
return m_impl.m_all_nodes.size();
@@ -219,16 +222,8 @@ Ndb_cluster_connection::wait_until_ready(int timeout,
else if (foundAliveNode > 0)
{
noChecksSinceFirstAliveFound++;
- if (timeout_after_first_alive >= 0)
- {
- if (noChecksSinceFirstAliveFound > timeout_after_first_alive)
- DBUG_RETURN(0);
- }
- else // timeout_after_first_alive < 0
- {
- if (noChecksSinceFirstAliveFound > -timeout_after_first_alive)
- DBUG_RETURN(-1);
- }
+ if (noChecksSinceFirstAliveFound > timeout_after_first_alive)
+ DBUG_RETURN(1);
}
else if (secondsCounter >= timeout)
{ // no alive nodes and timed out
@@ -256,6 +251,11 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
{
DBUG_ENTER("Ndb_cluster_connection");
DBUG_PRINT("enter",("Ndb_cluster_connection this=0x%x", this));
+
+ g_eventLogger.createConsoleHandler();
+ g_eventLogger.setCategory("NdbApi");
+ g_eventLogger.enable(Logger::LL_ON, Logger::LL_ERROR);
+
m_transporter_facade=
TransporterFacade::theFacadeInstance= new TransporterFacade();